亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? datafab.c

?? usb 子設備程序 支持sd卡 mouse keyboard 的最單單的驅動程序 gcc編譯 支持
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Driver for Datafab USB Compact Flash reader * * $Id: datafab.c,v 1.1.1.1 2007/06/12 07:27:09 eyryu Exp $ * * datafab driver v0.1: * * First release * * Current development and maintenance by: *   (c) 2000 Jimmie Mayfield (mayfield+datafab@sackheads.org) * *   Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver *   which I used as a template for this driver. * *   Some bugfixes and scatter-gather code by Gregory P. Smith  *   (greg-usb@electricrain.com) * *   Fix for media change by Joerg Schneider (js@joergschneider.com) * * Other contributors: *   (c) 2002 Alan Stern <stern@rowland.org> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. *//* * This driver attempts to support USB CompactFlash reader/writer devices * based on Datafab USB-to-ATA chips.  It was specifically developed for the  * Datafab MDCFE-B USB CompactFlash reader but has since been found to work  * with a variety of Datafab-based devices from a number of manufacturers. * I've received a report of this driver working with a Datafab-based * SmartMedia device though please be aware that I'm personally unable to * test SmartMedia support. * * This driver supports reading and writing.  If you're truly paranoid, * however, you can force the driver into a write-protected state by setting * the WP enable bits in datafab_handle_mode_sense().  See the comments * in that routine. */#include <linux/errno.h>#include <linux/slab.h>#include <scsi/scsi.h>#include <scsi/scsi_cmnd.h>#include "usb.h"#include "transport.h"#include "protocol.h"#include "debug.h"#include "datafab.h"static int datafab_determine_lun(struct us_data *us,				 struct datafab_info *info);static inline intdatafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) {	if (len == 0)		return USB_STOR_XFER_GOOD;	US_DEBUGP("datafab_bulk_read:  len = %d\n", len);	return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,			data, len, NULL);}static inline intdatafab_bulk_write(struct us_data *us, unsigned char *data, unsigned int len) {	if (len == 0)		return USB_STOR_XFER_GOOD;	US_DEBUGP("datafab_bulk_write:  len = %d\n", len);	return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,			data, len, NULL);}static int datafab_read_data(struct us_data *us,			     struct datafab_info *info,			     u32 sector,			     u32 sectors){	unsigned char *command = us->iobuf;	unsigned char *buffer;	unsigned char  thistime;	unsigned int totallen, alloclen;	int len, result;	unsigned int sg_idx = 0, sg_offset = 0;	// we're working in LBA mode.  according to the ATA spec, 	// we can support up to 28-bit addressing.  I don't know if Datafab	// supports beyond 24-bit addressing.  It's kind of hard to test 	// since it requires > 8GB CF card.	//	if (sectors > 0x0FFFFFFF)		return USB_STOR_TRANSPORT_ERROR;	if (info->lun == -1) {		result = datafab_determine_lun(us, info);		if (result != USB_STOR_TRANSPORT_GOOD)			return result;	}	totallen = sectors * info->ssize;	// Since we don't read more than 64 KB at a time, we have to create	// a bounce buffer and move the data a piece at a time between the	// bounce buffer and the actual transfer buffer.	alloclen = min(totallen, 65536u);	buffer = kmalloc(alloclen, GFP_NOIO);	if (buffer == NULL)		return USB_STOR_TRANSPORT_ERROR;	do {		// loop, never allocate or transfer more than 64k at once		// (min(128k, 255*info->ssize) is the real limit)		len = min(totallen, alloclen);		thistime = (len / info->ssize) & 0xff;		command[0] = 0;		command[1] = thistime;		command[2] = sector & 0xFF;		command[3] = (sector >> 8) & 0xFF;		command[4] = (sector >> 16) & 0xFF;		command[5] = 0xE0 + (info->lun << 4);		command[5] |= (sector >> 24) & 0x0F;		command[6] = 0x20;		command[7] = 0x01;		// send the read command		result = datafab_bulk_write(us, command, 8);		if (result != USB_STOR_XFER_GOOD)			goto leave;		// read the result		result = datafab_bulk_read(us, buffer, len);		if (result != USB_STOR_XFER_GOOD)			goto leave;		// Store the data in the transfer buffer		usb_stor_access_xfer_buf(buffer, len, us->srb,				 &sg_idx, &sg_offset, TO_XFER_BUF);		sector += thistime;		totallen -= len;	} while (totallen > 0);	kfree(buffer);	return USB_STOR_TRANSPORT_GOOD; leave:	kfree(buffer);	return USB_STOR_TRANSPORT_ERROR;}static int datafab_write_data(struct us_data *us,			      struct datafab_info *info,			      u32 sector,			      u32 sectors){	unsigned char *command = us->iobuf;	unsigned char *reply = us->iobuf;	unsigned char *buffer;	unsigned char thistime;	unsigned int totallen, alloclen;	int len, result;	unsigned int sg_idx = 0, sg_offset = 0;	// we're working in LBA mode.  according to the ATA spec, 	// we can support up to 28-bit addressing.  I don't know if Datafab	// supports beyond 24-bit addressing.  It's kind of hard to test 	// since it requires > 8GB CF card.	//	if (sectors > 0x0FFFFFFF)		return USB_STOR_TRANSPORT_ERROR;	if (info->lun == -1) {		result = datafab_determine_lun(us, info);		if (result != USB_STOR_TRANSPORT_GOOD)			return result;	}	totallen = sectors * info->ssize;	// Since we don't write more than 64 KB at a time, we have to create	// a bounce buffer and move the data a piece at a time between the	// bounce buffer and the actual transfer buffer.	alloclen = min(totallen, 65536u);	buffer = kmalloc(alloclen, GFP_NOIO);	if (buffer == NULL)		return USB_STOR_TRANSPORT_ERROR;	do {		// loop, never allocate or transfer more than 64k at once		// (min(128k, 255*info->ssize) is the real limit)		len = min(totallen, alloclen);		thistime = (len / info->ssize) & 0xff;		// Get the data from the transfer buffer		usb_stor_access_xfer_buf(buffer, len, us->srb,				&sg_idx, &sg_offset, FROM_XFER_BUF);		command[0] = 0;		command[1] = thistime;		command[2] = sector & 0xFF;		command[3] = (sector >> 8) & 0xFF;		command[4] = (sector >> 16) & 0xFF;		command[5] = 0xE0 + (info->lun << 4);		command[5] |= (sector >> 24) & 0x0F;		command[6] = 0x30;		command[7] = 0x02;		// send the command		result = datafab_bulk_write(us, command, 8);		if (result != USB_STOR_XFER_GOOD)			goto leave;		// send the data		result = datafab_bulk_write(us, buffer, len);		if (result != USB_STOR_XFER_GOOD)			goto leave;		// read the result		result = datafab_bulk_read(us, reply, 2);		if (result != USB_STOR_XFER_GOOD)			goto leave;		if (reply[0] != 0x50 && reply[1] != 0) {			US_DEBUGP("datafab_write_data:  Gah! "				  "write return code: %02x %02x\n",				  reply[0], reply[1]);			result = USB_STOR_TRANSPORT_ERROR;			goto leave;		}		sector += thistime;		totallen -= len;	} while (totallen > 0);	kfree(buffer);	return USB_STOR_TRANSPORT_GOOD; leave:	kfree(buffer);	return USB_STOR_TRANSPORT_ERROR;}static int datafab_determine_lun(struct us_data *us,				 struct datafab_info *info){	// Dual-slot readers can be thought of as dual-LUN devices.	// We need to determine which card slot is being used.	// We'll send an IDENTIFY DEVICE command and see which LUN responds...	//	// There might be a better way of doing this?	static unsigned char scommand[8] = { 0, 1, 0, 0, 0, 0xa0, 0xec, 1 };	unsigned char *command = us->iobuf;	unsigned char *buf;	int count = 0, rc;	if (!us || !info)		return USB_STOR_TRANSPORT_ERROR;	memcpy(command, scommand, 8);	buf = kmalloc(512, GFP_NOIO);	if (!buf)		return USB_STOR_TRANSPORT_ERROR;	US_DEBUGP("datafab_determine_lun:  locating...\n");	// we'll try 3 times before giving up...	//	while (count++ < 3) {		command[5] = 0xa0;		rc = datafab_bulk_write(us, command, 8);		if (rc != USB_STOR_XFER_GOOD) {			rc = USB_STOR_TRANSPORT_ERROR;			goto leave;		}		rc = datafab_bulk_read(us, buf, 512);		if (rc == USB_STOR_XFER_GOOD) {			info->lun = 0;			rc = USB_STOR_TRANSPORT_GOOD;			goto leave;		}		command[5] = 0xb0;		rc = datafab_bulk_write(us, command, 8);		if (rc != USB_STOR_XFER_GOOD) {			rc = USB_STOR_TRANSPORT_ERROR;			goto leave;		}		rc = datafab_bulk_read(us, buf, 512);		if (rc == USB_STOR_XFER_GOOD) {			info->lun = 1;			rc = USB_STOR_TRANSPORT_GOOD;			goto leave;		}		msleep(20);	}	rc = USB_STOR_TRANSPORT_ERROR; leave:	kfree(buf);	return rc;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区四区中文字幕| 久久综合九色综合97婷婷| 一区二区三区**美女毛片| 欧美四级电影在线观看| 亚洲一区二区三区自拍| 欧美精品视频www在线观看| 美女视频一区二区三区| 精品国产乱码久久久久久老虎| 精品一区二区三区在线观看| 久久夜色精品国产噜噜av| 91亚洲永久精品| 青青青伊人色综合久久| 亚洲一区在线视频观看| 欧美伊人久久大香线蕉综合69| 亚洲成人一区二区| 欧美不卡123| av一区二区三区在线| 亚洲成人黄色影院| 精品国精品自拍自在线| 97精品电影院| 日韩电影在线免费看| 久久蜜桃av一区二区天堂| 色婷婷综合久久久久中文| 日韩电影在线观看电影| 国产精品日韩成人| 欧美精品18+| 国产99久久久久久免费看农村| 亚洲乱码日产精品bd| 日韩午夜激情av| av不卡在线播放| 老司机精品视频导航| 亚洲人成小说网站色在线| 成人国产精品免费观看视频| 国产精品久久久久久福利一牛影视 | 色婷婷综合久色| 久久精品久久综合| 一区二区三区四区高清精品免费观看| 欧美一区二区三区在线| 91在线播放网址| 久久精品国产99国产| 亚洲免费看黄网站| 久久只精品国产| 欧美性视频一区二区三区| 国产成人精品www牛牛影视| 水蜜桃久久夜色精品一区的特点| 欧美激情综合五月色丁香小说| 欧美高清视频www夜色资源网| www.欧美精品一二区| 美女久久久精品| 亚洲va韩国va欧美va| 亚洲欧美自拍偷拍| 久久久www成人免费无遮挡大片| 欧美日韩成人综合| 一本一道综合狠狠老| 成人激情图片网| 国产麻豆精品在线观看| 蜜桃视频一区二区| 日韩专区在线视频| 亚洲制服丝袜av| 亚洲精品成人悠悠色影视| 国产欧美精品在线观看| 久久久www成人免费毛片麻豆| 日韩精品专区在线影院重磅| 欧美精品九九99久久| 在线观看精品一区| 91九色02白丝porn| 色综合 综合色| 色琪琪一区二区三区亚洲区| 91在线无精精品入口| 粉嫩一区二区三区在线看| 国产综合久久久久久久久久久久| 麻豆高清免费国产一区| 美国三级日本三级久久99| 青青草国产精品97视觉盛宴| 男人的天堂亚洲一区| 裸体健美xxxx欧美裸体表演| 日韩成人精品在线| 美女脱光内衣内裤视频久久影院| 日韩黄色一级片| 美女高潮久久久| 国产一区二区网址| 国产酒店精品激情| 福利电影一区二区| 97国产精品videossex| 91香蕉视频污| 欧美日韩国产综合草草| 亚洲欧洲av在线| 国产精品久久毛片| 亚洲欧美视频在线观看| 亚洲一区二区三区四区五区黄| 午夜视频在线观看一区二区三区| 午夜成人在线视频| 九九久久精品视频| 成人h动漫精品一区二区| 色999日韩国产欧美一区二区| 欧美日韩国产综合一区二区| 精品美女一区二区| 中文字幕一区二区三区在线播放| 亚洲综合在线视频| 青青青伊人色综合久久| 国产91丝袜在线播放九色| 99久久国产综合色|国产精品| 欧美午夜电影在线播放| 精品欧美一区二区在线观看| 国产精品午夜在线| 亚洲一区二区三区在线播放| 蜜臀av一区二区在线观看| 东方aⅴ免费观看久久av| 色婷婷av久久久久久久| 欧美www视频| 亚洲精品一二三四区| 美洲天堂一区二卡三卡四卡视频| 成人免费视频一区二区| 91久久国产最好的精华液| 欧美xxxx老人做受| 亚洲摸摸操操av| 精品制服美女久久| 日本高清不卡aⅴ免费网站| 精品欧美一区二区在线观看| 亚洲欧美电影一区二区| 另类小说视频一区二区| 97se亚洲国产综合自在线不卡| 欧美电影在哪看比较好| 国产精品主播直播| 在线亚洲一区二区| 亚洲国产精品成人综合色在线婷婷| 亚洲国产你懂的| 成人午夜又粗又硬又大| 欧美日韩国产高清一区| 综合欧美一区二区三区| 久久精品国产99久久6| 91精彩视频在线| 国产目拍亚洲精品99久久精品| 亚洲3atv精品一区二区三区| www.成人网.com| 欧美v日韩v国产v| 五月天视频一区| 99re热视频精品| 国产亚洲精久久久久久| 免费人成在线不卡| 欧美午夜理伦三级在线观看| 国产精品美女一区二区三区| 激情久久久久久久久久久久久久久久| 欧美综合色免费| 一区视频在线播放| 国产夫妻精品视频| 亚洲精品在线电影| 免费成人av资源网| 欧美日韩免费观看一区三区| 樱花草国产18久久久久| 欧美成人精精品一区二区频| 日产国产高清一区二区三区| 欧美日韩一级片网站| 一二三四区精品视频| 在线免费一区三区| 一区二区三区在线影院| 色妹子一区二区| 亚洲日本一区二区| 91丨porny丨国产入口| 亚洲欧美综合另类在线卡通| av在线播放成人| 亚洲女与黑人做爰| 色老汉一区二区三区| 亚洲私人影院在线观看| 色94色欧美sute亚洲线路一ni| 亚洲欧洲制服丝袜| 日本韩国一区二区三区视频| 欧美一级理论片| 欧美性一二三区| 亚洲男人的天堂一区二区| 91啪亚洲精品| 亚洲乱码中文字幕综合| 欧美亚洲综合另类| 午夜精品福利一区二区蜜股av| 欧美精品久久一区| 美日韩黄色大片| 国产午夜亚洲精品理论片色戒| 国产伦精品一区二区三区在线观看| 2014亚洲片线观看视频免费| 丁香六月综合激情| 综合av第一页| 欧美老女人第四色| 久久狠狠亚洲综合| 国产精品免费人成网站| 欧美综合亚洲图片综合区| 日韩电影在线免费看| 久久免费看少妇高潮| 成人18精品视频| 亚洲精品乱码久久久久久久久| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲摸摸操操av| 欧美电影精品一区二区| 欧美日韩高清影院| 日本美女一区二区三区| 日韩美女在线视频| 国产成人免费在线观看不卡| 亚洲精品老司机| 日韩av在线播放中文字幕| 精品1区2区在线观看| 91网站黄www|