Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v2.6.29 100 lines 2.8 kB view raw
1/* 2 * Driver for Alauda-based card readers 3 * 4 * Current development and maintenance by: 5 * (c) 2005 Daniel Drake <dsd@gentoo.org> 6 * 7 * See alauda.c for more explanation. 8 * 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 12 * later version. 13 * 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. 18 * 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. 22 */ 23 24#ifndef _USB_ALAUDA_H 25#define _USB_ALAUDA_H 26 27/* 28 * Status bytes 29 */ 30#define ALAUDA_STATUS_ERROR 0x01 31#define ALAUDA_STATUS_READY 0x40 32 33/* 34 * Control opcodes (for request field) 35 */ 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 42 43/* 44 * Bulk command identity (byte 0) 45 */ 46#define ALAUDA_BULK_CMD 0x40 47 48/* 49 * Bulk opcodes (byte 1) 50 */ 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 57 58/* 59 * Port to operate on (byte 8) 60 */ 61#define ALAUDA_PORT_XD 0x00 62#define ALAUDA_PORT_SM 0x01 63 64/* 65 * LBA and PBA are unsigned ints. Special values. 66 */ 67#define UNDEF 0xffff 68#define SPARE 0xfffe 69#define UNUSABLE 0xfffd 70 71int init_alauda(struct us_data *us); 72int alauda_transport(struct scsi_cmnd *srb, struct us_data *us); 73 74struct 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 */ 81 82 unsigned char pageshift; 83 unsigned char blockshift; 84 unsigned char zoneshift; 85 86 u16 **lba_to_pba; /* logical to physical block map */ 87 u16 **pba_to_lba; /* physical to logical block map */ 88}; 89 90struct alauda_info { 91 struct alauda_media_info port[2]; 92 int wr_ep; /* endpoint to write data out of */ 93 94 unsigned char sense_key; 95 unsigned long sense_asc; /* additional sense code */ 96 unsigned long sense_ascq; /* additional sense code qualifier */ 97}; 98 99#endif 100