OS Event

API 介绍

This section introduces OS event reference api.

Defines

MAX_TIME

event max wait time

EVENT_FLAG_AND

logic and

EVENT_FLAG_OR

logic or

EVENT_FLAG_CLEAR

logic clear

Typedefs

typedef void *os_event_h

event handle defination

Functions

os_event_h os_create_event(module_id_t module_id)

This function is to create a event.

参数:

module_id -- is the module id that creates the event

返回:

os_event_h 0 - for failure case otherwise - event id

bool os_wait_event(os_event_h event_id, uint32_t timeout, uint32_t *recv)

This function is to wait to take a event. This method should NOT be called in ISR.

参数:
  • event_id -- is id of the event being waiting to be taken.

  • timeout -- is time to wait in millisecond for the event to be available. when timeout is set to MAX_TIME, this method return only if the event become avaliable.

  • recv -- is eventbits

返回:

bool TRUE - Take the event successfully, FALSE - Failed to take the event within ms milliseconds

bool os_wait_event_with_v(os_event_h event_id, uint32_t set, uint8_t option, uint32_t timeout, uint32_t *recv)
bool os_set_event(os_event_h event_id, uint32_t set)

This function is to give a event. This method should NOT be called in ISR.

参数:
  • event_id -- is id of the event to be given.

  • set -- is setted event

返回:

bool TRUE - Give the event successfully, FALSE - Failed to take the event

bool os_set_event_isr(os_event_h event_id, uint32_t set)

This function is to give a event, only called in ISR.

参数:
  • event_id -- is id of the event to be given

  • set -- is setted event

返回:

bool TRUE - Give the event successfully, FALSE - Failed to take the event

void os_delete_event(os_event_h event_id)

This function is to delete a event.

参数:

event_id -- is id of the event to be deleted

void os_clear_event(os_event_h event_id, uint32_t set)

to clear event

参数:
  • event_id -- is id of the event to be cleared

  • set -- is cleared event

void os_clear_event_isr(os_event_h event_id, uint32_t set)

called from ISR to clear event

参数:
  • event_id -- is id of the event to be cleared

  • set -- is cleared event