コード例 #1
0
ファイル: raw_work_queue.c プロジェクト: Lizuxiang/raw-os
static void work_queue_task(void *pa)
{
	RAW_OS_ERROR  ret;
	OBJECT_WORK_QUEUE_MSG *msg_recv;
	WORK_QUEUE_STRUCT *wq;

	RAW_SR_ALLOC();
	
	wq = pa;

	while (1) {

		ret = raw_queue_receive (&wq->queue, RAW_WAIT_FOREVER, (void **)(&msg_recv));

		if (ret != RAW_SUCCESS) {
			
			RAW_ASSERT(0);

		}

		msg_recv->handler(msg_recv->arg, msg_recv->msg);

		RAW_CPU_DISABLE();

		msg_recv->next = free_work_queue_msg;
		free_work_queue_msg = msg_recv;

		RAW_CPU_ENABLE();


	}

}
コード例 #2
0
ファイル: active_object.c プロジェクト: aaron5117/raw-os
/*
************************************************************************************************************************
*                                   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
*                    ---------
*                   me is the active object  to post       
*				         
* Returns			
*						
* Note(s)    	
*
*             
************************************************************************************************************************
*/
RAW_U16 active_event_recall(ACTIVE_OBJECT_STRUCT *me, RAW_QUEUE *q) 
{
	STATE_EVENT *event;
	RAW_U16 recalled;
	RAW_U16 err;
	RAW_SR_ALLOC();

	err = raw_queue_receive (q, RAW_NO_WAIT, (RAW_VOID  **)&event);

	if (err == RAW_SUCCESS) {
		
		RAW_CPU_DISABLE();

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

		RAW_CPU_ENABLE();

		active_event_post_front(me, event);

		recalled = 1;
	}

	else {

		recalled = 0;
	}


	return recalled;
}
コード例 #3
0
ファイル: active_object.c プロジェクト: Lizuxiang/raw-os
STATE_EVENT *active_event_get(ACTIVE_OBJECT_STRUCT *me) 
{
	RAW_OS_ERROR err;
	STATE_EVENT *e;

	err = raw_queue_receive (&me->active_queue, RAW_WAIT_FOREVER, (void  **)&e);

	if (err != RAW_SUCCESS) {


		RAW_ASSERT(0);
	}

	return e;
	
}
コード例 #4
0
ファイル: active_object.c プロジェクト: Lizuxiang/raw-os
/*
************************************************************************************************************************
*                                   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
*                    ---------
*                   me is the active object  to post       
*				         
* Returns			
*						
* Note(s)    	
*
*             
************************************************************************************************************************
*/
RAW_U16 active_event_recall(ACTIVE_OBJECT_STRUCT *me, RAW_QUEUE *q) 
{
	STATE_EVENT *event;
	RAW_U16 recalled;
	RAW_OS_ERROR err;
	
	err = raw_queue_receive (q, RAW_NO_WAIT, (void  **)&event);

	if (err == RAW_SUCCESS) {

		active_event_post_front(me, event);

		recalled = 1;
	}

	else {

		recalled = 0;
	}


	return recalled;
}