TI BLE5-Stack API Documentation  9.14.00
Macros | Typedefs | Functions | Variables
osal.h File Reference

Detailed Description

This API allows the software components in the Z-Stack to be written independently of the specifics of the operating system, kernel, or tasking environment (including control loops or connect-to-interrupt systems).

Go to the source code of this file.

Macros

#define INTS_ALL   0xFF
 All interrupts. More...
 
#define LL_EVT_ADDRESS_RESOLUTION_TIMEOUT   0x00001000u
 
#define LL_EVT_ADV_LAST_CMD_DONE   0x00010000u
 
#define LL_EVT_ADV_RX_AVAIL   0x08000000u
 
#define LL_EVT_ADV_TX_BUFF_FINISHED   0x10000000u
 
#define LL_EVT_CENTRAL_CONN_CANCELLED   0x00000010u
 
#define LL_EVT_CENTRAL_CONN_CREATED   0x00000008u
 
#define LL_EVT_CMD_STARTED   0x00800000u
 
#define LL_EVT_CONN_DISCONNECTED_IMMED   0x00000800u
 
#define LL_EVT_CONN_RX_AVAIL   0x00008000u
 
#define LL_EVT_CONN_TX_BUFF_FINISHED   0x04000000u
 
#define LL_EVT_CONNECTION_LAST_CMD_DONE   0x00040000u
 
#define LL_EVT_CS   0x40000000u
 
#define LL_EVT_CS_CURRENT_SUBEVENT_CONT_PROCESS   (LL_EVT_CS | 1 << 6)
 
#define LL_EVT_CS_ERROR_POST_PROCESS   (LL_EVT_CS | 1 << 0)
 
#define LL_EVT_CS_NEXT_SUBEVENT_PROCESS   (LL_EVT_CS | 1 << 5)
 
#define LL_EVT_CS_PRECAL_POST_PROCESS   (LL_EVT_CS | 1 << 4)
 
#define LL_EVT_CS_RESULTS_POST_PROCESS   (LL_EVT_CS | 1 << 3)
 
#define LL_EVT_CS_STEPS_POST_PROCESS   (LL_EVT_CS | 1 << 2)
 
#define LL_EVT_CS_SUBEVENT_POST_PROCESS   (LL_EVT_CS | 1 << 1)
 
#define LL_EVT_EXT_ADV_TIMEOUT   0x00000040u
 
#define LL_EVT_EXT_SCAN_TIMEOUT   0x00000020u
 
#define LL_EVT_INIT_DONE   0x00002000u
 
#define LL_EVT_INIT_LAST_CMD_DONE   0x00000002u
 
#define LL_EVT_INIT_LAST_CMD_DONE_CONNECT   0x00000080u
 
#define LL_EVT_INIT_LAST_CMD_DONE_RX_ERR   0x00000004u
 
#define LL_EVT_INIT_RX_ENTRY_DONE   0x20000000u
 
#define LL_EVT_NONE   0x00000000u
 
#define LL_EVT_OUT_OF_MEMORY   0x00004000u
 
#define LL_EVT_PAWR_RSP_DATA_LAST_CMD_DONE   (LL_EVT_PERIODIC_SCANNER | 1 << 2)
 
#define LL_EVT_PERIODIC_ADV_LAST_CMD_DONE   0x01000000u
 
#define LL_EVT_PERIODIC_ADV_TX_BUFF_FINISHED   0x02000000u
 
#define LL_EVT_PERIODIC_SCAN_CANCELLED   (LL_EVT_PERIODIC_SCANNER | 1 << 3)
 
#define LL_EVT_PERIODIC_SCAN_LAST_CMD_DONE   (LL_EVT_PERIODIC_SCANNER | 1 << 0)
 
#define LL_EVT_PERIODIC_SCAN_RX_AVAIL   (LL_EVT_PERIODIC_SCANNER | 1 << 1)
 
#define LL_EVT_PERIODIC_SCANNER   0x00100000u
 
#define LL_EVT_POST_PROCESS_RF   0x00000001u
 
#define LL_EVT_RESCHEDULE   0x00400000u
 
#define LL_EVT_RESET_SYSTEM_HARD   0x00000200u
 
#define LL_EVT_RESET_SYSTEM_SOFT   0x00000400u
 
#define LL_EVT_SCAN_LAST_CMD_DONE   0x00020000u
 
#define LL_EVT_SCAN_RX_AVAIL   0x00080000u
 
#define SYS_EVENT_MSG   0x80000000u
 A message is waiting event. More...
 
#define SYS_RESERVED   SYS_EVENT_MSG
 

Typedefs

typedef event_hdr_t osal_event_hdr_t
 OSAL Event header. More...
 
typedef void(* osal_highres_timer_cback_t) (void *arg)
 High resolution timer callback function type. More...
 
typedef void(* osal_icallMsg_hook_t) (void *param)
 ICall Message hook. More...
 
typedef ICall_MsgHdr osal_msg_hdr_t
 ICall Message header. More...
 
typedef void * osal_msg_q_t
 osal message queue More...
 

Functions

uint8 osal_alien2proxy (ICall_EntityID entity)
 Assign or retrieve a proxy OSAL task id for an external ICall entity. More...
 
uint8 * osal_buffer_uint32 (uint8 *buf, uint32 val)
 Buffer an uint32 value - LSB first. More...
 
uint16 osal_build_uint16 (uint8 *swapped)
 Build a uint16 out of 2 bytes (0 then 1). More...
 
uint32_t osal_build_uint32 (uint8 *swapped, uint8 len)
 Build a uint32 out of sequential bytes. More...
 
uint8 osal_isbufset (uint8 *buf, uint8 val, uint8 len)
 Check if all of the array elements are set to a value. More...
 
uint8 osal_memcmp (const void GENERIC *src1, const void GENERIC *src2, unsigned int len)
 Generic memory compare. More...
 
void * osal_memcpy (void *dst, const void GENERIC *src, unsigned int len)
 Generic memory copy. More...
 
void * osal_memdup (const void GENERIC *src, unsigned int len)
 Allocates a buffer and copies the src buffer into the newly allocated space. More...
 
void * osal_memset (void *dest, uint8 value, int size)
 Set memory buffer to value. More...
 
uint16 osal_rand (void)
 Random number generator. More...
 
void * osal_revmemcpy (void *dst, const void GENERIC *src, unsigned int len)
 Generic reverse memory copy. More...
 
void osal_set_icall_hook (osal_icallMsg_hook_t param)
 Set the hook used to parse icall message. More...
 
int osal_strlen (char *pString)
 Calculates the length of a string. More...
 

Variables

ICall_EntityID osal_entity
 OSAL entity. More...
 
void(* osal_eventloop_hook )(void)
 OSAL event loop hook. More...
 
ICall_SyncHandle osal_syncHandle
 OSAL synchronization handle. More...
 
uint_least32_t osal_tickperiod
 OSAL ticket period. More...
 

Macro Definition Documentation

§ INTS_ALL

#define INTS_ALL   0xFF

All interrupts.

§ LL_EVT_ADDRESS_RESOLUTION_TIMEOUT

#define LL_EVT_ADDRESS_RESOLUTION_TIMEOUT   0x00001000u

§ LL_EVT_ADV_LAST_CMD_DONE

#define LL_EVT_ADV_LAST_CMD_DONE   0x00010000u

§ LL_EVT_ADV_RX_AVAIL

#define LL_EVT_ADV_RX_AVAIL   0x08000000u

§ LL_EVT_ADV_TX_BUFF_FINISHED

#define LL_EVT_ADV_TX_BUFF_FINISHED   0x10000000u

§ LL_EVT_CENTRAL_CONN_CANCELLED

#define LL_EVT_CENTRAL_CONN_CANCELLED   0x00000010u

§ LL_EVT_CENTRAL_CONN_CREATED

#define LL_EVT_CENTRAL_CONN_CREATED   0x00000008u

§ LL_EVT_CMD_STARTED

#define LL_EVT_CMD_STARTED   0x00800000u

§ LL_EVT_CONN_DISCONNECTED_IMMED

#define LL_EVT_CONN_DISCONNECTED_IMMED   0x00000800u

§ LL_EVT_CONN_RX_AVAIL

#define LL_EVT_CONN_RX_AVAIL   0x00008000u

§ LL_EVT_CONN_TX_BUFF_FINISHED

#define LL_EVT_CONN_TX_BUFF_FINISHED   0x04000000u

§ LL_EVT_CONNECTION_LAST_CMD_DONE

#define LL_EVT_CONNECTION_LAST_CMD_DONE   0x00040000u

§ LL_EVT_CS

#define LL_EVT_CS   0x40000000u

§ LL_EVT_CS_CURRENT_SUBEVENT_CONT_PROCESS

#define LL_EVT_CS_CURRENT_SUBEVENT_CONT_PROCESS   (LL_EVT_CS | 1 << 6)

§ LL_EVT_CS_ERROR_POST_PROCESS

#define LL_EVT_CS_ERROR_POST_PROCESS   (LL_EVT_CS | 1 << 0)

§ LL_EVT_CS_NEXT_SUBEVENT_PROCESS

#define LL_EVT_CS_NEXT_SUBEVENT_PROCESS   (LL_EVT_CS | 1 << 5)

§ LL_EVT_CS_PRECAL_POST_PROCESS

#define LL_EVT_CS_PRECAL_POST_PROCESS   (LL_EVT_CS | 1 << 4)

§ LL_EVT_CS_RESULTS_POST_PROCESS

#define LL_EVT_CS_RESULTS_POST_PROCESS   (LL_EVT_CS | 1 << 3)

§ LL_EVT_CS_STEPS_POST_PROCESS

#define LL_EVT_CS_STEPS_POST_PROCESS   (LL_EVT_CS | 1 << 2)

§ LL_EVT_CS_SUBEVENT_POST_PROCESS

#define LL_EVT_CS_SUBEVENT_POST_PROCESS   (LL_EVT_CS | 1 << 1)

§ LL_EVT_EXT_ADV_TIMEOUT

#define LL_EVT_EXT_ADV_TIMEOUT   0x00000040u

§ LL_EVT_EXT_SCAN_TIMEOUT

#define LL_EVT_EXT_SCAN_TIMEOUT   0x00000020u

§ LL_EVT_INIT_DONE

#define LL_EVT_INIT_DONE   0x00002000u

§ LL_EVT_INIT_LAST_CMD_DONE

#define LL_EVT_INIT_LAST_CMD_DONE   0x00000002u

§ LL_EVT_INIT_LAST_CMD_DONE_CONNECT

#define LL_EVT_INIT_LAST_CMD_DONE_CONNECT   0x00000080u

§ LL_EVT_INIT_LAST_CMD_DONE_RX_ERR

#define LL_EVT_INIT_LAST_CMD_DONE_RX_ERR   0x00000004u

§ LL_EVT_INIT_RX_ENTRY_DONE

#define LL_EVT_INIT_RX_ENTRY_DONE   0x20000000u

§ LL_EVT_NONE

#define LL_EVT_NONE   0x00000000u

§ LL_EVT_OUT_OF_MEMORY

#define LL_EVT_OUT_OF_MEMORY   0x00004000u

§ LL_EVT_PAWR_RSP_DATA_LAST_CMD_DONE

#define LL_EVT_PAWR_RSP_DATA_LAST_CMD_DONE   (LL_EVT_PERIODIC_SCANNER | 1 << 2)

§ LL_EVT_PERIODIC_ADV_LAST_CMD_DONE

#define LL_EVT_PERIODIC_ADV_LAST_CMD_DONE   0x01000000u

§ LL_EVT_PERIODIC_ADV_TX_BUFF_FINISHED

#define LL_EVT_PERIODIC_ADV_TX_BUFF_FINISHED   0x02000000u

§ LL_EVT_PERIODIC_SCAN_CANCELLED

#define LL_EVT_PERIODIC_SCAN_CANCELLED   (LL_EVT_PERIODIC_SCANNER | 1 << 3)

§ LL_EVT_PERIODIC_SCAN_LAST_CMD_DONE

#define LL_EVT_PERIODIC_SCAN_LAST_CMD_DONE   (LL_EVT_PERIODIC_SCANNER | 1 << 0)

§ LL_EVT_PERIODIC_SCAN_RX_AVAIL

#define LL_EVT_PERIODIC_SCAN_RX_AVAIL   (LL_EVT_PERIODIC_SCANNER | 1 << 1)

§ LL_EVT_PERIODIC_SCANNER

#define LL_EVT_PERIODIC_SCANNER   0x00100000u

§ LL_EVT_POST_PROCESS_RF

#define LL_EVT_POST_PROCESS_RF   0x00000001u

§ LL_EVT_RESCHEDULE

#define LL_EVT_RESCHEDULE   0x00400000u

§ LL_EVT_RESET_SYSTEM_HARD

#define LL_EVT_RESET_SYSTEM_HARD   0x00000200u

§ LL_EVT_RESET_SYSTEM_SOFT

#define LL_EVT_RESET_SYSTEM_SOFT   0x00000400u

§ LL_EVT_SCAN_LAST_CMD_DONE

#define LL_EVT_SCAN_LAST_CMD_DONE   0x00020000u

§ LL_EVT_SCAN_RX_AVAIL

#define LL_EVT_SCAN_RX_AVAIL   0x00080000u

§ SYS_EVENT_MSG

#define SYS_EVENT_MSG   0x80000000u

A message is waiting event.

§ SYS_RESERVED

#define SYS_RESERVED   SYS_EVENT_MSG

Typedef Documentation

§ osal_event_hdr_t

OSAL Event header.

§ osal_highres_timer_cback_t

typedef void(* osal_highres_timer_cback_t) (void *arg)

High resolution timer callback function type.

§ osal_icallMsg_hook_t

typedef void(* osal_icallMsg_hook_t) (void *param)

ICall Message hook.

§ osal_msg_hdr_t

typedef ICall_MsgHdr osal_msg_hdr_t

ICall Message header.

§ osal_msg_q_t

typedef void* osal_msg_q_t

osal message queue

Function Documentation

§ osal_alien2proxy()

uint8 osal_alien2proxy ( ICall_EntityID  entity)

Assign or retrieve a proxy OSAL task id for an external ICall entity.

Parameters
entityICall entity id
Returns
proxy OSAL task id

§ osal_buffer_uint32()

uint8* osal_buffer_uint32 ( uint8 *  buf,
uint32  val 
)

Buffer an uint32 value - LSB first.

Parameters
bufbuffer
valuint32 value
Returns
pointer to end of destination buffer

§ osal_build_uint16()

uint16 osal_build_uint16 ( uint8 *  swapped)

Build a uint16 out of 2 bytes (0 then 1).

Parameters
swapped0 then 1
Returns
uint16

§ osal_build_uint32()

uint32_t osal_build_uint32 ( uint8 *  swapped,
uint8  len 
)

Build a uint32 out of sequential bytes.

Parameters
swappedsequential bytes
lennumber of bytes in the uint8 array
Returns
uint32

§ osal_isbufset()

uint8 osal_isbufset ( uint8 *  buf,
uint8  val,
uint8  len 
)

Check if all of the array elements are set to a value.

Parameters
bufbuffer to check
valvalue to check each array element for
lenlength to check
Returns
TRUE if all "val"
FALSE otherwise

§ osal_memcmp()

uint8 osal_memcmp ( const void GENERIC *  src1,
const void GENERIC *  src2,
unsigned int  len 
)

Generic memory compare.

Parameters
src1source 1 address
src2source 2 address
lennumber of bytes to compare
Returns
TRUE if same
FALSE if different

§ osal_memcpy()

void* osal_memcpy ( void *  dst,
const void GENERIC *  src,
unsigned int  len 
)

Generic memory copy.

Note
This function differs from the standard memcpy(), since it returns the pointer to the next destination uint8. The standard memcpy() returns the original destination address.
Parameters
dstdestination address
srcsource address
lennumber of bytes to copy
Returns
pointer to end of destination buffer

§ osal_memdup()

void* osal_memdup ( const void GENERIC *  src,
unsigned int  len 
)

Allocates a buffer and copies the src buffer into the newly allocated space.

Allocation is done with with osal_mem_alloc

Parameters
srcsource address
lennumber of bytes to copy
Returns
pointer to the new allocated buffer
NULL if allocation fails

§ osal_memset()

void* osal_memset ( void *  dest,
uint8  value,
int  size 
)

Set memory buffer to value.

Parameters
destpointer to buffer
valuewhat to set each uint8 of the message
sizehow big
Returns
pointer to destination buffer

§ osal_rand()

uint16 osal_rand ( void  )

Random number generator.

Returns
new random number

§ osal_revmemcpy()

void* osal_revmemcpy ( void *  dst,
const void GENERIC *  src,
unsigned int  len 
)

Generic reverse memory copy.

Starts at the end of the source buffer, by taking the source address pointer and moving pointer ahead "len" bytes, then decrementing the pointer.

Note
This function differs from the standard memcpy(), since it returns the pointer to the next destination uint8. The standard memcpy() returns the original destination address.
Parameters
dstdestination address
srcsource address
lennumber of bytes to copy
Returns
pointer to end of destination buffer

§ osal_set_icall_hook()

void osal_set_icall_hook ( osal_icallMsg_hook_t  param)

Set the hook used to parse icall message.

Parameters
parampointer to a function that will be called if a icall message is found.

§ osal_strlen()

int osal_strlen ( char *  pString)

Calculates the length of a string.

Note
The string must be null terminated.
Parameters
*pStringpointer to text string
Returns
number of characters

Variable Documentation

§ osal_entity

ICall_EntityID osal_entity

OSAL entity.

§ osal_eventloop_hook

void(* osal_eventloop_hook) (void)

OSAL event loop hook.

§ osal_syncHandle

ICall_SyncHandle osal_syncHandle

OSAL synchronization handle.

§ osal_tickperiod

uint_least32_t osal_tickperiod

OSAL ticket period.

© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale