basdefs.h: Add and use RTEMS_PACKED

This commit is contained in:
Sebastian Huber
2015-10-16 08:26:44 +02:00
parent f97536dcd3
commit bc792bb3bd
6 changed files with 26 additions and 23 deletions

View File

@@ -87,7 +87,7 @@ typedef struct {
uint8_t HorizontalBorder; uint8_t HorizontalBorder;
uint8_t VerticalBorder; uint8_t VerticalBorder;
uint8_t Flags; 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_INLINE_ROUTINE uint16_t DTD_horizontal_active (
EDID_detailed_timing_descriptor *dtd) EDID_detailed_timing_descriptor *dtd)
@@ -165,7 +165,7 @@ typedef struct {
uint8_t ColorPointWhite_x; uint8_t ColorPointWhite_x;
uint8_t ColorPointWhite_y; uint8_t ColorPointWhite_y;
uint8_t ColorPointWhiteGamma; uint8_t ColorPointWhiteGamma;
} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_color_point_data; } RTEMS_PACKED EDID_color_point_data;
/* Basic Display Parameters */ /* Basic Display Parameters */
/* Monitor Descriptor - Data Type Tag */ /* Monitor Descriptor - Data Type Tag */
@@ -183,7 +183,7 @@ typedef struct {
/* see VESA, Generalized Timing Formula Standard - GTF /* see VESA, Generalized Timing Formula Standard - GTF
Version 1.0, December 18, 1996 */ Version 1.0, December 18, 1996 */
uint8_t GTFStandard[8]; uint8_t GTFStandard[8];
} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_monitor_range_limits; } RTEMS_PACKED EDID_monitor_range_limits;
#define EDID_DTT_MonitorName 0xFC #define EDID_DTT_MonitorName 0xFC
@@ -225,11 +225,11 @@ typedef struct {
uint8_t AddressableLinesLow; uint8_t AddressableLinesLow;
uint8_t AspectRatio_AddressableLinesHigh; uint8_t AspectRatio_AddressableLinesHigh;
uint8_t VerticalRate_PreferredVerticalRate; uint8_t VerticalRate_PreferredVerticalRate;
} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_CVT_3_byte_code_descriptor; } RTEMS_PACKED EDID_CVT_3_byte_code_descriptor;
typedef struct { typedef struct {
uint8_t VersionNumber; uint8_t VersionNumber;
EDID_CVT_3_byte_code_descriptor cvt[4]; 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_INLINE_ROUTINE uint16_t edid1_CVT_addressable_lines_high (
EDID_CVT_3_byte_code_descriptor *cvt) EDID_CVT_3_byte_code_descriptor *cvt)
@@ -251,7 +251,7 @@ EDID_INLINE_ROUTINE uint8_t edid1_CVT_aspect_ratio (
typedef struct { typedef struct {
uint8_t RevisionNumber; uint8_t RevisionNumber;
uint8_t EST_III[12]; uint8_t EST_III[12];
} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_established_timings_III; } RTEMS_PACKED EDID_established_timings_III;
enum EST_III { enum EST_III {
EST_1152x864_75Hz = 0, EST_1152x864_75Hz = 0,
EST_1024x768_85Hz = 1, EST_1024x768_85Hz = 1,
@@ -313,12 +313,12 @@ typedef struct {
uint8_t DataTypeTag; uint8_t DataTypeTag;
uint8_t Flag2; uint8_t Flag2;
uint8_t DescriptorData[13]; uint8_t DescriptorData[13];
} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_monitor_descriptor; } RTEMS_PACKED EDID_monitor_descriptor;
union EDID_DTD_MD { union EDID_DTD_MD {
EDID_detailed_timing_descriptor dtd; EDID_detailed_timing_descriptor dtd;
EDID_monitor_descriptor md; EDID_monitor_descriptor md;
} RTEMS_COMPILER_PACKED_ATTRIBUTE; } RTEMS_PACKED;
#define EDID1_STI_ImageAspectRatioOff 0 #define EDID1_STI_ImageAspectRatioOff 0
#define EDID1_STI_ImageAspectRatioMask 0x3 #define EDID1_STI_ImageAspectRatioMask 0x3
@@ -333,7 +333,7 @@ union EDID_DTD_MD {
typedef struct { typedef struct {
uint8_t HorizontalActivePixels; uint8_t HorizontalActivePixels;
uint8_t ImageAspectRatio_RefreshRate; uint8_t ImageAspectRatio_RefreshRate;
} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_standard_timing_identification; } RTEMS_PACKED EDID_standard_timing_identification;
/* Video Input Definition */ /* Video Input Definition */
/* Analog = 0, Digital = 1 */ /* Analog = 0, Digital = 1 */
@@ -446,7 +446,7 @@ typedef struct {
union EDID_DTD_MD dtd_md[4]; union EDID_DTD_MD dtd_md[4];
uint8_t ExtensionFlag; uint8_t ExtensionFlag;
uint8_t Checksum; uint8_t Checksum;
} RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_edid1; } RTEMS_PACKED EDID_edid1;
EDID_INLINE_ROUTINE uint16_t edid1_RedX (EDID_edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_RedX (EDID_edid1 *edid) {
return (edid->RedXHigh<<2) | (edid->GreenRedLow>>6); return (edid->RedXHigh<<2) | (edid->GreenRedLow>>6);

View File

@@ -179,7 +179,7 @@ typedef struct {
/** @brief Selector or Segment depending on whether this is used from 16bit /** @brief Selector or Segment depending on whether this is used from 16bit
protected mode or from real mode. */ protected mode or from real mode. */
uint16_t selector; 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. * @brief Protected mode info block as defined by VBE standard.
@@ -205,7 +205,7 @@ typedef struct {
uint8_t InProtectMode; uint8_t InProtectMode;
/** Checksum byte for structure. Sum over all structure bytes gives 0. */ /** Checksum byte for structure. Sum over all structure bytes gives 0. */
uint8_t Checksum; uint8_t Checksum;
} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_protected_mode_info_block; } RTEMS_PACKED VBE_protected_mode_info_block;
/** General VBE signature */ /** General VBE signature */
#define VBE_SIGNATURE "VESA" #define VBE_SIGNATURE "VESA"
@@ -243,7 +243,7 @@ typedef struct {
uint8_t Reserved[222]; uint8_t Reserved[222];
/** Data Area for OEM Strings */ /** Data Area for OEM Strings */
uint8_t OemData[256]; uint8_t OemData[256];
} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_vbe_info_block; } RTEMS_PACKED VBE_vbe_info_block;
/** /**
* @brief Describes graphic's mode parameter. * @brief Describes graphic's mode parameter.
@@ -345,7 +345,7 @@ typedef struct {
uint32_t MaxPixelClock; uint32_t MaxPixelClock;
/** remainder of VBE_mode_info_block */ /** remainder of VBE_mode_info_block */
uint8_t Reserved3[189]; uint8_t Reserved3[189];
} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_mode_info_block; } RTEMS_PACKED VBE_mode_info_block;
/** /**
* @brief Describes monitor synchronization. * @brief Describes monitor synchronization.
@@ -371,7 +371,7 @@ typedef struct {
uint16_t RefreshRate; uint16_t RefreshRate;
/** remainder of VBE_mode_info_block */ /** remainder of VBE_mode_info_block */
uint8_t Reserved[40]; uint8_t Reserved[40];
} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_CRTC_info_block; } RTEMS_PACKED VBE_CRTC_info_block;
/** /**
* @brief Describes palette entry. * @brief Describes palette entry.
@@ -385,7 +385,7 @@ typedef struct {
uint8_t Red; uint8_t Red;
/** DWORD alignment byte (unused) */ /** DWORD alignment byte (unused) */
uint8_t Alignment; uint8_t Alignment;
} RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_palette_entry; } RTEMS_PACKED VBE_palette_entry;
/** /**
* @brief Supplemental VBE info block. * @brief Supplemental VBE info block.
@@ -409,7 +409,7 @@ typedef struct {
uint8_t *OemStringPtr; uint8_t *OemStringPtr;
/** Reserved for description strings and future expansion */ /** Reserved for description strings and future expansion */
uint8_t Reserved[221]; 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_vbe_info_block Capabilities */
/** VBE Info Block - Capabilities\n /** VBE Info Block - Capabilities\n

View File

@@ -70,7 +70,7 @@ typedef struct {
to 32bit protected mode */ to 32bit protected mode */
uint16_t pm_code_selector; uint16_t pm_code_selector;
/* if this struct is to be modified update offset definitions as well */ /* 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 */ /* offsets to \a pm_bkp_and_param */
#define BKP_IDTR_LIM "0x00" #define BKP_IDTR_LIM "0x00"
@@ -113,7 +113,7 @@ typedef struct {
uint16_t rm_stack_pointer; uint16_t rm_stack_pointer;
/** data segment for real mode */ /** data segment for real mode */
uint16_t rm_data_segment; 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, /* addresses where we are going to put Interrupt buffer,
* parameter/returned/preserved values, stack and copy code * parameter/returned/preserved values, stack and copy code

View File

@@ -51,7 +51,7 @@ typedef struct {
uint16_t reg_es; uint16_t reg_es;
uint16_t reg_fs; uint16_t reg_fs;
uint16_t reg_gs; 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. * @brief Returns buffer and its size usable with real mode interrupt call.

View File

@@ -260,7 +260,7 @@ typedef struct {
unsigned int operation_size : 1; unsigned int operation_size : 1;
unsigned int granularity : 1; unsigned int granularity : 1;
unsigned int base_address_31_24 : 8; 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 * C callable function enabling to get easilly usable info from

View File

@@ -230,11 +230,14 @@
* placed so that the least memory is used. * placed so that the least memory is used.
*/ */
#if defined(__GNUC__) #if defined(__GNUC__)
#define RTEMS_COMPILER_PACKED_ATTRIBUTE __attribute__((packed)) #define RTEMS_PACKED __attribute__((__packed__))
#else #else
#define RTEMS_COMPILER_PACKED_ATTRIBUTE #define RTEMS_PACKED
#endif #endif
/* Provided for backward compatibility */
#define RTEMS_COMPILER_PACKED_ATTRIBUTE RTEMS_PACKED
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#define RTEMS_STATIC_ASSERT(cond, msg) \ #define RTEMS_STATIC_ASSERT(cond, msg) \
static_assert(cond, # msg) static_assert(cond, # msg)