[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Power-fail handling



Hi Jim,

Jim Law wrote:

We have a SystemAce CardFlash with a single FAT partition. Our custom board gives an interrupt when the AC power begins to fail, allowing us at least 20ms of time before on-board power begins to go away. I'm trying to find a reliable way to flush anything that might be in uClinux's buffers to the CardFlash when we get that interrupt. I believe sync() does what we want, but I'm having issues getting there fast enough. We catch the power fail interrupt just fine. Then we throw a signal that gets caught by a handler in our application. Our application priority has been set so we catch the signal reliably quickly in the handler, and so far we're running less than 1ms into our available time. But it seems like the call to sync() does not return reliably in the time available, even if we know there is nothing pending to write to the CardFlash. I don't know if I've chosen a silly way of doing this, or if there is some other side-effect or function of sync() that might be taking the time.

You might try calling emergency_sync() directly from your interrupt handler in the driver, that's how they do it in e.g. drivers/char/sysrq.c

Your driver will have to #include <linux/fs.h> to get the function prototype.

Let us know if this helps, it's a useful capability.

Cheers,

John

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/