www.ti.com
Task Events and Event Processing
17
SWRU271H–October 2010–Revised April 2019
Submit Documentation Feedback
Copyright © 2010–2019, Texas Instruments Incorporated
The Operating System Abstraction Layer (OSAL)
3.3 Task Events and Event Processing
After the OSAL initializes, it runs in an infinite loop checking for task events. You can find this loop in the
osal_start_system() function in the OSAL.c file. Task events are stored as unique bits in a 16-bit variable
where each bit corresponds to a unique event. The application determines the definition and use of these
event flags. Figure 3-1 shows a flow diagram of the OSAL processing scheme.
Figure 3-1. OSAL Task Loop
If the SimpleBLEPeripheral application defines a flag in simpleBLEPeripheral.h:
SBP_START_DEVICE_EVT (0x0001) indicating the initial device start is complete, the application
processing begins. The application cannot define one reserved flag value (0x8000). This value
corresponds to the event SYS_EVENT_MSG for messaging between tasks. For more information, see
Section 3.5.
When the OSAL detects an event set for a task, it calls the event processing routine of that task to
process the event. The task layer must add its own event processing routine to the table formed by the
array of function pointers called tasksArr (defined in OSAL_SimpleBLEPeripheral.c for the
SimpleBLEPeripheral example project). The order of the event processing routines in tasksArr is the same
as the order of task IDs in the osalInitTasks() function. Maintaining this task order is required for the
correct software layer to process events.