Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
realtek_cr.c File Reference
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <linux/cdrom.h>
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/usb_usual.h>
#include "usb.h"
#include "transport.h"
#include "protocol.h"
#include "debug.h"
#include "unusual_realtek.h"

Go to the source code of this file.

Data Structures

struct  rts51x_status
 
struct  rts51x_chip
 

Macros

#define FLIDX_AUTO_DELINK   0x01
 
#define SCSI_LUN(srb)   ((srb)->device->lun)
 
#define SET_BIT(data, idx)   ((data) |= 1 << (idx))
 
#define CLR_BIT(data, idx)   ((data) &= ~(1 << (idx)))
 
#define CHK_BIT(data, idx)   ((data) & (1 << (idx)))
 
#define SET_AUTO_DELINK(chip)   ((chip)->flag |= FLIDX_AUTO_DELINK)
 
#define CLR_AUTO_DELINK(chip)   ((chip)->flag &= ~FLIDX_AUTO_DELINK)
 
#define CHK_AUTO_DELINK(chip)   ((chip)->flag & FLIDX_AUTO_DELINK)
 
#define RTS51X_GET_VID(chip)   ((chip)->vendor_id)
 
#define RTS51X_GET_PID(chip)   ((chip)->product_id)
 
#define VENDOR_ID(chip)   ((chip)->status[0].vid)
 
#define PRODUCT_ID(chip)   ((chip)->status[0].pid)
 
#define FW_VERSION(chip)   ((chip)->status[0].fw_ver)
 
#define STATUS_LEN(chip)   ((chip)->status_len)
 
#define STATUS_SUCCESS   0
 
#define STATUS_FAIL   1
 
#define SUPPORT_DETAILED_TYPE1(chip)   CHK_BIT((chip)->status[0].function[0], 1)
 
#define SUPPORT_OT(chip)   CHK_BIT((chip)->status[0].function[0], 2)
 
#define SUPPORT_OC(chip)   CHK_BIT((chip)->status[0].function[0], 3)
 
#define SUPPORT_AUTO_DELINK(chip)   CHK_BIT((chip)->status[0].function[0], 4)
 
#define SUPPORT_SDIO(chip)   CHK_BIT((chip)->status[0].function[1], 0)
 
#define SUPPORT_DETAILED_TYPE2(chip)   CHK_BIT((chip)->status[0].function[1], 1)
 
#define CHECK_PID(chip, pid)   (RTS51X_GET_PID(chip) == (pid))
 
#define CHECK_FW_VER(chip, fw_ver)   (FW_VERSION(chip) == (fw_ver))
 
#define CHECK_ID(chip, pid, fw_ver)   (CHECK_PID((chip), (pid)) && CHECK_FW_VER((chip), (fw_ver)))
 
#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, vendorName, productName, useProtocol, useTransport, initFunction, flags)
 
#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, vendor_name, product_name, use_protocol, use_transport, init_function, Flags)
 
#define realtek_cr_suspend   NULL
 
#define realtek_cr_resume   NULL
 

Functions

 MODULE_DESCRIPTION ("Driver for Realtek USB Card Reader")
 
 MODULE_AUTHOR ("wwang <[email protected]>")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION ("1.03")
 
 module_param (auto_delink_en, int, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (auto_delink_en,"enable auto delink")
 
 MODULE_DEVICE_TABLE (usb, realtek_cr_ids)
 
 module_usb_driver (realtek_cr_driver)
 

Macro Definition Documentation

#define CHECK_FW_VER (   chip,
  fw_ver 
)    (FW_VERSION(chip) == (fw_ver))

Definition at line 161 of file realtek_cr.c.

#define CHECK_ID (   chip,
  pid,
  fw_ver 
)    (CHECK_PID((chip), (pid)) && CHECK_FW_VER((chip), (fw_ver)))

Definition at line 162 of file realtek_cr.c.

#define CHECK_PID (   chip,
  pid 
)    (RTS51X_GET_PID(chip) == (pid))

Definition at line 160 of file realtek_cr.c.

#define CHK_AUTO_DELINK (   chip)    ((chip)->flag & FLIDX_AUTO_DELINK)

Definition at line 133 of file realtek_cr.c.

#define CHK_BIT (   data,
  idx 
)    ((data) & (1 << (idx)))

Definition at line 129 of file realtek_cr.c.

#define CLR_AUTO_DELINK (   chip)    ((chip)->flag &= ~FLIDX_AUTO_DELINK)

Definition at line 132 of file realtek_cr.c.

#define CLR_BIT (   data,
  idx 
)    ((data) &= ~(1 << (idx)))

Definition at line 128 of file realtek_cr.c.

#define FLIDX_AUTO_DELINK   0x01

Definition at line 122 of file realtek_cr.c.

#define FW_VERSION (   chip)    ((chip)->status[0].fw_ver)

Definition at line 140 of file realtek_cr.c.

#define PRODUCT_ID (   chip)    ((chip)->status[0].pid)

Definition at line 139 of file realtek_cr.c.

#define realtek_cr_resume   NULL

Definition at line 1017 of file realtek_cr.c.

#define realtek_cr_suspend   NULL

Definition at line 1016 of file realtek_cr.c.

#define RTS51X_GET_PID (   chip)    ((chip)->product_id)

Definition at line 136 of file realtek_cr.c.

#define RTS51X_GET_VID (   chip)    ((chip)->vendor_id)

Definition at line 135 of file realtek_cr.c.

#define SCSI_LUN (   srb)    ((srb)->device->lun)

Definition at line 124 of file realtek_cr.c.

#define SET_AUTO_DELINK (   chip)    ((chip)->flag |= FLIDX_AUTO_DELINK)

Definition at line 131 of file realtek_cr.c.

#define SET_BIT (   data,
  idx 
)    ((data) |= 1 << (idx))

Definition at line 127 of file realtek_cr.c.

#define STATUS_FAIL   1

Definition at line 144 of file realtek_cr.c.

#define STATUS_LEN (   chip)    ((chip)->status_len)

Definition at line 141 of file realtek_cr.c.

#define STATUS_SUCCESS   0

Definition at line 143 of file realtek_cr.c.

#define SUPPORT_AUTO_DELINK (   chip)    CHK_BIT((chip)->status[0].function[0], 4)

Definition at line 153 of file realtek_cr.c.

#define SUPPORT_DETAILED_TYPE1 (   chip)    CHK_BIT((chip)->status[0].function[0], 1)

Definition at line 147 of file realtek_cr.c.

#define SUPPORT_DETAILED_TYPE2 (   chip)    CHK_BIT((chip)->status[0].function[1], 1)

Definition at line 157 of file realtek_cr.c.

#define SUPPORT_OC (   chip)    CHK_BIT((chip)->status[0].function[0], 3)

Definition at line 151 of file realtek_cr.c.

#define SUPPORT_OT (   chip)    CHK_BIT((chip)->status[0].function[0], 2)

Definition at line 149 of file realtek_cr.c.

#define SUPPORT_SDIO (   chip)    CHK_BIT((chip)->status[0].function[1], 0)

Definition at line 155 of file realtek_cr.c.

#define UNUSUAL_DEV (   id_vendor,
  id_product,
  bcdDeviceMin,
  bcdDeviceMax,
  vendorName,
  productName,
  useProtocol,
  useTransport,
  initFunction,
  flags 
)
Value:
{\
USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
.driver_info = (flags) \
}

Definition at line 190 of file realtek_cr.c.

#define UNUSUAL_DEV (   idVendor,
  idProduct,
  bcdDeviceMin,
  bcdDeviceMax,
  vendor_name,
  product_name,
  use_protocol,
  use_transport,
  init_function,
  Flags 
)
Value:
{ \
.vendorName = vendor_name, \
.productName = product_name, \
.useProtocol = use_protocol, \
.useTransport = use_transport, \
.initFunction = init_function, \
}

Definition at line 190 of file realtek_cr.c.

#define VENDOR_ID (   chip)    ((chip)->status[0].vid)

Definition at line 138 of file realtek_cr.c.

Function Documentation

MODULE_AUTHOR ( "wwang <[email protected]>"  )
MODULE_DESCRIPTION ( "Driver for Realtek USB Card Reader"  )
MODULE_DEVICE_TABLE ( usb  ,
realtek_cr_ids   
)
MODULE_LICENSE ( "GPL"  )
module_param ( auto_delink_en  ,
int  ,
S_IRUGO S_IWUSR 
)
MODULE_PARM_DESC ( auto_delink_en  ,
"enable auto delink"   
)
module_usb_driver ( realtek_cr_driver  )
MODULE_VERSION ( "1.03"  )