Re-instantiated the pack directives. Nested structs do break individual field natural alignment on arm-gcc.

This commit is contained in:
likewise
2004-05-06 03:27:13 +00:00
parent 5c7a70df28
commit e4295396ac
10 changed files with 173 additions and 85 deletions

View File

@@ -44,41 +44,49 @@
#include "lwip/netif.h"
#include "lwip/ip.h"
struct eth_addr {
u8_t addr[6];
};
struct eth_hdr {
/* Ethernet header is 14 bytes, this breaks natural alignment on
* subsequent (TCP/IP) protocol header fields. */
#if ETH_PAD_SIZE
u8_t padding[ETH_PAD_SIZE];
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif
struct eth_addr dest;
struct eth_addr src;
u16_t type;
};
PACK_STRUCT_BEGIN
struct eth_addr {
PACK_STRUCT_FIELD(u8_t addr[6]);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
PACK_STRUCT_BEGIN
struct eth_hdr {
#if ETH_PAD_SIZE
PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
#endif
PACK_STRUCT_FIELD(struct eth_addr dest);
PACK_STRUCT_FIELD(struct eth_addr src);
PACK_STRUCT_FIELD(u16_t type);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
PACK_STRUCT_BEGIN
/** the ARP message */
struct etharp_hdr {
/* Ethernet header */
struct eth_hdr ethhdr;
u16_t hwtype;
u16_t proto;
u16_t _hwlen_protolen;
u16_t opcode;
struct eth_addr shwaddr;
/* assume 2-byte alignment */
struct ip_addr2 sipaddr;
struct eth_addr dhwaddr;
/* assume 2-byte alignment */
struct ip_addr2 dipaddr;
};
PACK_STRUCT_FIELD(struct eth_hdr ethhdr);
PACK_STRUCT_FIELD(u16_t hwtype);
PACK_STRUCT_FIELD(u16_t proto);
PACK_STRUCT_FIELD(u16_t _hwlen_protolen);
PACK_STRUCT_FIELD(u16_t opcode);
PACK_STRUCT_FIELD(struct eth_addr shwaddr);
PACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
PACK_STRUCT_FIELD(struct eth_addr dhwaddr);
PACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
PACK_STRUCT_BEGIN
struct ethip_hdr {
struct eth_hdr eth;
struct ip_hdr ip;
PACK_STRUCT_FIELD(struct eth_hdr eth);
PACK_STRUCT_FIELD(struct ip_hdr ip);
};
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/epstruct.h"
#endif
#define ARP_TMR_INTERVAL 10000