VSF Documented
vsf_wifi_mt76.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_WIFI_MT76_H__
19#define __VSF_WIFI_MT76_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "../../vsf_wifi_cfg.h"
24
25#if VSF_USE_WIFI == ENABLED && VSF_WIFI_USE_MT76 == ENABLED
26
27#include "../../vsf_wifi.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/*============================ MACROS ========================================*/
34
35#define MT76_RX_URB_SIZE 2048
36#define MT76_TX_URB_SIZE 2048
37#define MT76_MCU_RESP_SIZE 2048
38
39#define MT76_EEPROM_SIZE 512
40
41/*============================ TYPES =========================================*/
42
43/* MT76 bus operations.
44 *
45 * These are chip-level communication primitives, not USB-specific calls. On
46 * USB the bus driver maps them to ep0 vendor requests and bulk URBs; on other
47 * buses (e.g. SDIO) the same chip driver would use a different bus_ops
48 * implementation that maps to the appropriate host/controller primitives. */
50 /* Send an MCU command / configuration request. On USB this becomes an
51 * ep0 vendor request; the exact request layout is bus-driver private. */
53 uint8_t req, uint8_t req_type, uint16_t value, uint16_t index,
54 void *buf, uint16_t len, vsf_wifi_done_t done);
55
56 /* Submit a TX frame (probe/auth/assoc/data). On USB this is a bulk OUT
57 * transfer on one of the AC endpoints. */
59 const uint8_t *data, uint16_t len, uint8_t queue_idx);
60
61 /* Start / re-arm a single RX reception. On USB this is a bulk IN URB. */
63 uint8_t *buf, uint16_t len, uint8_t queue_idx);
65
85
86/*============================ LOGGING HELPERS ===============================*/
87
88#if VSF_WIFI_CFG_CHIP_MT76_LOG_LEVEL >= 1
89# define vsf_wifi_chip_mt76_trace_error(...) vsf_trace_error(__VA_ARGS__)
90#else
91# define vsf_wifi_chip_mt76_trace_error(...) ((void)0)
92#endif
93
94#if VSF_WIFI_CFG_CHIP_MT76_LOG_LEVEL >= 2
95# define vsf_wifi_chip_mt76_trace_info(...) vsf_trace_info(__VA_ARGS__)
96#else
97# define vsf_wifi_chip_mt76_trace_info(...) ((void)0)
98#endif
99
100#if VSF_WIFI_CFG_CHIP_MT76_LOG_LEVEL >= 4
101# define vsf_wifi_chip_mt76_trace_debug(...) vsf_trace_info(__VA_ARGS__)
102#else
103# define vsf_wifi_chip_mt76_trace_debug(...) ((void)0)
104#endif
105
106/*============================ GLOBAL VARIABLES ==============================*/
107
109
110/*============================ PROTOTYPES ====================================*/
111
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif /* VSF_USE_WIFI == ENABLED && VSF_WIFI_USE_MT76 == ENABLED */
122#endif /* __VSF_WIFI_MT76_H__ */
vsf_err_t
Definition __type.h:42
struct ieee80211_ext_chansw_ie data
Definition ieee80211.h:80
unsigned short uint16_t
Definition stdint.h:7
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_wifi_mt76.h:66
uint8_t state
Definition vsf_wifi_mt76.h:74
uint8_t rx_buf[MT76_RX_URB_SIZE]
Definition vsf_wifi_mt76.h:81
uint8_t eeprom[MT76_EEPROM_SIZE]
Definition vsf_wifi_mt76.h:71
uint16_t pending_cmd
Definition vsf_wifi_mt76.h:78
void * bus_priv
Definition vsf_wifi_mt76.h:67
uint32_t asic_rev
Definition vsf_wifi_mt76.h:69
vsf_wifi_done_t pending_done
Definition vsf_wifi_mt76.h:77
uint8_t mac_addr[6]
Definition vsf_wifi_mt76.h:70
uint8_t mcu_seq
Definition vsf_wifi_mt76.h:73
uint8_t mcu_resp_buf[MT76_MCU_RESP_SIZE]
Definition vsf_wifi_mt76.h:83
uint8_t tx_buf[MT76_TX_URB_SIZE]
Definition vsf_wifi_mt76.h:82
Definition vsf_wifi.h:297
Definition vsf_wifi_mt76.h:49
vsf_err_t(* mcu_cmd)(vsf_wifi_t *wifi, uint8_t req, uint8_t req_type, uint16_t value, uint16_t index, void *buf, uint16_t len, vsf_wifi_done_t done)
Definition vsf_wifi_mt76.h:52
vsf_err_t(* rx_submit)(vsf_wifi_t *wifi, uint8_t *buf, uint16_t len, uint8_t queue_idx)
Definition vsf_wifi_mt76.h:62
vsf_err_t(* tx_frame)(vsf_wifi_t *wifi, const uint8_t *data, uint16_t len, uint8_t queue_idx)
Definition vsf_wifi_mt76.h:58
Definition vsf_wifi_priv.h:36
vk_av_control_value_t value
Definition vsf_audio.h:171
void(* vsf_wifi_done_t)(vsf_wifi_t *wifi, vsf_err_t err)
Definition vsf_wifi.h:120
struct vsf_wifi_mt76_bus_ops_t vsf_wifi_mt76_bus_ops_t
const vsf_wifi_chip_drv_t vsf_wifi_mt76_drv
Definition vsf_wifi_mt76.c:173
const uint32_t __mt76_main_firmware_size
Definition vsf_wifi_mt76_firmware_data.c:6803
#define MT76_TX_URB_SIZE
Definition vsf_wifi_mt76.h:36
const uint32_t __mt76_rom_patch_firmware_size
Definition vsf_wifi_mt76_firmware_data.c:1673
const uint8_t __mt76_rom_patch_firmware_data[]
Definition vsf_wifi_mt76_firmware_data.c:24
#define MT76_RX_URB_SIZE
Definition vsf_wifi_mt76.h:35
#define MT76_MCU_RESP_SIZE
Definition vsf_wifi_mt76.h:37
struct mt76_wifi_priv mt76_wifi_priv_t
#define MT76_EEPROM_SIZE
Definition vsf_wifi_mt76.h:39
const uint8_t __mt76_main_firmware_data[]
Definition vsf_wifi_mt76_firmware_data.c:1677
Generated from commit: vsfteam/vsf@d3b40b2