📄 readme
字号:
README for pwrmgt.cThis is a small sample program that demonstrates the mos_thread_sleep(time)function and the power management capability. They are related. In a single threaded system, mos_thread_sleep(time) would be functionally equivalent, that is, the MCU enters power-save mode when a thread calls mos_thread_sleep.Since Mantis OS (mos) is a multithreaded system, mos_thread_sleep() works alaunix sleep. The thread sleeps for the specified time, the MCU enters power-savemode only when the systems enters the idle loop (no more threads ready to execute). A enable_pwr_mgt() is provided becasue it makes power management explicit and places wake up obligations on the application. Applications may use mos_thread_sleep() to fulfill this obligation becasue this funtion uses Timer/Counter0 to wakeup the MCU. See ATmega128L manual for further details.Usage:/* mos_thread_sleep(x) * where x = 1...256 * for example: * x = 1 = sleep for 0.03125 secs. or 31.25 ms * x = 2 = sleep for 0.0625 secs or 62.5 ms * x = 3 = sleep for 0.09375 secs or 93.75 ms * . * . * . * x = 32 = sleep for 1 sec * . * . * . * x = 64 = sleep for 2 secs. * x = 128 = sleep for 4 secs. * x = 256 = sleep for 8 secs. */This small application can be used to test mos_thread_sleep and pwr mgt byminor changes to the application. However, the nodes must be instrumented to verify pwr mgt. Although exhaustive testing is impractical, I have verifiedthat the code works for nymphs and mica2s. Also, I tired different time durations for multiple threads to verify that the threads are scheduled correctly. Most of the related code is in mantis/src/mos/arch/avrn the following files:msched.c/msched.h, timer.c/timer.h and tlist.c/tlist.h.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -