Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1 | /* |
| 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 | * |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 15 | * |
| 16 | * File: baseband.h |
| 17 | * |
| 18 | * Purpose: Implement functions to access baseband |
| 19 | * |
| 20 | * Author: Jerry Chen |
| 21 | * |
| 22 | * Date: Jun. 5, 2002 |
| 23 | * |
| 24 | * Revision History: |
| 25 | * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec. |
| 26 | * 08-26-2003 Kyle Hsu : Add defines of packet type and TX rate. |
| 27 | */ |
| 28 | |
| 29 | #ifndef __BASEBAND_H__ |
| 30 | #define __BASEBAND_H__ |
| 31 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 32 | #include "device.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 33 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 34 | #define PREAMBLE_LONG 0 |
| 35 | #define PREAMBLE_SHORT 1 |
| 36 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 37 | /* |
| 38 | * Registers in the BASEBAND |
| 39 | */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 40 | #define BB_MAX_CONTEXT_SIZE 256 |
| 41 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 42 | #define C_SIFS_A 16 /* usec */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 43 | #define C_SIFS_BG 10 |
| 44 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 45 | #define C_EIFS 80 /* usec */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 46 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 47 | #define C_SLOT_SHORT 9 /* usec */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 48 | #define C_SLOT_LONG 20 |
| 49 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 50 | #define C_CWMIN_A 15 /* slot time */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 51 | #define C_CWMIN_B 31 |
| 52 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 53 | #define C_CWMAX 1023 /* slot time */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 54 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 55 | /* 0:11A 1:11B 2:11G */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 56 | #define BB_TYPE_11A 0 |
| 57 | #define BB_TYPE_11B 1 |
| 58 | #define BB_TYPE_11G 2 |
| 59 | |
Andres More | 74ecdc5 | 2013-01-31 14:55:58 -0500 | [diff] [blame] | 60 | /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga (OFDM in BasicRate) */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 61 | #define PK_TYPE_11A 0 |
| 62 | #define PK_TYPE_11B 1 |
| 63 | #define PK_TYPE_11GB 2 |
| 64 | #define PK_TYPE_11GA 3 |
| 65 | |
| 66 | #define TOP_RATE_54M 0x80000000 |
| 67 | #define TOP_RATE_48M 0x40000000 |
| 68 | #define TOP_RATE_36M 0x20000000 |
| 69 | #define TOP_RATE_24M 0x10000000 |
| 70 | #define TOP_RATE_18M 0x08000000 |
| 71 | #define TOP_RATE_12M 0x04000000 |
| 72 | #define TOP_RATE_11M 0x02000000 |
| 73 | #define TOP_RATE_9M 0x01000000 |
| 74 | #define TOP_RATE_6M 0x00800000 |
| 75 | #define TOP_RATE_55M 0x00400000 |
| 76 | #define TOP_RATE_2M 0x00200000 |
| 77 | #define TOP_RATE_1M 0x00100000 |
| 78 | |
Malcolm Priestley | aed387c | 2013-08-20 22:52:30 +0100 | [diff] [blame] | 79 | /* Length, Service, and Signal fields of Phy for Tx */ |
| 80 | struct vnt_phy_field { |
| 81 | u8 signal; |
| 82 | u8 service; |
Malcolm Priestley | 688141d | 2013-08-28 20:52:23 +0100 | [diff] [blame] | 83 | __le16 len; |
Malcolm Priestley | aed387c | 2013-08-20 22:52:30 +0100 | [diff] [blame] | 84 | } __packed; |
| 85 | |
Malcolm Priestley | d38ee5b | 2014-06-04 18:25:35 +0100 | [diff] [blame] | 86 | unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, |
Rithvik Patibandla | 1322739 | 2016-06-17 12:25:42 +0530 | [diff] [blame] | 87 | unsigned int frame_length, u16 tx_rate); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 88 | |
Malcolm Priestley | 205056f | 2014-06-04 18:25:34 +0100 | [diff] [blame] | 89 | void vnt_get_phy_field(struct vnt_private *, u32 frame_length, |
Rithvik Patibandla | 1322739 | 2016-06-17 12:25:42 +0530 | [diff] [blame] | 90 | u16 tx_rate, u8 pkt_type, struct vnt_phy_field *); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 91 | |
Malcolm Priestley | 3c956cc | 2014-07-16 22:21:54 +0100 | [diff] [blame] | 92 | void vnt_set_short_slot_time(struct vnt_private *); |
Malcolm Priestley | de8690a | 2014-07-16 22:21:55 +0100 | [diff] [blame] | 93 | void vnt_set_vga_gain_offset(struct vnt_private *, u8); |
Malcolm Priestley | 41868bf | 2014-07-16 22:21:52 +0100 | [diff] [blame] | 94 | void vnt_set_antenna_mode(struct vnt_private *, u8); |
Malcolm Priestley | 7534180 | 2014-07-16 22:21:53 +0100 | [diff] [blame] | 95 | int vnt_vt3184_init(struct vnt_private *); |
Malcolm Priestley | e8e072d | 2014-07-16 22:21:56 +0100 | [diff] [blame] | 96 | void vnt_set_deep_sleep(struct vnt_private *); |
Malcolm Priestley | 0e95175 | 2014-07-16 22:21:57 +0100 | [diff] [blame] | 97 | void vnt_exit_deep_sleep(struct vnt_private *); |
Malcolm Priestley | 80dcc0a | 2014-07-16 22:21:58 +0100 | [diff] [blame] | 98 | void vnt_update_pre_ed_threshold(struct vnt_private *, int scanning); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 99 | |
Andres More | e7b07d1 | 2010-05-01 19:12:26 -0300 | [diff] [blame] | 100 | #endif /* __BASEBAND_H__ */ |