BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Functions
sys.h File Reference

Hardware presentation/abstraction for SYS peripheral (SYS). More...

#include <bsp430/periph.h>

Go to the source code of this file.

Macros

#define BSP430_MODULE_SYS   defined(__MSP430_HAS_SYS__)
 
#define BSP430_SYS_FLAG_SYSRST_BOR   0x0001
 
#define BSP430_SYS_FLAG_SYSRST_LPM5WU   0x0002
 
#define BSP430_SYS_FLAG_SYSRST_POR   0x0004
 
#define BSP430_SYS_FLAG_SYSRST_PUC   0x0008
 

Functions

const char * xBSP430sysSYSRSTIVDescription (unsigned int sysrstiv)
 
unsigned int uiBSP430sysSYSRSTGenerator_ni (unsigned int *puiResetFlags)
 

Detailed Description

Hardware presentation/abstraction for SYS peripheral (SYS).

The System Control Module (SYS) is present on 5xx/6xx/FR5xx devices.

Module Configuration Options

None supported.

Hardware Presentation Layer

As there can be only one instance of SYS on any MCU, there is no structure supporting a SYS HPL. Manipulate the peripheral through its registers directly.

Hardware Adaptation Layer

As there can be only one instance of SYS on any MCU, there is no structure supporting a SYS HAL.

The functions provided by this module simplify the extraction of reset causes, notification of type of reset, and translation from MCU-specific reset codes to text cause descriptions.

Homepage
http://github.com/pabigot/bsp430

Macro Definition Documentation

#define BSP430_MODULE_SYS   defined(__MSP430_HAS_SYS__)

Defined on inclusion of <bsp430/periph/sys.h>. The value evaluates to true if the target MCU supports the System Control Module, and false if it does not.

C Preprocessor Only:
This macro may have a value that restricts its use to C preprocessor conditional directives.
#define BSP430_SYS_FLAG_SYSRST_BOR   0x0001

Flag indicating a BOR occurred during the last reset.

Set in the output reset flags parameter by uiBSP430sysSYSRSTGenerator_ni when a reset cause with a priority at least as high as security violation has been recorded.

Examples:
bootstrap/applpm/main.c, platform/exp430f5529/fatfs/main.c, and rf/cc3000/cli/main.c.
#define BSP430_SYS_FLAG_SYSRST_LPM5WU   0x0002

Flag indicating an LPMx.5 wakeup occurred during the last reset.

Set in the output reset flags parameter by uiBSP430sysSYSRSTGenerator_ni when SYSRSTIV_LPM5WU has been recorded.

Examples:
bootstrap/applpm/main.c, platform/exp430f5529/fatfs/main.c, and rf/cc3000/cli/main.c.
#define BSP430_SYS_FLAG_SYSRST_POR   0x0004

Flag indicating a POR occurred during the last reset.

Set in the output reset flags parameter by uiBSP430sysSYSRSTGenerator_ni when a reset cause with a priority at least as high as PMM_DOPOR has been recorded.

Examples:
bootstrap/applpm/main.c, platform/exp430f5529/fatfs/main.c, and rf/cc3000/cli/main.c.
#define BSP430_SYS_FLAG_SYSRST_PUC   0x0008

Flag indicating a PUC occurred during the last reset.

Set in the output reset flags parameter by uiBSP430sysSYSRSTGenerator_ni when any reset cause was recorded.

Examples:
bootstrap/applpm/main.c, platform/exp430f5529/fatfs/main.c, and rf/cc3000/cli/main.c.

Function Documentation

unsigned int uiBSP430sysSYSRSTGenerator_ni ( unsigned int *  puiResetFlags)

Generate the events recorded within the system reset vector.

This routine can be used to determine the cause of a reset. It can also detect whether the reset involves a brownout reset (BOR), which restores everything to its power-on condition, or is a result of an LPMx.5 wakeup, or several other classes of reset.

Recall that an MSP430 power on reset (POR) does not in fact return all values to power on defaults, nor does a power up clear (PUC). See vBSP430pmmInduceBOR().

Parameters
puiResetFlagsOptional pointer to a variable that indicates the class of reset causes encountered. On initial call, the value of the pointed-to variable should be zero; it is updated with BSP430_SYS_FLAG_SYSRST_BOR and related flags as each reset cause is returned.
Returns
A positive integer value corresponding to a SYSRST_type supported on the current microcontroller, or zero if all such values have been returned. Values are even and constrained to be no greater than 31.
Examples:
bootstrap/applpm/main.c, platform/exp430f5529/fatfs/main.c, and rf/cc3000/cli/main.c.
const char* xBSP430sysSYSRSTIVDescription ( unsigned int  sysrstiv)

Get the text describing the reset cause

The integer value returned by uiBSP430sysSYSRSTGenerator_ni() identifies an MCU-specific constant such as SYSRSTIV_WDTTO, but the value of that constant is different on different MCUs. This routine will map the integer value to the text description of the reset cause.

Parameters
sysrstivan integer reset cause value returned from uiBSP430sysSYSRSTGenerator_ni()
Returns
a text description of the reset cause that is being returned, or a null pointer if sysrstiv is not recognized.
Examples:
bootstrap/applpm/main.c, platform/exp430f5529/fatfs/main.c, and rf/cc3000/cli/main.c.