事件

宏定义

#define AOS_EVENT_AND   0x02u
 
#define AOS_EVENT_AND_CLEAR   0x03u
 
#define AOS_EVENT_OR   0x00u
 
#define AOS_EVENT_OR_CLEAR   0x01u
 

类型定义

typedef aos_hdl_t aos_event_t
 

函数

aos_status_t aos_event_create (aos_event_t *event, uint32_t value, uint32_t options)
 
void aos_event_free (aos_event_t *event)
 
aos_status_t aos_event_get (aos_event_t *event, uint32_t value, uint32_t opt, uint32_t *actl_value, uint32_t timeout)
 
aos_status_t aos_event_set (aos_event_t *event, uint32_t value, uint32_t opt)
 
aos_status_t aos_event_new (aos_event_t *event, uint32_t value)
 
bool aos_event_is_valid (aos_event_t *event)
 
aos_status_t aos_queue_new (aos_queue_t *queue, void *buf, size_t size, size_t max_msg)
 
bool aos_queue_is_valid (aos_queue_t *queue)
 
void * aos_queue_buf_ptr (aos_queue_t *queue)
 

详细描述

提供AliOS Things系统内核事件功能的基础API.

宏定义说明

◆ AOS_EVENT_AND

#define AOS_EVENT_AND   0x02u

期望事件标志位均为1时,即等待所有事件均发生时,任务解除阻塞

在文件 kernel.h53 行定义.

◆ AOS_EVENT_AND_CLEAR

#define AOS_EVENT_AND_CLEAR   0x03u

期望事件标志位均为1时,即等待所有事件均发生时,任务解除阻塞且将事件标志位清零

在文件 kernel.h54 行定义.

◆ AOS_EVENT_OR

#define AOS_EVENT_OR   0x00u

期望任意事件标志位为1时,即等待的任意事件发生,任务解除阻塞

在文件 kernel.h55 行定义.

◆ AOS_EVENT_OR_CLEAR

#define AOS_EVENT_OR_CLEAR   0x01u

期望任意事件标志位为1时,即等待的任意事件发生,任务解除阻塞且将事件标志位清零

在文件 kernel.h56 行定义.

类型定义说明

◆ aos_event_t

AOS信号量对象句柄类型

在文件 kernel.h128 行定义.

函数说明

◆ aos_event_create()

aos_status_t aos_event_create ( aos_event_t event,
uint32_t  value,
uint32_t  options 
)

Alloc a event.

参数
[out]sempointer of event object, event object must be alloced, hdl pointer in aos_sem_t will refer a kernel obj internally.
[in]valueinitial event value.
[in]optionsreserved.
返回
0:success.

◆ aos_event_free()

void aos_event_free ( aos_event_t event)

Destroy a event.

参数
[in]eventpointer of event object, mem refered by hdl pointer in aos_hdl_t will be freed internally.

◆ aos_event_get()

aos_status_t aos_event_get ( aos_event_t event,
uint32_t  value,
uint32_t  opt,
uint32_t *  actl_value,
uint32_t  timeout 
)

Get a event.

参数
[in]eventevent object.
[in]valueExpect value.
[in]optMode of operation, one of AND/AND_CLEAR/OR/OR_CLEAR
[OUT]actl_value Actual acquired value
[in]timeoutwaiting until timeout in milliseconds.
  • 返回
    0:success.

◆ aos_event_is_valid()

bool aos_event_is_valid ( aos_event_t event)

This function will check if event is valid. Deprecated, not Recommended.

参数
[in]eventpointer to the event.
返回
false: invalid, true: valid.

◆ aos_event_new()

aos_status_t aos_event_new ( aos_event_t event,
uint32_t  value 
)

Alloc a event. Deprecated, not Recommended.

参数
[out]eventpointer of event object, event object must be alloced, hdl pointer in aos_hdl_t will refer a kernel obj internally.
[in]valueinitial event value.
返回
0:success.

◆ aos_event_set()

aos_status_t aos_event_set ( aos_event_t event,
uint32_t  value,
uint32_t  opt 
)

Set a event.

参数
[in]eventevent object.
[in]valueThe value to set.
[in]optMode of operation, one of AND/AND_CLEAR/OR/OR_CLEAR
[in]timeoutwaiting until timeout in milliseconds.
返回
0:success.

◆ aos_queue_buf_ptr()

void* aos_queue_buf_ptr ( aos_queue_t queue)

This function will return buf start ptr if queue is inited. Deprecated, not Recommended.

参数
[in]queuepointer to the queue.
返回
NULL: error.

◆ aos_queue_is_valid()

bool aos_queue_is_valid ( aos_queue_t queue)

This function will check if queue is valid. Deprecated, not Recommended.

参数
[in]queuepointer to the queue.
返回
false: invalid, true: valid.

◆ aos_queue_new()

aos_status_t aos_queue_new ( aos_queue_t queue,
void *  buf,
size_t  size,
size_t  max_msg 
)

This function will create a queue. Deprecated, not Recommended.

参数
[in]queuepointer to the queue(the space is provided by user).
[in]bufbuf of the queue(provided by user).
[in]sizethe bytes of the buf.
[in]max_msgthe max size of the msg.
返回
0: success.