Kernel Monitor API#

OSMonCreate()#

Description#

Creates a monitor.

Files#

os.h/os_mon.c

Prototype#

void  OSMonCreate (OS_MON     *p_mon,
                   CPU_CHAR   *p_name,
                   void       *p_mon_data,
                   RTOS_ERR   *p_err)

Arguments#

p_mon

Pointer to the monitor to initialize. Your application is responsible for allocating storage space for the monitor.

p_name

Pointer to the name to assign to this monitor.

p_mon_data

Pointer to the monitor's global data.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_OS_ILLEGAL_RUN_TIME

Returned Value#

None.

Notes / Warnings#

None.

OSMonDel()#

Description#

This function deletes a monitor.

Files#

os.h/os_mon.c

Prototype#

OS_OBJ_QTY  OSMonDel (OS_MON    *p_mon,
                      OS_OPT     opt,
                      RTOS_ERR  *p_err)

Arguments#

p_mon

Pointer to the monitor to delete.

opt

Determines delete options as follows:

  • OS_OPT_DEL_NO_PEND Deletes the monitor ONLY if there are no tasks pending.

  • OS_OPT_DEL_ALWAYS Deletes the monitor even if there are tasks waiting. In this case, all pending tasks will be ready.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_OS_ILLEGAL_RUN_TIME

  • RTOS_ERR_OS_TASK_WAITING

Returned Value#

  • == 0 If there were no tasks waiting on the monitor, or upon error.

  • > 0 If one or more tasks are waiting on the monitor are now ready and informed.

Notes / Warnings#

(1) Use this function with care. Tasks that would normally expect the presence of the monitor MUST check the return code of OSMonOp().

(2) Because ALL tasks pending on the monitor will be ready, be careful in applications where the monitor is used for mutual exclusion because the resource(s) will no longer be guarded by the monitor.

OSMonOp()#

Description#

Performs an operation on a monitor.

Files#

os.h/os_mon.c

Prototype#

void  OSMonOp (OS_MON               *p_mon,
               OS_TICK               timeout,
               void                 *p_arg,
               OS_MON_ON_ENTER_PTR   p_on_enter,
               OS_MON_ON_EVAL_PTR    p_on_eval,
               OS_OPT                opt,
               RTOS_ERR             *p_err)

Arguments#

p_mon

Pointer to the monitor.

timeout

Optional timeout to be applied if the monitor blocks (pending).

p_arg

Argument of the monitor.

p_on_enter

Callback called at the entry of OSMonOp().

p_on_eval

Callback to be registered as the monitor's evaluation function.

opt

Possible option :

OS_OPT_POST_NO_SCHED Do not call the scheduler.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_ABORT

  • RTOS_ERR_TIMEOUT

Returned Value#

None.

Notes / Warnings#

None.