| Bartlomiej Zolnierkiewicz | 7ef5cc9 | 2009-11-04 18:35:32 +0100 | [diff] [blame] | 1 | /* | 
|  | 2 | Copyright (C) 2009 Bartlomiej Zolnierkiewicz | 
|  | 3 |  | 
|  | 4 | This program is free software; you can redistribute it and/or modify | 
|  | 5 | it under the terms of the GNU General Public License as published by | 
|  | 6 | the Free Software Foundation; either version 2 of the License, or | 
|  | 7 | (at your option) any later version. | 
|  | 8 |  | 
|  | 9 | This program is distributed in the hope that it will be useful, | 
|  | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
|  | 12 | GNU General Public License for more details. | 
|  | 13 |  | 
|  | 14 | You should have received a copy of the GNU General Public License | 
|  | 15 | along with this program; if not, write to the | 
|  | 16 | Free Software Foundation, Inc., | 
|  | 17 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 
|  | 18 | */ | 
|  | 19 |  | 
|  | 20 | #ifndef RT2800LIB_H | 
|  | 21 | #define RT2800LIB_H | 
|  | 22 |  | 
|  | 23 | struct rt2800_ops { | 
|  | 24 | void (*register_read)(struct rt2x00_dev *rt2x00dev, | 
|  | 25 | const unsigned int offset, u32 *value); | 
| Gertjan van Wingerde | 31a4cf1 | 2009-11-14 20:20:36 +0100 | [diff] [blame] | 26 | void (*register_read_lock)(struct rt2x00_dev *rt2x00dev, | 
|  | 27 | const unsigned int offset, u32 *value); | 
| Bartlomiej Zolnierkiewicz | 7ef5cc9 | 2009-11-04 18:35:32 +0100 | [diff] [blame] | 28 | void (*register_write)(struct rt2x00_dev *rt2x00dev, | 
|  | 29 | const unsigned int offset, u32 value); | 
|  | 30 | void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, | 
|  | 31 | const unsigned int offset, u32 value); | 
|  | 32 |  | 
|  | 33 | void (*register_multiread)(struct rt2x00_dev *rt2x00dev, | 
|  | 34 | const unsigned int offset, | 
|  | 35 | void *value, const u32 length); | 
|  | 36 | void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, | 
|  | 37 | const unsigned int offset, | 
|  | 38 | const void *value, const u32 length); | 
|  | 39 |  | 
|  | 40 | int (*regbusy_read)(struct rt2x00_dev *rt2x00dev, | 
|  | 41 | const unsigned int offset, | 
|  | 42 | const struct rt2x00_field32 field, u32 *reg); | 
|  | 43 | }; | 
|  | 44 |  | 
|  | 45 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, | 
|  | 46 | const unsigned int offset, | 
|  | 47 | u32 *value) | 
|  | 48 | { | 
|  | 49 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | 
|  | 50 |  | 
|  | 51 | rt2800ops->register_read(rt2x00dev, offset, value); | 
|  | 52 | } | 
|  | 53 |  | 
| Gertjan van Wingerde | 31a4cf1 | 2009-11-14 20:20:36 +0100 | [diff] [blame] | 54 | static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev, | 
|  | 55 | const unsigned int offset, | 
|  | 56 | u32 *value) | 
|  | 57 | { | 
|  | 58 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | 
|  | 59 |  | 
|  | 60 | rt2800ops->register_read_lock(rt2x00dev, offset, value); | 
|  | 61 | } | 
|  | 62 |  | 
| Bartlomiej Zolnierkiewicz | 7ef5cc9 | 2009-11-04 18:35:32 +0100 | [diff] [blame] | 63 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, | 
|  | 64 | const unsigned int offset, | 
|  | 65 | u32 value) | 
|  | 66 | { | 
|  | 67 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | 
|  | 68 |  | 
|  | 69 | rt2800ops->register_write(rt2x00dev, offset, value); | 
|  | 70 | } | 
|  | 71 |  | 
|  | 72 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, | 
|  | 73 | const unsigned int offset, | 
|  | 74 | u32 value) | 
|  | 75 | { | 
|  | 76 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | 
|  | 77 |  | 
|  | 78 | rt2800ops->register_write_lock(rt2x00dev, offset, value); | 
|  | 79 | } | 
|  | 80 |  | 
|  | 81 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, | 
|  | 82 | const unsigned int offset, | 
|  | 83 | void *value, const u32 length) | 
|  | 84 | { | 
|  | 85 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | 
|  | 86 |  | 
|  | 87 | rt2800ops->register_multiread(rt2x00dev, offset, value, length); | 
|  | 88 | } | 
|  | 89 |  | 
|  | 90 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, | 
|  | 91 | const unsigned int offset, | 
|  | 92 | const void *value, | 
|  | 93 | const u32 length) | 
|  | 94 | { | 
|  | 95 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | 
|  | 96 |  | 
|  | 97 | rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); | 
|  | 98 | } | 
|  | 99 |  | 
|  | 100 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, | 
|  | 101 | const unsigned int offset, | 
|  | 102 | const struct rt2x00_field32 field, | 
|  | 103 | u32 *reg) | 
|  | 104 | { | 
|  | 105 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | 
|  | 106 |  | 
|  | 107 | return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); | 
|  | 108 | } | 
|  | 109 |  | 
| Bartlomiej Zolnierkiewicz | 8929742 | 2009-11-04 18:36:24 +0100 | [diff] [blame] | 110 | void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | 
|  | 111 | const u8 command, const u8 token, | 
|  | 112 | const u8 arg0, const u8 arg1); | 
|  | 113 |  | 
| Bartlomiej Zolnierkiewicz | f445061 | 2009-11-04 18:36:40 +0100 | [diff] [blame] | 114 | extern const struct rt2x00debug rt2800_rt2x00debug; | 
|  | 115 |  | 
|  | 116 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); | 
|  | 117 | void rt2800_init_led(struct rt2x00_dev *rt2x00dev, | 
|  | 118 | struct rt2x00_led *led, enum led_type type); | 
|  | 119 | int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev, | 
|  | 120 | struct rt2x00lib_crypto *crypto, | 
|  | 121 | struct ieee80211_key_conf *key); | 
|  | 122 | int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev, | 
|  | 123 | struct rt2x00lib_crypto *crypto, | 
|  | 124 | struct ieee80211_key_conf *key); | 
|  | 125 | void rt2800_config_filter(struct rt2x00_dev *rt2x00dev, | 
|  | 126 | const unsigned int filter_flags); | 
|  | 127 | void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, | 
|  | 128 | struct rt2x00intf_conf *conf, const unsigned int flags); | 
|  | 129 | void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp); | 
|  | 130 | void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant); | 
|  | 131 | void rt2800_config(struct rt2x00_dev *rt2x00dev, | 
|  | 132 | struct rt2x00lib_conf *libconf, | 
|  | 133 | const unsigned int flags); | 
|  | 134 | void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); | 
|  | 135 | void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); | 
|  | 136 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, | 
|  | 137 | const u32 count); | 
|  | 138 |  | 
| Bartlomiej Zolnierkiewicz | fcf5154 | 2009-11-04 18:36:57 +0100 | [diff] [blame] | 139 | int rt2800_init_registers(struct rt2x00_dev *rt2x00dev); | 
|  | 140 | int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev); | 
|  | 141 | int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev); | 
|  | 142 |  | 
| Bartlomiej Zolnierkiewicz | 30e8403 | 2009-11-08 14:39:48 +0100 | [diff] [blame] | 143 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev); | 
|  | 144 | void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev); | 
| Bartlomiej Zolnierkiewicz | 38bd7b8 | 2009-11-08 14:39:01 +0100 | [diff] [blame] | 145 | int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev); | 
|  | 146 | int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev); | 
| Bartlomiej Zolnierkiewicz | 4da2933 | 2009-11-08 14:39:32 +0100 | [diff] [blame] | 147 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev); | 
| Bartlomiej Zolnierkiewicz | 38bd7b8 | 2009-11-08 14:39:01 +0100 | [diff] [blame] | 148 |  | 
| Bartlomiej Zolnierkiewicz | 2ce3399 | 2009-11-04 18:37:05 +0100 | [diff] [blame] | 149 | extern const struct ieee80211_ops rt2800_mac80211_ops; | 
|  | 150 |  | 
| Bartlomiej Zolnierkiewicz | 7ef5cc9 | 2009-11-04 18:35:32 +0100 | [diff] [blame] | 151 | #endif /* RT2800LIB_H */ |