mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-01-11 18:33:16 +01:00
Add support for architectures with stack alignment requirements in preparation for various 32 bit ports.
NOTE: The atomThreadCreate() and atmoOSInit() APIs have changed to take stack_bottom rather than stack_top and to allow optional stack-checking on a per-thread basis.
This commit is contained in:
committed by
Himanshu Chauhan
parent
f686c6527a
commit
d5a8c186b0
@@ -62,7 +62,7 @@ typedef struct atom_tcb
|
||||
|
||||
/* Details used if thread stack-checking is required */
|
||||
#ifdef ATOM_STACK_CHECKING
|
||||
POINTER stack_top; /* Pointer to top of stack allocation */
|
||||
POINTER stack_bottom; /* Pointer to bottom of stack allocation */
|
||||
uint32_t stack_size; /* Size of stack allocation in bytes */
|
||||
#endif
|
||||
|
||||
@@ -98,7 +98,7 @@ extern uint8_t atomOSStarted;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
extern uint8_t atomOSInit (void *idle_thread_stack_top, uint32_t stack_size);
|
||||
extern uint8_t atomOSInit (void *idle_thread_stack_bottom, uint32_t idle_thread_stack_size, uint8_t idle_thread_stack_check);
|
||||
extern void atomOSStart (void);
|
||||
|
||||
extern void atomSched (uint8_t timer_tick);
|
||||
@@ -113,7 +113,7 @@ extern ATOM_TCB *tcbDequeuePriority (ATOM_TCB **tcb_queue_ptr, uint8_t priority)
|
||||
|
||||
extern ATOM_TCB *atomCurrentContext (void);
|
||||
|
||||
extern uint8_t atomThreadCreate (ATOM_TCB *tcb_ptr, uint8_t priority, void (*entry_point)(uint32_t), uint32_t entry_param, void *stack_top, uint32_t stack_size);
|
||||
extern uint8_t atomThreadCreate (ATOM_TCB *tcb_ptr, uint8_t priority, void (*entry_point)(uint32_t), uint32_t entry_param, void *stack_bottom, uint32_t stack_size, uint8_t stack_check);
|
||||
extern uint8_t atomThreadStackCheck (ATOM_TCB *tcb_ptr, uint32_t *used_bytes, uint32_t *free_bytes);
|
||||
|
||||
extern ATOM_TCB *archContextSwitch (ATOM_TCB *old_tcb_ptr, ATOM_TCB *new_tcb_ptr);
|
||||
|
||||
@@ -369,25 +369,31 @@ static void atomThreadSwitch(ATOM_TCB *old_tcb, ATOM_TCB *new_tcb)
|
||||
* new thread may be scheduled in before the function returns.
|
||||
*
|
||||
* Optionally prefills the thread stack with a known value to enable stack
|
||||
* usage checking (if the ATOM_STACK_CHECKING macro is defined).
|
||||
* usage checking (if the ATOM_STACK_CHECKING macro is defined and
|
||||
* stack_check parameter is set to TRUE).
|
||||
*
|
||||
* @param[in] tcb_ptr Pointer to the thread's TCB storage
|
||||
* @param[in] priority Priority of the thread (0 to 255)
|
||||
* @param[in] entry_point Thread entry point
|
||||
* @param[in] entry_param Parameter passed to thread entry point
|
||||
* @param[in] stack_top Top of the stack area
|
||||
* @param[in] stack_bottom Bottom of the stack area
|
||||
* @param[in] stack_size Size of the stack area in bytes
|
||||
* @param[in] stack_check TRUE to enable stack checking for this thread
|
||||
*
|
||||
* @retval ATOM_OK Success
|
||||
* @retval ATOM_ERR_PARAM Bad parameters
|
||||
* @retval ATOM_ERR_QUEUE Error putting the thread on the ready queue
|
||||
*/
|
||||
uint8_t atomThreadCreate (ATOM_TCB *tcb_ptr, uint8_t priority, void (*entry_point)(uint32_t), uint32_t entry_param, void *stack_top, uint32_t stack_size)
|
||||
uint8_t atomThreadCreate (ATOM_TCB *tcb_ptr, uint8_t priority, void (*entry_point)(uint32_t), uint32_t entry_param, void *stack_bottom, uint32_t stack_size, uint8_t stack_check)
|
||||
{
|
||||
CRITICAL_STORE;
|
||||
uint8_t status;
|
||||
uint8_t *stack_top;
|
||||
#ifdef ATOM_STACK_CHECKING
|
||||
int32_t count;
|
||||
#endif
|
||||
|
||||
if ((tcb_ptr == NULL) || (entry_point == NULL) || (stack_top == NULL)
|
||||
if ((tcb_ptr == NULL) || (entry_point == NULL) || (stack_bottom == NULL)
|
||||
|| (stack_size == 0))
|
||||
{
|
||||
/* Bad parameters */
|
||||
@@ -411,6 +417,13 @@ uint8_t atomThreadCreate (ATOM_TCB *tcb_ptr, uint8_t priority, void (*entry_poin
|
||||
tcb_ptr->entry_point = entry_point;
|
||||
tcb_ptr->entry_param = entry_param;
|
||||
|
||||
/**
|
||||
* Calculate a pointer to the topmost stack entry, suitably aligned
|
||||
* for the architecture. This may discard the top few bytes if the
|
||||
* stack size is not a multiple of the stack entry/alignment size.
|
||||
*/
|
||||
stack_top = (uint8_t *)stack_bottom + (stack_size & ~(STACK_ALIGN_SIZE - 1)) - STACK_ALIGN_SIZE;
|
||||
|
||||
/**
|
||||
* Additional processing only required if stack-checking is
|
||||
* enabled. Incurs a slight overhead on each thread creation
|
||||
@@ -418,25 +431,29 @@ uint8_t atomThreadCreate (ATOM_TCB *tcb_ptr, uint8_t priority, void (*entry_poin
|
||||
* compiled out if not desired.
|
||||
*/
|
||||
#ifdef ATOM_STACK_CHECKING
|
||||
|
||||
/* Store the stack details for use by the stack-check function */
|
||||
tcb_ptr->stack_top = stack_top;
|
||||
tcb_ptr->stack_size = stack_size;
|
||||
|
||||
/**
|
||||
* Prefill the stack with a known value. This is used later in
|
||||
* calls to atomThreadStackCheck() to get an indication of how
|
||||
* much stack has been used during runtime.
|
||||
*/
|
||||
while (stack_size > 0)
|
||||
/* Set up stack-checking if enabled for this thread */
|
||||
if (stack_check)
|
||||
{
|
||||
/* Initialise all stack bytes from bottom up to 0x5A */
|
||||
*((uint8_t *)stack_top - (stack_size - 1)) = STACK_CHECK_BYTE;
|
||||
stack_size--;
|
||||
/* Store the stack details for use by the stack-check function */
|
||||
tcb_ptr->stack_bottom = stack_bottom;
|
||||
tcb_ptr->stack_size = stack_size;
|
||||
|
||||
/**
|
||||
* Prefill the stack with a known value. This is used later in
|
||||
* calls to atomThreadStackCheck() to get an indication of how
|
||||
* much stack has been used during runtime.
|
||||
*/
|
||||
count = (int32_t)stack_size;
|
||||
while (count > 0)
|
||||
{
|
||||
/* Initialise all stack bytes from top down to 0x5A */
|
||||
*((uint8_t *)stack_bottom + (count - 1)) = STACK_CHECK_BYTE;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Avoid compiler warnings due to unused stack_size variable */
|
||||
stack_size = stack_size;
|
||||
/* Avoid compiler warning due to unused parameter */
|
||||
stack_check = stack_check;
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -528,10 +545,10 @@ uint8_t atomThreadStackCheck (ATOM_TCB *tcb_ptr, uint32_t *used_bytes, uint32_t
|
||||
else
|
||||
{
|
||||
/**
|
||||
* Starting at the far end, count the unmodified areas until a
|
||||
* Starting at the bottom end, count the unmodified areas until a
|
||||
* modified byte is found.
|
||||
*/
|
||||
stack_ptr = (uint8_t *)tcb_ptr->stack_top - (tcb_ptr->stack_size - 1);
|
||||
stack_ptr = (uint8_t *)tcb_ptr->stack_bottom;
|
||||
for (i = 0; i < tcb_ptr->stack_size; i++)
|
||||
{
|
||||
/* Loop until a modified byte is found */
|
||||
@@ -647,13 +664,14 @@ ATOM_TCB *atomCurrentContext (void)
|
||||
* operating system facilities are being initialised. They are normally
|
||||
* enabled by the archFirstThreadRestore() routine in the architecture port.
|
||||
*
|
||||
* @param[in] idle_thread_stack_top Ptr to top of stack area for idle thread
|
||||
* @param[in] idle_thread_stack_bottom Ptr to bottom of stack for idle thread
|
||||
* @param[in] idle_thread_stack_size Size of idle thread stack in bytes
|
||||
* @param[in] idle_thread_stack_check TRUE if stack checking required on idle thread
|
||||
*
|
||||
* @retval ATOM_OK Success
|
||||
* @retval ATOM_ERROR Initialisation error
|
||||
*/
|
||||
uint8_t atomOSInit (void *idle_thread_stack_top, uint32_t idle_thread_stack_size)
|
||||
uint8_t atomOSInit (void *idle_thread_stack_bottom, uint32_t idle_thread_stack_size, uint8_t idle_thread_stack_check)
|
||||
{
|
||||
uint8_t status;
|
||||
|
||||
@@ -667,8 +685,9 @@ uint8_t atomOSInit (void *idle_thread_stack_top, uint32_t idle_thread_stack_size
|
||||
IDLE_THREAD_PRIORITY,
|
||||
atomIdleThread,
|
||||
0,
|
||||
idle_thread_stack_top,
|
||||
idle_thread_stack_size);
|
||||
idle_thread_stack_bottom,
|
||||
idle_thread_stack_size,
|
||||
idle_thread_stack_check);
|
||||
|
||||
/* Return status */
|
||||
return (status);
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
*/
|
||||
#define NULL ((void *)(0))
|
||||
|
||||
/* Size of each stack entry / stack alignment size (e.g. 8 bits) */
|
||||
#define STACK_ALIGN_SIZE sizeof(unsigned char)
|
||||
|
||||
/**
|
||||
* Architecture-specific types.
|
||||
* Uses the stdint.h naming convention, so if stdint.h is available on the
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
/* Required number of system ticks per second (normally 100 for 10ms tick) */
|
||||
#define SYSTEM_TICKS_PER_SEC 100
|
||||
|
||||
/* Size of each stack entry / stack alignment size (8 bits on AVR) */
|
||||
#define STACK_ALIGN_SIZE sizeof(uint8_t)
|
||||
|
||||
/**
|
||||
* Architecture-specific types.
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
* stack for application code local variables etc.
|
||||
*
|
||||
* With all OS tests implemented to date on the AVR, the Main thread
|
||||
* stack has not exceeded 198 bytes. To allow all tests to run we set
|
||||
* stack has not exceeded 201 bytes. To allow all tests to run we set
|
||||
* a minimum main thread stack size of 204 bytes. This may increase in
|
||||
* future as the codebase changes but for the time being is enough to
|
||||
* cope with all of the automated tests.
|
||||
@@ -167,17 +167,15 @@ int main ( void )
|
||||
/**
|
||||
* Initialise the OS before creating our threads.
|
||||
*
|
||||
* Note that we tell the OS that the idle stack is half its actual
|
||||
* size. This prevents it prefilling the bottom half with known
|
||||
* values for stack-checkig purposes, which we cannot allow because
|
||||
* we are temporarily using it for our own stack. The remainder will
|
||||
* still be available once the OS is started, this only prevents the
|
||||
* OS from prefilling it.
|
||||
* Note that we cannot enable stack-checking on the idle thread on
|
||||
* this platform because we are already using part of the idle
|
||||
* thread's stack now as our startup stack. Prefilling for stack
|
||||
* checking would overwrite our current stack.
|
||||
*
|
||||
* If you are not reusing the idle thread's stack during startup then
|
||||
* you should pass in the correct size here.
|
||||
* you are free to enable stack-checking here.
|
||||
*/
|
||||
status = atomOSInit(&idle_thread_stack[IDLE_STACK_SIZE_BYTES - 1], (IDLE_STACK_SIZE_BYTES/2));
|
||||
status = atomOSInit(&idle_thread_stack[0], IDLE_STACK_SIZE_BYTES, FALSE);
|
||||
if (status == ATOM_OK)
|
||||
{
|
||||
/* Enable the system tick timer */
|
||||
@@ -186,8 +184,9 @@ int main ( void )
|
||||
/* Create an application thread */
|
||||
status = atomThreadCreate(&main_tcb,
|
||||
TEST_THREAD_PRIO, main_thread_func, 0,
|
||||
&main_thread_stack[MAIN_STACK_SIZE_BYTES - 1],
|
||||
MAIN_STACK_SIZE_BYTES);
|
||||
&main_thread_stack[0],
|
||||
MAIN_STACK_SIZE_BYTES,
|
||||
TRUE);
|
||||
if (status == ATOM_OK)
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
/* Required number of system ticks per second (normally 100 for 10ms tick) */
|
||||
#define SYSTEM_TICKS_PER_SEC 100
|
||||
|
||||
/* Size of each stack entry / stack alignment size (8 bits on STM8) */
|
||||
#define STACK_ALIGN_SIZE sizeof(u8)
|
||||
|
||||
/**
|
||||
* Architecture-specific types.
|
||||
|
||||
@@ -139,7 +139,7 @@ NO_REG_SAVE void main ( void )
|
||||
*/
|
||||
|
||||
/* Initialise the OS before creating our threads */
|
||||
status = atomOSInit(&idle_thread_stack[IDLE_STACK_SIZE_BYTES - 1], IDLE_STACK_SIZE_BYTES);
|
||||
status = atomOSInit(&idle_thread_stack[0], IDLE_STACK_SIZE_BYTES, TRUE);
|
||||
if (status == ATOM_OK)
|
||||
{
|
||||
/* Enable the system tick timer */
|
||||
@@ -148,8 +148,9 @@ NO_REG_SAVE void main ( void )
|
||||
/* Create an application thread */
|
||||
status = atomThreadCreate(&main_tcb,
|
||||
TEST_THREAD_PRIO, main_thread_func, 0,
|
||||
&main_thread_stack[MAIN_STACK_SIZE_BYTES - 1],
|
||||
MAIN_STACK_SIZE_BYTES);
|
||||
&main_thread_stack[0],
|
||||
MAIN_STACK_SIZE_BYTES,
|
||||
TRUE);
|
||||
if (status == ATOM_OK)
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -63,8 +63,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* atomThreadCreate: Pass a bad TCB pointer */
|
||||
if (atomThreadCreate (NULL, TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
&test_thread_stack[TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_ERR_PARAM)
|
||||
&test_thread_stack[0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_ERR_PARAM)
|
||||
{
|
||||
ATOMLOG (_STR("Bad TCB check\n"));
|
||||
failures++;
|
||||
@@ -72,8 +72,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* atomThreadCreate: Pass a bad entry point */
|
||||
if (atomThreadCreate (&tcb1, TEST_THREAD_PRIO, NULL, 0,
|
||||
&test_thread_stack[TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_ERR_PARAM)
|
||||
&test_thread_stack[0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_ERR_PARAM)
|
||||
{
|
||||
ATOMLOG (_STR("Bad entry check\n"));
|
||||
failures++;
|
||||
@@ -81,7 +81,7 @@ uint32_t test_start (void)
|
||||
|
||||
/* atomThreadCreate: Pass a bad stack pointer */
|
||||
if (atomThreadCreate (&tcb1, TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
NULL, TEST_THREAD_STACK_SIZE) != ATOM_ERR_PARAM)
|
||||
NULL, TEST_THREAD_STACK_SIZE, TRUE) != ATOM_ERR_PARAM)
|
||||
{
|
||||
ATOMLOG (_STR("Bad stack ptr check\n"));
|
||||
failures++;
|
||||
@@ -89,7 +89,7 @@ uint32_t test_start (void)
|
||||
|
||||
/* atomThreadCreate: Pass a bad stack size */
|
||||
if (atomThreadCreate (&tcb1, TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
&test_thread_stack[TEST_THREAD_STACK_SIZE - 1], 0) != ATOM_ERR_PARAM)
|
||||
&test_thread_stack[0], 0, TRUE) != ATOM_ERR_PARAM)
|
||||
{
|
||||
ATOMLOG (_STR("Bad stack size check\n"));
|
||||
failures++;
|
||||
|
||||
@@ -98,8 +98,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create low priority thread */
|
||||
if (atomThreadCreate (&tcb[0], 253, test_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
@@ -107,8 +107,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create high priority thread */
|
||||
else if (atomThreadCreate (&tcb[1], 252, test_thread_func, 1,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
|
||||
@@ -100,29 +100,29 @@ uint32_t test_start (void)
|
||||
* a spell in which this thread was run.
|
||||
*/
|
||||
if (atomThreadCreate (&tcb[0], TEST_THREAD_PRIO + 1, test_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[1], TEST_THREAD_PRIO + 1, test_thread_func, 1,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[2], TEST_THREAD_PRIO + 1, test_thread_func, 2,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate (&tcb[3], TEST_THREAD_PRIO + 1, test_thread_func, 3,
|
||||
&test_thread_stack[3][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
ATOMLOG (_STR("Bad thread create\n"));
|
||||
failures++;
|
||||
|
||||
@@ -136,8 +136,8 @@ uint32_t test_start (void)
|
||||
}
|
||||
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test1_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -199,8 +199,8 @@ uint32_t test_start (void)
|
||||
}
|
||||
|
||||
else if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test2_thread_func, 0,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
|
||||
@@ -143,8 +143,8 @@ uint32_t test_start (void)
|
||||
/* Create a test thread, the sole purpose of which is to own mutex2 */
|
||||
g_owned = 0;
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
|
||||
@@ -111,8 +111,8 @@ uint32_t test_start (void)
|
||||
{
|
||||
/* Create Thread 1 (lower priority thread A) */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO+1, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -124,8 +124,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 2 (lower priority thread B) */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO+1, test_thread_func, 2,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -137,8 +137,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 3 (higher priority thread A) */
|
||||
if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 3,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -150,8 +150,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 4 (higher priority thread B) */
|
||||
if (atomThreadCreate(&tcb[3], TEST_THREAD_PRIO, test_thread_func, 4,
|
||||
&test_thread_stack[3][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -100,8 +100,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 1 */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -112,8 +112,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 2 */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 2,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -124,8 +124,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 3 */
|
||||
if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 3,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -136,8 +136,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 4 */
|
||||
if (atomThreadCreate(&tcb[3], TEST_THREAD_PRIO, test_thread_func, 4,
|
||||
&test_thread_stack[3][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -94,8 +94,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create second thread */
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -99,8 +99,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create second thread */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -93,8 +93,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create second thread */
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -93,8 +93,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 1 */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -103,8 +103,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 2 */
|
||||
else if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
@@ -113,8 +113,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 3 */
|
||||
else if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 2,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 3\n"));
|
||||
|
||||
@@ -87,8 +87,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create second thread */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -89,8 +89,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create a test thread that will block because the queue is empty */
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test1_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -146,8 +146,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create a test thread that will block because the queue is empty */
|
||||
else if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test2_thread_func, 0,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
|
||||
@@ -106,8 +106,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create a test thread that will block because the queue is full */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test1_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -177,8 +177,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create a test thread that will block because the queue is full */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test2_thread_func, 0,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
|
||||
@@ -114,8 +114,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 1 (lower priority thread A) */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO+1, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -127,8 +127,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 2 (lower priority thread B) */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO+1, test_thread_func, 2,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -140,8 +140,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 3 (higher priority thread A) */
|
||||
if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 3,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -153,8 +153,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 4 (higher priority thread B) */
|
||||
if (atomThreadCreate(&tcb[3], TEST_THREAD_PRIO, test_thread_func, 4,
|
||||
&test_thread_stack[3][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -106,8 +106,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create a test thread that will block because the queue is empty */
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO + 1, test1_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
|
||||
@@ -93,8 +93,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 1 */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -103,8 +103,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 2 */
|
||||
else if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
@@ -113,8 +113,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 3 */
|
||||
else if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 2,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 3\n"));
|
||||
|
||||
@@ -102,8 +102,8 @@ uint32_t test_start (void)
|
||||
{
|
||||
/* Create Thread 1 */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -114,8 +114,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 2 */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 2,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -126,8 +126,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 3 */
|
||||
if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 3,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -138,8 +138,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 4 */
|
||||
if (atomThreadCreate(&tcb[3], TEST_THREAD_PRIO, test_thread_func, 4,
|
||||
&test_thread_stack[3][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -133,8 +133,8 @@ uint32_t test_start (void)
|
||||
}
|
||||
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test1_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -200,8 +200,8 @@ uint32_t test_start (void)
|
||||
failures++;
|
||||
}
|
||||
else if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test2_thread_func, 0,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
|
||||
16
tests/sem3.c
16
tests/sem3.c
@@ -102,8 +102,8 @@ uint32_t test_start (void)
|
||||
{
|
||||
/* Create Thread 1 (lower priority thread A) */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO+1, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -115,8 +115,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 2 (lower priority thread B) */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO+1, test_thread_func, 2,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -128,8 +128,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 3 (higher priority thread A) */
|
||||
if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 3,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -141,8 +141,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 4 (higher priority thread B) */
|
||||
if (atomThreadCreate(&tcb[3], TEST_THREAD_PRIO, test_thread_func, 4,
|
||||
&test_thread_stack[3][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
16
tests/sem4.c
16
tests/sem4.c
@@ -96,8 +96,8 @@ uint32_t test_start (void)
|
||||
{
|
||||
/* Create Thread 1 */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -108,8 +108,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 2 */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 2,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -120,8 +120,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 3 */
|
||||
if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 3,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
@@ -132,8 +132,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 4 */
|
||||
if (atomThreadCreate(&tcb[3], TEST_THREAD_PRIO, test_thread_func, 4,
|
||||
&test_thread_stack[3][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[3][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -83,8 +83,8 @@ uint32_t test_start (void)
|
||||
{
|
||||
/* Create second thread */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -93,8 +93,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create second thread */
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
@@ -99,8 +99,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create second thread */
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread\n"));
|
||||
|
||||
12
tests/sem8.c
12
tests/sem8.c
@@ -109,8 +109,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create thread 1: Higher priority than main thread so should sleep */
|
||||
else if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO - 1, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -119,8 +119,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create thread 2: Same priority as main thread so should not sleep */
|
||||
else if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
@@ -129,8 +129,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create thread 3: Same priority as main thread so should not sleep */
|
||||
else if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO + 1, test_thread_func, 0,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 3\n"));
|
||||
|
||||
12
tests/sem9.c
12
tests/sem9.c
@@ -86,8 +86,8 @@ uint32_t test_start (void)
|
||||
{
|
||||
/* Create test thread 1 */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 0,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 1\n"));
|
||||
@@ -96,8 +96,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 2 */
|
||||
else if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 2\n"));
|
||||
@@ -106,8 +106,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create test thread 3 */
|
||||
else if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 2,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Error creating test thread 3\n"));
|
||||
|
||||
@@ -72,8 +72,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 1 */
|
||||
if (atomThreadCreate(&tcb[0], TEST_THREAD_PRIO, test_thread_func, 1,
|
||||
&test_thread_stack[0][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[0][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Thread1\n"));
|
||||
@@ -82,8 +82,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 2 */
|
||||
if (atomThreadCreate(&tcb[1], TEST_THREAD_PRIO, test_thread_func, 2,
|
||||
&test_thread_stack[1][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[1][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Thread2\n"));
|
||||
@@ -92,8 +92,8 @@ uint32_t test_start (void)
|
||||
|
||||
/* Create Thread 3 */
|
||||
if (atomThreadCreate(&tcb[2], TEST_THREAD_PRIO, test_thread_func, 3,
|
||||
&test_thread_stack[2][TEST_THREAD_STACK_SIZE - 1],
|
||||
TEST_THREAD_STACK_SIZE) != ATOM_OK)
|
||||
&test_thread_stack[2][0],
|
||||
TEST_THREAD_STACK_SIZE, TRUE) != ATOM_OK)
|
||||
{
|
||||
/* Fail */
|
||||
ATOMLOG (_STR("Thread3\n"));
|
||||
|
||||
Reference in New Issue
Block a user