diff --git a/kernel/common/string_s.c b/kernel/common/string_s.c index 9fe0c5e3935..4b536edd914 100644 --- a/kernel/common/string_s.c +++ b/kernel/common/string_s.c @@ -54,15 +54,16 @@ required by Security Development Lifecycle * if either or are NULL, or if the destination buffer * is too small. * +* \param dest destination buffer +* \param nDestElem number of elements in destination buffer +* \param src source buffer +* \param nElem number of elements to copy +* * RETURNS: 0 on success, otherwise invokes _NanoFatalErrorHandler() */ -errno_t __k_memcpy_s( - void *dest, /* destination buffer */ - size_t nDestElem, /* # of elements in destination buffer */ - const void *src, /* source buffer */ - size_t nElem /* # of elements to copy */ - ) +errno_t __k_memcpy_s(void *dest, size_t nDestElem, const void *src, + size_t nElem) { if ((dest == NULL) || (src == NULL) || (nDestElem < nElem)) { _NanoFatalErrorHandler(_NANO_ERR_INVALID_STRING_OP, @@ -86,12 +87,13 @@ errno_t __k_memcpy_s( * enabled, returns the number of elements in the string to a maximum * value of . Note that if is NULL, it returns 0. * +* \param str string about which to find length +* \param maxElem maximum number of elements in the string +* * RETURNS: number of elements in the null-terminated character string */ -size_t __strlen_s(const char *str, /* string about which to find length */ - size_t maxElem /* maximum # of elements in the string */ - ) +size_t __strlen_s(const char *str, size_t maxElem) { size_t len = 0; /* the calculated string length */ @@ -117,16 +119,15 @@ size_t __strlen_s(const char *str, /* string about which to find length */ * if either or are NULL, or if the buffer for destination string * is too small. * +* \param dest destination string buffer +* \param nDestElem number of elements in destination buffer +* \param src source string buffer +* * RETURNS: 0 on success, otherwise invokes _NanoFatalErrorHandler() */ -errno_t __strcpy_s - ( - char * dest, /* destination string buffer */ - size_t nDestElem, /* # of elements in destination buffer */ - const char * src /* source string buffer */ - ) - { +errno_t __strcpy_s(char *dest, size_t nDestElem, const char *src) +{ int i = 0; /* loop counter */ if (dest != NULL) { @@ -152,4 +153,4 @@ errno_t __strcpy_s */ return 1; - } +} diff --git a/samples/microkernel/apps/hello_world/src/hello.c b/samples/microkernel/apps/hello_world/src/hello.c index 11f23820856..ef0ade03946 100644 --- a/samples/microkernel/apps/hello_world/src/hello.c +++ b/samples/microkernel/apps/hello_world/src/hello.c @@ -53,12 +53,14 @@ #define SLEEPTIME 500 #define SLEEPTICKS (SLEEPTIME * sys_clock_ticks_per_sec / 1000) -void helloLoop - ( - const char * taskname, /* task identification string */ - ksem_t mySem, /* task's own semaphore */ - ksem_t otherSem /* other task's semaphore */ - ) +/* +* +* \param taskname task identification string +* \param mySem task's own semaphore +* \param otherSem other task's semaphore +* +*/ +void helloLoop(const char *taskname, ksem_t mySem, ksem_t otherSem) { while (1) { @@ -73,7 +75,7 @@ void helloLoop } } -void taskA (void) +void taskA(void) { /* taskA gives its own semaphore, allowing it to say hello right away */ task_sem_give (TASKASEM); @@ -82,7 +84,7 @@ void taskA (void) helloLoop (__FUNCTION__, TASKASEM, TASKBSEM); } -void taskB (void) +void taskB(void) { /* invoke routine that allows task to ping-pong hello messages with taskA */ helloLoop (__FUNCTION__, TASKBSEM, TASKASEM); @@ -111,7 +113,7 @@ char fiberStack[STACKSIZE]; struct nano_sem nanoSemTask; struct nano_sem nanoSemFiber; -void fiberEntry (void) +void fiberEntry(void) { struct nano_timer timer; uint32_t data[2] = {0, 0}; @@ -134,7 +136,7 @@ void fiberEntry (void) } } -void main (void) +void main(void) { struct nano_timer timer; uint32_t data[2] = {0, 0}; diff --git a/samples/microkernel/test/test_critical/src/critical.c b/samples/microkernel/test/test_critical/src/critical.c index 49affee3db0..547ed29a308 100644 --- a/samples/microkernel/test/test_critical/src/critical.c +++ b/samples/microkernel/test/test_critical/src/critical.c @@ -60,28 +60,27 @@ static uint32_t altTaskIterations = 0; * RETURNS: 0 */ -int criticalRtn (void) - { +int criticalRtn(void) +{ volatile uint32_t x; x = criticalVar; criticalVar = x + 1; return 0; - } +} /******************************************************************************* * * criticalLoop - common code for invoking task_offload_to_fiber() * +* \param count number of critical section calls made thus far +* * RETURNS: number of critical section calls made by task */ -uint32_t criticalLoop - ( - uint32_t count /* number of critical section calls made thus far */ - ) - { +uint32_t criticalLoop(uint32_t count) +{ int32_t ticks; ticks = task_node_tick_get_32 (); @@ -92,7 +91,7 @@ uint32_t criticalLoop } return count; - } +} /******************************************************************************* * @@ -103,8 +102,8 @@ uint32_t criticalLoop * RETURNS: N/A */ -void AlternateTask (void) - { +void AlternateTask(void) +{ task_sem_take_wait (ALT_SEM); /* Wait to be activated */ altTaskIterations = criticalLoop (altTaskIterations); @@ -116,7 +115,7 @@ void AlternateTask (void) altTaskIterations = criticalLoop (altTaskIterations); task_sem_give (REGRESS_SEM); - } +} /******************************************************************************* * @@ -129,8 +128,8 @@ void AlternateTask (void) * RETURNS: N/A */ -void RegressionTask (void) - { +void RegressionTask(void) +{ uint32_t nCalls = 0; int status; @@ -187,4 +186,4 @@ void RegressionTask (void) errorReturn: TC_END_RESULT (TC_FAIL); TC_END_REPORT (TC_FAIL); - } +} diff --git a/samples/microkernel/test/test_events/src/events.c b/samples/microkernel/test/test_events/src/events.c index cd657693fa5..f38bdc31408 100644 --- a/samples/microkernel/test/test_events/src/events.c +++ b/samples/microkernel/test/test_events/src/events.c @@ -76,10 +76,7 @@ extern struct nano_sem fiberSem; /* semaphore that allows test control the fiber * RETURNS: N/A */ -void isr_event_signal_handler - ( - void *data - ) +void isr_event_signal_handler(void *data) { ISR_INFO *pInfo = (ISR_INFO *) data; @@ -370,13 +367,12 @@ int fiberEventSignalTest(void) * * eventHandler - handler to run on EVENT_ID event * +* \param event signalled event +* * RETURNS: */ -int eventHandler - ( - int event /* signalled event */ - ) +int eventHandler(int event) { ARG_UNUSED(event); @@ -389,13 +385,12 @@ int eventHandler * * altEventHandler - handler to run on ALT_EVENT event * +* \param event signalled event +* * RETURNS: 1 */ -int altEventHandler - ( - int event /* signalled event */ - ) +int altEventHandler(int event) { ARG_UNUSED(event); diff --git a/samples/microkernel/test/test_fifo/src/fifo.c b/samples/microkernel/test/test_fifo/src/fifo.c index bd7143c04c5..c3599455788 100644 --- a/samples/microkernel/test/test_fifo/src/fifo.c +++ b/samples/microkernel/test/test_fifo/src/fifo.c @@ -107,14 +107,13 @@ void printMyData(void) * This routine verifies current value against expected value * and returns TRUE if they are the same. * +* \param expectRetValue expect value +* \param currentRetValue current value +* * RETURNS: TRUE, FALSE */ -BOOL verifyRetValue - ( - int expectRetValue, /* expect value */ - int currentRetValue /* current value */ - ) +BOOL verifyRetValue(int expectRetValue, int currentRetValue) { return (expectRetValue == currentRetValue); } /* verifyRetValue */ @@ -141,19 +140,15 @@ void initMicroObjects(void) * This routine fills the FIFO queue with myData array. This assumes the * queue is empty before we put in elements. * +* \param queue FIFO queue +* \param numElements Number of elements used to inserted into the queue +* * RETURNS: TC_PASS, TC_FAIL * * Also updates tcRC when result is TC_FAIL. */ -int fillFIFO - ( - kfifo_t queue, /* FIFO queue */ - int numElements /* - * number of elements used to inserted - * into the queue - */ - ) +int fillFIFO(kfifo_t queue, int numElements) { int result = TC_PASS; /* TC_PASS or TC_FAIL for this function */ int retValue; /* return value from task_fifo_xxx APIs */ @@ -289,14 +284,13 @@ exitTest4: * that they are in the right order. Expect the dequeue order as: myData[0], * myData[1]. * +* \param loopCnt number of elements passed to the for loop +* * RETURNS: TC_PASS, TC_FAIL * * Also updates tcRC when result is TC_FAIL. */ -int verifyQueueData - ( - int loopCnt /* Number of elements passed to the for loop */ - ) +int verifyQueueData(int loopCnt) { int result = TC_PASS; /* TC_PASS or TC_FAIL for this function */ int retValue; /* task_fifo_xxx interface return value */ diff --git a/samples/microkernel/test/test_map/src/map.c b/samples/microkernel/test/test_map/src/map.c index 7b27c9185b1..18ebb89af24 100644 --- a/samples/microkernel/test/test_map/src/map.c +++ b/samples/microkernel/test/test_map/src/map.c @@ -74,14 +74,13 @@ int testMapFreeAllBlocks(void **P); * This routine verifies current value against expected value * and returns TRUE if they are the same. * +* \param expectRetValue expect value +* \param currentRetValue current value +* * RETURNS: TRUE, FALSE */ -BOOL verifyRetValue - ( - int expectRetValue, /* expect value */ - int currentRetValue /* current value */ - ) +BOOL verifyRetValue(int expectRetValue, int currentRetValue) { return (expectRetValue == currentRetValue); @@ -160,13 +159,12 @@ exitTest1: * * task_mem_map_alloc(), task_mem_map_used_get() * +* \param p pointer to pointer of allocated blocks +* * RETURNS: TC_PASS, TC_FAIL */ -int testMapGetAllBlocks - ( - void **p /* pointer to pointer of allocated blocks */ - ) +int testMapGetAllBlocks(void **p) { int retValue; /* task_mem_map_xxx interface return value */ void *errPtr; /* Pointer to block */ @@ -233,13 +231,12 @@ int testMapGetAllBlocks * * task_mem_map_free(), task_mem_map_used_get() * +* \param p pointer to pointer of allocated blocks +* * RETURNS: TC_PASS, TC_FAIL */ -int testMapFreeAllBlocks - ( - void **p /* pointer to pointer of allocated blocks */ - ) +int testMapFreeAllBlocks(void **p) { int retValue; /* task_mem_map_xxx interface return value */ @@ -289,12 +286,11 @@ int testMapFreeAllBlocks * * This routine prints out the pointers. * +* \param pointer pointer to pointer of allocated blocks +* * RETURNS: N/A */ -void printPointers - ( - void **pointer /* pointer to pointer of allocated blocks */ - ) +void printPointers(void **pointer) { TC_PRINT("%s: ", __func__); for (int i = 0; i < NUMBLOCKS; i++) { diff --git a/samples/microkernel/test/test_pipe/src/pipe.c b/samples/microkernel/test/test_pipe/src/pipe.c index 2818354bfe0..a8cc611bce2 100644 --- a/samples/microkernel/test/test_pipe/src/pipe.c +++ b/samples/microkernel/test/test_pipe/src/pipe.c @@ -185,29 +185,28 @@ extern kpipe_t pipeId; * RETURNS: N/A */ -void microObjectsInit (void) - { +void microObjectsInit(void) +{ int i; /* loop counter */ for (i = 0; i < sizeof (rxBuffer); i++) { txBuffer[i] = (char) i; } - } +} /******************************************************************************* * * receiveBufferCheck - check the contents of the receive buffer * +* \param buffer pointer to buffer to check +* \param size number of bytes to check +* * RETURNS: on success, index of wrong character on failure */ -int receiveBufferCheck - ( - char * buffer, /* pointer to buffer to check */ - int size /* number of bytes to check */ - ) - { +int receiveBufferCheck(char *buffer, int size) +{ int j; /* loop counter */ for (j = 0; j < size; j++) @@ -219,23 +218,23 @@ int receiveBufferCheck } return size; - } +} /******************************************************************************* * * pipePutHelperWork - helper routine to pipePutTest() * +* \param singleItems testcase list (one item in the pipe) +* \param nSingles number of items in testcase +* \param manyItems testcase list (many items in the pipe) +* \param nMany number of items in testcase +* * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutHelperWork - ( - SIZE_EXPECT * singleItems, /* testcase list (one item in the pipe) */ - int nSingles, /* # of items in testcase */ - SIZE_EXPECT * manyItems, /* testcase list (many items in the pipe) */ - int nMany /* # of items in testcase */ - ) - { +int pipePutHelperWork(SIZE_EXPECT *singleItems, int nSingles, + SIZE_EXPECT *manyItems, int nMany) +{ int i; /* loop counter */ int j; /* loop counter */ int rv; /* value returned from task_pipe_get() */ @@ -329,7 +328,7 @@ int pipePutHelperWork task_sem_give (regSem); /* Wake the RegressionTask */ return TC_PASS; - } +} /******************************************************************************* * @@ -338,8 +337,8 @@ int pipePutHelperWork * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutHelper (void) - { +int pipePutHelper(void) +{ int rv; /* return value from pipePutHelperWork() */ rv = pipePutHelperWork (all_N, NELEMENTS(all_N), @@ -367,7 +366,7 @@ int pipePutHelper (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -375,17 +374,17 @@ int pipePutHelper (void) * * This routine tests the task_pipe_put() API. * +* \param singleItems testcase list (one item in the pipe) +* \param nSingles number of items in testcase +* \param manyItems testcase list (many items in the pipe) +* \param nMany number of items in testcase +* * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutTestWork - ( - SIZE_EXPECT * singleItems, /* testcase list (one item in the pipe) */ - int nSingles, /* # of items in testcase */ - SIZE_EXPECT * manyItems, /* testcase list (many items in the pipe) */ - int nMany /* # of items in testcase */ - ) - { +int pipePutTestWork(SIZE_EXPECT *singleItems, int nSingles, + SIZE_EXPECT *manyItems, int nMany) +{ int rv; /* return code from task_pipe_put() */ int i; /* loop counter */ int bytesWritten; /* # of bytes sent to pipe */ @@ -464,7 +463,7 @@ int pipePutTestWork } return TC_PASS; - } +} /******************************************************************************* * @@ -475,8 +474,8 @@ int pipePutTestWork * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutTest (void) - { +int pipePutTest(void) +{ int rv; /* return value from pipePutTestWork() */ rv = pipePutTestWork (all_N, NELEMENTS(all_N), @@ -504,7 +503,7 @@ int pipePutTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -513,8 +512,8 @@ int pipePutTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutWaitHelper (void) - { +int pipePutWaitHelper(void) +{ int i; /* loop counter */ int rv; /* return value from task_pipe_get_wait */ int bytesRead; /* # of bytes read from task_pipe_get_wait() */ @@ -573,7 +572,7 @@ int pipePutWaitHelper (void) task_sem_give (regSem); return TC_PASS; - } +} /******************************************************************************* * @@ -582,8 +581,8 @@ int pipePutWaitHelper (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutWaitTest (void) - { +int pipePutWaitTest(void) +{ int rv; /* return code from task_pipe_put_wait() */ int bytesWritten; /* # of bytes written to pipe */ @@ -637,7 +636,7 @@ int pipePutWaitTest (void) (void)task_sem_take_wait (regSem); return TC_PASS; - } +} /******************************************************************************* * @@ -646,8 +645,8 @@ int pipePutWaitTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutTimeoutHelper (void) - { +int pipePutTimeoutHelper(void) +{ int i; /* loop counter */ int rv; /* return value from task_pipe_get_wait_timeout() */ int bytesRead; /* # of bytes read from task_pipe_get_wait_timeout() */ @@ -706,7 +705,7 @@ int pipePutTimeoutHelper (void) task_sem_give (regSem); return TC_PASS; - } +} /******************************************************************************* * @@ -715,8 +714,8 @@ int pipePutTimeoutHelper (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipePutTimeoutTest (void) - { +int pipePutTimeoutTest(void) +{ int rv; /* return code from task_pipe_put_wait_timeout() */ int bytesWritten; /* # of bytes written to task_pipe_put_wait_timeout() */ @@ -790,7 +789,7 @@ int pipePutTimeoutTest (void) (void)task_sem_take_wait (regSem); return TC_PASS; - } +} /******************************************************************************* * @@ -804,8 +803,8 @@ int pipePutTimeoutTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipeGetTest (void) - { +int pipeGetTest(void) +{ int i; /* loop counter */ int j; /* loop counter */ int rv; /* return code from task_pipe_get() */ @@ -845,21 +844,20 @@ int pipeGetTest (void) } return TC_PASS; - } +} /******************************************************************************* * * pipeGetWaitHelperWork - test task_pipe_get_wait() * +* \param items testcase list for task_pipe_get_wait() +* \param nItems number of items in list +* * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipeGetWaitHelperWork - ( - SIZE_EXPECT * items, /* testcase list for task_pipe_get_wait() */ - int nItems /* # of items in list */ - ) - { +int pipeGetWaitHelperWork(SIZE_EXPECT *items, int nItems) +{ int i; /* loop counter */ int rv; /* return value from task_pipe_put_wait() */ int bytesSent; /* # of bytes sent to task_pipe_put_wait() */ @@ -885,7 +883,7 @@ int pipeGetWaitHelperWork } return TC_PASS; - } +} /******************************************************************************* * @@ -894,8 +892,8 @@ int pipeGetWaitHelperWork * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipeGetWaitHelper (void) - { +int pipeGetWaitHelper(void) +{ int rv; /* return coded form pipeGetWaitHelperWork() */ (void)task_sem_take_wait (altSem); @@ -915,21 +913,20 @@ int pipeGetWaitHelper (void) } return TC_PASS; - } +} /******************************************************************************* * * pipeGetWaitTestWork - test task_pipe_get_wait() * +* \param items testcase list for task_pipe_get_wait() +* \param nItems number of items in list +* * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipeGetWaitTestWork - ( - SIZE_EXPECT * items, /* testcase list for task_pipe_get_wait() */ - int nItems /* # of items in list */ - ) - { +int pipeGetWaitTestWork(SIZE_EXPECT *items, int nItems) +{ int i; /* loop counter */ int rv; /* return code from task_pipe_get_wait() */ int bytesRead; /* # of bytes read from task_pipe_get_wait() */ @@ -954,7 +951,7 @@ int pipeGetWaitTestWork } return TC_PASS; - } +} /******************************************************************************* * @@ -963,8 +960,8 @@ int pipeGetWaitTestWork * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipeGetWaitTest (void) - { +int pipeGetWaitTest(void) +{ int rv; /* return code from pipeGetWaitTestWork() */ int bytesRead; /* # of bytes read from task_pipe_get_waitait() */ @@ -993,7 +990,7 @@ int pipeGetWaitTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -1002,8 +999,8 @@ int pipeGetWaitTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int pipeGetTimeoutTest (void) - { +int pipeGetTimeoutTest(void) +{ int i; /* loop counter */ int rv; /* return value from task_pipe_get_wait_timeout() */ int bytesRead; /* # of bytes read from task_pipe_get_wait_timeout() */ @@ -1025,7 +1022,7 @@ int pipeGetTimeoutTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -1036,8 +1033,8 @@ int pipeGetTimeoutTest (void) * RETURNS: TC_PASS or TC_FAIL */ -int AlternateTask (void) - { +int AlternateTask(void) +{ int rv; /* return code from each set of test cases */ rv = pipePutHelper (); @@ -1076,7 +1073,7 @@ int AlternateTask (void) */ return TC_PASS; - } +} /******************************************************************************* * @@ -1087,8 +1084,8 @@ int AlternateTask (void) * RETURNS: TC_PASS or TC_FAIL */ -int RegressionTask (void) - { +int RegressionTask(void) +{ int tcRC; /* test case return code */ microObjectsInit (); @@ -1136,4 +1133,4 @@ int RegressionTask (void) } return TC_PASS; - } +} diff --git a/samples/microkernel/test/test_pool/src/pool.c b/samples/microkernel/test/test_pool/src/pool.c index 2c369eb655e..1b43d480adb 100644 --- a/samples/microkernel/test/test_pool/src/pool.c +++ b/samples/microkernel/test/test_pool/src/pool.c @@ -129,11 +129,7 @@ static TEST_CASE defrag[] = { * RETURNS: 0 if the same, non-zero if not the same */ -int blockCompare - ( - struct k_block *b1, - struct k_block *b2 - ) +int blockCompare(struct k_block *b1, struct k_block *b2) { char *p1 = (char *) b1; char *p2 = (char *) b2; @@ -157,13 +153,8 @@ int blockCompare * RETURNS: task_mem_pool_alloc() return value */ -int poolBlockGetFunc - ( - struct k_block *block, - kmemory_pool_t pool, - int size, - int32_t unused - ) +int poolBlockGetFunc(struct k_block *block, kmemory_pool_t pool, int size, + int32_t unused) { ARG_UNUSED(unused); @@ -177,13 +168,8 @@ int poolBlockGetFunc * RETURNS: task_mem_pool_alloc_wait() return value */ -int poolBlockGetWFunc - ( - struct k_block *block, - kmemory_pool_t pool, - int size, - int32_t unused - ) +int poolBlockGetWFunc(struct k_block *block, kmemory_pool_t pool, int size, + int32_t unused) { ARG_UNUSED(unused); @@ -197,13 +183,8 @@ int poolBlockGetWFunc * RETURNS: task_mem_pool_alloc_wait_timeout() return value */ -int poolBlockGetWTFunc - ( - struct k_block *block, - kmemory_pool_t pool, - int size, - int32_t timeout - ) +int poolBlockGetWTFunc(struct k_block *block, kmemory_pool_t pool, + int size, int32_t timeout) { return task_mem_pool_alloc_wait_timeout(block, pool, size, timeout); } @@ -215,11 +196,7 @@ int poolBlockGetWTFunc * RETURNS: N/A */ -void freeBlocks - ( - TEST_CASE *tests, - int nTests - ) +void freeBlocks(TEST_CASE *tests, int nTests) { int i; @@ -237,13 +214,8 @@ void freeBlocks * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int poolBlockGetWork - ( - char *string, - poolBlockGetFunc_t func, - TEST_CASE *tests, - int nTests - ) +int poolBlockGetWork(char *string, poolBlockGetFunc_t func, + TEST_CASE *tests, int nTests) { int i; int rv; @@ -414,11 +386,7 @@ int poolBlockGetWaitTest(void) * RETURNS: task_mem_pool_move() return value */ -int poolMoveBlock - ( - struct k_block *block, - kmemory_pool_t pool - ) +int poolMoveBlock(struct k_block *block, kmemory_pool_t pool) { return task_mem_pool_move(block, pool); } @@ -430,11 +398,7 @@ int poolMoveBlock * RETURNS: task_mem_pool_move_wait() return value */ -int poolMoveBlockW - ( - struct k_block *block, - kmemory_pool_t pool - ) +int poolMoveBlockW(struct k_block *block, kmemory_pool_t pool) { return task_mem_pool_move_wait(block, pool); } @@ -446,11 +410,7 @@ int poolMoveBlockW * RETURNS: task_mem_pool_move_wait_timeout() return value */ -int poolMoveBlockWT - ( - struct k_block *block, - kmemory_pool_t pool - ) +int poolMoveBlockWT(struct k_block *block, kmemory_pool_t pool) { return task_mem_pool_move_wait_timeout(block, pool, TENTH_SECOND); } diff --git a/samples/microkernel/test/test_sema/src/main.c b/samples/microkernel/test/test_sema/src/main.c index 14eb93d9324..b45bf67029c 100644 --- a/samples/microkernel/test/test_sema/src/main.c +++ b/samples/microkernel/test/test_sema/src/main.c @@ -110,12 +110,12 @@ static vvfn _trigger_isrSemaSignal = (vvfn) sw_isr_trigger_0; * RETURNS: N/A */ -void RegressionTaskEntry (void) - { +void RegressionTaskEntry(void) +{ extern int RegressionTask (void); task_sem_give (resultSems[RegressionTask ()]); - } +} /******************************************************************************* * @@ -127,12 +127,12 @@ void RegressionTaskEntry (void) * RETURNS: N/A */ -void AlternateTaskEntry (void) - { +void AlternateTaskEntry(void) +{ extern int AlternateTask (void); task_sem_give (resultSems[AlternateTask ()]); - } +} /******************************************************************************* * @@ -144,12 +144,12 @@ void AlternateTaskEntry (void) * RETURNS: N/A */ -void HighPriTaskEntry (void) - { +void HighPriTaskEntry(void) +{ extern int HighPriTask (void); task_sem_give (resultSems[HighPriTask ()]); - } +} /******************************************************************************* * @@ -161,43 +161,41 @@ void HighPriTaskEntry (void) * RETURNS: N/A */ -void LowPriTaskEntry (void) - { +void LowPriTaskEntry(void) +{ extern int LowPriTask (void); task_sem_give (resultSems[LowPriTask ()]); - } +} /******************************************************************************* * * testIsrHandler - ISR that gives specified semaphore * +* \param isrData pointer to semaphore to be given +* * RETURNS: N/A */ -static void testIsrHandler - ( - void *isrData /* pointer to semaphore to be given */ - ) - { +static void testIsrHandler(void *isrData) +{ isr_sem_give (*(ksem_t *)isrData, &CMD_PKT_SET(cmdPktSet)); - } +} /******************************************************************************* * * trigger_isrSemaSignal - generate interrupt that gives specified semaphore * +* \param semaphore semaphore to be given +* * RETURNS: N/A */ -void trigger_isrSemaSignal - ( - ksem_t semaphore /* semaphore to be given */ - ) - { +void trigger_isrSemaSignal(ksem_t semaphore) +{ testIsrInfo = semaphore; _trigger_isrSemaSignal (); - } +} /******************************************************************************* * @@ -206,10 +204,10 @@ void trigger_isrSemaSignal * RETURNS: N/A */ -void releaseTestFiber (void) - { +void releaseTestFiber(void) +{ nano_task_sem_give (&fiberSem); - } +} /******************************************************************************* * @@ -221,8 +219,8 @@ void releaseTestFiber (void) * RETURNS: N/A */ -static void testInterruptsInit (void) - { +static void testInterruptsInit(void) +{ struct isrInitInfo i = { { testIsrHandler, NULL}, @@ -230,7 +228,7 @@ static void testInterruptsInit (void) }; (void) initIRQ (&i); - } +} /******************************************************************************* * @@ -242,8 +240,8 @@ static void testInterruptsInit (void) * RETURNS: N/A */ -void MonitorTaskEntry (void) - { +void MonitorTaskEntry(void) +{ ksem_t result; int tasksDone; @@ -274,4 +272,4 @@ void MonitorTaskEntry (void) } TC_END_REPORT (TC_PASS); - } +} diff --git a/samples/microkernel/test/test_sprintf/src/test_sprintf.c b/samples/microkernel/test/test_sprintf/src/test_sprintf.c index c1d80ebf80c..c7f0f09a08a 100644 --- a/samples/microkernel/test/test_sprintf/src/test_sprintf.c +++ b/samples/microkernel/test/test_sprintf/src/test_sprintf.c @@ -88,8 +88,8 @@ typedef union * RETURNS: TC_PASS on success, TC_FAIL otherwise */ -int sprintfDoubleTest (void) - { +int sprintfDoubleTest(void) +{ char buffer[100]; raw_double_u var; int status = TC_PASS; @@ -254,7 +254,7 @@ int sprintfDoubleTest (void) } return status; - } +} #endif /* CONFIG_FLOAT */ /******************************************************************************* @@ -262,14 +262,8 @@ int sprintfDoubleTest (void) * tvsnprintf - a test wrapper for vsnprintf() */ -int tvsnprintf - ( - char * s, - size_t len, - const char * format, - ... - ) - { +int tvsnprintf(char *s, size_t len, const char *format, ...) +{ va_list vargs; int r; @@ -278,7 +272,7 @@ int tvsnprintf va_end (vargs); return r; - } +} /******************************************************************************* * @@ -292,8 +286,8 @@ int tvsnprintf * RETURNS: TC_PASS on success, TC_FAIL otherwise */ -int vsnprintfTest (void) - { +int vsnprintfTest(void) +{ int len; int status = TC_PASS; char buffer[100]; @@ -355,20 +349,15 @@ int vsnprintfTest (void) } return status; - } +} /******************************************************************************* * * tvsprintf - a test wrapper for vsprintf() */ -int tvsprintf - ( - char * s, - const char * format, - ... - ) - { +int tvsprintf(char *s, const char *format, ...) +{ va_list vargs; int r; @@ -377,7 +366,7 @@ int tvsprintf va_end (vargs); return r; - } +} /******************************************************************************* * @@ -390,8 +379,8 @@ int tvsprintf * RETURNS: TC_PASS on success, TC_FAIL otherwise */ -int vsprintfTest (void) - { +int vsprintfTest(void) +{ int len; int status = TC_PASS; char buffer[100]; @@ -413,7 +402,7 @@ int vsprintfTest (void) } return status; - } +} /******************************************************************************* * @@ -426,8 +415,8 @@ int vsprintfTest (void) * RETURNS: TC_PASS on success, TC_FAIL otherwise */ -int snprintfTest (void) - { +int snprintfTest(void) +{ int len; int status = TC_PASS; char buffer[100]; @@ -489,7 +478,7 @@ int snprintfTest (void) } return status; - } +} /******************************************************************************* * @@ -498,8 +487,8 @@ int snprintfTest (void) * RETURNS: TC_PASS on success, TC_FAIL otherwise */ -int sprintfMiscTest (void) - { +int sprintfMiscTest(void) +{ int status = TC_PASS; int count; char buffer[100]; @@ -573,7 +562,7 @@ int sprintfMiscTest (void) } return status; - } +} /******************************************************************************* * @@ -582,8 +571,8 @@ int sprintfMiscTest (void) * RETURNS: TC_PASS on success, TC_FAIL otherwise */ -int sprintfIntegerTest (void) - { +int sprintfIntegerTest(void) +{ int status = TC_PASS; int len; char buffer[100]; @@ -746,7 +735,7 @@ int sprintfIntegerTest (void) } return status; - } +} /******************************************************************************* * @@ -755,8 +744,8 @@ int sprintfIntegerTest (void) * RETURNS: TC_PASS on success, TC_FAIL otherwise */ -int sprintfStringTest (void) - { +int sprintfStringTest(void) +{ int len; int status = TC_PASS; char buffer[400]; @@ -797,7 +786,7 @@ int sprintfStringTest (void) } return status; - } +} /******************************************************************************* * @@ -806,8 +795,8 @@ int sprintfStringTest (void) * RETURNS: N/A */ -void RegressionTask (void) - { +void RegressionTask(void) +{ int status = TC_PASS; TC_START ("Test Microkernel sprintf APIs\n"); @@ -860,4 +849,4 @@ void RegressionTask (void) TC_END_RESULT (status); TC_END_REPORT (status); - } +} diff --git a/samples/microkernel/test/test_stackprot/src/stackprot.c b/samples/microkernel/test/test_stackprot/src/stackprot.c index e2fc3baec9a..959bf1419e9 100644 --- a/samples/microkernel/test/test_stackprot/src/stackprot.c +++ b/samples/microkernel/test/test_stackprot/src/stackprot.c @@ -68,7 +68,7 @@ static int count = 0; static int tcRC = TC_PASS; /* forward declarations */ -void check_input ( const char *name, const char *input ); +void check_input(const char *name, const char *input); /******************************************************************************* * @@ -77,21 +77,20 @@ void check_input ( const char *name, const char *input ); * This function calls check_input 6 times with the input name and a short * string, which is printed properly by check_input. * +* \param name task or fiber identification string +* * RETURNS: N/A */ -void printLoop - ( - const char * name /* task or fiber identification string */ - ) - { +void printLoop(const char *name) +{ while (count < 6) { /* A short input string to check_input. It will pass. */ check_input(name, "Stack ok"); count++; } - } +} /******************************************************************************* * @@ -109,17 +108,13 @@ void printLoop * RETURNS: N/A */ -void check_input - ( - const char *name, - const char *input - ) - { +void check_input(const char *name, const char *input) +{ /* Stack will overflow when input is more than 16 characters */ char buf[16]; strcpy(buf, input); TC_PRINT("%s: %s\n", name, buf); - } +} /******************************************************************************* * @@ -134,11 +129,11 @@ void check_input * RETURNS: N/A */ #ifdef CONFIG_MICROKERNEL -void AlternateTask (void) +void AlternateTask(void) #else -void fiber1 (void) +void fiber1(void) #endif /* ! CONFIG_MICROKERNEL */ - { +{ TC_PRINT("Starts %s\n", __func__); check_input(__func__, "Input string is too long and stack overflowed!\n"); @@ -149,7 +144,7 @@ void fiber1 (void) printLoop (__func__); tcRC = TC_FAIL; - } +} /******************************************************************************* * @@ -164,11 +159,11 @@ void fiber1 (void) */ #ifdef CONFIG_MICROKERNEL -void RegressionTask (void) +void RegressionTask(void) #else -void main (void) +void main(void) #endif /* ! CONFIG_MICROKERNEL */ - { +{ TC_START("Test Stack Protection Canary\n"); TC_PRINT("Starts %s\n", __func__); @@ -191,4 +186,4 @@ void main (void) errorExit: TC_END_RESULT(tcRC); TC_END_REPORT (tcRC); - } +} 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 895aa5c712f..a52c6cfd5b4 100644 --- a/samples/microkernel/test/test_static_idt/src/static_idt.c +++ b/samples/microkernel/test/test_static_idt/src/static_idt.c @@ -78,12 +78,12 @@ static char fiberStack[512]; #define _trigger_isrHandler() __asm__ volatile("int %0" : : "i" (TEST_SOFT_INT) : "memory") #define _trigger_spurHandler() __asm__ volatile("int %0" : : "i" (TEST_SPUR_INT) : "memory") #elif defined (__DCC__) -__asm volatile void _trigger_int (unsigned number) - { +__asm volatile void _trigger_int(unsigned number) +{ % con number ! int number - } +} #define _trigger_isrHandler() _trigger_int (TEST_SOFT_INT) #define _trigger_spurHandler() _trigger_int (TEST_SPUR_INT) #endif @@ -98,10 +98,10 @@ __asm volatile void _trigger_int (unsigned number) * RETURNS: N/A */ -void isr_handler (void) - { +void isr_handler(void) +{ intHandlerExecuted++; - } +} /******************************************************************************* * @@ -123,14 +123,11 @@ void isr_handler (void) * RETURNS: N/A */ -void exc_divide_error_handler - ( - NANO_ESF * pEsf - ) - { +void exc_divide_error_handler(NANO_ESF *pEsf) +{ pEsf->eip += 2; excHandlerExecuted = 1; /* provide evidence that the handler executed */ - } +} /******************************************************************************* @@ -143,8 +140,8 @@ void exc_divide_error_handler * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int nanoIdtStubTest (void) - { +int nanoIdtStubTest(void) +{ IDT_ENTRY * pIdtEntry; uint16_t offset; @@ -191,7 +188,7 @@ int nanoIdtStubTest (void) * and software interrupt are triggered so we don't check them. */ return TC_PASS; - } +} /******************************************************************************* * @@ -201,15 +198,11 @@ int nanoIdtStubTest (void) */ #ifdef CONFIG_MICROKERNEL -void idtSpurTask (void) +void idtSpurTask(void) #else -static void idtSpurFiber - ( - int a1, - int a2 - ) +static void idtSpurFiber(int a1, int a2) #endif - { +{ #ifndef CONFIG_MICROKERNEL ARG_UNUSED (a1); ARG_UNUSED (a2); @@ -222,7 +215,7 @@ static void idtSpurFiber /* Shouldn't get here */ spurHandlerAbortedContext = 0; - } +} /******************************************************************************* * @@ -234,11 +227,11 @@ static void idtSpurFiber */ #ifdef CONFIG_MICROKERNEL -void idtTestTask (void) +void idtTestTask(void) #else -void main (void) +void main(void) #endif - { +{ int rv; /* return value from tests */ volatile int error; /* used to create a divide by zero error */ @@ -313,4 +306,4 @@ void main (void) doneTests: TC_END (rv, "%s - %s.\n", rv == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT (rv); - } +} diff --git a/samples/microkernel/test/test_task/src/task.c b/samples/microkernel/test/test_task/src/task.c index a661e0b56cc..720ffcd5238 100644 --- a/samples/microkernel/test/test_task/src/task.c +++ b/samples/microkernel/test/test_task/src/task.c @@ -86,11 +86,8 @@ static volatile int mainTaskNotReady = 0; * RETURNS: N/A */ -void isr_task_command_handler - ( - void * data - ) - { +void isr_task_command_handler(void *data) +{ ISR_INFO * pInfo = (ISR_INFO *) data; int value = -1; @@ -106,7 +103,7 @@ void isr_task_command_handler } pInfo->data = value; - } +} /******************************************************************************* * @@ -115,12 +112,8 @@ void isr_task_command_handler * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int isrAPIsTest - ( - int taskId, - int taskPrio - ) - { +int isrAPIsTest(int taskId, int taskPrio) +{ isrInfo.cmd = CMD_TASKID; _trigger_isrTaskCommand (); if (isrInfo.data != taskId) @@ -140,7 +133,7 @@ int isrAPIsTest } return TC_PASS; - } +} /******************************************************************************* * @@ -149,12 +142,8 @@ int isrAPIsTest * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int taskMacrosTest - ( - int taskId, - int taskPrio - ) - { +int taskMacrosTest(int taskId, int taskPrio) +{ int value; value = task_id_get (); @@ -174,7 +163,7 @@ int taskMacrosTest } return TC_PASS; - } +} /******************************************************************************* * @@ -183,8 +172,8 @@ int taskMacrosTest * RETURNS: N/A */ -void microObjectsInit (void) - { +void microObjectsInit(void) +{ struct isrInitInfo i = { { isr_task_command_handler, NULL }, @@ -194,7 +183,7 @@ void microObjectsInit (void) (void) initIRQ (&i); TC_PRINT ("Microkernel objects initialized\n"); - } +} /******************************************************************************* * @@ -203,8 +192,8 @@ void microObjectsInit (void) * RETURNS: N/A */ -void helperTaskSetPrioTest (void) - { +void helperTaskSetPrioTest(void) +{ task_sem_take_wait (HT_SEM); helperData = task_priority_get (); /* Helper task priority lowered by 5 */ task_sem_give (RT_SEM); @@ -216,7 +205,7 @@ void helperTaskSetPrioTest (void) task_sem_take_wait (HT_SEM); helperData = task_priority_get (); /* Helper task prioirty restored */ task_sem_give (RT_SEM); - } +} /******************************************************************************* * @@ -225,8 +214,8 @@ void helperTaskSetPrioTest (void) * RETURNS: N/A */ -int taskSetPrioTest (void) - { +int taskSetPrioTest(void) +{ int rv; /* Lower the priority of the current task (RegressionTask) */ @@ -296,7 +285,7 @@ int taskSetPrioTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -305,8 +294,8 @@ int taskSetPrioTest (void) * RETURNS: N/A */ -void helperTaskSleepTest (void) - { +void helperTaskSleepTest(void) +{ int32_t firstTick; task_sem_take_wait (HT_SEM); @@ -318,7 +307,7 @@ void helperTaskSleepTest (void) helperData = task_node_tick_get_32 () - firstTick; task_sem_give (RT_SEM); - } +} /******************************************************************************* * @@ -327,8 +316,8 @@ void helperTaskSleepTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int taskSleepTest (void) - { +int taskSleepTest(void) +{ int32_t tick; tick = task_node_tick_get_32 (); /* Busy wait to align */ @@ -351,7 +340,7 @@ int taskSleepTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -360,8 +349,8 @@ int taskSleepTest (void) * RETURNS: N/A */ -void helperTaskYieldTest (void) - { +void helperTaskYieldTest(void) +{ int i; task_sem_take_wait (HT_SEM); @@ -372,7 +361,7 @@ void helperTaskYieldTest (void) } task_sem_give (RT_SEM); - } +} /******************************************************************************* * @@ -381,8 +370,8 @@ void helperTaskYieldTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int taskYieldTest (void) - { +int taskYieldTest(void) +{ int prevHelperData; int i; @@ -412,7 +401,7 @@ int taskYieldTest (void) task_sem_take_wait (RT_SEM); return TC_PASS; - } +} /******************************************************************************* * @@ -422,12 +411,12 @@ int taskYieldTest (void) * RETURNS: N/A */ -void helperTaskSuspendTest (void) - { +void helperTaskSuspendTest(void) +{ helperData++; task_sem_take_wait (HT_SEM); - } +} /******************************************************************************* * @@ -442,8 +431,8 @@ void helperTaskSuspendTest (void) * RETURNS: TC_PASS on success or TC_FAIL on failure */ -int taskSuspendTest (void) - { +int taskSuspendTest(void) +{ int prevHelperData; task_suspend (HT_TASKID); /* Suspend the helper task */ @@ -468,7 +457,7 @@ int taskSuspendTest (void) task_sem_give (HT_SEM); return TC_PASS; - } +} /******************************************************************************* * @@ -477,8 +466,8 @@ int taskSuspendTest (void) * RETURNS: N/A */ -void HelperTask (void) - { +void HelperTask(void) +{ int rv; task_sem_take_wait (HT_SEM); @@ -506,7 +495,7 @@ void HelperTask (void) helperTaskYieldTest (); helperTaskSuspendTest (); - } +} /******************************************************************************* * @@ -515,8 +504,8 @@ void HelperTask (void) * RETURNS: N/A */ -void RegressionTask (void) - { +void RegressionTask(void) +{ int rv; TC_START("Test Microkernel Task API"); @@ -578,4 +567,4 @@ void RegressionTask (void) errorReturn: TC_END_RESULT (tcRC); TC_END_REPORT (tcRC); - } /* RegressionTask */ +} /* RegressionTask */ diff --git a/samples/nanokernel/test/test_context/src/context.c b/samples/nanokernel/test/test_context/src/context.c index dc772bfe26b..8280d55e743 100644 --- a/samples/nanokernel/test/test_context/src/context.c +++ b/samples/nanokernel/test/test_context/src/context.c @@ -136,11 +136,8 @@ static void (*_trigger_isrHandler) (void) = (vvfn)sw_isr_trigger_0; * RETURNS: N/A */ -void isr_handler - ( - void * data - ) - { +void isr_handler(void *data) +{ ARG_UNUSED (data); switch (isrInfo.command) @@ -157,7 +154,7 @@ void isr_handler isrInfo.error = UNKNOWN_COMMAND; break; } - } +} /* Cortex-M3 does not implement connecting non-IRQ exception handlers */ #if !defined(CONFIG_CPU_CORTEXM3) @@ -175,14 +172,11 @@ void isr_handler * RETURNS: N/A */ -void exc_divide_error_handler - ( - NANO_ESF * pEsf - ) - { +void exc_divide_error_handler(NANO_ESF *pEsf) +{ pEsf->eip += 2; excHandlerExecuted = 1; /* provide evidence that the handler executed */ - } +} #endif /******************************************************************************* @@ -194,8 +188,8 @@ void exc_divide_error_handler * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int initNanoObjects (void) - { +int initNanoObjects(void) +{ nano_sem_init (&wakeFiber); nano_timer_init (&timer, timerData); @@ -211,7 +205,7 @@ int initNanoObjects (void) }; return initIRQ(&i) < 0 ? TC_FAIL : TC_PASS; - } +} /******************************************************************************* * @@ -225,8 +219,8 @@ int initNanoObjects (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int nano_cpu_idleTest (void) - { +int nano_cpu_idleTest(void) +{ int tick; /* current tick count */ int i; /* loop variable */ @@ -248,7 +242,7 @@ int nano_cpu_idleTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -257,15 +251,12 @@ int nano_cpu_idleTest (void) * RETURNS: irq_lock() return value */ -int irq_lockWrapper - ( - int unused - ) - { +int irq_lockWrapper(int unused) +{ ARG_UNUSED (unused); return irq_lock (); - } +} /******************************************************************************* * @@ -274,13 +265,10 @@ int irq_lockWrapper * RETURNS: N/A */ -void irq_unlockWrapper - ( - int imask - ) - { +void irq_unlockWrapper(int imask) +{ irq_unlock (imask); - } +} /******************************************************************************* * @@ -289,15 +277,12 @@ void irq_unlockWrapper * RETURNS: irq_lock_inline() return value */ -int irq_lock_inlineWrapper - ( - int unused - ) - { +int irq_lock_inlineWrapper(int unused) +{ ARG_UNUSED (unused); return irq_lock_inline (); - } +} /******************************************************************************* * @@ -306,13 +291,10 @@ int irq_lock_inlineWrapper * RETURNS: N/A */ -void irq_unlock_inlineWrapper - ( - int imask - ) - { +void irq_unlock_inlineWrapper(int imask) +{ irq_unlock_inline (imask); - } +} /******************************************************************************* * @@ -321,14 +303,11 @@ void irq_unlock_inlineWrapper * RETURNS: */ -int irq_disableWrapper - ( - int irq - ) - { +int irq_disableWrapper(int irq) +{ irq_disable (irq); return irq; - } +} /******************************************************************************* * @@ -337,13 +316,10 @@ int irq_disableWrapper * RETURNS: N/A */ -void irq_enableWrapper - ( - int irq - ) - { +void irq_enableWrapper(int irq) +{ irq_enable (irq); - } +} /******************************************************************************* * @@ -356,13 +332,9 @@ void irq_enableWrapper * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int nanoCpuDisableInterruptsTest - ( - disable_interrupt_func disableRtn, - enable_interrupt_func enableRtn, - int irq - ) - { +int nanoCpuDisableInterruptsTest(disable_interrupt_func disableRtn, + enable_interrupt_func enableRtn, int irq) +{ unsigned long long count = 0; unsigned long long i = 0; int tick; @@ -418,7 +390,7 @@ int nanoCpuDisableInterruptsTest } return (tick == nano_node_tick_get_32 ()) ? TC_FAIL : TC_PASS; - } +} /******************************************************************************* * @@ -431,8 +403,8 @@ int nanoCpuDisableInterruptsTest * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int nanoCtxTaskTest (void) - { +int nanoCtxTaskTest(void) +{ nano_context_id_t ctxId; TC_PRINT ("Testing context_self_get() from an ISR and task\n"); @@ -465,7 +437,7 @@ int nanoCtxTaskTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -484,11 +456,8 @@ int nanoCtxTaskTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int nanoCtxFiberTest - ( - nano_context_id_t taskCtxId - ) - { +int nanoCtxFiberTest(nano_context_id_t taskCtxId) +{ nano_context_id_t ctxId; ctxId = context_self_get (); @@ -527,7 +496,7 @@ int nanoCtxFiberTest } return TC_PASS; - } +} /******************************************************************************* * @@ -536,15 +505,14 @@ int nanoCtxFiberTest * This routine is the entry point to the fiber's helper fiber. It is used to * help test the behaviour of the fiber_yield() routine. * +* \param arg1 unused +* \param arg2 unused +* * RETURNS: N/A */ -static void fiberHelper - ( - int arg1, /* unused */ - int arg2 /* unused */ - ) - { +static void fiberHelper(int arg1, int arg2) +{ nano_context_id_t ctxId; ARG_UNUSED (arg1); @@ -565,7 +533,7 @@ static void fiberHelper fiberEvidence++; /* should now be 2 */ - } +} /******************************************************************************* * @@ -585,8 +553,8 @@ static void fiberHelper * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int fiber_yieldTest (void) - { +int fiber_yieldTest(void) +{ nano_context_id_t ctxId; /* @@ -647,7 +615,7 @@ int fiber_yieldTest (void) nano_fiber_sem_take_wait (&wakeFiber); return TC_PASS; - } +} /******************************************************************************* * @@ -655,15 +623,14 @@ int fiber_yieldTest (void) * * This routine is the entry point to the fiber started by the task. * +* \param taskCtxId context ID of the spawning task +* \param arg1 unused +* * RETURNS: N/A */ -static void fiberEntry - ( - int taskCtxId, /* context ID of the spawning task */ - int arg1 /* unused */ - ) - { +static void fiberEntry(int taskCtxId, int arg1) +{ int rv; ARG_UNUSED (arg1); @@ -685,7 +652,7 @@ static void fiberEntry { return; } - } +} /******************************************************************************* * @@ -696,8 +663,8 @@ static void fiberEntry * RETURNS: N/A */ -void main (void) - { +void main(void) +{ int rv; /* return value from tests */ TC_START ("Test Nanokernel CPU and context routines"); @@ -823,4 +790,4 @@ void main (void) doneTests: TC_END (rv, "%s - %s.\n", rv == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT (rv); - } +} diff --git a/samples/nanokernel/test/test_fifo/src/fifo.c b/samples/nanokernel/test/test_fifo/src/fifo.c index c3888567b84..68ead02c097 100644 --- a/samples/nanokernel/test/test_fifo/src/fifo.c +++ b/samples/nanokernel/test/test_fifo/src/fifo.c @@ -158,18 +158,17 @@ void testTaskFifoGetW(void); * This routine is the ISR handler for _trigger_nano_isr_fifo_put(). It adds * an item to the FIFO in the context of an ISR. * +* \param parameter pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_fifo_put - ( - void * parameter /* ptr to ISR handler parameter */ - ) - { +void isr_fifo_put(void *parameter) +{ ISR_FIFO_INFO * pInfo = (ISR_FIFO_INFO *) parameter; nano_isr_fifo_put (pInfo->channel, pInfo->data); - } +} /******************************************************************************* * @@ -178,18 +177,17 @@ void isr_fifo_put * This routine is the ISR handler for _trigger_nano_isr_fifo_get(). It gets * an item from the FIFO in the context of an ISR. * +* \param parameter pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_fifo_get - ( - void * parameter /* ptr to ISR handler parameter */ - ) - { +void isr_fifo_get(void *parameter) +{ ISR_FIFO_INFO * pInfo = (ISR_FIFO_INFO *) parameter; pInfo->data = nano_isr_fifo_get (pInfo->channel); - } +} /******************************************************************************* @@ -200,7 +198,7 @@ void isr_fifo_get */ void fiber1(void) - { +{ void * pData; /* pointer to FIFO object get from the queue */ int count = 0; /* counter */ @@ -263,7 +261,7 @@ void fiber1(void) /* Give semaphore to allow the main task to run */ nano_fiber_sem_give(&nanoSemObjTask); - } /* fiber1 */ +} /* fiber1 */ /******************************************************************************* @@ -277,7 +275,7 @@ void fiber1(void) */ void testFiberFifoGetW(void) - { +{ void * pGetData; /* pointer to FIFO object get from the queue */ void * pPutData; /* pointer to FIFO object to put to the queue */ @@ -312,7 +310,7 @@ void testFiberFifoGetW(void) TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } /* testFiberFifoGetW */ +} /* testFiberFifoGetW */ /******************************************************************************* @@ -328,7 +326,7 @@ void testFiberFifoGetW(void) */ void testIsrFifoFromFiber(void) - { +{ void * pGetData; /* pointer to FIFO object get from the queue */ TC_PRINT("Test ISR FIFO (invoked from Fiber)\n\n"); @@ -369,7 +367,7 @@ void testIsrFifoFromFiber(void) TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } /* testIsrFifoFromFiber */ +} /* testIsrFifoFromFiber */ /******************************************************************************* @@ -385,7 +383,7 @@ void testIsrFifoFromFiber(void) */ void testIsrFifoFromTask(void) - { +{ void * pGetData; /* pointer to FIFO object get from the queue */ void * pPutData; /* pointer to FIFO object put to queue */ int count = 0; /* counter */ @@ -448,7 +446,7 @@ void testIsrFifoFromTask(void) */ void fiber2(void) - { +{ void * pData; /* pointer to FIFO object from the queue */ /* Wait for fiber2 to be activated */ @@ -498,7 +496,7 @@ void fiber2(void) testIsrFifoFromFiber(); TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } /* fiber2 */ +} /* fiber2 */ /******************************************************************************* * @@ -507,8 +505,8 @@ void fiber2(void) * RETURNS: N/A */ -void fiber3 (void) - { +void fiber3(void) +{ void * pData; /* Wait for fiber3 to be activated */ @@ -544,7 +542,7 @@ void fiber3 (void) /* Wait for fiber3 to be re-activated (not expected to occur) */ nano_fiber_sem_take_wait (&nanoSemObj3); - } +} /******************************************************************************* @@ -558,7 +556,7 @@ void fiber3 (void) */ void testTaskFifoGetW(void) - { +{ void * pGetData; /* pointer to FIFO object get from the queue */ void * pPutData; /* pointer to FIFO object to put to the queue */ @@ -586,7 +584,7 @@ void testTaskFifoGetW(void) nano_task_fifo_put(&nanoFifoObj2, pPutData); TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } /* testTaskFifoGetW */ +} /* testTaskFifoGetW */ /******************************************************************************* * @@ -598,7 +596,7 @@ void testTaskFifoGetW(void) */ void initNanoObjects(void) - { +{ struct isrInitInfo i = { {isr_fifo_put, isr_fifo_get}, @@ -616,7 +614,7 @@ void initNanoObjects(void) nano_sem_init (&nanoSemObjTask); nano_timer_init (&timer, timerData); - } /* initNanoObjects */ +} /* initNanoObjects */ /******************************************************************************* * @@ -627,8 +625,8 @@ void initNanoObjects(void) * RETURNS: N/A */ -void main (void) - { +void main(void) +{ void * pData; /* pointer to FIFO object get from the queue */ int count = 0; /* counter */ TC_START("Test Nanokernel FIFO"); @@ -753,4 +751,4 @@ void main (void) exit: TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT (retCode); - } +} diff --git a/samples/nanokernel/test/test_lifo/src/lifo.c b/samples/nanokernel/test/test_lifo/src/lifo.c index 4eece16372f..7e3471e14e8 100644 --- a/samples/nanokernel/test/test_lifo/src/lifo.c +++ b/samples/nanokernel/test/test_lifo/src/lifo.c @@ -111,18 +111,17 @@ static void (*_trigger_nano_isr_lifo_get) (void) = (vvfn)sw_isr_trigger_1; * This routine is the ISR handler for _trigger_nano_isr_lifo_put(). It adds * an item to the LIFO in the context of an ISR. * +* \param data pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_lifo_put - ( - void * data /* ptr to ISR handler parameter */ - ) - { +void isr_lifo_put(void *data) +{ ISR_LIFO_INFO * pInfo = (ISR_LIFO_INFO *) data; nano_isr_lifo_put (pInfo->channel, pInfo->data); - } +} /******************************************************************************* * @@ -131,18 +130,17 @@ void isr_lifo_put * This routine is the ISR handler for _trigger_nano_isr_lifo_get(). It gets * an item from the LIFO in the context of an ISR. * +* \param data pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_lifo_get - ( - void * data /* ptr to ISR handler parameter */ - ) - { +void isr_lifo_get(void *data) +{ ISR_LIFO_INFO * pInfo = (ISR_LIFO_INFO *) data; pInfo->data = nano_isr_lifo_get (pInfo->channel); - } +} /******************************************************************************* * @@ -155,8 +153,8 @@ void isr_lifo_get * RETURNS: 0 on success, -1 on failure */ -int fiberLifoWaitTest (void) - { +int fiberLifoWaitTest(void) +{ void * data; /* ptr to data retrieved from LIFO */ /* @@ -205,7 +203,7 @@ int fiberLifoWaitTest (void) nano_fiber_sem_take_wait (&fiberWaitSem); return 0; - } +} /******************************************************************************* * @@ -217,8 +215,8 @@ int fiberLifoWaitTest (void) * RETURNS: 0 on success, -1 on failure */ -int fiberLifoNonWaitTest (void) - { +int fiberLifoNonWaitTest(void) +{ void * data; /* pointer to data retrieved from LIFO */ /* The LIFO has two items in it; retrieve them both */ @@ -289,7 +287,7 @@ int fiberLifoNonWaitTest (void) errorReturn: fiberDetectedFailure = 1; return -1; - } +} /******************************************************************************* * @@ -298,15 +296,14 @@ errorReturn: * NOTE: The fiber portion of the tests have higher priority than the task * portion of the tests. * +* \param arg1 unused +* \param arg2 unused +* * RETURNS: N/A */ -static void fiberEntry - ( - int arg1, /* unused */ - int arg2 /* unused */ - ) - { +static void fiberEntry(int arg1, int arg2) +{ int rv; /* return value from a test */ ARG_UNUSED (arg1); @@ -319,7 +316,7 @@ static void fiberEntry fiberLifoNonWaitTest (); } - } +} /******************************************************************************* * @@ -332,8 +329,8 @@ static void fiberEntry * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int taskLifoWaitTest (void) - { +int taskLifoWaitTest(void) +{ void *data; /* ptr to data retrieved from LIFO */ /* Wait on in case fiber's print message blocked */ @@ -380,7 +377,7 @@ int taskLifoWaitTest (void) /* Waiting on an empty LIFO passed for both fiber and task. */ return TC_PASS; - } +} /******************************************************************************* * @@ -392,8 +389,8 @@ int taskLifoWaitTest (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int taskLifoNonWaitTest (void) - { +int taskLifoNonWaitTest(void) +{ void * data; /* ptr to data retrieved from LIFO */ /* @@ -463,7 +460,7 @@ int taskLifoNonWaitTest (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -474,8 +471,8 @@ int taskLifoNonWaitTest (void) * RETURNS: N/A */ -void initNanoObjects (void) - { +void initNanoObjects(void) +{ struct isrInitInfo i = { {isr_lifo_put, isr_lifo_get}, @@ -490,7 +487,7 @@ void initNanoObjects (void) nano_timer_init (&timer, timerData); TC_PRINT ("Nano objects initialized\n"); - } +} /******************************************************************************* * @@ -501,8 +498,8 @@ void initNanoObjects (void) * RETURNS: N/A */ -void main (void) - { +void main(void) +{ int rv; /* return value from tests */ TC_START ("Test Nanokernel LIFO"); @@ -526,4 +523,4 @@ void main (void) TC_END (rv, "%s - %s.\n", rv == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT (rv); - } +} diff --git a/samples/nanokernel/test/test_sema/src/sema.c b/samples/nanokernel/test/test_sema/src/sema.c index 61297391a28..eb80497856b 100644 --- a/samples/nanokernel/test/test_sema/src/sema.c +++ b/samples/nanokernel/test/test_sema/src/sema.c @@ -102,18 +102,17 @@ static void (*_trigger_nano_isr_sem_take) (void) = (vvfn)sw_isr_trigger_1; * This routine is the ISR handler for _trigger_nano_isr_sem_take(). It takes a * semaphore within the context of an ISR. * +* \param data pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_sem_take - ( - void * data /* ptr to ISR handler parameter */ - ) - { +void isr_sem_take(void *data) +{ ISR_SEM_INFO * pInfo = (ISR_SEM_INFO *) data; pInfo->data = nano_isr_sem_take (pInfo->sem); - } +} /******************************************************************************* * @@ -122,19 +121,18 @@ void isr_sem_take * This routine is the ISR handler for _trigger_nano_isr_sem_take(). It gives a * semaphore within the context of an ISR. * +* \param data pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_sem_give - ( - void * data /* ptr to ISR handler parameter */ - ) - { +void isr_sem_give(void *data) +{ ISR_SEM_INFO * pInfo = (ISR_SEM_INFO *) data; nano_isr_sem_give (pInfo->sem); pInfo->data = 1; /* Indicate semaphore has been given */ - } +} /******************************************************************************* * @@ -146,8 +144,8 @@ void isr_sem_give * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int testSemFiberNoWait (void) - { +int testSemFiberNoWait(void) +{ int i; TC_PRINT ("Giving and taking a semaphore in a fiber (non-blocking)\n"); @@ -182,7 +180,7 @@ int testSemFiberNoWait (void) errorReturn: fiberDetectedFailure = 1; return TC_FAIL; - } +} /******************************************************************************* * @@ -191,15 +189,14 @@ errorReturn: * NOTE: The fiber portion of the tests have higher priority than the task * portion of the tests. * +* \param arg1 unused +* \param arg2 unused +* * RETURNS: N/A */ -static void fiberEntry - ( - int arg1, /* unused */ - int arg2 /* unused */ - ) - { +static void fiberEntry(int arg1, int arg2) +{ int rv; /* return value from a test */ ARG_UNUSED (arg1); @@ -259,7 +256,7 @@ static void fiberEntry if (isrSemInfo.data == 1) semTestState = STS_ISR_WOKE_TASK; - } +} /******************************************************************************* * @@ -270,8 +267,8 @@ static void fiberEntry * RETURNS: N/A */ -void initNanoObjects (void) - { +void initNanoObjects(void) +{ struct isrInitInfo i = { {isr_sem_give, isr_sem_take}, @@ -284,7 +281,7 @@ void initNanoObjects (void) nano_timer_init (&timer, timerData); TC_PRINT ("Nano objects initialized\n"); - } +} /******************************************************************************* * @@ -296,8 +293,8 @@ void initNanoObjects (void) * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int testSemIsrNoWait (void) - { +int testSemIsrNoWait(void) +{ int i; TC_PRINT ("Giving and taking a semaphore in an ISR (non-blocking)\n"); @@ -335,7 +332,7 @@ int testSemIsrNoWait (void) errorReturn: return TC_FAIL; - } +} /******************************************************************************* * @@ -347,8 +344,8 @@ errorReturn: * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int testSemTaskNoWait (void) - { +int testSemTaskNoWait(void) +{ int i; /* loop counter */ TC_PRINT ("Giving and taking a semaphore in a task (non-blocking)\n"); @@ -382,7 +379,7 @@ int testSemTaskNoWait (void) errorReturn: return TC_FAIL; - } +} /******************************************************************************* * @@ -394,8 +391,8 @@ errorReturn: * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int testSemWait (void) - { +int testSemWait(void) +{ if (fiberDetectedFailure != 0) { TC_ERROR (" *** Failure detected in the fiber."); @@ -432,7 +429,7 @@ int testSemWait (void) TC_PRINT ("Semaphore from the ISR woke the task.\n"); return TC_PASS; - } +} /******************************************************************************* * @@ -443,8 +440,8 @@ int testSemWait (void) * RETURNS: N/A */ -void main (void) - { +void main(void) +{ int rv; /* return value from tests */ TC_START ("Test Nanokernel Semaphores"); @@ -482,4 +479,4 @@ void main (void) doneTests: TC_END (rv, "%s - %s.\n", rv == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT (rv); - } +} diff --git a/samples/nanokernel/test/test_stack/src/stack.c b/samples/nanokernel/test/test_stack/src/stack.c index 40e489e8665..76781e4aaff 100644 --- a/samples/nanokernel/test/test_stack/src/stack.c +++ b/samples/nanokernel/test/test_stack/src/stack.c @@ -148,13 +148,13 @@ void testIsrStackFromTask(void); */ void initData(void) - { +{ for (int i=0; i< NUM_STACK_ELEMENT; i++) { myData[i] = (STARTNUM + i) * MULTIPLIER; myIsrData[i] = myData[i] + MYNUMBER; } - } /* initData */ +} /* initData */ /******************************************************************************* * @@ -163,19 +163,18 @@ void initData(void) * This routine is the ISR handler for _trigger_nano_isr_stack_push(). It adds * an item to the STACK in the context of an ISR. * +* \param parameter pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_stack_push - ( - void * parameter /* ptr to ISR handler parameter */ - ) - { +void isr_stack_push(void *parameter) +{ ISR_STACK_INFO * pInfo = (ISR_STACK_INFO *) parameter; nano_isr_stack_push (pInfo->channel, pInfo->data); - } /* isr_stack_push */ +} /* isr_stack_push */ /******************************************************************************* * @@ -185,14 +184,13 @@ void isr_stack_push * an item from the STACK in the context of an ISR. If the queue is empty, * it sets data to INVALID_DATA. * +* \param parameter pointer to ISR handler parameter +* * RETURNS: N/A */ -void isr_stack_pop - ( - void * parameter /* ptr to ISR handler parameter */ - ) - { +void isr_stack_pop(void *parameter) +{ ISR_STACK_INFO * pInfo = (ISR_STACK_INFO *) parameter; if ( nano_isr_stack_pop (pInfo->channel, &(pInfo->data)) == 0 ) @@ -201,7 +199,7 @@ void isr_stack_pop pInfo->data = INVALID_DATA; } - } /* isr_stack_pop */ +} /* isr_stack_pop */ /******************************************************************************* @@ -216,7 +214,7 @@ void isr_stack_pop */ void fiber1(void) - { +{ uint32_t data; /* data used to put and get from the stack queue */ int count = 0; /* counter */ @@ -251,7 +249,7 @@ void fiber1(void) /* Give semaphore to allow the main task to run */ nano_fiber_sem_give(&nanoSemObj); - } /* fiber1 */ +} /* fiber1 */ @@ -266,7 +264,7 @@ void fiber1(void) */ void testFiberStackPopW(void) - { +{ uint32_t data; /* data used to put and get from the stack queue */ TC_PRINT("Test Fiber STACK Pop Wait Interfaces\n\n"); @@ -300,7 +298,7 @@ void testFiberStackPopW(void) TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } /* testFiberStackPopW */ +} /* testFiberStackPopW */ /******************************************************************************* * @@ -315,7 +313,7 @@ void testFiberStackPopW(void) */ void testIsrStackFromFiber(void) - { +{ uint32_t result = INVALID_DATA; /* data used to put and get from the stack queue */ TC_PRINT("Test ISR STACK (invoked from Fiber)\n\n"); @@ -360,7 +358,7 @@ void testIsrStackFromFiber(void) TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } /* testIsrStackFromFiber */ +} /* testIsrStackFromFiber */ /******************************************************************************* * @@ -375,7 +373,7 @@ void testIsrStackFromFiber(void) */ void testIsrStackFromTask(void) - { +{ uint32_t result = INVALID_DATA; /* data used to put and get from the stack queue */ int count = 0; @@ -423,7 +421,7 @@ void testIsrStackFromTask(void) } TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } +} /******************************************************************************* * @@ -435,13 +433,13 @@ void testIsrStackFromTask(void) */ void fiber2(void) - { +{ testFiberStackPopW(); PRINT_LINE; testIsrStackFromFiber(); TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } +} /******************************************************************************* @@ -455,7 +453,7 @@ void fiber2(void) */ void testTaskStackPopW(void) - { +{ uint32_t data; /* data used to put and get from the stack queue */ PRINT_LINE; @@ -483,7 +481,7 @@ void testTaskStackPopW(void) nano_task_stack_push(&nanoStackObj2, data); TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); - } /* testTaskStackPopW */ +} /* testTaskStackPopW */ /******************************************************************************* * @@ -495,12 +493,12 @@ void testTaskStackPopW(void) * RETURNS: N/A */ -void fiber3 (void) - { +void fiber3(void) +{ nano_fiber_timer_start (&timer, SECONDS(1)); nano_fiber_timer_wait (&timer); nano_fiber_stack_push(&nanoStackObj, myData[0]); - } +} /******************************************************************************* * @@ -512,7 +510,7 @@ void fiber3 (void) */ void initNanoObjects(void) - { +{ struct isrInitInfo i = { {isr_stack_push, isr_stack_pop}, @@ -525,7 +523,7 @@ void initNanoObjects(void) nano_stack_init (&nanoStackObj2, stack2); nano_sem_init (&nanoSemObj); nano_timer_init (&timer, timerData); - } /* initNanoObjects */ +} /* initNanoObjects */ /******************************************************************************* * @@ -536,8 +534,8 @@ void initNanoObjects(void) * RETURNS: N/A */ -void main (void) - { +void main(void) +{ int count = 0; /* counter */ uint32_t data; /* data used to put and get from the stack queue */ @@ -625,4 +623,4 @@ void main (void) exit: TC_END(retCode, "%s - %s.\n", retCode == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT (retCode); - } +} diff --git a/samples/nanokernel/test/test_timer/src/timer.c b/samples/nanokernel/test/test_timer/src/timer.c index c75ea1285b3..49980dceace 100644 --- a/samples/nanokernel/test/test_timer/src/timer.c +++ b/samples/nanokernel/test/test_timer/src/timer.c @@ -94,15 +94,15 @@ static char fiber2Stack[FIBER2_STACKSIZE]; * RETURNS: N/A */ -void initNanoObjects (void) - { +void initNanoObjects(void) +{ nano_timer_init (&timer, timerData); nano_timer_init (&shortTimer, shortTimerData); nano_timer_init (&longTimer, longTimerData); nano_timer_init (&midTimer, midTimerData); nano_sem_init (&wakeTask); nano_sem_init (&wakeFiber); - } +} /******************************************************************************* * @@ -117,19 +117,21 @@ void initNanoObjects (void) * * This routine can be considered as testing nano_node_tick_get_32(), * nanoTimeElapsed() and nanoXXXTimerGetW() successful expiration cases. +* +* \param startRtn routine to start the timer +* \param waitRtn routine to get and wait for the timer +* \param getRtn routine to get the timer (no waiting) +* \param pTimer pointer to the timer +* \param pTimerData pointer to the expected timer data +* \param ticks number of ticks to wait +* * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int basicTimerWait - ( - timer_start_func startRtn, /* routine to start the timer */ - timer_getw_func waitRtn, /* routine to get and wait for the timer */ - timer_get_func getRtn, /* routine to get the timer (no waiting) */ - struct nano_timer *pTimer, /* ptr to the timer */ - void * pTimerData, /* ptr to the expected timer data */ - int ticks /* number of ticks to wait */ - ) - { +int basicTimerWait(timer_start_func startRtn, timer_getw_func waitRtn, + timer_get_func getRtn, struct nano_timer *pTimer, + void *pTimerData, int ticks) +{ uint64_t reftime; /* reference time for tick delta */ uint32_t tick; /* current tick */ uint32_t elapsed; /* # of elapsed ticks */ @@ -189,7 +191,7 @@ int basicTimerWait } return TC_PASS; - } +} /******************************************************************************* * @@ -203,14 +205,13 @@ int basicTimerWait * * Four timers are used so that the various paths can be tested. * +* \param startRtn routine to start the timers +* * RETURNS: N/A */ -void startTimers - ( - timer_start_func startRtn /* routine to start the timers */ - ) - { +void startTimers(timer_start_func startRtn) +{ int tick; /* current tick */ tick = nano_node_tick_get_32 (); @@ -223,7 +224,7 @@ void startTimers startRtn (&longTimer, LONG_TIMEOUT); startRtn (&shortTimer, SHORT_TIMEOUT); startRtn (&midTimer, MID_TIMEOUT); - } +} /******************************************************************************* * @@ -234,14 +235,13 @@ void startTimers * expire. The timers are expected to expire in the following order: * , , , * +* \param getRtn timer get routine (fiber or task) +* * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int busyWaitTimers - ( - timer_get_func getRtn /* timer get routine (fiber or task) */ - ) - { +int busyWaitTimers(timer_get_func getRtn) +{ int numExpired = 0; /* # of expired timers */ void * result; /* value returned from */ uint32_t ticks; /* tick by which time test should be complete */ @@ -301,7 +301,7 @@ int busyWaitTimers } return (nano_node_tick_get_32 () < ticks) ? TC_PASS : TC_FAIL; - } +} /******************************************************************************* * @@ -313,15 +313,14 @@ int busyWaitTimers * exercise the code that removes timers from important locations in the list; * these include the middle, the head, the tail, and the last item. * +* \param stopRtn routine to stop timer (fiber or task) +* \param getRtn timer get routine (fiber or task) +* * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int stopTimers - ( - timer_stop_func stopRtn, /* routine to stop timer (fiber or task) */ - timer_get_func getRtn /* timer get routine (fiber or task) */ - ) - { +int stopTimers(timer_stop_func stopRtn, timer_get_func getRtn) +{ int startTick; /* tick at which test starts */ int endTick; /* tick by which test should be completed */ @@ -349,7 +348,7 @@ int stopTimers } return TC_PASS; - } +} /******************************************************************************* * @@ -358,20 +357,19 @@ int stopTimers * The second fiber has a lower priority than the first, but is still given * precedence over the task. * +* \param arg1 unused +* \param arg2 unused +* * RETURNS: N/A */ -static void fiber2Entry - ( - int arg1, /* unused */ - int arg2 /* unused */ - ) - { +static void fiber2Entry(int arg1, int arg2) +{ ARG_UNUSED (arg1); ARG_UNUSED (arg2); nano_fiber_timer_stop (&timer); - } +} /******************************************************************************* * @@ -380,15 +378,14 @@ static void fiber2Entry * NOTE: The fiber portion of the tests have higher priority than the task * portion of the tests. * +* \param arg1 unused +* \param arg2 unused +* * RETURNS: N/A */ -static void fiberEntry - ( - int arg1, /* unused */ - int arg2 /* unused */ - ) - { +static void fiberEntry(int arg1, int arg2) +{ int rv; /* return value from a test */ void *result; /* return value from timer wait routine */ @@ -458,7 +455,7 @@ static void fiberEntry } nano_fiber_sem_give (&wakeTask); - } +} /******************************************************************************* * @@ -467,8 +464,8 @@ static void fiberEntry * RETURNS: TC_PASS on success, TC_FAIL on failure */ -int nano_node_cycle_get_32Test (void) - { +int nano_node_cycle_get_32Test(void) +{ uint32_t timeStamp1; uint32_t timeStamp2; int i; @@ -487,7 +484,7 @@ int nano_node_cycle_get_32Test (void) } return TC_PASS; - } +} /******************************************************************************* * @@ -498,8 +495,8 @@ int nano_node_cycle_get_32Test (void) * RETURNS: N/A */ -void main (void) - { +void main(void) +{ int rv; /* return value from tests */ TC_START ("Test Nanokernel Timer"); @@ -614,4 +611,4 @@ void main (void) doneTests: TC_END (rv, "%s - %s.\n", rv == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT (rv); - } +}