90#ifdef LOSCFG_BASE_CORE_SWTMR_ENABLE
99 if (eventCB == NULL) {
100 return LOS_ERRNO_EVENT_PTR_NULL;
107 OsHookCall(LOS_HOOK_TYPE_EVENT_INIT, eventCB);
114 return LOS_ERRNO_EVENT_PTR_NULL;
117 if (eventMask == 0) {
118 return LOS_ERRNO_EVENT_EVENTMASK_INVALID;
121 if (eventMask & LOS_ERRTYPE_ERROR) {
122 return LOS_ERRNO_EVENT_SETBIT_INVALID;
125 if (((mode & LOS_WAITMODE_OR) && (mode & LOS_WAITMODE_AND)) ||
126 (mode & ~(LOS_WAITMODE_OR | LOS_WAITMODE_AND | LOS_WAITMODE_CLR)) ||
127 !(mode & (LOS_WAITMODE_OR | LOS_WAITMODE_AND))) {
128 return LOS_ERRNO_EVENT_FLAGS_INVALID;
140 if (mode & LOS_WAITMODE_OR) {
141 if ((*eventID & eventMask) != 0) {
142 ret = *eventID & eventMask;
145 if ((eventMask != 0) && (eventMask == (*eventID & eventMask))) {
146 ret = *eventID & eventMask;
150 if (ret && (mode & LOS_WAITMODE_CLR)) {
151 *eventID = *eventID & ~ret;
168 return LOS_ERRNO_EVENT_READ_IN_INTERRUPT;
172 if (runTask->
taskStatus & OS_TASK_FLAG_SYSTEM_TASK) {
174 return LOS_ERRNO_EVENT_READ_IN_SYSTEM_TASK;
184 OsHookCall(LOS_HOOK_TYPE_EVENT_READ, eventCB, eventMask, mode, timeout);
196 return LOS_ERRNO_EVENT_READ_IN_LOCK;
204 if (ret == LOS_ERRNO_TSK_TIMEOUT) {
205 return LOS_ERRNO_EVENT_READ_TIMEOUT;
224 SCHEDULER_LOCK(intSave);
226 SCHEDULER_UNLOCK(intSave);
234 if (((resumedTask->
eventMode & LOS_WAITMODE_OR) && ((resumedTask->
eventMask & events) != 0)) ||
235 ((resumedTask->
eventMode & LOS_WAITMODE_AND) &&
241 resumedTask->
ops->
wake(resumedTask);
251 BOOL schedFlag = FALSE;
252 OsHookCall(LOS_HOOK_TYPE_EVENT_WRITE, eventCB, events);
264 resumedTask = nextTask;
268 if ((exitFlag != NULL) && (schedFlag == TRUE)) {
278 if (eventCB == NULL) {
279 return LOS_ERRNO_EVENT_PTR_NULL;
282 if (events & LOS_ERRTYPE_ERROR) {
283 return LOS_ERRNO_EVENT_SETBIT_INVALID;
286 SCHEDULER_LOCK(intSave);
288 SCHEDULER_UNLOCK(intSave);
307 SCHEDULER_LOCK(intSave);
309 SCHEDULER_UNLOCK(intSave);
315 return OsEventRead(eventCB, eventMask, mode, timeout, FALSE);
326 return OsEventRead(eventCB, eventMask, mode, timeout, TRUE);
338 if (eventCB == NULL) {
339 return LOS_ERRNO_EVENT_PTR_NULL;
342 SCHEDULER_LOCK(intSave);
344 SCHEDULER_UNLOCK(intSave);
345 return LOS_ERRNO_EVENT_SHOULD_NOT_DESTROY;
350 SCHEDULER_UNLOCK(intSave);
351 OsHookCall(LOS_HOOK_TYPE_EVENT_DESTROY, eventCB);
359 if (eventCB == NULL) {
360 return LOS_ERRNO_EVENT_PTR_NULL;
362 OsHookCall(LOS_HOOK_TYPE_EVENT_CLEAR, eventCB, eventMask);
363 SCHEDULER_LOCK(intSave);
365 SCHEDULER_UNLOCK(intSave);
370#ifdef LOSCFG_COMPAT_POSIX
382 SCHEDULER_LOCK(intSave);
391 SCHEDULER_UNLOCK(intSave);
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_EventClear(PEVENT_CB_S eventCB, UINT32 eventMask)
清除指定的事件类型
LITE_OS_SEC_TEXT_INIT UINT32 LOS_EventDestroy(PEVENT_CB_S eventCB)
销毁指定的事件控制块
LITE_OS_SEC_TEXT UINT32 LOS_EventPoll(UINT32 *eventID, UINT32 eventMask, UINT32 mode)
根据用户传入的事件值、事件掩码及校验模式,返回用户传入的事件是否符合预期
LITE_OS_SEC_TEXT UINT32 LOS_EventRead(PEVENT_CB_S eventCB, UINT32 eventMask, UINT32 mode, UINT32 timeout)
读取指定事件类型,超时时间为相对时间:单位为Tick
LITE_OS_SEC_TEXT UINT32 LOS_EventWrite(PEVENT_CB_S eventCB, UINT32 events)
写指定的事件类型
LITE_OS_SEC_TEXT_INIT UINT32 LOS_EventInit(PEVENT_CB_S eventCB)
初始化一个事件控制块
VOID OsBackTrace(VOID)
Kernel backtrace function.
STATIC INLINE VOID LOS_IntRestore(UINT32 intSave)
Restore interrupts. | 恢复到使用LOS_IntLock关闭所有中断之前的状态
STATIC INLINE UINT32 LOS_IntLock(VOID)
Disable all interrupts. | 关闭当前处理器所有中断响应
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelInit(LOS_DL_LIST *list)
Delete initialize a doubly linked list. | 将指定节点从链表中删除,并使用该节点初始化链表
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list)
LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list)
Identify whether a specified doubly linked list is empty. | 判断链表是否为空
VOID LOS_Schedule(VOID)
Trigger active task scheduling.
LITE_OS_SEC_TEXT UINT32 OsEventPoll(UINT32 *eventID, UINT32 eventMask, UINT32 mode)
根据用户传入的事件值、事件掩码及校验模式,返回用户传入的事件是否符合预期
LITE_OS_SEC_TEXT STATIC UINT32 OsEventReadImp(PEVENT_CB_S eventCB, UINT32 eventMask, UINT32 mode, UINT32 timeout, BOOL once)
读取指定事件类型的实现函数,超时时间为相对时间:单位为Tick
LITE_OS_SEC_TEXT_MINOR UINT32 OsEventReadOnce(PEVENT_CB_S eventCB, UINT32 eventMask, UINT32 mode, UINT32 timeout)
只读一次事件
LITE_OS_SEC_TEXT STATIC UINT32 OsEventReadCheck(const PEVENT_CB_S eventCB, UINT32 eventMask, UINT32 mode)
检查读事件
LITE_OS_SEC_TEXT STATIC UINT32 OsEventParamCheck(const VOID *ptr, UINT32 eventMask, UINT32 mode)
事件参数检查
LITE_OS_SEC_TEXT STATIC UINT8 OsEventResume(LosTaskCB *resumedTask, const PEVENT_CB_S eventCB, UINT32 events)
事件恢复操作
LITE_OS_SEC_TEXT_MINOR UINT32 OsEventWriteOnce(PEVENT_CB_S eventCB, UINT32 events)
只写一次事件
LITE_OS_SEC_TEXT STATIC UINT32 OsEventWrite(PEVENT_CB_S eventCB, UINT32 events, BOOL once)
写入事件
LITE_OS_SEC_TEXT STATIC UINT32 OsEventRead(PEVENT_CB_S eventCB, UINT32 eventMask, UINT32 mode, UINT32 timeout, BOOL once)
读取指定事件类型,超时时间为相对时间:单位为Tick
LITE_OS_SEC_TEXT UINT32 OsEventReadWithCond(const EventCond *cond, PEVENT_CB_S eventCB, UINT32 eventMask, UINT32 mode, UINT32 timeout)
有条件式读事件
LITE_OS_SEC_TEXT VOID OsEventWriteUnsafe(PEVENT_CB_S eventCB, UINT32 events, BOOL once, UINT8 *exitFlag)
以不安全的方式写事件
STATIC INLINE UINT32 OsIntLocked(VOID)
关闭当前处理器所有中断响应
VOID LOS_MpSchedule(UINT32 target)
STATIC INLINE LosTaskCB * OsCurrTaskGet(VOID)
STATIC INLINE BOOL OsPreemptableInSched(VOID)
BOOL LOS_SpinHeld(const SPIN_LOCK_S *lock)
STATIC INLINE VOID OsTaskWaitSetPendMask(UINT16 mask, UINTPTR lockID, UINT32 timeout)
设置事件阻塞掩码,即设置任务的等待事件.
STATIC INLINE VOID OsTaskWakeClearPendMask(LosTaskCB *resumeTask)
清除事件阻塞掩码,即任务不再等待任何事件.
volatile INT32 * realValue
struct LOS_DL_LIST * pstNext
UINT32(* wait)(LosTaskCB *runTask, LOS_DL_LIST *list, UINT32 timeout)
任务等待
VOID(* wake)(LosTaskCB *taskCB)
任务唤醒