Mantis Bug Tracker

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000183FirmwareHardware Interfacepublic2011-06-18 16:592011-06-18 16:59
ReporterFred 
Assigned ToFred 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionASAPFixed in Version 
Summary0000183: Provide basic code functionality to handle always-on
DescriptionCopy paste from my diary thread:

When we get told to go to sleep, we need to turn off clocks and so on and so forth and set a flag and disable the main loop, possibly by changing while(TRUE) to while(allSystemsAreGo) where the value of that condition is dependent on clock and sleep states etc.

When we wake up we need to restore all of the above functionality before allowing normal code to run. Some calls to existing init routines could be useful, or made to be useful.

As it turns out, ALL interrupt sources can generate a wakeup, thus all interrupts except some chosen one need to be turned off and disabled before going to sleep, currently I'm thinking "stop all interrupts" then "disable all interrupts cept our wakeup" then "restart general interrupts". Likewise, when waking, the whole lot need to come back on again, cleanly. Currently our interrupt init mechanism sucks anyway, so the foundation to this work is going to be to fix that up and maybe make the control mechanisms for that be generally accessible for use in this scenario. EG, currently the serial interrupt fires once at boot, for no reason...

Thinking about this some more, I guess we'll wind up at the line after the one we went to sleep on, so it'll be something like this:

Code:

notice that its time to sleep
tidy up loose ends
disable all interrupts
disable individual interrupts
enable "all" (just one now) interrupts
record current state and data etc
signal mcu to go to sleep
<hours/days/years go by>
assume that we just woke up (this may need some delay or busy wait loop on some sort of clock flag or similar to prevent wakeup code running while shutting down? RTFM)
fix up all clocks, states, setup variables, etc
reconfigure all interrupts
exit to normal running
Additional InformationOn top of the above, we need to force loss of sync and reset of various other bits of state, such as serial buffers, etc. Don't forget this.
TagsNo tags attached.
FirmwareVersion
Issue TypeNew Feature
Risk of Breakagehigh
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker