????????????????????get???????????????????????get_option?????????????????????????????????е????????????????????????clear??λ???????????????????????

??????1???ж??????????ж??У?

??????2???ж?get_option???????

??????3???ж???????????????????and??????or??

??????4??????????????????????ж?????????λ???????????????

??????5???ж??????????????????

??????6???ж??????????????????

??????7???????pend??????????У?

??????8?????ù??????????????????????????У?

??????9???????????μ?????е?????????????????λ???????????

?????????????????????????????????????ú?????

RAW_U16 raw_event_set(RAW_EVENT *event_ptr?? RAW_U32  flags_to_set?? RAW_U8 set_option)
 {
  LIST              *iter;
  LIST              *event_head_ptr;
  LIST            *iter_temp;
  struct RAW_TASK_OBJ          *task_ptr;
  
  RAW_U8 status;
  RAW_U8 need_sche = 0;
  
  RAW_SR_ALLOC();
 
  #if (RAW_EVENT_FUNCTION_CHECK > 0)
 
  if (event_ptr == 0) {
   return RAW_NULL_OBJECT;
  }
  
  if ((set_option  != RAW_AND) && (set_option  != RAW_OR)) {
   return RAW_NO_THIS_OPTION;
  }
  
  #endif
 
  event_head_ptr =  &event_ptr->common_block_obj.block_list;
  
  status = RAW_FALSE;
  
  RAW_CRITICAL_ENTER();
 
     /*if the set_option is AND_MASK?? it just clear the flags and will return immediately!*/
     if (set_option & RAW_FLAGS_AND_MASK)  {
   
   event_ptr->flags  &=  flags_to_set;
 
   RAW_CRITICAL_EXIT();
   return  RAW_SUCCESS;
     }
  /*if it is or mask then set the flag and continue.........*/
     else  {
    
   event_ptr->flags |= flags_to_set;   
     }
 
  iter = event_head_ptr->next;
 
  /*if list is not empty*/
   while (iter !=event_head_ptr) {
 
   task_ptr =  list_entry(iter?? RAW_TASK_OBJ?? task_list);
   iter_temp =  iter->next;
   
   if (task_ptr->raw_suspend_option & RAW_FLAGS_AND_MASK)  {
 
    if ((event_ptr->flags  & task_ptr ->raw_suspend_flags) == task_ptr ->raw_suspend_flags)
     status =  RAW_TRUE;
    else
 
     status =   RAW_FALSE;
   }
 
   
   else {
 
    if (event_ptr->flags  &  task_ptr ->raw_suspend_flags)
     
     status =  RAW_TRUE;
    else
     
     status =  RAW_FALSE;
   }
 
   
   if  (status)  {
    
    /*Ok the task condition is met?? just wake this task*/
    raw_wake_object(task_ptr);
  
    /*if  task is waken up*/
    need_sche = 1;
   }
 
   iter = iter_temp;
 
   }
 
  RAW_CRITICAL_EXIT();
 
  if (need_sche) {
   
   raw_sched();
  }
  return RAW_SUCCESS;
 }