[PATCH 6/6] basdefs.h: Add and use RTEMS_PACKED
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Oct 16 06:59:35 UTC 2015
---
c/src/lib/libbsp/i386/pc386/include/edid.h | 20 ++++++++++----------
c/src/lib/libbsp/i386/pc386/include/vbe3.h | 14 +++++++-------
.../libbsp/i386/shared/realmode_int/realmode_int.c | 4 ++--
.../libbsp/i386/shared/realmode_int/realmode_int.h | 2 +-
c/src/lib/libcpu/i386/cpu.h | 2 +-
cpukit/score/include/rtems/score/basedefs.h | 7 +++++--
6 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/c/src/lib/libbsp/i386/pc386/include/edid.h b/c/src/lib/libbsp/i386/pc386/include/edid.h
index 1120296..b8c00b1 100644
--- a/c/src/lib/libbsp/i386/pc386/include/edid.h
+++ b/c/src/lib/libbsp/i386/pc386/include/edid.h
@@ -87,7 +87,7 @@ typedef struct {
uint8_t HorizontalBorder;
uint8_t VerticalBorder;
uint8_t Flags;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_detailed_timing_descriptor;
+} RTEMS_PACKED EDID_detailed_timing_descriptor;
EDID_INLINE_ROUTINE uint16_t DTD_horizontal_active (
EDID_detailed_timing_descriptor *dtd)
@@ -165,7 +165,7 @@ typedef struct {
uint8_t ColorPointWhite_x;
uint8_t ColorPointWhite_y;
uint8_t ColorPointWhiteGamma;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_color_point_data;
+} RTEMS_PACKED EDID_color_point_data;
/* Basic Display Parameters */
/* Monitor Descriptor - Data Type Tag */
@@ -183,7 +183,7 @@ typedef struct {
/* see VESA, Generalized Timing Formula Standard - GTF
Version 1.0, December 18, 1996 */
uint8_t GTFStandard[8];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_monitor_range_limits;
+} RTEMS_PACKED EDID_monitor_range_limits;
#define EDID_DTT_MonitorName 0xFC
@@ -225,11 +225,11 @@ typedef struct {
uint8_t AddressableLinesLow;
uint8_t AspectRatio_AddressableLinesHigh;
uint8_t VerticalRate_PreferredVerticalRate;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_CVT_3_byte_code_descriptor;
+} RTEMS_PACKED EDID_CVT_3_byte_code_descriptor;
typedef struct {
uint8_t VersionNumber;
EDID_CVT_3_byte_code_descriptor cvt[4];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_CVT_timing_codes_3B;
+} RTEMS_PACKED EDID_CVT_timing_codes_3B;
EDID_INLINE_ROUTINE uint16_t edid1_CVT_addressable_lines_high (
EDID_CVT_3_byte_code_descriptor *cvt)
@@ -251,7 +251,7 @@ EDID_INLINE_ROUTINE uint8_t edid1_CVT_aspect_ratio (
typedef struct {
uint8_t RevisionNumber;
uint8_t EST_III[12];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_established_timings_III;
+} RTEMS_PACKED EDID_established_timings_III;
enum EST_III {
EST_1152x864_75Hz = 0,
EST_1024x768_85Hz = 1,
@@ -313,12 +313,12 @@ typedef struct {
uint8_t DataTypeTag;
uint8_t Flag2;
uint8_t DescriptorData[13];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_monitor_descriptor;
+} RTEMS_PACKED EDID_monitor_descriptor;
union EDID_DTD_MD {
EDID_detailed_timing_descriptor dtd;
EDID_monitor_descriptor md;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE;
+} RTEMS_PACKED;
#define EDID1_STI_ImageAspectRatioOff 0
#define EDID1_STI_ImageAspectRatioMask 0x3
@@ -333,7 +333,7 @@ union EDID_DTD_MD {
typedef struct {
uint8_t HorizontalActivePixels;
uint8_t ImageAspectRatio_RefreshRate;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_standard_timing_identification;
+} RTEMS_PACKED EDID_standard_timing_identification;
/* Video Input Definition */
/* Analog = 0, Digital = 1 */
@@ -446,7 +446,7 @@ typedef struct {
union EDID_DTD_MD dtd_md[4];
uint8_t ExtensionFlag;
uint8_t Checksum;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_edid1;
+} RTEMS_PACKED EDID_edid1;
EDID_INLINE_ROUTINE uint16_t edid1_RedX (EDID_edid1 *edid) {
return (edid->RedXHigh<<2) | (edid->GreenRedLow>>6);
diff --git a/c/src/lib/libbsp/i386/pc386/include/vbe3.h b/c/src/lib/libbsp/i386/pc386/include/vbe3.h
index 06f614f..b62ab6f 100644
--- a/c/src/lib/libbsp/i386/pc386/include/vbe3.h
+++ b/c/src/lib/libbsp/i386/pc386/include/vbe3.h
@@ -179,7 +179,7 @@ typedef struct {
/** @brief Selector or Segment depending on whether this is used from 16bit
protected mode or from real mode. */
uint16_t selector;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_far_pointer;
+} RTEMS_PACKED VBE_far_pointer;
/**
* @brief Protected mode info block as defined by VBE standard.
@@ -205,7 +205,7 @@ typedef struct {
uint8_t InProtectMode;
/** Checksum byte for structure. Sum over all structure bytes gives 0. */
uint8_t Checksum;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_protected_mode_info_block;
+} RTEMS_PACKED VBE_protected_mode_info_block;
/** General VBE signature */
#define VBE_SIGNATURE "VESA"
@@ -243,7 +243,7 @@ typedef struct {
uint8_t Reserved[222];
/** Data Area for OEM Strings */
uint8_t OemData[256];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_vbe_info_block;
+} RTEMS_PACKED VBE_vbe_info_block;
/**
* @brief Describes graphic's mode parameter.
@@ -345,7 +345,7 @@ typedef struct {
uint32_t MaxPixelClock;
/** remainder of VBE_mode_info_block */
uint8_t Reserved3[189];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_mode_info_block;
+} RTEMS_PACKED VBE_mode_info_block;
/**
* @brief Describes monitor synchronization.
@@ -371,7 +371,7 @@ typedef struct {
uint16_t RefreshRate;
/** remainder of VBE_mode_info_block */
uint8_t Reserved[40];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_CRTC_info_block;
+} RTEMS_PACKED VBE_CRTC_info_block;
/**
* @brief Describes palette entry.
@@ -385,7 +385,7 @@ typedef struct {
uint8_t Red;
/** DWORD alignment byte (unused) */
uint8_t Alignment;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_palette_entry;
+} RTEMS_PACKED VBE_palette_entry;
/**
* @brief Supplemental VBE info block.
@@ -409,7 +409,7 @@ typedef struct {
uint8_t *OemStringPtr;
/** Reserved for description strings and future expansion */
uint8_t Reserved[221];
-} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_supplemental_vbe_info_block;
+} RTEMS_PACKED VBE_supplemental_vbe_info_block;
/* VBE_vbe_info_block Capabilities */
/** VBE Info Block - Capabilities\n
diff --git a/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.c b/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.c
index 6836af3..58c39c8 100644
--- a/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.c
+++ b/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.c
@@ -70,7 +70,7 @@ typedef struct {
to 32bit protected mode */
uint16_t pm_code_selector;
/* if this struct is to be modified update offset definitions as well */
-} RTEMS_COMPILER_PACKED_ATTRIBUTE rm_int_regs_bkp_param;
+} RTEMS_PACKED rm_int_regs_bkp_param;
/* offsets to \a pm_bkp_and_param */
#define BKP_IDTR_LIM "0x00"
@@ -113,7 +113,7 @@ typedef struct {
uint16_t rm_stack_pointer;
/** data segment for real mode */
uint16_t rm_data_segment;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE pm_bkp_and_param;
+} RTEMS_PACKED pm_bkp_and_param;
/* addresses where we are going to put Interrupt buffer,
* parameter/returned/preserved values, stack and copy code
diff --git a/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h b/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h
index 6f77ec9..a6b067d 100644
--- a/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h
+++ b/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h
@@ -51,7 +51,7 @@ typedef struct {
uint16_t reg_es;
uint16_t reg_fs;
uint16_t reg_gs;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE i386_realmode_interrupt_registers;
+} RTEMS_PACKED i386_realmode_interrupt_registers;
/**
* @brief Returns buffer and its size usable with real mode interrupt call.
diff --git a/c/src/lib/libcpu/i386/cpu.h b/c/src/lib/libcpu/i386/cpu.h
index 0242e27..c0c4756 100644
--- a/c/src/lib/libcpu/i386/cpu.h
+++ b/c/src/lib/libcpu/i386/cpu.h
@@ -260,7 +260,7 @@ typedef struct {
unsigned int operation_size : 1;
unsigned int granularity : 1;
unsigned int base_address_31_24 : 8;
-} RTEMS_COMPILER_PACKED_ATTRIBUTE segment_descriptors;
+} RTEMS_PACKED segment_descriptors;
/*
* C callable function enabling to get easilly usable info from
diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index 3b6723e..7e282c1 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -230,11 +230,14 @@
* placed so that the least memory is used.
*/
#if defined(__GNUC__)
- #define RTEMS_COMPILER_PACKED_ATTRIBUTE __attribute__((packed))
+ #define RTEMS_PACKED __attribute__((__packed__))
#else
- #define RTEMS_COMPILER_PACKED_ATTRIBUTE
+ #define RTEMS_PACKED
#endif
+/* Provided for backward compatibility */
+#define RTEMS_COMPILER_PACKED_ATTRIBUTE RTEMS_PACKED
+
#if __cplusplus >= 201103L
#define RTEMS_STATIC_ASSERT(cond, msg) \
static_assert(cond, # msg)
--
1.8.4.5
More information about the devel
mailing list