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

Go to the source code of this file.

Data Structures

struct  ms_status_register
 
struct  ms_id_register
 
struct  ms_param_register
 
struct  ms_extra_data_register
 
struct  ms_register
 
struct  mspro_param_register
 
struct  mspro_io_info_register
 
struct  mspro_io_func_register
 
struct  mspro_io_cmd_register
 
struct  mspro_register
 
struct  ms_register_addr
 
struct  memstick_device_id
 
struct  memstick_request
 
struct  memstick_dev
 
struct  memstick_host
 
struct  memstick_driver
 

Macros

#define MEMSTICK_INT_CMDNAK   0x01
 
#define MEMSTICK_INT_IOREQ   0x08
 
#define MEMSTICK_INT_IOBREQ   0x10
 
#define MEMSTICK_INT_BREQ   0x20
 
#define MEMSTICK_INT_ERR   0x40
 
#define MEMSTICK_INT_CED   0x80
 
#define MEMSTICK_STATUS0_WP   0x01
 
#define MEMSTICK_STATUS0_SL   0x02
 
#define MEMSTICK_STATUS0_BF   0x10
 
#define MEMSTICK_STATUS0_BE   0x20
 
#define MEMSTICK_STATUS0_FB0   0x40
 
#define MEMSTICK_STATUS0_MB   0x80
 
#define MEMSTICK_STATUS1_UCFG   0x01
 
#define MEMSTICK_STATUS1_FGER   0x02
 
#define MEMSTICK_STATUS1_UCEX   0x04
 
#define MEMSTICK_STATUS1_EXER   0x08
 
#define MEMSTICK_STATUS1_UCDT   0x10
 
#define MEMSTICK_STATUS1_DTER   0x20
 
#define MEMSTICK_STATUS1_FB1   0x40
 
#define MEMSTICK_STATUS1_MB   0x80
 
#define MEMSTICK_SYS_PAM   0x08
 
#define MEMSTICK_SYS_BAMD   0x80
 
#define MEMSTICK_CP_BLOCK   0x00
 
#define MEMSTICK_CP_PAGE   0x20
 
#define MEMSTICK_CP_EXTRA   0x40
 
#define MEMSTICK_CP_OVERWRITE   0x80
 
#define MEMSTICK_OVERWRITE_UDST   0x10
 
#define MEMSTICK_OVERWRITE_PGST1   0x20
 
#define MEMSTICK_OVERWRITE_PGST0   0x40
 
#define MEMSTICK_OVERWRITE_BKST   0x80
 
#define MEMSTICK_MANAGEMENT_SYSFLG   0x04
 
#define MEMSTICK_MANAGEMENT_ATFLG   0x08
 
#define MEMSTICK_MANAGEMENT_SCMS1   0x10
 
#define MEMSTICK_MANAGEMENT_SCMS0   0x20
 
#define MEMSTICK_SYS_PAR4   0x00
 
#define MEMSTICK_SYS_PAR8   0x40
 
#define MEMSTICK_SYS_SERIAL   0x80
 
#define MEMSTICK_POWER_OFF   0
 
#define MEMSTICK_POWER_ON   1
 
#define MEMSTICK_SERIAL   0
 
#define MEMSTICK_PAR4   1
 
#define MEMSTICK_PAR8   2
 
#define MEMSTICK_MATCH_ALL   0x01
 
#define MEMSTICK_TYPE_LEGACY   0xff
 
#define MEMSTICK_TYPE_DUO   0x00
 
#define MEMSTICK_TYPE_PRO   0x01
 
#define MEMSTICK_CATEGORY_STORAGE   0xff
 
#define MEMSTICK_CATEGORY_STORAGE_DUO   0x00
 
#define MEMSTICK_CATEGORY_IO   0x01
 
#define MEMSTICK_CATEGORY_IO_PRO   0x10
 
#define MEMSTICK_CLASS_FLASH   0xff
 
#define MEMSTICK_CLASS_DUO   0x00
 
#define MEMSTICK_CLASS_ROM   0x01
 
#define MEMSTICK_CLASS_RO   0x02
 
#define MEMSTICK_CLASS_WP   0x03
 
#define MEMSTICK_CAP_AUTO_GET_INT   1
 
#define MEMSTICK_CAP_PAR4   2
 
#define MEMSTICK_CAP_PAR8   4
 

Enumerations

enum  memstick_tpc {
  MS_TPC_READ_MG_STATUS = 0x01, MS_TPC_READ_LONG_DATA = 0x02, MS_TPC_READ_SHORT_DATA = 0x03, MS_TPC_READ_MG_DATA = 0x03,
  MS_TPC_READ_REG = 0x04, MS_TPC_READ_QUAD_DATA = 0x05, MS_TPC_READ_IO_DATA = 0x05, MS_TPC_GET_INT = 0x07,
  MS_TPC_SET_RW_REG_ADRS = 0x08, MS_TPC_EX_SET_CMD = 0x09, MS_TPC_WRITE_QUAD_DATA = 0x0a, MS_TPC_WRITE_IO_DATA = 0x0a,
  MS_TPC_WRITE_REG = 0x0b, MS_TPC_WRITE_SHORT_DATA = 0x0c, MS_TPC_WRITE_MG_DATA = 0x0c, MS_TPC_WRITE_LONG_DATA = 0x0d,
  MS_TPC_SET_CMD = 0x0e
}
 
enum  memstick_command {
  MS_CMD_BLOCK_END = 0x33, MS_CMD_RESET = 0x3c, MS_CMD_BLOCK_WRITE = 0x55, MS_CMD_SLEEP = 0x5a,
  MS_CMD_BLOCK_ERASE = 0x99, MS_CMD_BLOCK_READ = 0xaa, MS_CMD_CLEAR_BUF = 0xc3, MS_CMD_FLASH_STOP = 0xcc,
  MS_CMD_LOAD_ID = 0x60, MS_CMD_CMP_ICV = 0x7f, MSPRO_CMD_FORMAT = 0x10, MSPRO_CMD_SLEEP = 0x11,
  MSPRO_CMD_WAKEUP = 0x12, MSPRO_CMD_READ_DATA = 0x20, MSPRO_CMD_WRITE_DATA = 0x21, MSPRO_CMD_READ_ATRB = 0x24,
  MSPRO_CMD_STOP = 0x25, MSPRO_CMD_ERASE = 0x26, MSPRO_CMD_READ_QUAD = 0x27, MSPRO_CMD_WRITE_QUAD = 0x28,
  MSPRO_CMD_SET_IBD = 0x46, MSPRO_CMD_GET_IBD = 0x47, MSPRO_CMD_IN_IO_DATA = 0xb0, MSPRO_CMD_OUT_IO_DATA = 0xb1,
  MSPRO_CMD_READ_IO_ATRB = 0xb2, MSPRO_CMD_IN_IO_FIFO = 0xb3, MSPRO_CMD_OUT_IO_FIFO = 0xb4, MSPRO_CMD_IN_IOM = 0xb5,
  MSPRO_CMD_OUT_IOM = 0xb6
}
 
enum  memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE }
 

Functions

struct ms_status_register __attribute__ ((packed))
 
int memstick_register_driver (struct memstick_driver *drv)
 
void memstick_unregister_driver (struct memstick_driver *drv)
 
struct memstick_hostmemstick_alloc_host (unsigned int extra, struct device *dev)
 
int memstick_add_host (struct memstick_host *host)
 
void memstick_remove_host (struct memstick_host *host)
 
void memstick_free_host (struct memstick_host *host)
 
void memstick_detect_change (struct memstick_host *host)
 
void memstick_suspend_host (struct memstick_host *host)
 
void memstick_resume_host (struct memstick_host *host)
 
void memstick_init_req_sg (struct memstick_request *mrq, unsigned char tpc, const struct scatterlist *sg)
 
void memstick_init_req (struct memstick_request *mrq, unsigned char tpc, const void *buf, size_t length)
 
int memstick_next_req (struct memstick_host *host, struct memstick_request **mrq)
 
void memstick_new_req (struct memstick_host *host)
 
int memstick_set_rw_addr (struct memstick_dev *card)
 

Variables

unsigned char reserved
 
unsigned char interrupt
 
unsigned char status0
 
unsigned char status1
 
unsigned char type
 
unsigned char if_mode
 
unsigned char category
 
unsigned char class
 
unsigned char system
 
unsigned char block_address_msb
 
unsigned short block_address
 
unsigned char cp
 
unsigned char page_address
 
unsigned char overwrite_flag
 
unsigned char management_flag
 
unsigned short logical_address
 
struct ms_status_register status
 
struct ms_id_register id
 
struct ms_param_register param
 
struct ms_extra_data_register extra_data
 
__be16 data_count
 
__be32 data_address
 
unsigned char tpc_param
 
unsigned char version
 
unsigned char io_category
 
unsigned char current_req
 
unsigned char card_opt_info
 
unsigned char rdy_wait_time
 
unsigned char func_enable
 
unsigned char func_select
 
unsigned char func_intmask
 
unsigned char transfer_mode
 
unsigned char reserved0 [8]
 
unsigned char reserved1 [8]
 
struct mspro_io_info_register io_info
 
struct mspro_io_func_register io_func
 
unsigned char reserved2 [7]
 
struct mspro_io_cmd_register io_cmd
 
unsigned char io_int
 
unsigned char io_int_func
 
unsigned char r_offset
 
unsigned char r_length
 
unsigned char w_offset
 
unsigned char w_length
 
enum memstick_tpc __attribute__
 

Macro Definition Documentation

#define MEMSTICK_CAP_AUTO_GET_INT   1

Definition at line 279 of file memstick.h.

#define MEMSTICK_CAP_PAR4   2

Definition at line 280 of file memstick.h.

#define MEMSTICK_CAP_PAR8   4

Definition at line 281 of file memstick.h.

#define MEMSTICK_CATEGORY_IO   0x01

Definition at line 228 of file memstick.h.

#define MEMSTICK_CATEGORY_IO_PRO   0x10

Definition at line 229 of file memstick.h.

#define MEMSTICK_CATEGORY_STORAGE   0xff

Definition at line 226 of file memstick.h.

#define MEMSTICK_CATEGORY_STORAGE_DUO   0x00

Definition at line 227 of file memstick.h.

#define MEMSTICK_CLASS_DUO   0x00

Definition at line 233 of file memstick.h.

#define MEMSTICK_CLASS_FLASH   0xff

Definition at line 232 of file memstick.h.

#define MEMSTICK_CLASS_RO   0x02

Definition at line 235 of file memstick.h.

#define MEMSTICK_CLASS_ROM   0x01

Definition at line 234 of file memstick.h.

#define MEMSTICK_CLASS_WP   0x03

Definition at line 236 of file memstick.h.

#define MEMSTICK_CP_BLOCK   0x00

Definition at line 79 of file memstick.h.

#define MEMSTICK_CP_EXTRA   0x40

Definition at line 81 of file memstick.h.

#define MEMSTICK_CP_OVERWRITE   0x80

Definition at line 82 of file memstick.h.

#define MEMSTICK_CP_PAGE   0x20

Definition at line 80 of file memstick.h.

#define MEMSTICK_INT_BREQ   0x20

Definition at line 54 of file memstick.h.

#define MEMSTICK_INT_CED   0x80

Definition at line 56 of file memstick.h.

#define MEMSTICK_INT_CMDNAK   0x01

Definition at line 51 of file memstick.h.

#define MEMSTICK_INT_ERR   0x40

Definition at line 55 of file memstick.h.

#define MEMSTICK_INT_IOBREQ   0x10

Definition at line 53 of file memstick.h.

#define MEMSTICK_INT_IOREQ   0x08

Definition at line 52 of file memstick.h.

#define MEMSTICK_MANAGEMENT_ATFLG   0x08

Definition at line 96 of file memstick.h.

#define MEMSTICK_MANAGEMENT_SCMS0   0x20

Definition at line 98 of file memstick.h.

#define MEMSTICK_MANAGEMENT_SCMS1   0x10

Definition at line 97 of file memstick.h.

#define MEMSTICK_MANAGEMENT_SYSFLG   0x04

Definition at line 95 of file memstick.h.

#define MEMSTICK_MATCH_ALL   0x01

Definition at line 218 of file memstick.h.

#define MEMSTICK_OVERWRITE_BKST   0x80

Definition at line 92 of file memstick.h.

#define MEMSTICK_OVERWRITE_PGST0   0x40

Definition at line 91 of file memstick.h.

#define MEMSTICK_OVERWRITE_PGST1   0x20

Definition at line 90 of file memstick.h.

#define MEMSTICK_OVERWRITE_UDST   0x10

Definition at line 89 of file memstick.h.

#define MEMSTICK_PAR4   1

Definition at line 210 of file memstick.h.

#define MEMSTICK_PAR8   2

Definition at line 211 of file memstick.h.

#define MEMSTICK_POWER_OFF   0

Definition at line 206 of file memstick.h.

#define MEMSTICK_POWER_ON   1

Definition at line 207 of file memstick.h.

#define MEMSTICK_SERIAL   0

Definition at line 209 of file memstick.h.

#define MEMSTICK_STATUS0_BE   0x20

Definition at line 62 of file memstick.h.

#define MEMSTICK_STATUS0_BF   0x10

Definition at line 61 of file memstick.h.

#define MEMSTICK_STATUS0_FB0   0x40

Definition at line 63 of file memstick.h.

#define MEMSTICK_STATUS0_MB   0x80

Definition at line 64 of file memstick.h.

#define MEMSTICK_STATUS0_SL   0x02

Definition at line 60 of file memstick.h.

#define MEMSTICK_STATUS0_WP   0x01

Definition at line 59 of file memstick.h.

#define MEMSTICK_STATUS1_DTER   0x20

Definition at line 72 of file memstick.h.

#define MEMSTICK_STATUS1_EXER   0x08

Definition at line 70 of file memstick.h.

#define MEMSTICK_STATUS1_FB1   0x40

Definition at line 73 of file memstick.h.

#define MEMSTICK_STATUS1_FGER   0x02

Definition at line 68 of file memstick.h.

#define MEMSTICK_STATUS1_MB   0x80

Definition at line 74 of file memstick.h.

#define MEMSTICK_STATUS1_UCDT   0x10

Definition at line 71 of file memstick.h.

#define MEMSTICK_STATUS1_UCEX   0x04

Definition at line 69 of file memstick.h.

#define MEMSTICK_STATUS1_UCFG   0x01

Definition at line 67 of file memstick.h.

#define MEMSTICK_SYS_BAMD   0x80

Definition at line 74 of file memstick.h.

#define MEMSTICK_SYS_PAM   0x08

Definition at line 73 of file memstick.h.

#define MEMSTICK_SYS_PAR4   0x00

Definition at line 108 of file memstick.h.

#define MEMSTICK_SYS_PAR8   0x40

Definition at line 109 of file memstick.h.

#define MEMSTICK_SYS_SERIAL   0x80

Definition at line 110 of file memstick.h.

#define MEMSTICK_TYPE_DUO   0x00

Definition at line 222 of file memstick.h.

#define MEMSTICK_TYPE_LEGACY   0xff

Definition at line 221 of file memstick.h.

#define MEMSTICK_TYPE_PRO   0x01

Definition at line 223 of file memstick.h.

Enumeration Type Documentation

Enumerator:
MS_CMD_BLOCK_END 
MS_CMD_RESET 
MS_CMD_BLOCK_WRITE 
MS_CMD_SLEEP 
MS_CMD_BLOCK_ERASE 
MS_CMD_BLOCK_READ 
MS_CMD_CLEAR_BUF 
MS_CMD_FLASH_STOP 
MS_CMD_LOAD_ID 
MS_CMD_CMP_ICV 
MSPRO_CMD_FORMAT 
MSPRO_CMD_SLEEP 
MSPRO_CMD_WAKEUP 
MSPRO_CMD_READ_DATA 
MSPRO_CMD_WRITE_DATA 
MSPRO_CMD_READ_ATRB 
MSPRO_CMD_STOP 
MSPRO_CMD_ERASE 
MSPRO_CMD_READ_QUAD 
MSPRO_CMD_WRITE_QUAD 
MSPRO_CMD_SET_IBD 
MSPRO_CMD_GET_IBD 
MSPRO_CMD_IN_IO_DATA 
MSPRO_CMD_OUT_IO_DATA 
MSPRO_CMD_READ_IO_ATRB 
MSPRO_CMD_IN_IO_FIFO 
MSPRO_CMD_OUT_IO_FIFO 
MSPRO_CMD_IN_IOM 
MSPRO_CMD_OUT_IOM 

Definition at line 170 of file memstick.h.

Enumerator:
MEMSTICK_POWER 
MEMSTICK_INTERFACE 

Definition at line 204 of file memstick.h.

Enumerator:
MS_TPC_READ_MG_STATUS 
MS_TPC_READ_LONG_DATA 
MS_TPC_READ_SHORT_DATA 
MS_TPC_READ_MG_DATA 
MS_TPC_READ_REG 
MS_TPC_READ_QUAD_DATA 
MS_TPC_READ_IO_DATA 
MS_TPC_GET_INT 
MS_TPC_SET_RW_REG_ADRS 
MS_TPC_EX_SET_CMD 
MS_TPC_WRITE_QUAD_DATA 
MS_TPC_WRITE_IO_DATA 
MS_TPC_WRITE_REG 
MS_TPC_WRITE_SHORT_DATA 
MS_TPC_WRITE_MG_DATA 
MS_TPC_WRITE_LONG_DATA 
MS_TPC_SET_CMD 

Definition at line 150 of file memstick.h.

Function Documentation

mcontroller : adapter info structure for old mimd_t apps

: base address : irq number : number of logical drives : pci bus : pci device : pci function : pci id : vendor id : slot number : unique id

Definition at line 171 of file esd_usb2.c.

int memstick_add_host ( struct memstick_host host)

memstick_add_host - start request processing on memstick host - host to use

Definition at line 511 of file memstick.c.

struct memstick_host* memstick_alloc_host ( unsigned int  extra,
struct device dev 
)
read

memstick_alloc_host - allocate a memstick_host structure : size of the user private data to allocate : parent device of the host

Definition at line 490 of file memstick.c.

void memstick_detect_change ( struct memstick_host host)

memstick_detect_change - schedule media detection on memstick host - host to use

Definition at line 210 of file memstick.c.

void memstick_free_host ( struct memstick_host host)

memstick_free_host - free memstick host - host to use

Definition at line 569 of file memstick.c.

void memstick_init_req ( struct memstick_request mrq,
unsigned char  tpc,
const void buf,
size_t  length 
)

memstick_init_req - set request fields needed for short data transfer - request to use - memstick Transport Protocol Command - TPC argument buffer - TPC argument size

The intended use of this function (transfer of data items several bytes in size) allows us to just copy the value between request structure and user supplied buffer.

Definition at line 298 of file memstick.c.

void memstick_init_req_sg ( struct memstick_request mrq,
unsigned char  tpc,
const struct scatterlist sg 
)

memstick_init_req_sg - set request fields needed for bulk data transfer - request to use - memstick Transport Protocol Command - TPC argument

Definition at line 268 of file memstick.c.

void memstick_new_req ( struct memstick_host host)

memstick_new_req - notify the host that some requests are pending - host to use

Definition at line 252 of file memstick.c.

int memstick_next_req ( struct memstick_host host,
struct memstick_request **  mrq 
)

memstick_next_req - called by host driver to obtain next request to process - host to use - pointer to stick the request to

Host calls this function from idle state (*mrq == NULL) or after finishing previous request (*mrq should point to it). If previous request was unsuccessful, it is retried for predetermined number of times. Return value of 0 means that new request was assigned to the host.

Definition at line 226 of file memstick.c.

int memstick_register_driver ( struct memstick_driver drv)

Definition at line 606 of file memstick.c.

void memstick_remove_host ( struct memstick_host host)

memstick_remove_host - stop request processing on memstick host - host to use

Definition at line 548 of file memstick.c.

void memstick_resume_host ( struct memstick_host host)

memstick_resume_host - notify bus driver of host resumption - host to use

Definition at line 592 of file memstick.c.

int memstick_set_rw_addr ( struct memstick_dev card)

memstick_set_rw_addr - issue SET_RW_REG_ADDR request and wait for it to complete - media device to use

Definition at line 371 of file memstick.c.

void memstick_suspend_host ( struct memstick_host host)

memstick_suspend_host - notify bus driver of host suspension - host to use

Definition at line 580 of file memstick.c.

void memstick_unregister_driver ( struct memstick_driver drv)

Definition at line 614 of file memstick.c.

Variable Documentation

unsigned short block_address

Definition at line 77 of file memstick.h.

unsigned char block_address_msb

Definition at line 76 of file memstick.h.

unsigned char card_opt_info

Definition at line 118 of file memstick.h.

unsigned char category

Definition at line 58 of file memstick.h.

unsigned char class

Definition at line 59 of file memstick.h.

unsigned char cp

Definition at line 78 of file memstick.h.

unsigned char current_req

Definition at line 117 of file memstick.h.

unsigned int data_address

Definition at line 113 of file memstick.h.

unsigned short data_count

Definition at line 112 of file memstick.h.

Definition at line 100 of file memstick.h.

unsigned char func_enable

Definition at line 122 of file memstick.h.

unsigned char func_intmask

Definition at line 124 of file memstick.h.

unsigned char func_select

Definition at line 123 of file memstick.h.

Definition at line 97 of file memstick.h.

unsigned char if_mode

Definition at line 57 of file memstick.h.

unsigned char interrupt

Definition at line 50 of file memstick.h.

unsigned char io_category

Definition at line 116 of file memstick.h.

Definition at line 150 of file memstick.h.

Definition at line 148 of file memstick.h.

Definition at line 147 of file memstick.h.

unsigned char io_int

Definition at line 151 of file memstick.h.

unsigned char io_int_func

Definition at line 152 of file memstick.h.

unsigned short logical_address

Definition at line 100 of file memstick.h.

unsigned char management_flag

Definition at line 94 of file memstick.h.

unsigned char overwrite_flag

Definition at line 88 of file memstick.h.

unsigned char page_address

Definition at line 84 of file memstick.h.

Definition at line 99 of file memstick.h.

unsigned char r_length

Definition at line 150 of file memstick.h.

unsigned char r_offset

Definition at line 149 of file memstick.h.

unsigned char rdy_wait_time

Definition at line 119 of file memstick.h.

unsigned char reserved[8]

Definition at line 49 of file memstick.h.

unsigned char reserved0[8]

Definition at line 144 of file memstick.h.

unsigned char reserved1[8]

Definition at line 146 of file memstick.h.

unsigned char reserved2[7]

Definition at line 149 of file memstick.h.

Definition at line 96 of file memstick.h.

unsigned char status0

Definition at line 58 of file memstick.h.

unsigned char status1

Definition at line 66 of file memstick.h.

unsigned char system

Definition at line 72 of file memstick.h.

unsigned short tpc_param

Definition at line 114 of file memstick.h.

unsigned char transfer_mode

Definition at line 125 of file memstick.h.

unsigned char type

Definition at line 56 of file memstick.h.

unsigned char version

Definition at line 115 of file memstick.h.

unsigned char w_length

Definition at line 152 of file memstick.h.

unsigned char w_offset

Definition at line 151 of file memstick.h.