blob: 09cf4f961ac290ce2a85c4ed483ac13e56db1f81 [file] [log] [blame]
Forest Bond5449c682009-04-25 10:30:44 -04001/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * File: baseband.h
20 *
21 * Purpose: Implement functions to access baseband
22 *
23 * Author: Jerry Chen
24 *
25 * Date: Jun. 5, 2002
26 *
27 */
28
29
30#ifndef __BASEBAND_H__
31#define __BASEBAND_H__
32
33
34#if !defined(__TTYPE_H__)
35#include "ttype.h"
36#endif
37
38#if !defined(__TETHER_H__)
39#include "tether.h"
40#endif
41
42#if !defined(__DEVICE_H__)
43#include "device.h"
44#endif
45
46
47/*--------------------- Export Definitions -------------------------*/
48
49//
50// Registers in the BASEBAND
51//
52#define BB_MAX_CONTEXT_SIZE 256
53
54
55//
56// Baseband RF pair definition in eeprom (Bits 6..0)
57//
58
59/*
60#define RATE_1M 0
61#define RATE_2M 1
62#define RATE_5M 2
63#define RATE_11M 3
64#define RATE_6M 4
65#define RATE_9M 5
66#define RATE_12M 6
67#define RATE_18M 7
68#define RATE_24M 8
69#define RATE_36M 9
70#define RATE_48M 10
71#define RATE_54M 11
72#define RATE_AUTO 12
73#define MAX_RATE 12
74
75
76//0:11A 1:11B 2:11G
77#define BB_TYPE_11A 0
78#define BB_TYPE_11B 1
79#define BB_TYPE_11G 2
80
81//0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
82#define PK_TYPE_11A 0
83#define PK_TYPE_11B 1
84#define PK_TYPE_11GB 2
85#define PK_TYPE_11GA 3
86*/
87
88
89#define PREAMBLE_LONG 0
90#define PREAMBLE_SHORT 1
91
92
93#define F5G 0
94#define F2_4G 1
95
96#define TOP_RATE_54M 0x80000000
97#define TOP_RATE_48M 0x40000000
98#define TOP_RATE_36M 0x20000000
99#define TOP_RATE_24M 0x10000000
100#define TOP_RATE_18M 0x08000000
101#define TOP_RATE_12M 0x04000000
102#define TOP_RATE_11M 0x02000000
103#define TOP_RATE_9M 0x01000000
104#define TOP_RATE_6M 0x00800000
105#define TOP_RATE_55M 0x00400000
106#define TOP_RATE_2M 0x00200000
107#define TOP_RATE_1M 0x00100000
108
109/*--------------------- Export Types ------------------------------*/
110
111/*--------------------- Export Macros ------------------------------*/
112
113
114
115#define BBvClearFOE(dwIoBase) \
116{ \
117 BBbWriteEmbeded(dwIoBase, 0xB1, 0); \
118}
119
120#define BBvSetFOE(dwIoBase) \
121{ \
122 BBbWriteEmbeded(dwIoBase, 0xB1, 0x0C); \
123}
124
125
126/*--------------------- Export Classes ----------------------------*/
127
128/*--------------------- Export Variables --------------------------*/
129
130/*--------------------- Export Functions --------------------------*/
131#ifdef __cplusplus
132extern "C" { /* Assume C declarations for C++ */
133#endif /* __cplusplus */
134
135UINT
136BBuGetFrameTime(
137 IN BYTE byPreambleType,
138 IN BYTE byPktType,
139 IN UINT cbFrameLength,
140 IN WORD wRate
141 );
142
143VOID
144BBvCaculateParameter (
145 IN PSDevice pDevice,
146 IN UINT cbFrameLength,
147 IN WORD wRate,
148 IN BYTE byPacketType,
149 OUT PWORD pwPhyLen,
150 OUT PBYTE pbyPhySrv,
151 OUT PBYTE pbyPhySgn
152 );
153
154BOOL BBbReadEmbeded(DWORD_PTR dwIoBase, BYTE byBBAddr, PBYTE pbyData);
155BOOL BBbWriteEmbeded(DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byData);
156
157VOID BBvReadAllRegs(DWORD_PTR dwIoBase, PBYTE pbyBBRegs);
158void BBvLoopbackOn(PSDevice pDevice);
159void BBvLoopbackOff(PSDevice pDevice);
160void BBvSetShortSlotTime(PSDevice pDevice);
161BOOL BBbIsRegBitsOn(DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byTestBits);
162BOOL BBbIsRegBitsOff(DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byTestBits);
163VOID BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData);
164
165// VT3253 Baseband
166BOOL BBbVT3253Init(PSDevice pDevice);
167VOID BBvSoftwareReset(DWORD_PTR dwIoBase);
168VOID BBvPowerSaveModeON(DWORD_PTR dwIoBase);
169VOID BBvPowerSaveModeOFF(DWORD_PTR dwIoBase);
170VOID BBvSetTxAntennaMode(DWORD_PTR dwIoBase, BYTE byAntennaMode);
171VOID BBvSetRxAntennaMode(DWORD_PTR dwIoBase, BYTE byAntennaMode);
172VOID BBvSetDeepSleep(DWORD_PTR dwIoBase, BYTE byLocalID);
173VOID BBvExitDeepSleep(DWORD_PTR dwIoBase, BYTE byLocalID);
174
175// timer for antenna diversity
176VOID
177TimerSQ3CallBack(
178 IN HANDLE hDeviceContext
179 );
180VOID
181TimerState1CallBack(
182 IN HANDLE hDeviceContext
183 );
184
185void BBvAntennaDiversity(PSDevice pDevice, BYTE byRxRate, BYTE bySQ3);
186VOID
187BBvClearAntDivSQ3Value (PSDevice pDevice);
188
189
190#ifdef __cplusplus
191} /* End of extern "C" { */
192#endif /* __cplusplus */
193
194
195#endif // __BASEBAND_H__
196
197
198