Each task has a maximum of 16 event markers, and the task can wait for several events at the same time, or choose to wait for one or some of these events. An event can be triggered by another task or interrupt handler function.
void Os_evt_set (
U16 event_flags,/* Bit pattern of event flags to set */
Os_tid task); /* The task, the events apply to */
Trigger Event function,
Event_flags represents an event that is triggered by an event that consumes a bit corresponding to a bit,event_flags of 1.
The task ID that represents the wait event.
Os_result Os_evt_wait_or (
U16 wait_flags,/* Bit pattern of events to wait for * *
U16 timeout); /* Length of time to wait for event */
return value:
Os_r_evt--at least one of the flags specified by Wait_flags have been set.
Os_r_tmo--the timeout has expired.
The function waits for an event specified by wait_flags to occur or times out before returning, and if it is returned by the event, the function will clear the event that causes the function to return.
, to know which event caused the function to return, can be obtained through the OS_GET_EVT function.
Returning OS_R_EVT indicates that at least one event in the awaited event has occurred. If you wait for multiple events at the same time, such as wait_flags=0x03, returning os_r_evt may be:
<1> Event 0 took place (0x01)
<2> Event 1 took place (0x02)
<3> event 0,1 occurred at the same time (0x03)
Returns OS_R_TMO indicates that the wait event timed out, and 0xFFFF indicates an infinite wait.
U16 os_evt_get (void);
The function returns the event that caused the Os_evt_wait_or function to return, and if Os_evt_wait_or returns with a timeout, the function returns 0.
Os_result Os_evt_wait_and (
U16 wait_flags,/* Bit pattern of events to wait for * *
U16 timeout); /* Length of time to wait for event */
return value:
Os_r_evt--all the flags specified by Wait_flags has been set.
Os_r_tmo--the timeout has expired.
The function waits for all events specified by wait_flags to occur or times out before returning, and if it is returned by the event, the function will clear the event that the wait_flags waits for.
The parameter, timeout, indicates the time to return the system tick.
void Os_evt_clr (
U16 clear_flags,/* Bit pattern of event flags to clear */
Os_tid task); /* The task, the events apply to */
Clears the event function, where the parameter clear_flags represents the event to be purged (the corresponding bit is 1), and the task is the job ID of the wait event.
void Isr_evt_set (
U16 event_flags,/* Bit pattern of event flags to set */
Os_tid task); /* The task, the events apply to */
This function can only be called in an IRQ and cannot be called in Fiq (for ARM7,ARM9 MCU), cortex-m3 all interrupt handler functions can be called.
So if you call the function in a place where the interrupt is very frequent, it can cause other tasks to not run if an event is touched in the interrupt handler
Two times, the task that waits for the event is likely to capture only one event at a time.
Communication between the RTX tasks--event flags