xiaoxiang781216 commented on pull request #2942:
URL: https://github.com/apache/incubator-nuttx/pull/2942#issuecomment-788141620


   > @xiaoxiang781216 - What is the use case for this?
   
   Normally, when XIP flash is programmed, to avoid MCU fetch other(random) 
code from flash and then hang the system because the flash can't read and 
erase/write at the same time, we have:
   
   1. Load progmem driver to RAM
   2. Disable interrupt during erase and write
   
   But, the interrupt latency may become unacceptable since it take a long 
time(~20ms) to program one flash block. So some progmem driver support some 
suspend/resume mechanism during programming by:
   
   1. Check whether there is any pending interrupt waiting for some threshold
   2. Command the flash part to enter the suspend state if item 1 is true
   3. Renable interrupt to process the pending interrupt as needed
   
   Before the scheduler select the flash thread again, other threads may get 
the chance to run and then try to read flash. In this case, the flash part is 
still in the suspend state, progmem driver need do some housekeeping work to 
restore the flash state.
   up_progmem_read callback is used for this particular case.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to