Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107818550
D3838.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D3838.diff
View Options
Index: head/sys/dev/usb/wlan/if_urtwn.c
===================================================================
--- head/sys/dev/usb/wlan/if_urtwn.c
+++ head/sys/dev/usb/wlan/if_urtwn.c
@@ -222,6 +222,7 @@
static int urtwn_ra_init(struct urtwn_softc *);
static void urtwn_tsf_sync_enable(struct urtwn_softc *);
static void urtwn_set_led(struct urtwn_softc *, int, int);
+static void urtwn_set_mode(struct urtwn_softc *, uint8_t);
static int urtwn_newstate(struct ieee80211vap *,
enum ieee80211_state, int);
static void urtwn_watchdog(void *);
@@ -1522,6 +1523,16 @@
}
}
+static void
+urtwn_set_mode(struct urtwn_softc *sc, uint8_t mode)
+{
+ uint8_t reg;
+
+ reg = urtwn_read_1(sc, R92C_MSR);
+ reg = (reg & ~R92C_MSR_MASK) | mode;
+ urtwn_write_1(sc, R92C_MSR, reg);
+}
+
static int
urtwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
{
@@ -1530,7 +1541,6 @@
struct urtwn_softc *sc = ic->ic_softc;
struct ieee80211_node *ni;
enum ieee80211_state ostate;
- uint32_t reg;
ostate = vap->iv_state;
DPRINTF("%s -> %s\n", ieee80211_state_name[ostate],
@@ -1545,9 +1555,7 @@
urtwn_set_led(sc, URTWN_LED_LINK, 0);
/* Set media status to 'No Link'. */
- reg = urtwn_read_4(sc, R92C_CR);
- reg = RW(reg, R92C_CR_NETTYPE, R92C_CR_NETTYPE_NOLINK);
- urtwn_write_4(sc, R92C_CR, reg);
+ urtwn_set_mode(sc, R92C_MSR_NOLINK);
/* Stop Rx of data frames. */
urtwn_write_2(sc, R92C_RXFLTMAP2, 0);
@@ -1632,9 +1640,7 @@
ni = ieee80211_ref_node(vap->iv_bss);
/* Set media status to 'Associated'. */
- reg = urtwn_read_4(sc, R92C_CR);
- reg = RW(reg, R92C_CR_NETTYPE, R92C_CR_NETTYPE_INFRA);
- urtwn_write_4(sc, R92C_CR, reg);
+ urtwn_set_mode(sc, R92C_MSR_INFRA);
/* Set BSSID. */
urtwn_write_4(sc, R92C_BSSID + 0, LE_READ_4(&ni->ni_bssid[0]));
@@ -3294,9 +3300,7 @@
urtwn_write_region_1(sc, R92C_MACID, macaddr, IEEE80211_ADDR_LEN);
/* Set initial network type. */
- reg = urtwn_read_4(sc, R92C_CR);
- reg = RW(reg, R92C_CR_NETTYPE, R92C_CR_NETTYPE_INFRA);
- urtwn_write_4(sc, R92C_CR, reg);
+ urtwn_set_mode(sc, R92C_MSR_INFRA);
urtwn_rxfilter_init(sc);
Index: head/sys/dev/usb/wlan/if_urtwnreg.h
===================================================================
--- head/sys/dev/usb/wlan/if_urtwnreg.h
+++ head/sys/dev/usb/wlan/if_urtwnreg.h
@@ -96,6 +96,7 @@
#define R92C_SYS_CFG 0x0f0
/* MAC General Configuration. */
#define R92C_CR 0x100
+#define R92C_MSR 0x102
#define R92C_PBP 0x104
#define R92C_TRXDMA_CTRL 0x10c
#define R92C_TRXFF_BNDY 0x114
@@ -377,22 +378,23 @@
#define R92C_SYS_CFG_TYPE_92C 0x08000000
/* Bits for R92C_CR. */
-#define R92C_CR_HCI_TXDMA_EN 0x00000001
-#define R92C_CR_HCI_RXDMA_EN 0x00000002
-#define R92C_CR_TXDMA_EN 0x00000004
-#define R92C_CR_RXDMA_EN 0x00000008
-#define R92C_CR_PROTOCOL_EN 0x00000010
-#define R92C_CR_SCHEDULE_EN 0x00000020
-#define R92C_CR_MACTXEN 0x00000040
-#define R92C_CR_MACRXEN 0x00000080
-#define R92C_CR_ENSEC 0x00000200
-#define R92C_CR_CALTMR_EN 0x00000400
-#define R92C_CR_NETTYPE_S 16
-#define R92C_CR_NETTYPE_M 0x00030000
-#define R92C_CR_NETTYPE_NOLINK 0
-#define R92C_CR_NETTYPE_ADHOC 1
-#define R92C_CR_NETTYPE_INFRA 2
-#define R92C_CR_NETTYPE_AP 3
+#define R92C_CR_HCI_TXDMA_EN 0x0001
+#define R92C_CR_HCI_RXDMA_EN 0x0002
+#define R92C_CR_TXDMA_EN 0x0004
+#define R92C_CR_RXDMA_EN 0x0008
+#define R92C_CR_PROTOCOL_EN 0x0010
+#define R92C_CR_SCHEDULE_EN 0x0020
+#define R92C_CR_MACTXEN 0x0040
+#define R92C_CR_MACRXEN 0x0080
+#define R92C_CR_ENSEC 0x0200
+#define R92C_CR_CALTMR_EN 0x0400
+
+/* Bits for R92C_MSR. */
+#define R92C_MSR_NOLINK 0x00
+#define R92C_MSR_ADHOC 0x01
+#define R92C_MSR_INFRA 0x02
+#define R92C_MSR_AP 0x03
+#define R92C_MSR_MASK (R92C_MSR_AP)
/* Bits for R92C_PBP. */
#define R92C_PBP_PSRX_M 0x0f
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 11:30 AM (16 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15940077
Default Alt Text
D3838.diff (3 KB)
Attached To
Mode
D3838: urtwn(4): separate R92C_MSR register from R92C_CR register
Attached
Detach File
Event Timeline
Log In to Comment