Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
rt2x00usb.h File Reference
#include <linux/usb.h>

Go to the source code of this file.

Data Structures

struct  queue_entry_priv_usb
 
struct  queue_entry_priv_usb_bcn
 

Macros

#define to_usb_device_intf(d)
 
#define REGISTER_TIMEOUT   500
 
#define REGISTER_TIMEOUT_FIRMWARE   1000
 
#define REGISTER_TIMEOUT16(__datalen)   ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u16)) )
 
#define REGISTER_TIMEOUT32(__datalen)   ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u32)) )
 
#define CSR_CACHE_SIZE   64
 
#define USB_VENDOR_REQUEST   ( USB_TYPE_VENDOR | USB_RECIP_DEVICE )
 
#define USB_VENDOR_REQUEST_IN   ( USB_DIR_IN | USB_VENDOR_REQUEST )
 
#define USB_VENDOR_REQUEST_OUT   ( USB_DIR_OUT | USB_VENDOR_REQUEST )
 
#define rt2x00usb_suspend   NULL
 
#define rt2x00usb_resume   NULL
 

Enumerations

enum  rt2x00usb_vendor_request {
  USB_DEVICE_MODE = 1, USB_SINGLE_WRITE = 2, USB_SINGLE_READ = 3, USB_MULTI_WRITE = 6,
  USB_MULTI_READ = 7, USB_EEPROM_WRITE = 8, USB_EEPROM_READ = 9, USB_LED_CONTROL = 10,
  USB_RX_CONTROL = 12
}
 
enum  rt2x00usb_mode_offset {
  USB_MODE_RESET = 1, USB_MODE_UNPLUG = 2, USB_MODE_FUNCTION = 3, USB_MODE_TEST = 4,
  USB_MODE_SLEEP = 7, USB_MODE_FIRMWARE = 8, USB_MODE_WAKEUP = 9
}
 

Functions

int rt2x00usb_vendor_request (struct rt2x00_dev *rt2x00dev, const u8 request, const u8 requesttype, const u16 offset, const u16 value, void *buffer, const u16 buffer_length, const int timeout)
 
int rt2x00usb_vendor_request_buff (struct rt2x00_dev *rt2x00dev, const u8 request, const u8 requesttype, const u16 offset, void *buffer, const u16 buffer_length, const int timeout)
 
int rt2x00usb_vendor_req_buff_lock (struct rt2x00_dev *rt2x00dev, const u8 request, const u8 requesttype, const u16 offset, void *buffer, const u16 buffer_length, const int timeout)
 
int rt2x00usb_regbusy_read (struct rt2x00_dev *rt2x00dev, const unsigned int offset, const struct rt2x00_field32 field, u32 *reg)
 
void rt2x00usb_register_read_async (struct rt2x00_dev *rt2x00dev, const unsigned int offset, bool(*callback)(struct rt2x00_dev *, int, u32))
 
void rt2x00usb_disable_radio (struct rt2x00_dev *rt2x00dev)
 
void rt2x00usb_kick_queue (struct data_queue *queue)
 
void rt2x00usb_flush_queue (struct data_queue *queue, bool drop)
 
void rt2x00usb_watchdog (struct rt2x00_dev *rt2x00dev)
 
void rt2x00usb_clear_entry (struct queue_entry *entry)
 
int rt2x00usb_initialize (struct rt2x00_dev *rt2x00dev)
 
void rt2x00usb_uninitialize (struct rt2x00_dev *rt2x00dev)
 
int rt2x00usb_probe (struct usb_interface *usb_intf, const struct rt2x00_ops *ops)
 
void rt2x00usb_disconnect (struct usb_interface *usb_intf)
 

Macro Definition Documentation

#define CSR_CACHE_SIZE   64

Definition at line 63 of file rt2x00usb.h.

#define REGISTER_TIMEOUT   500

Definition at line 43 of file rt2x00usb.h.

#define REGISTER_TIMEOUT16 (   __datalen)    ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u16)) )

REGISTER_TIMEOUT16 - Determine the timeout for 16bit register access : Data length

Definition at line 50 of file rt2x00usb.h.

#define REGISTER_TIMEOUT32 (   __datalen)    ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u32)) )

REGISTER_TIMEOUT32 - Determine the timeout for 32bit register access : Data length

Definition at line 57 of file rt2x00usb.h.

#define REGISTER_TIMEOUT_FIRMWARE   1000

Definition at line 44 of file rt2x00usb.h.

#define rt2x00usb_resume   NULL

Definition at line 439 of file rt2x00usb.h.

#define rt2x00usb_suspend   NULL

Definition at line 438 of file rt2x00usb.h.

#define to_usb_device_intf (   d)
Value:
({ \
struct usb_interface *intf = to_usb_interface(d); \
interface_to_usbdev(intf); \
})

Definition at line 31 of file rt2x00usb.h.

#define USB_VENDOR_REQUEST   ( USB_TYPE_VENDOR | USB_RECIP_DEVICE )

Definition at line 68 of file rt2x00usb.h.

#define USB_VENDOR_REQUEST_IN   ( USB_DIR_IN | USB_VENDOR_REQUEST )

Definition at line 69 of file rt2x00usb.h.

#define USB_VENDOR_REQUEST_OUT   ( USB_DIR_OUT | USB_VENDOR_REQUEST )

Definition at line 70 of file rt2x00usb.h.

Enumeration Type Documentation

enum rt2x00usb_mode_offset: Device modes offset.

Enumerator:
USB_MODE_RESET 
USB_MODE_UNPLUG 
USB_MODE_FUNCTION 
USB_MODE_TEST 
USB_MODE_SLEEP 
USB_MODE_FIRMWARE 
USB_MODE_WAKEUP 

Definition at line 90 of file rt2x00usb.h.

enum rt2x00usb_vendor_request: USB vendor commands.

Enumerator:
USB_DEVICE_MODE 
USB_SINGLE_WRITE 
USB_SINGLE_READ 
USB_MULTI_WRITE 
USB_MULTI_READ 
USB_EEPROM_WRITE 
USB_EEPROM_READ 
USB_LED_CONTROL 
USB_RX_CONTROL 

Definition at line 75 of file rt2x00usb.h.

Function Documentation

void rt2x00usb_clear_entry ( struct queue_entry *  entry)

Definition at line 557 of file rt2x00usb.c.

void rt2x00usb_disable_radio ( struct rt2x00_dev rt2x00dev)

Definition at line 547 of file rt2x00usb.c.

void rt2x00usb_disconnect ( struct usb_interface usb_intf)

Definition at line 836 of file rt2x00usb.c.

void rt2x00usb_flush_queue ( struct data_queue queue,
bool  drop 
)

rt2x00usb_flush_queue - Flush data queue : Data queue to stop : True to drop all pending frames.

This will walk through all entries of the queue and will optionally kill all URB's which were send to the device, or at least wait until they have been returned from the device..

Definition at line 465 of file rt2x00usb.c.

int rt2x00usb_initialize ( struct rt2x00_dev rt2x00dev)

Definition at line 701 of file rt2x00usb.c.

void rt2x00usb_kick_queue ( struct data_queue queue)

rt2x00usb_kick_queue - Kick data queue : Data queue to kick

This will walk through all entries of the queue and push all pending frames to the hardware as a single burst.

Definition at line 422 of file rt2x00usb.c.

int rt2x00usb_probe ( struct usb_interface usb_intf,
const struct rt2x00_ops ops 
)

Definition at line 779 of file rt2x00usb.c.

int rt2x00usb_regbusy_read ( struct rt2x00_dev rt2x00dev,
const unsigned int  offset,
const struct rt2x00_field32  field,
u32 reg 
)

rt2x00usb_regbusy_read - Read from register with busy check : Device pointer, see &struct rt2x00_dev. : Register offset : Field to check if register is busy : Pointer to where register contents should be stored

This function will read the given register, and checks if the register is busy. If it is, it will sleep for a couple of microseconds before reading the register again. If the register is not read after a certain timeout, this function will return FALSE.

Definition at line 143 of file rt2x00usb.c.

void rt2x00usb_register_read_async ( struct rt2x00_dev rt2x00dev,
const unsigned int  offset,
bool(*)(struct rt2x00_dev *, int, u32 callback 
)

rt2x00usb_register_read_async - Asynchronously read 32bit register word : Device pointer, see &struct rt2x00_dev. : Register offset : Functon to call when read completes.

Submit a control URB to read a 32bit register. This safe to be called from atomic context. The callback will be called when the URB completes. Otherwise the function is similar to rt2x00usb_register_read(). When the callback function returns false, the memory will be cleaned up, when it returns true, the urb will be fired again.

Definition at line 186 of file rt2x00usb.c.

void rt2x00usb_uninitialize ( struct rt2x00_dev rt2x00dev)

Definition at line 731 of file rt2x00usb.c.

int rt2x00usb_vendor_req_buff_lock ( struct rt2x00_dev rt2x00dev,
const u8  request,
const u8  requesttype,
const u16  offset,
void buffer,
const u16  buffer_length,
const int  timeout 
)

rt2x00usb_vendor_request_buff - Send register command to device (buffered) : Pointer to &struct rt2x00_dev : USB vendor command (See &enum rt2x00usb_vendor_request) : Request type &USB_VENDOR_REQUEST_* : Register offset to perform action on : Buffer where information will be read/written to by device : Size of &buffer : Operation timeout

A version of &rt2x00usb_vendor_request_buff which must be called if the usb_cache_mutex is already held.

Definition at line 81 of file rt2x00usb.c.

int rt2x00usb_vendor_request ( struct rt2x00_dev rt2x00dev,
const u8  request,
const u8  requesttype,
const u16  offset,
const u16  value,
void buffer,
const u16  buffer_length,
const int  timeout 
)

rt2x00usb_vendor_request - Send register command to device : Pointer to &struct rt2x00_dev : USB vendor command (See &enum rt2x00usb_vendor_request) : Request type &USB_VENDOR_REQUEST_* : Register offset to perform action on : Value to write to device : Buffer where information will be read/written to by device : Size of &buffer : Operation timeout

This is the main function to communicate with the device, the &buffer argument must either be NULL or point to a buffer allocated by kmalloc. Failure to do so can lead to unexpected behavior depending on the architecture.

Definition at line 39 of file rt2x00usb.c.

int rt2x00usb_vendor_request_buff ( struct rt2x00_dev rt2x00dev,
const u8  request,
const u8  requesttype,
const u16  offset,
void buffer,
const u16  buffer_length,
const int  timeout 
)

rt2x00usb_vendor_request_buff - Send register command to device (buffered) : Pointer to &struct rt2x00_dev : USB vendor command (See &enum rt2x00usb_vendor_request) : Request type &USB_VENDOR_REQUEST_* : Register offset to perform action on : Buffer where information will be read/written to by device : Size of &buffer : Operation timeout

This function will use a previously with kmalloc allocated cache to communicate with the device. The contents of the buffer pointer will be copied to this cache when writing, or read from the cache when reading. Buffers send to &rt2x00usb_vendor_request must be allocated with kmalloc. Hence the reason for using a previously allocated cache which has been allocated properly.

Definition at line 112 of file rt2x00usb.c.

void rt2x00usb_watchdog ( struct rt2x00_dev rt2x00dev)

rt2x00usb_watchdog - Watchdog for USB communication : Pointer to &struct rt2x00_dev

Check the health of the USB communication and determine if timeouts have occurred. If this is the case, this function will reset all communication to restore functionality again.

Definition at line 531 of file rt2x00usb.c.