1 #ifndef R819XUSB_CMDPKT_H
2 #define R819XUSB_CMDPKT_H
5 * Different command packets have dedicated message length and definition.
7 #define CMPK_RX_TX_FB_SIZE sizeof(cmpk_txfb_t) /* 20 */
8 #define CMPK_TX_SET_CONFIG_SIZE sizeof(cmpk_set_cfg_t) /* 16 */
9 #define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(cmpk_set_cfg_t) /* 16 */
10 #define CMPK_RX_TX_STS_SIZE sizeof(cmpk_tx_status_t)
11 #define CMPK_RX_DBG_MSG_SIZE sizeof(cmpk_rx_dbginfo_t)
12 #define CMPK_TX_RAHIS_SIZE sizeof(cmpk_tx_rahis_t)
14 /* For USB constant. */
15 #define ISR_TxBcnOk BIT27 /* Transmit Beacon OK */
16 #define ISR_TxBcnErr BIT26 /* Transmit Beacon Error */
17 #define ISR_BcnTimerIntr BIT13 /* Beacon Timer Interrupt */
20 * Define different command packet structures
22 * 1. RX side: TX feedback packet.
24 typedef struct tag_cmd_pkt_tx_feedback
{
26 u8 element_id
; /* Command packet type. */
27 u8 length
; /* Command packet length. */
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. */
59 * 2. RX side: Interrupt status packet.
60 * It includes Beacon State, Beacon Timer Interrupt
61 * and other useful informations in MAC ISR Reg.
63 typedef struct tag_cmd_pkt_interrupt_status
{
64 u8 element_id
; /* Command packet type. */
65 u8 length
; /* Command packet length. */
67 u32 interrupt_status
; /* Interrupt Status. */
72 * 3. TX side: Set configuration packet.
74 typedef struct tag_cmd_pkt_set_configuration
{
75 u8 element_id
; /* Command packet type. */
76 u8 length
; /* Command packet length. */
79 u8 cfg_size
:2; /* Configuration info. */
80 u8 cfg_type
:2; /* Configuration info. */
81 u8 cfg_action
:1; /* Configuration info. */
82 u8 cfg_reserve2
; /* Configuration info. */
83 u8 cfg_page
:4; /* Configuration info. */
84 u8 cfg_reserve3
:4; /* Configuration info. */
85 u8 cfg_offset
; /* Configuration info. */
91 * 4. Both side : TX/RX query configuraton packet.
92 * The query structure is the same as set configuration.
94 #define cmpk_query_cfg_t cmpk_set_cfg_t
97 * 5. Multi packet feedback status.
99 typedef struct tag_tx_stats_feedback
{
101 * For endian transfer
102 * Driver will not the same as firmware structure.
106 u8 length
; /* Command packet length */
107 u8 element_id
; /* Command packet type */
110 u16 txfail
; /* Tx Fail count */
111 u16 txok
; /* Tx ok count */
114 u16 txmcok
; /* tx multicast */
115 u16 txretry
; /* Tx Retry count */
118 u16 txucok
; /* tx unicast */
119 u16 txbcok
; /* tx broadcast */
138 } __attribute__((packed
)) cmpk_tx_status_t
;
141 * 6. Debug feedback message.
143 typedef struct tag_rx_debug_message_feedback
{
144 /* For endian transfer --> for driver */
147 u8 length
; /* Command packet length */
148 u8 element_id
; /* Command packet type */
152 * Define transmit rate history. For big endian format.
154 typedef struct tag_tx_rate_history
{
155 /* For endian transfer --> for driver */
157 u8 element_id
; /* Command packet type */
158 u8 length
; /* Command packet length */
160 /* DW 1-2 CCK rate counter */
165 } __attribute__((packed
)) cmpk_tx_rahis_t
;
167 typedef enum tag_command_packet_directories
{
169 RX_INTERRUPT_STATUS
= 1,
171 BOTH_QUERY_CONFIG
= 3,
173 RX_DBGINFO_FEEDBACK
= 5,
174 RX_TX_PER_PKT_FEEDBACK
= 6,
175 RX_TX_RATE_HISTORY
= 7,
179 extern bool cmpk_message_handle_tx(struct net_device
*dev
,
180 u8
*codevirtualaddress
,
184 extern u32
cmpk_message_handle_rx(struct net_device
*dev
,
185 struct ieee80211_rx_stats
*pstats
);
187 extern bool SendTxCommandPacket(struct net_device
*dev
,