Merged in AVyhovanec/nuttx (pull request #190)

packed_struct replaced by begin_packed_struct and end_packed_struct
This commit is contained in:
Gregory Nutt 2017-01-09 07:32:41 -06:00
commit 3f6e476fb4
9 changed files with 59 additions and 52 deletions

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/x86/include/i486/arch.h * arch/x86/include/i486/arch.h
* *
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -317,7 +317,7 @@
/* This structure defines one segment */ /* This structure defines one segment */
struct gdt_entry_s begin_packed_struct struct gdt_entry_s
{ {
uint16_t lowlimit; /* The lower 16 bits of the limit */ uint16_t lowlimit; /* The lower 16 bits of the limit */
uint16_t lowbase; /* The lower 16 bits of the base */ uint16_t lowbase; /* The lower 16 bits of the base */
@ -325,17 +325,17 @@ struct gdt_entry_s
uint8_t access; /* Access flags, determine ring segment can be used in */ uint8_t access; /* Access flags, determine ring segment can be used in */
uint8_t granularity; uint8_t granularity;
uint8_t hibase; /* The last 8 bits of the base */ uint8_t hibase; /* The last 8 bits of the base */
} packed_struct; } end_packed_struct;
/* This structure refers to the array of GDT entries, and is in the format /* This structure refers to the array of GDT entries, and is in the format
* required by the lgdt instruction. * required by the lgdt instruction.
*/ */
struct gdt_ptr_s begin_packed_struct struct gdt_ptr_s
{ {
uint16_t limit; /* The upper 16 bits of all selector limits */ uint16_t limit; /* The upper 16 bits of all selector limits */
uint32_t base; /* The address of the first GDT entry */ uint32_t base; /* The address of the first GDT entry */
} packed_struct; } end_packed_struct;
/* IDT data structures ****************************************************** /* IDT data structures ******************************************************
* *
@ -344,24 +344,24 @@ struct gdt_ptr_s
* processor to determine the correct response to interrupts and exceptions. * processor to determine the correct response to interrupts and exceptions.
*/ */
struct idt_entry_s begin_packed_struct struct idt_entry_s
{ {
uint16_t lobase; /* Lower 16-bits of vector address for interrupt */ uint16_t lobase; /* Lower 16-bits of vector address for interrupt */
uint16_t sel; /* Kernel segment selector */ uint16_t sel; /* Kernel segment selector */
uint8_t zero; /* This must always be zero */ uint8_t zero; /* This must always be zero */
uint8_t flags; /* (See documentation) */ uint8_t flags; /* (See documentation) */
uint16_t hibase; /* Upper 16-bits of vector address for interrupt */ uint16_t hibase; /* Upper 16-bits of vector address for interrupt */
} packed_struct; } end_packed_struct;
/* A struct describing a pointer to an array of interrupt handlers. This is /* A struct describing a pointer to an array of interrupt handlers. This is
* in a format suitable for giving to 'lidt'. * in a format suitable for giving to 'lidt'.
*/ */
struct idt_ptr_s begin_packed_struct struct idt_ptr_s
{ {
uint16_t limit; uint16_t limit;
uint32_t base; /* The address of the first GDT entry */ uint32_t base; /* The address of the first GDT entry */
} packed_struct; } end_packed_struct;
/**************************************************************************** /****************************************************************************
* Inline functions * Inline functions

View File

@ -119,7 +119,7 @@
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
struct pn532_frame begin_packed_struct struct pn532_frame
{ {
uint8_t preamble; /* 0x00 */ uint8_t preamble; /* 0x00 */
uint16_t start_code; /* 0x00FF (BE) -> 0xFF00 (LE) */ uint16_t start_code; /* 0x00FF (BE) -> 0xFF00 (LE) */
@ -130,22 +130,22 @@ struct pn532_frame
uint8_t tfi; /* Frame idenfifier 0xD4, 0xD5 */ uint8_t tfi; /* Frame idenfifier 0xD4, 0xD5 */
uint8_t data[]; /* LEN-1 bytes of Packet Data Information. uint8_t data[]; /* LEN-1 bytes of Packet Data Information.
* The first byte PD0 is the Command Code */ * The first byte PD0 is the Command Code */
} packed_struct; } end_packed_struct;
struct pn_poll_response begin_packed_struct struct pn_poll_response
{ {
uint8_t nbtg; uint8_t nbtg;
uint8_t tg; uint8_t tg;
uint8_t target_data[]; uint8_t target_data[];
} packed_struct; } end_packed_struct;
struct pn_target_type_a begin_packed_struct struct pn_target_type_a
{ {
uint16_t sens_res; uint16_t sens_res;
uint8_t sel_res; uint8_t sel_res;
uint8_t nfcid_len; uint8_t nfcid_len;
uint8_t nfcid_data[]; uint8_t nfcid_data[];
} packed_struct; } end_packed_struct;
struct pn_firmware_version struct pn_firmware_version
{ {

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* drivers/mtd/mtd_config.c * drivers/mtd/mtd_config.c
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2013 Ken Pettit. All rights reserved. * Copyright (C) 2013 Ken Pettit. All rights reserved.
* Author: Ken Pettit <pettitkd@gmail.com> * Author: Ken Pettit <pettitkd@gmail.com>
* With Updates from Gregory Nutt <gnutt@nuttx.org> * With Updates from Gregory Nutt <gnutt@nuttx.org>
@ -101,13 +101,13 @@ struct mtdconfig_struct_s
FAR uint8_t *buffer; /* Temp block read buffer */ FAR uint8_t *buffer; /* Temp block read buffer */
}; };
struct mtdconfig_header_s begin_packed_struct struct mtdconfig_header_s
{ {
uint8_t flags; /* Entry control flags */ uint8_t flags; /* Entry control flags */
uint8_t instance; /* Instance of the item */ uint8_t instance; /* Instance of the item */
uint16_t id; /* ID of the config data item */ uint16_t id; /* ID of the config data item */
uint16_t len; /* Length of the data block */ uint16_t len; /* Length of the data block */
} packed_struct; } end_packed_struct;
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* include/nuttx/analog/adc.h * include/nuttx/analog/adc.h
* *
* Copyright (C) 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2011 Li Zhuoyi. All rights reserved. * Copyright (C) 2011 Li Zhuoyi. All rights reserved.
* Author: Li Zhuoyi <lzyy.cn@gmail.com> * Author: Li Zhuoyi <lzyy.cn@gmail.com>
* Gregory Nutt <gnutt@nuttx.org> * Gregory Nutt <gnutt@nuttx.org>
@ -103,11 +103,11 @@ struct adc_callback_s
/* This describes on ADC message */ /* This describes on ADC message */
struct adc_msg_s begin_packed_struct struct adc_msg_s
{ {
uint8_t am_channel; /* The 8-bit ADC Channel */ uint8_t am_channel; /* The 8-bit ADC Channel */
int32_t am_data; /* ADC convert result (4 bytes) */ int32_t am_data; /* ADC convert result (4 bytes) */
} packed_struct; } end_packed_struct;
/* This describes a FIFO of ADC messages */ /* This describes a FIFO of ADC messages */

View File

@ -1,6 +1,7 @@
/************************************************************************************ /************************************************************************************
* include/nuttx/analog/dac.h * include/nuttx/analog/dac.h
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2011 Li Zhuoyi. All rights reserved. * Copyright (C) 2011 Li Zhuoyi. All rights reserved.
* Author: Li Zhuoyi <lzyy.cn@gmail.com> * Author: Li Zhuoyi <lzyy.cn@gmail.com>
* History: 0.1 2011-08-04 initial version * History: 0.1 2011-08-04 initial version
@ -74,11 +75,11 @@
* Public Types * Public Types
************************************************************************************/ ************************************************************************************/
struct dac_msg_s begin_packed_struct struct dac_msg_s
{ {
uint8_t am_channel; /* The 8-bit DAC Channel */ uint8_t am_channel; /* The 8-bit DAC Channel */
int32_t am_data; /* DAC convert result (4 bytes) */ int32_t am_data; /* DAC convert result (4 bytes) */
} packed_struct; } end_packed_struct;
struct dac_fifo_s struct dac_fifo_s
{ {

View File

@ -1,6 +1,7 @@
/**************************************************************************** /****************************************************************************
* include/nuttx/audio/audio.h * include/nuttx/audio/audio.h
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2013 Ken Pettit. All rights reserved. * Copyright (C) 2013 Ken Pettit. All rights reserved.
* Author: Ken Pettit <pettitkd@gmail.com> * Author: Ken Pettit <pettitkd@gmail.com>
* *
@ -363,7 +364,7 @@ struct ap_buffer_info_s
/* This structure describes an Audio Pipeline Buffer */ /* This structure describes an Audio Pipeline Buffer */
struct ap_buffer_s begin_packed_struct struct ap_buffer_s
{ {
struct dq_entry_s dq_entry; /* Double linked queue entry */ struct dq_entry_s dq_entry; /* Double linked queue entry */
struct audio_info_s i; /* The info for samples in this buffer */ struct audio_info_s i; /* The info for samples in this buffer */
@ -377,7 +378,7 @@ struct ap_buffer_s
uint16_t flags; /* Buffer flags */ uint16_t flags; /* Buffer flags */
uint16_t crefs; /* Number of reference counts */ uint16_t crefs; /* Number of reference counts */
uint8_t samp[0]; /* Offset of the first sample */ uint8_t samp[0]; /* Offset of the first sample */
} packed_struct; } end_packed_struct;
/* Structure defining the messages passed to a listening audio thread /* Structure defining the messages passed to a listening audio thread
* for dequeuing buffers and other operations. Also used to allocate * for dequeuing buffers and other operations. Also used to allocate

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* include/nuttx/compiler.h * include/nuttx/compiler.h
* *
* Copyright (C) 2007-2009, 2012-2013, 2015-2016 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2012-2013, 2015-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -81,7 +81,7 @@
# define weak_alias(name, aliasname) # define weak_alias(name, aliasname)
# define weak_function # define weak_function
# define weak_const_function # define weak_const_function
#endif # endif
/* The noreturn attribute informs GCC that the function will not return. */ /* The noreturn attribute informs GCC that the function will not return. */
@ -97,7 +97,8 @@
* ignoring other alignment rules. * ignoring other alignment rules.
*/ */
# define packed_struct __attribute__ ((packed)) # define begin_packed_struct
# define end_packed_struct __attribute__ ((packed))
/* GCC does not support the reentrant attribute */ /* GCC does not support the reentrant attribute */
@ -279,7 +280,8 @@
/* SDCC does not support the noreturn or packed attributes */ /* SDCC does not support the noreturn or packed attributes */
# define noreturn_function # define noreturn_function
# define packed_struct # define begin_packed_struct
# define end_packed_struct
/* REVISIT: */ /* REVISIT: */
@ -397,7 +399,8 @@
/* The Zilog compiler does not support the noreturn, packed, naked attributes */ /* The Zilog compiler does not support the noreturn, packed, naked attributes */
# define noreturn_function # define noreturn_function
# define packed_struct # define begin_packed_struct
# define end_packed_struct
# define naked_function # define naked_function
# define inline_function # define inline_function
# define noinline_function # define noinline_function
@ -489,7 +492,8 @@
# define weak_const_function # define weak_const_function
# define noreturn_function # define noreturn_function
# define farcall_function # define farcall_function
# define packed_struct # define begin_packed_struct __packed
# define end_packed_struct
# define reentrant_function # define reentrant_function
# define naked_function # define naked_function
# define inline_function # define inline_function
@ -526,7 +530,8 @@
# define restrict # define restrict
# define noreturn_function # define noreturn_function
# define farcall_function # define farcall_function
# define packed_struct # define begin_packed_struct
# define end_packed_struct
# define reentrant_function # define reentrant_function
# define naked_function # define naked_function
# define inline_function # define inline_function

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* include/nuttx/drivers/can.h * include/nuttx/drivers/can.h
* *
* Copyright (C) 2008, 2009, 2011-2012, 2015-2016 Gregory Nutt. All rights reserved. * Copyright (C) 2008, 2009, 2011-2012, 2015-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -388,7 +388,7 @@
*/ */
#ifdef CONFIG_CAN_EXTID #ifdef CONFIG_CAN_EXTID
struct can_hdr_s begin_packed_struct struct can_hdr_s
{ {
uint32_t ch_id; /* 11- or 29-bit ID (20- or 3-bits unused) */ uint32_t ch_id; /* 11- or 29-bit ID (20- or 3-bits unused) */
uint8_t ch_dlc : 4; /* 4-bit DLC */ uint8_t ch_dlc : 4; /* 4-bit DLC */
@ -398,9 +398,9 @@ struct can_hdr_s
#endif #endif
uint8_t ch_extid : 1; /* Extended ID indication */ uint8_t ch_extid : 1; /* Extended ID indication */
uint8_t ch_unused : 1; /* Unused */ uint8_t ch_unused : 1; /* Unused */
} packed_struct; } end_packed_struct;
#else #else
struct can_hdr_s begin_packed_struct struct can_hdr_s
{ {
uint16_t ch_id; /* 11-bit standard ID (5-bits unused) */ uint16_t ch_id; /* 11-bit standard ID (5-bits unused) */
uint8_t ch_dlc : 4; /* 4-bit DLC. May be encoded in CAN_FD mode. */ uint8_t ch_dlc : 4; /* 4-bit DLC. May be encoded in CAN_FD mode. */
@ -409,14 +409,14 @@ struct can_hdr_s
uint8_t ch_error : 1; /* 1=ch_id is an error report */ uint8_t ch_error : 1; /* 1=ch_id is an error report */
#endif #endif
uint8_t ch_unused : 2; /* Unused */ uint8_t ch_unused : 2; /* Unused */
} packed_struct; } end_packed_struct;
#endif #endif
struct can_msg_s begin_packed_struct struct can_msg_s
{ {
struct can_hdr_s cm_hdr; /* The CAN header */ struct can_hdr_s cm_hdr; /* The CAN header */
uint8_t cm_data[CAN_MAXDATALEN]; /* CAN message data (0-8 byte) */ uint8_t cm_data[CAN_MAXDATALEN]; /* CAN message data (0-8 byte) */
} packed_struct; } end_packed_struct;
/* This structure defines a CAN message FIFO. */ /* This structure defines a CAN message FIFO. */

View File

@ -2,7 +2,7 @@
* include/nuttx/usb/audio.h * include/nuttx/usb/audio.h
* Audio Device Class (ADC) definitions * Audio Device Class (ADC) definitions
* *
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* References: This header file is based on information provided by the * References: This header file is based on information provided by the
@ -1321,18 +1321,18 @@ struct adc_l1_curparm_s
/* Layout 1, Control RANGE Parameter Block */ /* Layout 1, Control RANGE Parameter Block */
struct adc_l1_subrange_s begin_packed_struct struct adc_l1_subrange_s
{ {
uint8_t l1_min; /* 0: MIN attribute */ uint8_t l1_min; /* 0: MIN attribute */
uint8_t l1_max; /* 1: MAX attribute */ uint8_t l1_max; /* 1: MAX attribute */
uint8_t l1_res; /* 2: RES attribute */ uint8_t l1_res; /* 2: RES attribute */
} packed_struct; } end_packed_struct;
struct adc_l1_rangeparm_s begin_packed_struct struct adc_l1_rangeparm_s
{ {
uint8_t l1_nranges; /* 0: Number of sub-ranges */ uint8_t l1_nranges; /* 0: Number of sub-ranges */
struct adc_l1_subrange_s l1_subrange[1]; struct adc_l1_subrange_s l1_subrange[1];
} packed_struct; } end_packed_struct;
#define USB_SIZEOF_ADC_LI_RANGEPARM(nranges) (1+3*(nranges)) #define USB_SIZEOF_ADC_LI_RANGEPARM(nranges) (1+3*(nranges))
@ -1422,18 +1422,18 @@ struct adc_equalizer_curparm_s
/* Graphic Equalizer Control RANGE Parameter Block */ /* Graphic Equalizer Control RANGE Parameter Block */
struct adc_eq_subrange_s begin_packed_struct struct adc_eq_subrange_s
{ {
uint8_t eq_min; /* 0: MIN attribute */ uint8_t eq_min; /* 0: MIN attribute */
uint8_t eq_max; /* 1: MAX attribute */ uint8_t eq_max; /* 1: MAX attribute */
uint8_t eq_res; /* 2: RES attribute */ uint8_t eq_res; /* 2: RES attribute */
} packed_struct; } end_packed_struct;
struct adc_equalizer_rangeparm_s begin_packed_struct struct adc_equalizer_rangeparm_s
{ {
uint8_t eq_nranges; /* 0: Number of sub-ranges */ uint8_t eq_nranges; /* 0: Number of sub-ranges */
struct adc_eq_subrange_s eq_subrange[1]; struct adc_eq_subrange_s eq_subrange[1];
} packed_struct; } end_packed_struct;
#define USB_SIZEOF_ADC_EQUALIZER_RANGEPARM(nranges) (1+3*(nranges)) #define USB_SIZEOF_ADC_EQUALIZER_RANGEPARM(nranges) (1+3*(nranges))
@ -1457,18 +1457,18 @@ struct adc_hilo_curparm_s
/* High/Low Scaling Control RANGE Parameter Block */ /* High/Low Scaling Control RANGE Parameter Block */
struct adc_hl_subrange_s begin_packed_struct struct adc_hl_subrange_s
{ {
uint8_t hl_min; /* 0: MIN attribute */ uint8_t hl_min; /* 0: MIN attribute */
uint8_t hl_max; /* 1: MAX attribute */ uint8_t hl_max; /* 1: MAX attribute */
uint8_t hl_res; /* 2: RES attribute */ uint8_t hl_res; /* 2: RES attribute */
} packed_struct; } end_packed_struct;
struct adc_hilo_rangeparm_s begin_packed_struct struct adc_hilo_rangeparm_s
{ {
uint8_t hl_nranges[2]; /* 0: Number of sub-ranges */ uint8_t hl_nranges[2]; /* 0: Number of sub-ranges */
struct adc_hl_subrange_s hl_subrange[1]; struct adc_hl_subrange_s hl_subrange[1];
} packed_struct; } end_packed_struct;
#define USB_SIZEOF_ADC_HILO_RANGEPARM(nranges) (2+3*(nranges)) #define USB_SIZEOF_ADC_HILO_RANGEPARM(nranges) (2+3*(nranges))