#if (INCLUDE__UBINOS__UBIK_TEST == 1)
#if !(UBINOS__UBIK_TEST__EXCLUDE_MSGQTESTSET == 1)
#include <stdio.h>
#define TASKWORKINGTIMEMS 500
#define TASKLOOPCOUNT 10
#define MSGSIZE 2
#define MSGCOUNT 10
static void msgqtest00_task1func(void * arg) {
unsigned int i;
unsigned char buf[MSGSIZE];
for (i=0; i<MSGSIZE; i++) {
buf[i] = i;
}
for (i=0; i<TASKLOOPCOUNT; i++) {
printf("task 1 produces one message\n");
}
}
static void msgqtest00_task2func(void * arg) {
unsigned int i;
unsigned char buf[MSGSIZE];
for (i=0; i<TASKLOOPCOUNT/2; i++) {
printf("task 2 waits message\n");
printf("task 2 consumes one message\n");
}
}
static void msgqtest00_task3func(void * arg) {
unsigned int i;
unsigned char buf[MSGSIZE];
for (i=0; i<TASKLOOPCOUNT/2; i++) {
printf("task 3 waits message\n");
printf("task 3 consumes one message\n");
}
}
int r;
int r2;
if (0 != r) {
printf("fail at msgq_create(), err=%d\n", r);
r = -1;
goto end0;
}
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end1;
}
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end2;
}
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end2;
}
r = 0;
end2:
if (0 != r2) {
printf("fail at task_join_and_delete(), err=%d\n", r2);
r = -1;
}
end1:
if (0 != r2) {
printf("fail at msgq_delete(), err=%d\n", r2);
r = -1;
}
end0:
return r;
}
#endif
#endif
void bsp_busywait(unsigned int count)
unsigned int bsp_getbusywaitcountperms(void)
int msgq_delete(msgq_pt *msgq_p)
int msgq_send(msgq_pt msgq, unsigned char *msg)
int msgq_create(msgq_pt *msgq_p, unsigned int msgsize, unsigned int maxcount)
int msgq_receive(msgq_pt msgq, unsigned char *msg)
stdlib (Standard Library) API
int task_create_noautodel(task_pt *task_p, taskfunc_ft func, void *arg, int priority, unsigned int stackdepth, const char *name)
int task_join_and_delete(task_pt *task_p, int *result_p, int count)
int task_sleep(unsigned int tick)
int task_getpriority(task_pt task)
#define NULL
Definition: type.h:42
int ubik_test_msgqtest00(void)
Simple message queue example.