???????????????????????????
???????????? ???????[ 2012/9/24 10:06:22 ] ????????
?????????????????????????????????????????н?????????????????????????????????????????????????????????????????????????????????????????????????????????????Щ???顣
???????????£????????????????????????????????????????????????????????ü?????????????????′????????????????????????ü??????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????а??????????????????????????и??????????????????????Щ?????????????????????????????????????????????????????????????????????????????и???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????й????????????????????????????????????????????????????????????????????y??????????????????????м???????????????????
???????????????????????????????????????????count?????????????????????????flags?????????????????е?bit????????????????????????????е???????????????????е?????????????????е?????????????bitλ??????????е??????????????????檔
???????????棬???????raw-os???????????????????????????????????????????????????????
typedef struct RAW_EVENT { RAW_COMMON_BLOCK_OBJECT common_block_obj; RAW_U32 flags; } RAW_EVENT; |
????????????????????????????????y?????flag?????????????????????????????????????????????????ú???????????????????????????????????????????????????????????????????
RAW_U16 raw_event_create(RAW_EVENT *event_ptr?? RAW_U8 *name_ptr?? RAW_U32 flags_init) { #if (RAW_EVENT_FUNCTION_CHECK > 0) if (event_ptr == 0) { return RAW_NULL_OBJECT; } #endif /*Init the list*/ list_init(&event_ptr->common_block_obj.block_list); event_ptr->common_block_obj.block_way = 0; event_ptr->common_block_obj.name = name_ptr; event_ptr->flags = flags_init ; return RAW_SUCCESS; } |
????????????????????????????????flags?????????????????????????????????flags??????????????????????????????????顢??????Щ???????????棬??????????????????????????????Щ
RAW_U16 raw_event_get(RAW_EVENT *event_ptr?? RAW_U32 requested_flags?? RAW_U8 get_option?? RAW_U32 wait_option) { RAW_U16 error_status; RAW_U8 status; RAW_SR_ALLOC(); #if (RAW_EVENT_FUNCTION_CHECK > 0) if (raw_int_nesting) { return RAW_NOT_CALLED_BY_ISR; } if ((get_option != RAW_AND) && (get_option != RAW_OR) && (get_option != RAW_AND_CLEAR) && (get_option != RAW_OR_CLEAR)) { return RAW_NO_THIS_OPTION; } #endif RAW_CRITICAL_ENTER(); /*if option is and flag*/ if (get_option & RAW_FLAGS_AND_MASK) { if ((event_ptr->flags & requested_flags) == requested_flags) { status = RAW_TRUE; } else { status = RAW_FALSE; } } /*if option is or flag*/ else { if (event_ptr->flags & requested_flags) { status = RAW_TRUE; } else { status = RAW_FALSE; } } if (status) { /*does it need to clear the flags*/ if (get_option & RAW_FLAGS_CLEAR_MASK) { event_ptr->flags &= ~requested_flags; } RAW_CRITICAL_EXIT(); return RAW_SUCCESS; } /*Cann't get event?? and return immediately if wait_option is RAW_NO_WAIT*/ if (wait_option == RAW_NO_WAIT) { RAW_CRITICAL_EXIT(); return RAW_NO_PEND_WAIT; } /*system is locked so task can not be blocked just return immediately*/ if (raw_sched_lock) { RAW_CRITICAL_EXIT(); return RAW_SCHED_DISABLE; } /*Remember the passed information*/ raw_task_active->raw_suspend_option = get_option; raw_task_active->raw_suspend_flags = requested_flags; raw_pend_object(&event_ptr->common_block_obj?? raw_task_active?? wait_option); RAW_CRITICAL_EXIT(); raw_sched(); RAW_CRITICAL_ENTER(); /*does it need to clear the flags*/ if (get_option & RAW_FLAGS_CLEAR_MASK) { event_ptr->flags &= ~requested_flags; } RAW_CRITICAL_EXIT(); /*So the task is waked up?? need know which reason cause wake up.*/ error_status = block_state_post_process(raw_task_active?? 0); return error_status; } |
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11