// SPDX-FileCopyrightText: 2019 Jiao Xianjun // SPDX-License-Identifier: AGPL-3.0-or-later #ifndef OPENWIFI_SDR #define OPENWIFI_SDR // -------------------for leds-------------------------------- struct gpio_led_data { //pleas always align with the leds-gpio.c in linux kernel struct led_classdev cdev; struct gpio_desc *gpiod; u8 can_sleep; u8 blinking; gpio_blink_set_t platform_gpio_blink_set; }; struct gpio_leds_priv { //pleas always align with the leds-gpio.c in linux kernel int num_leds; struct gpio_led_data leds[]; }; struct openwifi_rf_ops { char *name; // void (*init)(struct ieee80211_hw *); // void (*stop)(struct ieee80211_hw *); void (*set_chan)(struct ieee80211_hw *, struct ieee80211_conf *); // u8 (*calc_rssi)(u8 agc, u8 sq); }; struct openwifi_buffer_descriptor { // u32 num_dma_byte; // u32 sn; // u32 hw_queue_idx; // u32 retry_limit; // u32 need_ack; struct sk_buff *skb_linked; dma_addr_t dma_mapping_addr; // u32 reserved; } __packed; struct openwifi_ring { struct openwifi_buffer_descriptor *bds; u32 bd_wr_idx; u32 bd_rd_idx; u32 stop_flag; // track the stop/wake status between tx interrupt and openwifi_tx // u32 num_dma_symbol_request; // u32 reserved; } __packed; struct openwifi_vif { struct ieee80211_hw *dev; int idx; // this vif's idx on the dev /* beaconing */ struct delayed_work beacon_work; bool enable_beacon; }; union u32_byte4 { u32 a; u8 c[4]; }; union u16_byte2 { u16 a; u8 c[2]; }; #define MAX_NUM_LED 4 #define OPENWIFI_LED_MAX_NAME_LEN 32 // ------------ software reg definition ------------ #define MAX_NUM_DRV_REG 8 #define DRV_TX_REG_IDX_RATE 0 #define DRV_TX_REG_IDX_FREQ_BW_CFG 1 #define DRV_TX_REG_IDX_PRINT_CFG (MAX_NUM_DRV_REG-1) #define DRV_RX_REG_IDX_FREQ_BW_CFG 1 #define DRV_RX_REG_IDX_EXTRA_FO 2 #define DRV_RX_REG_IDX_PRINT_CFG (MAX_NUM_DRV_REG-1) #define DRV_XPU_REG_IDX_GIT_REV (MAX_NUM_DRV_REG-1) // ------end of software reg definition ------------ #define MAX_NUM_VIF 4 #define LEN_PHY_HEADER 16 #define LEN_PHY_CRC 4 #define RING_ROOM_THRESHOLD 4 #define NUM_TX_BD 64 // !!! should align to the fifo size in tx_bit_intf.v #define NUM_RX_BD 16 #define TX_BD_BUF_SIZE (8192) #define RX_BD_BUF_SIZE (8192) #define NUM_BIT_MAX_NUM_HW_QUEUE 2 #define MAX_NUM_HW_QUEUE 4 // number of queue in FPGA #define MAX_NUM_SW_QUEUE 4 // number of queue in Linux, depends on the number we report by dev->queues in openwifi_dev_probe #define NUM_BIT_MAX_PHY_TX_SN 10 // decrease 12 to 10 to reserve 2 bits storing related linux prio idx #define MAX_PHY_TX_SN ((1<