Esempio n. 1
0
void *thread_queue_receive(void *arg)
{
	GL_Status_t ret;
	GL_UINT32 msg;

	do {
		ret = GL_QueueReceive(*(GL_Queue_t *)arg, (void *)&msg, sizeof(msg), 2000);
		if (GL_SUCCESS == ret) {
			printf("Recv %u\n", msg);
		} else {
			break;
		}
	} while (1);

	return NULL;
}
Esempio n. 2
0
static void entry2(void *arg)
{
    GL_Status_t res;
    int i;
    char rec_msg[326];

    while (1) {
        res = GL_QueueReceive(queue_id1, rec_msg, 326, GL_INFINITE_WAIT);
        if (res != GL_SUCCESS) {
            diag_printf("receive timeout\n");
            continue;
        }
        diag_printf("message recieved : dumped:\n");
        for (i = 0; i < 215; i++) {
            diag_printf("%x ", rec_msg[i]);
        }
        diag_printf("entry2 alive\n");
    }
}
Esempio n. 3
0
static GL_Status_t test_GL_QueueDump(void)
{
	GL_Status_t ret = GL_SUCCESS;
	GL_Queue_t queueDump;
	GL_UINT32 const msgsize = 64;
	GL_UINT32 const initNum = 12;
	GL_UINT32 const initNumUrgent = 4;
	GL_UINT8  msgbuf[msgsize];
	GL_UINT8  recbuf[msgsize];
	GL_UINT32 i;

	for(i=0; i<10; i++){
		msgbuf[i] = i+0x30;
	}
	msgbuf[10] = 0;

	GL_TraceError("[%s]GL_QueueCreate\n", __FUNCTION__);
	if(GL_SUCCESS != (ret = GL_QueueCreate("listDump", msgsize, initNum, initNumUrgent, &queueDump))){
		GL_TraceError("[%s-%4d]GL_QueueCreate fail\n", __FUNCTION__, __LINE__);
		return ret;
	}
	GL_QUEUE_DUMP_LIST(0);

	GL_TraceError("[%s]GL_QueueSend %d times\n", __FUNCTION__, initNum+1);
	for(i=0; i<initNum+1; i++){
		if(GL_SUCCESS != (ret = GL_QueueSend(queueDump, (void*)msgbuf, 10))){
			GL_TraceError("[%s-%4d]GL_QueueSend fail\n", __FUNCTION__, __LINE__);
			//goto __exit;
			break;
		}
		GL_TraceInfo("GL_QueueSend:%s\n", msgbuf);
		GL_QUEUE_DUMP_LIST(0);
	}

	GL_TraceError("[%s]GL_QueueSendUrgent %d times\n", __FUNCTION__, initNumUrgent+1);
	for(i=0; i<initNumUrgent+1; i++){
		if(GL_SUCCESS != (ret = GL_QueueSendUrgent(queueDump, (void*)msgbuf, 10))){
			GL_TraceError("[%s-%4d]GL_QueueSendUrgent fail\n", __FUNCTION__, __LINE__);
			//goto __exit;
			break;
		}
		GL_TraceInfo("GL_QueueSendUrgent:%s\n", msgbuf);
		GL_QUEUE_DUMP_LIST(0);
	}

	GL_TraceError("[%s]GL_QueueReceive %d times\n", __FUNCTION__, initNum+initNumUrgent+1);
	for(i=0; i<initNum+initNumUrgent+1; i++){
		if(GL_SUCCESS != (ret = GL_QueueReceive(queueDump, (void*)recbuf, 10, GL_NO_WAIT))){
			GL_TraceError("[%s-%4d]GL_QueueReceive fail! ret=%d\n", __FUNCTION__, __LINE__, ret);
			//goto __exit;
			break;
		}
		recbuf[10] = 0;
		GL_TraceInfo("GL_QueueReceive:%s\n", recbuf);
		GL_QUEUE_DUMP_LIST(0);
	}

//__exit:

	GL_TraceError("[%s]GL_QueueDelete\n", __FUNCTION__);
	if(GL_SUCCESS != (ret = GL_QueueDelete(queueDump))){
		GL_TraceError("[%s-%4d]GL_QueueDelete fail\n", __FUNCTION__, __LINE__);
		return ret;
	}

	GL_QUEUE_DUMP_LIST(0);
	return ret;
}