Morse Micro IoT SDK  2.9.7

Detailed Description

Provides memory management functionality managing tasks (create, destroy, yield, etc.).

Macros

#define MMOSAL_TASK_ENTER_CRITICAL()
 Enter critical section. More...
 
#define MMOSAL_TASK_EXIT_CRITICAL()
 Exit critical section. More...
 

Typedefs

typedef void(* mmosal_task_fn_t) (void *arg)
 Type definition for task main functions. More...
 

Enumerations

enum  mmosal_task_priority {
  MMOSAL_TASK_PRI_IDLE , MMOSAL_TASK_PRI_MIN , MMOSAL_TASK_PRI_LOW , MMOSAL_TASK_PRI_NORM ,
  MMOSAL_TASK_PRI_HIGH
}
 Enumeration of task priorities (ordered lowest to highest). More...
 

Functions

struct mmosal_task * mmosal_task_create (mmosal_task_fn_t task_fn, void *argument, enum mmosal_task_priority priority, unsigned stack_size_u32, const char *name)
 Create a new task. More...
 
void mmosal_task_delete (struct mmosal_task *task)
 Delete the given task. More...
 
struct mmosal_task * mmosal_task_get_active (void)
 Get the handle of the active task. More...
 
void mmosal_task_yield (void)
 Yield the active task.
 
void mmosal_task_sleep (uint32_t duration_ms)
 Sleep for a period of time, yielding during that time. More...
 
void mmosal_task_enter_critical (void)
 Enter critical section. More...
 
void mmosal_task_exit_critical (void)
 Exit critical section. More...
 
void mmosal_disable_interrupts (void)
 Disable interrupts. More...
 
void mmosal_enable_interrupts (void)
 Enable interrupts. More...
 
const char * mmosal_task_name (void)
 Get the name of the running task. More...
 

Macro Definition Documentation

◆ MMOSAL_TASK_ENTER_CRITICAL

#define MMOSAL_TASK_ENTER_CRITICAL ( )
Value:
do { \
MMPORT_MEM_SYNC(); \
mmosal_task_enter_critical(); \
} while (0)

Enter critical section.

This may result in interrupts being disabled so critical sections must be kept short. Each entry to a critical section must be matched to a corresponding exit (MMOSAL_TASK_EXIT_CRITICAL()).

Definition at line 240 of file mmosal.h.

◆ MMOSAL_TASK_EXIT_CRITICAL

#define MMOSAL_TASK_EXIT_CRITICAL ( )
Value:
do { \
MMPORT_MEM_SYNC(); \
mmosal_task_exit_critical(); \
} while (0)

Exit critical section.

Used to exit a critical section previously entered with MMOSAL_TASK_ENTER_CRITICAL()).

Definition at line 251 of file mmosal.h.

Typedef Documentation

◆ mmosal_task_fn_t

typedef void(* mmosal_task_fn_t) (void *arg)

Type definition for task main functions.

Parameters
argOpaque argument passed in at task creation.

Definition at line 173 of file mmosal.h.

Enumeration Type Documentation

◆ mmosal_task_priority

Enumeration of task priorities (ordered lowest to highest).

Enumerator
MMOSAL_TASK_PRI_IDLE 

Idle task priority.

MMOSAL_TASK_PRI_MIN 

Minimum priority.

MMOSAL_TASK_PRI_LOW 

Low priority.

MMOSAL_TASK_PRI_NORM 

Normal priority.

MMOSAL_TASK_PRI_HIGH 

High priority.

Definition at line 176 of file mmosal.h.

Function Documentation

◆ mmosal_disable_interrupts()

void mmosal_disable_interrupts ( void  )

Disable interrupts.

Warning
This function should generally not be used. Use mmosal_task_enter_critical() instead.

◆ mmosal_enable_interrupts()

void mmosal_enable_interrupts ( void  )

Enable interrupts.

Warning
This function should generally not be used. Use mmosal_task_exit_critical() instead.

◆ mmosal_task_create()

struct mmosal_task * mmosal_task_create ( mmosal_task_fn_t  task_fn,
void *  argument,
enum mmosal_task_priority  priority,
unsigned  stack_size_u32,
const char *  name 
)

Create a new task.

Parameters
task_fnTask main function.
argumentArgument to pass to main function.
priorityTask priority.
stack_size_u32Size of stack to allocate for task (in units of 32 bit words).
nameName to give the task.
Returns
an opaque task handle, or NULL on failure.

◆ mmosal_task_delete()

void mmosal_task_delete ( struct mmosal_task *  task)

Delete the given task.

Parameters
taskHandle of the task to delete (or NULL to delete the current task).
Note
With FreeRTOS deleted tasks will not be cleaned up until the idle task runs.

◆ mmosal_task_enter_critical()

void mmosal_task_enter_critical ( void  )

Enter critical section.

This may result in interrupts being disabled so critical sections must be kept short. Each entry to a critical section must be matched to a corresponding exit (mmosal_task_exit_critical()).

Note
This function should not be invoked directly. Use MMOSAL_TASK_ENTER_CRITICAL().

◆ mmosal_task_exit_critical()

void mmosal_task_exit_critical ( void  )

Exit critical section.

Used to exit a critical section previously entered with mmosal_task_enter_critical()).

Note
This function should not be invoked directly. Use MMOSAL_TASK_EXIT_CRITICAL().

◆ mmosal_task_get_active()

struct mmosal_task * mmosal_task_get_active ( void  )

Get the handle of the active task.

Returns
the handle of the active task.

◆ mmosal_task_name()

const char * mmosal_task_name ( void  )

Get the name of the running task.

Returns
the name of the running task.

◆ mmosal_task_sleep()

void mmosal_task_sleep ( uint32_t  duration_ms)

Sleep for a period of time, yielding during that time.

Parameters
duration_msSleep duration, in milliseconds.