FreeBSD kernel usb device Code
if_ural.c File Reference
#include <sys/cdefs.h>
#include "opt_wlan.h"
#include <sys/param.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/mbuf.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/endian.h>
#include <sys/kdb.h>
#include <net/bpf.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_regdomain.h>
#include <net80211/ieee80211_radiotap.h>
#include <net80211/ieee80211_ratectl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include "usbdevs.h"
#include <dev/usb/usb_debug.h>
#include <dev/usb/wlan/if_uralreg.h>
#include <dev/usb/wlan/if_uralvar.h>
Include dependency graph for if_ural.c:

Go to the source code of this file.

Macros

#define USB_DEBUG_VAR   ural_debug
 
#define URAL_RSSI(rssi)
 
#define URAL_DEV(v, p)   { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
 
#define RAL_TX_TIMEOUT   5000
 
#define RAL_RXTX_TURNAROUND   5 /* us */
 

Functions

 __FBSDID ("$FreeBSD$")
 
static usb_error_t ural_do_request (struct ural_softc *sc, struct usb_device_request *req, void *data)
 
static struct ieee80211vap * ural_vap_create (struct ieee80211com *, const char[IFNAMSIZ], int, enum ieee80211_opmode, int, const uint8_t[IEEE80211_ADDR_LEN], const uint8_t[IEEE80211_ADDR_LEN])
 
static void ural_vap_delete (struct ieee80211vap *)
 
static void ural_tx_free (struct ural_tx_data *, int)
 
static void ural_setup_tx_list (struct ural_softc *)
 
static void ural_unsetup_tx_list (struct ural_softc *)
 
static int ural_newstate (struct ieee80211vap *, enum ieee80211_state, int)
 
static void ural_setup_tx_desc (struct ural_softc *, struct ural_tx_desc *, uint32_t, int, int)
 
static int ural_tx_bcn (struct ural_softc *, struct mbuf *, struct ieee80211_node *)
 
static int ural_tx_mgt (struct ural_softc *, struct mbuf *, struct ieee80211_node *)
 
static int ural_tx_data (struct ural_softc *, struct mbuf *, struct ieee80211_node *)
 
static int ural_transmit (struct ieee80211com *, struct mbuf *)
 
static void ural_start (struct ural_softc *)
 
static void ural_parent (struct ieee80211com *)
 
static void ural_set_testmode (struct ural_softc *)
 
static void ural_eeprom_read (struct ural_softc *, uint16_t, void *, int)
 
static uint16_t ural_read (struct ural_softc *, uint16_t)
 
static void ural_read_multi (struct ural_softc *, uint16_t, void *, int)
 
static void ural_write (struct ural_softc *, uint16_t, uint16_t)
 
static void ural_write_multi (struct ural_softc *, uint16_t, void *, static void ural_getradiocaps(struct ieee80211com int)
 
 DRIVER_MODULE (ural, uhub, ural_driver, ural_devclass, NULL, 0)
 
 MODULE_DEPEND (ural, usb, 1, 1, 1)
 
 MODULE_DEPEND (ural, wlan, 1, 1, 1)
 
 MODULE_VERSION (ural, 1)
 
 USB_PNP_HOST_INFO (ural_devs)
 
static int ural_match (device_t self)
 
static int ural_attach (device_t self)
 
static int ural_detach (device_t self)
 
static void ural_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void ural_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error)
 
static uint8_t ural_plcp_signal (int rate)
 
static int ural_sendprot (struct ural_softc *sc, const struct mbuf *m, struct ieee80211_node *ni, int prot, int rate)
 
static int ural_tx_raw (struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni, const struct ieee80211_bpf_params *params)
 
static void ural_write_multi (struct ural_softc *sc, uint16_t reg, void *buf, int len)
 
static void ural_bbp_write (struct ural_softc *sc, uint8_t reg, uint8_t val)
 
static uint8_t ural_bbp_read (struct ural_softc *sc, uint8_t reg)
 
static void ural_rf_write (struct ural_softc *sc, uint8_t reg, uint32_t val)
 
static void ural_scan_start (struct ieee80211com *ic)
 
static void ural_scan_end (struct ieee80211com *ic)
 
static void ural_getradiocaps (struct ieee80211com *ic, int maxchans, int *nchans, struct ieee80211_channel chans[])
 
static void ural_set_channel (struct ieee80211com *ic)
 
static void ural_set_chan (struct ural_softc *sc, struct ieee80211_channel *c)
 
static void ural_disable_rf_tune (struct ural_softc *sc)
 
static void ural_enable_tsf_sync (struct ural_softc *sc)
 
static void ural_enable_tsf (struct ural_softc *sc)
 
static void ural_update_slot (struct ural_softc *sc)
 
static void ural_set_txpreamble (struct ural_softc *sc)
 
static void ural_set_basicrates (struct ural_softc *sc, const struct ieee80211_channel *c)
 
static void ural_set_bssid (struct ural_softc *sc, const uint8_t *bssid)
 
static void ural_set_macaddr (struct ural_softc *sc, const uint8_t *addr)
 
static void ural_setpromisc (struct ural_softc *sc)
 
static void ural_update_promisc (struct ieee80211com *ic)
 
static const char * ural_get_rf (int rev)
 
static void ural_read_eeprom (struct ural_softc *sc)
 
static int ural_bbp_init (struct ural_softc *sc)
 
static void ural_set_txantenna (struct ural_softc *sc, int antenna)
 
static void ural_set_rxantenna (struct ural_softc *sc, int antenna)
 
static void ural_init (struct ural_softc *sc)
 
static void ural_stop (struct ural_softc *sc)
 
static int ural_raw_xmit (struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_bpf_params *params)
 
static void ural_ratectl_start (struct ural_softc *sc, struct ieee80211_node *ni)
 
static void ural_ratectl_timeout (void *arg)
 
static void ural_ratectl_task (void *arg, int pending)
 
static int ural_pause (struct ural_softc *sc, int timeout)
 

Variables

static const STRUCT_USB_HOST_ID ural_devs []
 
static usb_callback_t ural_bulk_read_callback
 
static usb_callback_t ural_bulk_write_callback
 
 ural_def_mac []
 
struct {
   uint8_t   reg
 
   uint8_t   val
 
ural_def_bbp []
 
static const uint32_t ural_rf2522_r2 []
 
static const uint32_t ural_rf2523_r2 []
 
static const uint32_t ural_rf2524_r2 []
 
static const uint32_t ural_rf2525_r2 []
 
static const uint32_t ural_rf2525_hi_r2 []
 
static const uint32_t ural_rf2525e_r2 []
 
static const uint32_t ural_rf2526_hi_r2 []
 
static const uint32_t ural_rf2526_r2 []
 
struct {
   uint8_t   chan
 
   uint32_t   r1
 
   uint32_t   r2
 
   uint32_t   r4
 
ural_rf5222 []
 
static const uint8_t ural_chan_5ghz []
 
static const struct usb_config ural_config [URAL_N_TRANSFER]
 
static device_probe_t ural_match
 
static device_attach_t ural_attach
 
static device_detach_t ural_detach
 
static device_method_t ural_methods []
 
static driver_t ural_driver
 
static devclass_t ural_devclass
 

Macro Definition Documentation

◆ RAL_RXTX_TURNAROUND

#define RAL_RXTX_TURNAROUND   5 /* us */

Definition at line 1777 of file if_ural.c.

◆ RAL_TX_TIMEOUT

#define RAL_TX_TIMEOUT   5000

Definition at line 1026 of file if_ural.c.

◆ URAL_DEV

#define URAL_DEV (   v,
 
)    { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }

◆ URAL_RSSI

#define URAL_RSSI (   rssi)
Value:
((rssi) > (RAL_NOISE_FLOOR + RAL_RSSI_CORR) ? \
((rssi) - (RAL_NOISE_FLOOR + RAL_RSSI_CORR)) : 0)
#define RAL_NOISE_FLOOR
Definition: if_uralreg.h:20
#define RAL_RSSI_CORR
Definition: if_uralreg.h:21

Definition at line 89 of file if_ural.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   ural_debug

Definition at line 74 of file if_ural.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( ural  ,
uhub  ,
ural_driver  ,
ural_devclass  ,
NULL  ,
 
)

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( ural  ,
usb  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( ural  ,
wlan  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( ural  ,
 
)

◆ ural_attach()

◆ ural_bbp_init()

static int ural_bbp_init ( struct ural_softc sc)
static

Definition at line 1938 of file if_ural.c.

References ural_softc::bbp_prom, RAL_BBP_VERSION, reg, ural_softc::reg, ural_softc::sc_dev, ural_bbp_read(), ural_bbp_write(), ural_def_bbp, ural_pause(), val, and ural_softc::val.

Referenced by ural_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_bbp_read()

static uint8_t ural_bbp_read ( struct ural_softc sc,
uint8_t  reg 
)
static

Definition at line 1508 of file if_ural.c.

References RAL_BBP_BUSY, RAL_BBP_WRITE, RAL_PHY_CSR7, RAL_PHY_CSR8, reg, ural_softc::sc_dev, ural_pause(), ural_read(), ural_write(), and val.

Referenced by ural_bbp_init(), ural_set_chan(), ural_set_rxantenna(), and ural_set_txantenna().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_bbp_write()

static void ural_bbp_write ( struct ural_softc sc,
uint8_t  reg,
uint8_t  val 
)
static

Definition at line 1487 of file if_ural.c.

References RAL_BBP_BUSY, RAL_PHY_CSR7, RAL_PHY_CSR8, reg, ural_softc::sc_dev, ural_pause(), ural_read(), ural_write(), and val.

Referenced by ural_bbp_init(), ural_set_chan(), ural_set_rxantenna(), and ural_set_txantenna().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_bulk_read_callback()

◆ ural_bulk_write_callback()

◆ ural_detach()

static int ural_detach ( device_t  self)
static

◆ ural_disable_rf_tune()

static void ural_disable_rf_tune ( struct ural_softc sc)
static

Definition at line 1721 of file if_ural.c.

References RAL_RF1, RAL_RF3, RAL_RF_2523, ural_softc::rf_regs, ural_softc::rf_rev, and ural_rf_write().

Referenced by ural_set_chan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_do_request()

static usb_error_t ural_do_request ( struct ural_softc sc,
struct usb_device_request req,
void *  data 
)
static

Definition at line 541 of file if_ural.c.

References data, req, ural_softc::sc_mtx, ural_softc::sc_udev, ural_pause(), usbd_do_request_flags(), and usbd_errstr().

Referenced by ural_eeprom_read(), ural_read(), ural_read_multi(), ural_set_testmode(), ural_write(), and ural_write_multi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_eeprom_read()

static void ural_eeprom_read ( struct ural_softc sc,
uint16_t  addr,
void *  buf,
int  len 
)
static

Definition at line 1388 of file if_ural.c.

References addr, error, len, RAL_READ_EEPROM, req, ural_softc::sc_dev, ural_do_request(), usbd_errstr(), USETW, and UT_READ_VENDOR_DEVICE.

Referenced by ural_read_eeprom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_enable_tsf()

static void ural_enable_tsf ( struct ural_softc sc)
static

Definition at line 1770 of file if_ural.c.

References RAL_ENABLE_TSF, RAL_ENABLE_TSF_SYNC, RAL_TXRX_CSR19, and ural_write().

Referenced by ural_newstate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_enable_tsf_sync()

static void ural_enable_tsf_sync ( struct ural_softc sc)
static

Definition at line 1741 of file if_ural.c.

References DPRINTF, RAL_ENABLE_BEACON_GENERATOR, RAL_ENABLE_TBCN, RAL_ENABLE_TSF, RAL_ENABLE_TSF_SYNC, RAL_TXRX_CSR18, RAL_TXRX_CSR19, RAL_TXRX_CSR20, ural_softc::sc_ic, and ural_write().

Referenced by ural_newstate(), and ural_scan_end().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_get_rf()

static const char * ural_get_rf ( int  rev)
static

Definition at line 1898 of file if_ural.c.

References RAL_RF_2522, RAL_RF_2523, RAL_RF_2524, RAL_RF_2525, RAL_RF_2525E, RAL_RF_2526, and RAL_RF_5222.

Referenced by ural_attach().

Here is the caller graph for this function:

◆ ural_getradiocaps()

static void ural_getradiocaps ( struct ieee80211com *  ic,
int  maxchans,
int *  nchans,
struct ieee80211_channel  chans[] 
)
static

Definition at line 1581 of file if_ural.c.

References RAL_RF_5222, ural_softc::rf_rev, and ural_chan_5ghz.

Referenced by ural_attach().

Here is the caller graph for this function:

◆ ural_init()

◆ ural_match()

static int ural_match ( device_t  self)
static

◆ ural_newstate()

static int ural_newstate ( struct ieee80211vap *  vap,
enum ieee80211_state  nstate,
int  arg 
)
static

◆ ural_parent()

static void ural_parent ( struct ieee80211com *  ic)
static

Definition at line 1345 of file if_ural.c.

References RAL_LOCK, RAL_UNLOCK, ural_softc::sc_detached, ural_softc::sc_running, ural_init(), ural_setpromisc(), and ural_stop().

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_pause()

static int ural_pause ( struct ural_softc sc,
int  timeout 
)
static

Definition at line 2220 of file if_ural.c.

References ural_softc::sc_mtx, and usb_pause_mtx().

Referenced by ural_bbp_init(), ural_bbp_read(), ural_bbp_write(), ural_do_request(), ural_init(), ural_rf_write(), ural_set_chan(), and ural_stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_plcp_signal()

static uint8_t ural_plcp_signal ( int  rate)
static

Definition at line 958 of file if_ural.c.

Referenced by ural_setup_tx_desc().

Here is the caller graph for this function:

◆ ural_ratectl_start()

static void ural_ratectl_start ( struct ural_softc sc,
struct ieee80211_node *  ni 
)
static

Definition at line 2168 of file if_ural.c.

References RAL_STA_CSR0, ural_vap::ratectl_ch, ural_softc::sta, ural_ratectl_timeout(), ural_read_multi(), URAL_VAP, usb_callout_reset, and ural_vap::vap.

Referenced by ural_newstate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_ratectl_task()

static void ural_ratectl_task ( void *  arg,
int  pending 
)
static

Definition at line 2190 of file if_ural.c.

References fail, RAL_LOCK, RAL_STA_CSR0, RAL_UNLOCK, ural_vap::ratectl_ch, ural_softc::sc_txs, ural_softc::sta, ural_ratectl_timeout(), ural_read_multi(), usb_callout_reset, and ural_vap::vap.

Referenced by ural_vap_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_ratectl_timeout()

static void ural_ratectl_timeout ( void *  arg)
static

Definition at line 2180 of file if_ural.c.

References ural_vap::ratectl_task, and ural_vap::vap.

Referenced by ural_ratectl_start(), and ural_ratectl_task().

Here is the caller graph for this function:

◆ ural_raw_xmit()

static int ural_raw_xmit ( struct ieee80211_node *  ni,
struct mbuf *  m,
const struct ieee80211_bpf_params *  params 
)
static

Definition at line 2126 of file if_ural.c.

References RAL_LOCK, RAL_TX_MINFREE, RAL_UNLOCK, ural_softc::sc_running, ural_softc::tx_nfree, ural_tx_mgt(), and ural_tx_raw().

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_read()

static uint16_t ural_read ( struct ural_softc sc,
uint16_t  reg 
)
static

Definition at line 1407 of file if_ural.c.

References error, RAL_READ_MAC, reg, req, ural_softc::sc_dev, ural_do_request(), usbd_errstr(), USETW, UT_READ_VENDOR_DEVICE, and val.

Referenced by ural_attach(), ural_bbp_read(), ural_bbp_write(), ural_init(), ural_rf_write(), ural_set_chan(), ural_set_txantenna(), ural_set_txpreamble(), and ural_setpromisc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_read_eeprom()

static void ural_read_eeprom ( struct ural_softc sc)
static

◆ ural_read_multi()

static void ural_read_multi ( struct ural_softc sc,
uint16_t  reg,
void *  buf,
int  len 
)
static

Definition at line 1430 of file if_ural.c.

References error, len, RAL_READ_MULTI_MAC, reg, req, ural_softc::sc_dev, ural_do_request(), usbd_errstr(), USETW, and UT_READ_VENDOR_DEVICE.

Referenced by ural_init(), ural_ratectl_start(), and ural_ratectl_task().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_rf_write()

static void ural_rf_write ( struct ural_softc sc,
uint8_t  reg,
uint32_t  val 
)
static

Definition at line 1531 of file if_ural.c.

References RAL_PHY_CSR10, RAL_PHY_CSR9, RAL_RF_20BIT, RAL_RF_BUSY, RAL_RF_LOBUSY, reg, ural_softc::rf_regs, ural_softc::sc_dev, ural_pause(), ural_read(), ural_write(), and val.

Referenced by ural_disable_rf_tune(), and ural_set_chan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_scan_end()

static void ural_scan_end ( struct ieee80211com *  ic)
static

Definition at line 1569 of file if_ural.c.

References RAL_LOCK, RAL_UNLOCK, ural_softc::sc_bssid, ural_enable_tsf_sync(), and ural_set_bssid().

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_scan_start()

static void ural_scan_start ( struct ieee80211com *  ic)
static

Definition at line 1558 of file if_ural.c.

References RAL_LOCK, RAL_TXRX_CSR19, RAL_UNLOCK, ural_set_bssid(), and ural_write().

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_sendprot()

static int ural_sendprot ( struct ural_softc sc,
const struct mbuf *  m,
struct ieee80211_node *  ni,
int  prot,
int  rate 
)
static

Definition at line 1127 of file if_ural.c.

References data, next, RAL_TX_ACK, RAL_TX_RETRY, ural_softc::sc_dev, ural_softc::sc_xfer, ural_softc::tx_free, ural_softc::tx_nfree, ural_softc::tx_q, URAL_BULK_WR, ural_setup_tx_desc(), and usbd_transfer_start().

Referenced by ural_tx_data(), and ural_tx_raw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_basicrates()

static void ural_set_basicrates ( struct ural_softc sc,
const struct ieee80211_channel *  c 
)
static

Definition at line 1819 of file if_ural.c.

References RAL_TXRX_CSR11, and ural_write().

Referenced by ural_newstate(), and ural_set_chan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_bssid()

static void ural_set_bssid ( struct ural_softc sc,
const uint8_t *  bssid 
)
static

Definition at line 1836 of file if_ural.c.

References DPRINTF, RAL_MAC_CSR5, RAL_MAC_CSR6, RAL_MAC_CSR7, and ural_write().

Referenced by ural_newstate(), ural_scan_end(), and ural_scan_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_chan()

◆ ural_set_channel()

static void ural_set_channel ( struct ieee80211com *  ic)
static

Definition at line 1600 of file if_ural.c.

References RAL_LOCK, RAL_UNLOCK, and ural_set_chan().

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_macaddr()

static void ural_set_macaddr ( struct ural_softc sc,
const uint8_t *  addr 
)
static

Definition at line 1853 of file if_ural.c.

References addr, DPRINTF, RAL_MAC_CSR2, RAL_MAC_CSR3, RAL_MAC_CSR4, and ural_write().

Referenced by ural_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_rxantenna()

static void ural_set_rxantenna ( struct ural_softc sc,
int  antenna 
)
static

Definition at line 2000 of file if_ural.c.

References RAL_BBP_ANTA, RAL_BBP_ANTB, RAL_BBP_DIVERSITY, RAL_BBP_RX, RAL_RF_2525E, RAL_RF_2526, ural_softc::rf_rev, ural_bbp_read(), and ural_bbp_write().

Referenced by ural_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_testmode()

static void ural_set_testmode ( struct ural_softc sc)
static

Definition at line 1369 of file if_ural.c.

References error, RAL_VENDOR_REQUEST, req, ural_softc::sc_dev, ural_do_request(), usbd_errstr(), USETW, and UT_WRITE_VENDOR_DEVICE.

Referenced by ural_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_txantenna()

static void ural_set_txantenna ( struct ural_softc sc,
int  antenna 
)
static

Definition at line 1971 of file if_ural.c.

References RAL_BBP_ANTA, RAL_BBP_ANTB, RAL_BBP_DIVERSITY, RAL_BBP_FLIPIQ, RAL_BBP_TX, RAL_PHY_CSR5, RAL_PHY_CSR6, RAL_RF_2525E, RAL_RF_2526, RAL_RF_5222, ural_softc::rf_rev, tx, ural_bbp_read(), ural_bbp_write(), ural_read(), and ural_write().

Referenced by ural_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_set_txpreamble()

static void ural_set_txpreamble ( struct ural_softc sc)
static

Definition at line 1804 of file if_ural.c.

References RAL_SHORT_PREAMBLE, RAL_TXRX_CSR10, ural_softc::sc_ic, ural_read(), and ural_write().

Referenced by ural_newstate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_setpromisc()

static void ural_setpromisc ( struct ural_softc sc)
static

Definition at line 1870 of file if_ural.c.

References DPRINTF, RAL_DROP_NOT_TO_ME, RAL_TXRX_CSR2, ural_softc::sc_ic, ural_read(), and ural_write().

Referenced by ural_parent(), and ural_update_promisc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_setup_tx_desc()

static void ural_setup_tx_desc ( struct ural_softc sc,
struct ural_tx_desc desc,
uint32_t  flags,
int  len,
int  rate 
)
static

Definition at line 981 of file if_ural.c.

References desc, len, RAL_AIFSN, RAL_IVOFFSET, RAL_LOGCWMAX, RAL_LOGCWMIN, RAL_PLCP_LENGEXT, RAL_TX_NEWSEQ, RAL_TX_OFDM, remainder, ural_softc::sc_ic, and ural_plcp_signal().

Referenced by ural_sendprot(), ural_tx_bcn(), ural_tx_data(), ural_tx_mgt(), and ural_tx_raw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_setup_tx_list()

static void ural_setup_tx_list ( struct ural_softc sc)
static

Definition at line 628 of file if_ural.c.

References data, next, RAL_TX_LIST_COUNT, ural_tx_data::sc, ural_softc::tx_data, ural_softc::tx_free, ural_softc::tx_nfree, and ural_softc::tx_q.

Referenced by ural_init().

Here is the caller graph for this function:

◆ ural_start()

static void ural_start ( struct ural_softc sc)
static

Definition at line 1322 of file if_ural.c.

References RAL_LOCK_ASSERT, RAL_TX_MINFREE, ural_softc::sc_running, ural_softc::sc_snd, ural_softc::tx_nfree, and ural_tx_data().

Referenced by ural_bulk_read_callback(), ural_bulk_write_callback(), and ural_transmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_stop()

static void ural_stop ( struct ural_softc sc)
static

Definition at line 2097 of file if_ural.c.

References RAL_DISABLE_RX, RAL_LOCK, RAL_LOCK_ASSERT, RAL_MAC_CSR1, RAL_RESET_ASIC, RAL_RESET_BBP, RAL_TXRX_CSR2, RAL_UNLOCK, ural_softc::sc_running, ural_softc::sc_xfer, URAL_BULK_RD, URAL_BULK_WR, ural_pause(), ural_unsetup_tx_list(), ural_write(), and usbd_transfer_drain().

Referenced by ural_init(), and ural_parent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_transmit()

static int ural_transmit ( struct ieee80211com *  ic,
struct mbuf *  m 
)
static

Definition at line 1300 of file if_ural.c.

References error, RAL_LOCK, RAL_UNLOCK, ural_softc::sc_running, ural_softc::sc_snd, and ural_start().

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_tx_bcn()

static int ural_tx_bcn ( struct ural_softc sc,
struct mbuf *  m0,
struct ieee80211_node *  ni 
)
static

Definition at line 1029 of file if_ural.c.

References data, next, ural_tx_data::ni, RAL_TX_IFS_NEWBACKOFF, RAL_TX_TIMESTAMP, ural_tx_data::sc, ural_softc::sc_xfer, ural_softc::tx_free, ural_softc::tx_nfree, ural_softc::tx_q, URAL_BULK_WR, ural_setup_tx_desc(), and usbd_transfer_start().

Referenced by ural_newstate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_tx_data()

static int ural_tx_data ( struct ural_softc sc,
struct mbuf *  m0,
struct ieee80211_node *  ni 
)
static

Definition at line 1217 of file if_ural.c.

References data, error, k, next, RAL_LOCK_ASSERT, RAL_TX_ACK, RAL_TX_IFS_SIFS, RAL_TX_RETRY, ural_softc::sc_xfer, ural_softc::tx_free, ural_softc::tx_nfree, ural_softc::tx_q, URAL_BULK_WR, ural_sendprot(), ural_setup_tx_desc(), usbd_transfer_start(), and USETW.

Referenced by ural_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_tx_free()

static void ural_tx_free ( struct ural_tx_data data,
int  txerr 
)
static

Definition at line 614 of file if_ural.c.

References data, next, ural_softc::tx_free, and ural_softc::tx_nfree.

Referenced by ural_bulk_write_callback().

Here is the caller graph for this function:

◆ ural_tx_mgt()

static int ural_tx_mgt ( struct ural_softc sc,
struct mbuf *  m0,
struct ieee80211_node *  ni 
)
static

Definition at line 1069 of file if_ural.c.

References data, k, next, RAL_LOCK_ASSERT, RAL_TX_ACK, RAL_TX_TIMESTAMP, ural_softc::sc_xfer, ural_softc::tx_free, ural_softc::tx_nfree, ural_softc::tx_q, URAL_BULK_WR, ural_setup_tx_desc(), usbd_transfer_start(), and USETW.

Referenced by ural_raw_xmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_tx_raw()

static int ural_tx_raw ( struct ural_softc sc,
struct mbuf *  m0,
struct ieee80211_node *  ni,
const struct ieee80211_bpf_params *  params 
)
static

Definition at line 1164 of file if_ural.c.

References data, error, next, ural_tx_data::ni, RAL_LOCK_ASSERT, RAL_TX_ACK, RAL_TX_IFS_SIFS, ural_tx_data::rate, ural_tx_data::sc, ural_softc::sc_xfer, ural_softc::tx_free, ural_softc::tx_nfree, ural_softc::tx_q, URAL_BULK_WR, ural_sendprot(), ural_setup_tx_desc(), and usbd_transfer_start().

Referenced by ural_raw_xmit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_unsetup_tx_list()

static void ural_unsetup_tx_list ( struct ural_softc sc)
static

Definition at line 647 of file if_ural.c.

References data, RAL_TX_LIST_COUNT, ural_tx_data::sc, ural_softc::tx_data, ural_softc::tx_free, ural_softc::tx_nfree, and ural_softc::tx_q.

Referenced by ural_detach(), and ural_stop().

Here is the caller graph for this function:

◆ ural_update_promisc()

static void ural_update_promisc ( struct ieee80211com *  ic)
static

Definition at line 1887 of file if_ural.c.

References RAL_LOCK, RAL_UNLOCK, ural_softc::sc_running, and ural_setpromisc().

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_update_slot()

static void ural_update_slot ( struct ural_softc sc)
static

Definition at line 1779 of file if_ural.c.

References RAL_MAC_CSR10, RAL_MAC_CSR11, RAL_MAC_CSR12, RAL_RXTX_TURNAROUND, ural_softc::sc_ic, and ural_write().

Referenced by ural_newstate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_vap_create()

static struct ieee80211vap * ural_vap_create ( struct ieee80211com *  ic,
const char  name[IFNAMSIZ],
int  unit,
enum ieee80211_opmode  opmode,
int  flags,
const uint8_t  bssid[IEEE80211_ADDR_LEN],
const uint8_t  mac[IEEE80211_ADDR_LEN] 
)
static

Definition at line 562 of file if_ural.c.

References name, ural_vap::newstate, ural_vap::ratectl_ch, ural_vap::ratectl_task, ural_softc::sc_mtx, ural_newstate(), ural_ratectl_task(), usb_callout_init_mtx, and ural_vap::vap.

Referenced by ural_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ural_vap_delete()

static void ural_vap_delete ( struct ieee80211vap *  vap)
static

Definition at line 601 of file if_ural.c.

References ural_vap::ratectl_ch, ural_vap::ratectl_task, URAL_VAP, usb_callout_drain, and ural_vap::vap.

Referenced by ural_attach().

Here is the caller graph for this function:

◆ ural_write()

static void ural_write ( struct ural_softc sc,
uint16_t  reg,
uint16_t  val 
)
static

◆ ural_write_multi() [1/2]

static void ural_write_multi ( struct ural_softc ,
uint16_t  ,
void *  ,
static void ural_getradiocaps(struct ieee80211com  int 
)
static

Definition at line 161 of file if_ural.c.

◆ ural_write_multi() [2/2]

static void ural_write_multi ( struct ural_softc sc,
uint16_t  reg,
void *  buf,
int  len 
)
static

Definition at line 1468 of file if_ural.c.

References error, len, RAL_WRITE_MULTI_MAC, reg, req, ural_softc::sc_dev, ural_do_request(), usbd_errstr(), USETW, and UT_WRITE_VENDOR_DEVICE.

Here is the call graph for this function:

◆ USB_PNP_HOST_INFO()

USB_PNP_HOST_INFO ( ural_devs  )

Variable Documentation

◆ chan

◆ r1

◆ r2

◆ r4

uint32_t r4

Definition at line 317 of file if_ural.c.

Referenced by rum_set_chan(), run_rt2870_set_chan(), and ural_set_chan().

◆ reg

◆ ural_attach

device_attach_t ural_attach
static

Definition at line 387 of file if_ural.c.

◆ ural_bulk_read_callback

usb_callback_t ural_bulk_read_callback
static

Definition at line 128 of file if_ural.c.

◆ ural_bulk_write_callback

usb_callback_t ural_bulk_write_callback
static

Definition at line 129 of file if_ural.c.

◆ ural_chan_5ghz

const uint8_t ural_chan_5ghz[]
static
Initial value:
=
{ 36, 40, 44, 48, 52, 56, 60, 64,
100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
149, 153, 157, 161 }

Definition at line 361 of file if_ural.c.

Referenced by ural_getradiocaps().

◆ ural_config

const struct usb_config ural_config[URAL_N_TRANSFER]
static
Initial value:
= {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.bufsize = (RAL_FRAME_SIZE + RAL_TX_DESC_SIZE + 4),
.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
.timeout = 5000,
},
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
},
}
static usb_callback_t ural_bulk_read_callback
Definition: if_ural.c:128
static usb_callback_t ural_bulk_write_callback
Definition: if_ural.c:129
#define RAL_TX_DESC_SIZE
Definition: if_uralreg.h:24
#define RAL_RX_DESC_SIZE
Definition: if_uralreg.h:23
#define RAL_FRAME_SIZE
Definition: if_uralreg.h:25
@ URAL_BULK_WR
Definition: if_uralvar.h:85
@ URAL_BULK_RD
Definition: if_uralvar.h:86
#define UE_ADDR_ANY
Definition: usb.h:537
#define UE_BULK
Definition: usb.h:543
#define UE_DIR_IN
Definition: usb.h:531
#define UE_DIR_OUT
Definition: usb.h:532

Definition at line 366 of file if_ural.c.

Referenced by ural_attach().

◆ 

const struct { ... } ural_def_bbp[]

Referenced by ural_bbp_init().

◆ ural_def_mac

ural_def_mac[]
Initial value:
= {
{ RAL_TXRX_CSR5, 0x8c8d },
{ RAL_TXRX_CSR6, 0x8b8a },
{ RAL_TXRX_CSR7, 0x8687 },
{ RAL_TXRX_CSR8, 0x0085 },
{ RAL_MAC_CSR13, 0x1111 },
{ RAL_MAC_CSR14, 0x1e11 },
{ RAL_TXRX_CSR21, 0xe78f },
{ RAL_MAC_CSR9, 0xff1d },
{ RAL_MAC_CSR11, 0x0002 },
{ RAL_MAC_CSR22, 0x0053 },
{ RAL_MAC_CSR15, 0x0000 },
{ RAL_TXRX_CSR19, 0x0000 },
{ RAL_TXRX_CSR18, 0x005a },
{ RAL_PHY_CSR2, 0x0000 },
{ RAL_TXRX_CSR0, 0x1ec0 },
{ RAL_PHY_CSR4, 0x000f }
}
#define RAL_MAC_CSR8
Definition: if_uralreg.h:48
#define RAL_TXRX_CSR0
Definition: if_uralreg.h:66
#define RAL_TXRX_CSR6
Definition: if_uralreg.h:69
#define RAL_MAC_CSR13
Definition: if_uralreg.h:53
#define RAL_MAC_CSR9
Definition: if_uralreg.h:49
#define RAL_TXRX_CSR7
Definition: if_uralreg.h:70
#define RAL_TXRX_CSR5
Definition: if_uralreg.h:68
#define RAL_PHY_CSR2
Definition: if_uralreg.h:87
#define RAL_TXRX_CSR18
Definition: if_uralreg.h:74
#define RAL_PHY_CSR4
Definition: if_uralreg.h:88
#define RAL_TXRX_CSR8
Definition: if_uralreg.h:71
#define RAL_MAC_CSR22
Definition: if_uralreg.h:61
#define RAL_MAC_CSR11
Definition: if_uralreg.h:51
#define RAL_MAC_CSR14
Definition: if_uralreg.h:54
#define RAL_TXRX_CSR21
Definition: if_uralreg.h:77
#define RAL_TXRX_CSR19
Definition: if_uralreg.h:75
#define RAL_MAC_CSR15
Definition: if_uralreg.h:55

Definition at line 205 of file if_ural.c.

Referenced by ural_init().

◆ ural_detach

device_detach_t ural_detach
static

Definition at line 388 of file if_ural.c.

Referenced by ural_attach().

◆ ural_devclass

devclass_t ural_devclass
static

Definition at line 404 of file if_ural.c.

◆ ural_devs

const STRUCT_USB_HOST_ID ural_devs[]
static

Definition at line 94 of file if_ural.c.

Referenced by ural_match().

◆ ural_driver

driver_t ural_driver
static
Initial value:
= {
.name = "ural",
.methods = ural_methods,
.size = sizeof(struct ural_softc),
}
static device_method_t ural_methods[]
Definition: if_ural.c:390

Definition at line 398 of file if_ural.c.

◆ ural_match

device_probe_t ural_match
static

Definition at line 386 of file if_ural.c.

◆ ural_methods

device_method_t ural_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, ural_match),
DEVMETHOD(device_attach, ural_attach),
DEVMETHOD(device_detach, ural_detach),
DEVMETHOD_END
}
static device_probe_t ural_match
Definition: if_ural.c:386
static device_detach_t ural_detach
Definition: if_ural.c:388
static device_attach_t ural_attach
Definition: if_ural.c:387

Definition at line 390 of file if_ural.c.

◆ ural_rf2522_r2

const uint32_t ural_rf2522_r2[]
static
Initial value:
= {
0x307f6, 0x307fb, 0x30800, 0x30805, 0x3080a, 0x3080f, 0x30814,
0x30819, 0x3081e, 0x30823, 0x30828, 0x3082d, 0x30832, 0x3083e
}

Definition at line 269 of file if_ural.c.

Referenced by ural_set_chan().

◆ ural_rf2523_r2

const uint32_t ural_rf2523_r2[]
static
Initial value:
= {
0x00327, 0x00328, 0x00329, 0x0032a, 0x0032b, 0x0032c, 0x0032d,
0x0032e, 0x0032f, 0x00340, 0x00341, 0x00342, 0x00343, 0x00346
}

Definition at line 274 of file if_ural.c.

Referenced by ural_set_chan().

◆ ural_rf2524_r2

const uint32_t ural_rf2524_r2[]
static
Initial value:
= {
0x00327, 0x00328, 0x00329, 0x0032a, 0x0032b, 0x0032c, 0x0032d,
0x0032e, 0x0032f, 0x00340, 0x00341, 0x00342, 0x00343, 0x00346
}

Definition at line 279 of file if_ural.c.

Referenced by ural_set_chan().

◆ ural_rf2525_hi_r2

const uint32_t ural_rf2525_hi_r2[]
static
Initial value:
= {
0x2032f, 0x20340, 0x20341, 0x20342, 0x20343, 0x20344, 0x20345,
0x20346, 0x20347, 0x20348, 0x20349, 0x2034a, 0x2034b, 0x2034e
}

Definition at line 289 of file if_ural.c.

Referenced by ural_set_chan().

◆ ural_rf2525_r2

const uint32_t ural_rf2525_r2[]
static
Initial value:
= {
0x20327, 0x20328, 0x20329, 0x2032a, 0x2032b, 0x2032c, 0x2032d,
0x2032e, 0x2032f, 0x20340, 0x20341, 0x20342, 0x20343, 0x20346
}

Definition at line 284 of file if_ural.c.

Referenced by ural_set_chan().

◆ ural_rf2525e_r2

const uint32_t ural_rf2525e_r2[]
static
Initial value:
= {
0x2044d, 0x2044e, 0x2044f, 0x20460, 0x20461, 0x20462, 0x20463,
0x20464, 0x20465, 0x20466, 0x20467, 0x20468, 0x20469, 0x2046b
}

Definition at line 294 of file if_ural.c.

Referenced by ural_set_chan().

◆ ural_rf2526_hi_r2

const uint32_t ural_rf2526_hi_r2[]
static
Initial value:
= {
0x0022a, 0x0022b, 0x0022b, 0x0022c, 0x0022c, 0x0022d, 0x0022d,
0x0022e, 0x0022e, 0x0022f, 0x0022d, 0x00240, 0x00240, 0x00241
}

Definition at line 299 of file if_ural.c.

Referenced by ural_set_chan().

◆ ural_rf2526_r2

const uint32_t ural_rf2526_r2[]
static
Initial value:
= {
0x00226, 0x00227, 0x00227, 0x00228, 0x00228, 0x00229, 0x00229,
0x0022a, 0x0022a, 0x0022b, 0x0022b, 0x0022c, 0x0022c, 0x0022d
}

Definition at line 304 of file if_ural.c.

Referenced by ural_set_chan().

◆ 

const struct { ... } ural_rf5222[]

Referenced by ural_set_chan().

◆ val