module ti.sysbios.family.msp430.Power

Power Manager Module

This module provides functions that can be called to reduce MSP430 power consumption. [ more ... ]
C synopsis target-domain sourced in ti/sysbios/family/msp430/Power.xdc
#include <ti/sysbios/family/msp430/Power.h>
Functions
Void 
Void 
Void 
Void 
Functions common to all target modules
Typedefs
typedef enum
typedef enum
typedef Void 
Constants
extern const Bool 
extern const Error_Id 
extern const Bool 
extern const Power_IdleMode 
extern const Power_SleepPrepFuncPtr 
 
DETAILS
This module provides functions that can be called to reduce MSP430 power consumption.

Calling Context

Function Hwi Swi Task Main Startup
idleCPU N N N N N
changeIdleMode Y Y Y Y Y
sleepCPU N N Y N N
wakeCPU Y N N N N
Definitions:
  • Hwi: API is callable from a Hwi thread.
  • Swi: API is callable from a Swi thread.
  • Task: API is callable from a Task thread.
  • Main: API is callable from main().
  • Startup: API is callable during any module startup.
 
enum Power_IdleMode

Available idle modes

C synopsis target-domain
typedef enum Power_IdleMode {
    Power_LPM0,
    Power_LPM1,
    Power_LPM2,
    Power_LPM3,
    Power_LPM4
} Power_IdleMode;
 
 
enum Power_SleepMode

Available sleep modes

C synopsis target-domain
typedef enum Power_SleepMode {
    Power_Sleep_LPM4_5
    // Shutdown (LPM4.5)
} Power_SleepMode;
 
 
typedef Power_SleepPrepFuncPtr

Sleep mode preparation function type definition

C synopsis target-domain
typedef Void (*Power_SleepPrepFuncPtr)();
 
 
config Power_E_dynamicModeNotAllowed  // module-wide

Dynamic mode not allowed error

C synopsis target-domain
extern const Error_Id Power_E_dynamicModeNotAllowed;
 
DETAILS
This Error is raised if there is an attempt to change idleMode at runtime, or trigger a dynamic CPU wakeup, and allowDynamicMode is set to "false".
 
config Power_allowDynamicMode  // module-wide

Allow dynamic changes to idleMode (changeIdleMode), or dynamically waking the CPU upon return from interrupt (wakeCPU), at runtime?

C synopsis target-domain
extern const Bool Power_allowDynamicMode;
 
 
config Power_idle  // module-wide

Idle CPU when threads blocked waiting for an interrupt?

C synopsis target-domain
extern const Bool Power_idle;
 
 
config Power_idleMode  // module-wide

Idle mode for CPU to enter while waiting for an interrupt

C synopsis target-domain
extern const Power_IdleMode Power_idleMode;
 
 
config Power_sleepPrepFunction  // module-wide

I/O preparation function to be called by Power_sleepCPU()

C synopsis target-domain
extern const Power_SleepPrepFuncPtr Power_sleepPrepFunction;
 
 
Power_changeIdleMode()  // module-wide

Change the idleMode used for idling the CPU

C synopsis target-domain
Void Power_changeIdleMode(Power_IdleMode mode);
 
DETAILS
This function does not immediately affect the state of the CPU, but defines the idleMode that will be invoked at subsequent opportunities SYS/BIOS has to idle the CPU.
Changing the idleMode at runtime requires that idle be enabled, the initial idleMode is defined, and allowDynamicMode is specified in the application configuration. For example:
  var Power = xdc.useModule('ti.sysbios.family.msp430.Power');
  Power.idle = true;
  Power.idleMode = Power.LPM3;
  Power.allowDynamicMode = true;
 
Power_idleCPU()  // module-wide

Function to automatically idle the CPU during idle time

C synopsis target-domain
Void Power_idleCPU();
 
DETAILS
When the idle configuration parameter is set, this function will be added to the list of Idle loop functions. When called from the Idle loop, it will transition the CPU into the idle mode specified by the idleMode configuration parameter. The CPU will stay in the corresponding low power mode until the next interrupt occurs.
 
Power_sleepCPU()  // module-wide

Function called by the application to sleep the CPU

C synopsis target-domain
Void Power_sleepCPU(Power_SleepMode sleepMode);
 
DETAILS
This function currently supports the LPM4.5 sleep mode only, and only on MSP430 devices that support this mode. To be effective, the device I/Os MUST be properly configured before LPM4.5 is activated, otherwise there may be excessive current draw, which could be higher than before this function is called. The proper configuration of I/Os is device, application, and board specific. The caller of this function has two options:
1) Prepare the device I/Os, and any (non-reset) wakeup interrupts prior to calling this function, or 2) Write a function for this purpose, and configure it as the optional sleepPrepFunction, that Power_sleepCPU() should call before transitioning to LPM4.5.
 
Power_wakeCPU()  // module-wide

Function called to trigger a dynamic CPU wakeup upon return from interrupt

C synopsis target-domain
Void Power_wakeCPU();
 
DETAILS
An interrupt can be configured statically (at build time) to let the CPU naturally resume an LPM mode upon return from interrupt (see Hwi).
This function (Power_wakeCPU()) can be called from within an ISR function to override the static configuration (where the CPU would resume an LPM mode), and force the CPU to stay awake upon return from interrupt.
For the case of nested interrupts, the effect of this API is for the bottom-most (or first-preempting) interrupt, meaning that if this function is called from an ISR that has nested upon another, the CPU will be kept awake after the interrupt that first awoke the CPU.
To call this function, it is required that allowDynamicMode is specified as 'true' in the application configuration. For example:
  var Power = xdc.useModule('ti.sysbios.family.msp430.Power');
  Power.allowDynamicMode = true;
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Power_Module_id();
// Get this module's unique id
 
Bool Power_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Power_Module_heap();
// The heap from which this module allocates memory
 
Bool Power_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 Power_Module_getMask();
// Returns the diagnostics mask for this module
 
Void Power_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
 
XDCscript usage meta-domain sourced in ti/sysbios/family/msp430/Power.xdc
var Power = xdc.useModule('ti.sysbios.family.msp430.Power');
module-wide constants & types
        const Power.LPM0;
        const Power.LPM1;
        const Power.LPM2;
        const Power.LPM3;
        const Power.LPM4;
 
module-wide config parameters
        msg: "E_dynamicModeNotAllowed: Dynamic mode is not enabled (allowDynamicMode=false)"
    };
 
 
 
enum Power.IdleMode

Available idle modes

XDCscript usage meta-domain
values of type Power.IdleMode
    const Power.LPM0;
    const Power.LPM1;
    const Power.LPM2;
    const Power.LPM3;
    const Power.LPM4;
 
C SYNOPSIS
 
enum Power.SleepMode

Available sleep modes

XDCscript usage meta-domain
values of type Power.SleepMode
    const Power.Sleep_LPM4_5;
    // Shutdown (LPM4.5)
 
C SYNOPSIS
 
config Power.E_dynamicModeNotAllowed  // module-wide

Dynamic mode not allowed error

XDCscript usage meta-domain
Power.E_dynamicModeNotAllowed = Error.Desc {
    msg: "E_dynamicModeNotAllowed: Dynamic mode is not enabled (allowDynamicMode=false)"
};
 
DETAILS
This Error is raised if there is an attempt to change idleMode at runtime, or trigger a dynamic CPU wakeup, and allowDynamicMode is set to "false".
C SYNOPSIS
 
config Power.allowDynamicMode  // module-wide

Allow dynamic changes to idleMode (changeIdleMode), or dynamically waking the CPU upon return from interrupt (wakeCPU), at runtime?

XDCscript usage meta-domain
Power.allowDynamicMode = Bool false;
 
C SYNOPSIS
 
config Power.idle  // module-wide

Idle CPU when threads blocked waiting for an interrupt?

XDCscript usage meta-domain
Power.idle = Bool true;
 
C SYNOPSIS
 
config Power.idleMode  // module-wide

Idle mode for CPU to enter while waiting for an interrupt

XDCscript usage meta-domain
Power.idleMode = Power.IdleMode Power.LPM0;
 
C SYNOPSIS
 
config Power.sleepPrepFunction  // module-wide

I/O preparation function to be called by Power_sleepCPU()

XDCscript usage meta-domain
Power.sleepPrepFunction = Void(*)() undefined;
 
C SYNOPSIS
 
metaonly config Power.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
Power.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
generated on Thu, 01 Mar 2012 16:57:24 GMT