summaryrefslogtreecommitdiff
path: root/samples/microkernel
diff options
context:
space:
mode:
Diffstat (limited to 'samples/microkernel')
-rw-r--r--samples/microkernel/apps/hello_world/src/hello.c50
-rw-r--r--samples/microkernel/apps/philosophers/src/phil_fiber.c56
-rw-r--r--samples/microkernel/apps/philosophers/src/phil_task.c31
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/event_b.c110
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/fifo_b.c32
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/fifo_r.c8
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mailbox_b.c38
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mailbox_r.c39
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/master.c89
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/master.h28
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/memmap_b.c10
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mempool_b.c12
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mutex_b.c10
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/nop_b.c8
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/pipe_b.c169
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/pipe_r.c125
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/receiver.c10
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/receiver.h2
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/sema_b.c42
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/sema_r.c42
-rw-r--r--samples/microkernel/benchmark/boot_time/src/boot_time.c40
-rw-r--r--samples/microkernel/benchmark/footprint/src/microkernel_footprint.c42
-rw-r--r--samples/microkernel/benchmark/footprint/src/test_asm_inline_gcc.h2
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/main.c16
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/micro_int_to_task.c23
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/micro_int_to_task_evt.c16
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/micro_sema_lock_release.c48
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c70
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/nano_ctx_switch.c43
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/nano_int.c16
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/nano_int_lock_unlock.c36
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber.c25
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber_sem.c24
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/timestamp.h41
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/utils.c12
-rw-r--r--samples/microkernel/benchmark/latency_measure/src/utils.h33
-rw-r--r--samples/microkernel/test/test_critical/src/critical.c18
-rw-r--r--samples/microkernel/test/test_events/src/test_fiber.c26
-rw-r--r--samples/microkernel/test/test_fp_sharing/src/main.c9
-rw-r--r--samples/microkernel/test/test_libs/src/libraries.c96
-rw-r--r--samples/microkernel/test/test_mail/src/mail.c53
-rw-r--r--samples/microkernel/test/test_mail/src/main.c50
-rw-r--r--samples/microkernel/test/test_mutex/src/mutex.c132
-rw-r--r--samples/microkernel/test/test_pipe/src/main.c38
-rw-r--r--samples/microkernel/test/test_pipe/src/pipe.c528
-rw-r--r--samples/microkernel/test/test_pool/src/pool.c2
-rw-r--r--samples/microkernel/test/test_secure_string_api/src/secure.c72
-rw-r--r--samples/microkernel/test/test_sema/src/main.c26
-rw-r--r--samples/microkernel/test/test_sema/src/sema.c430
-rw-r--r--samples/microkernel/test/test_sema/src/test_fiber.c20
-rw-r--r--samples/microkernel/test/test_sprintf/src/test_sprintf.c327
-rw-r--r--samples/microkernel/test/test_stackprot/src/stackprot.c25
-rw-r--r--samples/microkernel/test/test_static_idt/src/static_idt.c96
-rw-r--r--samples/microkernel/test/test_task/src/task.c112
-rw-r--r--samples/microkernel/test/test_task_irq/src/main.c55
-rw-r--r--samples/microkernel/test/test_task_irq/src/raise_int.c1160
-rw-r--r--samples/microkernel/test/test_task_irq/src/test_device.c80
-rw-r--r--samples/microkernel/test/test_tickless/src/test_tickless.c74
-rw-r--r--samples/microkernel/test/test_tickless/src/timestamps.c62
-rw-r--r--samples/microkernel/test/test_timer/src/timer.c2
-rw-r--r--samples/microkernel/test/test_xip/src/test_xip.c18
61 files changed, 2466 insertions, 2443 deletions
diff --git a/samples/microkernel/apps/hello_world/src/hello.c b/samples/microkernel/apps/hello_world/src/hello.c
index b3ec83d3c..79daad612 100644
--- a/samples/microkernel/apps/hello_world/src/hello.c
+++ b/samples/microkernel/apps/hello_world/src/hello.c
@@ -63,29 +63,29 @@
void helloLoop(const char *taskname, ksem_t mySem, ksem_t otherSem)
{
while (1) {
- task_sem_take_wait(mySem);
+ task_sem_take_wait(mySem);
- /* say "hello" */
- PRINT("%s: Hello World!\n", taskname);
+ /* say "hello" */
+ PRINT("%s: Hello World!\n", taskname);
- /* wait a while, then let other task have a turn */
- task_sleep(SLEEPTICKS);
- task_sem_give(otherSem);
+ /* wait a while, then let other task have a turn */
+ task_sleep(SLEEPTICKS);
+ task_sem_give(otherSem);
}
}
void taskA(void)
{
- /* taskA gives its own semaphore, allowing it to say hello right away */
+ /* taskA gives its own semaphore, allowing it to say hello right away */
task_sem_give(TASKASEM);
- /* invoke routine that allows task to ping-pong hello messages with taskB */
+ /* invoke routine that allows task to ping-pong hello messages with taskB */
helloLoop(__FUNCTION__, TASKASEM, TASKBSEM);
}
void taskB(void)
{
- /* invoke routine that allows task to ping-pong hello messages with taskA */
+ /* invoke routine that allows task to ping-pong hello messages with taskA */
helloLoop(__FUNCTION__, TASKBSEM, TASKASEM);
}
@@ -121,16 +121,16 @@ void fiberEntry(void)
nano_timer_init(&timer, data);
while (1) {
- /* wait for task to let us have a turn */
- nano_fiber_sem_take_wait(&nanoSemFiber);
+ /* wait for task to let us have a turn */
+ nano_fiber_sem_take_wait(&nanoSemFiber);
- /* say "hello" */
- PRINT("%s: Hello World!\n", __FUNCTION__);
+ /* say "hello" */
+ PRINT("%s: Hello World!\n", __FUNCTION__);
- /* wait a while, then let task have a turn */
- nano_fiber_timer_start(&timer, SLEEPTICKS);
- nano_fiber_timer_wait(&timer);
- nano_fiber_sem_give(&nanoSemTask);
+ /* wait a while, then let task have a turn */
+ nano_fiber_timer_start(&timer, SLEEPTICKS);
+ nano_fiber_timer_wait(&timer);
+ nano_fiber_sem_give(&nanoSemTask);
}
}
@@ -146,16 +146,16 @@ void main(void)
nano_timer_init(&timer, data);
while (1) {
- /* say "hello" */
- PRINT("%s: Hello World!\n", __FUNCTION__);
+ /* say "hello" */
+ PRINT("%s: Hello World!\n", __FUNCTION__);
- /* wait a while, then let fiber have a turn */
- nano_task_timer_start(&timer, SLEEPTICKS);
- nano_task_timer_wait(&timer);
- nano_task_sem_give(&nanoSemFiber);
+ /* wait a while, then let fiber have a turn */
+ nano_task_timer_start(&timer, SLEEPTICKS);
+ nano_task_timer_wait(&timer);
+ nano_task_sem_give(&nanoSemFiber);
- /* now wait for fiber to let us have a turn */
- nano_task_sem_take_wait(&nanoSemTask);
+ /* now wait for fiber to let us have a turn */
+ nano_task_sem_take_wait(&nanoSemTask);
}
}
diff --git a/samples/microkernel/apps/philosophers/src/phil_fiber.c b/samples/microkernel/apps/philosophers/src/phil_fiber.c
index 7d1fed633..1380766f5 100644
--- a/samples/microkernel/apps/philosophers/src/phil_fiber.c
+++ b/samples/microkernel/apps/philosophers/src/phil_fiber.c
@@ -71,30 +71,28 @@ kmutex_t forks[] = {forkMutex0, forkMutex1, forkMutex2, forkMutex3, forkMutex4,
*
* myPrint - print a philosophers state
*
+* @param id Philosopher ID.
+* @param str EATING or THINKING.
+*
* RETURNS: N/A
*/
-static void myPrint
- (
- int id, /* philosopher ID */
- char *str /* EATING or THINKING */
- )
- {
+static void myPrint(int id, char *str)
+{
PRINTF("\x1b[%d;%dHPhilosopher %d %s\n", id + 1, 1, id, str);
- }
+}
/*******************************************************************************
*
* myDelay - wait for a number of ticks to elapse
*
+* @param ticks Number of ticks to delay.
+*
* RETURNS: N/A
*/
-static void myDelay
- (
- int ticks /* # of ticks to delay */
- )
- {
+static void myDelay(int ticks)
+{
#ifdef CONFIG_MICROKERNEL
task_sleep(ticks);
#else
@@ -104,7 +102,7 @@ static void myDelay
nano_fiber_timer_start(&timer, ticks);
nano_fiber_timer_wait(&timer);
#endif
- }
+}
/*******************************************************************************
*
@@ -117,7 +115,7 @@ static void myDelay
*/
void philEntry(void)
- {
+{
#ifdef CONFIG_NANOKERNEL
struct nano_sem *f1; /* fork #1 */
struct nano_sem *f2; /* fork #2 */
@@ -125,33 +123,33 @@ void philEntry(void)
kmutex_t f1; /* fork #1 */
kmutex_t f2; /* fork #2 */
#endif
- static int myId; /* next philosopher ID */
- int pri = irq_lock(); /* interrupt lock level */
- int id = myId++; /* current philosopher ID */
+ static int myId; /* next philosopher ID */
+ int pri = irq_lock(); /* interrupt lock level */
+ int id = myId++; /* current philosopher ID */
irq_unlock(pri);
- /* always take the lowest fork first */
+ /* always take the lowest fork first */
if ((id+1) != N_PHILOSOPHERS) {
- f1 = FORK(id);
- f2 = FORK(id + 1);
+ f1 = FORK(id);
+ f2 = FORK(id + 1);
}
else {
- f1 = FORK(0);
- f2 = FORK(id);
+ f1 = FORK(0);
+ f2 = FORK(id);
}
while (1) {
- TAKE(f1);
- TAKE(f2);
+ TAKE(f1);
+ TAKE(f2);
PRINT(id, "EATING ");
- RANDDELAY(id);
+ RANDDELAY(id);
- GIVE(f2);
- GIVE(f1);
+ GIVE(f2);
+ GIVE(f1);
PRINT(id, "THINKING");
- RANDDELAY(id);
- }
+ RANDDELAY(id);
}
+}
diff --git a/samples/microkernel/apps/philosophers/src/phil_task.c b/samples/microkernel/apps/philosophers/src/phil_task.c
index b21a0fc18..7ae6eba82 100644
--- a/samples/microkernel/apps/philosophers/src/phil_task.c
+++ b/samples/microkernel/apps/philosophers/src/phil_task.c
@@ -74,27 +74,28 @@ struct nano_sem forks[N_PHILOSOPHERS];
*/
int main(void)
- {
+{
int i;
PRINTF(DEMO_DESCRIPTION, "fibers", "nanokernel");
for (i = 0; i < N_PHILOSOPHERS; i++) {
- nano_sem_init(&forks[i]);
- nano_task_sem_give(&forks[i]);
+ nano_sem_init(&forks[i]);
+ nano_task_sem_give(&forks[i]);
}
- /* create philosopher fibers */
- for (i = 0; i < N_PHILOSOPHERS; i++)
+ /* create philosopher fibers */
+ for (i = 0; i < N_PHILOSOPHERS; i++) {
task_fiber_start(&philStack[i][0], STSIZE,
- (nano_fiber_entry_t) philEntry, 0, 0, 6, 0);
+ (nano_fiber_entry_t) philEntry, 0, 0, 6, 0);
+ }
- /* wait forever */
+ /* wait forever */
while (1) {
- extern void nano_cpu_idle(void);
- nano_cpu_idle();
- }
+ extern void nano_cpu_idle(void);
+ nano_cpu_idle();
}
+}
#else
/*******************************************************************************
@@ -105,14 +106,14 @@ int main(void)
*/
void philDemo(void)
- {
+{
PRINTF(DEMO_DESCRIPTION, "tasks", "microkernel");
- task_group_start(PHI);
+ task_group_start(PHI);
- /* wait forever */
+ /* wait forever */
while (1) {
- task_sleep(10000);
- }
+ task_sleep(10000);
}
+}
#endif
diff --git a/samples/microkernel/benchmark/app_kernel/src/event_b.c b/samples/microkernel/benchmark/app_kernel/src/event_b.c
index 0c5c77f00..b78443997 100644
--- a/samples/microkernel/benchmark/app_kernel/src/event_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/event_b.c
@@ -66,7 +66,7 @@ int example_handler (int event);
*/
void event_test(void)
- {
+{
int nReturn;
int nCounter;
uint32_t et; /* elapsed time */
@@ -74,107 +74,107 @@ void event_test(void)
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "Signal enabled event",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
et = BENCH_START();
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
- nReturn = task_event_recv(TEST_EVENT);
+ nReturn = task_event_recv(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventTestErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventTestErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "Signal event & Test event",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
et = BENCH_START();
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
- nReturn = task_event_recv_wait(TEST_EVENT);
+ nReturn = task_event_recv_wait(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventTestErr, output_file);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventTestErr, output_file);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "Signal event & TestW event",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
PRINT_STRING("| Signal event with installed handler"
- " |\n", output_file);
+ " |\n", output_file);
nReturn = task_event_set_handler (TEST_EVENT, example_handler);
if (nReturn != RC_OK) {
- PRINT_F(output_file, "-------- Error installing event handler.\n");
- task_sleep(SLEEP_TIME);
- return; /* error */
+ PRINT_F(output_file, "-------- Error installing event handler.\n");
+ task_sleep(SLEEP_TIME);
+ return; /* error */
}
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
- if (nEventValue != TEST_EVENT + 1) {
- PRINT_STRING(EventHandlerErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
+ if (nEventValue != TEST_EVENT + 1) {
+ PRINT_STRING(EventHandlerErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
- nEventValue = 0;
+ nEventValue = 0;
}
nReturn = task_event_set_handler (TEST_EVENT, NULL);
if (nReturn != RC_OK) {
- PRINT_F(output_file, "Error removing event handler.\n");
- task_sleep(SLEEP_TIME);
- return; /* error */
+ PRINT_F(output_file, "Error removing event handler.\n");
+ task_sleep(SLEEP_TIME);
+ return; /* error */
}
PRINT_STRING("| Handler responds OK"
- " |\n",
- output_file);
+ " |\n",
+ output_file);
return; /* success */
- }
+}
/*******************************************************************************
@@ -190,10 +190,10 @@ void event_test(void)
*/
int example_handler (int event)
- {
+{
nEventValue = event + 1;
return 1;
- }
+}
#endif /* EVENT_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/fifo_b.c b/samples/microkernel/benchmark/app_kernel/src/fifo_b.c
index a133bbf53..57b2ebd5e 100644
--- a/samples/microkernel/benchmark/app_kernel/src/fifo_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/fifo_b.c
@@ -44,73 +44,73 @@
*/
void queue_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX1, data_bench);
+ task_fifo_put_wait(DEMOQX1, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
PRINT_F(output_file, FORMAT, "enqueue 1 byte msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX1, data_bench);
+ task_fifo_get_wait(DEMOQX1, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "dequeue 1 byte msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX4, data_bench);
+ task_fifo_put_wait(DEMOQX4, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "enqueue 4 bytes msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX4, data_bench);
+ task_fifo_get_wait(DEMOQX4, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "dequeue 4 bytes msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
task_sem_give(STARTRCV);
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX1, data_bench);
+ task_fifo_put_wait(DEMOQX1, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "enqueue 1 byte msg in FIFO to a waiting higher priority task",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ "enqueue 1 byte msg in FIFO to a waiting higher priority task",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX4, data_bench);
+ task_fifo_put_wait(DEMOQX4, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "enqueue 4 bytes in FIFO to a waiting higher priority task",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
- }
+ "enqueue 4 bytes in FIFO to a waiting higher priority task",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+}
#endif /* FIFO_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/fifo_r.c b/samples/microkernel/benchmark/app_kernel/src/fifo_r.c
index 7d3c4e6ad..185794740 100644
--- a/samples/microkernel/benchmark/app_kernel/src/fifo_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/fifo_r.c
@@ -46,16 +46,16 @@
*/
void dequtask(void)
- {
+{
int x, i;
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX1, &x);
+ task_fifo_get_wait(DEMOQX1, &x);
}
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX4, &x);
- }
+ task_fifo_get_wait(DEMOQX4, &x);
}
+}
#endif /* FIFO_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c b/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c
index 867cd971c..1af847cae 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c
@@ -100,7 +100,7 @@ void mailbox_put(uint32_t size, int count, uint32_t *time);
*/
void mailbox_test(void)
- {
+{
uint32_t putsize;
uint32_t puttime;
int putcount;
@@ -109,14 +109,14 @@ void mailbox_test(void)
PRINT_STRING(dashline, output_file);
PRINT_STRING("| "
- "M A I L B O X M E A S U R E M E N T S"
- " |\n", output_file);
+ "M A I L B O X M E A S U R E M E N T S"
+ " |\n", output_file);
PRINT_STRING(dashline, output_file);
PRINT_STRING("| Send mailbox message to waiting high "
- "priority task and wait |\n", output_file);
+ "priority task and wait |\n", output_file);
PRINT_F(output_file, "| repeat for %4d times and take the "
- "average |\n",
- NR_OF_MBOX_RUNS);
+ "average |\n",
+ NR_OF_MBOX_RUNS);
PRINT_STRING(dashline, output_file);
PRINT_HEADER();
PRINT_STRING(dashline, output_file);
@@ -131,14 +131,14 @@ void mailbox_test(void)
PRINT_ONE_RESULT();
EmptyMsgPutTime = puttime;
for (putsize = 8; putsize <= MESSAGE_SIZE; putsize <<= 1) {
- mailbox_put(putsize, putcount, &puttime);
- task_fifo_get_wait(MB_COMM, &getinfo); /* waiting for ack */
- PRINT_ONE_RESULT();
+ mailbox_put(putsize, putcount, &puttime);
+ task_fifo_get_wait(MB_COMM, &getinfo); /* waiting for ack */
+ PRINT_ONE_RESULT();
}
PRINT_STRING(dashline, output_file);
PRINT_OVERHEAD();
PRINT_XFER_RATE();
- }
+}
/*******************************************************************************
@@ -147,15 +147,15 @@ void mailbox_test(void)
*
* RETURNS: N/A
*
+ * @param size The size of the data chunk.
+ * @param count Number of data chunks.
+ * @param time The total time.
+ *
* \NOMANUAL
*/
-void mailbox_put(
- uint32_t size, /* the size of the data chunk */
- int count, /* number of data chunks */
- uint32_t *time /* the total time */
- )
- {
+void mailbox_put(uint32_t size, int count, uint32_t *time)
+{
int i;
unsigned int t;
@@ -163,15 +163,15 @@ void mailbox_put(
Message.tx_data = data_bench;
Message.size = size;
- /* first sync with the receiver */
+ /* first sync with the receiver */
task_sem_give(SEM0);
t = BENCH_START();
for (i = 0; i < count; i++) {
- task_mbox_put_wait(MAILB1, 1, &Message);
+ task_mbox_put_wait(MAILB1, 1, &Message);
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
check_result();
- }
+}
#endif /* MAILBOX_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c b/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c
index edf598a0d..3723d5676 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c
@@ -56,7 +56,7 @@ int mailbox_get(kmbox_t mailbox,int size,int count,unsigned int* time);
*/
void mailrecvtask(void)
- {
+{
int getsize;
unsigned int gettime;
int getcount;
@@ -72,13 +72,13 @@ void mailrecvtask(void)
task_fifo_put_wait(MB_COMM, &getinfo); /* acknowledge to master */
for (getsize = 8; getsize <= MESSAGE_SIZE; getsize <<= 1) {
- mailbox_get(MAILB1, getsize, getcount, &gettime);
- getinfo.time = gettime;
- getinfo.size = getsize;
- getinfo.count = getcount;
- task_fifo_put_wait(MB_COMM, &getinfo); /* acknowledge to master */
- }
+ mailbox_get(MAILB1, getsize, getcount, &gettime);
+ getinfo.time = gettime;
+ getinfo.size = getsize;
+ getinfo.count = getcount;
+ task_fifo_put_wait(MB_COMM, &getinfo); /* acknowledge to master */
}
+}
/*******************************************************************************
@@ -87,16 +87,16 @@ void mailrecvtask(void)
*
* RETURNS: 0
*
+ * @param mailbox The mailbox to read data from.
+ * @param size Size of each data portion.
+ * @param count Number of data portions.
+ * @param time Resulting time.
+ *
* \NOMANUAL
*/
-int mailbox_get(
- kmbox_t mailbox, /* the mailbox to read data from */
- int size, /* size of each data portion */
- int count, /* number of data portions */
- unsigned int* time /* resulting time */
- )
- {
+int mailbox_get(kmbox_t mailbox, int size, int count, unsigned int* time)
+{
int i;
unsigned int t;
struct k_msg Message;
@@ -105,18 +105,19 @@ int mailbox_get(
Message.rx_data = data_recv;
Message.size = size;
- /* sync with the sender */
+ /* sync with the sender */
task_sem_take_wait(SEM0);
t = BENCH_START();
for (i = 0; i < count; i++) {
- task_mbox_get_wait(mailbox, &Message);
+ task_mbox_get_wait(mailbox, &Message);
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
- if (bench_test_end() < 0)
- PRINT_OVERFLOW_ERROR();
- return 0;
+ if (bench_test_end() < 0) {
+ PRINT_OVERFLOW_ERROR();
}
+ return 0;
+}
#endif /* MAILBOX_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/master.c b/samples/microkernel/benchmark/app_kernel/src/master.c
index 3700ec70b..87ab14f3c 100644
--- a/samples/microkernel/benchmark/app_kernel/src/master.c
+++ b/samples/microkernel/benchmark/app_kernel/src/master.c
@@ -45,8 +45,7 @@ char Msg[MAX_MSG];
char data_bench[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)];
#ifdef PIPE_BENCH
-kpipe_t TestPipes[] = {
-PIPE_NOBUFF, PIPE_SMALLBUFF, PIPE_BIGBUFF};
+kpipe_t TestPipes[] = {PIPE_NOBUFF, PIPE_SMALLBUFF, PIPE_BIGBUFF};
#endif
const char dashline[] =
"|--------------------------------------"
@@ -83,22 +82,22 @@ int kbhit(void)
*
* RETURNS: N/A
*
+ * @param continuously Run test till the user presses the key.
+ * @param autorun Expect user input.
+ *
* \NOMANUAL
*/
-void init_output(
- int *continuously, /* run test till the user presses the key */
- int *autorun /* expect user input */
- )
- {
+void init_output(int *continuously, int *autorun)
+{
ARG_UNUSED(continuously);
ARG_UNUSED(autorun);
- /*
- * send all printf and fprintf to console
- */
+ /*
+ * send all printf and fprintf to console
+ */
output_file = stdout;
- }
+}
/*******************************************************************************
*
@@ -110,8 +109,8 @@ void init_output(
*/
void output_close(void)
- {
- }
+{
+}
/* no need to wait for user key press when using console */
#define WAIT_FOR_USER() {}
@@ -128,7 +127,7 @@ void output_close(void)
/* see config.h to select or to unselect*/
void BenchTask(void)
- {
+{
int autorun = 0, continuously = 0;
init_output(&continuously, &autorun);
@@ -136,40 +135,40 @@ void BenchTask(void)
PRINT_STRING(newline, output_file);
do {
- PRINT_STRING(dashline, output_file);
- PRINT_STRING("| S I M P L E S E R V I C E "
- "M E A S U R E M E N T S | nsec |\n",
- output_file);
- PRINT_STRING(dashline, output_file);
- task_start(RECVTASK);
- call_test();
- queue_test();
- sema_test();
- mutex_test();
- memorymap_test();
- mempool_test();
- event_test();
- mailbox_test();
- pipe_test();
- PRINT_STRING("| END OF TESTS "
- " |\n",
- output_file);
- PRINT_STRING(dashline, output_file);
- PRINT_STRING("VXMICRO PROJECT EXECUTION SUCCESSFUL\n",output_file);
- }
- while (continuously && !kbhit());
+ PRINT_STRING(dashline, output_file);
+ PRINT_STRING("| S I M P L E S E R V I C E "
+ "M E A S U R E M E N T S | nsec |\n",
+ output_file);
+ PRINT_STRING(dashline, output_file);
+ task_start(RECVTASK);
+ call_test();
+ queue_test();
+ sema_test();
+ mutex_test();
+ memorymap_test();
+ mempool_test();
+ event_test();
+ mailbox_test();
+ pipe_test();
+ PRINT_STRING("| END OF TESTS "
+ " |\n",
+ output_file);
+ PRINT_STRING(dashline, output_file);
+ PRINT_STRING("VXMICRO PROJECT EXECUTION SUCCESSFUL\n",output_file);
+ } while (continuously && !kbhit());
WAIT_FOR_USER();
- /*
- * Make a 2 second delay. sys_clock_ticks_per_sec in this context is
- * a number of system times ticks in a second.
- */
- if (autorun)
- task_sleep(2 * sys_clock_ticks_per_sec);
+ /*
+ * Make a 2 second delay. sys_clock_ticks_per_sec in this context is
+ * a number of system times ticks in a second.
+ */
+ if (autorun) {
+ task_sleep(2 * sys_clock_ticks_per_sec);
+ }
output_close();
- }
+}
/*******************************************************************************
@@ -182,6 +181,6 @@ void BenchTask(void)
*/
void dummy_test(void)
- {
+{
return;
- }
+}
diff --git a/samples/microkernel/benchmark/app_kernel/src/master.h b/samples/microkernel/benchmark/app_kernel/src/master.h
index 33b2d3392..6adc1e1a2 100644
--- a/samples/microkernel/benchmark/app_kernel/src/master.h
+++ b/samples/microkernel/benchmark/app_kernel/src/master.h
@@ -148,33 +148,31 @@ extern void event_test(void);
* is defined in the main file
*/
-#define PRINT_F(stream, fmt, ...) \
- { \
+#define PRINT_F(stream, fmt, ...) \
+{ \
snprintf(sline, SLINE_LEN, fmt, ##__VA_ARGS__); \
- PRINT_STRING(sline, stream); \
- }
+ PRINT_STRING(sline, stream); \
+}
#define PRINT_OVERFLOW_ERROR() \
- PRINT_F(output_file, \
- __FILE__":%d Error: tick occured\n", __LINE__)
+ PRINT_F(output_file, __FILE__":%d Error: tick occured\n", __LINE__)
static inline uint32_t BENCH_START(void)
- {
+{
uint32_t et;
bench_test_start();
et = TIME_STAMP_DELTA_GET(0);
return et;
- }
+}
#define check_result() \
- { \
- if (bench_test_end() < 0) \
- { \
- PRINT_OVERFLOW_ERROR(); \
- return; /* error */ \
- } \
- }
+{ \
+ if (bench_test_end() < 0) { \
+ PRINT_OVERFLOW_ERROR(); \
+ return; /* error */ \
+ } \
+}
#endif /* _MASTER_H */
diff --git a/samples/microkernel/benchmark/app_kernel/src/memmap_b.c b/samples/microkernel/benchmark/app_kernel/src/memmap_b.c
index 03e72be19..06777cb61 100644
--- a/samples/microkernel/benchmark/app_kernel/src/memmap_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/memmap_b.c
@@ -46,7 +46,7 @@
*/
void memorymap_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
void* p;
@@ -54,14 +54,14 @@ void memorymap_test(void)
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_MAP_RUNS; i++) {
- task_mem_map_alloc_wait(MAP1, &p);
- task_mem_map_free(MAP1, &p);
+ task_mem_map_alloc_wait(MAP1, &p);
+ task_mem_map_free(MAP1, &p);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "average alloc and dealloc memory page",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MAP_RUNS)));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MAP_RUNS)));
+}
#endif /* MEMMAP_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mempool_b.c b/samples/microkernel/benchmark/app_kernel/src/mempool_b.c
index 6130e3cdb..7401c1652 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mempool_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mempool_b.c
@@ -44,7 +44,7 @@
*/
void mempool_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
struct k_block block;
@@ -52,15 +52,15 @@ void mempool_test(void)
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_POOL_RUNS; i++) {
- task_mem_pool_alloc_wait(&block, DEMOPOOL, 16);
- task_mem_pool_free(&block);
+ task_mem_pool_alloc_wait(&block, DEMOPOOL, 16);
+ task_mem_pool_free(&block);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "average alloc and dealloc memory pool block",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_POOL_RUNS)));
- }
+ "average alloc and dealloc memory pool block",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_POOL_RUNS)));
+}
#endif /* MEMPOOL_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mutex_b.c b/samples/microkernel/benchmark/app_kernel/src/mutex_b.c
index 4b05baf76..07fcce479 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mutex_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mutex_b.c
@@ -44,21 +44,21 @@
*/
void mutex_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_MUTEX_RUNS; i++) {
- task_mutex_lock_wait(DEMO_MUTEX);
- task_mutex_unlock(DEMO_MUTEX);
+ task_mutex_lock_wait(DEMO_MUTEX);
+ task_mutex_unlock(DEMO_MUTEX);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "average lock and unlock mutex",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MUTEX_RUNS)));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MUTEX_RUNS)));
+}
#endif /* MUTEX_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/nop_b.c b/samples/microkernel/benchmark/app_kernel/src/nop_b.c
index 61e25b322..82c992a8b 100644
--- a/samples/microkernel/benchmark/app_kernel/src/nop_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/nop_b.c
@@ -48,19 +48,19 @@ extern void _task_nop(void);
*/
void call_test(void)
- {
+{
uint32_t et; /* Elapsed Time */
int i;
et = BENCH_START();
for (i = 0; i < NR_OF_NOP_RUNS; i++) {
- _task_nop();
+ _task_nop();
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "minimum VxMicro call time",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_NOP_RUNS));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_NOP_RUNS));
+}
#endif /* MICROKERNEL_CALL_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/pipe_b.c b/samples/microkernel/benchmark/app_kernel/src/pipe_b.c
index 9a71bdc52..dba6168c3 100644
--- a/samples/microkernel/benchmark/app_kernel/src/pipe_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/pipe_b.c
@@ -117,7 +117,7 @@ int pipeput(kpipe_t pipe, K_PIPE_OPTION
*/
void pipe_test(void)
- {
+{
uint32_t putsize;
int getsize;
uint32_t puttime[3];
@@ -130,76 +130,76 @@ void pipe_test(void)
task_sem_reset(SEM0);
task_sem_give(STARTRCV);
- /* action: */
+ /* action: */
- /* non-buffered operation, matching (ALL_N) */
+ /* non-buffered operation, matching (ALL_N) */
PRINT_STRING(dashline, output_file);
PRINT_STRING("| "
- "C H A N N E L M E A S U R E M E N T S"
- " |\n", output_file);
+ "C H A N N E L M E A S U R E M E N T S"
+ " |\n", output_file);
PRINT_STRING(dashline, output_file);
PRINT_STRING("| Send data into a pipe towards a "
- "receiving high priority task and wait |\n",
- output_file);
+ "receiving high priority task and wait |\n",
+ output_file);
PRINT_STRING(dashline, output_file);
PRINT_STRING("| "
- "matching sizes (_ALL_N)"
- " |\n", output_file);
+ "matching sizes (_ALL_N)"
+ " |\n", output_file);
PRINT_STRING(dashline, output_file);
PRINT_ALL_TO_N_HEADER_UNIT();
PRINT_STRING(dashline, output_file);
PRINT_STRING("| put | get | no buf | small buf| big buf |"
- " no buf | small buf| big buf |\n", output_file);
+ " no buf | small buf| big buf |\n", output_file);
PRINT_STRING(dashline, output_file);
for (putsize = 8; putsize <= MESSAGE_SIZE_PIPE; putsize <<= 1) {
- for (pipe = 0; pipe < 3; pipe++) {
- putcount = NR_OF_PIPE_RUNS;
- pipeput(TestPipes[pipe], _ALL_N, putsize, putcount,
- &puttime[pipe]);
+ for (pipe = 0; pipe < 3; pipe++) {
+ putcount = NR_OF_PIPE_RUNS;
+ pipeput(TestPipes[pipe], _ALL_N, putsize, putcount,
+ &puttime[pipe]);
- task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
- }
- PRINT_ALL_TO_N();
+ task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
+ }
+ PRINT_ALL_TO_N();
}
PRINT_STRING(dashline, output_file);
- /* Test with two different sender priorities */
+ /* Test with two different sender priorities */
for (prio = 0; prio < 2; prio++) {
- /* non-buffered operation, non-matching (1_TO_N) */
- if (prio == 0) {
- PRINT_STRING("| "
- "non-matching sizes (1_TO_N) to higher priority"
- " |\n", output_file);
- TaskPrio = task_priority_get();
- }
- if (prio == 1) {
- PRINT_STRING("| "
- "non-matching sizes (1_TO_N) to lower priority"
- " |\n", output_file);
- task_priority_set(task_id_get(), TaskPrio - 2);
- }
- PRINT_STRING(dashline, output_file);
- PRINT_1_TO_N_HEADER();
- PRINT_STRING("| put | get | no buf | small buf| big buf | "
- "no buf | small buf| big buf |\n", output_file);
- PRINT_STRING(dashline, output_file);
+ /* non-buffered operation, non-matching (1_TO_N) */
+ if (prio == 0) {
+ PRINT_STRING("| "
+ "non-matching sizes (1_TO_N) to higher priority"
+ " |\n", output_file);
+ TaskPrio = task_priority_get();
+ }
+ if (prio == 1) {
+ PRINT_STRING("| "
+ "non-matching sizes (1_TO_N) to lower priority"
+ " |\n", output_file);
+ task_priority_set(task_id_get(), TaskPrio - 2);
+ }
+ PRINT_STRING(dashline, output_file);
+ PRINT_1_TO_N_HEADER();
+ PRINT_STRING("| put | get | no buf | small buf| big buf | "
+ "no buf | small buf| big buf |\n", output_file);
+ PRINT_STRING(dashline, output_file);
- for (putsize = 8; putsize <= (MESSAGE_SIZE_PIPE); putsize <<= 1) {
- putcount = MESSAGE_SIZE_PIPE / putsize;
- for (pipe = 0; pipe < 3; pipe++) {
- pipeput(TestPipes[pipe], _1_TO_N, putsize,
- putcount, &puttime[pipe]);
- /* size*count == MESSAGE_SIZE_PIPE */
- task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
- getsize = getinfo.size;
+ for (putsize = 8; putsize <= (MESSAGE_SIZE_PIPE); putsize <<= 1) {
+ putcount = MESSAGE_SIZE_PIPE / putsize;
+ for (pipe = 0; pipe < 3; pipe++) {
+ pipeput(TestPipes[pipe], _1_TO_N, putsize,
+ putcount, &puttime[pipe]);
+ /* size*count == MESSAGE_SIZE_PIPE */
+ task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
+ getsize = getinfo.size;
+ }
+ PRINT_1_TO_N();
}
- PRINT_1_TO_N();
- }
- PRINT_STRING(dashline, output_file);
- task_priority_set(task_id_get(), TaskPrio);
- }
+ PRINT_STRING(dashline, output_file);
+ task_priority_set(task_id_get(), TaskPrio);
}
+}
/*******************************************************************************
@@ -208,60 +208,63 @@ void pipe_test(void)
*
* RETURNS: 0 on success, 1 on error
*
+ * @param pipe The pipe to be tested.
+ * @param option _ALL_TO_N or _1_TO_N.
+ * @param size Data chunk size.
+ * @param count Number of data chunks.
+ * @param time Total write time.
+ *
* \NOMANUAL
*/
-int pipeput(
- kpipe_t pipe, /* The pipe to be tested */
- K_PIPE_OPTION option, /* _ALL_TO_N or _1_TO_N */
- int size, /* data chunk size */
- int count, /* number of data chunks */
- uint32_t *time /* total write time */
- )
- {
+int pipeput(kpipe_t pipe, K_PIPE_OPTION option, int size, int count, uint32_t *time)
+{
int i;
unsigned int t;
int sizexferd_total = 0;
int size2xfer_total = size * count;
- /* first sync with the receiver */
+ /* first sync with the receiver */
task_sem_give(SEM0);
t = BENCH_START();
for (i = 0; _1_TO_N == option || (i < count); i++) {
- int sizexferd = 0;
- int size2xfer = min(size, size2xfer_total - sizexferd_total);
- int ret;
+ int sizexferd = 0;
+ int size2xfer = min(size, size2xfer_total - sizexferd_total);
+ int ret;
- ret = task_pipe_put_wait(pipe, data_bench, size2xfer,
- &sizexferd, option);
- if (RC_OK != ret)
- return 1;
- if (_ALL_N == option && sizexferd != size2xfer)
- return 1;
+ ret = task_pipe_put_wait(pipe, data_bench, size2xfer,
+ &sizexferd, option);
+ if (RC_OK != ret) {
+ return 1;
+ }
+ if (_ALL_N == option && sizexferd != size2xfer) {
+ return 1;
+ }
- sizexferd_total += sizexferd;
- if (size2xfer_total == sizexferd_total)
- break;
+ sizexferd_total += sizexferd;
+ if (size2xfer_total == sizexferd_total) {
+ break;
+ }
- if (size2xfer_total < sizexferd_total)
- return 1;
+ if (size2xfer_total < sizexferd_total) {
+ return 1;
+ }
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
if (bench_test_end() < 0) {
- if (high_timer_overflow()) {
- PRINT_STRING("| Timer overflow. Results are invalid ",
- output_file);
- }
- else {
- PRINT_STRING("| Tick occured. Results may be inaccurate ",
- output_file);
- }
- PRINT_STRING(" |\n",
- output_file);
+ if (high_timer_overflow()) {
+ PRINT_STRING("| Timer overflow. Results are invalid ",
+ output_file);
+ }
+ else {
+ PRINT_STRING("| Tick occured. Results may be inaccurate ",
+ output_file);
+ }
+ PRINT_STRING(" |\n", output_file);
}
return 0;
- }
+}
#endif /* PIPE_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/pipe_r.c b/samples/microkernel/benchmark/app_kernel/src/pipe_r.c
index 1737d4301..7aa8322cd 100644
--- a/samples/microkernel/benchmark/app_kernel/src/pipe_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/pipe_r.c
@@ -39,7 +39,7 @@
* Function prototypes.
*/
int pipeget(kpipe_t pipe, K_PIPE_OPTION option,
- int size, int count, unsigned int* time);
+ int size, int count, unsigned int* time);
/*
* Function declarations.
@@ -57,7 +57,7 @@ int pipeget(kpipe_t pipe, K_PIPE_OPTION option,
*/
void piperecvtask(void)
- {
+{
int getsize;
unsigned int gettime;
int getcount;
@@ -65,37 +65,37 @@ void piperecvtask(void)
int prio;
GetInfo getinfo;
- /* matching (ALL_N) */
+ /* matching (ALL_N) */
for (getsize = 8; getsize <= MESSAGE_SIZE_PIPE; getsize <<= 1) {
- for (pipe = 0; pipe < 3; pipe++) {
- getcount = NR_OF_PIPE_RUNS;
- pipeget(TestPipes[pipe], _ALL_N, getsize,
- getcount, &gettime);
- getinfo.time = gettime;
- getinfo.size = getsize;
- getinfo.count = getcount;
- task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
- }
+ for (pipe = 0; pipe < 3; pipe++) {
+ getcount = NR_OF_PIPE_RUNS;
+ pipeget(TestPipes[pipe], _ALL_N, getsize,
+ getcount, &gettime);
+ getinfo.time = gettime;
+ getinfo.size = getsize;
+ getinfo.count = getcount;
+ task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
+ }
}
for (prio = 0; prio < 2; prio++) {
- /* non-matching (1_TO_N) */
- for (getsize = (MESSAGE_SIZE_PIPE); getsize >= 8; getsize >>= 1) {
- getcount = MESSAGE_SIZE_PIPE / getsize;
- for (pipe = 0; pipe < 3; pipe++) {
- /* size*count == MESSAGE_SIZE_PIPE */
- pipeget(TestPipes[pipe], _1_TO_N,
- getsize, getcount, &gettime);
- getinfo.time = gettime;
- getinfo.size = getsize;
- getinfo.count = getcount;
- task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
+ /* non-matching (1_TO_N) */
+ for (getsize = (MESSAGE_SIZE_PIPE); getsize >= 8; getsize >>= 1) {
+ getcount = MESSAGE_SIZE_PIPE / getsize;
+ for (pipe = 0; pipe < 3; pipe++) {
+ /* size*count == MESSAGE_SIZE_PIPE */
+ pipeget(TestPipes[pipe], _1_TO_N,
+ getsize, getcount, &gettime);
+ getinfo.time = gettime;
+ getinfo.size = getsize;
+ getinfo.count = getcount;
+ task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
+ }
}
- }
}
- }
+}
/*******************************************************************************
@@ -104,61 +104,66 @@ void piperecvtask(void)
*
* RETURNS: 0 on success, 1 on error
*
+ * @param pipe Pipe to read data from.
+ * @param option _ALL_TO_N or _1_TO_N.
+ * @param size Data chunk size.
+ * @param count Number of data chunks.
+ * @param time Total write time.
+ *
* \NOMANUAL
*/
-int pipeget(
- kpipe_t pipe, /* pipe to read data from */
- K_PIPE_OPTION option, /* _ALL_TO_N or _1_TO_N */
- int size, /* data chunk size */
- int count, /* number of data chunks */
- unsigned int* time /* total write time */
- )
- {
+int pipeget(kpipe_t pipe, K_PIPE_OPTION option, int size, int count,
+ unsigned int* time)
+{
int i;
unsigned int t;
int sizexferd_total = 0;
int size2xfer_total = size * count;
- /* sync with the sender */
+ /* sync with the sender */
task_sem_take_wait(SEM0);
t = BENCH_START();
for (i = 0; _1_TO_N == option || (i < count); i++) {
- int sizexferd = 0;
- int size2xfer = min(size, size2xfer_total - sizexferd_total);
- int ret;
-
- ret = task_pipe_get_wait(pipe, data_recv, size2xfer,
- &sizexferd, option);
- if (RC_OK != ret)
- return 1;
+ int sizexferd = 0;
+ int size2xfer = min(size, size2xfer_total - sizexferd_total);
+ int ret;
+
+ ret = task_pipe_get_wait(pipe, data_recv, size2xfer,
+ &sizexferd, option);
+ if (RC_OK != ret) {
+ return 1;
+ }
- if (_ALL_N == option && sizexferd != size2xfer)
- return 1;
+ if (_ALL_N == option && sizexferd != size2xfer) {
+ return 1;
+ }
- sizexferd_total += sizexferd;
- if (size2xfer_total == sizexferd_total)
- break;
+ sizexferd_total += sizexferd;
+ if (size2xfer_total == sizexferd_total) {
+ break;
+ }
- if (size2xfer_total < sizexferd_total)
- return 1;
+ if (size2xfer_total < sizexferd_total) {
+ return 1;
+ }
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
if (bench_test_end() < 0) {
- if (high_timer_overflow()) {
- PRINT_STRING("| Timer overflow. Results are invalid ",
- output_file);
- }
- else {
- PRINT_STRING("| Tick occured. Results may be inaccurate ",
- output_file);
- }
- PRINT_STRING(" |\n",
- output_file);
+ if (high_timer_overflow()) {
+ PRINT_STRING("| Timer overflow. Results are invalid ",
+ output_file);
+ }
+ else {
+ PRINT_STRING("| Tick occured. Results may be inaccurate ",
+ output_file);
+ }
+ PRINT_STRING(" |\n",
+ output_file);
}
return 0;
- }
+}
#endif /* PIPE_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/receiver.c b/samples/microkernel/benchmark/app_kernel/src/receiver.c
index 8f543d9d6..1e51fe9f1 100644
--- a/samples/microkernel/benchmark/app_kernel/src/receiver.c
+++ b/samples/microkernel/benchmark/app_kernel/src/receiver.c
@@ -41,9 +41,7 @@
#include "receiver.h"
-char data_recv[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)] = {
- 0
- };
+char data_recv[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)] = { 0 };
void dequtask(void);
void waittask(void);
@@ -60,8 +58,8 @@ void piperecvtask(void);
*/
void recvtask(void)
- {
- /* order must be compatible with master.c ! */
+{
+ /* order must be compatible with master.c ! */
#ifdef FIFO_BENCH
task_sem_take_wait(STARTRCV);
dequtask();
@@ -78,4 +76,4 @@ void recvtask(void)
task_sem_take_wait(STARTRCV);
piperecvtask();
#endif
- }
+}
diff --git a/samples/microkernel/benchmark/app_kernel/src/receiver.h b/samples/microkernel/benchmark/app_kernel/src/receiver.h
index b1da20f7e..c025692c3 100644
--- a/samples/microkernel/benchmark/app_kernel/src/receiver.h
+++ b/samples/microkernel/benchmark/app_kernel/src/receiver.h
@@ -42,7 +42,7 @@ typedef struct {
int count;
unsigned int time;
int size;
- } GetInfo;
+} GetInfo;
/* global data */
extern char data_recv[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)];
diff --git a/samples/microkernel/benchmark/app_kernel/src/sema_b.c b/samples/microkernel/benchmark/app_kernel/src/sema_b.c
index e63fd7592..94c085aa7 100644
--- a/samples/microkernel/benchmark/app_kernel/src/sema_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/sema_b.c
@@ -45,104 +45,104 @@
*/
void sema_test(void)
- {
+{
uint32_t et; /* elapsed Time */
int i;
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM0);
+ task_sem_give(SEM0);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal semaphore",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
task_sem_reset(SEM1);
task_sem_give(STARTRCV);
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM1);
+ task_sem_give(SEM1);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waiting high pri task",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM1);
+ task_sem_give(SEM1);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "signal to waiting high pri task, with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ "signal to waiting high pri task, with timeout",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM2);
+ task_sem_give(SEM2);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (2)",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM2);
+ task_sem_give(SEM2);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (2), with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM3);
+ task_sem_give(SEM3);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (3)",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM3);
+ task_sem_give(SEM3);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (3), with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM4);
+ task_sem_give(SEM4);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (4)",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM4);
+ task_sem_give(SEM4);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (4), with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+}
#endif /* SEMA_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/sema_r.c b/samples/microkernel/benchmark/app_kernel/src/sema_r.c
index c08d27779..5b02dc263 100644
--- a/samples/microkernel/benchmark/app_kernel/src/sema_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/sema_r.c
@@ -47,7 +47,7 @@
*/
void waittask(void)
- {
+{
int i;
ksem_t slist[5];
@@ -58,27 +58,35 @@ void waittask(void)
slist[3] = ENDLIST;
slist[4] = ENDLIST;
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_take_wait(SEM1);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_take_wait_timeout(SEM1, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_take_wait(SEM1);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_take_wait_timeout(SEM1, SEMA_WAIT_TIME);
+ }
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait(slist);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait(slist);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ }
slist[2] = SEM3;
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait(slist);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait(slist);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ }
slist[3] = SEM4;
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait(slist);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait(slist);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
}
+}
#endif /* SEMA_BENCH */
diff --git a/samples/microkernel/benchmark/boot_time/src/boot_time.c b/samples/microkernel/benchmark/boot_time/src/boot_time.c
index d3fb6606b..a0e4dcd2a 100644
--- a/samples/microkernel/benchmark/boot_time/src/boot_time.c
+++ b/samples/microkernel/benchmark/boot_time/src/boot_time.c
@@ -56,7 +56,7 @@ extern uint64_t __main_tsc; /* timestamp when main() begins executing */
extern uint64_t __idle_tsc; /* timestamp when CPU went idle */
void bootTimeTask(void)
- {
+{
uint64_t task_tsc; /* timestamp at beginning of first task */
uint64_t _start_us; /* being of __start timestamp in us */
uint64_t main_us; /* begin of main timestamp in us */
@@ -70,7 +70,7 @@ void bootTimeTask(void)
task_tsc = _NanoTscRead();
#ifndef CONFIG_NANOKERNEL
- /* Go to sleep for 1 tick in order to timestamp when IdleTask halts. */
+ /* Go to sleep for 1 tick in order to timestamp when IdleTask halts. */
task_sleep(1);
#endif /* ! CONFIG_NANOKERNEL */
@@ -84,30 +84,30 @@ void bootTimeTask(void)
idle_us = s_idle_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
#endif
- /* Indicate start for sanity test suite */
+ /* Indicate start for sanity test suite */
TC_START("Boot Time Measurement");
- /* Only print lower 32bit of time result */
+ /* Only print lower 32bit of time result */
#ifdef CONFIG_NANOKERNEL
TC_PRINT("NanoKernel Boot Result: Clock Frequency: %d MHz\n",
- CONFIG_CPU_CLOCK_FREQ_MHZ);
+ CONFIG_CPU_CLOCK_FREQ_MHZ);
#else /* CONFIG_MICROKERNEL */
TC_PRINT("MicroKernel Boot Result: Clock Frequency: %d MHz\n",
- CONFIG_CPU_CLOCK_FREQ_MHZ);
+ CONFIG_CPU_CLOCK_FREQ_MHZ);
#endif
TC_PRINT("__start : %d cycles, %d us\n",
- (uint32_t)(__start_tsc & 0xFFFFFFFFULL),
- (uint32_t) (_start_us & 0xFFFFFFFFULL));
+ (uint32_t)(__start_tsc & 0xFFFFFFFFULL),
+ (uint32_t) (_start_us & 0xFFFFFFFFULL));
TC_PRINT("_start->main(): %d cycles, %d us\n",
- (uint32_t)(s_main_tsc & 0xFFFFFFFFULL),
- (uint32_t) (main_us & 0xFFFFFFFFULL));
+ (uint32_t)(s_main_tsc & 0xFFFFFFFFULL),
+ (uint32_t) (main_us & 0xFFFFFFFFULL));
TC_PRINT("_start->task : %d cycles, %d us\n",
- (uint32_t)(s_task_tsc & 0xFFFFFFFFULL),
- (uint32_t) (task_us & 0xFFFFFFFFULL));
+ (uint32_t)(s_task_tsc & 0xFFFFFFFFULL),
+ (uint32_t) (task_us & 0xFFFFFFFFULL));
#ifndef CONFIG_NANOKERNEL /* CONFIG_MICROKERNEL */
TC_PRINT("_start->idle : %d cycles, %d us\n",
- (uint32_t)(s_idle_tsc & 0xFFFFFFFFULL),
- (uint32_t) (idle_us & 0xFFFFFFFFULL));
+ (uint32_t)(s_idle_tsc & 0xFFFFFFFFULL),
+ (uint32_t) (idle_us & 0xFFFFFFFFULL));
#endif
@@ -117,7 +117,7 @@ void bootTimeTask(void)
TC_END_RESULT(TC_PASS);
TC_END_REPORT(TC_PASS);
- }
+}
#ifdef CONFIG_NANOKERNEL
@@ -131,13 +131,13 @@ char fiberStack[512];
*/
void main(void)
- {
- /* record timestamp for nanokernel's main() function */
+{
+ /* record timestamp for nanokernel's main() function */
__main_tsc = _NanoTscRead();
- /* create bootTime fibers */
+ /* create bootTime fibers */
task_fiber_start(fiberStack, 512,
- (nano_fiber_entry_t) bootTimeTask, 0, 0, 6, 0);
- }
+ (nano_fiber_entry_t) bootTimeTask, 0, 0, 6, 0);
+}
#endif /* CONFIG_NANOKERNEL */
diff --git a/samples/microkernel/benchmark/footprint/src/microkernel_footprint.c b/samples/microkernel/benchmark/footprint/src/microkernel_footprint.c
index e2997a463..8a4204fda 100644
--- a/samples/microkernel/benchmark/footprint/src/microkernel_footprint.c
+++ b/samples/microkernel/benchmark/footprint/src/microkernel_footprint.c
@@ -84,27 +84,27 @@ NANO_CPU_INT_REGISTER(isrDummyIntStub, TEST_SOFT_INT, 0);
/* pointer array ensures specified functions are linked into the image */
static pfunc func_array[] = {
- /* event functions */
+ /* event functions */
(pfunc)task_event_send,
(pfunc)_task_event_recv,
- /* mutex functions */
+ /* mutex functions */
(pfunc)_task_mutex_lock,
(pfunc)_task_mutex_unlock,
- /* FIFO functions */
+ /* FIFO functions */
(pfunc)_task_fifo_put,
(pfunc)_task_fifo_get,
(pfunc)_task_fifo_ioctl,
- /* memory map functions */
+ /* memory map functions */
(pfunc)task_mem_map_used_get,
(pfunc)_task_mem_map_alloc,
(pfunc)_task_mem_map_free,
#ifdef TEST_max
- /* task device interrupt functions */
+ /* task device interrupt functions */
(pfunc)task_irq_alloc,
(pfunc)_task_irq_test,
(pfunc)task_irq_ack,
(pfunc)task_irq_free,
- /* semaphore functions */
+ /* semaphore functions */
(pfunc)isr_sem_give,
(pfunc)task_sem_give,
(pfunc)task_sem_group_give,
@@ -113,7 +113,7 @@ static pfunc func_array[] = {
(pfunc)task_sem_group_reset,
(pfunc)_task_sem_take,
(pfunc)_task_sem_group_take,
- /* pipe functions */
+ /* pipe functions */
(pfunc)task_pipe_put,
(pfunc)task_pipe_put_wait,
(pfunc)task_pipe_put_wait_timeout,
@@ -123,17 +123,17 @@ static pfunc func_array[] = {
(pfunc)_task_pipe_put_async,
(pfunc)_task_pipe_put,
(pfunc)_task_pipe_get,
- /* mailbox functions */
+ /* mailbox functions */
(pfunc)_task_mbox_put,
(pfunc)_task_mbox_get,
(pfunc)_task_mbox_put_async,
(pfunc)_task_mbox_data_get,
(pfunc)_task_mbox_data_get_async_block,
- /* memory pool functions */
+ /* memory pool functions */
(pfunc)_task_mem_pool_alloc,
(pfunc)task_mem_pool_free,
(pfunc)task_mem_pool_defragment,
- /* task functions */
+ /* task functions */
(pfunc)_task_ioctl,
(pfunc)_task_group_ioctl,
(pfunc)task_abort_handler_set,
@@ -142,7 +142,7 @@ static pfunc func_array[] = {
(pfunc)task_sleep,
(pfunc)task_yield,
#endif /* TEST_max */
- };
+};
/*******************************************************************************
*
@@ -152,9 +152,9 @@ static pfunc func_array[] = {
*/
void dummyIsr(void *unused)
- {
+{
ARG_UNUSED(unused);
- }
+}
#ifdef TEST_reg
/*******************************************************************************
@@ -169,13 +169,13 @@ void dummyIsr(void *unused)
*/
static void isrDummyIntStub(void *unused)
- {
+{
ARG_UNUSED(unused);
isr_dummy();
CODE_UNREACHABLE;
- }
+}
#endif /* TEST_reg */
/*******************************************************************************
@@ -191,14 +191,14 @@ static void isrDummyIntStub(void *unused)
*/
void fgTaskEntry(void)
- {
+{
#ifdef TEST_max
- /* dynamically link in dummy ISR */
+ /* dynamically link in dummy ISR */
irq_connect(NANO_SOFT_IRQ, IRQ_PRIORITY, dummyIsr,
- (void *) 0, isrDummyHandlerStub);
+ (void *) 0, isrDummyHandlerStub);
#endif /* TEST_max */
- /* note: referencing "func_array" ensures it isn't optimized out */
+ /* note: referencing "func_array" ensures it isn't optimized out */
#ifdef TEST_max
printf((char *)MESSAGE, func_array);
#else
@@ -206,8 +206,8 @@ void fgTaskEntry(void)
#endif /* TEST_max */
while (1) {
- i++;
- }
+ i++;
}
+}
#endif /* TEST_min */
diff --git a/samples/microkernel/benchmark/footprint/src/test_asm_inline_gcc.h b/samples/microkernel/benchmark/footprint/src/test_asm_inline_gcc.h
index 427e32051..83570103f 100644
--- a/samples/microkernel/benchmark/footprint/src/test_asm_inline_gcc.h
+++ b/samples/microkernel/benchmark/footprint/src/test_asm_inline_gcc.h
@@ -42,7 +42,7 @@ static inline void isr_dummy(void)
extern void _IntEnt(void);
extern void _IntExit(void);
- /* compiler-generated preamble pushes & modifies EBP */
+ /* compiler-generated preamble pushes & modifies EBP */
__asm__ volatile (
"pop %%ebp;\n\t"
"call _IntEnt;\n\t"
diff --git a/samples/microkernel/benchmark/latency_measure/src/main.c b/samples/microkernel/benchmark/latency_measure/src/main.c
index b7d995015..d3f59bf5e 100644
--- a/samples/microkernel/benchmark/latency_measure/src/main.c
+++ b/samples/microkernel/benchmark/latency_measure/src/main.c
@@ -54,7 +54,7 @@ int errorCount = 0; /* track number of errors */
*/
void nanoTest(void)
- {
+{
PRINT_NANO_BANNER();
PRINT_TIME_BANNER();
@@ -72,7 +72,7 @@ void nanoTest(void)
nanoIntLockUnlock();
printDashLine();
- }
+}
#ifdef CONFIG_NANOKERNEL
/*******************************************************************************
@@ -85,14 +85,14 @@ void nanoTest(void)
*/
void main(void)
- {
+{
bench_test_init();
nanoTest();
PRINT_END_BANNER();
TC_END_REPORT(errorCount);
- }
+}
#else
@@ -112,7 +112,7 @@ void microTaskSwitchYield(void);
*/
void microTest(void)
- {
+{
PRINT_MICRO_BANNER();
PRINT_TIME_BANNER();
@@ -130,7 +130,7 @@ void microTest(void)
microTaskSwitchYield();
printDashLine();
- }
+}
/*******************************************************************************
*
@@ -142,7 +142,7 @@ void microTest(void)
*/
void microMain(void)
- {
+{
bench_test_init();
nanoTest();
@@ -150,5 +150,5 @@ void microMain(void)
PRINT_END_BANNER();
TC_END_REPORT(errorCount);
- }
+}
#endif /* CONFIG_NANOKERNEL */
diff --git a/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task.c b/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task.c
index 83b83bf4e..4ebb8974c 100644
--- a/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task.c
+++ b/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task.c
@@ -58,12 +58,12 @@ static uint32_t timestamp;
*/
static void latencyTestIsr(void *unused)
- {
+{
ARG_UNUSED(unused);
flagVar = 1;
timestamp = TIME_STAMP_DELTA_GET(0);
- }
+}
/*******************************************************************************
*
@@ -78,16 +78,17 @@ static void latencyTestIsr(void *unused)
*/
static void makeInt(void)
- {
+{
initSwInterrupt(latencyTestIsr);
flagVar = 0;
raiseIntFunc();
if (flagVar != 1) {
- PRINT_FORMAT(" Flag variable has not changed. FAILED\n");
+ PRINT_FORMAT(" Flag variable has not changed. FAILED\n");
}
- else
- timestamp = TIME_STAMP_DELTA_GET(timestamp);
+ else {
+ timestamp = TIME_STAMP_DELTA_GET(timestamp);
}
+}
/*******************************************************************************
*
@@ -99,16 +100,16 @@ static void makeInt(void)
*/
int microIntToTask(void)
- {
+{
PRINT_FORMAT(" 1- Measure time to switch from ISR to back to"
- " interrupted task");
+ " interrupted task");
TICK_SYNCH();
makeInt();
if (flagVar == 1) {
- PRINT_FORMAT(" switching time is %lu tcs = %lu nsec",
- timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
+ PRINT_FORMAT(" switching time is %lu tcs = %lu nsec",
+ timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
}
return 0;
- }
+}
#endif /* MICROKERNEL */
diff --git a/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task_evt.c b/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task_evt.c
index f988c370c..f704fdaf7 100644
--- a/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task_evt.c
+++ b/samples/microkernel/benchmark/latency_measure/src/micro_int_to_task_evt.c
@@ -60,12 +60,12 @@ static uint32_t timestamp = 0;
*/
static void latencyTestIsr(void *unused)
- {
+{
ARG_UNUSED(unused);
isr_event_send(EVENT0);
timestamp = TIME_STAMP_DELTA_GET(0);
- }
+}
/*******************************************************************************
*
@@ -81,12 +81,12 @@ static void latencyTestIsr(void *unused)
*/
void microInt(void)
- {
+{
task_sem_take_wait(INTSEMA);
setSwInterrupt(latencyTestIsr);
raiseIntFunc();
task_suspend(task_id_get());
- }
+}
/*******************************************************************************
*
@@ -98,16 +98,16 @@ void microInt(void)
*/
int microIntToTaskEvt(void)
- {
+{
PRINT_FORMAT(" 2- Measure time from ISR to executing a different task"
- " (rescheduled)");
+ " (rescheduled)");
TICK_SYNCH();
task_sem_give(INTSEMA);
task_event_recv_wait(EVENT0);
timestamp = TIME_STAMP_DELTA_GET(timestamp);
PRINT_FORMAT(" switch time is %lu tcs = %lu nsec",
- timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
+ timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
return 0;
- }
+}
#endif /* CONFIG_MICROKERNEL */
diff --git a/samples/microkernel/benchmark/latency_measure/src/micro_sema_lock_release.c b/samples/microkernel/benchmark/latency_measure/src/micro_sema_lock_release.c
index 06a572632..18f9ba51d 100644
--- a/samples/microkernel/benchmark/latency_measure/src/micro_sema_lock_release.c
+++ b/samples/microkernel/benchmark/latency_measure/src/micro_sema_lock_release.c
@@ -66,44 +66,44 @@ static uint32_t timestamp;
*/
int microSemaLockUnlock(void)
- {
+{
int i;
PRINT_FORMAT(" 3- Measure average time to signal a sema then test"
- " that sema");
+ " that sema");
bench_test_start();
timestamp = TIME_STAMP_DELTA_GET(0);
for (i = SEMASTART; i <= SEMAEND; i++) {
- task_sem_give(i);
+ task_sem_give(i);
}
timestamp = TIME_STAMP_DELTA_GET(timestamp);
if (bench_test_end() == 0) {
- PRINT_FORMAT(" Average semaphore signal time %lu tcs = %lu nsec",
- timestamp / N_TEST_SEMA,
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_SEMA));
+ PRINT_FORMAT(" Average semaphore signal time %lu tcs = %lu nsec",
+ timestamp / N_TEST_SEMA,
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_SEMA));
}
else {
- errorCount++;
- PRINT_OVERFLOW_ERROR();
+ errorCount++;
+ PRINT_OVERFLOW_ERROR();
}
bench_test_start();
timestamp = TIME_STAMP_DELTA_GET(0);
for (i = SEMASTART; i <= SEMAEND; i++) {
- task_sem_take_wait(i);
+ task_sem_take_wait(i);
}
timestamp = TIME_STAMP_DELTA_GET(timestamp);
if (bench_test_end() == 0) {
- PRINT_FORMAT(" Average semaphore test time %lu tcs = %lu nsec",
- timestamp / N_TEST_SEMA,
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_SEMA));
+ PRINT_FORMAT(" Average semaphore test time %lu tcs = %lu nsec",
+ timestamp / N_TEST_SEMA,
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_SEMA));
}
else {
- errorCount++;
- PRINT_OVERFLOW_ERROR();
+ errorCount++;
+ PRINT_OVERFLOW_ERROR();
}
return 0;
- }
+}
/*******************************************************************************
*
@@ -118,28 +118,28 @@ int microSemaLockUnlock(void)
*/
int microMutexLockUnlock(void)
- {
+{
int i;
PRINT_FORMAT(" 4- Measure average time to lock a mutex then"
- " unlock that mutex");
+ " unlock that mutex");
timestamp = TIME_STAMP_DELTA_GET(0);
for (i = 0; i < N_TEST_MUTEX; i++) {
- task_mutex_lock_wait(TEST_MUTEX);
+ task_mutex_lock_wait(TEST_MUTEX);
}
timestamp = TIME_STAMP_DELTA_GET(timestamp);
PRINT_FORMAT(" Average time to lock the mutex %lu tcs = %lu nsec",
- timestamp / N_TEST_MUTEX,
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_MUTEX));
+ timestamp / N_TEST_MUTEX,
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_MUTEX));
timestamp = TIME_STAMP_DELTA_GET(0);
for (i = 0; i <= N_TEST_MUTEX; i++) {
- task_mutex_unlock(TEST_MUTEX);
+ task_mutex_unlock(TEST_MUTEX);
}
timestamp = TIME_STAMP_DELTA_GET(timestamp);
PRINT_FORMAT(" Average time to unlock the mutex %lu tcs = %lu nsec",
- timestamp / N_TEST_MUTEX,
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_MUTEX));
+ timestamp / N_TEST_MUTEX,
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, N_TEST_MUTEX));
return 0;
- }
+}
#endif /* CONFIG_MICROKERNEL */
diff --git a/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c b/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
index 15ee63d3b..88f37504b 100644
--- a/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
+++ b/samples/microkernel/benchmark/latency_measure/src/micro_task_switch_yield.c
@@ -62,12 +62,12 @@ static uint32_t helper_task_iterations = 0;
*/
void yieldingTask(void)
- {
+{
while (helper_task_iterations < NB_OF_YIELD) {
- task_yield();
- helper_task_iterations++;
- }
+ task_yield();
+ helper_task_iterations++;
}
+}
/*******************************************************************************
*
@@ -79,60 +79,60 @@ void yieldingTask(void)
*/
void microTaskSwitchYield(void)
- {
+{
uint32_t iterations = 0;
int32_t delta;
uint32_t timestamp;
PRINT_FORMAT(" 5- Measure average context switch time between tasks using"
- " (task_yield)");
+ " (task_yield)");
bench_test_start();
- /* launch helper task of the same priority than this routine */
+ /* launch helper task of the same priority than this routine */
task_start(YIELDTASK);
- /* get initial timestamp */
+ /* get initial timestamp */
timestamp = TIME_STAMP_DELTA_GET(0);
- /* loop until either helper or this routine reaches number of yields */
+ /* loop until either helper or this routine reaches number of yields */
while (iterations < NB_OF_YIELD && helper_task_iterations < NB_OF_YIELD) {
- task_yield();
- iterations++;
+ task_yield();
+ iterations++;
}
- /* get the number of cycles it took to do the test */
+ /* get the number of cycles it took to do the test */
timestamp = TIME_STAMP_DELTA_GET(timestamp);
- /* Ensure both helper and this routine were context switching back & forth.
- * For execution to reach the line below, either this routine or helper
- * routine reached NB_OF_YIELD. The other loop must be at most one
- * iteration away from reaching NB_OF_YIELD if execute was switching back
- * and forth.
- */
+ /* Ensure both helper and this routine were context switching back & forth.
+ * For execution to reach the line below, either this routine or helper
+ * routine reached NB_OF_YIELD. The other loop must be at most one
+ * iteration away from reaching NB_OF_YIELD if execute was switching back
+ * and forth.
+ */
delta = iterations - helper_task_iterations;
if (bench_test_end() < 0) {
- errorCount++;
- PRINT_OVERFLOW_ERROR();
+ errorCount++;
+ PRINT_OVERFLOW_ERROR();
}
else if (abs(delta) > 1) {
- /* expecting even alternating context switch, seems one routine
- * called yield without the other having chance to execute
- */
- errorCount++;
- PRINT_FORMAT(" Error, iteration:%lu, helper iteration:%lu",
- iterations, helper_task_iterations);
+ /* expecting even alternating context switch, seems one routine
+ * called yield without the other having chance to execute
+ */
+ errorCount++;
+ PRINT_FORMAT(" Error, iteration:%lu, helper iteration:%lu",
+ iterations, helper_task_iterations);
}
else {
- /* task_yield is called (iterations + helper_task_iterations)
- * times in total.
- */
- PRINT_FORMAT(" Average task context switch using "
- "yield %lu tcs = %lu nsec",
- timestamp / (iterations + helper_task_iterations),
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp,
- (iterations + helper_task_iterations)));
- }
+ /* task_yield is called (iterations + helper_task_iterations)
+ * times in total.
+ */
+ PRINT_FORMAT(" Average task context switch using "
+ "yield %lu tcs = %lu nsec",
+ timestamp / (iterations + helper_task_iterations),
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp,
+ (iterations + helper_task_iterations)));
}
+}
#endif
diff --git a/samples/microkernel/benchmark/latency_measure/src/nano_ctx_switch.c b/samples/microkernel/benchmark/latency_measure/src/nano_ctx_switch.c
index 736d6a05d..9e349e877 100644
--- a/samples/microkernel/benchmark/latency_measure/src/nano_ctx_switch.c
+++ b/samples/microkernel/benchmark/latency_measure/src/nano_ctx_switch.c
@@ -77,16 +77,16 @@ static volatile int ctxSwitchBalancer = 0;
*/
static void fiberOne(void)
- {
+{
nano_fiber_sem_take_wait(&syncSema);
timestamp = TIME_STAMP_DELTA_GET(0);
while (ctxSwitchCounter < NCTXSWITCH) {
- fiber_yield();
- ctxSwitchCounter++;
- ctxSwitchBalancer--;
+ fiber_yield();
+ ctxSwitchCounter++;
+ ctxSwitchBalancer--;
}
timestamp = TIME_STAMP_DELTA_GET(timestamp);
- }
+}
/*******************************************************************************
*
@@ -101,14 +101,14 @@ static void fiberOne(void)
*/
static void fiberTwo(void)
- {
+{
nano_fiber_sem_give(&syncSema);
while (ctxSwitchCounter < NCTXSWITCH) {
- fiber_yield();
- ctxSwitchCounter++;
- ctxSwitchBalancer++;
- }
+ fiber_yield();
+ ctxSwitchCounter++;
+ ctxSwitchBalancer++;
}
+}
/*******************************************************************************
*
@@ -120,7 +120,7 @@ static void fiberTwo(void)
*/
int nanoCtxSwitch(void)
- {
+{
PRINT_FORMAT(" 4- Measure average context switch time between fibers");
nano_sem_init(&syncSema);
ctxSwitchCounter = 0;
@@ -128,19 +128,20 @@ int nanoCtxSwitch(void)
bench_test_start();
task_fiber_start(&fiberOneStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiberOne, 0, 0, 6, 0);
+ (nano_fiber_entry_t) fiberOne, 0, 0, 6, 0);
task_fiber_start(&fiberTwoStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiberTwo, 0, 0, 6, 0);
+ (nano_fiber_entry_t) fiberTwo, 0, 0, 6, 0);
if (ctxSwitchBalancer > 3 || ctxSwitchBalancer < -3) {
- PRINT_FORMAT(" Balance is %d. FAILED", ctxSwitchBalancer);
+ PRINT_FORMAT(" Balance is %d. FAILED", ctxSwitchBalancer);
}
else if (bench_test_end() != 0) {
- errorCount++;
- PRINT_OVERFLOW_ERROR();
+ errorCount++;
+ PRINT_OVERFLOW_ERROR();
}
- else
- PRINT_FORMAT(" Average context switch time is %lu tcs = %lu nsec",
- timestamp / ctxSwitchCounter,
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, ctxSwitchCounter));
- return 0;
+ else {
+ PRINT_FORMAT(" Average context switch time is %lu tcs = %lu nsec",
+ timestamp / ctxSwitchCounter,
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, ctxSwitchCounter));
}
+ return 0;
+}
diff --git a/samples/microkernel/benchmark/latency_measure/src/nano_int.c b/samples/microkernel/benchmark/latency_measure/src/nano_int.c
index ff0c7158a..2d6322784 100644
--- a/samples/microkernel/benchmark/latency_measure/src/nano_int.c
+++ b/samples/microkernel/benchmark/latency_measure/src/nano_int.c
@@ -60,11 +60,11 @@ static uint32_t timestamp;
*/
static void latencyTestIsr(void *unused)
- {
+{
ARG_UNUSED(unused);
timestamp = TIME_STAMP_DELTA_GET(timestamp);
- }
+}
/*******************************************************************************
*
@@ -79,11 +79,11 @@ static void latencyTestIsr(void *unused)
*/
static void fiberInt(void)
- {
+{
initSwInterrupt(latencyTestIsr);
timestamp = TIME_STAMP_DELTA_GET(0);
raiseIntFunc();
- }
+}
/*******************************************************************************
*
@@ -95,12 +95,12 @@ static void fiberInt(void)
*/
int nanoIntLatency(void)
- {
+{
PRINT_FORMAT(" 1- Measure time to switch from fiber to ISR execution");
TICK_SYNCH();
task_fiber_start(&fiberStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0);
+ (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0);
PRINT_FORMAT(" switching time is %lu tcs = %lu nsec",
- timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
+ timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
return 0;
- }
+}
diff --git a/samples/microkernel/benchmark/latency_measure/src/nano_int_lock_unlock.c b/samples/microkernel/benchmark/latency_measure/src/nano_int_lock_unlock.c
index bc417bf4f..0ad1860a8 100644
--- a/samples/microkernel/benchmark/latency_measure/src/nano_int_lock_unlock.c
+++ b/samples/microkernel/benchmark/latency_measure/src/nano_int_lock_unlock.c
@@ -59,48 +59,48 @@ static uint32_t timestamp = 0;
*/
int nanoIntLockUnlock(void)
- {
+{
int i;
unsigned int mask;
PRINT_FORMAT(" 5- Measure average time to lock then unlock interrupts");
PRINT_FORMAT(" 5.1- When each lock and unlock is executed as a function"
- " call");
+ " call");
bench_test_start();
timestamp = TIME_STAMP_DELTA_GET(0);
for (i = 0; i < NTESTS; i++) {
- mask = irq_lock();
- irq_unlock(mask);
+ mask = irq_lock();
+ irq_unlock(mask);
}
timestamp = TIME_STAMP_DELTA_GET(timestamp);
if (bench_test_end() == 0) {
- PRINT_FORMAT(" Average time for lock then unlock "
- "is %lu tcs = %lu nsec",
- timestamp / NTESTS, SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, NTESTS));
+ PRINT_FORMAT(" Average time for lock then unlock "
+ "is %lu tcs = %lu nsec",
+ timestamp / NTESTS, SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, NTESTS));
}
else {
- errorCount++;
- PRINT_OVERFLOW_ERROR();
+ errorCount++;
+ PRINT_OVERFLOW_ERROR();
}
PRINT_FORMAT(" ");
PRINT_FORMAT(" 5.2- When each lock and unlock is executed as inline"
- " function call");
+ " function call");
bench_test_start();
timestamp = TIME_STAMP_DELTA_GET(0);
for (i = 0; i < NTESTS; i++) {
- mask = irq_lock_inline();
- irq_unlock_inline(mask);
+ mask = irq_lock_inline();
+ irq_unlock_inline(mask);
}
timestamp = TIME_STAMP_DELTA_GET(timestamp);
if (bench_test_end() == 0) {
- PRINT_FORMAT(" Average time for lock then unlock "
- "is %lu tcs = %lu nsec",
- timestamp / NTESTS, SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, NTESTS));
+ PRINT_FORMAT(" Average time for lock then unlock "
+ "is %lu tcs = %lu nsec",
+ timestamp / NTESTS, SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, NTESTS));
}
else {
- errorCount++;
- PRINT_OVERFLOW_ERROR();
+ errorCount++;
+ PRINT_OVERFLOW_ERROR();
}
return 0;
- }
+}
diff --git a/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber.c b/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber.c
index 12f61784c..67dd7c9a3 100644
--- a/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber.c
+++ b/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber.c
@@ -62,12 +62,12 @@ static uint32_t timestamp;
*/
static void latencyTestIsr(void *unused)
- {
+{
ARG_UNUSED(unused);
flagVar = 1;
timestamp = TIME_STAMP_DELTA_GET(0);
- }
+}
/*******************************************************************************
*
@@ -82,16 +82,17 @@ static void latencyTestIsr(void *unused)
*/
static void fiberInt(void)
- {
+{
setSwInterrupt(latencyTestIsr);
flagVar = 0;
raiseIntFunc();
if (flagVar != 1) {
- PRINT_FORMAT(" Flag variable has not changed. FAILED");
+ PRINT_FORMAT(" Flag variable has not changed. FAILED");
}
- else
- timestamp = TIME_STAMP_DELTA_GET(timestamp);
+ else {
+ timestamp = TIME_STAMP_DELTA_GET(timestamp);
}
+}
/*******************************************************************************
*
@@ -103,15 +104,15 @@ static void fiberInt(void)
*/
int nanoIntToFiber(void)
- {
+{
PRINT_FORMAT(" 2- Measure time to switch from ISR back to interrupted"
- " fiber");
+ " fiber");
TICK_SYNCH();
task_fiber_start(&fiberStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0);
+ (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0);
if (flagVar == 1) {
- PRINT_FORMAT(" switching time is %lu tcs = %lu nsec",
- timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
+ PRINT_FORMAT(" switching time is %lu tcs = %lu nsec",
+ timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
}
return 0;
- }
+}
diff --git a/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber_sem.c b/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber_sem.c
index 8aecaa4d9..c0d59cf1d 100644
--- a/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber_sem.c
+++ b/samples/microkernel/benchmark/latency_measure/src/nano_int_to_fiber_sem.c
@@ -73,12 +73,12 @@ static uint32_t timestamp = 0;
*/
static void latencyTestIsr(void *unused)
- {
+{
ARG_UNUSED(unused);
nano_isr_sem_give(&testSema);
timestamp = TIME_STAMP_DELTA_GET(0);
- }
+}
/*******************************************************************************
*
@@ -93,11 +93,11 @@ static void latencyTestIsr(void *unused)
*/
static void fiberInt(void)
- {
+{
setSwInterrupt(latencyTestIsr);
raiseIntFunc();
fiber_yield();
- }
+}
/*******************************************************************************
*
@@ -112,10 +112,10 @@ static void fiberInt(void)
*/
static void fiberWaiter(void)
- {
+{
nano_fiber_sem_take_wait(&testSema);
timestamp = TIME_STAMP_DELTA_GET(timestamp);
- }
+}
/*******************************************************************************
*
@@ -127,18 +127,18 @@ static void fiberWaiter(void)
*/
int nanoIntToFiberSem(void)
- {
+{
PRINT_FORMAT(" 3- Measure time from ISR to executing a different fiber"
- " (rescheduled)");
+ " (rescheduled)");
nano_sem_init(&testSema);
TICK_SYNCH();
task_fiber_start(&waiterStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiberWaiter, 0, 0, 5, 0);
+ (nano_fiber_entry_t) fiberWaiter, 0, 0, 5, 0);
task_fiber_start(&intStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0);
+ (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0);
PRINT_FORMAT(" switching time is %lu tcs = %lu nsec",
- timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
+ timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp));
return 0;
- }
+}
diff --git a/samples/microkernel/benchmark/latency_measure/src/timestamp.h b/samples/microkernel/benchmark/latency_measure/src/timestamp.h
index 51b553a28..d43ba703f 100644
--- a/samples/microkernel/benchmark/latency_measure/src/timestamp.h
+++ b/samples/microkernel/benchmark/latency_measure/src/timestamp.h
@@ -85,29 +85,30 @@ typedef int64_t TICK_TYPE;
extern uint32_t tm_off;
static inline uint32_t TIME_STAMP_DELTA_GET(uint32_t ts)
- {
+{
uint32_t t;
- /* serialize so OS_GET_TIME() is not reordered */
+ /* serialize so OS_GET_TIME() is not reordered */
timestamp_serialize();
t = OS_GET_TIME();
uint32_t res = (t >= ts)? (t - ts): (ULONG_MAX - ts + t);
- if (ts > 0)
- res -= tm_off;
- return res;
+ if (ts > 0) {
+ res -= tm_off;
}
+ return res;
+}
/*
* Routine initializes the benchmark timing measurement
* The function sets up the global variable tm_off
*/
static inline void bench_test_init(void)
- {
+{
uint32_t t = OS_GET_TIME();
tm_off = OS_GET_TIME() - t;
- }
+}
#if defined(CONFIG_MICROKERNEL) && defined(KERNEL)
@@ -127,23 +128,23 @@ static TICK_TYPE tCheck;
* Functions modify the tCheck global variable.
*/
static inline void bench_test_start(void)
- {
+{
tCheck = 0;
- /* before reading time we synchronize to the start of the timer tick */
+ /* before reading time we synchronize to the start of the timer tick */
TICK_SYNCH();
tCheck = TICK_GET(&tCheck);
- }
+}
/* returns 0 if the number of ticks is valid and -1 if not */
static inline int bench_test_end(void)
- {
+{
tCheck = TICK_GET(&tCheck);
- if (tCheck > BENCH_MAX_TICKS)
- return -1;
- else
- return 0;
+ if (tCheck > BENCH_MAX_TICKS) {
+ return -1;
}
+ return 0;
+}
/*
* Returns -1 if number of ticks cause high precision timer counter
@@ -152,12 +153,12 @@ static inline int bench_test_end(void)
* results or is it completely invalid
*/
static inline int high_timer_overflow(void)
- {
- if (tCheck >= (UINT_MAX / sys_clock_hw_cycles_per_tick))
- return -1;
- else
- return 0;
+{
+ if (tCheck >= (UINT_MAX / sys_clock_hw_cycles_per_tick)) {
+ return -1;
}
+ return 0;
+}
#endif /* CONFIG_NANOKERNEL || CONFIG_MICROKERNEL */
#endif /* _TIMESTAMP_H_ */
diff --git a/samples/microkernel/benchmark/latency_measure/src/utils.c b/samples/microkernel/benchmark/latency_measure/src/utils.c
index 2a9df77ac..920ae2aa6 100644
--- a/samples/microkernel/benchmark/latency_measure/src/utils.c
+++ b/samples/microkernel/benchmark/latency_measure/src/utils.c
@@ -73,13 +73,13 @@ char tmpString[TMP_STRING_SIZE];
*/
int initSwInterrupt(ptestIsr pIsrHdlr)
- {
+{
vector = irq_connect(NANO_SOFT_IRQ, IRQ_PRIORITY, pIsrHdlr,
(void *) 0, isrLatencyHandlerStub);
pcurrIsrFunc = pIsrHdlr;
return vector;
- }
+}
/*******************************************************************************
*
@@ -95,10 +95,10 @@ int initSwInterrupt(ptestIsr pIsrHdlr)
*/
void setSwInterrupt(ptestIsr pIsrHdlr)
- {
+{
irq_handler_set(vector, pcurrIsrFunc, pIsrHdlr, (void *)0);
pcurrIsrFunc = pIsrHdlr;
- }
+}
/*******************************************************************************
*
@@ -114,6 +114,6 @@ void setSwInterrupt(ptestIsr pIsrHdlr)
* \NOMANUAL
*/
void raiseIntFunc(void)
- {
+{
raiseInt(vector);
- }
+}
diff --git a/samples/microkernel/benchmark/latency_measure/src/utils.h b/samples/microkernel/benchmark/latency_measure/src/utils.h
index 7f5cfd62e..6703c12fe 100644
--- a/samples/microkernel/benchmark/latency_measure/src/utils.h
+++ b/samples/microkernel/benchmark/latency_measure/src/utils.h
@@ -51,13 +51,11 @@ extern int errorCount;
#define PRINT(fmt, ...) printk(fmt, ##__VA_ARGS__)
#define PRINTF(fmt, ...) printf(fmt, ##__VA_ARGS__)
-#define PRINT_FORMAT(fmt, ...) \
- do \
- { \
+#define PRINT_FORMAT(fmt, ...) \
+ do { \
snprintf(tmpString, TMP_STRING_SIZE, fmt, ##__VA_ARGS__); \
PRINTF("|%-77s|\n", tmpString); \
- } \
- while (0)
+ } while (0)
/*******************************************************************************
*
@@ -69,33 +67,34 @@ extern int errorCount;
*/
static inline void printDashLine(void)
- {
+{
PRINTF("|-----------------------------------------------------------------"
- "------------|\n");
- }
+ "------------|\n");
+}
-#define PRINT_END_BANNER() \
+#define PRINT_END_BANNER() \
PRINTF("| E N D "\
- " |\n"); \
+ " |\n"); \
printDashLine();
-#define PRINT_NANO_BANNER() \
+#define PRINT_NANO_BANNER() \
printDashLine(); \
PRINTF("| VxMicro Nanokernel Latency Benchmark "\
- " |\n"); \
+ " |\n"); \
printDashLine();
-#define PRINT_MICRO_BANNER() \
+#define PRINT_MICRO_BANNER() \
printDashLine(); \
PRINTF("| VxMicro Microkernel Latency Benchmark "\
- " |\n"); \
+ " |\n"); \
printDashLine();
-#define PRINT_TIME_BANNER() \
- PRINT_FORMAT(" tcs = timer clock cycles: 1 tcs is %lu nsec", SYS_CLOCK_HW_CYCLES_TO_NS(1));\
+#define PRINT_TIME_BANNER() \
+ PRINT_FORMAT(" tcs = timer clock cycles: 1 tcs is %lu nsec", \
+ SYS_CLOCK_HW_CYCLES_TO_NS(1)); \
printDashLine();
-#define PRINT_OVERFLOW_ERROR() \
+#define PRINT_OVERFLOW_ERROR() \
PRINT_FORMAT(" Error: tick occured")
#else
diff --git a/samples/microkernel/test/test_critical/src/critical.c b/samples/microkernel/test/test_critical/src/critical.c
index eee77f0df..967da786f 100644
--- a/samples/microkernel/test/test_critical/src/critical.c
+++ b/samples/microkernel/test/test_critical/src/critical.c
@@ -87,7 +87,7 @@ uint32_t criticalLoop(uint32_t count)
while (task_tick_get_32() < ticks + NUM_TICKS) {
task_offload_to_fiber(criticalRtn, &criticalVar);
count++;
- }
+ }
return count;
}
@@ -138,18 +138,18 @@ void RegressionTask(void)
nCalls = criticalLoop(nCalls);
- /* Wait for AlternateTask() to complete */
+ /* Wait for AlternateTask() to complete */
status = task_sem_take_wait_timeout(REGRESS_SEM, TEST_TIMEOUT);
if (status != RC_OK) {
TC_ERROR("Timed out waiting for REGRESS_SEM\n");
goto errorReturn;
- }
+ }
if (criticalVar != nCalls + altTaskIterations) {
TC_ERROR("Unexpected value for <criticalVar>. Expected %d, got %d\n",
- nCalls + altTaskIterations, criticalVar);
+ nCalls + altTaskIterations, criticalVar);
goto errorReturn;
- }
+ }
TC_PRINT("Obtained expected <criticalVar> value of %u\n", criticalVar);
TC_PRINT("Enabling time slicing ...\n");
@@ -160,18 +160,18 @@ void RegressionTask(void)
nCalls = criticalLoop(nCalls);
- /* Wait for AlternateTask() to finish */
+ /* Wait for AlternateTask() to finish */
status = task_sem_take_wait_timeout(REGRESS_SEM, TEST_TIMEOUT);
if (status != RC_OK) {
TC_ERROR("Timed out waiting for REGRESS_SEM\n");
goto errorReturn;
- }
+ }
if (criticalVar != nCalls + altTaskIterations) {
TC_ERROR("Unexpected value for <criticalVar>. Expected %d, got %d\n",
- nCalls + altTaskIterations, criticalVar);
+ nCalls + altTaskIterations, criticalVar);
goto errorReturn;
- }
+ }
TC_PRINT("Obtained expected <criticalVar> value of %u\n", criticalVar);
TC_END_RESULT(TC_PASS);
diff --git a/samples/microkernel/test/test_events/src/test_fiber.c b/samples/microkernel/test/test_events/src/test_fiber.c
index bcf444b80..61db5233e 100644
--- a/samples/microkernel/test/test_events/src/test_fiber.c
+++ b/samples/microkernel/test/test_events/src/test_fiber.c
@@ -64,27 +64,27 @@ static char fiberStack[FIBER_STACK_SIZE]; /* test fiber stack size */
* RETURNS: N/A
*/
static void testFiberEntry(void)
- {
- /* signal event for eventWaitTest() */
- /* single test */
+{
+ /* signal event for eventWaitTest() */
+ /* single test */
nano_fiber_sem_take_wait(&fiberSem);
fiber_event_send(EVENT_ID);
- /* test in cycle */
+ /* test in cycle */
nano_fiber_sem_take_wait(&fiberSem);
fiber_event_send(EVENT_ID);
- /* signal event for eventTimeoutTest() */
+ /* signal event for eventTimeoutTest() */
nano_fiber_sem_take_wait(&fiberSem);
fiber_event_send(EVENT_ID);
- /*
- * Signal two events for fiberEventSignalTest ().
- * It has to detect only one
- */
+ /*
+ * Signal two events for fiberEventSignalTest ().
+ * It has to detect only one
+ */
nano_fiber_sem_take_wait(&fiberSem);
fiber_event_send(EVENT_ID);
fiber_event_send(EVENT_ID);
- }
+}
/*******************************************************************************
*
@@ -94,8 +94,8 @@ static void testFiberEntry(void)
*/
void testFiberInit(void)
- {
+{
nano_sem_init(&fiberSem);
task_fiber_start(fiberStack, FIBER_STACK_SIZE, (nano_fiber_entry_t)testFiberEntry,
- 0, 0, FIBER_PRIORITY, 0);
- }
+ 0, 0, FIBER_PRIORITY, 0);
+}
diff --git a/samples/microkernel/test/test_fp_sharing/src/main.c b/samples/microkernel/test/test_fp_sharing/src/main.c
index d4612ec1e..2ab4ffc11 100644
--- a/samples/microkernel/test/test_fp_sharing/src/main.c
+++ b/samples/microkernel/test/test_fp_sharing/src/main.c
@@ -207,8 +207,9 @@ void load_store_low(void)
*/
floatRegInitByte = MAIN_FLOAT_REG_CHECK_BYTE;
- for (bufIx = 0; bufIx < SIZEOF_FP_REG_SET; ++bufIx)
+ for (bufIx = 0; bufIx < SIZEOF_FP_REG_SET; ++bufIx) {
((unsigned char *)&floatRegSetLoad)[bufIx] = floatRegInitByte++;
+ }
/* Keep cranking forever, or until an error is detected. */
@@ -353,8 +354,9 @@ void load_store_high(void)
floatRegInitByte = FIBER_FLOAT_REG_CHECK_BYTE;
- for (bufIx = 0; bufIx < SIZEOF_FP_REG_SET; ++bufIx)
+ for (bufIx = 0; bufIx < SIZEOF_FP_REG_SET; ++bufIx) {
floatRegisterSetBytePtr[bufIx] = floatRegInitByte++;
+ }
/*
* Utilize an architecture specific function to load all the floating
@@ -395,9 +397,10 @@ void load_store_high(void)
/* periodically issue progress report */
- if ((++load_store_high_count % 100) == 0)
+ if ((++load_store_high_count % 100) == 0) {
PRINT_DATA("Load and store OK after %u (high) + %u (low) tests\n",
load_store_high_count, load_store_low_count);
+ }
#if (MAX_TESTS != 0)
/* terminate testing if specified limit has been reached */
diff --git a/samples/microkernel/test/test_libs/src/libraries.c b/samples/microkernel/test/test_libs/src/libraries.c
index 574e9432d..361a0fde0 100644
--- a/samples/microkernel/test/test_libs/src/libraries.c
+++ b/samples/microkernel/test/test_libs/src/libraries.c
@@ -165,15 +165,15 @@ char buffer[BUFSIZE];
int memset_test(void)
{
- TC_PRINT ("\tmemset ...\t");
+ TC_PRINT("\tmemset ...\t");
- memset (buffer, 'a', BUFSIZE);
+ memset(buffer, 'a', BUFSIZE);
if (buffer[0] != 'a' || buffer[BUFSIZE-1] != 'a') {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
}
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
return TC_PASS;
}
@@ -186,16 +186,16 @@ int memset_test(void)
int strlen_test(void)
{
- TC_PRINT ("\tstrlen ...\t");
+ TC_PRINT("\tstrlen ...\t");
- memset (buffer, '\0', BUFSIZE);
- memset (buffer, 'b', 5); /* 5 is BUFSIZE / 2 */
+ memset(buffer, '\0', BUFSIZE);
+ memset(buffer, 'b', 5); /* 5 is BUFSIZE / 2 */
if (strlen(buffer) != 5) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
}
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
return TC_PASS;
}
@@ -206,32 +206,32 @@ int strlen_test(void)
* RETURNS: TC_PASS or TC_FAIL
*/
-int strcmp_test (void)
+int strcmp_test(void)
{
strcpy(buffer, "eeeee");
- TC_PRINT ("\tstrcmp less ...\t");
+ TC_PRINT("\tstrcmp less ...\t");
if (strcmp(buffer, "fffff") >= 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
} else {
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
}
- TC_PRINT ("\tstrcmp equal ...\t");
+ TC_PRINT("\tstrcmp equal ...\t");
if (strcmp(buffer, "eeeee") != 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
} else {
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
}
- TC_PRINT ("\tstrcmp greater ...\t");
+ TC_PRINT("\tstrcmp greater ...\t");
if (strcmp(buffer, "ddddd") <= 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
} else {
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
}
return TC_PASS;
@@ -244,32 +244,32 @@ int strcmp_test (void)
* RETURNS: TC_PASS or TC_FAIL
*/
-int strncmp_test (void)
+int strncmp_test(void)
{
strncpy(buffer, "eeeeeeeeeeee", BUFSIZE);
- TC_PRINT ("\tstrncmp 0 ...\t");
+ TC_PRINT("\tstrncmp 0 ...\t");
if (strncmp(buffer, "fffff", 0) != 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
} else {
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
}
- TC_PRINT ("\tstrncmp 3 ...\t");
+ TC_PRINT("\tstrncmp 3 ...\t");
if (strncmp(buffer, "eeeff", 3) != 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
} else {
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
}
- TC_PRINT ("\tstrncmp 10 ...\t");
+ TC_PRINT("\tstrncmp 10 ...\t");
if (strncmp(buffer, "eeeeeeeeeeeff", BUFSIZE) != 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
} else {
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
}
return TC_PASS;
@@ -283,19 +283,19 @@ int strncmp_test (void)
* RETURNS: TC_PASS or TC_FAIL
*/
-int strcpy_test (void)
+int strcpy_test(void)
{
- TC_PRINT ("\tstrcpy ...\t");
+ TC_PRINT("\tstrcpy ...\t");
- memset (buffer, '\0', BUFSIZE);
+ memset(buffer, '\0', BUFSIZE);
strcpy(buffer, "10 chars!!\0");
if (strcmp(buffer, "10 chars!!\0") != 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
}
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
return TC_PASS;
}
@@ -306,20 +306,20 @@ int strcpy_test (void)
* RETURNS: TC_PASS or TC_FAIL
*/
-int strncpy_test (void)
+int strncpy_test(void)
{
- TC_PRINT ("\tstrncpy ...\t");
+ TC_PRINT("\tstrncpy ...\t");
- memset (buffer, '\0', BUFSIZE);
+ memset(buffer, '\0', BUFSIZE);
strncpy(buffer, "This is over 10 characters", BUFSIZE);
/* Purposely different values */
if (strncmp(buffer, "This is over 20 characters", BUFSIZE) != 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
}
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
return TC_PASS;
}
@@ -330,27 +330,27 @@ int strncpy_test (void)
* RETURNS: TC_PASS or TC_FAIL
*/
-int strchr_test (void)
+int strchr_test(void)
{
char *rs = NULL;
- TC_PRINT ("\tstrchr ...\t");
+ TC_PRINT("\tstrchr ...\t");
- memset (buffer, '\0', BUFSIZE);
+ memset(buffer, '\0', BUFSIZE);
strncpy(buffer, "Copy 10", BUFSIZE);
rs = strchr(buffer, '1');
if (!rs) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
}
if (strncmp(rs, "10", 2) != 0) {
- TC_PRINT ("failed\n");
+ TC_PRINT("failed\n");
return TC_FAIL;
}
- TC_PRINT ("passed\n");
+ TC_PRINT("passed\n");
return TC_PASS;
}
@@ -366,7 +366,7 @@ int stringTest(void)
TC_PRINT("Testing string.h library ...\n");
if (memset_test() || strlen_test() || strcmp_test() || strcpy_test() ||
- strncpy_test() || strncmp_test() || strchr_test()) {
+ strncpy_test() || strncmp_test() || strchr_test()) {
return TC_FAIL;
}
@@ -388,8 +388,8 @@ int RegressionTask(void)
{
TC_PRINT("Validating access to supported libraries\n");
- if (limitsTest () || stdboolTest () || stddefTest () ||
- stdintTest () || stringTest ()) {
+ if (limitsTest() || stdboolTest() || stddefTest() ||
+ stdintTest() || stringTest()) {
TC_PRINT("Library validation failed\n");
return TC_FAIL;
}
diff --git a/samples/microkernel/test/test_mail/src/mail.c b/samples/microkernel/test/test_mail/src/mail.c
index d6457d8ab..320f9365e 100644
--- a/samples/microkernel/test/test_mail/src/mail.c
+++ b/samples/microkernel/test/test_mail/src/mail.c
@@ -65,10 +65,10 @@ are not (yet) tested include:
/* defines */
-#define MSGSIZE 16 /* Standard message data size */
-#define XFER_PRIO 5 /* standard message transfer priority */
-#define MSG_INFO1 1234 /* Message info test value */
-#define MSG_INFO2 666 /* Message info test value */
+#define MSGSIZE 16 /* Standard message data size */
+#define XFER_PRIO 5 /* standard message transfer priority */
+#define MSG_INFO1 1234 /* Message info test value */
+#define MSG_INFO2 666 /* Message info test value */
/* locals */
@@ -99,18 +99,18 @@ extern kmemory_pool_t smallBlkszPool;
* rx_task to receiverTask - destination for the message
* mailbox to inMbox
*
+* @param inMsg The message being received.
+* @param inMbox Mail box to receive the message.
+* @param receiverTask Destination for the message.
+* @param dataArea Pointer to (optional) buffer to send.
+* @param dataSize Size of (optional) buffer to send.
+* @param info Additional (optional) info to send.
+*
* RETURNS: N/A
*/
-static void setMsg_Sender
- (
- struct k_msg *inMsg, /* the message being received */
- kmbox_t inMbox, /* mail box to receive the message */
- ktask_t receiverTask, /* destination for the message */
- void *dataArea, /* pointer to (optional) buffer to send */
- uint32_t dataSize, /* size of (optional) buffer to send */
- uint32_t info /* additional (optional) info to send */
- )
+static void setMsg_Sender(struct k_msg *inMsg, kmbox_t inMbox, ktask_t receiverTask,
+ void *dataArea, uint32_t dataSize, uint32_t info)
{
inMsg->rx_task = receiverTask;
inMsg->mailbox = inMbox;
@@ -129,17 +129,17 @@ static void setMsg_Sender
* tx_task to senderTask - receiver tries to get message from this source
* mailbox to inMbox
*
+* @param inMsg Message descriptor.
+* @param inMbox Mail box to receive from.
+* @param senderTask Sending task to receive from.
+* @param inBuffer Incoming data area
+* @param inBufferSize Size of incoming data area.
+*
* RETURNS: N/A
*/
-static void setMsg_Receiver
- (
- struct k_msg *inMsg, /* message descriptor */
- kmbox_t inMbox, /* mail box to receive from */
- ktask_t senderTask, /* sending task to receive from */
- void *inBuffer, /* incoming data area */
- uint32_t inBufferSize /* size of incoming data area */
- )
+static void setMsg_Receiver(struct k_msg *inMsg, kmbox_t inMbox, ktask_t senderTask,
+ void *inBuffer, uint32_t inBufferSize)
{
inMsg->mailbox = inMbox;
inMsg->tx_task = senderTask;
@@ -154,15 +154,14 @@ static void setMsg_Receiver
*
* setMsg_RecvBuf - sets rx_data field in msg and clears buffer
*
+* @param inMsg The message being received.
+* @param inBuffer Incoming data area.
+* @param inBufferSize Size of incoming data area.
+*
* RETURNS: N/A
*/
-static void setMsg_RecvBuf
- (
- struct k_msg *inMsg, /* the message being received */
- char *inBuffer, /* incoming data area */
- uint32_t inBufferSize /* size of incoming data area */
- )
+static void setMsg_RecvBuf(struct k_msg *inMsg, char *inBuffer, uint32_t inBufferSize)
{
inMsg->rx_data = inBuffer;
inMsg->size = inBufferSize;
diff --git a/samples/microkernel/test/test_mail/src/main.c b/samples/microkernel/test/test_mail/src/main.c
index 639acdf11..b3e1ce99a 100644
--- a/samples/microkernel/test/test_mail/src/main.c
+++ b/samples/microkernel/test/test_mail/src/main.c
@@ -66,15 +66,15 @@ static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST };
/* globals */
ktask_t msgSenderTask = MSGSENDERTASK;
-ktask_t msgRcvrTask = MSGRCVRTASK;
+ktask_t msgRcvrTask = MSGRCVRTASK;
-ksem_t semSync1 = SEM_SYNC1;
-ksem_t semSync2 = SEM_SYNC2;
+ksem_t semSync1 = SEM_SYNC1;
+ksem_t semSync2 = SEM_SYNC2;
-kmbox_t myMbox = MYMBOX;
-kmbox_t noRcvrMbox = NORCVRMBOX;
+kmbox_t myMbox = MYMBOX;
+kmbox_t noRcvrMbox = NORCVRMBOX;
-kmemory_pool_t testPool = TESTPOOL;
+kmemory_pool_t testPool = TESTPOOL;
kmemory_pool_t smallBlkszPool = SMALLBLKSZPOOL;
/*******************************************************************************
@@ -88,11 +88,11 @@ kmemory_pool_t smallBlkszPool = SMALLBLKSZPOOL;
*/
void MsgSenderTaskEntry(void)
- {
+{
extern int MsgSenderTask(void);
task_sem_give(resultSems[MsgSenderTask()]);
- }
+}
/*******************************************************************************
*
@@ -105,11 +105,11 @@ void MsgSenderTaskEntry(void)
*/
void MsgRcvrTaskEntry(void)
- {
+{
extern int MsgRcvrTask(void);
task_sem_give(resultSems[MsgRcvrTask()]);
- }
+}
/*******************************************************************************
*
@@ -122,31 +122,31 @@ void MsgRcvrTaskEntry(void)
*/
void MonitorTaskEntry(void)
- {
+{
ksem_t result;
int tasksDone;
PRINT_DATA("Starting mailbox tests\n");
PRINT_LINE;
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
+ /*
+ * the various test tasks start executing automatically;
+ * wait for all tasks to complete or a failure to occur,
+ * then issue the appropriate test case summary message
+ */
for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take_wait_timeout(resultSems, TIMEOUT);
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
+ result = task_sem_group_take_wait_timeout(resultSems, TIMEOUT);
+ if (result != resultSems[TC_PASS]) {
+ if (result != resultSems[TC_FAIL]) {
+ TC_ERROR("Monitor task timed out\n");
+ }
+ TC_END_RESULT(TC_FAIL);
+ TC_END_REPORT(TC_FAIL);
+ return;
}
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
}
TC_END_RESULT(TC_PASS);
TC_END_REPORT(TC_PASS);
- }
+}
diff --git a/samples/microkernel/test/test_mutex/src/mutex.c b/samples/microkernel/test/test_mutex/src/mutex.c
index 7bd274cd0..dea0ca38c 100644
--- a/samples/microkernel/test/test_mutex/src/mutex.c
+++ b/samples/microkernel/test/test_mutex/src/mutex.c
@@ -89,19 +89,19 @@ static int tcRC = TC_PASS; /* test case return code */
*/
void Task10(void)
- {
+{
int rv;
task_sleep(3 * ONE_SECOND + HALF_SECOND);
- /* Wait and boost owner priority to 10 */
+ /* Wait and boost owner priority to 10 */
rv = task_mutex_lock_wait_timeout(Mutex4, ONE_SECOND);
if (rv != RC_TIME) {
tcRC = TC_FAIL;
TC_ERROR("Failed to timeout on mutex 0x%x\n", Mutex4);
return;
- }
- } /* Task10 */
+ }
+} /* Task10 */
/*******************************************************************************
@@ -112,29 +112,29 @@ void Task10(void)
*/
void Task15(void)
- {
+{
int rv;
task_sleep(3 * ONE_SECOND + 3 * FOURTH_SECOND);
- /*
- * Wait for the mutex. There is a higher priority level task waiting
- * on the mutex, so request will not immediately contribute to raising
- * the priority of the owning task (RegressionTask). When Task10 times out
- * this task will become the highest priority waiting task. The priority
- * of the owning task (RegressionTask) will not drop back to 20, but will
- * instead drop to 15.
- */
+ /*
+ * Wait for the mutex. There is a higher priority level task waiting
+ * on the mutex, so request will not immediately contribute to raising
+ * the priority of the owning task (RegressionTask). When Task10 times out
+ * this task will become the highest priority waiting task. The priority
+ * of the owning task (RegressionTask) will not drop back to 20, but will
+ * instead drop to 15.
+ */
rv = task_mutex_lock_wait_timeout(Mutex4, 2 * ONE_SECOND);
if (rv != RC_OK) {
tcRC = TC_FAIL;
TC_ERROR("Failed to take mutex 0x%x\n", Mutex4);
return;
- }
+ }
task_mutex_unlock(Mutex4);
- }
+}
/*******************************************************************************
*
@@ -144,27 +144,27 @@ void Task15(void)
*/
void Task20(void)
- {
+{
int rv;
task_sleep(2 * ONE_SECOND + HALF_SECOND);
- /*
- * Wait and boost owner priority to 20. While waiting, another task of
- * a very low priority level will also wait for the mutex. Task20 is
- * expected to time out around the 5.5 second mark. When it times out,
- * Task45 will become the only waiting task for this mutex and the
- * priority of the owning task RegressionTask will drop to 25.
- */
+ /*
+ * Wait and boost owner priority to 20. While waiting, another task of
+ * a very low priority level will also wait for the mutex. Task20 is
+ * expected to time out around the 5.5 second mark. When it times out,
+ * Task45 will become the only waiting task for this mutex and the
+ * priority of the owning task RegressionTask will drop to 25.
+ */
rv = task_mutex_lock_wait_timeout(Mutex3, 3 * ONE_SECOND);
if (rv != RC_TIME) {
tcRC = TC_FAIL;
TC_ERROR("Failed to timeout on mutex 0x%x\n", Mutex3);
return;
- }
+ }
- } /* Task20 */
+} /* Task20 */
/*******************************************************************************
*
@@ -174,7 +174,7 @@ void Task20(void)
*/
void Task25(void)
- {
+{
int rv;
task_sleep(ONE_SECOND + HALF_SECOND);
@@ -184,10 +184,10 @@ void Task25(void)
tcRC = TC_FAIL;
TC_ERROR("Failed to take mutex 0x%x\n", Mutex2);
return;
- }
+ }
task_mutex_unlock(Mutex2);
- } /* Task25 */
+} /* Task25 */
/*******************************************************************************
*
@@ -197,7 +197,7 @@ void Task25(void)
*/
void Task30(void)
- {
+{
int rv;
task_sleep(HALF_SECOND); /* Allow lower priority task to run */
@@ -208,17 +208,17 @@ void Task30(void)
tcRC = TC_FAIL;
TC_ERROR("Failed to NOT take locked mutex 0x%x\n", Mutex1);
return;
- }
+ }
rv = task_mutex_lock_wait(Mutex1); /* Wait and boost owner priority to 30 */
if (rv != RC_OK) {
tcRC = TC_FAIL;
TC_ERROR("Failed to take mutex 0x%x\n", Mutex1);
return;
- }
+ }
task_mutex_unlock(Mutex1);
- }
+}
/*******************************************************************************
*
@@ -228,7 +228,7 @@ void Task30(void)
*/
void Task45(void)
- {
+{
int rv;
task_sleep(3 * ONE_SECOND + HALF_SECOND);
@@ -237,9 +237,9 @@ void Task45(void)
tcRC = TC_FAIL;
TC_ERROR("Failed to take mutex 0x%x\n", Mutex2);
return;
- }
- task_mutex_unlock(Mutex3);
}
+ task_mutex_unlock(Mutex3);
+}
/*******************************************************************************
*
@@ -251,7 +251,7 @@ void Task45(void)
*/
void RegressionTask(void)
- {
+{
int rv;
int i;
kmutex_t mutexes[4] = {Mutex1, Mutex2, Mutex3, Mutex4};
@@ -263,41 +263,41 @@ void RegressionTask(void)
PRINT_LINE;
- /*
- * 1st iteration: Take Mutex1; Task30 waits on Mutex1
- * 2nd iteration: Take Mutex2: Task25 waits on Mutex2
- * 3rd iteration: Take Mutex3; Task20 waits on Mutex3
- * 4th iteration: Take Mutex4; Task10 waits on Mutex4
- */
+ /*
+ * 1st iteration: Take Mutex1; Task30 waits on Mutex1
+ * 2nd iteration: Take Mutex2: Task25 waits on Mutex2
+ * 3rd iteration: Take Mutex3; Task20 waits on Mutex3
+ * 4th iteration: Take Mutex4; Task10 waits on Mutex4
+ */
for (i = 0; i < 4; i++) {
rv = task_mutex_lock(mutexes[i]);
if (rv != RC_OK) {
- TC_ERROR("Failed to lock mutex 0x%x\n", mutexes[i]);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
+ TC_ERROR("Failed to lock mutex 0x%x\n", mutexes[i]);
+ tcRC = TC_FAIL;
+ goto errorReturn;
+ }
task_sleep(ONE_SECOND);
rv = task_priority_get();
if (rv != priority[i]) {
- TC_ERROR("Expected priority %d, not %d\n", priority[i], rv);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
+ TC_ERROR("Expected priority %d, not %d\n", priority[i], rv);
+ tcRC = TC_FAIL;
+ goto errorReturn;
+ }
if (tcRC != TC_PASS) { /* Catch any errors from other tasks */
- goto errorReturn;
- }
+ goto errorReturn;
}
+ }
- /* ~ 4 seconds have passed */
+ /* ~ 4 seconds have passed */
TC_PRINT("Done LOCKING! Current priority = %d\n", task_priority_get());
task_sleep(ONE_SECOND); /* Task10 should time out */
- /* ~ 5 seconds have passed */
+ /* ~ 5 seconds have passed */
rv = task_priority_get();
if (rv != 15) {
@@ -305,7 +305,7 @@ void RegressionTask(void)
TC_ERROR("Expected priority %d, not %d\n", 15, rv);
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
task_mutex_unlock(Mutex4);
rv = task_priority_get();
@@ -314,40 +314,40 @@ void RegressionTask(void)
TC_ERROR("Expected priority %d, not %d\n", 20, rv);
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
task_sleep(ONE_SECOND); /* Task20 should time out */
- /* ~ 6 seconds have passed */
+ /* ~ 6 seconds have passed */
for (i = 0; i < 3; i++) {
rv = task_priority_get();
if (rv != dropPri[i]) {
- TC_ERROR("Expected priority %d, not %d\n", dropPri[i], rv);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
+ TC_ERROR("Expected priority %d, not %d\n", dropPri[i], rv);
+ tcRC = TC_FAIL;
+ goto errorReturn;
+ }
task_mutex_unlock(giveMutex[i]);
if (tcRC != TC_PASS) {
- goto errorReturn;
- }
+ goto errorReturn;
}
+ }
rv = task_priority_get();
if (rv != 40) {
TC_ERROR("Expected priority %d, not %d\n", 40, rv);
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
task_sleep(ONE_SECOND); /* Give Task45 time to run */
if (tcRC != TC_PASS) {
goto errorReturn;
- }
+ }
errorReturn:
TC_END_RESULT(tcRC);
TC_END_REPORT(tcRC);
- } /* RegressionTask */
+} /* RegressionTask */
diff --git a/samples/microkernel/test/test_pipe/src/main.c b/samples/microkernel/test/test_pipe/src/main.c
index f52b32ee8..ce37a2cac 100644
--- a/samples/microkernel/test/test_pipe/src/main.c
+++ b/samples/microkernel/test/test_pipe/src/main.c
@@ -82,11 +82,11 @@ kpipe_t pipeId = PIPE_ID;
*/
void RegressionTaskEntry(void)
- {
+{
extern int RegressionTask(void);
task_sem_give(resultSems[RegressionTask()]);
- }
+}
/*******************************************************************************
*
@@ -99,11 +99,11 @@ void RegressionTaskEntry(void)
*/
void AlternateTaskEntry(void)
- {
+{
extern int AlternateTask(void);
task_sem_give(resultSems[AlternateTask()]);
- }
+}
/*******************************************************************************
*
@@ -116,31 +116,31 @@ void AlternateTaskEntry(void)
*/
void MonitorTaskEntry(void)
- {
+{
ksem_t result;
int tasksDone;
PRINT_DATA("Starting pipe tests\n");
PRINT_LINE;
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
+ /*
+ * the various test tasks start executing automatically;
+ * wait for all tasks to complete or a failure to occur,
+ * then issue the appropriate test case summary message
+ */
for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take_wait_timeout(resultSems, TIMEOUT);
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
+ result = task_sem_group_take_wait_timeout(resultSems, TIMEOUT);
+ if (result != resultSems[TC_PASS]) {
+ if (result != resultSems[TC_FAIL]) {
+ TC_ERROR("Monitor task timed out\n");
+ }
+ TC_END_RESULT(TC_FAIL);
+ TC_END_REPORT(TC_FAIL);
+ return;
}
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
}
TC_END_RESULT(TC_PASS);
TC_END_REPORT(TC_PASS);
- }
+}
diff --git a/samples/microkernel/test/test_pipe/src/pipe.c b/samples/microkernel/test/test_pipe/src/pipe.c
index 871faf6df..256b208e8 100644
--- a/samples/microkernel/test/test_pipe/src/pipe.c
+++ b/samples/microkernel/test/test_pipe/src/pipe.c
@@ -64,7 +64,7 @@ typedef struct {
K_PIPE_OPTION options; /* options for task_pipe_XXX() APIs */
int sent; /* expected # of bytes sent */
int rcode; /* expected return code */
- } SIZE_EXPECT;
+} SIZE_EXPECT;
/* locals */
@@ -180,7 +180,7 @@ void microObjectsInit(void)
for (i = 0; i < sizeof(rxBuffer); i++) {
txBuffer[i] = (char) i;
- }
+ }
}
/*******************************************************************************
@@ -199,9 +199,9 @@ int receiveBufferCheck(char *buffer, int size)
for (j = 0; j < size; j++) {
if (buffer[j] != (char) j) {
- return j;
- }
+ return j;
}
+ }
return size;
}
@@ -230,76 +230,76 @@ int pipePutHelperWork(SIZE_EXPECT *singleItems, int nSingles,
for (i = 0; i < nSingles; i++) {
(void)task_sem_take_wait(altSem);
for (j = 0; j < sizeof(rxBuffer); j++) {
- rxBuffer[j] = 0;
- }
+ rxBuffer[j] = 0;
+ }
rv = task_pipe_get(pipeId, rxBuffer, singleItems[i].size,
- &bytesReceived, singleItems[i].options);
+ &bytesReceived, singleItems[i].options);
if (rv != singleItems[i].rcode) {
- TC_ERROR("task_pipe_get(%d bytes) : Expected %d not %d.\n"
- " bytesReceived = %d\n",
- singleItems[i].size, singleItems[i].rcode,
- rv, bytesReceived);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_get(%d bytes) : Expected %d not %d.\n"
+ " bytesReceived = %d\n",
+ singleItems[i].size, singleItems[i].rcode,
+ rv, bytesReceived);
+ return TC_FAIL;
+ }
if (bytesReceived != singleItems[i].sent) {
- TC_ERROR("task_pipe_get(%d) : "
- "Expected %d bytes to be received, not %d\n",
- singleItems[i].size, singleItems[i].sent, bytesReceived);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_get(%d) : "
+ "Expected %d bytes to be received, not %d\n",
+ singleItems[i].size, singleItems[i].sent, bytesReceived);
+ return TC_FAIL;
+ }
index = receiveBufferCheck(rxBuffer, bytesReceived);
if (index != bytesReceived) {
- TC_ERROR("pipePutHelper: rxBuffer[%d] is %d, not %d\n",
- index, rxBuffer[index], index);
- return TC_FAIL;
- }
+ TC_ERROR("pipePutHelper: rxBuffer[%d] is %d, not %d\n",
+ index, rxBuffer[index], index);
+ return TC_FAIL;
+ }
task_sem_give(counterSem);
task_sem_give(regSem);
- }
+ }
- /*
- * Get items from the pipe. There should be more than one item
- * stored in it.
- */
+ /*
+ * Get items from the pipe. There should be more than one item
+ * stored in it.
+ */
(void)task_sem_take_wait(altSem);
for (i = 0; i < nMany; i++) {
for (j = 0; j < sizeof(rxBuffer); j++) {
- rxBuffer[j] = 0;
- }
+ rxBuffer[j] = 0;
+ }
rv = task_pipe_get(pipeId, rxBuffer, manyItems[i].size,
- &bytesReceived, manyItems[i].options);
+ &bytesReceived, manyItems[i].options);
if (rv != manyItems[i].rcode) {
- TC_ERROR("task_pipe_get(%d bytes) : Expected %d not %d.\n"
- " bytesReceived = %d, iteration: %d\n",
- manyItems[i].size, manyItems[i].rcode,
- rv, bytesReceived, i+1);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_get(%d bytes) : Expected %d not %d.\n"
+ " bytesReceived = %d, iteration: %d\n",
+ manyItems[i].size, manyItems[i].rcode,
+ rv, bytesReceived, i+1);
+ return TC_FAIL;
+ }
if (bytesReceived != manyItems[i].sent) {
- TC_ERROR("task_pipe_get(%d) : "
- "Expected %d bytes to be received, not %d\n",
- manyItems[i].size, manyItems[i].sent, bytesReceived);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_get(%d) : "
+ "Expected %d bytes to be received, not %d\n",
+ manyItems[i].size, manyItems[i].sent, bytesReceived);
+ return TC_FAIL;
+ }
index = receiveBufferCheck(rxBuffer, bytesReceived);
if (index != bytesReceived) {
- TC_ERROR("pipeGetHelper: rxBuffer[%d] is %d, not %d\n",
- index, rxBuffer[index], index);
- return TC_FAIL;
- }
+ TC_ERROR("pipeGetHelper: rxBuffer[%d] is %d, not %d\n",
+ index, rxBuffer[index], index);
+ return TC_FAIL;
+ }
task_sem_give(counterSem);
- }
+ }
task_sem_give(regSem); /* Wake the RegressionTask */
@@ -318,25 +318,25 @@ int pipePutHelper(void)
int rv; /* return value from pipePutHelperWork() */
rv = pipePutHelperWork(all_N, ARRAY_SIZE(all_N),
- many_all_N, ARRAY_SIZE(many_all_N));
+ many_all_N, ARRAY_SIZE(many_all_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on all_N/many_all_N test\n");
return TC_FAIL;
- }
+ }
rv = pipePutHelperWork(one_to_N, ARRAY_SIZE(one_to_N),
- many_one_to_N, ARRAY_SIZE(many_one_to_N));
+ many_one_to_N, ARRAY_SIZE(many_one_to_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on _1_TO_N/many_1_TO_N test\n");
return TC_FAIL;
- }
+ }
rv = pipePutHelperWork(zero_to_N, ARRAY_SIZE(zero_to_N),
- many_zero_to_N, ARRAY_SIZE(many_zero_to_N));
+ many_zero_to_N, ARRAY_SIZE(many_zero_to_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on _0_TO_N/many_0_TO_N test\n");
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -367,65 +367,65 @@ int pipePutTestWork(SIZE_EXPECT *singleItems, int nSingles,
for (i = 0; i < nSingles; i++) {
rv = task_pipe_put(pipeId, txBuffer, singleItems[i].size,
- &bytesWritten, singleItems[i].options);
+ &bytesWritten, singleItems[i].options);
if (rv != singleItems[i].rcode) {
- TC_ERROR("task_pipe_put(%d) : Expected %d not %d.\n"
- " bytesWritten = %d, Iteration: %d\n",
- singleItems[i].size, singleItems[i].rcode,
- rv, bytesWritten, i + 1);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_put(%d) : Expected %d not %d.\n"
+ " bytesWritten = %d, Iteration: %d\n",
+ singleItems[i].size, singleItems[i].rcode,
+ rv, bytesWritten, i + 1);
+ return TC_FAIL;
+ }
if (bytesWritten != singleItems[i].sent) {
- TC_ERROR("task_pipe_put(%d) : "
- "Expected %d bytes to be written, not %d\n",
- singleItems[i].size, singleItems[i].sent, bytesWritten);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_put(%d) : "
+ "Expected %d bytes to be written, not %d\n",
+ singleItems[i].size, singleItems[i].sent, bytesWritten);
+ return TC_FAIL;
+ }
task_sem_give(altSem);
(void)task_sem_take_wait(regSem);
- nitem = task_sem_count_get(counterSem) - 1;
+ nitem = task_sem_count_get(counterSem) - 1;
if (nitem != i) {
- TC_ERROR("Expected item number is %d, not %d\n",
- i, nitem);
- return TC_FAIL;
- }
+ TC_ERROR("Expected item number is %d, not %d\n",
+ i, nitem);
+ return TC_FAIL;
}
+ }
- /* This time, more than one item will be in the pipe at a time */
+ /* This time, more than one item will be in the pipe at a time */
task_sem_reset(counterSem);
for (i = 0; i < nMany; i++) {
rv = task_pipe_put(pipeId, txBuffer, manyItems[i].size,
- &bytesWritten, manyItems[i].options);
+ &bytesWritten, manyItems[i].options);
if (rv != manyItems[i].rcode) {
- TC_ERROR("task_pipe_put(%d) : Expected %d not %d.\n"
- " bytesWritten = %d, iteration: %d\n",
- manyItems[i].size, manyItems[i].rcode,
- rv, bytesWritten, i + 1);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_put(%d) : Expected %d not %d.\n"
+ " bytesWritten = %d, iteration: %d\n",
+ manyItems[i].size, manyItems[i].rcode,
+ rv, bytesWritten, i + 1);
+ return TC_FAIL;
+ }
if (bytesWritten != manyItems[i].sent) {
- TC_ERROR("task_pipe_put(%d) : "
- "Expected %d bytes to be written, not %d\n",
- manyItems[i].size, manyItems[i].sent, bytesWritten);
- return TC_FAIL;
- }
+ TC_ERROR("task_pipe_put(%d) : "
+ "Expected %d bytes to be written, not %d\n",
+ manyItems[i].size, manyItems[i].sent, bytesWritten);
+ return TC_FAIL;
}
+ }
task_sem_give(altSem); /* Wake the alternate task */
- /* wait for other task reading all the items from pipe */
+ /* wait for other task reading all the items from pipe */
(void)task_sem_take_wait(regSem);
if (task_sem_count_get(counterSem) != nMany) {
TC_ERROR("Expected number of items %d, not %d\n",
- nMany, task_sem_count_get(counterSem));
+ nMany, task_sem_count_get(counterSem));
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -444,25 +444,25 @@ int pipePutTest(void)
int rv; /* return value from pipePutTestWork() */
rv = pipePutTestWork(all_N, ARRAY_SIZE(all_N),
- many_all_N, ARRAY_SIZE(many_all_N));
+ many_all_N, ARRAY_SIZE(many_all_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on _ALL_N/many_ALL_N test\n");
return TC_FAIL;
- }
+ }
rv = pipePutTestWork(one_to_N, ARRAY_SIZE(one_to_N),
- many_one_to_N, ARRAY_SIZE(many_one_to_N));
+ many_one_to_N, ARRAY_SIZE(many_one_to_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on _1_TO_N/many_1_TO_N test\n");
return TC_FAIL;
- }
+ }
rv = pipePutTestWork(zero_to_N, ARRAY_SIZE(zero_to_N),
- many_zero_to_N, ARRAY_SIZE(many_zero_to_N));
+ many_zero_to_N, ARRAY_SIZE(many_zero_to_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on _0_TO_N/many_0_TO_N test\n");
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -482,49 +482,49 @@ int pipePutWaitHelper(void)
(void)task_sem_take_wait(altSem); /* Wait until test is ready */
- /* 1. task_pipe_get_wait() will force a context switch to RegressionTask() */
+ /* 1. task_pipe_get_wait() will force a context switch to RegressionTask() */
rv = task_pipe_get_wait(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _ALL_N);
+ &bytesRead, _ALL_N);
if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
+ "Expected %d bytes to be read, not %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesRead);
return TC_FAIL;
- }
+ }
- /* 2. task_pipe_get_wait() will force a context switch to RegressionTask(). */
+ /* 2. task_pipe_get_wait() will force a context switch to RegressionTask(). */
rv = task_pipe_get_wait(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _1_TO_N);
+ &bytesRead, _1_TO_N);
if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
+ "Expected %d bytes to be read, not %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesRead);
return TC_FAIL;
- }
+ }
- /*
- * Before emptying the pipe, check that task_pipe_get_wait() fails when
- * using the _0_TO_N option.
- */
+ /*
+ * Before emptying the pipe, check that task_pipe_get_wait() fails when
+ * using the _0_TO_N option.
+ */
rv = task_pipe_get_wait(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N);
+ &bytesRead, _0_TO_N);
if (rv != RC_FAIL) {
TC_ERROR("Expected return code %d, not %d\n", RC_FAIL, rv);
return TC_FAIL;
- }
+ }
- /* 3. Empty the pipe in two reads */
+ /* 3. Empty the pipe in two reads */
for (i = 0; i < 2; i++) {
rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N);
+ &bytesRead, _0_TO_N);
if ((rv != RC_OK) || (bytesRead != PIPE_SIZE / 2)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE / 2, bytesRead);
- return TC_FAIL;
- }
+ TC_ERROR("Expected return code %d, not %d\n"
+ "Expected %d bytes to be read, not %d\n",
+ RC_OK, rv, PIPE_SIZE / 2, bytesRead);
+ return TC_FAIL;
}
+ }
task_sem_give(regSem);
@@ -543,49 +543,49 @@ int pipePutWaitTest(void)
int rv; /* return code from task_pipe_put_wait() */
int bytesWritten; /* # of bytes written to pipe */
- /* 1. Fill the pipe */
+ /* 1. Fill the pipe */
rv = task_pipe_put_wait(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N);
+ &bytesWritten, _ALL_N);
if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesWritten);
return TC_FAIL;
- }
+ }
task_sem_give(altSem); /* Wake the alternate task */
- /* 2. task_pipe_put_wait() will force a context switch to AlternateTask(). */
+ /* 2. task_pipe_put_wait() will force a context switch to AlternateTask(). */
rv = task_pipe_put_wait(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N);
+ &bytesWritten, _ALL_N);
if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesWritten);
return TC_FAIL;
- }
+ }
- /* 3. task_pipe_put_wait() will force a context switch to AlternateTask(). */
+ /* 3. task_pipe_put_wait() will force a context switch to AlternateTask(). */
rv = task_pipe_put_wait(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _1_TO_N);
+ &bytesWritten, _1_TO_N);
if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesWritten);
return TC_FAIL;
- }
+ }
- /* This should return immediately as _0_TO_N with a wait is an error. */
+ /* This should return immediately as _0_TO_N with a wait is an error. */
rv = task_pipe_put_wait(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _0_TO_N);
+ &bytesWritten, _0_TO_N);
if ((rv != RC_FAIL) || (bytesWritten != 0)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_FAIL, rv, 0, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_FAIL, rv, 0, bytesWritten);
return TC_FAIL;
- }
+ }
- /* Wait for AlternateTask()'s pipePutWaitHelper() to finish */
+ /* Wait for AlternateTask()'s pipePutWaitHelper() to finish */
(void)task_sem_take_wait(regSem);
return TC_PASS;
@@ -606,49 +606,49 @@ int pipePutTimeoutHelper(void)
(void)task_sem_take_wait(altSem); /* Wait until test is ready */
- /* 1. task_pipe_get_wait_timeout() will force a context switch to RegressionTask() */
+ /* 1. task_pipe_get_wait_timeout() will force a context switch to RegressionTask() */
rv = task_pipe_get_wait_timeout(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _ALL_N, ONE_SECOND);
+ &bytesRead, _ALL_N, ONE_SECOND);
if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
+ "Expected %d bytes to be read, not %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesRead);
return TC_FAIL;
- }
+ }
- /* 2. task_pipe_get_wait_timeout() will force a context switch to RegressionTask(). */
+ /* 2. task_pipe_get_wait_timeout() will force a context switch to RegressionTask(). */
rv = task_pipe_get_wait_timeout(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _1_TO_N, ONE_SECOND);
+ &bytesRead, _1_TO_N, ONE_SECOND);
if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
+ "Expected %d bytes to be read, not %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesRead);
return TC_FAIL;
- }
+ }
- /*
- * Before emptying the pipe, check that task_pipe_get_wait_timeout() fails when
- * using the _0_TO_N option.
- */
+ /*
+ * Before emptying the pipe, check that task_pipe_get_wait_timeout() fails when
+ * using the _0_TO_N option.
+ */
rv = task_pipe_get_wait_timeout(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N, ONE_SECOND);
+ &bytesRead, _0_TO_N, ONE_SECOND);
if (rv != RC_FAIL) {
TC_ERROR("Expected return code %d, not %d\n", RC_FAIL, rv);
return TC_FAIL;
- }
+ }
- /* 3. Empty the pipe in two reads */
+ /* 3. Empty the pipe in two reads */
for (i = 0; i < 2; i++) {
rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N);
+ &bytesRead, _0_TO_N);
if ((rv != RC_OK) || (bytesRead != PIPE_SIZE / 2)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE / 2, bytesRead);
- return TC_FAIL;
- }
+ TC_ERROR("Expected return code %d, not %d\n"
+ "Expected %d bytes to be read, not %d\n",
+ RC_OK, rv, PIPE_SIZE / 2, bytesRead);
+ return TC_FAIL;
}
+ }
task_sem_give(regSem);
@@ -667,67 +667,69 @@ int pipePutTimeoutTest(void)
int rv; /* return code from task_pipe_put_wait_timeout() */
int bytesWritten; /* # of bytes written to task_pipe_put_wait_timeout() */
- /* 1. Fill the pipe */
+ /* 1. Fill the pipe */
rv = task_pipe_put_wait_timeout(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, ONE_SECOND);
+ &bytesWritten, _ALL_N, ONE_SECOND);
if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesWritten);
return TC_FAIL;
- }
+ }
- /* Timeout while waiting to put data into the pipe */
+ /* Timeout while waiting to put data into the pipe */
rv = task_pipe_put_wait_timeout(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, ONE_SECOND);
+ &bytesWritten, _ALL_N, ONE_SECOND);
if ((rv != RC_TIME) || (bytesWritten != 0)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_TIME, rv, 0, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_TIME, rv, 0, bytesWritten);
return TC_FAIL;
- }
+ }
rv = task_pipe_put_wait_timeout(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _1_TO_N, ONE_SECOND);
+ &bytesWritten, _1_TO_N, ONE_SECOND);
if ((rv != RC_TIME) || (bytesWritten != 0)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_TIME, rv, 0, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_TIME, rv, 0, bytesWritten);
return TC_FAIL;
- }
+ }
task_sem_give(altSem); /* Wake the alternate task */
- /* 2. task_pipe_put_wait() will force a context switch to AlternateTask(). */
+ /* 2. task_pipe_put_wait() will force a context switch to AlternateTask(). */
rv = task_pipe_put_wait_timeout(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, ONE_SECOND);
+ &bytesWritten, _ALL_N, ONE_SECOND);
if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten); return TC_FAIL; }
+ "Bytes written: expected %d, got %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesWritten);
+ return TC_FAIL;
+ }
- /* 3. task_pipe_put_wait() will force a context switch to AlternateTask(). */
+ /* 3. task_pipe_put_wait() will force a context switch to AlternateTask(). */
rv = task_pipe_put_wait_timeout(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _1_TO_N, ONE_SECOND);
+ &bytesWritten, _1_TO_N, ONE_SECOND);
if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_OK, rv, PIPE_SIZE, bytesWritten);
return TC_FAIL;
- }
+ }
- /* This should return immediately as _0_TO_N with a wait is an error. */
+ /* This should return immediately as _0_TO_N with a wait is an error. */
rv = task_pipe_put_wait(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _0_TO_N);
+ &bytesWritten, _0_TO_N);
if ((rv != RC_FAIL) || (bytesWritten != 0)) {
TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_FAIL, rv, 0, bytesWritten);
+ "Bytes written: expected %d, got %d\n",
+ RC_FAIL, rv, 0, bytesWritten);
return TC_FAIL;
- }
+ }
- /* Wait for AlternateTask()'s pipePutWaitHelper() to finish */
+ /* Wait for AlternateTask()'s pipePutWaitHelper() to finish */
(void)task_sem_take_wait(regSem);
return TC_PASS;
@@ -756,28 +758,28 @@ int pipeGetTest(void)
for (j = 0; j < ARRAY_SIZE(options); j++) {
for (i = 0; i < ARRAY_SIZE(size); i++) {
- rv = task_pipe_get(pipeId, rxBuffer, size[i],
- &bytesRead, options[j]);
- if (rv != RC_FAIL) {
- TC_ERROR("Expected return code %d, not %d\n", RC_FAIL, rv);
- return TC_FAIL;
- }
- }
+ rv = task_pipe_get(pipeId, rxBuffer, size[i],
+ &bytesRead, options[j]);
+ if (rv != RC_FAIL) {
+ TC_ERROR("Expected return code %d, not %d\n", RC_FAIL, rv);
+ return TC_FAIL;
+ }
}
+ }
for (i = 0; i < ARRAY_SIZE(size); i++) {
rv = task_pipe_get(pipeId, rxBuffer, size[i],
- &bytesRead, _0_TO_N);
+ &bytesRead, _0_TO_N);
if (rv != RC_OK) {
- TC_ERROR("Expected return code %d, not %d\n", RC_OK, rv);
- return TC_FAIL;
- }
+ TC_ERROR("Expected return code %d, not %d\n", RC_OK, rv);
+ return TC_FAIL;
+ }
if (bytesRead != 0) {
- TC_ERROR("Expected <bytesRead> %d, not %d\n", 0, bytesRead);
- return TC_FAIL;
- }
+ TC_ERROR("Expected <bytesRead> %d, not %d\n", 0, bytesRead);
+ return TC_FAIL;
}
+ }
return TC_PASS;
}
@@ -799,22 +801,22 @@ int pipeGetWaitHelperWork(SIZE_EXPECT *items, int nItems)
int bytesSent; /* # of bytes sent to task_pipe_put_wait() */
for (i = 0; i < nItems; i++) {
- /*
- * Pipe should be empty. Most calls to task_pipe_get_wait() should
- * block until the call to task_pipe_put() is performed in the routine
- * pipeGetWaitHelperWork().
- */
+ /*
+ * Pipe should be empty. Most calls to task_pipe_get_wait() should
+ * block until the call to task_pipe_put() is performed in the routine
+ * pipeGetWaitHelperWork().
+ */
bytesSent = 0;
rv = task_pipe_put_wait(pipeId, rxBuffer, items[i].size,
- &bytesSent, items[i].options);
+ &bytesSent, items[i].options);
if ((rv != items[i].rcode) || (bytesSent != items[i].sent)) {
- TC_ERROR("Expected return value %d, got %d\n"
- "Expected bytesSent = %d, got %d\n",
- items[i].rcode, rv, 0, bytesSent);
- return TC_FAIL;
- }
+ TC_ERROR("Expected return value %d, got %d\n"
+ "Expected bytesSent = %d, got %d\n",
+ items[i].rcode, rv, 0, bytesSent);
+ return TC_FAIL;
}
+ }
return TC_PASS;
}
@@ -836,13 +838,13 @@ int pipeGetWaitHelper(void)
if (rv != TC_PASS) {
TC_ERROR("Failed on _ALL_N test\n");
return TC_FAIL;
- }
+ }
rv = pipeGetWaitHelperWork(wait_one_to_N, ARRAY_SIZE(wait_one_to_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on _1_TO_N test\n");
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -864,21 +866,21 @@ int pipeGetWaitTestWork(SIZE_EXPECT *items, int nItems)
int bytesRead; /* # of bytes read from task_pipe_get_wait() */
for (i = 0; i < nItems; i++) {
- /*
- * Pipe should be empty. Most calls to task_pipe_get_wait() should
- * block until the call to task_pipe_put() is performed in the routine
- * pipeGetWaitHelperWork().
- */
+ /*
+ * Pipe should be empty. Most calls to task_pipe_get_wait() should
+ * block until the call to task_pipe_put() is performed in the routine
+ * pipeGetWaitHelperWork().
+ */
rv = task_pipe_get_wait(pipeId, rxBuffer, items[i].size,
- &bytesRead, items[i].options);
+ &bytesRead, items[i].options);
if ((rv != items[i].rcode) || (bytesRead != items[i].sent)) {
- TC_ERROR("Expected return value %d, got %d\n"
- "Expected bytesRead = %d, got %d\n",
- items[i].rcode, rv, 0, bytesRead);
- return TC_FAIL;
- }
+ TC_ERROR("Expected return value %d, got %d\n"
+ "Expected bytesRead = %d, got %d\n",
+ items[i].rcode, rv, 0, bytesRead);
+ return TC_FAIL;
}
+ }
return TC_PASS;
}
@@ -901,20 +903,20 @@ int pipeGetWaitTest(void)
if (rv != TC_PASS) {
TC_ERROR("Failed on _ALL_N test\n");
return TC_FAIL;
- }
+ }
rv = pipeGetWaitTestWork(wait_one_to_N, ARRAY_SIZE(wait_one_to_N));
if (rv != TC_PASS) {
TC_ERROR("Failed on _1_TO_N test\n");
return TC_FAIL;
- }
+ }
rv = task_pipe_get_wait(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _0_TO_N);
+ &bytesRead, _0_TO_N);
if (rv != RC_FAIL) {
TC_ERROR("Expected return code of %d, not %d\n", RC_FAIL, rv);
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -934,17 +936,17 @@ int pipeGetTimeoutTest(void)
for (i = 0; i < ARRAY_SIZE(timeout_cases); i++) {
rv = task_pipe_get_wait_timeout(pipeId, rxBuffer, timeout_cases[i].size,
- &bytesRead, timeout_cases[i].options, ONE_SECOND);
+ &bytesRead, timeout_cases[i].options, ONE_SECOND);
if ((rv != timeout_cases[i].rcode) ||
- (bytesRead != timeout_cases[i].sent)) {
- TC_ERROR("Expected return code %d, got %d\n"
- "Expected <bytesRead> %d, got %d\n"
- "Iteration %d\n",
- timeout_cases[i].rcode, rv, timeout_cases[i].sent,
- bytesRead, i + 1);
- return TC_FAIL;
- }
+ (bytesRead != timeout_cases[i].sent)) {
+ TC_ERROR("Expected return code %d, got %d\n"
+ "Expected <bytesRead> %d, got %d\n"
+ "Iteration %d\n",
+ timeout_cases[i].rcode, rv, timeout_cases[i].sent,
+ bytesRead, i + 1);
+ return TC_FAIL;
}
+ }
return TC_PASS;
}
@@ -965,33 +967,33 @@ int AlternateTask(void)
rv = pipePutHelper();
if (rv != TC_PASS) {
return TC_FAIL;
- }
+ }
rv = pipePutWaitHelper();
if (rv != TC_PASS) {
return TC_FAIL;
- }
+ }
rv = pipePutTimeoutHelper();
if (rv != TC_PASS) {
return TC_FAIL;
- }
+ }
- /*
- * There is no pipeGetHelper() as the task_pipe_get() checks have
- * either been done in pipePutHelper(), or pipeGetTest().
- */
+ /*
+ * There is no pipeGetHelper() as the task_pipe_get() checks have
+ * either been done in pipePutHelper(), or pipeGetTest().
+ */
rv = pipeGetWaitHelper();
if (rv != TC_PASS) {
return TC_FAIL;
- }
+ }
- /*
- * There is no pipeGetTimeoutHelper() as the task_pipe_get_wait_timeout() checks
- * have either been done in pipePutTimeoutHelper() or
- * pipeGetTimeoutTest().
- */
+ /*
+ * There is no pipeGetTimeoutHelper() as the task_pipe_get_wait_timeout() checks
+ * have either been done in pipePutTimeoutHelper() or
+ * pipeGetTimeoutTest().
+ */
return TC_PASS;
}
@@ -1014,38 +1016,38 @@ int RegressionTask(void)
TC_PRINT("Testing task_pipe_put() ...\n");
tcRC = pipePutTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
TC_PRINT("Testing task_pipe_put_wait() ...\n");
tcRC = pipePutWaitTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
TC_PRINT("Testing task_pipe_put_wait_timeout() ...\n");
tcRC = pipePutTimeoutTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
TC_PRINT("Testing task_pipe_get() ...\n");
tcRC = pipeGetTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
TC_PRINT("Testing task_pipe_get_wait() ...\n");
tcRC = pipeGetWaitTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
TC_PRINT("Testing task_pipe_get_wait_timeout() ...\n");
tcRC = pipeGetTimeoutTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
return TC_PASS;
}
diff --git a/samples/microkernel/test/test_pool/src/pool.c b/samples/microkernel/test/test_pool/src/pool.c
index bf64de768..2a00c704b 100644
--- a/samples/microkernel/test/test_pool/src/pool.c
+++ b/samples/microkernel/test/test_pool/src/pool.c
@@ -59,7 +59,7 @@ This modules tests the following memory pool routines:
typedef struct {
struct k_block *block; /* pointer to block data */
- kmemory_pool_t poolId; /* pool ID */
+ kmemory_pool_t poolId; /* pool ID */
int size; /* request size in bytes */
int32_t timeout; /* # of ticks to wait */
int rcode; /* expected return code */
diff --git a/samples/microkernel/test/test_secure_string_api/src/secure.c b/samples/microkernel/test/test_secure_string_api/src/secure.c
index f1eef4ded..57e552267 100644
--- a/samples/microkernel/test/test_secure_string_api/src/secure.c
+++ b/samples/microkernel/test/test_secure_string_api/src/secure.c
@@ -58,43 +58,46 @@ This modules tests the following secure routines:
*/
void MainTask(void)
- {
+{
int result;
- /* wait for the first task to start */
+ /* wait for the first task to start */
result = task_sem_take_wait_timeout(SEMA1, WAIT_TOUT);
if (result != RC_OK) {
- TC_ERROR("Test task 1 did not start properly\n");
- goto fail;
+ TC_ERROR("Test task 1 did not start properly\n");
+ goto fail;
}
- /* now we check the first task to perform the test and die */
+
+ /* now we check the first task to perform the test and die */
result = task_sem_take_wait_timeout(SEMA1, WAIT_TOUT);
if (result == RC_TIME) {
- TC_PRINT("As expected, test task 1 did not continue operating \n");
- TC_PRINT("after calling memcpy_s with incorrect parameters\n");
+ TC_PRINT("As expected, test task 1 did not continue operating \n");
+ TC_PRINT("after calling memcpy_s with incorrect parameters\n");
}
else {
- TC_ERROR("Test task 1 unexpectedly continued\n"
- "after calling memcpy_s with incorrect parameters\n");
- goto fail;
+ TC_ERROR("Test task 1 unexpectedly continued\n"
+ "after calling memcpy_s with incorrect parameters\n");
+ goto fail;
}
- /* wait for the second task to start */
+ /* wait for the second task to start */
result = task_sem_take_wait_timeout(SEMA2, WAIT_TOUT);
if (result != RC_OK) {
- TC_ERROR("Test task 2 did not start properly\n");
- goto fail;
+ TC_ERROR("Test task 2 did not start properly\n");
+ goto fail;
}
- /* now we check the second task to perform the test and die */
+
+ /* now we check the second task to perform the test and die */
result = task_sem_take_wait_timeout(SEMA2, WAIT_TOUT);
if (result == RC_TIME) {
- TC_PRINT("As expected, test task 2 did not continue operating \n");
- TC_PRINT("after calling strcpy_s with incorrect parameters\n");
+ TC_PRINT("As expected, test task 2 did not continue operating \n");
+ TC_PRINT("after calling strcpy_s with incorrect parameters\n");
}
else {
- TC_ERROR("Test task 2 unexpectedly continued\n"
- "after calling memcpy_s with incorrect parameters\n");
- goto fail;
+ TC_ERROR("Test task 2 unexpectedly continued\n"
+ "after calling memcpy_s with incorrect parameters\n");
+ goto fail;
}
+
TC_END_RESULT(TC_PASS);
TC_END_REPORT(TC_PASS);
return;
@@ -102,7 +105,7 @@ void MainTask(void)
fail:
TC_END_RESULT(TC_FAIL);
TC_END_REPORT(TC_FAIL);
- }
+}
/*******************************************************************************
*
@@ -113,18 +116,19 @@ fail:
* RETURNS: N/A
*/
void MemcpyTask(void)
- {
+{
uint8_t buf1[BUFSIZE];
uint8_t buf2[BUFSIZE + 1];
- /* do correct memory copy */
+ /* do correct memory copy */
k_memcpy_s(buf2, sizeof(buf2), buf1, sizeof(buf1));
task_sem_give(SEMA1);
task_yield();
- /* do incorrect memory copy */
+
+ /* do incorrect memory copy */
k_memcpy_s(buf1, sizeof(buf1), buf2, sizeof(buf2));
task_sem_give(SEMA1);
- }
+}
/*******************************************************************************
*
@@ -135,22 +139,22 @@ void MemcpyTask(void)
* RETURNS: N/A
*/
void StrcpyTask(void)
- {
+{
char buf1[BUFSIZE];
- char buf2[BUFSIZE] = { '1', '2', '3', '4', '5',
- '6', '7', '8', '9', 0 };
+ char buf2[BUFSIZE] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', 0 };
- /* do correct string copy */
+ /* do correct string copy */
strcpy_s(buf1, sizeof(buf1), buf2);
task_sem_give(SEMA2);
task_yield();
- /*
- * Make the string not \0 terminated as a result
- * strcpy_s has to make an error
- */
+ /*
+ * Make the string not \0 terminated as a result
+ * strcpy_s has to make an error
+ */
buf2[BUFSIZE - 1] = '0';
- /* do incorrect string copy */
+
+ /* do incorrect string copy */
strcpy_s(buf1, sizeof(buf1), buf2);
task_sem_give(SEMA2);
- }
+}
diff --git a/samples/microkernel/test/test_sema/src/main.c b/samples/microkernel/test/test_sema/src/main.c
index 7b893af9d..49b96aa6f 100644
--- a/samples/microkernel/test/test_sema/src/main.c
+++ b/samples/microkernel/test/test_sema/src/main.c
@@ -249,22 +249,22 @@ void MonitorTaskEntry(void)
PRINT_DATA("Starting semaphore tests\n");
PRINT_LINE;
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
+ /*
+ * the various test tasks start executing automatically;
+ * wait for all tasks to complete or a failure to occur,
+ * then issue the appropriate test case summary message
+ */
for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take_wait_timeout(resultSems, SECONDS(60));
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
+ result = task_sem_group_take_wait_timeout(resultSems, SECONDS(60));
+ if (result != resultSems[TC_PASS]) {
+ if (result != resultSems[TC_FAIL]) {
+ TC_ERROR("Monitor task timed out\n");
+ }
+ TC_END_RESULT(TC_FAIL);
+ TC_END_REPORT(TC_FAIL);
+ return;
}
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
}
TC_END_RESULT(TC_PASS);
diff --git a/samples/microkernel/test/test_sema/src/sema.c b/samples/microkernel/test/test_sema/src/sema.c
index a582ae6e0..bc5255048 100644
--- a/samples/microkernel/test/test_sema/src/sema.c
+++ b/samples/microkernel/test/test_sema/src/sema.c
@@ -81,15 +81,15 @@ extern ksem_t semList[];
*/
int simpleSemaTest(void)
- {
+{
int signalCount;
int i;
int status;
- /*
- * Signal the semaphore several times from an ISR. After each signal,
- * check the signal count.
- */
+ /*
+ * Signal the semaphore several times from an ISR. After each signal,
+ * check the signal count.
+ */
for (i = 0; i < 5; i++) {
trigger_isrSemaSignal(simpleSem);
@@ -97,74 +97,74 @@ int simpleSemaTest(void)
task_sleep(10); /* Time for low priority task to run. */
signalCount = task_sem_count_get(simpleSem);
if (signalCount != (i + 1)) {
- TC_ERROR("<signalCount> error. Expected %d, got %d\n",
- i + 1, signalCount);
- return TC_FAIL;
- }
+ TC_ERROR("<signalCount> error. Expected %d, got %d\n",
+ i + 1, signalCount);
+ return TC_FAIL;
}
+ }
- /*
- * Signal the semaphore several times from a task. After each signal,
- * check the signal count.
- */
+ /*
+ * Signal the semaphore several times from a task. After each signal,
+ * check the signal count.
+ */
for (i = 5; i < 10; i++) {
task_sem_give(simpleSem);
signalCount = task_sem_count_get(simpleSem);
if (signalCount != (i + 1)) {
- TC_ERROR("<signalCount> error. Expected %d, got %d\n",
- i + 1, signalCount);
- return TC_FAIL;
- }
+ TC_ERROR("<signalCount> error. Expected %d, got %d\n",
+ i + 1, signalCount);
+ return TC_FAIL;
}
+ }
- /*
- * Test the semaphore without wait. Check the signal count after each
- * attempt (it should be decrementing by 1 each time).
- */
+ /*
+ * Test the semaphore without wait. Check the signal count after each
+ * attempt (it should be decrementing by 1 each time).
+ */
for (i = 9; i >= 4; i--) {
status = task_sem_take(simpleSem);
if (status != RC_OK) {
- TC_ERROR("task_sem_take(SIMPLE_SEM) error. Expected %d, not %d.\n",
- RC_OK, status);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_take(SIMPLE_SEM) error. Expected %d, not %d.\n",
+ RC_OK, status);
+ return TC_FAIL;
+ }
signalCount = task_sem_count_get(simpleSem);
if (signalCount != i) {
- TC_ERROR("<signalCount> error. Expected %d, not %d\n",
- i, signalCount);
- return TC_FAIL;
- }
+ TC_ERROR("<signalCount> error. Expected %d, not %d\n",
+ i, signalCount);
+ return TC_FAIL;
}
+ }
task_sem_reset(simpleSem);
- /*
- * The semaphore's signal count should now be zero (0). Test the
- * semaphore without wait. It should fail.
- */
+ /*
+ * The semaphore's signal count should now be zero (0). Test the
+ * semaphore without wait. It should fail.
+ */
for (i = 0; i < 10; i++) {
status = task_sem_take(simpleSem);
if (status != RC_FAIL) {
- TC_ERROR("task_sem_take(SIMPLE_SEM) error. Expected %d, got %d.\n",
- RC_FAIL, status);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_take(SIMPLE_SEM) error. Expected %d, got %d.\n",
+ RC_FAIL, status);
+ return TC_FAIL;
+ }
signalCount = task_sem_count_get(simpleSem);
if (signalCount != 0) {
- TC_ERROR("<signalCount> error. Expected %d, not %d\n",
- 0, signalCount);
- return TC_FAIL;
- }
+ TC_ERROR("<signalCount> error. Expected %d, not %d\n",
+ 0, signalCount);
+ return TC_FAIL;
}
+ }
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -174,55 +174,55 @@ int simpleSemaTest(void)
*/
int simpleSemaWaitTest(void)
- {
+{
int status;
int i;
for (i = 0; i < 5; i++) {
- /* Wait one second for SIMPLE_SEM. Timeout is expected. */
+ /* Wait one second for SIMPLE_SEM. Timeout is expected. */
status = task_sem_take_wait_timeout(simpleSem, OBJ_TIMEOUT);
if (status != RC_TIME) {
- TC_ERROR("task_sem_take_wait_timeout() error. Expected %d, got %d\n",
- RC_TIME, status);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_take_wait_timeout() error. Expected %d, got %d\n",
+ RC_TIME, status);
+ return TC_FAIL;
}
+ }
- /*
- * Signal the semaphore upon which the alternate task is waiting. The
- * alternate task (which is at a lower priority) will cause SIMPLE_SEM
- * to be signalled, thus waking this task.
- */
+ /*
+ * Signal the semaphore upon which the alternate task is waiting. The
+ * alternate task (which is at a lower priority) will cause SIMPLE_SEM
+ * to be signalled, thus waking this task.
+ */
task_sem_give(altSem);
status = task_sem_take_wait_timeout(simpleSem, OBJ_TIMEOUT);
if (status != RC_OK) {
TC_ERROR("task_sem_take_wait_timeout() error. Expected %d, got %d\n",
- RC_OK, status);
+ RC_OK, status);
return TC_FAIL;
- }
+ }
- /*
- * Note that task_sem_take_wait() has been tested when waking up the alternate
- * task. Since previous tests had this task waiting, the alternate task
- * must have had the time to enter the state where it is waiting for the
- * ALTTASK_SEM semaphore to be given. Thus, we do not need to test for
- * it here.
- *
- * Now wait on SIMPLE_SEM again. This time it will be woken up by an
- * ISR signalling the semaphore.
- */
+ /*
+ * Note that task_sem_take_wait() has been tested when waking up the alternate
+ * task. Since previous tests had this task waiting, the alternate task
+ * must have had the time to enter the state where it is waiting for the
+ * ALTTASK_SEM semaphore to be given. Thus, we do not need to test for
+ * it here.
+ *
+ * Now wait on SIMPLE_SEM again. This time it will be woken up by an
+ * ISR signalling the semaphore.
+ */
status = task_sem_take_wait_timeout(simpleSem, OBJ_TIMEOUT);
if (status != RC_OK) {
TC_ERROR("task_sem_take_wait_timeout() error. Expected %d, got %d\n",
- RC_OK, status);
+ RC_OK, status);
return TC_FAIL;
- }
+ }
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -232,77 +232,77 @@ int simpleSemaWaitTest(void)
*/
int simpleGroupTest(void)
- {
+{
int i;
int j;
int status;
ksem_t value;
- /* Ensure that the semaphores in the group are reset */
+ /* Ensure that the semaphores in the group are reset */
task_sem_group_reset(semList);
for (i = 0; semList[i] != ENDLIST; i++) {
status = task_sem_count_get(semList[i]);
if (status != 0) {
- TC_ERROR("task_sem_count_get() returned %d not %d\n", status, 0);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_count_get() returned %d not %d\n", status, 0);
+ return TC_FAIL;
}
+ }
- /* Timeout while waiting for a semaphore from the group */
+ /* Timeout while waiting for a semaphore from the group */
value = task_sem_group_take_wait_timeout(semList, OBJ_TIMEOUT);
if (value != ENDLIST) {
TC_ERROR("task_sem_group_take_wait_timeout() returned %d not %d\n",
- value, ENDGROUP);
+ value, ENDGROUP);
return TC_FAIL;
- }
+ }
- /* Signal the semaphores in the group */
+ /* Signal the semaphores in the group */
for (i = 0; i < 10; i++) {
task_sem_group_give(semList);
for (j = 0; semList[j] != ENDLIST; j++) {
- status = task_sem_count_get(semList[j]);
- if (status != i + 1) {
- TC_ERROR("task_sem_count_get() returned %d not %d\n",
- status, i + 1);
- return TC_FAIL;
- }
- }
+ status = task_sem_count_get(semList[j]);
+ if (status != i + 1) {
+ TC_ERROR("task_sem_count_get() returned %d not %d\n",
+ status, i + 1);
+ return TC_FAIL;
+ }
}
+ }
- /* Get the semaphores */
+ /* Get the semaphores */
for (i = 9; i >= 5; i--) {
value = task_sem_group_take_wait_timeout(semList, 0);
for (j = 0; semList[j] != ENDLIST; j++) {
- status = task_sem_count_get(semList[j]);
- if (status != (value == semList[j] ? i : 10)) {
- TC_ERROR("task_sem_count_get(0x%x) returned %d not %d\n",
- semList[j], status, (value == semList[j]) ? i : 10);
- return TC_FAIL;
- }
- }
+ status = task_sem_count_get(semList[j]);
+ if (status != (value == semList[j] ? i : 10)) {
+ TC_ERROR("task_sem_count_get(0x%x) returned %d not %d\n",
+ semList[j], status, (value == semList[j]) ? i : 10);
+ return TC_FAIL;
+ }
}
+ }
- /* Reset the semaphores in the group */
+ /* Reset the semaphores in the group */
task_sem_group_reset(semList);
for (i = 0; semList[i] != ENDLIST; i++) {
status = task_sem_count_get(semList[i]);
if (status != 0) {
- TC_ERROR("task_sem_count_get() returned %d not %d\n", status, 0);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_count_get() returned %d not %d\n", status, 0);
+ return TC_FAIL;
}
+ }
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -315,57 +315,57 @@ int simpleGroupTest(void)
*/
int simpleGroupWaitTest(void)
- {
+{
int i;
ksem_t sema;
task_sem_give(altSem); /* Wake the alternate task */
- /*
- * Wait for a semaphore to be signalled by the alternate task.
- * Each semaphore in the group will be tested.
- */
+ /*
+ * Wait for a semaphore to be signalled by the alternate task.
+ * Each semaphore in the group will be tested.
+ */
for (i = 0; semList[i] != ENDLIST; i++) {
sema = task_sem_group_take_wait(semList);
if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
- (int) semList[i], (int) sema);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
+ (int) semList[i], (int) sema);
+ return TC_FAIL;
}
+ }
- /*
- * The Alternate Task will signal the semaphore group once. Note that
- * when the semaphore group is signalled, the last semaphore in the
- * group is the value that is returned, not the first.
- */
+ /*
+ * The Alternate Task will signal the semaphore group once. Note that
+ * when the semaphore group is signalled, the last semaphore in the
+ * group is the value that is returned, not the first.
+ */
for (i = 3; i >= 0; i--) {
sema = task_sem_group_take_wait(semList);
if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
- (int) semList[3], (int) sema);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
+ (int) semList[3], (int) sema);
+ return TC_FAIL;
}
+ }
- /*
- * Again wait for a semaphore to be signalled. This time, the alternate
- * task will trigger an interrupt that signals the semaphore.
- */
+ /*
+ * Again wait for a semaphore to be signalled. This time, the alternate
+ * task will trigger an interrupt that signals the semaphore.
+ */
for (i = 0; semList[i] != ENDLIST; i++) {
sema = task_sem_group_take_wait(semList);
if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
- (int) semList[i], (int) sema);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
+ (int) semList[i], (int) sema);
+ return TC_FAIL;
}
+ }
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -382,7 +382,7 @@ int simpleGroupWaitTest(void)
* RETURNS: TC_PASS on success or TC_FAIL on failure
*/
static int simpleFiberSemTest(void)
- {
+{
int signalCount;
int status;
int i;
@@ -391,36 +391,36 @@ static int simpleFiberSemTest(void)
task_sem_reset(simpleSem);
task_sem_group_reset(semList);
- /* let the fiber signal the semaphore and wait on it */
+ /* let the fiber signal the semaphore and wait on it */
releaseTestFiber();
status = task_sem_take_wait_timeout(simpleSem, OBJ_TIMEOUT);
if (status != RC_OK) {
- TC_ERROR("task_sem_take_wait_timeout() error. Expected %d, got %d\n",
- RC_OK, status);
- return TC_FAIL;
+ TC_ERROR("task_sem_take_wait_timeout() error. Expected %d, got %d\n",
+ RC_OK, status);
+ return TC_FAIL;
}
- /* release the fiber and let it signal the semaphore N_TESTS times */
+ /* release the fiber and let it signal the semaphore N_TESTS times */
releaseTestFiber();
signalCount = task_sem_count_get(simpleSem);
if (signalCount != N_TESTS) {
- TC_ERROR("<signalCount> error. Expected %d, got %d\n",
- N_TESTS, signalCount);
- return TC_FAIL;
+ TC_ERROR("<signalCount> error. Expected %d, got %d\n",
+ N_TESTS, signalCount);
+ return TC_FAIL;
}
- /* wait on the semaphore group while the fiber signals each semaphore in it */
+ /* wait on the semaphore group while the fiber signals each semaphore in it */
for (i = 0; semList[i] != ENDLIST; i++) {
- releaseTestFiber();
+ releaseTestFiber();
sema = task_sem_group_take_wait_timeout(semList, OBJ_TIMEOUT);
if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
- (int) semList[i], (int) sema);
- return TC_FAIL;
- }
+ TC_ERROR("task_sem_group_take_wait() error. Expected %d, not %d\n",
+ (int) semList[i], (int) sema);
+ return TC_FAIL;
}
- return TC_PASS;
}
+ return TC_PASS;
+}
/*******************************************************************************
*
@@ -430,31 +430,31 @@ static int simpleFiberSemTest(void)
*/
int HighPriTask(void)
- {
+{
int status;
- /* Wait until task is activated */
+ /* Wait until task is activated */
status = task_sem_take_wait(hpSem);
if (status != RC_OK) {
TC_ERROR("%s priority task failed to wait on %s: %d\n",
- "High", "HIGH_PRI_SEM", status);
+ "High", "HIGH_PRI_SEM", status);
return TC_FAIL;
- }
+ }
- /* Wait on a semaphore along with other tasks */
+ /* Wait on a semaphore along with other tasks */
status = task_sem_take_wait(manyBlockSem);
if (status != RC_OK) {
TC_ERROR("%s priority task failed to wait on %s: %d\n",
- "High", "MANY_BLOCKED_SEM", status);
+ "High", "MANY_BLOCKED_SEM", status);
return TC_FAIL;
- }
+ }
- /* Inform Regression test HP task is no longer blocked on MANY_BLOCKED_SEM*/
+ /* Inform Regression test HP task is no longer blocked on MANY_BLOCKED_SEM*/
task_sem_give(blockHpSem);
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -464,22 +464,22 @@ int HighPriTask(void)
*/
int LowPriTask(void)
- {
+{
int status;
- /* Wait on a semaphore along with other tasks */
+ /* Wait on a semaphore along with other tasks */
status = task_sem_take_wait(manyBlockSem);
if (status != RC_OK) {
TC_ERROR("%s priority task failed to wait on %s: %d\n",
- "Low", "MANY_BLOCKED_SEM", status);
+ "Low", "MANY_BLOCKED_SEM", status);
return TC_FAIL;
- }
+ }
- /* Inform Regression test LP task is no longer blocked on MANY_BLOCKED_SEM*/
+ /* Inform Regression test LP task is no longer blocked on MANY_BLOCKED_SEM*/
task_sem_give(blockLpSem);
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -491,74 +491,74 @@ int LowPriTask(void)
*/
int AlternateTask(void)
- {
+{
int status;
int i;
- /* Wait until it is time to continue */
+ /* Wait until it is time to continue */
status = task_sem_take_wait(altSem);
if (status != RC_OK) {
TC_ERROR("task_sem_take_wait() error. Expected %d, got %d\n",
- RC_OK, status);
+ RC_OK, status);
return TC_FAIL;
- }
+ }
- /*
- * After signalling the semaphore upon which the main (RegressionTask) task
- * is waiting, control will pass back to the main (RegressionTask) task.
- */
+ /*
+ * After signalling the semaphore upon which the main (RegressionTask) task
+ * is waiting, control will pass back to the main (RegressionTask) task.
+ */
task_sem_give(simpleSem);
- /*
- * Control has returned to the alternate task. Trigger an ISR that will
- * signal the semaphore upon which RegressionTask is waiting.
- */
+ /*
+ * Control has returned to the alternate task. Trigger an ISR that will
+ * signal the semaphore upon which RegressionTask is waiting.
+ */
trigger_isrSemaSignal(simpleSem);
- /* Wait for RegressionTask to wake this task up */
+ /* Wait for RegressionTask to wake this task up */
status = task_sem_take_wait(altSem);
if (status != RC_OK) {
TC_ERROR("task_sem_take_wait() error. Expected %d, got %d",
- RC_OK, status);
+ RC_OK, status);
return TC_FAIL;
- }
+ }
- /* Wait on a semaphore that will have many waiters */
+ /* Wait on a semaphore that will have many waiters */
status = task_sem_take_wait(manyBlockSem);
if (status != RC_OK) {
TC_ERROR("task_sem_take_wait() error. Expected %d, got %d",
- RC_OK, status);
+ RC_OK, status);
return TC_FAIL;
- }
+ }
- /* Inform Regression test MP task is no longer blocked on MANY_BLOCKED_SEM*/
+ /* Inform Regression test MP task is no longer blocked on MANY_BLOCKED_SEM*/
task_sem_give(blockMpSem);
- /* Wait until the alternate task is needed again */
+ /* Wait until the alternate task is needed again */
status = task_sem_take_wait(altSem);
if (status != RC_OK) {
TC_ERROR("task_sem_take_wait() error. Expected %d, got %d",
- RC_OK, status);
+ RC_OK, status);
return TC_FAIL;
- }
+ }
for (i = 0; semList[i] != ENDLIST; i++) {
task_sem_give(semList[i]);
- /* Context switch back to Regression Task */
- }
+ /* Context switch back to Regression Task */
+ }
task_sem_group_give(semList);
- /* Context switch back to Regression Task */
+ /* Context switch back to Regression Task */
for (i = 0; semList[i] != ENDLIST; i++) {
trigger_isrSemaSignal(semList[i]);
- /* Context switch back to Regression Task */
- }
+ /* Context switch back to Regression Task */
+ }
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -570,7 +570,7 @@ int AlternateTask(void)
*/
int RegressionTask(void)
- {
+{
int tcRC;
int value;
ksem_t semBlockList[4];
@@ -580,31 +580,31 @@ int RegressionTask(void)
semBlockList[2] = blockLpSem;
semBlockList[3] = ENDLIST;
- /* Signal a semaphore that has no waiting tasks. */
+ /* Signal a semaphore that has no waiting tasks. */
TC_PRINT("Signal and test a semaphore without blocking\n");
tcRC = simpleSemaTest();
if (tcRC != TC_PASS) {
return TC_FAIL;
- }
+ }
- /* Wait on a semaphore. */
+ /* Wait on a semaphore. */
TC_PRINT("Signal and test a semaphore with blocking\n");
tcRC = simpleSemaWaitTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
- /*
- * Have many tasks wait on a semaphore (MANY_BLOCKED_SEM). They will
- * block in the following order:
- * LowPriorityTask (low priority)
- * HighPriorityTask (high priority)
- * AlternateTask (medium priority)
- *
- * When the semaphore (MANY_BLOCKED_SEM) is signalled, HighPriorityTask
- * will be woken first.
- *
- */
+ /*
+ * Have many tasks wait on a semaphore (MANY_BLOCKED_SEM). They will
+ * block in the following order:
+ * LowPriorityTask (low priority)
+ * HighPriorityTask (high priority)
+ * AlternateTask (medium priority)
+ *
+ * When the semaphore (MANY_BLOCKED_SEM) is signalled, HighPriorityTask
+ * will be woken first.
+ *
+ */
TC_PRINT("Testing many tasks blocked on the same semaphore\n");
@@ -619,18 +619,18 @@ int RegressionTask(void)
value = task_sem_group_take_wait_timeout(semBlockList, OBJ_TIMEOUT);
if (value != blockHpSem) {
TC_ERROR("%s priority task did not get semaphore: 0x%x\n",
- "High", value);
+ "High", value);
return TC_FAIL;
- }
+ }
task_sem_give(manyBlockSem);
task_sleep(OBJ_TIMEOUT); /* Ensure medium priority task can run */
value = task_sem_group_take_wait_timeout(semBlockList, OBJ_TIMEOUT);
if (value != blockMpSem) {
TC_ERROR("%s priority task did not get semaphore: 0x%x\n",
- "Medium", value);
+ "Medium", value);
return TC_FAIL;
- }
+ }
task_sem_give(manyBlockSem);
@@ -639,35 +639,35 @@ int RegressionTask(void)
value = task_sem_group_take_wait_timeout(semBlockList, OBJ_TIMEOUT);
if (value != blockLpSem) {
TC_ERROR("%s priority task did not get semaphore: 0x%x\n",
- "Low", value);
+ "Low", value);
return TC_FAIL;
- }
+ }
value = task_sem_group_take_wait_timeout(semBlockList, OBJ_TIMEOUT);
if (value != ENDLIST) {
TC_ERROR("Group test Expecting ENDLIST, but got 0x%x\n",
- value);
+ value);
return TC_FAIL;
- }
+ }
TC_PRINT("Testing semaphore groups without blocking\n");
tcRC = simpleGroupTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
TC_PRINT("Testing semaphore groups with blocking\n");
tcRC = simpleGroupWaitTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
TC_PRINT("Testing semaphore release by fiber\n");
tcRC = simpleFiberSemTest();
if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
+ return TC_FAIL;
+ }
return TC_PASS;
- }
+}
diff --git a/samples/microkernel/test/test_sema/src/test_fiber.c b/samples/microkernel/test/test_sema/src/test_fiber.c
index be7fd1add..24d44f7da 100644
--- a/samples/microkernel/test/test_sema/src/test_fiber.c
+++ b/samples/microkernel/test/test_sema/src/test_fiber.c
@@ -72,24 +72,24 @@ static CMD_PKT_SET_INSTANCE(cmdPktSet, N_TESTS + 1)
* RETURNS: N/A
*/
static void testFiberEntry(void)
- {
+{
int i;
- /* release semaphore test task is waiting for */
+ /* release semaphore test task is waiting for */
nano_fiber_sem_take_wait(&fiberSem);
fiber_sem_give(simpleSem, &CMD_PKT_SET(cmdPktSet));
- /* release the semaphore for N_TESTS times */
+ /* release the semaphore for N_TESTS times */
nano_fiber_sem_take_wait(&fiberSem);
for (i = 0; i < N_TESTS; i++) {
- fiber_sem_give(simpleSem, &CMD_PKT_SET(cmdPktSet));
+ fiber_sem_give(simpleSem, &CMD_PKT_SET(cmdPktSet));
}
- /* signal each semaphore in the group */
+ /* signal each semaphore in the group */
for (i = 0; semList[i] != ENDLIST; i++) {
- nano_fiber_sem_take_wait(&fiberSem);
- fiber_sem_give(semList[i], &CMD_PKT_SET(cmdPktSet));
- }
+ nano_fiber_sem_take_wait(&fiberSem);
+ fiber_sem_give(semList[i], &CMD_PKT_SET(cmdPktSet));
}
+}
/*******************************************************************************
*
@@ -99,8 +99,8 @@ static void testFiberEntry(void)
*/
void testFiberInit(void)
- {
+{
nano_sem_init(&fiberSem);
task_fiber_start(fiberStack, FIBER_STACK_SIZE, (nano_fiber_entry_t)testFiberEntry,
0, 0, FIBER_PRIORITY, 0);
- }
+}
diff --git a/samples/microkernel/test/test_sprintf/src/test_sprintf.c b/samples/microkernel/test/test_sprintf/src/test_sprintf.c
index 367e3f9a1..02805f303 100644
--- a/samples/microkernel/test/test_sprintf/src/test_sprintf.c
+++ b/samples/microkernel/test/test_sprintf/src/test_sprintf.c
@@ -75,8 +75,8 @@ typedef union {
struct {
uint32_t u1; /* This part contains the exponent */
uint32_t u2; /* This part contains the fraction */
- };
- } raw_double_u;
+ };
+} raw_double_u;
#ifdef CONFIG_FLOAT
/*******************************************************************************
@@ -98,7 +98,7 @@ int sprintfDoubleTest(void)
if (strcmp(buffer, "+INF") != 0) {
TC_ERROR("sprintf(+INF) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
var.u1 = 0x00000000;
var.u2 = 0xfff00000; /* Bit pattern for -INF (double) */
@@ -106,7 +106,7 @@ int sprintfDoubleTest(void)
if (strcmp(buffer, "-INF") != 0) {
TC_ERROR("sprintf(-INF) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
var.u1 = 0x00000000;
var.u2 = 0x7ff80000; /* Bit pattern for NaN (double) */
@@ -114,123 +114,122 @@ int sprintfDoubleTest(void)
if (strcmp(buffer, "NaN") != 0) {
TC_ERROR("sprintf(NaN) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
var.d = 1.0;
sprintf(buffer, "%f", var.d);
if (strcmp(buffer, "1.000000") != 0) {
TC_ERROR("sprintf(1.0) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%+f", var.d);
if (strcmp(buffer, "+1.000000") != 0) {
TC_ERROR("sprintf(+1.0) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%.2f", var.d);
if (strcmp(buffer, "1.00") != 0) {
TC_ERROR("sprintf(1.00) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%.*f", 11, var.d);
if (strcmp(buffer, "1.00000000000") != 0) {
TC_ERROR("sprintf(1.00000000000) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%12f", var.d);
if (strcmp(buffer, " 1.000000") != 0) {
TC_ERROR("sprintf( 1.000000) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%-12f", var.d);
if (strcmp(buffer, "1.000000 ") != 0) {
TC_ERROR("sprintf(1.000000 ) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%012f", var.d);
if (strcmp(buffer, "00001.000000") != 0) {
TC_ERROR("sprintf(00001.000000) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
var.d = -1.0;
sprintf(buffer, "%f", var.d);
if (strcmp(buffer, "-1.000000") != 0) {
TC_ERROR("sprintf(-1.0) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
var.d = 1234.56789;
sprintf(buffer, "%f", var.d);
if (strcmp(buffer, "1234.567890") != 0) {
TC_ERROR("sprintf(-1.0) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
var.d = 1234.0;
sprintf(buffer, "%e", var.d);
if (strcmp(buffer, "1.234000e+003") != 0) {
TC_ERROR("sprintf(1.234000e+003) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%E", var.d);
if (strcmp(buffer, "1.234000E+003") != 0) {
TC_ERROR("sprintf(1.234000E+003) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
var.d = 0.1234;
sprintf(buffer, "%e", var.d);
if (strcmp(buffer, "1.234000e-001") != 0) {
TC_ERROR("sprintf(1.234000e-001) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%E", var.d);
if (strcmp(buffer, "1.234000E-001") != 0) {
TC_ERROR("sprintf(1.234000E-001) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
var.d = 1234000000.0;
sprintf(buffer, "%g", var.d);
if (strcmp(buffer, "1.234e+009") != 0) {
TC_ERROR("sprintf(1.234e+009) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%G", var.d);
if (strcmp(buffer, "1.234E+009") != 0) {
TC_ERROR("sprintf(1.234E+009) - incorrect output '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
- /*
- * VxMicro does not support size modifiers such as L. As such, attempts to
- * print a long double will NOT result in intuitively expected output.
- * Until such time as they are supported (if ever) the output will remain
- * counter-intuitive. If they ever are supported then this test will have
- * to be updated.
- */
+ /*
+ * VxMicro does not support size modifiers such as L. As such, attempts to
+ * print a long double will NOT result in intuitively expected output.
+ * Until such time as they are supported (if ever) the output will remain
+ * counter-intuitive. If they ever are supported then this test will have
+ * to be updated.
+ */
sprintf(buffer, "%Lf", (long double) 1234567.0);
if (strcmp("-0.000000", buffer) != 0) {
- TC_ERROR("sprintf(%%Lf). Expected '-0.000000', got '%s'\n",
- buffer);
+ TC_ERROR("sprintf(%%Lf). Expected '-0.000000', got '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
return status;
}
@@ -271,55 +270,55 @@ int vsnprintfTest(void)
int status = TC_PASS;
char buffer[100];
- /*
- * VxMicro may be handling the string size in a non-standard manner.
- * If a negative value is supplied for the string size, VxMicro converts
- * it to 0x7fffffff--maximum integer size. Since there is insufficient
- * memory to test a string of that length, we just check that the string
- * was fully written so that we can exercise the code path.
- */
+ /*
+ * VxMicro may be handling the string size in a non-standard manner.
+ * If a negative value is supplied for the string size, VxMicro converts
+ * it to 0x7fffffff--maximum integer size. Since there is insufficient
+ * memory to test a string of that length, we just check that the string
+ * was fully written so that we can exercise the code path.
+ */
buffer[0] = '\0';
len = tvsnprintf(buffer, (size_t)(-4), "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("vsnprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
TC_ERROR("vsnprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
+ DEADBEEF_LHEX_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
buffer[0] = '\0';
len = tvsnprintf(buffer, 0, "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("vsnprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, "") != 0) {
TC_ERROR("vsnprintf(%%x). Expected '%s', got '%s'\n",
- "", buffer);
+ "", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = tvsnprintf(buffer, 4, "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("vsnprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, "dea") != 0) {
TC_ERROR("vsnprintf(%%x). Expected '%s', got '%s'\n",
- "dea", buffer);
+ "dea", buffer);
status = TC_FAIL;
- }
+ }
return status;
}
@@ -358,19 +357,19 @@ int vsprintfTest(void)
int status = TC_PASS;
char buffer[100];
- /*******************/
+ /*******************/
len = tvsprintf(buffer, "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("sprintf(%%x). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
TC_ERROR("sprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
+ DEADBEEF_LHEX_STR, buffer);
status = TC_FAIL;
- }
+ }
return status;
}
@@ -392,55 +391,55 @@ int snprintfTest(void)
int status = TC_PASS;
char buffer[100];
- /*
- * VxMicro may be handling the string size in a non-standard manner.
- * If a negative value is supplied for the string size, VxMicro converts
- * it to 0x7fffffff--maximum integer size. Since there is insufficient
- * memory to test a string of that length, we just check that the string
- * was fully written so that we can exercise the code path.
- */
+ /*
+ * VxMicro may be handling the string size in a non-standard manner.
+ * If a negative value is supplied for the string size, VxMicro converts
+ * it to 0x7fffffff--maximum integer size. Since there is insufficient
+ * memory to test a string of that length, we just check that the string
+ * was fully written so that we can exercise the code path.
+ */
buffer[0] = '\0';
len = snprintf(buffer, (size_t)(-4), "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("snprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
TC_ERROR("snprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
+ DEADBEEF_LHEX_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
buffer[0] = '\0';
len = snprintf(buffer, 0, "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("snprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, "") != 0) {
TC_ERROR("snprintf(%%x). Expected '%s', got '%s'\n",
- "", buffer);
+ "", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = snprintf(buffer, 4, "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("snprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, "dea") != 0) {
TC_ERROR("snprintf(%%x). Expected '%s', got '%s'\n",
- "dea", buffer);
+ "dea", buffer);
status = TC_FAIL;
- }
+ }
return status;
}
@@ -458,65 +457,65 @@ int sprintfMiscTest(void)
int count;
char buffer[100];
- /*******************/
+ /*******************/
sprintf(buffer, "%p", (void *) DEADBEEF);
if (strcmp(buffer, DEADBEEF_PTR_STR) != 0) {
TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- DEADBEEF_PTR_STR, buffer);
+ DEADBEEF_PTR_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
sprintf(buffer, "test data %n test data", &count);
if (count != 10) {
TC_ERROR("sprintf(%%n). Expected count to be %d, not %d\n",
- 10, count);
+ 10, count);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, "test data test data") != 0) {
TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- "test data test data", buffer);
+ "test data test data", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
sprintf(buffer, "%*d", 10, 1234);
if (strcmp(buffer, " 1234") != 0) {
TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- " 1234", buffer);
+ " 1234", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
sprintf(buffer, "%*d", -10, 1234);
if (strcmp(buffer, "1234 ") != 0) {
TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- "1234 ", buffer);
+ "1234 ", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
sprintf(buffer, "% d", 1234);
if (strcmp(buffer, " 1234") != 0) {
TC_ERROR("sprintf(%% d). Expected '%s', got '%s'\n",
- " 1234", buffer);
+ " 1234", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
sprintf(buffer, "%hx", 1234);
if (strcmp("4d2", buffer) != 0) {
TC_ERROR("sprintf(%%hx). Expected '4d2', got '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
sprintf(buffer, "%lx", 1234ul);
if (strcmp("4d2", buffer) != 0) {
TC_ERROR("sprintf(%%lx). Expected '4d2', got '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
return status;
}
@@ -534,142 +533,142 @@ int sprintfIntegerTest(void)
int len;
char buffer[100];
- /*******************/
+ /*******************/
- /* Note: VxMicro prints hex numbers in 8 characters */
+ /* Note: VxMicro prints hex numbers in 8 characters */
len = sprintf(buffer, "%x", 0x11);
if (len != 2) {
TC_ERROR("sprintf(%%x). Expected 2 bytes written, not %d\n", len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, "11") != 0) {
TC_ERROR("sprintf(%%x). Expected '%s', got '%s'\n", "11", buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_STR)) {
TC_ERROR("sprintf(%%x). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
+ strlen(DEADBEEF_LHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
TC_ERROR("sprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
+ DEADBEEF_LHEX_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%X", DEADBEEF);
if (len != strlen(DEADBEEF_UHEX_STR)) {
TC_ERROR("sprintf(%%X). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_UHEX_STR), len);
+ strlen(DEADBEEF_UHEX_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_UHEX_STR) != 0) {
TC_ERROR("sprintf(%%X). Expected '%s', got '%s'\n",
- DEADBEEF_UHEX_STR, buffer);
+ DEADBEEF_UHEX_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%u", DEADBEEF);
if (len != strlen(DEADBEEF_UNSIGNED_STR)) {
TC_ERROR("sprintf(%%u). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_UNSIGNED_STR), len);
+ strlen(DEADBEEF_UNSIGNED_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_UNSIGNED_STR) != 0) {
TC_ERROR("sprintf(%%u). Expected '%s', got '%s'\n",
- DEADBEEF_UNSIGNED_STR, buffer);
+ DEADBEEF_UNSIGNED_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%d", (int) DEADBEEF);
if (len != strlen(DEADBEEF_SIGNED_STR)) {
TC_ERROR("sprintf(%%d). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_SIGNED_STR), len);
+ strlen(DEADBEEF_SIGNED_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_SIGNED_STR) != 0) {
TC_ERROR("sprintf(%%d). Expected '%s', got '%s'\n",
- DEADBEEF_SIGNED_STR, buffer);
+ DEADBEEF_SIGNED_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%o", DEADBEEF);
if (len != strlen(DEADBEEF_OCTAL_STR)) {
TC_ERROR("sprintf(%%o). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_OCTAL_STR), len);
+ strlen(DEADBEEF_OCTAL_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_OCTAL_STR) != 0) {
TC_ERROR("sprintf(%%o). Expected '%s', got '%s'\n",
- DEADBEEF_OCTAL_STR, buffer);
+ DEADBEEF_OCTAL_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%#o", DEADBEEF);
if (len != strlen(DEADBEEF_OCTAL_ALT_STR)) {
TC_ERROR("sprintf(%%#o). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_OCTAL_ALT_STR), len);
+ strlen(DEADBEEF_OCTAL_ALT_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_OCTAL_ALT_STR) != 0) {
TC_ERROR("sprintf(%%#o). Expected '%s', got '%s'\n",
- DEADBEEF_OCTAL_ALT_STR, buffer);
+ DEADBEEF_OCTAL_ALT_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%#x", DEADBEEF);
if (len != strlen(DEADBEEF_LHEX_ALT_STR)) {
TC_ERROR("sprintf(%%#x). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_LHEX_ALT_STR), len);
+ strlen(DEADBEEF_LHEX_ALT_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_LHEX_ALT_STR) != 0) {
TC_ERROR("sprintf(%%#x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_ALT_STR, buffer);
+ DEADBEEF_LHEX_ALT_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%#X", DEADBEEF);
if (len != strlen(DEADBEEF_UHEX_ALT_STR)) {
TC_ERROR("sprintf(%%#X). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_UHEX_ALT_STR), len);
+ strlen(DEADBEEF_UHEX_ALT_STR), len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, DEADBEEF_UHEX_ALT_STR) != 0) {
TC_ERROR("sprintf(%%#X). Expected '%s', got '%s'\n",
- DEADBEEF_UHEX_ALT_STR, buffer);
+ DEADBEEF_UHEX_ALT_STR, buffer);
status = TC_FAIL;
- }
+ }
- /*******************/
+ /*******************/
len = sprintf(buffer, "%+d", 1);
if (len != 2) {
TC_ERROR("sprintf(%%+d). Expected %d bytes written, not %d\n",
- 2, len);
+ 2, len);
status = TC_FAIL;
- }
+ }
if (strcmp(buffer, "+1") != 0) {
TC_ERROR("sprintf(%%+d). Expected '+1', got '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
return status;
}
@@ -691,31 +690,31 @@ int sprintfStringTest(void)
if (strcmp(buffer, "%") != 0) {
TC_ERROR("sprintf(%%). Expected '%%', got '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%c", 't');
if (strcmp(buffer, "t") != 0) {
TC_ERROR("sprintf(%%c). Expected 't', got '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
sprintf(buffer, "%s", "short string");
if (strcmp(buffer, "short string") != 0) {
TC_ERROR("sprintf(%%s). Expected 'short string', got '%s'\n", buffer);
status = TC_FAIL;
- }
+ }
len = sprintf(buffer, "%s", REALLY_LONG_STRING);
if (len != PRINTF_MAX_STRING_LENGTH) {
TC_ERROR("Internals changed. Max string length no longer %d\n",
- PRINTF_MAX_STRING_LENGTH);
+ PRINTF_MAX_STRING_LENGTH);
status = TC_FAIL;
- }
+ }
if (strncmp(buffer, REALLY_LONG_STRING, PRINTF_MAX_STRING_LENGTH) != 0) {
TC_ERROR("First %d characters of REALLY_LONG_STRING not printed!\n",
- PRINTF_MAX_STRING_LENGTH);
+ PRINTF_MAX_STRING_LENGTH);
status = TC_FAIL;
- }
+ }
return status;
}
@@ -738,38 +737,38 @@ void RegressionTask(void)
TC_PRINT("Testing sprintf() with integers ....\n");
if (sprintfIntegerTest() != TC_PASS) {
status = TC_FAIL;
- }
+ }
TC_PRINT("Testing snprintf() ....\n");
if (snprintfTest() != TC_PASS) {
status = TC_FAIL;
- }
+ }
TC_PRINT("Testing vsprintf() ....\n");
if (vsprintfTest() != TC_PASS) {
status = TC_FAIL;
- }
+ }
TC_PRINT("Testing vsnprintf() ....\n");
if (vsnprintfTest() != TC_PASS) {
status = TC_FAIL;
- }
+ }
TC_PRINT("Testing sprintf() with strings ....\n");
if (sprintfStringTest() != TC_PASS) {
status = TC_FAIL;
- }
+ }
TC_PRINT("Testing sprintf() with misc options ....\n");
if (sprintfMiscTest() != TC_PASS) {
status = TC_FAIL;
- }
+ }
#ifdef CONFIG_FLOAT
TC_PRINT("Testing sprintf() with doubles ....\n");
if (sprintfDoubleTest() != TC_PASS) {
status = TC_FAIL;
- }
+ }
#endif /* CONFIG_FLOAT */
TC_END_RESULT(status);
diff --git a/samples/microkernel/test/test_stackprot/src/stackprot.c b/samples/microkernel/test/test_stackprot/src/stackprot.c
index 379ba76aa..7dee7568f 100644
--- a/samples/microkernel/test/test_stackprot/src/stackprot.c
+++ b/samples/microkernel/test/test_stackprot/src/stackprot.c
@@ -85,10 +85,10 @@ void check_input(const char *name, const char *input);
void printLoop(const char *name)
{
while (count < 6) {
- /* A short input string to check_input. It will pass. */
+ /* A short input string to check_input. It will pass. */
check_input(name, "Stack ok");
count++;
- }
+ }
}
/*******************************************************************************
@@ -109,7 +109,7 @@ void printLoop(const char *name)
void check_input(const char *name, const char *input)
{
- /* Stack will overflow when input is more than 16 characters */
+ /* Stack will overflow when input is more than 16 characters */
char buf[16];
strcpy(buf, input);
@@ -135,12 +135,11 @@ void fiber1(void)
#endif /* ! CONFIG_MICROKERNEL */
{
TC_PRINT("Starts %s\n", __func__);
- check_input(__func__,
- "Input string is too long and stack overflowed!\n");
- /*
- * Expect this task to terminate due to stack check fail and will not
- * execute pass here.
- */
+ check_input(__func__, "Input string is too long and stack overflowed!\n");
+ /*
+ * Expect this task to terminate due to stack check fail and will not
+ * execute pass here.
+ */
printLoop(__func__);
tcRC = TC_FAIL;
@@ -168,17 +167,17 @@ void main(void)
TC_PRINT("Starts %s\n", __func__);
#ifdef CONFIG_MICROKERNEL
- /* Start task */
+ /* Start task */
task_start(ALTERNATETASK); /* refer to prj.vpf file */
#else
- /* Start fiber */
+ /* Start fiber */
task_fiber_start(&fiberStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiber1, 0, 0, 7, 0);
+ (nano_fiber_entry_t) fiber1, 0, 0, 7, 0);
#endif /* ! CONFIG_MICROKERNEL */
if (tcRC == TC_FAIL) {
goto errorExit;
- }
+ }
printLoop(__func__);
diff --git a/samples/microkernel/test/test_static_idt/src/static_idt.c b/samples/microkernel/test/test_static_idt/src/static_idt.c
index c93591b0d..c5ed03763 100644
--- a/samples/microkernel/test/test_static_idt/src/static_idt.c
+++ b/samples/microkernel/test/test_static_idt/src/static_idt.c
@@ -137,44 +137,44 @@ int nanoIdtStubTest(void)
IDT_ENTRY *pIdtEntry;
uint16_t offset;
- /* Check for the interrupt stub */
+ /* Check for the interrupt stub */
pIdtEntry = (IDT_ENTRY *) (_idt_base_address + (TEST_SOFT_INT << 3));
offset = (uint16_t)((uint32_t)(&nanoIntStub) & 0xFFFF);
if (pIdtEntry->lowOffset != offset) {
- TC_ERROR("Failed to find low offset of nanoIntStub \
- (0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
- return TC_FAIL;
+ TC_ERROR("Failed to find low offset of nanoIntStub "
+ "(0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
+ return TC_FAIL;
}
offset = (uint16_t)((uint32_t)(&nanoIntStub) >> 16);
if (pIdtEntry->hiOffset != offset) {
- TC_ERROR("Failed to find high offset of nanoIntStub \
- (0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
- return TC_FAIL;
+ TC_ERROR("Failed to find high offset of nanoIntStub "
+ "(0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
+ return TC_FAIL;
}
- /* Check for the exception stub */
+ /* Check for the exception stub */
pIdtEntry = (IDT_ENTRY *) (_idt_base_address + (IV_DIVIDE_ERROR << 3));
offset = (uint16_t)((uint32_t)(&exc_divide_error_handlerStub) & 0xFFFF);
if (pIdtEntry->lowOffset != offset) {
- TC_ERROR("Failed to find low offset of exc stub \
- (0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
- return TC_FAIL;
+ TC_ERROR("Failed to find low offset of exc stub "
+ "(0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
+ return TC_FAIL;
}
offset = (uint16_t)((uint32_t)(&exc_divide_error_handlerStub) >> 16);
if (pIdtEntry->hiOffset != offset) {
- TC_ERROR("Failed to find high offset of exc stub \
- (0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
- return TC_FAIL;
+ TC_ERROR("Failed to find high offset of exc stub "
+ "(0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
+ return TC_FAIL;
}
- /*
- * If the other fields are wrong, the system will crash when the exception
- * and software interrupt are triggered so we don't check them.
- */
+ /*
+ * If the other fields are wrong, the system will crash when the exception
+ * and software interrupt are triggered so we don't check them.
+ */
return TC_PASS;
}
@@ -200,7 +200,7 @@ static void idtSpurFiber(int a1, int a2)
_trigger_spurHandler();
- /* Shouldn't get here */
+ /* Shouldn't get here */
spurHandlerAbortedContext = 0;
}
@@ -230,59 +230,59 @@ void main(void)
rv = nanoIdtStubTest();
if (rv != TC_PASS) {
goto doneTests;
- }
+ }
TC_PRINT("Testing to see interrupt handler executes properly\n");
_trigger_isrHandler();
if (intHandlerExecuted == 0) {
- TC_ERROR("Interrupt handler did not execute\n");
- rv = TC_FAIL;
- goto doneTests;
+ TC_ERROR("Interrupt handler did not execute\n");
+ rv = TC_FAIL;
+ goto doneTests;
} else if (intHandlerExecuted != 1) {
- TC_ERROR("Interrupt handler executed more than once! (%d)\n",
- intHandlerExecuted);
- rv = TC_FAIL;
- goto doneTests;
+ TC_ERROR("Interrupt handler executed more than once! (%d)\n",
+ intHandlerExecuted);
+ rv = TC_FAIL;
+ goto doneTests;
}
TC_PRINT("Testing to see exception handler executes properly\n");
- /*
- * Use excHandlerExecuted instead of 0 to prevent the compiler issuing a
- * 'divide by zero' warning.
- */
+ /*
+ * Use excHandlerExecuted instead of 0 to prevent the compiler issuing a
+ * 'divide by zero' warning.
+ */
error = error / excHandlerExecuted;
if (excHandlerExecuted == 0) {
- TC_ERROR("Exception handler did not execute\n");
- rv = TC_FAIL;
- goto doneTests;
+ TC_ERROR("Exception handler did not execute\n");
+ rv = TC_FAIL;
+ goto doneTests;
}
else if (excHandlerExecuted != 1) {
- TC_ERROR("Exception handler executed more than once! (%d)\n",
- excHandlerExecuted);
- rv = TC_FAIL;
- goto doneTests;
+ TC_ERROR("Exception handler executed more than once! (%d)\n",
+ excHandlerExecuted);
+ rv = TC_FAIL;
+ goto doneTests;
}
- /*
- * Start fiber/task to trigger the spurious interrupt handler
- */
+ /*
+ * Start fiber/task to trigger the spurious interrupt handler
+ */
TC_PRINT("Testing to see spurious handler executes properly\n");
#ifdef CONFIG_MICROKERNEL
task_start(tSpurTask);
#else
task_fiber_start(fiberStack, sizeof(fiberStack), idtSpurFiber, 0, 0, 5, 0);
#endif
- /*
- * The fiber/task should not run past where the spurious interrupt is
- * generated. Therefore spurHandlerAbortedContext should remain at 1.
- */
+ /*
+ * The fiber/task should not run past where the spurious interrupt is
+ * generated. Therefore spurHandlerAbortedContext should remain at 1.
+ */
if (spurHandlerAbortedContext == 0) {
- TC_ERROR("Spurious handler did not execute as expected\n");
- rv = TC_FAIL;
- goto doneTests;
+ TC_ERROR("Spurious handler did not execute as expected\n");
+ rv = TC_FAIL;
+ goto doneTests;
}
doneTests:
diff --git a/samples/microkernel/test/test_task/src/task.c b/samples/microkernel/test/test_task/src/task.c
index b8bf2eabd..e79291697 100644
--- a/samples/microkernel/test/test_task/src/task.c
+++ b/samples/microkernel/test/test_task/src/task.c
@@ -65,7 +65,7 @@ This module tests the following task APIs:
typedef struct {
int cmd;
int data;
- } ISR_INFO;
+} ISR_INFO;
/* locals */
@@ -91,14 +91,14 @@ void isr_task_command_handler(void *data)
int value = -1;
switch (pInfo->cmd) {
- case CMD_TASKID:
- value = isr_task_id_get();
- break;
+ case CMD_TASKID:
+ value = isr_task_id_get();
+ break;
- case CMD_PRIORITY:
- value = isr_task_priority_get();
- break;
- }
+ case CMD_PRIORITY:
+ value = isr_task_priority_get();
+ break;
+ }
pInfo->data = value;
}
@@ -116,17 +116,17 @@ int isrAPIsTest(int taskId, int taskPrio)
_trigger_isrTaskCommand();
if (isrInfo.data != taskId) {
TC_ERROR("isr_task_id_get() returned %d, not %d\n",
- isrInfo.data, taskId);
+ isrInfo.data, taskId);
return TC_FAIL;
- }
+ }
isrInfo.cmd = CMD_PRIORITY;
_trigger_isrTaskCommand();
if (isrInfo.data != taskPrio) {
TC_ERROR("isr_task_priority_get() returned %d, not %d\n",
- isrInfo.data, taskPrio);
+ isrInfo.data, taskPrio);
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -145,16 +145,16 @@ int taskMacrosTest(int taskId, int taskPrio)
value = task_id_get();
if (value != taskId) {
TC_ERROR("task_id_get() returned 0x%x, not 0x%x\n",
- value, taskId);
+ value, taskId);
return TC_FAIL;
- }
+ }
value = task_priority_get();
if (value != taskPrio) {
TC_ERROR("task_priority_get() returned %d, not %d\n",
- value, taskPrio);
+ value, taskPrio);
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -211,65 +211,65 @@ int taskSetPrioTest(void)
{
int rv;
- /* Lower the priority of the current task (RegressionTask) */
+ /* Lower the priority of the current task (RegressionTask) */
task_priority_set(RT_TASKID, RT_PRIO + 5);
rv = task_priority_get();
if (rv != RT_PRIO + 5) {
TC_ERROR("Expected priority to be changed to %d, not %d\n",
- RT_PRIO + 5, rv);
+ RT_PRIO + 5, rv);
return TC_FAIL;
- }
+ }
- /* Raise the priority of the current task (RegressionTask) */
+ /* Raise the priority of the current task (RegressionTask) */
task_priority_set(RT_TASKID, RT_PRIO - 5);
rv = task_priority_get();
if (rv != RT_PRIO - 5) {
TC_ERROR("Expected priority to be changed to %d, not %d\n",
- RT_PRIO - 5, rv);
+ RT_PRIO - 5, rv);
return TC_FAIL;
- }
+ }
- /* Restore the priority of the current task (RegressionTask) */
+ /* Restore the priority of the current task (RegressionTask) */
task_priority_set(RT_TASKID, RT_PRIO);
rv = task_priority_get();
if (rv != RT_PRIO) {
TC_ERROR("Expected priority to be changed to %d, not %d\n",
- RT_PRIO, rv);
+ RT_PRIO, rv);
return TC_FAIL;
- }
+ }
- /* Lower the priority of the helper task (HelperTask) */
+ /* Lower the priority of the helper task (HelperTask) */
task_priority_set(HT_TASKID, HT_PRIO + 5);
task_sem_give(HT_SEM);
task_sem_take_wait(RT_SEM);
if (helperData != HT_PRIO + 5) {
TC_ERROR("Expected priority to be changed to %d, not %d\n",
- HT_PRIO + 5, helperData);
+ HT_PRIO + 5, helperData);
return TC_FAIL;
- }
+ }
- /* Raise the priority of the helper task (HelperTask) */
+ /* Raise the priority of the helper task (HelperTask) */
task_priority_set(HT_TASKID, HT_PRIO - 5);
task_sem_give(HT_SEM);
task_sem_take_wait(RT_SEM);
if (helperData != HT_PRIO - 5) {
TC_ERROR("Expected priority to be changed to %d, not %d\n",
- HT_PRIO - 5, helperData);
+ HT_PRIO - 5, helperData);
return TC_FAIL;
- }
+ }
- /* Restore the priority of the helper task (HelperTask) */
+ /* Restore the priority of the helper task (HelperTask) */
task_priority_set(HT_TASKID, HT_PRIO);
task_sem_give(HT_SEM);
task_sem_take_wait(RT_SEM);
if (helperData != HT_PRIO) {
TC_ERROR("Expected priority to be changed to %d, not %d\n",
- HT_PRIO, helperData);
+ HT_PRIO, helperData);
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -289,7 +289,7 @@ void helperTaskSleepTest(void)
firstTick = task_tick_get_32();
while (mainTaskNotReady) {
- }
+ }
helperData = task_tick_get_32() - firstTick;
task_sem_give(RT_SEM);
@@ -308,7 +308,7 @@ int taskSleepTest(void)
tick = task_tick_get_32(); /* Busy wait to align */
while (tick == task_tick_get_32()) { /* to tick boundary */
- }
+ }
task_sem_give(HT_SEM);
@@ -319,9 +319,9 @@ int taskSleepTest(void)
if (helperData != SLEEP_TIME) {
TC_ERROR("task_sleep() slept for %d ticks, not %d\n",
- helperData, SLEEP_TIME);
+ helperData, SLEEP_TIME);
return TC_FAIL;
- }
+ }
return TC_PASS;
}
@@ -341,7 +341,7 @@ void helperTaskYieldTest(void)
for (i = 0; i < 5; i++) {
helperData++;
task_yield();
- }
+ }
task_sem_give(RT_SEM);
}
@@ -360,7 +360,7 @@ int taskYieldTest(void)
helperData = 0;
- /* 1st raise the priority of the helper task */
+ /* 1st raise the priority of the helper task */
task_priority_set(HT_TASKID, RT_PRIO);
task_sem_give(HT_SEM);
@@ -369,16 +369,16 @@ int taskYieldTest(void)
task_yield();
if (helperData == prevHelperData) {
- TC_ERROR("Iter %d. helperData did not change (%d) \n",
- i + 1, helperData);
- return TC_FAIL;
- }
+ TC_ERROR("Iter %d. helperData did not change (%d) \n",
+ i + 1, helperData);
+ return TC_FAIL;
}
+ }
- /* Restore helper task priority */
+ /* Restore helper task priority */
task_priority_set(HT_TASKID, HT_PRIO);
- /* Ensure that the helper task finishes */
+ /* Ensure that the helper task finishes */
task_sem_take_wait(RT_SEM);
return TC_PASS;
@@ -424,7 +424,7 @@ int taskSuspendTest(void)
if (prevHelperData != helperData) {
TC_ERROR("Helper task did not suspend!\n");
return TC_FAIL;
- }
+ }
task_resume(HT_TASKID);
task_sleep(SLEEP_TIME);
@@ -432,7 +432,7 @@ int taskSuspendTest(void)
if (prevHelperData == helperData) {
TC_ERROR("Helper task did not resume!\n");
return TC_FAIL;
- }
+ }
task_sem_give(HT_SEM);
return TC_PASS;
@@ -454,7 +454,7 @@ void HelperTask(void)
if (rv != TC_PASS) {
tcRC = TC_FAIL;
return;
- }
+ }
task_sem_give(RT_SEM);
task_sem_take_wait(HT_SEM);
@@ -462,7 +462,7 @@ void HelperTask(void)
if (rv != TC_PASS) {
tcRC = TC_FAIL;
return;
- }
+ }
task_sem_give(RT_SEM);
helperTaskSetPrioTest();
@@ -496,7 +496,7 @@ void RegressionTask(void)
if (rv != TC_PASS) {
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
task_sem_give(HT_SEM);
task_sem_take_wait(RT_SEM);
@@ -506,7 +506,7 @@ void RegressionTask(void)
if (rv != TC_PASS) {
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
task_sem_give(HT_SEM);
task_sem_take_wait(RT_SEM);
@@ -515,25 +515,25 @@ void RegressionTask(void)
if (taskSetPrioTest() != TC_PASS) {
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
TC_PRINT("Testing task_sleep()\n");
if (taskSleepTest() != TC_PASS) {
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
TC_PRINT("Testing task_yield()\n");
if (taskYieldTest() != TC_PASS) {
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
TC_PRINT("Testing task_suspend() and task_resume()\n");
if (taskSuspendTest() != TC_PASS) {
tcRC = TC_FAIL;
goto errorReturn;
- }
+ }
errorReturn:
TC_END_RESULT(tcRC);
diff --git a/samples/microkernel/test/test_task_irq/src/main.c b/samples/microkernel/test/test_task_irq/src/main.c
index 9325754ed..88a5e5d5c 100644
--- a/samples/microkernel/test/test_task_irq/src/main.c
+++ b/samples/microkernel/test/test_task_irq/src/main.c
@@ -64,10 +64,10 @@ static ksem_t rdySem = SEM_RDY;
*/
void taskAMain(void)
- {
+{
extern int taskA(ksem_t semRdy);
task_sem_give(resultSems[taskA(rdySem)]);
- }
+}
/*******************************************************************************
*
@@ -80,10 +80,10 @@ void taskAMain(void)
*/
void taskBMain(void)
- {
+{
extern int taskB(ksem_t semRdy);
task_sem_give(resultSems[taskB(rdySem)]);
- }
+}
/*******************************************************************************
*
@@ -96,29 +96,30 @@ void taskBMain(void)
* RETURNS: N/A
*/
void registerWait(void)
- {
+{
extern void raiseInt(uint8_t id);
int tasksDone;
int irq_obj;
- /* Wait for the 2 tasks to finish registering their IRQ objects*/
+ /* Wait for the 2 tasks to finish registering their IRQ objects*/
for (tasksDone = 0; tasksDone < NUM_TEST_TASKS - 1; tasksDone++) {
if (task_sem_take_wait_timeout(SEM_RDY, TIMEOUT) != RC_OK) {
- TC_ERROR("Monitor task timed out\n");
- task_sem_give(resultSems[TC_FAIL]);
- return;
- }
+ TC_ERROR("Monitor task timed out\n");
+ task_sem_give(resultSems[TC_FAIL]);
+ return;
}
+ }
TC_PRINT("Generating interrupts for all allocated IRQ objects...\n");
for (irq_obj = 0; irq_obj < NUM_TASK_IRQS; irq_obj++) {
- if (task_irq_object[irq_obj].irq != INVALID_VECTOR)
- raiseInt((uint8_t)task_irq_object[irq_obj].vector);
+ if (task_irq_object[irq_obj].irq != INVALID_VECTOR) {
+ raiseInt((uint8_t)task_irq_object[irq_obj].vector);
}
+ }
task_sem_give(resultSems[TC_PASS]);
- }
+}
/*******************************************************************************
*
@@ -131,7 +132,7 @@ void registerWait(void)
*/
void MonitorTaskEntry(void)
- {
+{
extern struct task_irq_info task_irq_object[NUM_TASK_IRQS];
ksem_t result;
int tasksDone;
@@ -139,24 +140,24 @@ void MonitorTaskEntry(void)
PRINT_DATA("Starting task level interrupt handling tests\n");
PRINT_LINE;
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
+ /*
+ * the various test tasks start executing automatically;
+ * wait for all tasks to complete or a failure to occur,
+ * then issue the appropriate test case summary message
+ */
for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
result = task_sem_group_take_wait_timeout(resultSems, TIMEOUT);
if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
- }
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
+ if (result != resultSems[TC_FAIL]) {
+ TC_ERROR("Monitor task timed out\n");
+ }
+ TC_END_RESULT(TC_FAIL);
+ TC_END_REPORT(TC_FAIL);
+ return;
}
+ }
TC_END_RESULT(TC_PASS);
TC_END_REPORT(TC_PASS);
- }
+}
diff --git a/samples/microkernel/test/test_task_irq/src/raise_int.c b/samples/microkernel/test/test_task_irq/src/raise_int.c
index eab832631..89afb9c3f 100644
--- a/samples/microkernel/test/test_task_irq/src/raise_int.c
+++ b/samples/microkernel/test/test_task_irq/src/raise_int.c
@@ -43,1350 +43,1350 @@
#if defined(VXMICRO_ARCH_x86)
static void genInt0(void)
- {
+{
__asm__ volatile("int $0");
- }
+}
static void genInt1(void)
- {
+{
__asm__ volatile("int $1");
- }
+}
static void genInt2(void)
- {
+{
__asm__ volatile("int $2");
- }
+}
static void genInt3(void)
- {
+{
__asm__ volatile("int $3");
- }
+}
static void genInt4(void)
- {
+{
__asm__ volatile("int $4");
- }
+}
static void genInt5(void)
- {
+{
__asm__ volatile("int $5");
- }
+}
static void genInt6(void)
- {
+{
__asm__ volatile("int $6");
- }
+}
static void genInt7(void)
- {
+{
__asm__ volatile("int $7");
- }
+}
static void genInt8(void)
- {
+{
__asm__ volatile("int $8");
- }
+}
static void genInt9(void)
- {
+{
__asm__ volatile("int $9");
- }
+}
static void genInt10(void)
- {
+{
__asm__ volatile("int $10");
- }
+}
static void genInt11(void)
- {
+{
__asm__ volatile("int $11");
- }
+}
static void genInt12(void)
- {
+{
__asm__ volatile("int $12");
- }
+}
static void genInt13(void)
- {
+{
__asm__ volatile("int $13");
- }
+}
static void genInt14(void)
- {
+{
__asm__ volatile("int $14");
- }
+}
static void genInt15(void)
- {
+{
__asm__ volatile("int $15");
- }
+}
static void genInt16(void)
- {
+{
__asm__ volatile("int $16");
- }
+}
static void genInt17(void)
- {
+{
__asm__ volatile("int $17");
- }
+}
static void genInt18(void)
- {
+{
__asm__ volatile("int $18");
- }
+}
static void genInt19(void)
- {
+{
__asm__ volatile("int $19");
- }
+}
static void genInt20(void)
- {
+{
__asm__ volatile("int $20");
- }
+}
static void genInt21(void)
- {
+{
__asm__ volatile("int $21");
- }
+}
static void genInt22(void)
- {
+{
__asm__ volatile("int $22");
- }
+}
static void genInt23(void)
- {
+{
__asm__ volatile("int $23");
- }
+}
static void genInt24(void)
- {
+{
__asm__ volatile("int $24");
- }
+}
static void genInt25(void)
- {
+{
__asm__ volatile("int $25");
- }
+}
static void genInt26(void)
- {
+{
__asm__ volatile("int $26");
- }
+}
static void genInt27(void)
- {
+{
__asm__ volatile("int $27");
- }
+}
static void genInt28(void)
- {
+{
__asm__ volatile("int $28");
- }
+}
static void genInt29(void)
- {
+{
__asm__ volatile("int $29");
- }
+}
static void genInt30(void)
- {
+{
__asm__ volatile("int $30");
- }
+}
static void genInt31(void)
- {
+{
__asm__ volatile("int $31");
- }
+}
static void genInt32(void)
- {
+{
__asm__ volatile("int $32");
- }
+}
static void genInt33(void)
- {
+{
__asm__ volatile("int $33");
- }
+}
static void genInt34(void)
- {
+{
__asm__ volatile("int $34");
- }
+}
static void genInt35(void)
- {
+{
__asm__ volatile("int $35");
- }
+}
static void genInt36(void)
- {
+{
__asm__ volatile("int $36");
- }
+}
static void genInt37(void)
- {
+{
__asm__ volatile("int $37");
- }
+}
static void genInt38(void)
- {
+{
__asm__ volatile("int $38");
- }
+}
static void genInt39(void)
- {
+{
__asm__ volatile("int $39");
- }
+}
static void genInt40(void)
- {
+{
__asm__ volatile("int $40");
- }
+}
static void genInt41(void)
- {
+{
__asm__ volatile("int $41");
- }
+}
static void genInt42(void)
- {
+{
__asm__ volatile("int $42");
- }
+}
static void genInt43(void)
- {
+{
__asm__ volatile("int $43");
- }
+}
static void genInt44(void)
- {
+{
__asm__ volatile("int $44");
- }
+}
static void genInt45(void)
- {
+{
__asm__ volatile("int $45");
- }
+}
static void genInt46(void)
- {
+{
__asm__ volatile("int $46");
- }
+}
static void genInt47(void)
- {
+{
__asm__ volatile("int $47");
- }
+}
static void genInt48(void)
- {
+{
__asm__ volatile("int $48");
- }
+}
static void genInt49(void)
- {
+{
__asm__ volatile("int $49");
- }
+}
static void genInt50(void)
- {
+{
__asm__ volatile("int $50");
- }
+}
static void genInt51(void)
- {
+{
__asm__ volatile("int $51");
- }
+}
static void genInt52(void)
- {
+{
__asm__ volatile("int $52");
- }
+}
static void genInt53(void)
- {
+{
__asm__ volatile("int $53");
- }
+}
static void genInt54(void)
- {
+{
__asm__ volatile("int $54");
- }
+}
static void genInt55(void)
- {
+{
__asm__ volatile("int $55");
- }
+}
static void genInt56(void)
- {
+{
__asm__ volatile("int $56");
- }
+}
static void genInt57(void)
- {
+{
__asm__ volatile("int $57");
- }
+}
static void genInt58(void)
- {
+{
__asm__ volatile("int $58");
- }
+}
static void genInt59(void)
- {
+{
__asm__ volatile("int $59");
- }
+}
static void genInt60(void)
- {
+{
__asm__ volatile("int $60");
- }
+}
static void genInt61(void)
- {
+{
__asm__ volatile("int $61");
- }
+}
static void genInt62(void)
- {
+{
__asm__ volatile("int $62");
- }
+}
static void genInt63(void)
- {
+{
__asm__ volatile("int $63");
- }
+}
static void genInt64(void)
- {
+{
__asm__ volatile("int $64");
- }
+}
static void genInt65(void)
- {
+{
__asm__ volatile("int $65");
- }
+}
static void genInt66(void)
- {
+{
__asm__ volatile("int $66");
- }
+}
static void genInt67(void)
- {
+{
__asm__ volatile("int $67");
- }
+}
static void genInt68(void)
- {
+{
__asm__ volatile("int $68");
- }
+}
static void genInt69(void)
- {
+{
__asm__ volatile("int $69");
- }
+}
static void genInt70(void)
- {
+{
__asm__ volatile("int $70");
- }
+}
static void genInt71(void)
- {
+{
__asm__ volatile("int $71");
- }
+}
static void genInt72(void)
- {
+{
__asm__ volatile("int $72");
- }
+}
static void genInt73(void)
- {
+{
__asm__ volatile("int $73");
- }
+}
static void genInt74(void)
- {
+{
__asm__ volatile("int $74");
- }
+}
static void genInt75(void)
- {
+{
__asm__ volatile("int $75");
- }
+}
static void genInt76(void)
- {
+{
__asm__ volatile("int $76");
- }
+}
static void genInt77(void)
- {
+{
__asm__ volatile("int $77");
- }
+}
static void genInt78(void)
- {
+{
__asm__ volatile("int $78");
- }
+}
static void genInt79(void)
- {
+{
__asm__ volatile("int $79");
- }
+}
static void genInt80(void)
- {
+{
__asm__ volatile("int $80");
- }
+}
static void genInt81(void)
- {
+{
__asm__ volatile("int $81");
- }
+}
static void genInt82(void)
- {
+{
__asm__ volatile("int $82");
- }
+}
static void genInt83(void)
- {
+{
__asm__ volatile("int $83");
- }
+}
static void genInt84(void)
- {
+{
__asm__ volatile("int $84");
- }
+}
static void genInt85(void)
- {
+{
__asm__ volatile("int $85");
- }
+}
static void genInt86(void)
- {
+{
__asm__ volatile("int $86");
- }
+}
static void genInt87(void)
- {
+{
__asm__ volatile("int $87");
- }
+}
static void genInt88(void)
- {
+{
__asm__ volatile("int $88");
- }
+}
static void genInt89(void)
- {
+{
__asm__ volatile("int $89");
- }
+}
static void genInt90(void)
- {
+{
__asm__ volatile("int $90");
- }
+}
static void genInt91(void)
- {
+{
__asm__ volatile("int $91");
- }
+}
static void genInt92(void)
- {
+{
__asm__ volatile("int $92");
- }
+}
static void genInt93(void)
- {
+{
__asm__ volatile("int $93");
- }
+}
static void genInt94(void)
- {
+{
__asm__ volatile("int $94");
- }
+}
static void genInt95(void)
- {
+{
__asm__ volatile("int $95");
- }
+}
static void genInt96(void)
- {
+{
__asm__ volatile("int $96");
- }
+}
static void genInt97(void)
- {
+{
__asm__ volatile("int $97");
- }
+}
static void genInt98(void)
- {
+{
__asm__ volatile("int $98");
- }
+}
static void genInt99(void)
- {
+{
__asm__ volatile("int $99");
- }
+}
static void genInt100(void)
- {
+{
__asm__ volatile("int $100");
- }
+}
static void genInt101(void)
- {
+{
__asm__ volatile("int $101");
- }
+}
static void genInt102(void)
- {
+{
__asm__ volatile("int $102");
- }
+}
static void genInt103(void)
- {
+{
__asm__ volatile("int $103");
- }
+}
static void genInt104(void)
- {
+{
__asm__ volatile("int $104");
- }
+}
static void genInt105(void)
- {
+{
__asm__ volatile("int $105");
- }
+}
static void genInt106(void)
- {
+{
__asm__ volatile("int $106");
- }
+}
static void genInt107(void)
- {
+{
__asm__ volatile("int $107");
- }
+}
static void genInt108(void)
- {
+{
__asm__ volatile("int $108");
- }
+}
static void genInt109(void)
- {
+{
__asm__ volatile("int $109");
- }
+}
static void genInt110(void)
- {
+{
__asm__ volatile("int $110");
- }
+}
static void genInt111(void)
- {
+{
__asm__ volatile("int $111");
- }
+}
static void genInt112(void)
- {
+{
__asm__ volatile("int $112");
- }
+}
static void genInt113(void)
- {
+{
__asm__ volatile("int $113");
- }
+}
static void genInt114(void)
- {
+{
__asm__ volatile("int $114");
- }
+}
static void genInt115(void)
- {
+{
__asm__ volatile("int $115");
- }
+}
static void genInt116(void)
- {
+{
__asm__ volatile("int $116");
- }
+}
static void genInt117(void)
- {
+{
__asm__ volatile("int $117");
- }
+}
static void genInt118(void)
- {
+{
__asm__ volatile("int $118");
- }
+}
static void genInt119(void)
- {
+{
__asm__ volatile("int $119");
- }
+}
static void genInt120(void)
- {
+{
__asm__ volatile("int $120");
- }
+}
static void genInt121(void)
- {
+{
__asm__ volatile("int $121");
- }
+}
static void genInt122(void)
- {
+{
__asm__ volatile("int $122");
- }
+}
static void genInt123(void)
- {
+{
__asm__ volatile("int $123");
- }
+}
static void genInt124(void)
- {
+{
__asm__ volatile("int $124");
- }
+}
static void genInt125(void)
- {
+{
__asm__ volatile("int $125");
- }
+}
static void genInt126(void)
- {
+{
__asm__ volatile("int $126");
- }
+}
static void genInt127(void)
- {
+{
__asm__ volatile("int $127");
- }
+}
static void genInt128(void)
- {
+{
__asm__ volatile("int $128");
- }
+}
static void genInt129(void)
- {
+{
__asm__ volatile("int $129");
- }
+}
static void genInt130(void)
- {
+{
__asm__ volatile("int $130");
- }
+}
static void genInt131(void)
- {
+{
__asm__ volatile("int $131");
- }
+}
static void genInt132(void)
- {
+{
__asm__ volatile("int $132");
- }
+}
static void genInt133(void)
- {
+{
__asm__ volatile("int $133");
- }
+}
static void genInt134(void)
- {
+{
__asm__ volatile("int $134");
- }
+}
static void genInt135(void)
- {
+{
__asm__ volatile("int $135");
- }
+}
static void genInt136(void)
- {
+{
__asm__ volatile("int $136");
- }
+}
static void genInt137(void)
- {
+{
__asm__ volatile("int $137");
- }
+}
static void genInt138(void)
- {
+{
__asm__ volatile("int $138");
- }
+}
static void genInt139(void)
- {
+{
__asm__ volatile("int $139");
- }
+}
static void genInt140(void)
- {
+{
__asm__ volatile("int $140");
- }
+}
static void genInt141(void)
- {
+{
__asm__ volatile("int $141");
- }
+}
static void genInt142(void)
- {
+{
__asm__ volatile("int $142");
- }
+}
static void genInt143(void)
- {
+{
__asm__ volatile("int $143");
- }
+}
static void genInt144(void)
- {
+{
__asm__ volatile("int $144");
- }
+}
static void genInt145(void)
- {
+{
__asm__ volatile("int $145");
- }
+}
static void genInt146(void)
- {
+{
__asm__ volatile("int $146");
- }
+}
static void genInt147(void)
- {
+{
__asm__ volatile("int $147");
- }
+}
static void genInt148(void)
- {
+{
__asm__ volatile("int $148");
- }
+}
static void genInt149(void)
- {
+{
__asm__ volatile("int $149");
- }
+}
static void genInt150(void)
- {
+{
__asm__ volatile("int $150");
- }
+}
static void genInt151(void)
- {
+{
__asm__ volatile("int $151");
- }
+}
static void genInt152(void)
- {
+{
__asm__ volatile("int $152");
- }
+}
static void genInt153(void)
- {
+{
__asm__ volatile("int $153");
- }
+}
static void genInt154(void)
- {
+{
__asm__ volatile("int $154");
- }
+}
static void genInt155(void)
- {
+{
__asm__ volatile("int $155");
- }
+}
static void genInt156(void)
- {
+{
__asm__ volatile("int $156");
- }
+}
static void genInt157(void)
- {
+{
__asm__ volatile("int $157");
- }
+}
static void genInt158(void)
- {
+{
__asm__ volatile("int $158");
- }
+}
static void genInt159(void)
- {
+{
__asm__ volatile("int $159");
- }
+}
static void genInt160(void)
- {
+{
__asm__ volatile("int $160");
- }
+}
static void genInt161(void)
- {
+{
__asm__ volatile("int $161");
- }
+}
static void genInt162(void)
- {
+{
__asm__ volatile("int $162");
- }
+}
static void genInt163(void)
- {
+{
__asm__ volatile("int $163");
- }
+}
static void genInt164(void)
- {
+{
__asm__ volatile("int $164");
- }
+}
static void genInt165(void)
- {
+{
__asm__ volatile("int $165");
- }
+}
static void genInt166(void)
- {
+{
__asm__ volatile("int $166");
- }
+}
static void genInt167(void)
- {
+{
__asm__ volatile("int $167");
- }
+}
static void genInt168(void)
- {
+{
__asm__ volatile("int $168");
- }
+}
static void genInt169(void)
- {
+{
__asm__ volatile("int $169");
- }
+}
static void genInt170(void)
- {
+{
__asm__ volatile("int $170");
- }
+}
static void genInt171(void)
- {
+{
__asm__ volatile("int $171");
- }
+}
static void genInt172(void)
- {
+{
__asm__ volatile("int $172");
- }
+}
static void genInt173(void)
- {
+{
__asm__ volatile("int $173");
- }
+}
static void genInt174(void)
- {
+{
__asm__ volatile("int $174");
- }
+}
static void genInt175(void)
- {
+{
__asm__ volatile("int $175");
- }
+}
static void genInt176(void)
- {
+{
__asm__ volatile("int $176");
- }
+}
static void genInt177(void)
- {
+{
__asm__ volatile("int $177");
- }
+}
static void genInt178(void)
- {
+{
__asm__ volatile("int $178");
- }
+}
static void genInt179(void)
- {
+{
__asm__ volatile("int $179");
- }
+}
static void genInt180(void)
- {
+{
__asm__ volatile("int $180");
- }
+}
static void genInt181(void)
- {
+{
__asm__ volatile("int $181");
- }
+}
static void genInt182(void)
- {
+{
__asm__ volatile("int $182");
- }
+}
static void genInt183(void)
- {
+{
__asm__ volatile("int $183");
- }
+}
static void genInt184(void)
- {
+{
__asm__ volatile("int $184");
- }
+}
static void genInt185(void)
- {
+{
__asm__ volatile("int $185");
- }
+}
static void genInt186(void)
- {
+{
__asm__ volatile("int $186");
- }
+}
static void genInt187(void)
- {
+{
__asm__ volatile("int $187");
- }
+}
static void genInt188(void)
- {
+{
__asm__ volatile("int $188");
- }
+}
static void genInt189(void)
- {
+{
__asm__ volatile("int $189");
- }
+}
static void genInt190(void)
- {
+{
__asm__ volatile("int $190");
- }
+}
static void genInt191(void)
- {
+{
__asm__ volatile("int $191");
- }
+}
static void genInt192(void)
- {
+{
__asm__ volatile("int $192");
- }
+}
static void genInt193(void)
- {
+{
__asm__ volatile("int $193");
- }
+}
static void genInt194(void)
- {
+{
__asm__ volatile("int $194");
- }
+}
static void genInt195(void)
- {
+{
__asm__ volatile("int $195");
- }
+}
static void genInt196(void)
- {
+{
__asm__ volatile("int $196");
- }
+}
static void genInt197(void)
- {
+{
__asm__ volatile("int $197");
- }
+}
static void genInt198(void)
- {
+{
__asm__ volatile("int $198");
- }
+}
static void genInt199(void)
- {
+{
__asm__ volatile("int $199");
- }
+}
static void genInt200(void)
- {
+{
__asm__ volatile("int $200");
- }
+}
static void genInt201(void)
- {
+{
__asm__ volatile("int $201");
- }
+}
static void genInt202(void)
- {
+{
__asm__ volatile("int $202");
- }
+}
static void genInt203(void)
- {
+{
__asm__ volatile("int $203");
- }
+}
static void genInt204(void)
- {
+{
__asm__ volatile("int $204");
- }
+}
static void genInt205(void)
- {
+{
__asm__ volatile("int $205");
- }
+}
static void genInt206(void)
- {
+{
__asm__ volatile("int $206");
- }
+}
static void genInt207(void)
- {
+{
__asm__ volatile("int $207");
- }
+}
static void genInt208(void)
- {
+{
__asm__ volatile("int $208");
- }
+}
static void genInt209(void)
- {
+{
__asm__ volatile("int $209");
- }
+}
static void genInt210(void)
- {
+{
__asm__ volatile("int $210");
- }
+}
static void genInt211(void)
- {
+{
__asm__ volatile("int $211");
- }
+}
static void genInt212(void)
- {
+{
__asm__ volatile("int $212");
- }
+}
static void genInt213(void)
- {
+{
__asm__ volatile("int $213");
- }
+}
static void genInt214(void)
- {
+{
__asm__ volatile("int $214");
- }
+}
static void genInt215(void)
- {
+{
__asm__ volatile("int $215");
- }
+}
static void genInt216(void)
- {
+{
__asm__ volatile("int $216");
- }
+}
static void genInt217(void)
- {
+{
__asm__ volatile("int $217");
- }
+}
static void genInt218(void)
- {
+{
__asm__ volatile("int $218");
- }
+}
static void genInt219(void)
- {
+{
__asm__ volatile("int $219");
- }
+}
static void genInt220(void)
- {
+{
__asm__ volatile("int $220");
- }
+}
static void genInt221(void)
- {
+{
__asm__ volatile("int $221");
- }
+}
static void genInt222(void)
- {
+{
__asm__ volatile("int $222");
- }
+}
static void genInt223(void)
- {
+{
__asm__ volatile("int $223");
- }
+}
static void genInt224(void)
- {
+{
__asm__ volatile("int $224");
- }
+}
static void genInt225(void)
- {
+{
__asm__ volatile("int $225");
- }
+}
static void genInt226(void)
- {
+{
__asm__ volatile("int $226");
- }
+}
static void genInt227(void)
- {
+{
__asm__ volatile("int $227");
- }
+}
static void genInt228(void)
- {
+{
__asm__ volatile("int $228");
- }
+}
static void genInt229(void)
- {
+{
__asm__ volatile("int $229");
- }
+}
static void genInt230(void)
- {
+{
__asm__ volatile("int $230");
- }
+}
static void genInt231(void)
- {
+{
__asm__ volatile("int $231");
- }
+}
static void genInt232(void)
- {
+{
__asm__ volatile("int $232");
- }
+}
static void genInt233(void)
- {
+{
__asm__ volatile("int $233");
- }
+}
static void genInt234(void)
- {
+{
__asm__ volatile("int $234");
- }
+}
static void genInt235(void)
- {
+{
__asm__ volatile("int $235");
- }
+}
static void genInt236(void)
- {
+{
__asm__ volatile("int $236");
- }
+}
static void genInt237(void)
- {
+{
__asm__ volatile("int $237");
- }
+}
static void genInt238(void)
- {
+{
__asm__ volatile("int $238");
- }
+}
static void genInt239(void)
- {
+{
__asm__ volatile("int $239");
- }
+}
static void genInt240(void)
- {
+{
__asm__ volatile("int $240");
- }
+}
static void genInt241(void)
- {
+{
__asm__ volatile("int $241");
- }
+}
static void genInt242(void)
- {
+{
__asm__ volatile("int $242");
- }
+}
static void genInt243(void)
- {
+{
__asm__ volatile("int $243");
- }
+}
static void genInt244(void)
- {
+{
__asm__ volatile("int $244");
- }
+}
static void genInt245(void)
- {
+{
__asm__ volatile("int $245");
- }
+}
static void genInt246(void)
- {
+{
__asm__ volatile("int $246");
- }
+}
static void genInt247(void)
- {
+{
__asm__ volatile("int $247");
- }
+}
static void genInt248(void)
- {
+{
__asm__ volatile("int $248");
- }
+}
static void genInt249(void)
- {
+{
__asm__ volatile("int $249");
- }
+}
static void genInt250(void)
- {
+{
__asm__ volatile("int $250");
- }
+}
static void genInt251(void)
- {
+{
__asm__ volatile("int $251");
- }
+}
static void genInt252(void)
- {
+{
__asm__ volatile("int $252");
- }
+}
static void genInt253(void)
- {
+{
__asm__ volatile("int $253");
- }
+}
static void genInt254(void)
- {
+{
__asm__ volatile("int $254");
- }
+}
static void genInt255(void)
- {
+{
__asm__ volatile("int $255");
- }
+}
static void (*intFPtr[256])(void) = {
- genInt0, genInt1, genInt2,genInt3,
- genInt4, genInt5, genInt6,genInt7,
- genInt8, genInt9, genInt10,genInt11,
- genInt12, genInt13, genInt14,genInt15,
- genInt16, genInt17, genInt18,genInt19,
- genInt20, genInt21, genInt22,genInt23,
- genInt24, genInt25, genInt26,genInt27,
- genInt28, genInt29, genInt30,genInt31,
- genInt32, genInt33, genInt34,genInt35,
- genInt36, genInt37, genInt38,genInt39,
- genInt40, genInt41, genInt42,genInt43,
- genInt44, genInt45, genInt46,genInt47,
- genInt48, genInt49, genInt50,genInt51,
- genInt52, genInt53, genInt54,genInt55,
- genInt56, genInt57, genInt58,genInt59,
- genInt60, genInt61, genInt62,genInt63,
- genInt64, genInt65, genInt66,genInt67,
- genInt68, genInt69, genInt70,genInt71,
- genInt72, genInt73, genInt74,genInt75,
- genInt76, genInt77, genInt78,genInt79,
- genInt80, genInt81, genInt82,genInt83,
- genInt84, genInt85, genInt86,genInt87,
- genInt88, genInt89, genInt90,genInt91,
- genInt92, genInt93, genInt94,genInt95,
- genInt96, genInt97, genInt98,genInt99,
- genInt100, genInt101, genInt102,genInt103,
- genInt104, genInt105, genInt106,genInt107,
- genInt108, genInt109, genInt110,genInt111,
- genInt112, genInt113, genInt114,genInt115,
- genInt116, genInt117, genInt118,genInt119,
- genInt120, genInt121, genInt122,genInt123,
- genInt124, genInt125, genInt126,genInt127,
- genInt128, genInt129, genInt130,genInt131,
- genInt132, genInt133, genInt134,genInt135,
- genInt136, genInt137, genInt138,genInt139,
- genInt140, genInt141, genInt142,genInt143,
- genInt144, genInt145, genInt146,genInt147,
- genInt148, genInt149, genInt150,genInt151,
- genInt152, genInt153, genInt154,genInt155,
- genInt156, genInt157, genInt158,genInt159,
- genInt160, genInt161, genInt162,genInt163,
- genInt164, genInt165, genInt166,genInt167,
- genInt168, genInt169, genInt170,genInt171,
- genInt172, genInt173, genInt174,genInt175,
- genInt176, genInt177, genInt178,genInt179,
- genInt180, genInt181, genInt182,genInt183,
- genInt184, genInt185, genInt186,genInt187,
- genInt188, genInt189, genInt190,genInt191,
- genInt192, genInt193, genInt194,genInt195,
- genInt196, genInt197, genInt198,genInt199,
- genInt200, genInt201, genInt202,genInt203,
- genInt204, genInt205, genInt206,genInt207,
- genInt208, genInt209, genInt210,genInt211,
- genInt212, genInt213, genInt214,genInt215,
- genInt216, genInt217, genInt218,genInt219,
- genInt220, genInt221, genInt222,genInt223,
- genInt224, genInt225, genInt226,genInt227,
- genInt228, genInt229, genInt230,genInt231,
- genInt232, genInt233, genInt234,genInt235,
- genInt236, genInt237, genInt238,genInt239,
- genInt240, genInt241, genInt242,genInt243,
- genInt244, genInt245, genInt246,genInt247,
- genInt248, genInt249, genInt250,genInt251,
- genInt252, genInt253, genInt254,genInt255};
+ genInt0, genInt1, genInt2,genInt3,
+ genInt4, genInt5, genInt6,genInt7,
+ genInt8, genInt9, genInt10,genInt11,
+ genInt12, genInt13, genInt14,genInt15,
+ genInt16, genInt17, genInt18,genInt19,
+ genInt20, genInt21, genInt22,genInt23,
+ genInt24, genInt25, genInt26,genInt27,
+ genInt28, genInt29, genInt30,genInt31,
+ genInt32, genInt33, genInt34,genInt35,
+ genInt36, genInt37, genInt38,genInt39,
+ genInt40, genInt41, genInt42,genInt43,
+ genInt44, genInt45, genInt46,genInt47,
+ genInt48, genInt49, genInt50,genInt51,
+ genInt52, genInt53, genInt54,genInt55,
+ genInt56, genInt57, genInt58,genInt59,
+ genInt60, genInt61, genInt62,genInt63,
+ genInt64, genInt65, genInt66,genInt67,
+ genInt68, genInt69, genInt70,genInt71,
+ genInt72, genInt73, genInt74,genInt75,
+ genInt76, genInt77, genInt78,genInt79,
+ genInt80, genInt81, genInt82,genInt83,
+ genInt84, genInt85, genInt86,genInt87,
+ genInt88, genInt89, genInt90,genInt91,
+ genInt92, genInt93, genInt94,genInt95,
+ genInt96, genInt97, genInt98,genInt99,
+ genInt100, genInt101, genInt102,genInt103,
+ genInt104, genInt105, genInt106,genInt107,
+ genInt108, genInt109, genInt110,genInt111,
+ genInt112, genInt113, genInt114,genInt115,
+ genInt116, genInt117, genInt118,genInt119,
+ genInt120, genInt121, genInt122,genInt123,
+ genInt124, genInt125, genInt126,genInt127,
+ genInt128, genInt129, genInt130,genInt131,
+ genInt132, genInt133, genInt134,genInt135,
+ genInt136, genInt137, genInt138,genInt139,
+ genInt140, genInt141, genInt142,genInt143,
+ genInt144, genInt145, genInt146,genInt147,
+ genInt148, genInt149, genInt150,genInt151,
+ genInt152, genInt153, genInt154,genInt155,
+ genInt156, genInt157, genInt158,genInt159,
+ genInt160, genInt161, genInt162,genInt163,
+ genInt164, genInt165, genInt166,genInt167,
+ genInt168, genInt169, genInt170,genInt171,
+ genInt172, genInt173, genInt174,genInt175,
+ genInt176, genInt177, genInt178,genInt179,
+ genInt180, genInt181, genInt182,genInt183,
+ genInt184, genInt185, genInt186,genInt187,
+ genInt188, genInt189, genInt190,genInt191,
+ genInt192, genInt193, genInt194,genInt195,
+ genInt196, genInt197, genInt198,genInt199,
+ genInt200, genInt201, genInt202,genInt203,
+ genInt204, genInt205, genInt206,genInt207,
+ genInt208, genInt209, genInt210,genInt211,
+ genInt212, genInt213, genInt214,genInt215,
+ genInt216, genInt217, genInt218,genInt219,
+ genInt220, genInt221, genInt222,genInt223,
+ genInt224, genInt225, genInt226,genInt227,
+ genInt228, genInt229, genInt230,genInt231,
+ genInt232, genInt233, genInt234,genInt235,
+ genInt236, genInt237, genInt238,genInt239,
+ genInt240, genInt241, genInt242,genInt243,
+ genInt244, genInt245, genInt246,genInt247,
+ genInt248, genInt249, genInt250,genInt251,
+ genInt252, genInt253, genInt254,genInt255};
/*******************************************************************************
*
@@ -1400,9 +1400,9 @@ static void (*intFPtr[256])(void) = {
* \NOMANUAL
*/
void raiseInt(uint8_t id)
- {
+{
(*intFPtr[id])();
- }
+}
#endif /* Intel */
#if defined(CONFIG_CPU_CORTEXM3)
@@ -1419,7 +1419,7 @@ void raiseInt(uint8_t id)
*/
void raiseInt(uint8_t id)
- {
+{
_NvicSwInterruptTrigger((unsigned int)id);
- }
+}
#endif
diff --git a/samples/microkernel/test/test_task_irq/src/test_device.c b/samples/microkernel/test/test_task_irq/src/test_device.c
index 88fae4042..c6a562312 100644
--- a/samples/microkernel/test/test_task_irq/src/test_device.c
+++ b/samples/microkernel/test/test_task_irq/src/test_device.c
@@ -77,63 +77,63 @@ exercises the task_irq_free() API.
*/
int taskA(ksem_t semRdy)
- {
+{
if (task_irq_alloc(DEV1_ID, DEV1_IRQ, 1) == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
+ TC_ERROR("Not able to allocate IRQ object\n");
+ return TC_FAIL;
+ }
TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV1_ID, DEV1_IRQ);
if (task_irq_alloc(DEV2_ID, DEV2_IRQ, 2) == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
+ TC_ERROR("Not able to allocate IRQ object\n");
+ return TC_FAIL;
+ }
TC_PRINT("IRQ object %d using IRQ%d allocated\n\n", DEV2_ID, DEV2_IRQ);
- /* Send semaphore to let loader know IRQ objects have been allocated */
+ /* Send semaphore to let loader know IRQ objects have been allocated */
task_sem_give(semRdy);
if (task_irq_test_wait(DEV1_ID) != RC_OK) {
- TC_ERROR("Not able to test IRQ object event\n");
- return TC_FAIL;
- }
+ TC_ERROR("Not able to test IRQ object event\n");
+ return TC_FAIL;
+ }
TC_PRINT("Received event for IRQ object %d\n", DEV1_ID);
task_irq_ack(DEV1_ID);
if (task_irq_test_wait(DEV2_ID) != RC_OK) {
- TC_ERROR("Not able to test IRQ object event\n");
- return TC_FAIL;
- }
+ TC_ERROR("Not able to test IRQ object event\n");
+ return TC_FAIL;
+ }
TC_PRINT("Received event for IRQ object %d\n", DEV2_ID);
task_irq_ack(DEV2_ID);
- /* Wait for other task to receive its events */
+ /* Wait for other task to receive its events */
(void)task_sem_take_wait(semRdy);
TC_PRINT("\nAttempt to allocate an IRQ object that\n");
TC_PRINT("is already allocated by another task...\n");
if (task_irq_alloc(DEV4_ID, DEV4_IRQ, 1) != INVALID_VECTOR) {
- TC_ERROR("Error: Was able to allocate\n\n");
+ TC_ERROR("Error: Was able to allocate\n\n");
return TC_FAIL;
- }
+ }
TC_PRINT("Re-allocation of IRQ object %d prevented\n", DEV4_ID);
TC_PRINT("\nAttempt to allocate an IRQ that\n"
"is already allocated by another task...\n");
if (task_irq_alloc(DEV5_ID, DEV4_IRQ, 1) != INVALID_VECTOR) {
- TC_ERROR("Error: Was able to allocate\n\n");
+ TC_ERROR("Error: Was able to allocate\n\n");
return TC_FAIL;
- }
+ }
TC_PRINT("Re-allocation of IRQ%d prevented\n\n", DEV4_IRQ);
- /* Signal other task that we are done processing */
+ /* Signal other task that we are done processing */
task_sem_give(semRdy);
return TC_PASS;
- }
+}
/*******************************************************************************
*
@@ -147,46 +147,46 @@ int taskA(ksem_t semRdy)
*/
int taskB(ksem_t semRdy)
- {
+{
if (task_irq_alloc(DEV3_ID, DEV3_IRQ, 1) == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
+ TC_ERROR("Not able to allocate IRQ object\n");
+ return TC_FAIL;
+ }
TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV3_ID, DEV3_IRQ);
if (task_irq_alloc(DEV4_ID, DEV4_IRQ, 1) == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
+ TC_ERROR("Not able to allocate IRQ object\n");
+ return TC_FAIL;
+ }
TC_PRINT("IRQ object %d using IRQ%d allocated\n\n", DEV4_ID, DEV4_IRQ);
- /* Send semaphore to let loader/main know objects have been allocated */
+ /* Send semaphore to let loader/main know objects have been allocated */
task_sem_give(semRdy);
if (task_irq_test_wait(DEV3_ID) != RC_OK) {
TC_ERROR("Not able to test IRQ object event\n");
return TC_FAIL;
- }
+ }
TC_PRINT("Received event for IRQ object %d\n", DEV3_ID);
task_irq_ack(DEV3_ID);
if (task_irq_test_wait(DEV4_ID) != RC_OK) {
- TC_ERROR("Not able to test IRQ object event\n");
- return TC_FAIL;
- }
+ TC_ERROR("Not able to test IRQ object event\n");
+ return TC_FAIL;
+ }
TC_PRINT("Received event for IRQ object %d\n", DEV4_ID);
task_irq_ack(DEV4_ID);
- /* Signal other task that we are done receiving events */
+ /* Signal other task that we are done receiving events */
task_sem_give(semRdy);
- /*
- * Wait for other task to finish processing. The signal just previously
- * sent will not be seen here as the other task is a higher priority and
- * will thus consume the signal first.
- */
+ /*
+ * Wait for other task to finish processing. The signal just previously
+ * sent will not be seen here as the other task is a higher priority and
+ * will thus consume the signal first.
+ */
(void)task_sem_take_wait(semRdy);
@@ -195,4 +195,4 @@ int taskB(ksem_t semRdy)
TC_PRINT("IRQ object %d freed\n", DEV3_ID);
return TC_PASS;
- }
+}
diff --git a/samples/microkernel/test/test_tickless/src/test_tickless.c b/samples/microkernel/test/test_tickless/src/test_tickless.c
index bf83c31cc..69a2460ef 100644
--- a/samples/microkernel/test/test_tickless/src/test_tickless.c
+++ b/samples/microkernel/test/test_tickless/src/test_tickless.c
@@ -88,7 +88,7 @@ extern void _TimestampClose(void);
#endif
void ticklessTestTask(void)
- {
+{
int32_t start_ticks;
int32_t end_ticks;
int32_t diff_ticks;
@@ -111,25 +111,25 @@ void ticklessTestTask(void)
printk("Calibrating TSC...\n");
#ifdef CONFIG_TICKLESS_IDLE
oldThreshold = _sys_idle_threshold_ticks;
- /* make sure we do not enter tickless idle mode */
+ /* make sure we do not enter tickless idle mode */
_sys_idle_threshold_ticks = 0x7FFFFFFF;
#endif
- /* initialize the timer, if necessary */
+ /* initialize the timer, if necessary */
_TIMESTAMP_OPEN();
for (i = 0; i < CAL_REPS; i++) {
- /*
- * Do a single tick sleep to get us as close to a tick boundary
- * as we can.
- */
- task_sleep(1);
- start_ticks = task_tick_get_32();
- start_tsc = _TIMESTAMP_READ();
- task_sleep(SLEEP_TICKS);
- end_tsc = _TIMESTAMP_READ();
- end_ticks = task_tick_get_32();
- cal_tsc += end_tsc - start_tsc;
+ /*
+ * Do a single tick sleep to get us as close to a tick boundary
+ * as we can.
+ */
+ task_sleep(1);
+ start_ticks = task_tick_get_32();
+ start_tsc = _TIMESTAMP_READ();
+ task_sleep(SLEEP_TICKS);
+ end_tsc = _TIMESTAMP_READ();
+ end_ticks = task_tick_get_32();
+ cal_tsc += end_tsc - start_tsc;
}
cal_tsc /= CAL_REPS;
@@ -149,17 +149,17 @@ void ticklessTestTask(void)
printk("Going idle for %d ticks...\n", SLEEP_TICKS);
for (i = 0; i < CAL_REPS; i++) {
- /*
- * Do a single tick sleep to get us as close to a tick boundary
- * as we can.
- */
- task_sleep(1);
- start_ticks = task_tick_get_32();
- start_tsc = _TIMESTAMP_READ();
- task_sleep(SLEEP_TICKS);
- end_tsc = _TIMESTAMP_READ();
- end_ticks = task_tick_get_32();
- diff_tsc += end_tsc - start_tsc;
+ /*
+ * Do a single tick sleep to get us as close to a tick boundary
+ * as we can.
+ */
+ task_sleep(1);
+ start_ticks = task_tick_get_32();
+ start_tsc = _TIMESTAMP_READ();
+ task_sleep(SLEEP_TICKS);
+ end_tsc = _TIMESTAMP_READ();
+ end_ticks = task_tick_get_32();
+ diff_tsc += end_tsc - start_tsc;
}
diff_tsc /= CAL_REPS;
@@ -180,25 +180,27 @@ void ticklessTestTask(void)
printk("Cal time stamp: 0x%x\n", cal_tsc);
#endif
- /* Calculate percentage difference between calibrated TSC diff and measured result */
- if (diff_tsc > cal_tsc)
- diff_per = (100 * (diff_tsc - cal_tsc)) / cal_tsc;
- else
- diff_per = (100 * (cal_tsc - diff_tsc)) / cal_tsc;
+ /* Calculate percentage difference between calibrated TSC diff and measured result */
+ if (diff_tsc > cal_tsc) {
+ diff_per = (100 * (diff_tsc - cal_tsc)) / cal_tsc;
+ }
+ else {
+ diff_per = (100 * (cal_tsc - diff_tsc)) / cal_tsc;
+ }
printk("variance in time stamp diff: %d percent\n", (int32_t)diff_per);
if (diff_ticks != SLEEP_TICKS) {
- printk("* TEST FAILED. TICK COUNT INCORRECT *\n");
- TC_END_REPORT(TC_FAIL);
+ printk("* TEST FAILED. TICK COUNT INCORRECT *\n");
+ TC_END_REPORT(TC_FAIL);
}
else {
- TC_END_REPORT(TC_PASS);
- }
+ TC_END_REPORT(TC_PASS);
+ }
- /* release the timer, if necessary */
+ /* release the timer, if necessary */
_TIMESTAMP_CLOSE();
while(1);
- }
+}
diff --git a/samples/microkernel/test/test_tickless/src/timestamps.c b/samples/microkernel/test/test_tickless/src/timestamps.c
index 6dd1ddb4d..f8d62a42b 100644
--- a/samples/microkernel/test/test_tickless/src/timestamps.c
+++ b/samples/microkernel/test/test_tickless/src/timestamps.c
@@ -82,14 +82,14 @@ BSP-specific timestamp support for the tickless idle test.
*/
void _TimestampOpen(void)
- {
- /* QEMU does not currently support the 32-bit timer modes of the GPTM */
+{
+ /* QEMU does not currently support the 32-bit timer modes of the GPTM */
printk("WARNING! Timestamp is not supported for this target!\n");
- /* enable timer access */
+ /* enable timer access */
_CLKGATECTRL |= _CLKGATECTRL_TIMESTAMP_EN;
- /* minimum 3 clk delay is required before timer register access */
+ /* minimum 3 clk delay is required before timer register access */
task_sleep(3);
_TIMESTAMP_CTRL = 0x0; /* disable/reset timer */
@@ -100,7 +100,7 @@ void _TimestampOpen(void)
_TIMESTAMP_ICLEAR = 0x70F; /* clear all interrupt status */
_TIMESTAMP_CTRL = 0x1; /* enable timer */
- }
+}
/*******************************************************************************
*
@@ -114,30 +114,30 @@ void _TimestampOpen(void)
*/
uint32_t _TimestampRead(void)
- {
+{
static uint32_t lastTimerVal = 0;
static uint32_t cnt = 0;
uint32_t timerVal = _TIMESTAMP_VAL;
- /* handle rollover for every other read (end of sleep) */
+ /* handle rollover for every other read (end of sleep) */
if ((cnt % 2) && (timerVal > lastTimerVal)) {
- lastTimerVal = timerVal;
+ lastTimerVal = timerVal;
- /* convert to extended up-counter value */
- timerVal = _TIMESTAMP_EXT + (_TIMESTAMP_MAX - timerVal);
+ /* convert to extended up-counter value */
+ timerVal = _TIMESTAMP_EXT + (_TIMESTAMP_MAX - timerVal);
}
else {
- lastTimerVal = timerVal;
+ lastTimerVal = timerVal;
- /* convert to up-counter value */
- timerVal = _TIMESTAMP_MAX - timerVal;
+ /* convert to up-counter value */
+ timerVal = _TIMESTAMP_MAX - timerVal;
}
cnt++;
return timerVal;
- }
+}
/*******************************************************************************
*
@@ -151,15 +151,15 @@ uint32_t _TimestampRead(void)
*/
void _TimestampClose(void)
- {
+{
- /* disable/reset timer */
+ /* disable/reset timer */
_TIMESTAMP_CTRL = 0x0;
_TIMESTAMP_CFG = 0x0;
- /* disable timer access */
+ /* disable timer access */
_CLKGATECTRL &= ~_CLKGATECTRL_TIMESTAMP_EN;
- }
+}
#elif defined(CONFIG_BSP_FSL_FRDM_K64F)
/* Freescale FRDM-K64F target - use RTC (prescale value) */
@@ -198,11 +198,11 @@ void _TimestampClose(void)
*/
void _TimestampOpen(void)
- {
- /* enable timer access */
+{
+ /* enable timer access */
_CLKGATECTRL |= _CLKGATECTRL_TIMESTAMP_EN;
- /* set 32 KHz RTC clk */
+ /* set 32 KHz RTC clk */
_SYSOPTCTRL2 |= _SYSOPTCTRL2_32KHZRTCCLK;
_TIMESTAMP_STATUS = 0x0; /* disable counter */
@@ -215,13 +215,13 @@ void _TimestampOpen(void)
_TIMESTAMP_WACCESS = 0xFF; /* allow register write access */
_TIMESTAMP_IMASK = 0x0; /* mask all timer interrupts */
- /* minimum 0.3 sec delay required for oscillator stabilization */
+ /* minimum 0.3 sec delay required for oscillator stabilization */
task_sleep(300000/sys_clock_us_per_tick);
_TIMESTAMP_VAL = 0x0; /* clear invalid time flag in status register */
_TIMESTAMP_STATUS = 0x10; /* enable counter */
- }
+}
/*******************************************************************************
*
@@ -235,30 +235,30 @@ void _TimestampOpen(void)
*/
uint32_t _TimestampRead(void)
- {
+{
static uint32_t lastPrescale = 0;
static uint32_t cnt = 0;
uint32_t prescale1 = _TIMESTAMP_PRESCALE;
uint32_t prescale2 = _TIMESTAMP_PRESCALE;
- /* ensure a valid reading */
+ /* ensure a valid reading */
while (prescale1 != prescale2) {
prescale1 = _TIMESTAMP_PRESCALE;
prescale2 = _TIMESTAMP_PRESCALE;
- }
+ }
- /* handle prescale rollover @ 0x8000 for every other read (end of sleep) */
+ /* handle prescale rollover @ 0x8000 for every other read (end of sleep) */
if ((cnt % 2) && (prescale1 < lastPrescale)) {
prescale1 += 0x8000;
- }
+ }
lastPrescale = prescale2;
cnt++;
return prescale1;
- }
+}
/*******************************************************************************
*
@@ -272,10 +272,10 @@ uint32_t _TimestampRead(void)
*/
void _TimestampClose(void)
- {
+{
_TIMESTAMP_STATUS = 0x0; /* disable counter */
_TIMESTAMP_CTRL = 0x0; /* disable oscillator */
- }
+}
#else
#error "Unknown BSP"
diff --git a/samples/microkernel/test/test_timer/src/timer.c b/samples/microkernel/test/test_timer/src/timer.c
index a50525d63..826cbd759 100644
--- a/samples/microkernel/test/test_timer/src/timer.c
+++ b/samples/microkernel/test/test_timer/src/timer.c
@@ -128,7 +128,7 @@ int testLowTimerPeriodicity(void)
}
(void) task_tick_delta_32(&refTime);
- /* Use task_timer_restart() to change the periodicity */
+ /* Use task_timer_restart() to change the periodicity */
task_timer_restart(pTimer[0], 0, 60);
for (i = 0; i < 6; i++) {
status = task_sem_take_wait_timeout(TIMER_SEM, 100);
diff --git a/samples/microkernel/test/test_xip/src/test_xip.c b/samples/microkernel/test/test_xip/src/test_xip.c
index ae98e71ea..f90dd380d 100644
--- a/samples/microkernel/test/test_xip/src/test_xip.c
+++ b/samples/microkernel/test/test_xip/src/test_xip.c
@@ -66,27 +66,27 @@ void main(void)
void RegressionTaskEntry(void)
#endif
- {
+{
int tcRC = TC_PASS;
int i;
PRINT_DATA("Starting XIP tests\n");
PRINT_LINE;
- /* Test globals are correct */
+ /* Test globals are correct */
TC_PRINT("Test globals\n");
- /* Array should be filled with monotomically incrementing values */
+ /* Array should be filled with monotomically incrementing values */
for (i = 0; i < XIP_TEST_ARRAY_SZ; i++) {
- if (xip_array[i] != (i+1)) {
- TC_PRINT("xip_array[%d] != %d\n", i, i+1);
- tcRC = TC_FAIL;
- goto exitRtn;
- }
+ if (xip_array[i] != (i+1)) {
+ TC_PRINT("xip_array[%d] != %d\n", i, i+1);
+ tcRC = TC_FAIL;
+ goto exitRtn;
+ }
}
exitRtn:
TC_END_RESULT(tcRC);
TC_END_REPORT(tcRC);
- }
+}