From 3ad7602ef237319eb320488f090df786a9c03423 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 20 Dec 1999 15:21:31 +0000 Subject: Modifications to avoid having the size of the Buffer_addresses array too small when OPERATION_COUNT is less than 10. --- c/src/tests/tmtests/tm20/task1.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'c/src/tests/tmtests') diff --git a/c/src/tests/tmtests/tm20/task1.c b/c/src/tests/tmtests/tm20/task1.c index 162a99c8d1..34247ead95 100644 --- a/c/src/tests/tmtests/tm20/task1.c +++ b/c/src/tests/tmtests/tm20/task1.c @@ -12,6 +12,7 @@ #define TEST_INIT #include "system.h" +#include rtems_device_major_number _STUB_major = 1; @@ -19,18 +20,23 @@ rtems_id Region_id; rtems_name Region_name; rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; +#define PARTITION_SIZE 2048 +#define PARTITION_ELEMENT_SIZE 128 +#define PARTITION_BUFFER_POINTERS \ + ((PARTITION_SIZE / PARTITION_ELEMENT_SIZE) + 2) + rtems_id Partition_id; rtems_name Partition_name; -rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; +rtems_unsigned8 Partition_area[ PARTITION_SIZE ] CPU_STRUCTURE_ALIGNMENT; -void *Buffer_address_1; -void *Buffer_address_2; -void *Buffer_address_3; -void *Buffer_address_4; +void *Buffer_address_1; +void *Buffer_address_2; +void *Buffer_address_3; +void *Buffer_address_4; rtems_unsigned32 buffer_count; -void *Buffer_addresses[ OPERATION_COUNT+1 ]; +void *Buffer_addresses[ PARTITION_BUFFER_POINTERS ]; rtems_task Task_1( rtems_task_argument argument @@ -95,7 +101,7 @@ rtems_task Task_1( rtems_partition_create( Partition_name, Partition_area, - 2048, + PARTITION_SIZE, 128, RTEMS_DEFAULT_ATTRIBUTES, &Partition_id @@ -154,6 +160,8 @@ rtems_task Task_1( if ( status == RTEMS_UNSATISFIED ) break; buffer_count++; + + assert( buffer_count < PARTITION_BUFFER_POINTERS ); } Timer_initialize(); @@ -209,7 +217,7 @@ rtems_task Task_1( RTEMS_NO_TIMEOUT, &Buffer_address_2 ); - directive_failed( status, "region_get_semgent" ); + directive_failed( status, "region_get_segment" ); Timer_initialize(); (void) rtems_region_get_segment( -- cgit v1.2.3