2 * Driver for Alauda-based card readers
4 * Current development and maintenance by:
5 * (c) 2005 Daniel Drake <dsd@gentoo.org>
7 * See alauda.c for more explanation.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 #define ALAUDA_STATUS_ERROR 0x01
31 #define ALAUDA_STATUS_READY 0x40
34 * Control opcodes (for request field)
36 #define ALAUDA_GET_XD_MEDIA_STATUS 0x08
37 #define ALAUDA_GET_SM_MEDIA_STATUS 0x98
38 #define ALAUDA_ACK_XD_MEDIA_CHANGE 0x0a
39 #define ALAUDA_ACK_SM_MEDIA_CHANGE 0x9a
40 #define ALAUDA_GET_XD_MEDIA_SIG 0x86
41 #define ALAUDA_GET_SM_MEDIA_SIG 0x96
44 * Bulk command identity (byte 0)
46 #define ALAUDA_BULK_CMD 0x40
49 * Bulk opcodes (byte 1)
51 #define ALAUDA_BULK_GET_REDU_DATA 0x85
52 #define ALAUDA_BULK_READ_BLOCK 0x94
53 #define ALAUDA_BULK_ERASE_BLOCK 0xa3
54 #define ALAUDA_BULK_WRITE_BLOCK 0xb4
55 #define ALAUDA_BULK_GET_STATUS2 0xb7
56 #define ALAUDA_BULK_RESET_MEDIA 0xe0
59 * Port to operate on (byte 8)
61 #define ALAUDA_PORT_XD 0x00
62 #define ALAUDA_PORT_SM 0x01
65 * LBA and PBA are unsigned ints. Special values.
69 #define UNUSABLE 0xfffd
71 int init_alauda(struct us_data
*us
);
72 int alauda_transport(struct scsi_cmnd
*srb
, struct us_data
*us
);
74 struct alauda_media_info
{
75 unsigned long capacity
; /* total media size in bytes */
76 unsigned int pagesize
; /* page size in bytes */
77 unsigned int blocksize
; /* number of pages per block */
78 unsigned int uzonesize
; /* number of usable blocks per zone */
79 unsigned int zonesize
; /* number of blocks per zone */
80 unsigned int blockmask
; /* mask to get page from address */
82 unsigned char pageshift
;
83 unsigned char blockshift
;
84 unsigned char zoneshift
;
86 u16
**lba_to_pba
; /* logical to physical block map */
87 u16
**pba_to_lba
; /* physical to logical block map */
91 struct alauda_media_info port
[2];
92 int wr_ep
; /* endpoint to write data out of */
94 unsigned char sense_key
;
95 unsigned long sense_asc
; /* additional sense code */
96 unsigned long sense_ascq
; /* additional sense code qualifier */