mirror of https://github.com/rusefi/ChibiOS.git
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9054 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
742a1d93c8
commit
1c8b3555ba
|
@ -50,11 +50,8 @@ int main(void) {
|
|||
/* OS initialization.*/
|
||||
(void) OS_API_Init();
|
||||
|
||||
/* Activates the serial driver 2 using the driver default configuration.
|
||||
PA2(TX) and PA3(RX) are routed to USART2.*/
|
||||
/* Activates the serial driver 1 using the driver default configuration.*/
|
||||
sdStart(&SD1, NULL);
|
||||
palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7));
|
||||
palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7));
|
||||
|
||||
/* GPIOI1 is programmed as output (board LED).*/
|
||||
palClearLine(LINE_ARD_D13);
|
||||
|
|
|
@ -44,7 +44,7 @@ THD_WORKING_AREA(wa_test4, TASKS_STACK_SIZE);]]></value>
|
|||
<value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to threading.</value>
|
||||
</description>
|
||||
<shared_code>
|
||||
<value><![CDATA[#include "osapi.h"
|
||||
<value><![CDATA[#include "osapi.h"
|
||||
|
||||
static void test_thread1(void) {
|
||||
|
||||
|
@ -60,18 +60,25 @@ static void test_thread3(void) {
|
|||
|
||||
test_emit_token('C');
|
||||
}
|
||||
|
||||
static void test_thread4(void) {
|
||||
|
||||
test_emit_token('D');
|
||||
}
|
||||
|
||||
static void test_thread_delete(void) {
|
||||
|
||||
static void test_thread4(void) {
|
||||
|
||||
test_emit_token('D');
|
||||
}
|
||||
|
||||
static void delete_handler(void) {
|
||||
|
||||
test_emit_token('C');
|
||||
}
|
||||
|
||||
static void test_thread_delete(void) {
|
||||
|
||||
test_emit_token('A');
|
||||
(void) OS_TaskInstallDeleteHandler(delete_handler);
|
||||
while (!OS_TaskDeleteCheck()) {
|
||||
OS_TaskDelay(1);
|
||||
}
|
||||
test_emit_token('A');
|
||||
(void) OS_TaskDelay(1);
|
||||
}
|
||||
test_emit_token('B');
|
||||
}]]></value>
|
||||
</shared_code>
|
||||
<cases>
|
||||
|
@ -528,9 +535,9 @@ test_assert_sequence("ABCD", "task order violation");]]></value>
|
|||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[int32 err;
|
||||
|
||||
err = OS_TaskDelete((uint32)-1);
|
||||
<value><![CDATA[int32 err;
|
||||
|
||||
err = OS_TaskDelete((uint32)-1);
|
||||
test_assert(err == OS_ERR_INVALID_ID, "wrong task id not detected");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
|
@ -554,10 +561,47 @@ test_assert(err == OS_ERR_INVALID_ID, "wrong task id not detected");]]></value>
|
|||
<value />
|
||||
</teardown_code>
|
||||
<local_variables>
|
||||
<value />
|
||||
<value><![CDATA[uint32 tid;]]></value>
|
||||
</local_variables>
|
||||
</various_code>
|
||||
<steps />
|
||||
<steps>
|
||||
<step>
|
||||
<description>
|
||||
<value>Creating a task executing an infinite loop.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[int32 err;
|
||||
|
||||
err = OS_TaskCreate(&tid,
|
||||
"deletable thread",
|
||||
test_thread_delete,
|
||||
(uint32 *)wa_test1,
|
||||
sizeof wa_test1,
|
||||
TASKS_BASE_PRIORITY,
|
||||
0);
|
||||
test_assert(err == OS_SUCCESS, "deletable task creation failed");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
<step>
|
||||
<description>
|
||||
<value>Letting the task run for a while then deleting it. A check is performed on the correct execution of the delete handler.</value>
|
||||
</description>
|
||||
<tags>
|
||||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[int32 err;
|
||||
|
||||
(void) OS_TaskDelay(50);
|
||||
err = OS_TaskDelete(tid);
|
||||
test_assert(err == OS_SUCCESS, "delete failed");
|
||||
test_assert_sequence("ABC", "events order violation");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
</steps>
|
||||
</case>
|
||||
</cases>
|
||||
</sequence>
|
||||
|
|
|
@ -61,12 +61,19 @@ static void test_thread4(void) {
|
|||
test_emit_token('D');
|
||||
}
|
||||
|
||||
static void delete_handler(void) {
|
||||
|
||||
test_emit_token('C');
|
||||
}
|
||||
|
||||
static void test_thread_delete(void) {
|
||||
|
||||
while (!OS_TaskDeleteCheck()) {
|
||||
OS_TaskDelay(1);
|
||||
}
|
||||
test_emit_token('A');
|
||||
(void) OS_TaskInstallDeleteHandler(delete_handler);
|
||||
while (!OS_TaskDeleteCheck()) {
|
||||
(void) OS_TaskDelay(1);
|
||||
}
|
||||
test_emit_token('B');
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -498,9 +505,41 @@ static const testcase_t test_001_003 = {
|
|||
* functionality.
|
||||
*
|
||||
* <h2>Test Steps</h2>
|
||||
* - Creating a task executing an infinite loop.
|
||||
* - Letting the task run for a while then deleting it. A check is
|
||||
* performed on the correct execution of the delete handler.
|
||||
* .
|
||||
*/
|
||||
|
||||
static void test_001_004_execute(void) {
|
||||
uint32 tid;
|
||||
|
||||
/* Creating a task executing an infinite loop.*/
|
||||
test_set_step(1);
|
||||
{
|
||||
int32 err;
|
||||
|
||||
err = OS_TaskCreate(&tid,
|
||||
"deletable thread",
|
||||
test_thread_delete,
|
||||
(uint32 *)wa_test1,
|
||||
sizeof wa_test1,
|
||||
TASKS_BASE_PRIORITY,
|
||||
0);
|
||||
test_assert(err == OS_SUCCESS, "deletable task creation failed");
|
||||
}
|
||||
|
||||
/* Letting the task run for a while then deleting it. A check is
|
||||
performed on the correct execution of the delete handler.*/
|
||||
test_set_step(2);
|
||||
{
|
||||
int32 err;
|
||||
|
||||
(void) OS_TaskDelay(50);
|
||||
err = OS_TaskDelete(tid);
|
||||
test_assert(err == OS_SUCCESS, "delete failed");
|
||||
test_assert_sequence("ABC", "events order violation");
|
||||
}
|
||||
}
|
||||
|
||||
static const testcase_t test_001_004 = {
|
||||
|
|
Loading…
Reference in New Issue