Beispiel #1
0
/*
************************************************************************************************************************
*                                    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);
	
}
Beispiel #2
0
/*
************************************************************************************************************************
*                                   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);
	
}
Beispiel #3
0
/*
************************************************************************************************************************
*                                    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);
	
}
Beispiel #4
0
/*
************************************************************************************************************************
*                                    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);
}
Beispiel #5
0
void
app_cfg_set_net_settings(const net_settings_t* settings)
{
  if (memcmp(settings, &app_cfg_local.data.net_settings, sizeof(net_settings_t)) != 0) {
    chMtxLock(&app_cfg_mtx);
    app_cfg_local.data.net_settings = *settings;
    chMtxUnlock();

    msg_post(MSG_NET_NETWORK_SETTINGS, NULL);
  }
}
Beispiel #6
0
static void int_msg_handler(TASK_0_EVENT_TYPE ev, void *msg_data)
{
	OBJECT_INT_MSG *int_msg;
	RAW_OS_ERROR   int_msg_ret;
	
	RAW_SR_ALLOC();
	
	int_msg = msg_data;
	int_msg_ret = RAW_SYSTEM_ERROR;
	
	switch (ev) {

		#if (CONFIG_RAW_TASK_SUSPEND > 0)
		
		case RAW_TYPE_SUSPEND:
			int_msg_ret = task_suspend((RAW_TASK_OBJ *)(int_msg->object));
			break;

			
		#endif
		
		#if (CONFIG_RAW_TASK_RESUME > 0)
		
		case RAW_TYPE_RESUME:
			int_msg_ret = task_resume((RAW_TASK_OBJ *)(int_msg->object));
			break;

			
		#endif

		#if (CONFIG_RAW_SEMAPHORE > 0)
		
		case RAW_TYPE_SEM:
			int_msg_ret = semaphore_put((RAW_SEMAPHORE *)(int_msg->object), WAKE_ONE_SEM);
			break;

		case RAW_TYPE_SEM_ALL:
			int_msg_ret = semaphore_put((RAW_SEMAPHORE *)(int_msg->object), WAKE_ALL_SEM);
			break;
			
		#endif
		
		
		#if (CONFIG_RAW_QUEUE > 0)
		
		case RAW_TYPE_Q_FRONT:
			int_msg_ret = msg_post((RAW_QUEUE *)(int_msg->object), int_msg->msg, SEND_TO_FRONT, WAKE_ONE_QUEUE);
			break;

		case RAW_TYPE_Q_END:
			int_msg_ret = msg_post((RAW_QUEUE *)(int_msg->object), int_msg->msg, SEND_TO_END, WAKE_ONE_QUEUE);
			break;

		case RAW_TYPE_Q_ALL:
			int_msg_ret = msg_post((RAW_QUEUE *)(int_msg->object), int_msg->msg, int_msg->opt, WAKE_ALL_QUEUE);
			break;

		#endif


		#if (CONFIG_RAW_QUEUE_SIZE > 0)
		
		case RAW_TYPE_Q_SIZE_FRONT:
			int_msg_ret = msg_size_post((RAW_QUEUE_SIZE *)(int_msg->object), int_msg->msg, int_msg->msg_size, SEND_TO_FRONT, WAKE_ONE_QUEUE);
			break;

		case RAW_TYPE_Q_SIZE_END:
			int_msg_ret = msg_size_post((RAW_QUEUE_SIZE *)(int_msg->object), int_msg->msg, int_msg->msg_size, SEND_TO_END, WAKE_ONE_QUEUE);
			break;

		case RAW_TYPE_Q_SIZE_ALL:
			int_msg_ret = msg_size_post((RAW_QUEUE_SIZE *)(int_msg->object), int_msg->msg, int_msg->msg_size, int_msg->opt, WAKE_ALL_QUEUE);
			break;

		#endif

		#if (CONFIG_RAW_EVENT > 0)
		
		case RAW_TYPE_EVENT:
			int_msg_ret = event_set((RAW_EVENT *)(int_msg->object), int_msg->event_flags, int_msg->opt);
			break;
			
		#endif

		#if (CONFIG_RAW_IDLE_EVENT > 0)
		
		case RAW_TYPE_IDLE_END_EVENT_POST:
			int_msg_ret = event_post((ACTIVE_EVENT_STRUCT *)(int_msg->object), int_msg->msg_size, int_msg->msg, SEND_TO_END);
			break;

		case RAW_TYPE_IDLE_FRONT_EVENT_POST:
			int_msg_ret = event_post((ACTIVE_EVENT_STRUCT *)(int_msg->object), int_msg->msg_size, int_msg->msg, SEND_TO_FRONT);
			break;
			
		#endif
		
		default:
			RAW_ASSERT(0);



	}

	if (int_msg_ret != RAW_SUCCESS) {

		/*trace the incorrect information here, there is no way to infrom user at this condition*/
		TRACE_INT_MSG_HANDLE_ERROR(ev, int_msg->object, int_msg_ret);
	}

	RAW_CPU_DISABLE();

	int_msg->next = free_object_int_msg;
	free_object_int_msg = int_msg;
	
	RAW_CPU_ENABLE();

}