/* ************************************************************************************************************************ * Notify function call back * * Description: This function is called to post a msg to the queue end and implement FIFO. * * Arguments :p_q is the address of the queue object * ----- * p_void is the address of the msg * ----- * * * Returns * RAW_SUCCESS: raw os return success * RAW_MSG_MAX:queue is full * * * * Note(s) * * ************************************************************************************************************************ */ RAW_U16 raw_queue_post_notify(RAW_QUEUE *p_q, RAW_VOID *p_void) { #if (RAW_QUEUE_FUNCTION_CHECK > 0) if (p_q == 0) { return RAW_NULL_OBJECT; } if (p_void == 0) { return RAW_NULL_POINTER; } #endif #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting) { return int_msg_post(RAW_TYPE_Q_END, p_q, p_void, 0, 0, 0); } #endif return msg_post(p_q, p_void, SEND_TO_END, WAKE_ONE_QUEUE); }
/* ************************************************************************************************************************ * Post a msg to the all the task waiting for on this queue * * Description: This function is called to post a msg to the queue end and implement FIFO or LIFO as opt specified. * * Arguments :p_q is the address of the queue object * ----- * p_void is the address of the msg * ----- * opt: the opt option is: * SEND_TO_END implement FIFO * SEND_TO_FRONTimplement LIFO * ----- * * * Returns RAW_SUCCESS: raw os return success * RAW_MSG_MAX:queue is full * * Note(s) THis function will wake all the task waiting for this queue other than one! * * ************************************************************************************************************************ */ RAW_U16 raw_queue_all_post(RAW_QUEUE *p_q, RAW_VOID *p_void, RAW_U8 opt) { #if (RAW_QUEUE_FUNCTION_CHECK > 0) if (p_q == 0) { return RAW_NULL_OBJECT; } if (p_void == 0) { return RAW_NULL_POINTER; } #endif TRACE_QUEUE_AP_TIME_RECORD(p_q, p_void, opt); #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting) { return int_msg_post(RAW_TYPE_Q_ALL, p_q, p_void, 0, 0, opt); } #endif return msg_post(p_q, p_void, opt, WAKE_ALL_QUEUE); }
/* ************************************************************************************************************************ * Set an event * * Description: This service sets or clears event flags in an event flags group, depending * upon the specified set-option. All suspended threads whose event flags * request is now satisfied are resumed. * * Arguments :event_ptr: is the address of event object * ----- * flags_to_set: is the event flags to set or clear based * upon the set option selected. * * ----- * set_option Specifies whether the event flags specified are * ANDed or ORed into the current event flags of * the group. The following are valid selections: * RAW_AND * * RAW_OR * Selecting RAW_AND specifies that the specified * event flags are ANDed into the current event * flags in the group andthis option will not wake any event and is often used to * clear event flags in a group. Otherwise, if RAW_OR * is specified, the specified event flags are ORed * with the current event in the group and this option may wake event * * Returns RAW_SUCCESS : Set event success. * RAW_OBJ_INVALIDATE_STATE:invalidate task state, possibly system error * * Note(s) :if the set_option is AND_MASK, it just clear the flags and will return immediately! * * ************************************************************************************************************************ */ RAW_U16 raw_event_set(RAW_EVENT *event_ptr, RAW_U32 flags_to_set, RAW_U8 set_option) { #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 #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting) { return int_msg_post(RAW_TYPE_EVENT, event_ptr, 0, 0u, flags_to_set, set_option); } #endif return event_set(event_ptr, flags_to_set, set_option); }
/* ************************************************************************************************************************ * Post a msg to the queue end * * Description: This function is called to post a msg to the queue end and implement FIFO. * * Arguments :p_q is the address of the queue object * ----- * p_void is the address of the msg * ----- * * * Returns * RAW_SUCCESS: raw os return success * RAW_MSG_MAX:queue is full * * * * Note(s) * * ************************************************************************************************************************ */ RAW_U16 raw_queue_end_post(RAW_QUEUE *p_q, RAW_VOID *p_void) { #if (RAW_QUEUE_FUNCTION_CHECK > 0) if (p_q == 0) { return RAW_NULL_OBJECT; } if (p_void == 0) { return RAW_NULL_POINTER; } #endif TRACE_QUEUE_EP_TIME_RECORD(p_q, p_void); #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting && raw_sched_lock) { return int_msg_post(RAW_TYPE_Q_END, p_q, p_void, 0, 0, 0); } #endif return msg_post(p_q, p_void, SEND_TO_END, WAKE_ONE_QUEUE); }
/* ************************************************************************************************************************ * Post a msg to the queue front * * Description: This function is called to post a msg to the queue front and implement LIFO. * * Arguments :p_q is the address of the queue object * ----- * p_void is the address of the msg * ----- * * * Returns * RAW_SUCCESS: raw os return success * RAW_MSG_MAX:queue is full * * * * Note(s) * * ************************************************************************************************************************ */ RAW_OS_ERROR raw_queue_front_post(RAW_QUEUE *p_q, void *p_void) { #if (RAW_QUEUE_FUNCTION_CHECK > 0) if (p_q == 0) { return RAW_NULL_OBJECT; } if (p_void == 0) { return RAW_NULL_POINTER; } #endif TRACE_QUEUE_FP_TIME_RECORD(p_q, p_void); #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting && raw_sched_lock) { return int_msg_post(RAW_TYPE_Q_FRONT, p_q, p_void, 0, 0, 0); } #endif return msg_post(p_q, p_void,SEND_TO_FRONT, WAKE_ONE_QUEUE); }
/* ************************************************************************************************************************ * Post a msg to the all the task waiting for on this queue with size * * Description: This function is called to post a msg to the queue end and implement FIFO or LIFO as opt specified. * * Arguments :p_q is the address of the queue object * ----- * p_void is the address of the msg * ----- * opt: the opt option is: * SEND_TO_END implement FIFO * SEND_TO_FRONTimplement LIFO * ----- * * size : is the message size to be posted * * Returns * RAW_SUCCESS: raw os return success * RAW_MSG_MAX:queue is full * *Note(s) THis function will wake all the task waiting for this queue other than one! * * ************************************************************************************************************************ */ RAW_OS_ERROR raw_queue_size_all_post(RAW_QUEUE_SIZE *p_q, void *p_void, MSG_SIZE_TYPE size, RAW_U8 opt) { #if (RAW_QUEUE_SIZE_FUNCTION_CHECK > 0) if (p_q == 0) { return RAW_NULL_OBJECT; } /*if send null pointer, just return*/ if (p_void == 0) { return RAW_NULL_POINTER; } #endif #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting) { return int_msg_post(RAW_TYPE_Q_SIZE_ALL, p_q, p_void, size, 0, opt); } #endif return msg_size_post(p_q, p_void, size, opt, WAKE_ALL_QUEUE); }
/* ************************************************************************************************************************ * Post a msg to the queue end with size * * Description: This function is called to post a msg to the queue end and implement FIFO. * * Arguments :p_q is the address of the queue object * ----- * p_void is the address of the msg * ----- * wait_option: is how the service behaves if the msg queue is full. * The wait options are * defined as follows: * RAW_NO_WAIT (0x00000000) * RAW_WAIT_FOREVER (0xFFFFFFFF) * timeout value (0x00000001 * through * 0xFFFFFFFE) * --------- * size : is the message size to be posted * * Returns * RAW_SUCCESS: raw os return success * RAW_MSG_MAX:queue is full * * Note(s) * * ************************************************************************************************************************ */ RAW_OS_ERROR raw_queue_size_end_post(RAW_QUEUE_SIZE *p_q, void *p_void, MSG_SIZE_TYPE size) { #if (RAW_QUEUE_SIZE_FUNCTION_CHECK > 0) if (p_q == 0) { return RAW_NULL_OBJECT; } /*if send null pointer, just return*/ if (p_void == 0) { return RAW_NULL_POINTER; } #endif #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting && raw_sched_lock) { return int_msg_post(RAW_TYPE_Q_SIZE_END, p_q, p_void, size, 0, 0); } #endif return msg_size_post(p_q, p_void, size, SEND_TO_END, WAKE_ONE_QUEUE); }
/* ************************************************************************************************************************ * Post an event (LIFO) to idle task * * Description: This function is called to post an event to idle task, it might be called in interrupt. * * Arguments :me is the address of ACTIVE_EVENT_STRUCT * ----- * sig is the signal which want to be posted to idle task * ----- * para is the parameter which want to be posted to idle task. * * Returns RAW_SUCCESS: raw os return success * RAW_IDLE_EVENT_EXHAUSTED: No more msg to me. * * Note(s) * * ************************************************************************************************************************ */ RAW_OS_ERROR idle_event_front_post(ACTIVE_EVENT_STRUCT *me, RAW_U16 sig, void *para) { #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting && raw_sched_lock) { return int_msg_post(RAW_TYPE_IDLE_FRONT_EVENT_POST, me, para, sig, 0, 0); } #endif return event_post(me, sig, para, SEND_TO_FRONT); }
/* ************************************************************************************************************************ * Notify function call back and release a semaphore. * * Description: This function is called to call back a registered notify function. * * Arguments :semaphore_ptr is the address of semphore object want to be initialized * ----- * * * Returns RAW_SEMAPHORE_OVERFLOW: semphore value excedded 0xffffffff * RAW_SUCCESS: raw os return success * Note(s) * * ************************************************************************************************************************ */ RAW_U16 raw_semaphore_put_notify(RAW_SEMAPHORE *semaphore_ptr) { #if (RAW_SEMA_FUNCTION_CHECK > 0) if (semaphore_ptr == 0) { return RAW_NULL_OBJECT; } #endif #if (CONFIG_RAW_ZERO_INTERRUPT > 0) if (raw_int_nesting) { return int_msg_post(RAW_TYPE_SEM, semaphore_ptr, 0, 0, 0, 0); } #endif return semaphore_put(semaphore_ptr, WAKE_ONE_SEM); }