git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9309 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
30f7b5e868
commit
f7ef558614
|
@ -21,8 +21,8 @@
|
|||
/*
|
||||
* Blinker thread #1.
|
||||
*/
|
||||
static THD_WORKING_AREA(waThread1, 128);
|
||||
static THD_FUNCTION(Thread1, arg) {
|
||||
THD_WORKING_AREA(waThread1, 128);
|
||||
THD_FUNCTION(Thread1, arg) {
|
||||
|
||||
(void)arg;
|
||||
|
||||
|
@ -50,8 +50,8 @@ static THD_FUNCTION(Thread1, arg) {
|
|||
/*
|
||||
* Blinker thread #2.
|
||||
*/
|
||||
static THD_WORKING_AREA(waThread2, 128);
|
||||
static THD_FUNCTION(Thread2, arg) {
|
||||
THD_WORKING_AREA(waThread2, 128);
|
||||
THD_FUNCTION(Thread2, arg) {
|
||||
|
||||
(void)arg;
|
||||
|
||||
|
|
|
@ -60,23 +60,10 @@
|
|||
/*
|
||||
* Working Area size of test threads.
|
||||
*/
|
||||
#define WA_SIZE THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE)
|
||||
#define WA_SIZE MEM_ALIGN_NEXT(THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE), \
|
||||
PORT_WORKING_AREA_ALIGN)
|
||||
|
||||
/*
|
||||
* Union of all Working Areas, usable as a single large buffer if required.
|
||||
*/
|
||||
union test_buffers {
|
||||
struct {
|
||||
THD_WORKING_AREA(T0, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T1, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T2, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T3, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T4, THREADS_STACK_SIZE);
|
||||
} wa;
|
||||
uint8_t buffer[WA_SIZE * 5];
|
||||
};
|
||||
|
||||
extern union test_buffers test;
|
||||
extern uint8_t test_buffer[WA_SIZE * 5];
|
||||
extern thread_t *threads[MAX_THREADS];
|
||||
extern void * ROMCONST wa[5];
|
||||
|
||||
|
@ -86,10 +73,9 @@ systime_t test_wait_tick(void);]]></value>
|
|||
</global_definitions>
|
||||
<global_code>
|
||||
<value><![CDATA[/*
|
||||
* Static working areas, the following areas can be used for threads or
|
||||
* used as temporary buffers.
|
||||
* Global test buffer holding 5 working areas.
|
||||
*/
|
||||
union test_buffers test;
|
||||
ALIGNED_VAR(PORT_WORKING_AREA_ALIGN) uint8_t test_buffer[WA_SIZE * 5];
|
||||
|
||||
/*
|
||||
* Pointers to the spawned threads.
|
||||
|
@ -99,8 +85,11 @@ thread_t *threads[MAX_THREADS];
|
|||
/*
|
||||
* Pointers to the working areas.
|
||||
*/
|
||||
void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2,
|
||||
test.wa.T3, test.wa.T4};
|
||||
void * ROMCONST wa[5] = {test_buffer + (WA_SIZE * 0),
|
||||
test_buffer + (WA_SIZE * 1),
|
||||
test_buffer + (WA_SIZE * 2),
|
||||
test_buffer + (WA_SIZE * 3),
|
||||
test_buffer + (WA_SIZE * 4)};
|
||||
|
||||
/*
|
||||
* Sets a termination request in all the test-spawned threads.
|
||||
|
@ -3575,8 +3564,7 @@ test_assert(chPoolAlloc(&mp1) == NULL, "provider returned memory");]]></value>
|
|||
<value><![CDATA[#define ALLOC_SIZE 16
|
||||
#define HEAP_SIZE (ALLOC_SIZE * 8)
|
||||
|
||||
static memory_heap_t test_heap;
|
||||
static CH_HEAP_AREA(myheap, HEAP_SIZE);]]></value>
|
||||
memory_heap_t test_heap;]]></value>
|
||||
</shared_code>
|
||||
<cases>
|
||||
<case>
|
||||
|
@ -3591,7 +3579,7 @@ static CH_HEAP_AREA(myheap, HEAP_SIZE);]]></value>
|
|||
</condition>
|
||||
<various_code>
|
||||
<setup_code>
|
||||
<value><![CDATA[chHeapObjectInit(&test_heap, myheap, sizeof(myheap));]]></value>
|
||||
<value><![CDATA[chHeapObjectInit(&test_heap, test_buffer, sizeof(test_buffer));]]></value>
|
||||
</setup_code>
|
||||
<teardown_code>
|
||||
<value />
|
||||
|
@ -3621,7 +3609,7 @@ size_t n, sz;]]></value>
|
|||
<value />
|
||||
</tags>
|
||||
<code>
|
||||
<value><![CDATA[p1 = chHeapAlloc(&test_heap, HEAP_SIZE * 2);
|
||||
<value><![CDATA[p1 = chHeapAlloc(&test_heap, sizeof test_buffer * 2);
|
||||
test_assert(p1 == NULL, "allocation not failed");]]></value>
|
||||
</code>
|
||||
</step>
|
||||
|
@ -3850,7 +3838,7 @@ The test expects the first two threads to successfully start and the third one t
|
|||
</condition>
|
||||
<various_code>
|
||||
<setup_code>
|
||||
<value><![CDATA[chHeapObjectInit(&heap1, test.buffer, sizeof(union test_buffers));]]></value>
|
||||
<value><![CDATA[chHeapObjectInit(&heap1, test_buffer, sizeof test_buffer);]]></value>
|
||||
</setup_code>
|
||||
<teardown_code>
|
||||
<value />
|
||||
|
|
|
@ -91,10 +91,9 @@ const testcase_t * const *test_suite[] = {
|
|||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* Static working areas, the following areas can be used for threads or
|
||||
* used as temporary buffers.
|
||||
* Global test buffer holding 5 working areas.
|
||||
*/
|
||||
union test_buffers test;
|
||||
ALIGNED_VAR(PORT_WORKING_AREA_ALIGN) uint8_t test_buffer[WA_SIZE * 5];
|
||||
|
||||
/*
|
||||
* Pointers to the spawned threads.
|
||||
|
@ -104,8 +103,11 @@ thread_t *threads[MAX_THREADS];
|
|||
/*
|
||||
* Pointers to the working areas.
|
||||
*/
|
||||
void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2,
|
||||
test.wa.T3, test.wa.T4};
|
||||
void * ROMCONST wa[5] = {test_buffer + (WA_SIZE * 0),
|
||||
test_buffer + (WA_SIZE * 1),
|
||||
test_buffer + (WA_SIZE * 2),
|
||||
test_buffer + (WA_SIZE * 3),
|
||||
test_buffer + (WA_SIZE * 4)};
|
||||
|
||||
/*
|
||||
* Sets a termination request in all the test-spawned threads.
|
||||
|
|
|
@ -82,23 +82,10 @@ extern "C" {
|
|||
/*
|
||||
* Working Area size of test threads.
|
||||
*/
|
||||
#define WA_SIZE THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE)
|
||||
#define WA_SIZE MEM_ALIGN_NEXT(THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE), \
|
||||
PORT_WORKING_AREA_ALIGN)
|
||||
|
||||
/*
|
||||
* Union of all Working Areas, usable as a single large buffer if required.
|
||||
*/
|
||||
union test_buffers {
|
||||
struct {
|
||||
THD_WORKING_AREA(T0, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T1, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T2, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T3, THREADS_STACK_SIZE);
|
||||
THD_WORKING_AREA(T4, THREADS_STACK_SIZE);
|
||||
} wa;
|
||||
uint8_t buffer[WA_SIZE * 5];
|
||||
};
|
||||
|
||||
extern union test_buffers test;
|
||||
extern uint8_t test_buffer[WA_SIZE * 5];
|
||||
extern thread_t *threads[MAX_THREADS];
|
||||
extern void * ROMCONST wa[5];
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@
|
|||
#define ALLOC_SIZE 16
|
||||
#define HEAP_SIZE (ALLOC_SIZE * 8)
|
||||
|
||||
static memory_heap_t test_heap;
|
||||
static CH_HEAP_AREA(myheap, HEAP_SIZE);
|
||||
memory_heap_t test_heap;
|
||||
|
||||
/****************************************************************************
|
||||
* Test cases.
|
||||
|
@ -89,7 +88,7 @@ static CH_HEAP_AREA(myheap, HEAP_SIZE);
|
|||
*/
|
||||
|
||||
static void test_010_001_setup(void) {
|
||||
chHeapObjectInit(&test_heap, myheap, sizeof(myheap));
|
||||
chHeapObjectInit(&test_heap, test_buffer, sizeof(test_buffer));
|
||||
}
|
||||
|
||||
static void test_010_001_execute(void) {
|
||||
|
@ -107,7 +106,7 @@ static void test_010_001_execute(void) {
|
|||
an error is expected.*/
|
||||
test_set_step(2);
|
||||
{
|
||||
p1 = chHeapAlloc(&test_heap, HEAP_SIZE * 2);
|
||||
p1 = chHeapAlloc(&test_heap, sizeof test_buffer * 2);
|
||||
test_assert(p1 == NULL, "allocation not failed");
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ static THD_FUNCTION(dyn_thread1, p) {
|
|||
*/
|
||||
|
||||
static void test_011_001_setup(void) {
|
||||
chHeapObjectInit(&heap1, test.buffer, sizeof(union test_buffers));
|
||||
chHeapObjectInit(&heap1, test_buffer, sizeof test_buffer);
|
||||
}
|
||||
|
||||
static void test_011_001_execute(void) {
|
||||
|
|
Loading…
Reference in New Issue