RT-Thread RTOS
1.2.0
An open source embedded real-time operating system
|
Macros | |
#define | RT_EVENT_FLAG_AND 0x01 |
#define | RT_EVENT_FLAG_OR 0x02 |
#define | RT_EVENT_FLAG_CLEAR 0x04 |
Functions | |
rt_err_t | rt_event_init (rt_event_t event, const char *name, rt_uint8_t flag) |
rt_err_t | rt_event_detach (rt_event_t event) |
rt_event_t | rt_event_create (const char *name, rt_uint8_t flag) |
rt_err_t | rt_event_delete (rt_event_t event) |
rt_err_t | rt_event_send (rt_event_t event, rt_uint32_t set) |
rt_err_t | rt_event_control (rt_event_t event, int cmd, void *arg) |
#define RT_EVENT_FLAG_AND 0x01 |
flag definitions in event logic and
#define RT_EVENT_FLAG_OR 0x02 |
logic or
#define RT_EVENT_FLAG_CLEAR 0x04 |
clear flag
rt_err_t rt_event_init | ( | rt_event_t | event, |
const char * | name, | ||
rt_uint8_t | flag | ||
) |
The function will initialize a static event object.
event | is a pointer to the event to initialize. It is assumed that storage for the event will be allocated in your application. |
name | is a pointer to the name that given to the event. |
flag | is the event flag, which determines the queuing way of how multiple threads wait when the event is not available. The event flag can be ONE of the following values: RT_IPC_FLAG_PRIO The pending threads will queue in order of priority. RT_IPC_FLAG_FIFO The pending threads will queue in the first-in-first-out method (also known as first-come-first-served (FCFS) scheduling strategy). NOTE: RT_IPC_FLAG_FIFO is a non-real-time scheduling mode. It is strongly recommended to use RT_IPC_FLAG_PRIO to ensure the thread is real-time UNLESS your applications concern about the first-in-first-out principle, and you clearly understand that all threads involved in this event will become non-real-time threads. |
rt_err_t rt_event_detach | ( | rt_event_t | event | ) |
This function will detach a static event object.
event | is a pointer to an event object to be detached. |
rt_event_t rt_event_create | ( | const char * | name, |
rt_uint8_t | flag | ||
) |
Creating an event object.
name | is a pointer to the name that given to the event. |
flag | is the event flag, which determines the queuing way of how multiple threads wait when the event is not available. The event flag can be ONE of the following values: RT_IPC_FLAG_PRIO The pending threads will queue in order of priority. RT_IPC_FLAG_FIFO The pending threads will queue in the first-in-first-out method (also known as first-come-first-served (FCFS) scheduling strategy). NOTE: RT_IPC_FLAG_FIFO is a non-real-time scheduling mode. It is strongly recommended to use RT_IPC_FLAG_PRIO to ensure the thread is real-time UNLESS your applications concern about the first-in-first-out principle, and you clearly understand that all threads involved in this event will become non-real-time threads. |
rt_err_t rt_event_delete | ( | rt_event_t | event | ) |
This function will delete an event object and release the memory space.
event | is a pointer to an event object to be deleted. |
rt_err_t rt_event_send | ( | rt_event_t | event, |
rt_uint32_t | set | ||
) |
This function will send an event to the event object. If there is a thread suspended on the event, the thread will be resumed.
event | is a pointer to the event object to be sent. |
set | is a flag that you will set for this event's flag. You can set an event flag, or you can set multiple flags through OR logic operation. |
rt_err_t rt_event_control | ( | rt_event_t | event, |
int | cmd, | ||
void * | arg | ||
) |
This function will set some extra attributions of an event object.
event | is a pointer to an event object. |
cmd | is a command word used to configure some attributions of the event. |
arg | is the argument of the function to execute the command. |