blob: 1d6c9c73adb6e9128c9905166e0d7f91592dfcdf [file] [log] [blame]
Ali Baharcf3e6882011-09-04 03:14:04 +08001/******************************************************************************
2 *
3 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * Modifications for inclusion into the Linux staging tree are
19 * Copyright(c) 2010 Larry Finger. All rights reserved.
20 *
21 * Contact information:
22 * WLAN FAE <wlanfae@realtek.com>
23 * Larry Finger <Larry.Finger@lwfinger.net>
24 *
25 ******************************************************************************/
Larry Finger2865d422010-08-20 10:15:30 -050026#ifndef _RTL8712_RECV_H_
27#define _RTL8712_RECV_H_
28
29#include "osdep_service.h"
30#include "drv_types.h"
31
32#define NR_RECVBUFF (8)
33#define NR_PREALLOC_RECV_SKB (8)
34#define RXDESC_SIZE 24
35#define RXDESC_OFFSET RXDESC_SIZE
36#define RECV_BLK_SZ 512
37#define RECV_BLK_CNT 16
38#define RECV_BLK_TH RECV_BLK_CNT
39#define MAX_RECVBUF_SZ (30720) /* 30K */
40#define RECVBUFF_ALIGN_SZ 512
41#define RSVD_ROOM_SZ (0)
42/*These definition is used for Rx packet reordering.*/
43#define SN_LESS(a, b) (((a-b) & 0x800) != 0)
44#define SN_EQUAL(a, b) (a == b)
45#define REORDER_WAIT_TIME 30 /* (ms)*/
46
47struct recv_stat {
48 unsigned int rxdw0;
49 unsigned int rxdw1;
50 unsigned int rxdw2;
51 unsigned int rxdw3;
52 unsigned int rxdw4;
53 unsigned int rxdw5;
54};
55
56struct phy_cck_rx_status {
57 /* For CCK rate descriptor. This is a unsigned 8:1 variable.
58 * LSB bit present 0.5. And MSB 7 bts present a signed value.
59 * Range from -64~+63.5. */
60 u8 adc_pwdb_X[4];
61 u8 sq_rpt;
62 u8 cck_agc_rpt;
63};
64
65struct phy_stat {
66 unsigned int phydw0;
67 unsigned int phydw1;
68 unsigned int phydw2;
69 unsigned int phydw3;
70 unsigned int phydw4;
71 unsigned int phydw5;
72 unsigned int phydw6;
73 unsigned int phydw7;
74};
75#define PHY_STAT_GAIN_TRSW_SHT 0
76#define PHY_STAT_PWDB_ALL_SHT 4
77#define PHY_STAT_CFOSHO_SHT 5
78#define PHY_STAT_CCK_AGC_RPT_SHT 5
79#define PHY_STAT_CFOTAIL_SHT 9
80#define PHY_STAT_RXEVM_SHT 13
81#define PHY_STAT_RXSNR_SHT 15
82#define PHY_STAT_PDSNR_SHT 19
83#define PHY_STAT_CSI_CURRENT_SHT 21
84#define PHY_STAT_CSI_TARGET_SHT 23
85#define PHY_STAT_SIGEVM_SHT 25
86#define PHY_STAT_MAX_EX_PWR_SHT 26
87
88union recvstat {
89 struct recv_stat recv_stat;
90 unsigned int value[RXDESC_SIZE>>2];
91};
92
93
94struct recv_buf {
95 struct list_head list;
96 spinlock_t recvbuf_lock;
97 u32 ref_cnt;
98 struct _adapter *adapter;
99 struct urb *purb;
100 _pkt *pskb;
101 u8 reuse;
102 u8 irp_pending;
103 u32 transfer_len;
104 uint len;
105 u8 *phead;
106 u8 *pdata;
107 u8 *ptail;
108 u8 *pend;
109 u8 *pbuf;
110 u8 *pallocated_buf;
111};
112
113/*
114 head ----->
115 data ----->
116 payload
117 tail ----->
118 end ----->
119 len = (unsigned int )(tail - data);
120*/
Javier M. Mellid05937582011-04-02 03:01:49 +0200121struct recv_frame_hdr {
Larry Finger2865d422010-08-20 10:15:30 -0500122 struct list_head list;
123 _pkt *pkt;
124 _pkt *pkt_newalloc;
125 struct _adapter *adapter;
126 u8 fragcnt;
127 struct rx_pkt_attrib attrib;
128 uint len;
129 u8 *rx_head;
130 u8 *rx_data;
131 u8 *rx_tail;
132 u8 *rx_end;
133 void *precvbuf;
134 struct sta_info *psta;
135 /*for A-MPDU Rx reordering buffer control*/
136 struct recv_reorder_ctrl *preorder_ctrl;
137};
138
139union recv_frame {
140 union {
141 struct list_head list;
142 struct recv_frame_hdr hdr;
143 addr_t mem[RECVFRAME_HDR_ALIGN>>2];
144 } u;
145};
146
147int r8712_init_recvbuf(struct _adapter *padapter, struct recv_buf *precvbuf);
148void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf);
149s32 r8712_signal_scale_mapping(s32 cur_sig);
150void r8712_reordering_ctrl_timeout_handler(void *pcontext);
151
152#endif
153