Exemplo n.º 1
0
/*
************************************************************************************************************************
*                                    Post an event to active object  
*
* Description: This function is called to post an event to active object (Implemented as FIFO way)
*
* Arguments  :me is the address of this active object
*                    ---------
*                    event is the address of sending event               
*				         
* Returns			
*						
* Note(s)    	
*
*             
************************************************************************************************************************
*/
void active_event_post_end(ACTIVE_OBJECT_STRUCT *me, STATE_EVENT *event)
{
	RAW_OS_ERROR err;

	RAW_SR_ALLOC();
	

	RAW_CPU_DISABLE();

	if (event->which_pool) {          
		event->ref_count++;          
	}

	RAW_CPU_ENABLE();

	err = raw_queue_end_post(&me->active_queue, (void *)event);

	if (err != RAW_SUCCESS) {

		RAW_ASSERT(0);

	}

	

	
	
}
Exemplo n.º 2
0
/*
************************************************************************************************************************
*                                   Post an event  to a defered queue
*
* Description: This function is called to post an event  to a defered queue.
*
* Arguments  :q is the address of the defered queue
*                    ---------
*                    event is the defered event           
*				         
* Returns			
*						
* Note(s)    	
*
*             
************************************************************************************************************************
*/
void active_event_defer_post(RAW_QUEUE *q, STATE_EVENT *event)
{
	RAW_OS_ERROR err;

	err = raw_queue_end_post(q, (void *)event);

	if (err != RAW_SUCCESS) {

		RAW_ASSERT(0);

	}
}
Exemplo n.º 3
0
/*
************************************************************************************************************************
*                                   Post an event  to a defered queue
*
* Description: This function is called to post an event  to a defered queue.
*
* Arguments  :q is the address of the defered queue
*                    ---------
*                    event is the defered event           
*				         
* Returns			
*						
* Note(s)    	
*
*             
************************************************************************************************************************
*/
void active_event_defer_post(RAW_QUEUE *q, STATE_EVENT *event)
{
	RAW_U16 ret;

	ret = raw_queue_end_post(q, (void *)event);

	if (ret != RAW_SUCCESS) {

		RAW_ASSERT(0);

	}
}
Exemplo n.º 4
0
/*
************************************************************************************************************************
*                                       Schedule the specific work queue
*
* Description: This function is called to schedule the specific work queue
*
* Arguments  :wq is the address of the work queue object
*                    -----
*                    arg is the argument passed to the handler
*	               -----
*                    msg is the message passed to the handler
*				         
* Returns   : RAW_SUCCESS
*                  RAW_WORK_QUEUE_MSG_MAX: need more work_queue_internal_msg.
*                  RAW_MSG_MAX:queue is full.
*
* Note(s)  :   This API can be called by interrupt or task.  
*
*             
************************************************************************************************************************
*/
RAW_OS_ERROR sche_work_queue(WORK_QUEUE_STRUCT *wq, RAW_U32 arg, void *msg, WORK_QUEUE_HANDLER handler)
{
	OBJECT_WORK_QUEUE_MSG *msg_data;
	RAW_OS_ERROR ret;

	RAW_SR_ALLOC();

	RAW_CPU_DISABLE();
	
	if (free_work_queue_msg == 0) {
		
		RAW_CPU_ENABLE();
		
		return RAW_WORK_QUEUE_MSG_MAX;
	}

	msg_data = free_work_queue_msg;

	free_work_queue_msg->arg = arg;
	free_work_queue_msg->msg = msg;
	free_work_queue_msg->handler = handler;
	
	free_work_queue_msg = free_work_queue_msg->next;

	RAW_CPU_ENABLE();
	
	ret = raw_queue_end_post(&wq->queue, msg_data);

	if (ret == RAW_SUCCESS) {

	}

	else {

		RAW_CPU_DISABLE();
		msg_data->next = free_work_queue_msg;
		free_work_queue_msg = msg_data;
		RAW_CPU_ENABLE();	
	}
		
	return ret;
}