Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
whcd.h File Reference
#include <linux/uwb/whci.h>
#include <linux/uwb/umc.h>
#include <linux/workqueue.h>
#include "whci-hc.h"

Go to the source code of this file.

Data Structures

struct  whc
 
struct  whc_std
 
struct  whc_urb
 

Macros

#define WHC_GENCMD_TIMEOUT_MS   100
 
#define wusbhc_to_whc(w)   (container_of((w), struct whc, wusbhc))
 

Enumerations

enum  whc_update { WHC_UPDATE_ADDED = 0x01, WHC_UPDATE_REMOVED = 0x02, WHC_UPDATE_UPDATED = 0x04 }
 

Functions

int whc_init (struct whc *whc)
 
void whc_clean_up (struct whc *whc)
 
void whc_write_wusbcmd (struct whc *whc, u32 mask, u32 val)
 
int whc_do_gencmd (struct whc *whc, u32 cmd, u32 params, void *addr, size_t len)
 
void whc_hw_error (struct whc *whc, const char *reason)
 
int whc_wusbhc_start (struct wusbhc *wusbhc)
 
void whc_wusbhc_stop (struct wusbhc *wusbhc, int delay)
 
int whc_mmcie_add (struct wusbhc *wusbhc, u8 interval, u8 repeat_cnt, u8 handle, struct wuie_hdr *wuie)
 
int whc_mmcie_rm (struct wusbhc *wusbhc, u8 handle)
 
int whc_bwa_set (struct wusbhc *wusbhc, s8 stream_index, const struct uwb_mas_bm *mas_bm)
 
int whc_dev_info_set (struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
 
int whc_set_num_dnts (struct wusbhc *wusbhc, u8 interval, u8 slots)
 
int whc_set_ptk (struct wusbhc *wusbhc, u8 port_idx, u32 tkid, const void *ptk, size_t key_size)
 
int whc_set_gtk (struct wusbhc *wusbhc, u32 tkid, const void *gtk, size_t key_size)
 
int whc_set_cluster_id (struct whc *whc, u8 bcid)
 
irqreturn_t whc_int_handler (struct usb_hcd *hcd)
 
void whc_dn_work (struct work_struct *work)
 
void asl_start (struct whc *whc)
 
void asl_stop (struct whc *whc)
 
int asl_init (struct whc *whc)
 
void asl_clean_up (struct whc *whc)
 
int asl_urb_enqueue (struct whc *whc, struct urb *urb, gfp_t mem_flags)
 
int asl_urb_dequeue (struct whc *whc, struct urb *urb, int status)
 
void asl_qset_delete (struct whc *whc, struct whc_qset *qset)
 
void scan_async_work (struct work_struct *work)
 
int pzl_init (struct whc *whc)
 
void pzl_clean_up (struct whc *whc)
 
void pzl_start (struct whc *whc)
 
void pzl_stop (struct whc *whc)
 
int pzl_urb_enqueue (struct whc *whc, struct urb *urb, gfp_t mem_flags)
 
int pzl_urb_dequeue (struct whc *whc, struct urb *urb, int status)
 
void pzl_qset_delete (struct whc *whc, struct whc_qset *qset)
 
void scan_periodic_work (struct work_struct *work)
 
struct whc_qsetqset_alloc (struct whc *whc, gfp_t mem_flags)
 
void qset_free (struct whc *whc, struct whc_qset *qset)
 
struct whc_qsetget_qset (struct whc *whc, struct urb *urb, gfp_t mem_flags)
 
void qset_delete (struct whc *whc, struct whc_qset *qset)
 
void qset_clear (struct whc *whc, struct whc_qset *qset)
 
void qset_reset (struct whc *whc, struct whc_qset *qset)
 
int qset_add_urb (struct whc *whc, struct whc_qset *qset, struct urb *urb, gfp_t mem_flags)
 
void qset_free_std (struct whc *whc, struct whc_std *std)
 
void qset_remove_urb (struct whc *whc, struct whc_qset *qset, struct urb *urb, int status)
 
void process_halted_qtd (struct whc *whc, struct whc_qset *qset, struct whc_qtd *qtd)
 
void process_inactive_qtd (struct whc *whc, struct whc_qset *qset, struct whc_qtd *qtd)
 
enum whc_update qset_add_qtds (struct whc *whc, struct whc_qset *qset)
 
void qset_remove_complete (struct whc *whc, struct whc_qset *qset)
 
void pzl_update (struct whc *whc, uint32_t wusbcmd)
 
void asl_update (struct whc *whc, uint32_t wusbcmd)
 
void whc_dbg_init (struct whc *whc)
 
void whc_dbg_clean_up (struct whc *whc)
 

Macro Definition Documentation

#define WHC_GENCMD_TIMEOUT_MS   100

Definition at line 30 of file whcd.h.

#define wusbhc_to_whc (   w)    (container_of((w), struct whc, wusbhc))

Definition at line 78 of file whcd.h.

Enumeration Type Documentation

enum whc_update
Enumerator:
WHC_UPDATE_ADDED 
WHC_UPDATE_REMOVED 
WHC_UPDATE_UPDATED 

Definition at line 136 of file whcd.h.

Function Documentation

void asl_clean_up ( struct whc whc)

asl_clean_up - free ASL resources

The ASL is stopped and empty except for the dummy qset.

Definition at line 380 of file asl.c.

int asl_init ( struct whc whc)

asl_init - initialize the asynchronous schedule list

A dummy qset with no qTDs is added to the ASL to simplify removing qsets (no need to stop the ASL when the last qset is removed).

Definition at line 361 of file asl.c.

void asl_qset_delete ( struct whc whc,
struct whc_qset qset 
)

asl_qset_delete - delete a qset from the ASL

Definition at line 348 of file asl.c.

void asl_start ( struct whc whc)

Definition at line 145 of file asl.c.

void asl_stop ( struct whc whc)

Definition at line 159 of file asl.c.

void asl_update ( struct whc whc,
uint32_t  wusbcmd 
)

asl_update - request an ASL update and wait for the hardware to be synced : the WHCI HC : WUSBCMD value to start the update.

If the WUSB HC is inactive (i.e., the ASL is stopped) then the update must be skipped as the hardware may not respond to update requests.

Definition at line 176 of file asl.c.

int asl_urb_dequeue ( struct whc whc,
struct urb urb,
int  status 
)

asl_urb_dequeue - remove an URB (qset) from the async list. : the WHCI host controller : the URB to dequeue : the current status of the URB

URBs that do yet have qTDs can simply be removed from the software queue, otherwise the qset must be removed from the ASL so the qTDs can be removed.

Definition at line 308 of file asl.c.

int asl_urb_enqueue ( struct whc whc,
struct urb urb,
gfp_t  mem_flags 
)

asl_urb_enqueue - queue an URB onto the asynchronous list (ASL). : the WHCI host controller : the URB to enqueue : flags for any memory allocations

The qset for the endpoint is obtained and the urb queued on to it.

Work is scheduled to update the hardware's view of the ASL.

Definition at line 265 of file asl.c.

struct whc_qset* get_qset ( struct whc whc,
struct urb urb,
gfp_t  mem_flags 
)
read

get_qset - get the qset for an async endpoint

A new qset is created if one does not already exist.

Definition at line 158 of file qset.c.

void process_halted_qtd ( struct whc whc,
struct whc_qset qset,
struct whc_qtd qtd 
)

process_halted_qtd - process a qset with a halted qtd

Remove all the qTDs for the failed URB and return the failed URB to the USB subsystem. Then remove all other qTDs so the qset can be removed.

FIXME: this is the point where rate adaptation can be done. If a transfer failed because it exceeded the maximum number of retries then it could be reactivated with a slower rate without having to remove the qset.

Definition at line 801 of file qset.c.

void process_inactive_qtd ( struct whc whc,
struct whc_qset qset,
struct whc_qtd qtd 
)

process_inactive_qtd - process an inactive (but not halted) qTD.

Update the urb with the transfer bytes from the qTD, if the urb is completely transferred or (in the case of an IN only) the LPF is set, then the transfer is complete and the urb should be returned to the system.

Definition at line 749 of file qset.c.

void pzl_clean_up ( struct whc whc)

pzl_clean_up - free PZL resources : the WHCI host controller

The PZL is stopped and empty.

Definition at line 412 of file pzl.c.

int pzl_init ( struct whc whc)

pzl_init - initialize the periodic zone list : the WHCI host controller

Definition at line 388 of file pzl.c.

void pzl_qset_delete ( struct whc whc,
struct whc_qset qset 
)

pzl_qset_delete - delete a qset from the PZL

Definition at line 377 of file pzl.c.

void pzl_start ( struct whc whc)

pzl_start - start the periodic schedule : the WHCI host controller

The PZL must be valid (e.g., all entries in the list should have the T bit set).

Definition at line 158 of file pzl.c.

void pzl_stop ( struct whc whc)

pzl_stop - stop the periodic schedule : the WHCI host controller

Definition at line 172 of file pzl.c.

void pzl_update ( struct whc whc,
uint32_t  wusbcmd 
)

pzl_update - request a PZL update and wait for the hardware to be synced : the WHCI HC : WUSBCMD value to start the update.

If the WUSB HC is inactive (i.e., the PZL is stopped) then the update must be skipped as the hardware may not respond to update requests.

Definition at line 189 of file pzl.c.

int pzl_urb_dequeue ( struct whc whc,
struct urb urb,
int  status 
)

pzl_urb_dequeue - remove an URB (qset) from the periodic list : the WHCI host controller : the URB to dequeue : the current status of the URB

URBs that do yet have qTDs can simply be removed from the software queue, otherwise the qset must be removed so the qTDs can be safely removed.

Definition at line 336 of file pzl.c.

int pzl_urb_enqueue ( struct whc whc,
struct urb urb,
gfp_t  mem_flags 
)

pzl_urb_enqueue - queue an URB onto the periodic list (PZL) : the WHCI host controller : the URB to enqueue : flags for any memory allocations

The qset for the endpoint is obtained and the urb queued on to it.

Work is scheduled to update the hardware's view of the PZL.

Definition at line 293 of file pzl.c.

enum whc_update qset_add_qtds ( struct whc whc,
struct whc_qset qset 
)

qset_add_qtds - add qTDs for an URB to a qset

Returns true if the list (ASL/PZL) must be updated because (for a WHCI 0.95 controller) an activated qTD was pointed to be iCur.

Definition at line 189 of file qset.c.

int qset_add_urb ( struct whc whc,
struct whc_qset qset,
struct urb urb,
gfp_t  mem_flags 
)

qset_add_urb - add an urb to the qset's queue.

The URB is chopped into sTDs, one for each qTD that will required. At least one qTD (and sTD) is required even if the transfer has no data (e.g., for some control transfers).

Definition at line 635 of file qset.c.

struct whc_qset* qset_alloc ( struct whc whc,
gfp_t  mem_flags 
)
read

Definition at line 28 of file qset.c.

void qset_clear ( struct whc whc,
struct whc_qset qset 
)

qset_clear - clear fields in a qset so it may be reinserted into a schedule.

The sequence number and current window are not cleared (see qset_reset()).

Definition at line 123 of file qset.c.

void qset_delete ( struct whc whc,
struct whc_qset qset 
)

qset_delete - wait for a qset to be unused, then free it.

Definition at line 831 of file qset.c.

void qset_free ( struct whc whc,
struct whc_qset qset 
)

Definition at line 823 of file qset.c.

void qset_free_std ( struct whc whc,
struct whc_std std 
)

qset_free_std - remove an sTD and free it. : the WHCI host controller : the sTD to remove and free.

Definition at line 299 of file qset.c.

void qset_remove_complete ( struct whc whc,
struct whc_qset qset 
)

Definition at line 176 of file qset.c.

void qset_remove_urb ( struct whc whc,
struct whc_qset qset,
struct urb urb,
int  status 
)

qset_remove_urb - remove an URB from the urb queue.

The URB is returned to the USB subsystem.

Definition at line 703 of file qset.c.

void qset_reset ( struct whc whc,
struct whc_qset qset 
)

qset_reset - reset endpoint state in a qset.

Clears the sequence number and current window. This qset must not be in the ASL or PZL.

Definition at line 145 of file qset.c.

void scan_async_work ( struct work_struct work)

scan_async_work - scan the ASL for qsets to process.

Process each qset in the ASL in turn and then signal the WHC that the ASL has been updated.

Then start, stop or update the asynchronous schedule as required.

Definition at line 202 of file asl.c.

void scan_periodic_work ( struct work_struct work)

scan_periodic_work - scan the PZL for qsets to process.

Process each qset in the PZL in turn and then signal the WHC that the PZL has been updated.

Then start, stop or update the periodic schedule as required.

Definition at line 231 of file pzl.c.

int whc_bwa_set ( struct wusbhc wusbhc,
s8  stream_index,
const struct uwb_mas_bm mas_bm 
)

Definition at line 94 of file wusb.c.

void whc_clean_up ( struct whc whc)

Definition at line 161 of file init.c.

void whc_dbg_clean_up ( struct whc whc)

Definition at line 195 of file debug.c.

void whc_dbg_init ( struct whc whc)

Definition at line 175 of file debug.c.

int whc_dev_info_set ( struct wusbhc wusbhc,
struct wusb_dev wusb_dev 
)

Definition at line 104 of file wusb.c.

void whc_dn_work ( struct work_struct work)

Definition at line 86 of file int.c.

int whc_do_gencmd ( struct whc whc,
u32  cmd,
u32  params,
void addr,
size_t  len 
)

whc_do_gencmd - start a generic command via the WUSBGENCMDSTS register : the WHCI HC : command to start. : parameters for the command (the WUSBGENCMDPARAMS register value). : pointer to any data for the command (may be NULL). : length of the data (if any).

Definition at line 48 of file hw.c.

void whc_hw_error ( struct whc whc,
const char reason 
)

whc_hw_error - recover from a hardware error : the WHCI HC that broke. : a description of the failure.

Recover from broken hardware with a full reset.

Definition at line 98 of file hw.c.

int whc_init ( struct whc whc)

Definition at line 57 of file init.c.

irqreturn_t whc_int_handler ( struct usb_hcd *  hcd)

Definition at line 32 of file int.c.

int whc_mmcie_add ( struct wusbhc wusbhc,
u8  interval,
u8  repeat_cnt,
u8  handle,
struct wuie_hdr wuie 
)

Definition at line 70 of file wusb.c.

int whc_mmcie_rm ( struct wusbhc wusbhc,
u8  handle 
)

Definition at line 84 of file wusb.c.

int whc_set_cluster_id ( struct whc whc,
u8  bcid 
)

Definition at line 218 of file wusb.c.

int whc_set_gtk ( struct wusbhc wusbhc,
u32  tkid,
const void gtk,
size_t  key_size 
)

whc_set_gtk - set the GTK for subsequent broadcast packets

The GTK is stored in the last entry in the key table (the previous N_DEVICES entries are for the per-device PTKs).

Definition at line 203 of file wusb.c.

int whc_set_num_dnts ( struct wusbhc wusbhc,
u8  interval,
u8  slots 
)

Definition at line 128 of file wusb.c.

int whc_set_ptk ( struct wusbhc wusbhc,
u8  port_idx,
u32  tkid,
const void ptk,
size_t  key_size 
)

whc_set_ptk - set the PTK to use for a device.

The index into the key table for this PTK is the same as the device's port index.

Definition at line 172 of file wusb.c.

void whc_write_wusbcmd ( struct whc whc,
u32  mask,
u32  val 
)

Definition at line 26 of file hw.c.

int whc_wusbhc_start ( struct wusbhc wusbhc)

Definition at line 44 of file wusb.c.

void whc_wusbhc_stop ( struct wusbhc wusbhc,
int  delay 
)

Definition at line 54 of file wusb.c.