SYS/BIOS
7.00
|
SYS/BIOS Top-Level Manager.
This module is responsible for setting up global parameters pertaining to SYS/BIOS and for performing the SYS/BIOS startup sequence.
The SYS/BIOS startup sequence is logically divided into two phases: those operations that occur prior to the application's "main()" function being called, and those operations that are performed after the application's "main()" function is invoked.
The "before main()" startup sequence is governed completely by the ti/sysbios/runtime/Startup module.
The "after main()" startup sequence is governed by SYS/BIOS and is initiated by an explicit call to the BIOS_start function at the end of the application's main() function.
Control points are provided at various places in each of the two startup sequences for user startup operations to be inserted.
The RTSC runtime startup sequence is as follows:
The SYS/BIOS startup sequence begins at the end of main() when BIOS_start() is called:
Below is a configuration script excerpt that installs a user-supplied startup function at every possible control point in the RTSC and SYS/BIOS startup sequence:
Function | Hwi | Swi | Task | Main | Startup |
---|---|---|---|---|---|
getCpuFreq | Y | Y | Y | Y | Y |
getThreadType | Y | Y | Y | Y | N |
setCpuFreq | Y | Y | Y | Y | Y |
start | N | N | N | Y | N |
Definitions:
|
#include <xdc/std.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ti/sysbios/runtime/Types.h>
Go to the source code of this file.
Macros | |
#define | ti_sysbios_BIOS_version (0x70300) |
#define | BIOS_WAIT_FOREVER (~(0U)) |
Used in APIs that take a timeout to specify wait forever. More... | |
#define | BIOS_NO_WAIT (0U) |
Used in APIs that take a timeout to specify no waiting. More... | |
Typedefs | |
typedef enum BIOS_ThreadType | BIOS_ThreadType |
typedef enum BIOS_RtsLockType | BIOS_RtsLockType |
typedef void(* | BIOS_StartupFuncPtr) (void) |
User startup function type definition. More... | |
typedef void(* | BIOS_StartFuncPtr) (void) |
typedef void(* | BIOS_ExitFuncPtr) (int arg1) |
Enumerations | |
enum | BIOS_ThreadType { BIOS_ThreadType_Hwi, BIOS_ThreadType_Swi, BIOS_ThreadType_Task, BIOS_ThreadType_Main } |
Current thread type definitions. More... | |
enum | BIOS_RtsLockType { BIOS_NoLocking, BIOS_GateHwi, BIOS_GateSwi, BIOS_GateMutex, BIOS_GateMutexPri } |
Type of Gate to use in the TI RTS library. More... | |
Functions | |
void | BIOS_start (void) |
Start SYS/BIOS. More... | |
void | BIOS_exit (int stat) |
Exit currently running SYS/BIOS executable. More... | |
BIOS_ThreadType | BIOS_getThreadType (void) |
Get the current thread type. More... | |
void | BIOS_setCpuFreq (Types_FreqHz *freq) |
Set CPU Frequency in Hz. More... | |
void | BIOS_getCpuFreq (Types_FreqHz *freq) |
Get CPU frequency in Hz. More... | |
Variables | |
const Types_FreqHz | BIOS_cpuFreq |
CPU frequency in Hz. More... | |
const bool | BIOS_taskEnabled |
SYS/BIOS Task services enable flag. More... | |
const bool | BIOS_swiEnabled |
SYS/BIOS Swi services enable flag. More... | |
const bool | BIOS_clockEnabled |
SYS/BIOS Clock services enable flag. More... | |
const size_t | BIOS_heapSize |
Size of system heap, units are in MAUs. More... | |
const bool | BIOS_heapTrackEnabled |
Use HeapTrack with system default heap. More... | |
#define ti_sysbios_BIOS_version (0x70300) |
#define BIOS_WAIT_FOREVER (~(0U)) |
Used in APIs that take a timeout to specify wait forever.
#define BIOS_NO_WAIT (0U) |
Used in APIs that take a timeout to specify no waiting.
typedef enum BIOS_ThreadType BIOS_ThreadType |
typedef enum BIOS_RtsLockType BIOS_RtsLockType |
typedef void(* BIOS_StartupFuncPtr) (void) |
User startup function type definition.
typedef void(* BIOS_StartFuncPtr) (void) |
typedef void(* BIOS_ExitFuncPtr) (int arg1) |
enum BIOS_ThreadType |
Current thread type definitions.
These values are returned by BIOS_getThreadType.
Enumerator | |
---|---|
BIOS_ThreadType_Hwi | |
BIOS_ThreadType_Swi | |
BIOS_ThreadType_Task | |
BIOS_ThreadType_Main |
enum BIOS_RtsLockType |
Type of Gate to use in the TI RTS library.
void BIOS_start | ( | void | ) |
Start SYS/BIOS.
The user's main() function is required to call this function after all other user initializations have been performed.
This function does not return.
This function performs any remaining SYS/BIOS initializations and then transfers control to the highest priority ready task if BIOS_taskEnabled is true. If BIOS_taskEnabled is false, control is transferred directly to the Idle Loop.
The SYS/BIOS start sequence is as follows:
void BIOS_exit | ( | int | stat | ) |
Exit currently running SYS/BIOS executable.
This function is called when a SYS/BIOS executable needs to terminate normally. This function sets the internal SYS/BIOS threadType to BIOS_ThreadType_Main and then calls System_exit passing along the 'stat' argument.
All functions bound via System_atexit or the ANSI C Standard Library atexit function are then executed.
stat | exit status to return to calling environment. |
BIOS_ThreadType BIOS_getThreadType | ( | void | ) |
Get the current thread type.
Current | thread type |
void BIOS_setCpuFreq | ( | Types_FreqHz * | freq | ) |
Set CPU Frequency in Hz.
This API is not thread safe. Please use appropriate locks.
void BIOS_getCpuFreq | ( | Types_FreqHz * | freq | ) |
Get CPU frequency in Hz.
This API is not thread safe. Please use appropriate locks.
const Types_FreqHz BIOS_cpuFreq |
CPU frequency in Hz.
This configuration parameter allows SYS/BIOS to convert various periods between timer ticks (or instruction cycles) and real-time units. For example, timer periods expressed in micro-seconds need to be converted into timer ticks in order to properly program the timers.
If CPU frequency is 100MHz, the following configuration script configures SYS/BIOS with the proper clock frequency:
const bool BIOS_taskEnabled |
SYS/BIOS Task services enable flag.
The following behaviors occur when BIOS_taskEnabled is set to false:
const bool BIOS_swiEnabled |
SYS/BIOS Swi services enable flag.
The following behaviors occur when BIOS_swiEnabled is set to false:
const bool BIOS_clockEnabled |
SYS/BIOS Clock services enable flag.
The following behaviors occur when BIOS_clockEnabled is set to false:
const size_t BIOS_heapSize |
Size of system heap, units are in MAUs.
The system heap is, by default, used to allocate instance object state structures, such as Task objects and their stacks, Semaphore objects, etc.
const bool BIOS_heapTrackEnabled |
Use HeapTrack with system default heap.
This configuration parameter will add a HeapTrack instance on top of the system heap. HeapTrack adds a tracker packet to every allocated buffer and displays the information in RTOS Object Viewer (ROV). An assert will be raised on a free if there was a buffer overflow.