hantek-4032l: Fix structure packing.
- use pragma to handle different behavior between gcc and minGW bit-field packing - bit-field integer variables needs to be align to 2-byte boundary Compiler does not produce an error when accessing into non-__packed pointer. However, the field might not be properly aligned for this type. More information could be found on: - https://sourceforge.net/p/mingw-w64/bugs/275/ - http://www.keil.com/support/man/docs/ARMCC/armcc_chr1359124990875.htm Signed-off-by: Andrej Valek <andy@skyrain.eu>
This commit is contained in:
parent
972001561b
commit
e80e1858ef
|
@ -30,7 +30,7 @@ enum h4032l_cmd {
|
|||
CMD_GET = 0x6b5a
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) h4032l_status_packet {
|
||||
struct h4032l_status_packet {
|
||||
uint32_t magic;
|
||||
uint32_t values;
|
||||
uint32_t status;
|
||||
|
|
|
@ -77,7 +77,8 @@ enum h4032l_status {
|
|||
H4032L_STATUS_TRANSFER,
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) h4032l_trigger {
|
||||
#pragma pack(push,2)
|
||||
struct h4032l_trigger {
|
||||
struct {
|
||||
uint32_t edge_signal:5;
|
||||
uint32_t edge_type:2;
|
||||
|
@ -99,7 +100,7 @@ struct __attribute__((__packed__)) h4032l_trigger {
|
|||
uint32_t combine_data;
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) h4032l_cmd_pkt {
|
||||
struct h4032l_cmd_pkt {
|
||||
uint16_t magic; /* 0x017f */
|
||||
uint8_t sample_rate;
|
||||
struct {
|
||||
|
@ -115,6 +116,7 @@ struct __attribute__((__packed__)) h4032l_cmd_pkt {
|
|||
struct h4032l_trigger trigger[2];
|
||||
uint16_t cmd;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct dev_context {
|
||||
enum h4032l_status status;
|
||||
|
|
Loading…
Reference in New Issue