Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
MQX RTOS Abstraction Layer

The Kinetis SDK provides the MQX RTOS Abstraction Layer for synchronization, mutual exclusion, message queue, etc. More...

Overview

Data Structures

struct  mutex_t
 Type for a mutex. More...
 

Macros

#define OSA_WAIT_FOREVER   0xFFFFFFFFU
 Constant to pass as timeout value in order to wait indefinitely. More...
 
#define FSL_OSA_TIME_RANGE   0xFFFFFFFFU
 OSA's time range in millisecond, OSA time wraps if exceeds this value. More...
 
#define OSA_DEFAULT_INT_HANDLER   (OSA_DefaultIntHandler())
 The default interrupt handler installed in vector table. More...
 
#define MQX_MAIN_TASK_PRIORITY   (7+16)
 The priority of MQX RTOS Main_Task. More...
 

Typedefs

typedef LWSEM_STRUCT semaphore_t
 Type for MQX RTOS mutex. More...
 
typedef LWEVENT_STRUCT event_t
 Type for an event group object. More...
 
typedef _mqx_uint event_flags_t
 Type for an event flags group, bit 32 is reserved. More...
 
typedef TASK_FPTR task_t
 Type for a task pointer. More...
 
typedef _task_id task_handler_t
 Type for a task handler, returned by the OSA_TaskCreate function. More...
 
typedef uint32_t task_param_t
 Type for a task handler, returned by the task_create function. More...
 
typedef uint32_t task_stack_t
 Type for a task stack. More...
 
typedef _mqx_max_type msg_queue_t
 Type for a message queue. More...
 
typedef void * msg_queue_handler_t
 Type for a message queue handler. More...
 

Functions

static osa_int_handler_t OSA_DefaultIntHandler (void)
 The default interrupt handler installed in vector table. More...
 

Thread management

#define OSA_TASK_DEFINE(task, stackSize)
 Defines a task. More...
 
#define PRIORITY_OSA_TO_RTOS(osa_prio)   ((osa_prio)+7U)
 To provide unified task priority for upper layer, OSA layer makes a conversion. More...
 
#define PRIORITY_RTOS_TO_OSA(rtos_prio)   ((rtos_prio)-7U)
 

Message queues

#define SIZE_IN_MMT_UNITS(size)   ((size + sizeof(_mqx_max_type) - 1) / sizeof(_mqx_max_type))
 
#define MSG_QUEUE_DECLARE(name, number, size)   _mqx_max_type name[SIZE_IN_MMT_UNITS(sizeof(LWMSGQ_STRUCT)) + SIZE_IN_MMT_UNITS(size * 4) * number]
 This macro statically reserves the memory required for the queue. More...
 

Data Structure Documentation

struct mutex_t

Data Fields

volatile bool isWaiting
 Is any task waiting for a timeout on this mutex.
 
volatile bool isLocked
 Is the object locked or not.
 
uint32_t time_start
 The time to start timeout.
 
uint32_t timeout
 Timeout to wait in milliseconds.
 
LWSEM_STRUCT sema
 The lwsem structure. More...
 
_task_id owner
 Task who locks this mutex. More...
 

Field Documentation

LWSEM_STRUCT mutex_t::sema
_task_id mutex_t::owner

Macro Definition Documentation

#define OSA_WAIT_FOREVER   0xFFFFFFFFU
#define FSL_OSA_TIME_RANGE   0xFFFFFFFFU
#define OSA_DEFAULT_INT_HANDLER   (OSA_DefaultIntHandler())
#define MQX_MAIN_TASK_PRIORITY   (7+16)
#define OSA_TASK_DEFINE (   task,
  stackSize 
)
Value:
task_stack_t task##_stack[MQX_REQUIRED_STACK_SIZE(stackSize)/sizeof(task_stack_t)+1]; \
task_handler_t task##_task_handler;
uint32_t task_stack_t
Type for a task stack.
Definition: fsl_os_abstraction_bm.h:104
_task_id task_handler_t
Type for a task handler, returned by the OSA_TaskCreate function.
Definition: fsl_os_abstraction_mqx.h:124
uint32_t task_stack_t
Type for a task stack.
Definition: fsl_os_abstraction_mqx.h:130

This macro defines resources for a task statically. Then, the OSA_TaskCreate creates the task based-on these resources.

Parameters
taskThe task function.
stackSizeThe stack size this task needs in bytes.
#define PRIORITY_OSA_TO_RTOS (   osa_prio)    ((osa_prio)+7U)

MQX RTOS highest 7 priorities are special priorities.

#define MSG_QUEUE_DECLARE (   name,
  number,
  size 
)    _mqx_max_type name[SIZE_IN_MMT_UNITS(sizeof(LWMSGQ_STRUCT)) + SIZE_IN_MMT_UNITS(size * 4) * number]
Parameters
nameIdentifier for the memory region.
numberNumber of elements in the queue.
sizeSize of element in 4 B units.

Typedef Documentation

typedef LWSEM_STRUCT semaphore_t

Type for a semaphore.

typedef LWEVENT_STRUCT event_t
typedef _mqx_uint event_flags_t
typedef TASK_FPTR task_t
typedef _task_id task_handler_t
typedef uint32_t task_param_t
typedef uint32_t task_stack_t
typedef _mqx_max_type msg_queue_t
typedef void* msg_queue_handler_t

Function Documentation

static osa_int_handler_t OSA_DefaultIntHandler ( void  )
inlinestatic
Returns
Default ISR.