I would like to make a suggestion to the designers of the Flash API.
For those API functions that require disabling of interrupts to operate properly, don't expect the user of the API routine to disable interrupts.
Preserve the interrupt state at the beginning of the API call, then disable interrupts within the API call for the critical sections of code.
Restore the interrupt state upon return from the API call.
In this way, a user of the API can start out with interrupts enabled. Inside the API call, only the critical sections of code need to have interrupts disabled.
If the API call is made with interrupts disabled, the the API call would leave interrupts disabled for the entire API call.
Andy