예제 #1
0
파일: sched.c 프로젝트: liuning587/rtos_811
/*
* This function is used to flush the contents of the message queue.
*/
extern  uint8_t msgQFlush
    (
    MSG_Q_ID msgQId /* a pointer to the event control block associated with the desired queue */
    )
{
    return OSQFlush(msgQId);
}
예제 #2
0
void network_gm_reset(void)
{
	INT8S	res = 0;
//	INT8U 		err;
	gd_msg_t 	*send_msg = NULL;
	
	res = gprsmodule_reset();
	
	gd_msg_malloc(&send_msg);
	send_msg->data =  (void*)NULL;
	if(res == 0)	
	{
		fail_tick = 0;
		send_msg->type = GD_MSG_GM_INIT;
		OSQPost(gd_system.network_task.q_network, (void*)send_msg);	
	}
	else
	{
		fail_tick++;
		if(fail_tick >= NETWORK_FAIL_COUNT)
		{
			fail_tick = 0;
			OSQFlush(gd_system.network_task.q_network);
			//system reset
			system_reset();
		}
		else
		{
			send_msg->type = GD_MSG_GM_RESET;
		}
		OSQPost(gd_system.network_task.q_network, (void*)send_msg);	
	}

}
예제 #3
0
//========================================================
//Function Name:msgQFlush
//Syntax:		void msgQFlush(MSG_Q_ID msgQId)
//Purpose:		flush message queue
//Note:
//Parameters:   MSG_Q_ID msgQId
//Return:
//=======================================================
void msgQFlush(MSG_Q_ID msgQId)
{
	MSG_Q_LOCK();
	OSQFlush(msgQId->pEvent);
	gp_memset( (INT8S *)msgQId->pMsgPool, 0, msgQId->maxMsgs * (msgQId->maxMsgLength + 4) );
	MSG_Q_UNLOCK();
}
예제 #4
0
파일: TEST.C 프로젝트: loganwhite/uCOSIIExp
void  main (void) {
    PC_DispClrScr(DISP_FGND_WHITE + DISP_BGND_BLACK);      /* Clear the screen                         */

    OSInit();                                              /* Initialize uC/OS-II                      */

    PC_DOSSaveReturn();                                    /* Save environment to return to DOS        */
    PC_VectSet(uCOS, OSCtxSw);                             /* Install uC/OS-II's context switch vector */

    RandomSem   = OSSemCreate(1);                          /* Random number semaphore                  */
	MSGQ		= OSQCreate(MSGQGrp, N_TASKS);
	OSQFlush(MSGQ);
	
    OSTaskCreate(TaskStart, (void *)0, &TaskStartStk[TASK_STK_SIZE - 1], 0);
    OSStart();                                             /* Start multitasking                       */
}
예제 #5
0
/*
  Deallocates a mailbox. If there are messages still present in the
  mailbox when the mailbox is deallocated, it is an indication of a
  programming error in lwIP and the developer should be notified.
*/
void _sys_mbox_free(sys_mbox_t *mbox)
{
    u8_t     ucErr;
    
    LWIP_ASSERT( "sys_mbox_free ", *mbox != SYS_MBOX_NULL );    
    
    //clear OSQ EVENT
    OSQFlush( (*mbox)->pQ );
    
    //del OSQ EVENT
    (void)OSQDel( (*mbox)->pQ, OS_DEL_NO_PEND, &ucErr);
    LWIP_ASSERT( "OSQDel ", ucErr == OS_ERR_NONE );
    
    //put mem back to mem queue
    ucErr = OSMemPut( pQueueMem, (*mbox) );
    LWIP_ASSERT( "OSMemPut ", ucErr == OS_ERR_NONE );  
}
예제 #6
0
/*
  Deallocates a mailbox. If there are messages still present in the
  mailbox when the mailbox is deallocated, it is an indication of a
  programming error in lwIP and the developer should be notified.
*/
void
sys_mbox_free(sys_mbox_t mbox)
{
	u8_t     ucErr;
	
	LWIP_ASSERT( "sys_mbox_free ", mbox != SYS_MBOX_NULL );      
	    
	/* clear OSQ EVENT */
	OSQFlush( mbox->pQ );
	
	/* del OSQ EVENT */
	(void)OSQDel( mbox->pQ, OS_DEL_NO_PEND, &ucErr);
	LWIP_ASSERT( "OSQDel ", ucErr == OS_ERR_NONE );
	
	/* put mem back to mem queue */
	ucErr = OSMemPut( pQueueMem, mbox );
	LWIP_ASSERT( "OSMemPut ", ucErr == OS_ERR_NONE );  
}
예제 #7
0
void network_tcpip_mode(void)
{
	INT8S	res = 0;
	INT8U 		err;
	gd_msg_t 	*send_msg = NULL;


	OSSemPend(gd_system.gm_operate_sem, GD_SEM_TIMEOUT, &err);
	if(err != OS_NO_ERR)	
		res = -1;
	else 	
		res = gprs_tcpip_mode_init(0x01);   
 	OSSemPost(gd_system.gm_operate_sem);
	
	gd_msg_malloc(&send_msg);
	send_msg->data =  (void*)NULL;
	if(res == 0)
	{
		fail_tick = 0;
		gd_system.state = GD_STATE_STANDBY;
		send_msg->type = GD_MSG_TCP_CONNECT;
		OSQPost(gd_system.network_task.q_network, (void*)send_msg);	
	}
	else
	{
		fail_tick++;
		if(fail_tick >= NETWORK_FAIL_COUNT)
		{
			fail_tick = 0;	
			OSQFlush(gd_system.network_task.q_network);
			send_msg->type = GD_MSG_GM_RESET;
		}
		else
		{
			send_msg->type = GD_MSG_TCP_MODE_INIT;
		}	
		OSQPost(gd_system.network_task.q_network, (void*)send_msg);	
	}	

}
예제 #8
0
파일: key.c 프로젝트: postgetme/crco
void key_msg_flush (void)
{
    OSQFlush (os_q_key_msg);   
}
예제 #9
0
void flush_radio_queue(void)
{
    static OS_ERR os_err;

    OSQFlush(&opQueue, &os_err);
}
/**
 * reset uart read buffer
 */
void flushUARTBuffer()
{
	OSQFlush(uartQsem); //reset msg que usefull for cleaning invalid data
}