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

BSP430 interface to FreeRTOS. More...

#include <bsp430/core.h>
#include <bsp430/clock.h>

Go to the source code of this file.

Macros

#define configBSP430_RTOS_FREERTOS   0
 
#define configBSP430_FREERTOS_SCHEDULER   1
 
#define portACLK_FREQUENCY_HZ   (BSP430_CLOCK_LFXT1_IS_FAULTED_NI() ? BSP430_CLOCK_NOMINAL_VLOCLK_HZ : BSP430_CLOCK_NOMINAL_XT1CLK_HZ)
 
#define configBSP430_HPL_TA0   1
 
#define configBSP430_HAL_TA0_CC0_ISR   0
 

Functions

void vBSP430freertosSuspendScheduler (void)
 
void vBSP430freertosResumeScheduler (void)
 

Detailed Description

BSP430 interface to FreeRTOS.

More specifically, to the BSP430-enabled FreeRTOS port supporting MSPGCC. Other toolchains aren't intentionally excluded, they just aren't supported yet.

This header is not included by any BSP430 code, nor should it be directly included by application code. It is included by the freertos-mspgcc port of FreeRTOS via the portmacro.h header if configBSP430_RTOS_FREERTOS is defined to a true value by the compilation environment. Doing this makes basic BSP430 configuration data available within FreeRTOS application code. Note that this inclusion occurs before FreeRTOS.h includes the application-specific FreeRTOSConfig.h, allowing this file to set defaults for the FreeRTOS port.

The FreeRTOS.h header is similarly included by bsp430/core.h when configBSP430_RTOS_FREERTOS is defined to a true value by the compilation environment. This ensures that the BSP430 infrastructure uses FreeRTOS-compatible mechanisms for critical sections and interrupt management.

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

Macro Definition Documentation

#define configBSP430_FREERTOS_SCHEDULER   1

If defined to a true value, the FreeRTOS-BSP430 port.c file will use the BSP430 timer infrastructure on TA0 for the task scheduler. This requires that configBSP430_HPL_TA0 be true and configBSP430_HAL_TA0_CC0_ISR be false. Use of this feature is compatible with configBSP430_UPTIME, and allows the FreeRTOS scheduler to co-exist with other users of TA0.

Defaulted:
The value here is superseded by previously encountered definitions.
#define configBSP430_HAL_TA0_CC0_ISR   0

FreeRTOS scheduler defines its own TA0 CC0 ISR.

Note
If the setting here conflicts with a setting elsewhere, the compiler should generate a warning.
#define configBSP430_HPL_TA0   1

FreeRTOS scheduler requires use of TA0.

Note
If the setting here conflicts with a setting elsewhere, the compiler should generate a warning.
#define configBSP430_RTOS_FREERTOS   0

Mark that BSP430 will be running under FreeRTOS.

Defining this macro to a true value externally to the system will:

  • Cause the inclusion of bsp430/core.h to also include "FreeRTOS.h", making available the standard FreeRTOS environment to BSP430 library code and defining RTOS-related macros to use the FreeRTOS implementation.

  • Cause the inclusion of "FreeRTOS.h" to include <bsp430/core.h>, make standard BSP430 configuration data available to the FreeRTOS application code.

This cascading effect should be initiated by adding -DconfigBSP430_RTOS_FREERTOS to the CPPFLAGS variable during builds of FreeRTOS applications, including the BSP430 modules linked to the application.

Defaulted:
The value here is superseded by previously encountered definitions.

The FreeRTOS-BSP430 port needs to know the rate at which the scheduler clock runs. This is normally ACLK, but whether ACLK is XT1CLK, VLOCLK, or some other frequency isn't really known.

Todo:
Refine this
Defaulted:
The value here is superseded by previously encountered definitions.

Function Documentation

void vBSP430freertosResumeScheduler ( void  )

Invoke to resume the FreeRTOS scheduler.

This re-enables the task timeslice interrupt and schedules an interrupt after completion of a full timeslice.

The intent is that this be invoked after the application wakes up from a low power mode in which OSCOFF was set.

Note
This function is available only if configBSP430_FREERTOS_SCHEDULER is true.
void vBSP430freertosSuspendScheduler ( void  )

Invoke to suspend the FreeRTOS scheduler.

This does not suspend any tasks, or prevent the scheduler from resuming the way vTaskEndScheduler does. It merely inhibits the task timeslice interrupt. The intent is that this be invoked prior to suspending the application in a low power mode that includes OSCOFF (e.g., LPM4_bits), if it is determined that no task is blocked on a tick-related event.

Note
This function is available only if configBSP430_FREERTOS_SCHEDULER is true.