[rtems commit] rtems: Add RTEMS_PARTITION_ALIGNMENT

Sebastian Huber sebh at rtems.org
Wed Oct 7 06:11:38 UTC 2020


Module:    rtems
Branch:    master
Commit:    97e9728306a692ce7870db29c6b5d86dd9560692
Changeset: http://git.rtems.org/rtems/commit/?id=97e9728306a692ce7870db29c6b5d86dd9560692

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Sep 30 14:21:32 2020 +0200

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 5a64843..a3c3128 100644
--- a/cpukit/include/rtems/rtems/part.h
+++ b/cpukit/include/rtems/rtems/part.h
@@ -36,6 +36,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
  *
  *  Partition Manager
diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index d2811b4..6d7a227 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 <rtems/confdefs.h>
 
-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 3937385..a2297d5 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
   );



More information about the vc mailing list