From 97e9728306a692ce7870db29c6b5d86dd9560692 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 30 Sep 2020 14:21:32 +0200 Subject: rtems: Add RTEMS_PARTITION_ALIGNMENT Update #4105. --- cpukit/include/rtems/rtems/part.h | 9 +++++++++ testsuites/psxtests/psxconfig01/init.c | 2 +- testsuites/sptests/sppartition_err01/init.c | 17 +++++++++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/cpukit/include/rtems/rtems/part.h b/cpukit/include/rtems/rtems/part.h index 5a6484329f..a3c3128a00 100644 --- a/cpukit/include/rtems/rtems/part.h +++ b/cpukit/include/rtems/rtems/part.h @@ -35,6 +35,15 @@ extern "C" { */ /**@{*/ +/** + * @brief This constant defines the minimum alignment of a partition buffer in + * bytes. + * + * Use it with RTEMS_ALIGNED() to define the alignment of partition buffer + * types or statically allocated partition buffer areas. + */ +#define RTEMS_PARTITION_ALIGNMENT CPU_SIZEOF_POINTER + /** * @brief RTEMS Partition Create * diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c index d2811b409a..6d7a227793 100644 --- a/testsuites/psxtests/psxconfig01/init.c +++ b/testsuites/psxtests/psxconfig01/init.c @@ -186,7 +186,7 @@ static rtems_task Init(rtems_task_argument argument); #include -typedef struct { +typedef struct RTEMS_ALIGNED(RTEMS_PARTITION_ALIGNMENT) { uint64_t data [16]; } area; diff --git a/testsuites/sptests/sppartition_err01/init.c b/testsuites/sptests/sppartition_err01/init.c index 39373852fb..a2297d53cc 100644 --- a/testsuites/sptests/sppartition_err01/init.c +++ b/testsuites/sptests/sppartition_err01/init.c @@ -16,17 +16,18 @@ const char rtems_test_name[] = "SPPARTITION_ERR 1"; -uint32_t Other_Memory; +static uint32_t Other_Memory; -TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */ -TEST_EXTERN rtems_id Partition_id[ 2 ]; /* array of partition ids */ +static rtems_name Partition_name[ 2 ]; /* array of partition names */ -TEST_EXTERN uint8_t Partition_good_area[256] CPU_STRUCTURE_ALIGNMENT; -#define Partition_bad_area (void *) 0x00000005 +static rtems_id Partition_id[ 2 ]; /* array of partition ids */ + +static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t + Partition_good_area[ 256 ]; -void test_partition_errors(void); +#define Partition_bad_area (void *) 0x00000005 -void test_partition_errors(void) +static void test_partition_errors(void) { void *buffer_address_1; void *buffer_address_2; @@ -152,7 +153,7 @@ void test_partition_errors(void) Partition_name[ 1 ], Partition_good_area, 128, - 35, + RTEMS_PARTITION_ALIGNMENT - 1, RTEMS_DEFAULT_ATTRIBUTES, &junk_id ); -- cgit v1.2.3