6 #define RTL8187_EEPROM_TXPWR_BASE 0x05
7 #define RTL8187_EEPROM_MAC_ADDR 0x07
8 #define RTL8187_EEPROM_TXPWR_CHAN_1 0x16 /* 3 channels */
9 #define RTL8187_EEPROM_TXPWR_CHAN_6 0x1B /* 2 channels */
10 #define RTL8187_EEPROM_TXPWR_CHAN_4 0x3D /* 2 channels */
12 #define RTL8187_REQT_READ 0xC0
13 #define RTL8187_REQT_WRITE 0x40
14 #define RTL8187_REQ_GET_REG 0x05
15 #define RTL8187_REQ_SET_REG 0x05
17 #define RTL8187_MAX_RX 0x9C4
19 struct rtl8187_rx_info {
21 struct ieee80211_hw *dev;
24 struct rtl8187_rx_hdr {
32 } __attribute__((packed));
34 struct rtl8187_tx_info {
35 struct ieee80211_tx_control *control;
37 struct ieee80211_hw *dev;
40 struct rtl8187_tx_hdr {
42 #define RTL8187_TX_FLAG_NO_ENCRYPT (1 << 15)
43 #define RTL8187_TX_FLAG_MORE_FRAG (1 << 17)
44 #define RTL8187_TX_FLAG_CTS (1 << 18)
45 #define RTL8187_TX_FLAG_RTS (1 << 23)
49 } __attribute__((packed));
52 /* common between rtl818x drivers */
53 struct rtl818x_csr *map;
54 void (*rf_init)(struct ieee80211_hw *);
57 /* rtl8187 specific */
58 struct ieee80211_channel channels[14];
59 struct ieee80211_rate rates[12];
60 struct ieee80211_hw_mode modes[2];
61 struct usb_device *udev;
65 struct sk_buff_head rx_queue;
68 void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
70 static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr)
74 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
75 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
76 (unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
81 static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr)
85 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
86 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
87 (unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
89 return le16_to_cpu(val);
92 static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
96 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
97 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
98 (unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
100 return le32_to_cpu(val);
103 static inline void rtl818x_iowrite8(struct rtl8187_priv *priv,
106 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
107 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
108 (unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
111 static inline void rtl818x_iowrite16(struct rtl8187_priv *priv,
112 __le16 *addr, u16 val)
114 __le16 buf = cpu_to_le16(val);
116 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
117 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
118 (unsigned long)addr, 0, &buf, sizeof(buf), HZ / 2);
121 static inline void rtl818x_iowrite32(struct rtl8187_priv *priv,
122 __le32 *addr, u32 val)
124 __le32 buf = cpu_to_le32(val);
126 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
127 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
128 (unsigned long)addr, 0, &buf, sizeof(buf), HZ / 2);
131 #endif /* RTL8187_H */