#ifndef WLAN_HIGH_TYPES_H_ #define WLAN_HIGH_TYPES_H_ #include "wlan_common_types.h" #define ETH_ADDR_SIZE 6 // Length of Ethernet MAC address (in bytes) #define IP_ADDR_SIZE 4 // Length of IP address (in bytes) typedef enum application_role_t{ APPLICATION_ROLE_AP = 1, APPLICATION_ROLE_STA = 2, APPLICATION_ROLE_IBSS = 3, APPLICATION_ROLE_UNKNOWN = 0xFF } application_role_t; /******************************************************************** * @brief Channel Type Enum * * This enum described the type of channel that is specified in the * chan_spec_t struct. The size of an enum is compiler dependent. Because * this enum will be used in structs whose contents must be aligned with * wlan_exp in Python, we use a compile time assertion to at least create * a compilation error if the size winds up being different than wlan_exp * expects. * ********************************************************************/ typedef enum __attribute__((__packed__)) { CHAN_TYPE_BW20 = 0, CHAN_TYPE_BW40_SEC_BELOW = 1, CHAN_TYPE_BW40_SEC_ABOVE = 2 } chan_type_t; ASSERT_TYPE_SIZE(chan_type_t, 1); /******************************************************************** * @brief Channel Specifications Struct * * This struct contains a primary channel number and a chan_type_t. * Together, this tuple of information can be used to calculate the * center frequency and bandwidth of the radio. ********************************************************************/ typedef struct __attribute__((__packed__)){ u8 chan_pri; chan_type_t chan_type; } chan_spec_t; ASSERT_TYPE_SIZE(chan_spec_t, 2); // Scan FSM states typedef enum scan_state_t{ SCAN_IDLE, SCAN_RUNNING, SCAN_PAUSED } scan_state_t; // Interrupt controller started/stopped state typedef enum interrupt_state_t{ INTERRUPTS_DISABLED, INTERRUPTS_ENABLED } interrupt_state_t; // Ethernet header typedef struct ethernet_header_t{ u8 dest_mac_addr[ETH_ADDR_SIZE]; // Destination MAC address u8 src_mac_addr[ETH_ADDR_SIZE]; // Source MAC address u16 ethertype; // EtherType } ethernet_header_t; // IPv4 Header typedef struct ipv4_header_t{ u8 version_ihl; // [7:4] Version; [3:0] Internet Header Length u8 dscp_ecn; // [7:2] Differentiated Services Code Point; [1:0] Explicit Congestion Notification u16 total_length; // Total Length (includes header and data - in bytes) u16 identification; // Identification u16 fragment_offset; // [15:14] Flags; [13:0] Fragment offset u8 ttl; // Time To Live u8 protocol; // Protocol u16 header_checksum; // IP header checksum u8 src_ip_addr[IP_ADDR_SIZE]; // Source IP address (big endian) u8 dest_ip_addr[IP_ADDR_SIZE]; // Destination IP address (big endian) } ipv4_header_t; // UDP Header typedef struct udp_header_t{ u16 src_port; // Source port number u16 dest_port; // Destination port number u16 length; // Length of UDP header and UDP data (in bytes) u16 checksum; // Checksum } udp_header_t; // wlan_exp Transport Header typedef struct wlan_exp_transport_header{ u16 dest_id; // Destination ID u16 src_id; // Source ID u16 length; // Length of the Packet u16 seq_num; // Sequence Number u16 flags; // Transport flags } wlan_exp_transport_header; // ARP Packet typedef struct arp_ipv4_packet_t{ u16 htype; // Hardware Type u16 ptype; // Protocol Type u8 hlen; // Length of Hardware address u8 plen; // Length of Protocol address u16 oper; // Operation u8 sender_haddr[ETH_ADDR_SIZE]; // Sender hardware address u8 sender_paddr[IP_ADDR_SIZE]; // Sender protocol address u8 target_haddr[ETH_ADDR_SIZE]; // Target hardware address u8 target_paddr[IP_ADDR_SIZE]; // Target protocol address } arp_ipv4_packet_t; // Socket address structure typedef struct __attribute__((__packed__)) sockaddr_t { u16 sa_family; u8 sa_data[14]; } sockaddr_t; ASSERT_TYPE_SIZE(sockaddr_t, 16); // Internet (IP) address structure typedef struct __attribute__((__packed__)) in_addr_t { u8 s_addr[IP_ADDR_LEN]; } in_addr_t; // Internet (IP) socket address structure typedef struct __attribute__((__packed__)) sockaddr_in_t { u16 sin_family; u16 sin_port; in_addr_t sin_addr; u8 sin_zero[8]; } sockaddr_in_t; ASSERT_TYPE_SIZE(sockaddr_in_t, 16); // Function pointer type (void return, 1 argument) for Interrupt Service Routines // axi_intc and ps_gic use compatible types but different names for interrupt handlers typedef void (*wlan_intr_handler_t)(void *data); #endif /* WLAN_HIGH_TYPES_H_ */