Add macro ETH_ADDR() to initialize a struct eth_addr with its 6 bytes and taking care of correct braces

This commit is contained in:
goldsimon
2017-04-11 08:49:15 +02:00
parent 8695e6e6cb
commit 26d3466f50
3 changed files with 6 additions and 2 deletions

View File

@@ -55,6 +55,7 @@ extern "C" {
# include "arch/bpstruct.h"
#endif
PACK_STRUCT_BEGIN
/** An Ethernet MAC address */
struct eth_addr {
PACK_STRUCT_FLD_8(u8_t addr[ETH_HWADDR_LEN]);
} PACK_STRUCT_STRUCT;
@@ -63,6 +64,9 @@ PACK_STRUCT_END
# include "arch/epstruct.h"
#endif
/** Initialize a struct eth_addr with its 6 bytes (takes care of correct braces) */
#define ETH_ADDR(b0, b1, b2, b3, b4, b5) {{b0, b1, b2, b3, b4, b5}}
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif

View File

@@ -78,7 +78,7 @@ typedef struct bridgeif_initdata_s {
/** @ingroup bridgeif
* Use this for constant initialization of a bridgeif_initdat_t
* (ethaddr must be passed as MAKE_ETH_ADDR())
* (ethaddr must be passed as ETH_ADDR())
*/
#define BRIDGEIF_INITDATA1(max_ports, max_fdb_dynamic_entries, max_fdb_static_entries, ethaddr) {ethaddr, max_ports, max_fdb_dynamic_entries, max_fdb_static_entries}
/** @ingroup bridgeif