File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -598,18 +598,12 @@ pub struct Api {
598598 /// On a microcontroller, this will wait for interrupts. Running in an
599599 /// emulator, this will sleep the thread for a while.
600600 pub power_idle : extern "C" fn ( ) ,
601- /// The OS will call this function to turn the power off .
601+ /// The OS will call this function to control power on this system .
602602 ///
603603 /// This function will not return, because the system will be switched off
604604 /// before it can return. In the event on an error, this function will hang
605605 /// instead.
606- pub power_off : extern "C" fn ( ) -> !,
607- /// The OS will call this function to reboot the system.
608- ///
609- /// This function will not return, because the system will be rebooted
610- /// before it can return. In the event on an error, this function will hang
611- /// instead.
612- pub power_reboot : extern "C" fn ( ) -> !,
606+ pub power_control : extern "C" fn ( mode : PowerMode ) -> !,
613607
614608 // ========================================================================
615609 // Mutex functions
Original file line number Diff line number Diff line change @@ -105,6 +105,21 @@ pub struct MemoryRegion {
105105 pub kind : MemoryKind ,
106106}
107107
108+ /// The kinds of power control we can do.
109+ #[ repr( C ) ]
110+ #[ derive( Debug , Copy , Clone ) ]
111+ pub enum PowerMode {
112+ /// Turn the system power off
113+ Off ,
114+ /// Reboot the main processor
115+ Reset ,
116+ /// Reboot the main processor, but tell it to enter a bootloader mode for
117+ /// programming. Precisely what this will do will depend upon the BIOS. Some
118+ /// BIOSes will not have a bootloader mode and this will do a regular
119+ /// reboot.
120+ Bootloader ,
121+ }
122+
108123// ============================================================================
109124// Impls
110125// ============================================================================
You can’t perform that action at this time.
0 commit comments