PSDK QNX API Guide
OSAL_API

Files

file  osal.h
 OS Abstraction Layer header.
 

Data Structures

struct  Osal_StaticMemStatus
 This structure holds static memory status parameters of OSAL library. More...
 
struct  Osal_memRange
 Osal memory address range. More...
 
struct  Osal_HwAttrs
 Osal hw attributes structure. More...
 

Variables

uint32_t Osal_StaticMemStatus::peakSemObjs
 
uint32_t Osal_StaticMemStatus::numMaxSemObjs
 
uint32_t Osal_StaticMemStatus::numFreeSemObjs
 
uint32_t Osal_StaticMemStatus::peakTimerObjs
 
uint32_t Osal_StaticMemStatus::numMaxTimerObjs
 
uint32_t Osal_StaticMemStatus::numFreeTimerObjs
 
uint32_t Osal_StaticMemStatus::peakHwiObjs
 
uint32_t Osal_StaticMemStatus::numMaxHwiObjs
 
uint32_t Osal_StaticMemStatus::numFreeHwiObjs
 
uintptr_t Osal_memRange::base
 
uint32_t Osal_memRange::size
 
uint32_t Osal_HwAttrs::cpuFreqKHz
 
uint32_t Osal_HwAttrs::extClkKHz
 
Osal_HwAccessType Osal_HwAttrs::hwAccessType
 
uintptr_t Osal_HwAttrs::osalDelayTimerBaseAddr
 
Osal_memRange Osal_HwAttrs::extSemaphorePBlock
 
Osal_memRange Osal_HwAttrs::extHwiPBlock
 

Osal Error return Codes

Return error codes for Osal generic APIs

enum  Osal_ThreadType {
  Osal_ThreadType_Hwi ,
  Osal_ThreadType_Swi ,
  Osal_ThreadType_Task ,
  Osal_ThreadType_Main ,
  Osal_ThreadType_Abort
}
 This enum defines the multiple thread types used under OSAL library. More...
 
enum  Osal_HwAccessType {
  OSAL_HWACCESS_UNRESTRICTED ,
  OSAL_HWACCESS_RESTRICTED
}
 Osal hw access type. More...
 
void Osal_DebugP_assert (int32_t expression, const char *file, int32_t line)
 
Osal_ThreadType Osal_getThreadType (void)
 Function to get the current thread type. More...
 
int32_t Osal_delay (uint32_t nTicks)
 Function to delay/sleep the specified number of ticks. More...
 
#define osal_OK   ((int32_t)(0))
 
#define osal_FAILURE   (-(int32_t)(1))
 
#define osal_UNSUPPORTED   (-(int32_t)(2))
 
#define osal_NOMEM   (-(int32_t)(3))
 
#define osal_WAIT_FOREVER   (~((uint32_t)0U))
 
#define osal_NO_WAIT   ((uint32_t)0U)
 
#define OSAL_NONOS_SEMAPHOREP_SIZE_BYTES   ((uint32_t) 48U)
 
#define OSAL_NONOS_HWIP_SIZE_BYTES   ((uint32_t) 48U)
 
#define OSAL_FREERTOS_HWIP_C7X_SIZE_BYTES   ((uint32_t) 56U)
 
#define OSAL_SAFERTOS_HWIP_C7X_SIZE_BYTES   ((uint32_t) 56U)
 
#define OSAL_FREERTOS_SEMAPHOREP_SIZE_BYTES   ((uint32_t) 96U)
 
#define OSAL_FREERTOS_TASKP_SIZE_BYTES   ((uint32_t) 128U)
 
#define OSAL_SAFERTOS_SEMAPHOREP_SIZE_BYTES   ((uint32_t) 248U)
 
#define OSAL_SAFERTOS_TASKP_SIZE_BYTES   ((uint32_t) 248U)
 
#define OSAL_Assert(expression)
 Assert checking function. More...
 

Osal HwAttrs ValidBit definitions

Osal_HwAttrs gOsal_HwAttrs
 external references for Osal Hw Attribute structure More...
 
int32_t Osal_setHwAttrs (uint32_t ctrlBitMap, const Osal_HwAttrs *hwAttrs)
 Function to set the Hw Attributes. More...
 
int32_t Osal_getHwAttrs (Osal_HwAttrs *hwAttrs)
 Function to get the Hw Attributes. More...
 
int32_t Osal_getStaticMemStatus (Osal_StaticMemStatus *pMemStat)
 Function to get the static memory usage of OSAL library. More...
 
uint32_t Osal_getCoreId (void)
 Function to get the core ID of the running Core. More...
 
int32_t Osal_isInPrivilegeMode (void)
 Function to check if the calling task is in privileged mode. More...
 
void OS_init (void)
 Function for initializing the OS / scheduler. More...
 
void OS_start (void)
 Function to strat OS / scheduler. More...
 
void OS_stop (void)
 Function to stop OS / scheduler. More...
 
#define OSAL_HWATTR_SET_EXT_CLK   (0x00000001U)
 
#define OSAL_HWATTR_SET_ECM_INT   (0x00000002U)
 
#define OSAL_HWATTR_SET_HWACCESS_TYPE   (0x00000004U)
 
#define OSAL_HWATTR_SET_OSALDELAY_TIMER_BASE   (0x00000008U)
 
#define OSAL_HWATTR_SET_SEMP_EXT_BASE   (0x00000010U)
 
#define OSAL_HWATTR_SET_HWIP_EXT_BASE   (0x00000020U)
 
#define OSAL_HWATTR_SET_CPU_FREQ   (0x00000040U)
 
#define OSAL_HWATTR_SET_TARG_PROC_LIST   (0x00000080U)
 
#define OSAL_COMPILE_TIME_SIZE_CHECK(x, y)
 

Detailed Description

OSAL interface

Macro Definition Documentation

◆ osal_OK

#define osal_OK   ((int32_t)(0))

◆ osal_FAILURE

#define osal_FAILURE   (-(int32_t)(1))

◆ osal_UNSUPPORTED

#define osal_UNSUPPORTED   (-(int32_t)(2))

◆ osal_NOMEM

#define osal_NOMEM   (-(int32_t)(3))

◆ osal_WAIT_FOREVER

#define osal_WAIT_FOREVER   (~((uint32_t)0U))

◆ osal_NO_WAIT

#define osal_NO_WAIT   ((uint32_t)0U)

◆ OSAL_NONOS_SEMAPHOREP_SIZE_BYTES

#define OSAL_NONOS_SEMAPHOREP_SIZE_BYTES   ((uint32_t) 48U)

◆ OSAL_NONOS_HWIP_SIZE_BYTES

#define OSAL_NONOS_HWIP_SIZE_BYTES   ((uint32_t) 48U)

◆ OSAL_FREERTOS_HWIP_C7X_SIZE_BYTES

#define OSAL_FREERTOS_HWIP_C7X_SIZE_BYTES   ((uint32_t) 56U)

◆ OSAL_SAFERTOS_HWIP_C7X_SIZE_BYTES

#define OSAL_SAFERTOS_HWIP_C7X_SIZE_BYTES   ((uint32_t) 56U)

◆ OSAL_FREERTOS_SEMAPHOREP_SIZE_BYTES

#define OSAL_FREERTOS_SEMAPHOREP_SIZE_BYTES   ((uint32_t) 96U)

◆ OSAL_FREERTOS_TASKP_SIZE_BYTES

#define OSAL_FREERTOS_TASKP_SIZE_BYTES   ((uint32_t) 128U)

◆ OSAL_SAFERTOS_SEMAPHOREP_SIZE_BYTES

#define OSAL_SAFERTOS_SEMAPHOREP_SIZE_BYTES   ((uint32_t) 248U)

◆ OSAL_SAFERTOS_TASKP_SIZE_BYTES

#define OSAL_SAFERTOS_TASKP_SIZE_BYTES   ((uint32_t) 248U)

◆ OSAL_Assert

#define OSAL_Assert (   expression)
Value:
(Osal_DebugP_assert((int32_t)((expression)?1:0),\
__FILE__, __LINE__))
void Osal_DebugP_assert(int32_t expression, const char *file, int32_t line)

Assert checking function.

If the expression is evaluated to true, the API does nothing. If it is evaluated to false, the underlying RTOS port implementation handles the assert via its mechanisms.

Parameters
expressionExpression to evaluate

◆ OSAL_HWATTR_SET_EXT_CLK

#define OSAL_HWATTR_SET_EXT_CLK   (0x00000001U)

bit map to set external clock in Osal_HwAttr default value

◆ OSAL_HWATTR_SET_ECM_INT

#define OSAL_HWATTR_SET_ECM_INT   (0x00000002U)

bit map to set Event combiner interrupt numbers in the Osal_HwAttr

◆ OSAL_HWATTR_SET_HWACCESS_TYPE

#define OSAL_HWATTR_SET_HWACCESS_TYPE   (0x00000004U)

bit map to set the hardware access type

◆ OSAL_HWATTR_SET_OSALDELAY_TIMER_BASE

#define OSAL_HWATTR_SET_OSALDELAY_TIMER_BASE   (0x00000008U)

bit map to set the osal_delay Timer base address

◆ OSAL_HWATTR_SET_SEMP_EXT_BASE

#define OSAL_HWATTR_SET_SEMP_EXT_BASE   (0x00000010U)

bit map to set the extended SemaphoreP memory block for additional SemaphoreP needs

◆ OSAL_HWATTR_SET_HWIP_EXT_BASE

#define OSAL_HWATTR_SET_HWIP_EXT_BASE   (0x00000020U)

bit map to set the extended HwiP memory block for additional HwiP needs

◆ OSAL_HWATTR_SET_CPU_FREQ

#define OSAL_HWATTR_SET_CPU_FREQ   (0x00000040U)

bit map to set the CPU frequency

◆ OSAL_HWATTR_SET_TARG_PROC_LIST

#define OSAL_HWATTR_SET_TARG_PROC_LIST   (0x00000080U)

bit map to set the target processor list to direct interrupts to specific core

◆ OSAL_COMPILE_TIME_SIZE_CHECK

#define OSAL_COMPILE_TIME_SIZE_CHECK (   x,
 
)
Value:
do { \
struct { \
uint8_t NegativeSizeIfPostulateFalse[(y) + 1U - (x)]; \
} PostulateCheck; \
} \
while (BFALSE)

This macro generates compilier error if postulate is false, so allows 0 overhead compile time size check. This "works" when the expression contains sizeof() which otherwise doesn't work with preprocessor

Example

     #define  OSAL_TEST_STRUCT_SIZE_BYTES ((uint32_t) 48U)
     typedef struct Test_Struct_Ext_s {
         Bool        used;
         Test_Struct test;
     } Test_Struct_Ext;

     void OsalTest_compileTime_SizeChk(void)
     {
     #if defined(__GNUC__) && !defined(__ti__)
     #pragma GCC diagnostic push
     #pragma GCC diagnostic ignored "-Wunused-variable"
     #else
     #pragma diag_suppress 179
     #endif
         OSAL_COMPILE_TIME_SIZE_CHECK (sizeof(Test_Struct_Ext),OSAL_TEST_STRUCT_SIZE_BYTES);
     #if defined(__GNUC__) && !defined(__ti__)
     #pragma GCC diagnostic pop
     #endif
     }

Enumeration Type Documentation

◆ Osal_ThreadType

This enum defines the multiple thread types used under OSAL library.

Enumerator
Osal_ThreadType_Hwi 

Current thread is a Hwi

Osal_ThreadType_Swi 

Current thread is a Swi

Osal_ThreadType_Task 

Current thread is a Task

Osal_ThreadType_Main 

Current thread is Main

Osal_ThreadType_Abort 

Current thread is an Abort

◆ Osal_HwAccessType

Osal hw access type.

Enumerator
OSAL_HWACCESS_UNRESTRICTED 

No restriction on hardware access or configuration

OSAL_HWACCESS_RESTRICTED 

Restrictive access to hardware such as GIC

Function Documentation

◆ Osal_DebugP_assert()

void Osal_DebugP_assert ( int32_t  expression,
const char *  file,
int32_t  line 
)

◆ Osal_getThreadType()

Osal_ThreadType Osal_getThreadType ( void  )

Function to get the current thread type.

Returns
current thread type

◆ Osal_delay()

int32_t Osal_delay ( uint32_t  nTicks)

Function to delay/sleep the specified number of ticks.

Parameters
nTicksnumber of ticks

#

Note
for bare metal application it is number of 1ms ticks
    Prerequisites: Board_init() to be called before 
    invoking this API
Returns
osal_OK for success, osal_FAILURE on failure

◆ Osal_setHwAttrs()

int32_t Osal_setHwAttrs ( uint32_t  ctrlBitMap,
const Osal_HwAttrs hwAttrs 
)

Function to set the Hw Attributes.

Parameters
ctrlBitMapcontrol bit map as defined by the OSAL_HWATTR_SET control bits
hwAttrspointer to Osal_HwAttrs structure
Returns
osal_OK for success, osal_FAILURE on failure and osal_UNSUPPORTED for unsupported configurations osal_UNSUPPORTED is a non fatal error and applications can continue processing if they get this error code. Osal would be configured to utilize default timer for Osal_delay() API. The default timer address for AM437x and AM335x SoCs are found under ti/osal/soc/'<'soc_part'>'/osal_soc.h For other SoCs the time base address is not applicable and the API returns osal_UNSUPPORTED as the return value.

◆ Osal_getHwAttrs()

int32_t Osal_getHwAttrs ( Osal_HwAttrs hwAttrs)

Function to get the Hw Attributes.

Parameters
hwAttrspointer to Osal_HwAttrs structure
Returns
osal_OK for success, osal_FAILURE on failure

◆ Osal_getStaticMemStatus()

int32_t Osal_getStaticMemStatus ( Osal_StaticMemStatus pMemStat)

Function to get the static memory usage of OSAL library.

Parameters
pMemStatpointer to Osal_StaticMemStatus structure
Returns
osal_OK for success, osal_FAILURE on failure

◆ Osal_getCoreId()

uint32_t Osal_getCoreId ( void  )

Function to get the core ID of the running Core.

Returns
core ID of the running core

◆ Osal_isInPrivilegeMode()

int32_t Osal_isInPrivilegeMode ( void  )

Function to check if the calling task is in privileged mode.

Returns
Returns pdTrue

◆ OS_init()

void OS_init ( void  )

Function for initializing the OS / scheduler.

◆ OS_start()

void OS_start ( void  )

Function to strat OS / scheduler.

◆ OS_stop()

void OS_stop ( void  )

Function to stop OS / scheduler.

Variable Documentation

◆ peakSemObjs

uint32_t Osal_StaticMemStatus::peakSemObjs

Maxmium number of Semaphore objects used

◆ numMaxSemObjs

uint32_t Osal_StaticMemStatus::numMaxSemObjs

Number of Semaphore objects allocated

◆ numFreeSemObjs

uint32_t Osal_StaticMemStatus::numFreeSemObjs

Number of Semaphore objects available

◆ peakTimerObjs

uint32_t Osal_StaticMemStatus::peakTimerObjs

Maxmium number of Timer objects used

◆ numMaxTimerObjs

uint32_t Osal_StaticMemStatus::numMaxTimerObjs

Number of Timer objects allocated

◆ numFreeTimerObjs

uint32_t Osal_StaticMemStatus::numFreeTimerObjs

Number of Timer objects available

◆ peakHwiObjs

uint32_t Osal_StaticMemStatus::peakHwiObjs

Maxmium number of Hwi objects used

◆ numMaxHwiObjs

uint32_t Osal_StaticMemStatus::numMaxHwiObjs

Number of Hwi objects allocated

◆ numFreeHwiObjs

uint32_t Osal_StaticMemStatus::numFreeHwiObjs

Number of Hwi objects available

◆ base

uintptr_t Osal_memRange::base

Start address value

◆ size

uint32_t Osal_memRange::size

size in bytes

◆ cpuFreqKHz

uint32_t Osal_HwAttrs::cpuFreqKHz

CPU frequency in KHz

◆ extClkKHz

uint32_t Osal_HwAttrs::extClkKHz

External Clock value in KHz

◆ hwAccessType

Osal_HwAccessType Osal_HwAttrs::hwAccessType

Hardware access type

◆ osalDelayTimerBaseAddr

uintptr_t Osal_HwAttrs::osalDelayTimerBaseAddr

Delay timer base address: Delay timer base configuration is applicable for only AM335x/AM437x SoCs It is not applicable and should not be set for other SoCs Osal setHwAttrs API would return failure (osal_UNSUPPORTED) if attempted to be set for SoCs other than AM335x and AM437x.

◆ extSemaphorePBlock

Osal_memRange Osal_HwAttrs::extSemaphorePBlock

Semaphore external memory control block

◆ extHwiPBlock

Osal_memRange Osal_HwAttrs::extHwiPBlock

Hwi external memory control block

◆ gOsal_HwAttrs

Osal_HwAttrs gOsal_HwAttrs
extern

external references for Osal Hw Attribute structure