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