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); |
| 26 | void (*register_write)(struct rt2x00_dev *rt2x00dev, |
| 27 | const unsigned int offset, u32 value); |
| 28 | void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, |
| 29 | const unsigned int offset, u32 value); |
| 30 | |
| 31 | void (*register_multiread)(struct rt2x00_dev *rt2x00dev, |
| 32 | const unsigned int offset, |
| 33 | void *value, const u32 length); |
| 34 | void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, |
| 35 | const unsigned int offset, |
| 36 | const void *value, const u32 length); |
| 37 | |
| 38 | int (*regbusy_read)(struct rt2x00_dev *rt2x00dev, |
| 39 | const unsigned int offset, |
| 40 | const struct rt2x00_field32 field, u32 *reg); |
| 41 | }; |
| 42 | |
| 43 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, |
| 44 | const unsigned int offset, |
| 45 | u32 *value) |
| 46 | { |
| 47 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
| 48 | |
| 49 | rt2800ops->register_read(rt2x00dev, offset, value); |
| 50 | } |
| 51 | |
| 52 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, |
| 53 | const unsigned int offset, |
| 54 | u32 value) |
| 55 | { |
| 56 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
| 57 | |
| 58 | rt2800ops->register_write(rt2x00dev, offset, value); |
| 59 | } |
| 60 | |
| 61 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, |
| 62 | const unsigned int offset, |
| 63 | u32 value) |
| 64 | { |
| 65 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
| 66 | |
| 67 | rt2800ops->register_write_lock(rt2x00dev, offset, value); |
| 68 | } |
| 69 | |
| 70 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, |
| 71 | const unsigned int offset, |
| 72 | void *value, const u32 length) |
| 73 | { |
| 74 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
| 75 | |
| 76 | rt2800ops->register_multiread(rt2x00dev, offset, value, length); |
| 77 | } |
| 78 | |
| 79 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, |
| 80 | const unsigned int offset, |
| 81 | const void *value, |
| 82 | const u32 length) |
| 83 | { |
| 84 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
| 85 | |
| 86 | rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); |
| 87 | } |
| 88 | |
| 89 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, |
| 90 | const unsigned int offset, |
| 91 | const struct rt2x00_field32 field, |
| 92 | u32 *reg) |
| 93 | { |
| 94 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
| 95 | |
| 96 | return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); |
| 97 | } |
| 98 | |
Bartlomiej Zolnierkiewicz | 8929742 | 2009-11-04 18:36:24 +0100 | [diff] [blame] | 99 | void rt2800_bbp_write(struct rt2x00_dev *rt2x00dev, |
| 100 | const unsigned int word, const u8 value); |
| 101 | void rt2800_bbp_read(struct rt2x00_dev *rt2x00dev, |
| 102 | const unsigned int word, u8 *value); |
| 103 | void rt2800_rfcsr_write(struct rt2x00_dev *rt2x00dev, |
| 104 | const unsigned int word, const u8 value); |
| 105 | void rt2800_rfcsr_read(struct rt2x00_dev *rt2x00dev, |
| 106 | const unsigned int word, u8 *value); |
| 107 | void rt2800_rf_write(struct rt2x00_dev *rt2x00dev, |
| 108 | const unsigned int word, const u32 value); |
| 109 | void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, |
| 110 | const u8 command, const u8 token, |
| 111 | const u8 arg0, const u8 arg1); |
| 112 | |
Bartlomiej Zolnierkiewicz | f445061 | 2009-11-04 18:36:40 +0100 | [diff] [blame] | 113 | extern const struct rt2x00debug rt2800_rt2x00debug; |
| 114 | |
| 115 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); |
| 116 | void rt2800_init_led(struct rt2x00_dev *rt2x00dev, |
| 117 | struct rt2x00_led *led, enum led_type type); |
| 118 | int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev, |
| 119 | struct rt2x00lib_crypto *crypto, |
| 120 | struct ieee80211_key_conf *key); |
| 121 | int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev, |
| 122 | struct rt2x00lib_crypto *crypto, |
| 123 | struct ieee80211_key_conf *key); |
| 124 | void rt2800_config_filter(struct rt2x00_dev *rt2x00dev, |
| 125 | const unsigned int filter_flags); |
| 126 | void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, |
| 127 | struct rt2x00intf_conf *conf, const unsigned int flags); |
| 128 | void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp); |
| 129 | void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant); |
| 130 | void rt2800_config(struct rt2x00_dev *rt2x00dev, |
| 131 | struct rt2x00lib_conf *libconf, |
| 132 | const unsigned int flags); |
| 133 | void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); |
| 134 | void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); |
| 135 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, |
| 136 | const u32 count); |
| 137 | |
Bartlomiej Zolnierkiewicz | 7ef5cc9 | 2009-11-04 18:35:32 +0100 | [diff] [blame] | 138 | #endif /* RT2800LIB_H */ |