192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond/*
292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * All rights reserved.
492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * This program is free software; you can redistribute it and/or modify
692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * it under the terms of the GNU General Public License as published by
792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * the Free Software Foundation; either version 2 of the License, or
892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * (at your option) any later version.
992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
1092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * This program is distributed in the hope that it will be useful,
1192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * but WITHOUT ANY WARRANTY; without even the implied warranty of
1292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * GNU General Public License for more details.
1492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
1592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * You should have received a copy of the GNU General Public License along
1692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * with this program; if not, write to the Free Software Foundation, Inc.,
1792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
1992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * File: baseband.h
2192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Purpose: Implement functions to access baseband
2392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Author: Jerry Chen
2592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Date: Jun. 5, 2002
2792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Revision History:
2992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *      06-10-2003 Bryan YC Fan:  Re-write codes to support VT3253 spec.
3092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *      08-26-2003 Kyle Hsu    :  Add defines of packet type and TX rate.
3192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond */
3292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
3392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#ifndef __BASEBAND_H__
3492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define __BASEBAND_H__
3592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
3692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "device.h"
3792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
3892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define PREAMBLE_LONG   0
3992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define PREAMBLE_SHORT  1
4092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
4174ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More/*
4274ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More * Registers in the BASEBAND
4374ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More */
4492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define BB_MAX_CONTEXT_SIZE 256
4592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
4674ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More#define C_SIFS_A      16      /* usec */
4792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define C_SIFS_BG     10
4892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
4974ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More#define C_EIFS      80      /* usec */
5092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
5174ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More#define C_SLOT_SHORT   9      /* usec */
5292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define C_SLOT_LONG   20
5392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
5474ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More#define C_CWMIN_A     15       /* slot time */
5592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define C_CWMIN_B     31
5692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
5774ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More#define C_CWMAX      1023     /* slot time */
5892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
5974ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More/* 0:11A 1:11B 2:11G */
6092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define BB_TYPE_11A    0
6192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define BB_TYPE_11B    1
6292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define BB_TYPE_11G    2
6392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
6474ecdc5e4bbd6a7f399e4a3cb61270b46d2e62d3Andres More/* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */
6592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define PK_TYPE_11A     0
6692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define PK_TYPE_11B     1
6792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define PK_TYPE_11GB    2
6892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define PK_TYPE_11GA    3
6992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
7092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_54M        0x80000000
7192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_48M        0x40000000
7292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_36M        0x20000000
7392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_24M        0x10000000
7492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_18M        0x08000000
7592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_12M        0x04000000
7692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_11M        0x02000000
7792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_9M         0x01000000
7892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_6M         0x00800000
7992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_55M        0x00400000
8092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_2M         0x00200000
8192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TOP_RATE_1M         0x00100000
8292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
83aed387c78d4ad3cb7b65670785ab396ce06d0b5dMalcolm Priestley/* Length, Service, and Signal fields of Phy for Tx */
84aed387c78d4ad3cb7b65670785ab396ce06d0b5dMalcolm Priestleystruct vnt_phy_field {
85aed387c78d4ad3cb7b65670785ab396ce06d0b5dMalcolm Priestley	u8 signal;
86aed387c78d4ad3cb7b65670785ab396ce06d0b5dMalcolm Priestley	u8 service;
87688141d674b4b44b43b46adfa52bff5cf48834bfMalcolm Priestley	__le16 len;
88aed387c78d4ad3cb7b65670785ab396ce06d0b5dMalcolm Priestley} __packed;
89aed387c78d4ad3cb7b65670785ab396ce06d0b5dMalcolm Priestley
90d38ee5b2a445e182e644c83cbadc7f33d24eef15Malcolm Priestleyunsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
91030ede1e0ed4b112f774e3bef82e93a188ac8969Malcolm Priestley	unsigned int frame_length, u16 tx_rate);
9292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
93205056f35054a5590d5f69d76c9653b97d01d87fMalcolm Priestleyvoid vnt_get_phy_field(struct vnt_private *, u32 frame_length,
94a1ff5435145a06900fb4673db4974934a3ea3015Malcolm Priestley	u16 tx_rate, u8 pkt_type, struct vnt_phy_field *);
9592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
963c956cc025cedf28ec97646439854d3c3a370883Malcolm Priestleyvoid vnt_set_short_slot_time(struct vnt_private *);
97de8690a2e38a6f3a4131b8fa4c01ecb1a99b3dccMalcolm Priestleyvoid vnt_set_vga_gain_offset(struct vnt_private *, u8);
9841868bf4b56d9177cce46eb8eca3f7895f065493Malcolm Priestleyvoid vnt_set_antenna_mode(struct vnt_private *, u8);
997534180cf97d97826bf734f5e4f9bbdc96d29c97Malcolm Priestleyint vnt_vt3184_init(struct vnt_private *);
100e8e072da885e7d9edd56e28e7e2accce9b050ac8Malcolm Priestleyvoid vnt_set_deep_sleep(struct vnt_private *);
1010e951753dc41096b795f10f3dfa7bc72ba76fc78Malcolm Priestleyvoid vnt_exit_deep_sleep(struct vnt_private *);
10280dcc0aeb92d37cb67eb2553de74d826983085a1Malcolm Priestleyvoid vnt_update_pre_ed_threshold(struct vnt_private *, int scanning);
10392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
104e7b07d1d8936e06f88dbe227401ce659c2f9dee5Andres More#endif /* __BASEBAND_H__ */
105