1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef R819XUSB_CMDPKT_H
3 #define R819XUSB_CMDPKT_H
4 /* Different command packet have dedicated message length and definition. */
5 #define CMPK_RX_TX_FB_SIZE sizeof(cmpk_txfb_t) /* 20 */
6 #define CMPK_TX_SET_CONFIG_SIZE sizeof(cmpk_set_cfg_t) /* 16 */
7 #define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(cmpk_set_cfg_t) /* 16 */
8 #define CMPK_RX_TX_STS_SIZE sizeof(cmpk_tx_status_t)
9 #define CMPK_RX_DBG_MSG_SIZE sizeof(cmpk_rx_dbginfo_t)
10 #define CMPK_TX_RAHIS_SIZE sizeof(cmpk_tx_rahis_t)
12 /* 2008/05/08 amy For USB constant. */
13 #define ISR_TxBcnOk BIT(27) /* Transmit Beacon OK */
14 #define ISR_TxBcnErr BIT(26) /* Transmit Beacon Error */
15 #define ISR_BcnTimerIntr BIT(13) /* Beacon Timer Interrupt */
18 /* Define element ID of command packet. */
20 /*------------------------------Define structure----------------------------*/
21 /* Define different command packet structure. */
22 /* 1. RX side: TX feedback packet. */
23 typedef struct tag_cmd_pkt_tx_feedback {
25 u8 element_id; /* Command packet type. */
26 u8 length; /* Command packet length. */
27 /* Change tx feedback info field. */
28 /*------TX Feedback Info Field */
31 u8 tok:1; /* Transmit ok. */
39 /*------TX Feedback Info Field */
45 u8 s_rate; /* Start rate. */
46 u8 f_rate; /* Final rate. */
58 /* 2. RX side: Interrupt status packet. It includes Beacon State,
59 * Beacon Timer Interrupt and other useful informations in MAC ISR Reg.
61 typedef struct tag_cmd_pkt_interrupt_status {
62 u8 element_id; /* Command packet type. */
63 u8 length; /* Command packet length. */
65 u32 interrupt_status; /* Interrupt Status. */
69 /* 3. TX side: Set configuration packet. */
70 typedef struct tag_cmd_pkt_set_configuration {
71 u8 element_id; /* Command packet type. */
72 u8 length; /* Command packet length. */
74 /* Configuration info. */
87 /* 4. Both side : TX/RX query configuraton packet. The query structure is the
88 * same as set configuration.
90 #define cmpk_query_cfg_t cmpk_set_cfg_t
92 /* 5. Multi packet feedback status. */
93 typedef struct tag_tx_stats_feedback {
94 /* For endian transfer --> Driver will not the same as
99 u8 length; /* Command packet length */
100 u8 element_id; /* Command packet type */
103 u16 txfail; /* Tx fail count */
104 u16 txok; /* Tx ok count */
107 u16 txmcok; /* Tx multicast */
108 u16 txretry; /* Tx retry count */
111 u16 txucok; /* Tx unicast */
112 u16 txbcok; /* Tx broadcast */
131 } __packed cmpk_tx_status_t;
133 /* 6. Debug feedback message. */
134 /* Define RX debug message */
135 typedef struct tag_rx_debug_message_feedback {
136 /* For endian transfer --> for driver */
139 u8 length; /* Command packet length */
140 u8 element_id; /* Command packet type */
143 /* Variable debug message. */
147 /* Define transmit rate history. For big endian format. */
148 typedef struct tag_tx_rate_history {
149 /* For endian transfer --> for driver */
151 u8 element_id; /* Command packet type */
152 u8 length; /* Command packet length */
155 /* DW 1-2 CCK rate counter */
168 } __packed cmpk_tx_rahis_t;
170 typedef enum tag_command_packet_directories {
172 RX_INTERRUPT_STATUS = 1,
174 BOTH_QUERY_CONFIG = 3,
176 RX_DBGINFO_FEEDBACK = 5,
177 RX_TX_PER_PKT_FEEDBACK = 6,
178 RX_TX_RATE_HISTORY = 7,
182 typedef enum _rt_status {
187 } rt_status, *prt_status;
189 u32 cmpk_message_handle_rx(struct net_device *dev,
190 struct ieee80211_rx_stats *pstats);
191 rt_status SendTxCommandPacket(struct net_device *dev,
192 void *pData, u32 DataLen);