1 /* 2 * Copyright 2008-2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <mlan_api.h> 8 #include <wmlog.h> 9 #ifdef RW610 10 #include <wifi-imu.h> 11 #else 12 #include <wifi-sdio.h> 13 #endif 14 #include <wifi-internal.h> 15 16 #define NET_MAC_ADDR_LEN 6 17 18 #define NET_IPV4_ADDR_U32(x) (x).in_addr.s_addr 19 20 /* 21 * Packets of this type need o be handled 22 * for WPS and Supplicant 23 */ 24 #define ETHTYPE_EAPOL 0x888EU /* EAPOL */ 25 26 /* This is an Token-Ring LLC structure */ 27 struct eth_llc_hdr 28 { 29 t_u8 dsap; /* destination SAP */ 30 t_u8 ssap; /* source SAP */ 31 t_u8 llc; /* LLC control field */ 32 t_u8 protid[3]; /* protocol id */ 33 t_u16 type; /* ether type field */ 34 } __packed; 35 36 #define SIZEOF_ETH_LLC_HDR (8U) 37 #define SIZEOF_ETH_HDR (14U) 38 39 /* Define those to better describe your network interface. */ 40 #define IFNAME0 'm' 41 #define IFNAME1 'l' 42 43 /* 44 * It was observed that Wi-Fi card does not wakeup 45 * immediately after call to wlan_wakeup_card. 46 * The code tries to wakeup the card by writing 47 * in SDIO register. 48 * It waits for 20 ms for AWAKE event from Wi-Fi card, 49 * if AWAKE event is not generated or received by MCU code 50 * it returns error and does not send a packet out. 51 * This is observed with 8801 Wi-Fi card. 52 * So for 8801 based platforms the wait time is now 35 ms. 53 */ 54 55 #if CONFIG_WiFi_878x 56 #define MAX_WAIT_TIME 20 57 #else 58 #define MAX_WAIT_TIME 35 59 #endif 60 #define MAX_INTERFACES_SUPPORTED 3U 61 62 /* The time to block waiting for input. */ 63 #define emacBLOCK_TIME_WAITING_FOR_INPUT ((portTickType)100) 64 /*------------------------------------------------------*/ 65 extern int wlan_get_mac_address(uint8_t *dest); 66 extern void wlan_wake_up_card(void); 67 68 #if CONFIG_P2P 69 mlan_status wlan_send_gen_sdio_cmd(uint8_t *buf, uint32_t buflen); 70 #endif 71 #if CONFIG_P2P 72 extern int wlan_get_wfd_mac_address(t_u8 *); 73 extern int wfd_bss_type; 74 #endif 75 76 #if CONFIG_WPS2 77 void (*wps_rx_callback)(const t_u8 *buf, size_t len); 78 #endif 79 80 #if CONFIG_WPA_SUPP 81 // void (*l2_packet_rx_callback)(const struct pbuf *p); 82 #endif /* CONFIG_HOST_SUPP */ 83 84 void wrapper_wlan_update_uap_rxrate_info(RxPD *rxpd); 85 86 int wrapper_wlan_handle_rx_packet(t_u16 datalen, RxPD *rxpd, void *p, void *payload); 87 88 int wrapper_wlan_handle_amsdu_rx_packet(const t_u8 *rcvdata, const t_u16 datalen); 89 90 #if CONFIG_NET_MONITOR 91 void user_recv_monitor_data(const t_u8 *rcvdata); 92 #endif 93