How to gracefully power-off?

  • Hello,


    We are using WEC2013 on efusA9X boards. To power off the device we do the following:


    Code
    1. 1. Finish file operations in our application.
    2. 2. Call SetSystemPowerState(NULL, POWER_STATE_USERIDLE, 0);
    3. (leads into the same power state as ndcucfg's "ScreenOff" does).
    4. 3. Wait 1 second.
    5. 4. Switch power of the efusA9X-board off.


    When doing so, is there a risk that there is still data in the cache of the file system that has not yet been written, if power management is enabled in the kernel?


    Would it be better to call

    Code
    1. FileSystemPowerFunction(FSNOTIFY_POWER_OFF);
    2. PowerOffSystem();

    before switching off or is this done by the power management anyway when entering POWER_STATE_USERIDLE?


    Best regards,

    Habi

  • Hello,


    USER_IDLE is redundant it does not prevent that any open file buffers will be flushed.


    Else this is a difficult question while using (ex)FAT. There are a lot of flags, registry settings and OS functions to short and ensure that buffered data is be written to a file. But it is an enourmous task to handle it in reality. For example different threads/thread priorities or use of implizite buffers (.NET/ third party SW) may delay the process.


    So i recomment use of F3S. Than you can be sure that in worst case the last consitent state of the files/registry are still valid.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.