Callisto4Bootloader: ARK/ip-macros.h Source File

Callisto4Bootloader

ip-macros.h
Go to the documentation of this file.
1 /*
2 * ip-macros.h
3 *
4 * Created on: 9 Jul 2020
5 * Author: Nick Pelling
6 */
7
8 #ifndef IP_MACROS_H_
9 #define IP_MACROS_H_
10
11 // Simple X-Macros to extract the individual fields out of an IP 4-tuple
12 #define IP0(A,B,C,D) A
13 #define IP1(A,B,C,D) B
14 #define IP2(A,B,C,D) C
15 #define IP3(A,B,C,D) D
16 #define IPALL(A,B,C,D) A,B,C,D
17
18 // Simple X-Macros to extract the individual fields out of a MAC 6-tuple
19 #define MAC0(A,B,C,D,E,F) A
20 #define MAC1(A,B,C,D,E,F) B
21 #define MAC2(A,B,C,D,E,F) C
22 #define MAC3(A,B,C,D,E,F) D
23 #define MAC4(A,B,C,D,E,F) E
24 #define MAC5(A,B,C,D,E,F) F
25 #define MACALL(A,B,C,D,E,F) A,B,C,D,E,F
26
27 #define SET_MAC_ADDRESS(ARRAY,XMACRO) \
28 ARRAY[0] = XMACRO(MAC0); \
29 ARRAY[1] = XMACRO(MAC1); \
30 ARRAY[2] = XMACRO(MAC2); \
31 ARRAY[3] = XMACRO(MAC3); \
32 ARRAY[4] = XMACRO(MAC4); \
33 ARRAY[5] = XMACRO(MAC5)
34
35 #define SET_IP_ADDRESS(ARRAY,XMACRO) \
36 ARRAY[0] = XMACRO(IP0); \
37 ARRAY[1] = XMACRO(IP1); \
38 ARRAY[2] = XMACRO(IP2); \
39 ARRAY[3] = XMACRO(IP3)
40
41 #endif /* IP_MACROS_H_ */