mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-03 21:14:40 +08:00
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:
parent
8695e6e6cb
commit
26d3466f50
@ -55,6 +55,7 @@ extern "C" {
|
|||||||
# include "arch/bpstruct.h"
|
# include "arch/bpstruct.h"
|
||||||
#endif
|
#endif
|
||||||
PACK_STRUCT_BEGIN
|
PACK_STRUCT_BEGIN
|
||||||
|
/** An Ethernet MAC address */
|
||||||
struct eth_addr {
|
struct eth_addr {
|
||||||
PACK_STRUCT_FLD_8(u8_t addr[ETH_HWADDR_LEN]);
|
PACK_STRUCT_FLD_8(u8_t addr[ETH_HWADDR_LEN]);
|
||||||
} PACK_STRUCT_STRUCT;
|
} PACK_STRUCT_STRUCT;
|
||||||
@ -63,6 +64,9 @@ PACK_STRUCT_END
|
|||||||
# include "arch/epstruct.h"
|
# include "arch/epstruct.h"
|
||||||
#endif
|
#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
|
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||||
# include "arch/bpstruct.h"
|
# include "arch/bpstruct.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -78,7 +78,7 @@ typedef struct bridgeif_initdata_s {
|
|||||||
|
|
||||||
/** @ingroup bridgeif
|
/** @ingroup bridgeif
|
||||||
* Use this for constant initialization of a bridgeif_initdat_t
|
* 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}
|
#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
|
/** @ingroup bridgeif
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
* - some configuration options controlling the memory consumption (maximum number of ports
|
* - some configuration options controlling the memory consumption (maximum number of ports
|
||||||
* and FDB entries)
|
* and FDB entries)
|
||||||
* - e.g. for a bridge MAC address 00-01-02-03-04-05, 2 bridge ports, 1024 FDB entries + 16 static MAC entries:
|
* - e.g. for a bridge MAC address 00-01-02-03-04-05, 2 bridge ports, 1024 FDB entries + 16 static MAC entries:
|
||||||
* bridgeif_initdata_t mybridge_initdata = BRIDGEIF_INITDATA1(2, 1024, 16, MAKE_ETH_ADDR(0, 1, 2, 3, 4, 5));
|
* bridgeif_initdata_t mybridge_initdata = BRIDGEIF_INITDATA1(2, 1024, 16, ETH_ADDR(0, 1, 2, 3, 4, 5));
|
||||||
* - add the bridge netif (with IPv4 config):
|
* - add the bridge netif (with IPv4 config):
|
||||||
* struct netif bridge_netif;
|
* struct netif bridge_netif;
|
||||||
* netif_add(&bridge_netif, &my_ip, &my_netmask, &my_gw, &mybridge_initdata, bridgeif_init, tcpip_input);
|
* netif_add(&bridge_netif, &my_ip, &my_netmask, &my_gw, &mybridge_initdata, bridgeif_init, tcpip_input);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user