📄 rt2x00.h
字号:
unsigned int queue); /* * RX control handlers */ void (*fill_rxdone) (struct data_entry *entry, struct rxdata_entry_desc *desc); /* * Configuration handlers. */ void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac); void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid); void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type, const int tsf_sync); void (*config_preamble) (struct rt2x00_dev *rt2x00dev, const int short_preamble, const int ack_timeout, const int ack_consume_time); void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags, struct rt2x00lib_conf *libconf);#define CONFIG_UPDATE_PHYMODE ( 1 << 1 )#define CONFIG_UPDATE_CHANNEL ( 1 << 2 )#define CONFIG_UPDATE_TXPOWER ( 1 << 3 )#define CONFIG_UPDATE_ANTENNA ( 1 << 4 )#define CONFIG_UPDATE_SLOT_TIME ( 1 << 5 )#define CONFIG_UPDATE_BEACON_INT ( 1 << 6 )#define CONFIG_UPDATE_ALL 0xffff};/* * rt2x00 driver callback operation structure. */struct rt2x00_ops { const char *name; const unsigned int rxd_size; const unsigned int txd_size; const unsigned int eeprom_size; const unsigned int rf_size; const struct rt2x00lib_ops *lib; const struct ieee80211_ops *hw;#ifdef CONFIG_RT2X00_LIB_DEBUGFS const struct rt2x00debug *debugfs;#endif /* CONFIG_RT2X00_LIB_DEBUGFS */};/* * rt2x00 device flags */enum rt2x00_flags { /* * Device state flags */ DEVICE_PRESENT, DEVICE_REGISTERED_HW, DEVICE_INITIALIZED, DEVICE_STARTED, DEVICE_STARTED_SUSPEND, DEVICE_ENABLED_RADIO, DEVICE_DISABLED_RADIO_HW, /* * Driver features */ DRIVER_REQUIRE_FIRMWARE, DRIVER_REQUIRE_BEACON_RING, /* * Driver configuration */ CONFIG_SUPPORT_HW_BUTTON, CONFIG_FRAME_TYPE, CONFIG_RF_SEQUENCE, CONFIG_EXTERNAL_LNA_A, CONFIG_EXTERNAL_LNA_BG, CONFIG_DOUBLE_ANTENNA, CONFIG_DISABLE_LINK_TUNING, CONFIG_SHORT_PREAMBLE,};/* * rt2x00 device structure. */struct rt2x00_dev { /* * Device structure. * The structure stored in here depends on the * system bus (PCI or USB). * When accessing this variable, the rt2x00dev_{pci,usb} * macro's should be used for correct typecasting. */ void *dev;#define rt2x00dev_pci(__dev) ( (struct pci_dev*)(__dev)->dev )#define rt2x00dev_usb(__dev) ( (struct usb_interface*)(__dev)->dev ) /* * Callback functions. */ const struct rt2x00_ops *ops; /* * IEEE80211 control structure. */ struct ieee80211_hw *hw; struct ieee80211_hw_mode *hwmodes; unsigned int curr_hwmode;#define HWMODE_B 0#define HWMODE_G 1#define HWMODE_A 2 /* * rfkill structure for RF state switching support. * This will only be compiled in when required. */#ifdef CONFIG_RT2X00_LIB_RFKILL struct rfkill *rfkill; struct input_polled_dev *poll_dev;#endif /* CONFIG_RT2X00_LIB_RFKILL */ /* * If enabled, the debugfs interface structures * required for deregistration of debugfs. */#ifdef CONFIG_RT2X00_LIB_DEBUGFS const struct rt2x00debug_intf *debugfs_intf;#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ /* * Device flags. * In these flags the current status and some * of the device capabilities are stored. */ unsigned long flags; /* * Chipset identification. */ struct rt2x00_chip chip; /* * hw capability specifications. */ struct hw_mode_spec spec; /* * Register pointers * csr_addr: Base register address. (PCI) * csr_cache: CSR cache for usb_control_msg. (USB) */ void __iomem *csr_addr; void *csr_cache; /* * Interface configuration. */ struct interface interface; /* * Link quality */ struct link link; /* * EEPROM data. */ __le16 *eeprom; /* * Active RF register values. * These are stored here so we don't need * to read the rf registers and can directly * use this value instead. * This field should be accessed by using * rt2x00_rf_read() and rt2x00_rf_write(). */ u32 *rf; /* * USB Max frame size (for rt2500usb & rt73usb). */ u16 usb_maxpacket; /* * Current TX power value. */ u16 tx_power; /* * LED register (for rt61pci & rt73usb). */ u16 led_reg; /* * Led mode (LED_MODE_*) */ u8 led_mode; /* * Rssi <-> Dbm offset */ u8 rssi_offset; /* * Frequency offset (for rt61pci & rt73usb). */ u8 freq_offset; /* * Low level statistics which will have * to be kept up to date while device is running. */ struct ieee80211_low_level_stats low_level_stats; /* * RX configuration information. */ struct ieee80211_rx_status rx_status; /* * Scheduled work. */ struct work_struct beacon_work; struct work_struct filter_work; struct work_struct config_work; /* * Data ring arrays for RX, TX and Beacon. * The Beacon array also contains the Atim ring * if that is supported by the device. */ int data_rings; struct data_ring *rx; struct data_ring *tx; struct data_ring *bcn; /* * Firmware image. */ const struct firmware *fw;};/* * For-each loop for the ring array. * All rings have been allocated as a single array, * this means we can create a very simply loop macro * that is capable of looping through all rings. * ring_end(), txring_end() and ring_loop() are helper macro's which * should not be used directly. Instead the following should be used: * ring_for_each() - Loops through all rings (RX, TX, Beacon & Atim) * txring_for_each() - Loops through TX data rings (TX only) * txringall_for_each() - Loops through all TX rings (TX, Beacon & Atim) */#define ring_end(__dev) \ &(__dev)->rx[(__dev)->data_rings]#define txring_end(__dev) \ &(__dev)->tx[(__dev)->hw->queues]#define ring_loop(__entry, __start, __end) \ for ((__entry) = (__start); \ prefetch(&(__entry)[1]), (__entry) != (__end); \ (__entry) = &(__entry)[1])#define ring_for_each(__dev, __entry) \ ring_loop(__entry, (__dev)->rx, ring_end(__dev))#define txring_for_each(__dev, __entry) \ ring_loop(__entry, (__dev)->tx, txring_end(__dev))#define txringall_for_each(__dev, __entry) \ ring_loop(__entry, (__dev)->tx, ring_end(__dev))/* * Generic RF access. * The RF is being accessed by word index. */static inline void rt2x00_rf_read(const struct rt2x00_dev *rt2x00dev, const unsigned int word, u32 *data){ *data = rt2x00dev->rf[word];}static inline void rt2x00_rf_write(const struct rt2x00_dev *rt2x00dev, const unsigned int word, u32 data){ rt2x00dev->rf[word] = data;}/* * Generic EEPROM access. * The EEPROM is being accessed by word index. */static inline void *rt2x00_eeprom_addr(const struct rt2x00_dev *rt2x00dev, const unsigned int word){ return (void *)&rt2x00dev->eeprom[word];}static inline void rt2x00_eeprom_read(const struct rt2x00_dev *rt2x00dev, const unsigned int word, u16 *data){ *data = le16_to_cpu(rt2x00dev->eeprom[word]);}static inline void rt2x00_eeprom_write(const struct rt2x00_dev *rt2x00dev, const unsigned int word, u16 data){ rt2x00dev->eeprom[word] = cpu_to_le16(data);}/* * Chipset handlers */static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev, const u16 rt, const u16 rf, const u32 rev){ INFO(rt2x00dev, "Chipset detected - rt: %04x, rf: %04x, rev: %08x.\n", rt, rf, rev); rt2x00dev->chip.rt = rt; rt2x00dev->chip.rf = rf; rt2x00dev->chip.rev = rev;}static inline char rt2x00_rt(const struct rt2x00_chip *chipset, const u16 chip){ return (chipset->rt == chip);}static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip){ return (chipset->rf == chip);}static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset){ return chipset->rev;}static inline u16 rt2x00_check_rev(const struct rt2x00_chip *chipset, const u32 rev){ return (((chipset->rev & 0xffff0) == rev) && !!(chipset->rev & 0x0000f));}/* * Duration calculations * The rate variable passed is: 100kbs. * To convert from bytes to bits we multiply size with 8, * then the size is multiplied with 10 to make the * real rate -> rate argument correction. */static inline u16 get_duration(const unsigned int size, const u8 rate){ return ((size * 8 * 10) / rate);}static inline u16 get_duration_res(const unsigned int size, const u8 rate){ return ((size * 8 * 10) % rate);}/* * Library functions. */struct data_ring *rt2x00lib_get_ring(struct rt2x00_dev *rt2x00dev, const unsigned int queue);/* * Interrupt context handlers. */void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev);void rt2x00lib_txdone(struct data_entry *entry, const int status, const int retry);void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb, struct rxdata_entry_desc *desc);/* * TX descriptor initializer */void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, struct data_desc *txd, struct ieee80211_hdr *ieee80211hdr, unsigned int length, struct ieee80211_tx_control *control);/* * mac80211 handlers. */int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_control *control);int rt2x00mac_start(struct ieee80211_hw *hw);void rt2x00mac_stop(struct ieee80211_hw *hw);int rt2x00mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf);void rt2x00mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf);int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf);int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, struct ieee80211_if_conf *conf);int rt2x00mac_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats);int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, struct ieee80211_tx_queue_stats *stats);void rt2x00mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, int cts_protection, int preamble);int rt2x00mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params);/* * Driver allocation handlers. */int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev);void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev);#ifdef CONFIG_PMint rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state);int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev);#endif /* CONFIG_PM */#endif /* RT2X00_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -