BSP430
20141115
Board Support Package for MSP430 microcontrollers
|
Entrypoint for platform-specific capabilities. More...
Go to the source code of this file.
Functions | |
void | vBSP430platformInitialize_ni (void) |
int | iBSP430platformConfigurePeripheralPins_ni (tBSP430periphHandle periph, int periph_config, int enablep) |
void | vBSP430platformSpinForJumper_ni (void) |
const char * | xBSP430platformPeripheralHelp (tBSP430periphHandle periph, int periph_config) |
Entrypoint for platform-specific capabilities.
This header defines prototypes for functions that are implemented in the platform-specific implementation file.
Further, if a recognized platform selection macro is defined to a true value, the corresponding platform-specific header will be included for you. Platform-specific headers are included based on the definitions of:
#define BSP430_PLATFORM_BOOT_ACLK_DIVIDING_SHIFT 0 |
The ACLK dividing shift configured at boot if BSP430_PLATFORM_BOOT_CONFIGURE_CLOCKS is true.
Several clock peripherals support dividing the input signal to reduce jitter or slow the clock. This option corresponds to the DIVA field in such a peripheral.
The option is ignored unless the clock peripheral supports dividing the ACLK source.
#define BSP430_PLATFORM_BOOT_ACLK_SOURCE eBSP430clockSRC_XT1CLK_FALLBACK |
The ACLK source configured at boot if BSP430_PLATFORM_BOOT_CONFIGURE_CLOCKS is true.
On most MCUs, the power-up-clear default would be equivalent to using eBSP430clockSRC_XT1CLK. However, on MCUs that use BC2 the absence of a crystal will cause this setting to leave the LFXT1 fault present, which causes ulBSP430clockConfigureMCLK_ni() to hang because it cannot distinguish that fault from a DCO fault. Consequently, the BSP430 default will fall back to a non-crystal source if the crystal is unstable. This is particularly important for pre-5xx MCUs where the peripheral pins associated with the crystal power-up in their peripheral mode enabling the crystal.
Also consider BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 since 5xx/6xx family MCUs do not automatically configure the peripheral pins to enable XIN/XOUT to function even if the crystal is present.
#define BSP430_PLATFORM_BOOT_CONFIGURE_CLOCKS 1 |
If defined to a true value, vBSP430platformInitialize_ni() will configure the MCLK, SMCLK, and ACLK clock infrastructure.
If defined to a false value, vBSP430platformInitialize_ni() will leave the clocks in their power-up configuration.
#define BSP430_PLATFORM_BOOT_CONFIGURE_LEDS 1 |
If defined to a true value and BSP430_LED is also true, vBSP430platformInitialize_ni() will invoke vBSP430ledInitialize_ni() prior to the crystal stabilization phase of platform initialization.
#define BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 0 |
If defined to a true value, vBSP430platformInitialize_ni() will:
If defined to a false value, platforms which power-up with the crystal pins configured for their peripheral mode (specifically, 2xx family devices including the EXP430G2 "Launchpad" ), should:
Other platforms may treat this as if BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 was left undefined.
If BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 is left undefined, vBSP430platformInitialize_ni() will leave the crystal in its power-up configuration. For most clock peripherals this is a faulted mode because the XIN/XOUT pins are reset to digital I/O rather than peripheral function mode. For 2xx-family devices the pins are defaulted to peripheral function mode, and the BC2 configuration will normally use the crystal if it is populated.
#define BSP430_PLATFORM_BOOT_CONFIGURE_XT2 0 |
Same as BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 except configures XT2
If defined to a true value, vBSP430platformInitialize_ni() will invoke iBSP430clockConfigureXT2_ni() to enable and stabilize the crystal.
This has no effect if XT2 is not supported on the platform.
#define BSP430_PLATFORM_BOOT_DISABLE_WATCHDOG (! (configBSP430_CORE_SUPPORT_WATCHDOG - 0)) |
If defined to a true value vBSP430platformInitialize_ni() will set the watchdog infrastructure into a reset state prior to any other activities.
If configBSP430_CORE_SUPPORT_WATCHDOG is true then this is defaulted to false; otherwise it is defaulted to true.
#define BSP430_PLATFORM_BOOT_LFXT1_DELAY_SEC 1 |
The number of seconds that vBSP430platformInitialize_ni() should use in calculating the loop count parameter to iBSP430clockConfigureLFXT1_ni() while attempting to stabilize the clock.
Set this to zero on platforms that don't have a crystal.
#define BSP430_PLATFORM_BOOT_SMCLK_DIVIDING_SHIFT 0 |
The SMCLK dividing shift configured at boot if BSP430_PLATFORM_BOOT_CONFIGURE_CLOCKS is true.
Several clock peripherals support dividing the input signal to reduce jitter or slow the clock. This option corresponds to the DIVS field in such a peripheral.
The option is ignored unless the clock peripheral supports dividing the SMCLK source.
#define BSP430_PLATFORM_BOOT_SMCLK_SOURCE eBSP430clockSRC_SMCLK_PU_DEFAULT |
The SMCLK source configured at boot if BSP430_PLATFORM_BOOT_CONFIGURE_CLOCKS is true.
On most MCUs, the power-up-clear default will be equivalent having SMCLK and MCLK run at the same rate. In some cases it might be desirable to use an external crystal as the source for SMCLK.
#define BSP430_PLATFORM_BUTTON0 include <bsp430/platform.h> |
Defined by the infrastructure if configBSP430_PLATFORM_BUTTON0 is true. The defined value evaluates to true if the button is supported by the platform, and to false if the button is not supported.
BSP430_PLATFORM_BUTTON1
) are also defined, up to button 3.#define BSP430_PLATFORM_BUTTON0_PORT_BIT include <bsp430/platform.h> |
A platform-specific identification of the bit on BSP430_PLATFORM_BUTTON0_PORT_PERIPH_HANDLE that is associated with the platform's primary button.
The value is defined if the platform supports a button, regardless of whether configBSP430_PLATFORM_BUTTON0 is set. The latter must be set in order for the HAL interface to the button to be enabled automatically.
BSP430_PLATFORM_BUTTON1_PORT_BIT
) may also be defined, up to button 3.#define BSP430_PLATFORM_BUTTON0_PORT_PERIPH_HANDLE include <bsp430/platform.h> |
A platform-specific identification of a port device handle through which the platform's primary button is controlled.
The value is defined if the platform supports a button, regardless of whether configBSP430_PLATFORM_BUTTON0 is set. The latter must be set in order for the HAL interface to the button to be enabled automatically.
BSP430_PLATFORM_BUTTON1_PORT_PERIPH_HANDLE
) may also be defined, up to button 3.#define BSP430_PLATFORM_CUSTOM 0 |
Define to a true value if application is being built for a custom (out-of-tree) platform.
A true value causes <bsp430/platform.h> to include corresponding platform-specific header <bsp430/platform/custom/platform.h>.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/custom/bsp430_config.h> for you.
Custom platform files should not be placed within the BSP430 source or install area, but are included using a path that makes them appear to be there. This is primarily to avoid any confusion due to accidental resolution of an unadorned include of "platform.h"
or "bsp430_config.h"
to the wrong file. It is the responsibility of the application developer to ensure that the include directories provided to the compiler allow the custom platform headers to be located at the necessary paths.
Alternatively, you could have your application include the custom platform files directly and bypass any reference to <bsp430/platform.h> or <bsp430/platform/bsp430_config.h>.
#define BSP430_PLATFORM_EM430 0 |
Define to a true value if application is being built for the EM430 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/em430/platform.h>. If you include that header directly, BSP430_PLATFORM_EM430 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/em430/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430F5438 0 |
Define to a true value if application is being built for the MSP-EXP430F5438 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430f5438/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430F5438 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430f5438/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430F5529 0 |
Define to a true value if application is being built for the MSP-EXP430F5529 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430f5529/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430F5529 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430f5529/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430F5529LP 0 |
Define to a true value if application is being built for the MSP-EXP430F5529LP platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430f5529lp/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430F5529LP will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430f5529lp/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430FG4618 0 |
Define to a true value if application is being built for the MSP-EXP430FG4618 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430fg4618/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430FG4618 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430fg4618/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430FR4133 0 |
Define to a true value if application is being built for the MSP-EXP430FR4133 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430fr4133/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430FR4133 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430fr4133/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430FR5739 0 |
Define to a true value if application is being built for the MSP-EXP430FR5739 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430fr5739/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430FR5739 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430fr5739/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430FR5969 0 |
Define to a true value if application is being built for the MSP-EXP430FR5969 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430fr5969/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430FR5969 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430fr5969/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_EXP430G2 0 |
Define to a true value if application is being built for the MSP-EXP430G2 platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/exp430g2/platform.h>. If you include that header directly, BSP430_PLATFORM_EXP430G2 will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/exp430g2/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_PERIPHERAL_HELP 1 /* True unless platform explicitly disabled it */ |
Defined to indicate that the application or infrastructure supports use of the vBSP430platformSpinForJumper_ni() function. The value is defined only if configBSP430_PLATFORM_PERIPHERAL_HELP is set, and is true only if the platform supports xBSP430platformPeripheralHelp().
#define BSP430_PLATFORM_RF2500T 0 |
Define to a true value if application is being built for the EZ430-RF2500T platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/rf2500t/platform.h>. If you include that header directly, BSP430_PLATFORM_RF2500T will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/rf2500t/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_SPIN_FOR_JUMPER 0 /* False unless platform explicitly enabled it */ |
Defined to indicate that the application or infrastructure supports use of the vBSP430platformSpinForJumper_ni() function. The value is defined only if configBSP430_PLATFORM_SPIN_FOR_JUMPER is set, and is true only if the platform supports vBSP430platformSpinForJumper_ni().
#define BSP430_PLATFORM_SURF 0 |
Define to a true value if application is being built for the SURF platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/surf/platform.h>. If you include that header directly, BSP430_PLATFORM_SURF will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/surf/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_TRXEB 0 |
Define to a true value if application is being built for the TRXEB platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/trxeb/platform.h>. If you include that header directly, BSP430_PLATFORM_TRXEB will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/trxeb/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define BSP430_PLATFORM_WOLVERINE 0 |
Define to a true value if application is being built for the WOLVERINE platform.
A true value causes <bsp430/platform.h> to include the corresponding platform-specific header <bsp430/platform/wolverine/platform.h>. If you include that header directly, BSP430_PLATFORM_WOLVERINE will be defined for you.
A true value also causes <bsp430/platform/bsp430_config.h> to include <bsp430/platform/wolverine/bsp430_config.h> for you. You should not include that header directly, as it coordinates with the generic platform version.
#define configBSP430_PLATFORM_BUTTON0 0 |
Define to a true value if the application will want to use the primary button (if any) supported by a platform.
configBSP430_PLATFORM_BUTTON1
) are also defined with default values of 0, up to button 3.#define configBSP430_PLATFORM_PERIPHERAL_HELP 0 |
Define to a true value if the application will want to invoke xBSP430platformPeripheralHelp().
#define configBSP430_PLATFORM_RF 0 |
Define to a true value to enable any built-in radio platform.
For example, this enables configBSP430_RF_RF2500T when on BSP430_PLATFORM_RF2500T.
Platforms reference this macro only when there is a hard-wired radio. For pluggable radios specific defines like configBSP430_RF_CC2520EMK or configBSP430_RF_ANAREN_CC110L must be used.
#define configBSP430_PLATFORM_SPIN_FOR_JUMPER 0 |
Define to a true value to indicate that the application or infrastructure suggests use of the vBSP430platformSpinForJumper_ni() function.
This value represents an application or system request for the feature; availability of the feature must be tested using BSP430_PLATFORM_SPIN_FOR_JUMPER.
int iBSP430platformConfigurePeripheralPins_ni | ( | tBSP430periphHandle | periph, |
int | periph_config, | ||
int | enablep | ||
) |
Configure the pins associated with a given peripheral.
Implementers should consult the MCU data sheet to determine the appropriate port selection register configuration. Note that in many cases it is not necessary to configure the port direction (e.g. P1DIR) for peripheral functions (e.g. UCA0RXD and UCA0TXD). In some cases it is not necessary to configure XOUT if XIN is configured.
periph | Raw peripheral device for which pins should be configured. |
periph_config | Flag controlling which pins of the peripheral will be configured. A value of zero indicates a platform and peripheral-specific default. Generic flag values include BSP430_PERIPHCFG_SERIAL_UART, BSP430_PERIPHCFG_SERIAL_I2C, BSP430_PERIPHCFG_SERIAL_SPI3, and BSP430_PERIPHCFG_SERIAL_SPI4. |
enablep | TRUE to enable for peripheral use; FALSE to disable (return to general purpose IO). When disabled, the direction and output register bits are configured for low power use (output zero). Note that only the pins specified by periph_config will be modified. |
void vBSP430platformInitialize_ni | ( | void | ) |
Basic configuration for the platform.
Applications should assume that invoking this in main() will configure the system based on requested settings.
Basic configuration for the platform.
This routine should:
If your platform does not need to do anything special, you can re-use the standard implementation of this function by including this in your platform-specific platform.c
file:
This standard implementation can be customized through several of the macros listed above.
void vBSP430platformSpinForJumper_ni | ( | void | ) |
Block until a platform-specific jumper has been removed.
Several platforms that use a TIUSB device to provide serial port emulation, including the MSP430 LaunchPad and the EXP430FR5739, must not transmit any data while a driver is initializing, especially on Linux systems. We need a way to hold off an installed application from writing to the serial port until that's happened. What we do is, if a platform-specific pin is grounded, block until it's released. When plugging in a device for the first time, place a jumper connecting that pin to ground, wait for the driver to load, then remove the jumper.
The platform-specific header should document whether this function is supported, and if it is what jumper configuration is recognized.
const char* xBSP430platformPeripheralHelp | ( | tBSP430periphHandle | periph, |
int | periph_config | ||
) |
Provide peripheral-specific help strings for application integration
For cross-platform applications it is helpful if the startup text describes any external connections. Since, for example, pins associated with an I2C interface are platform-specific, that information belongs in the platform rather than the application.
This routine should be implemented on all platforms, and any peripheral supported by vBSP430platformConfigurePeripheralPins_ni() should produce a help string.
periph | Raw peripheral device for which help is desired |
periph_config | Flag as passed to iBSP430platformConfigurePeripheralPins_ni() as the periph_config value. A value of zero will describe all potential pins for the peripheral. |