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

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

?? usbbulkdevlib.c

?? sl811hs_vxworks_host_driver_v1_0_13 sl811的主驅動
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* usbBulkDevLib.c - USB Bulk Only Mass Storage class driver */

/* Copyright 2000-2001 Wind River Systems, Inc. */

/*
modification history
--------------------
01g,08aug01,dat  Removing warnings
01f,25jul01,wef  fixed spr #69285
01e,01may01,wef  fixed incorrect declaration of usbBulkDevDestroy
01d,12apr01,wef  added logic to do READ/WRITE 6 or 10 based on configlette
		 parameter - added a paramter to usbBulBlkDevCreate () 
		 for this purpose.  added support for drives with partition 
		 tables.
01c,02sep00,bri  added support for multiple devices.
01b,04aug00,bri  updated as per review.
01a,22may00,bri  written.
*/

/*
DESCRIPTION

This module implements the USB Mass Storage class driver for the vxWorks 
operating system.  This module presents an interface which is a superset 
of the vxWorks Block Device driver model.  This driver implements external 
APIs which would be expected of a standard block device driver. 

This class driver restricts to Mass Storage class devices that follow bulk-only
transport.  For bulk-only devices transport of command, data and status occurs 
solely via bulk endpoints.  The default control pipe is only used to set 
configuration, clear STALL condition on endpoints and to issue class-specific 
requests. 

The class driver is a client of the Universal Serial Bus Driver (USBD).  All
interaction with the USB buses and devices is handled through the USBD.

INITIALIZATION

The class driver must be initialized with usbBulkDevInit().  It is assumed that
USBD is already initialized and attached to atleast one USB Host Controller.  
usbBulkDevInit() registers the class driver as a client module with USBD.  It 
also registers a callback routine to get notified whenever a USB MSC/SCSI/
BULK-ONLY device is attached or removed from the system.  The callback routine
creates a USB_BULK_DEV structure to represent the USB device attached.  It 
also sets device configuration, interface settings and creates pipes for 
BULK_IN and BULK_OUT transfers. 

OTHER FUNCTIONS

usbBulkBlkDevCreate() is the entry point to define a logical block device.
This routine initializes the fields with in the vxWorks block device structure 
BLK_DEV.  This BLK_DEV structure is part of the USB_BULK_DEV structure.  
Memory is allocated for USB_BULK_DEV by the dynamic attach notification 
callback routine.  So, this create routine just initializes the BLK_DEV 
structure and returns a pointer to it, which is used during file system 
initializtion call.

usbBulkDevIoctl() implements functions which are beyond basic file handling. 
Class-specific requests, Descriptor show, are some of the functions.  Function
code parameter identifies the IO operation requested. 

DATA FLOW

For each USB MSC/SCSI/BULK-ONLY device detected, usbBulkPhysDevCreate() will
create pipes to BULK_IN and a BULK_OUT endpoints of the device.  A pipe is a
channel between USBD client i,e usbBulkDevLib and a specific endpoint.  All 
SCSI commands are encapsulated with in a Command Block Wrapper (CBW) and 
transferred across the BULK_OUT endpoint through the out pipe created.  
This is followed by a data transfer phase.  Depending on the SCSI command 
sent to the device, the direction bit in the CBW will indicate whether data 
is transferred to or from the device.  This bit has no significance if no
data transfer is expected.  Data is transferred to the device through BULK_OUT
endpoint and if the device is required to transfer data, it does through
the BULK_IN endpoint.  The device shall send Command Status Wrapper (CSW) via 
BULK_IN endpoint.  This will indicate the success or failure of the CBW.  The
data to be transferred to device will be pointed by the file system launched 
on the device. 


INCLUDE FILES: usbBulkDevLib.h, blkIo.h

SEE ALSO:
.I "USB Mass Storage Class - Bulk Only Transport Specification Version 1.0,"
.I "SCSI-2 Standard specification 10L - Direct Access device commands"

*/

/* includes */

#include "vxWorks.h"
#include "string.h"
#include "errno.h"
#include "errnoLib.h"
#include "ioLib.h"
#include "blkIo.h"
#include "stdio.h"
#include "logLib.h"
#include "dosFsLib.h"

#include "usb/usbPlatform.h"
#include "usb/ossLib.h"	            /* operations system srvcs */
#include "usb/usb.h"	            /* general USB definitions */
#include "usb/usbListLib.h"         /* linked list functions   */
#include "usb/usbdLib.h"            /* USBD interface          */
#include "usb/usbLib.h"	            /* USB utility functions   */

#include "drv/usb/usbBulkDevLib.h"


/* defines */

#define USB_DEBUG_MSG        0x01
#define USB_DEBUG_ERR        0x02

#define USB_BULK_DEBUG                  \
        if (usbBulkDebug & USB_DEBUG_MSG)   \
            logMsg

#define USB_BULK_ERR                    \
        if (usbBulkDebug & USB_DEBUG_ERR)   \
            logMsg

#define USB_BULK_OFFS  1000

/* typedefs */

/* USB_BULK_DEV Structure - used to describe USB MSC/SCSI/BULK-ONLY device */

typedef struct usbBulkDev
    {
    BLK_DEV           blkDev;         /* Vxworks block device structure */
                                      /* Must be the first one          */
    USBD_NODE_ID      bulkDevId;      /* USBD node ID of the device     */	 
    UINT16            configuration;  /* Configuration value        	*/    
    UINT16            interface;      /* Interface number               */
    UINT16            altSetting;     /* Alternate setting of interface */ 
    UINT16            outEpAddress;   /* Bulk out EP address            */   
    UINT16            inEpAddress;    /* Bulk in EP address             */
    USBD_PIPE_HANDLE  outPipeHandle;  /* Pipe handle for Bulk out EP    */
    USBD_PIPE_HANDLE  inPipeHandle;   /* Pipe handle for Bulk in EP     */
    USB_IRP           inIrp;          /* IRP used for bulk-in data      */
    USB_IRP           outIrp;         /* IRP used for bulk-out data     */
    USB_IRP           statusIrp;      /* IRP used for reading status    */ 
    UINT8             maxLun;         /* Max. number of LUN supported   */
    USB_BULK_CBW      bulkCbw;        /* Structure for Command block    */
    USB_BULK_CSW      bulkCsw;        /* Structure for Command status   */
    UINT8 *           bulkInData;     /* Pointer for bulk-in data       */
    UINT8 *           bulkOutData;    /* Pointer for bulk-out data      */   
    UINT32            numBlks;	      /* Number of blocks on device     */	 
    UINT32            blkOffset;      /* Offset of the starting block   */
    UINT16            lockCount;      /* Count of times structure locked*/
    BOOL              connected;      /* TRUE if USB_BULK device connected */    
    LINK              bulkDevLink;    /* Link to other USB_BULK devices    */  
    BOOL              read10Able;     /* Which read/write command the device  */
				      /* supports.  If TRUE, the device uses  */
				      /* READ10/WRITE10, if FALSE uses READ6 / */
				      /* WRITE6 */
    } USB_BULK_DEV, *pUSB_BULK_DEV;    

/* Attach request for user callback */

typedef struct attach_request
    {
    LINK reqLink;                       /* linked list of requests */
    USB_BULK_ATTACH_CALLBACK callback;  /* client callback routine */
    pVOID callbackArg;                  /* client callback argument*/
    } ATTACH_REQUEST, *pATTACH_REQUEST;

/* globals */

BOOL usbBulkDebug =  0;

/* locals */

LOCAL UINT16 initCount = 0;           /* Count for Bulk device initialisation */

LOCAL USBD_CLIENT_HANDLE usbdHandle;  /* Handle for this class driver */

LOCAL LIST_HEAD bulkDevList;          /* linked list of USB_BULK_DEV */

LOCAL LIST_HEAD    reqList;           /* Attach callback request list */

 MUTEX_HANDLE bulkDevMutex;      /* mutex used to protect internal structs */

SEM_HANDLE   bulkIrpSem;        /* Semaphore for IRP Synchronisation */

LOCAL UINT32 usbBulkIrpTimeOut = USB_BULK_IRP_TIME_OUT; /* Time out for IRP */

/* forward declarations */

LOCAL  STATUS usbBulkDescShow (USBD_NODE_ID nodeId);
LOCAL  STATUS usbBulkConfigDescShow  (USBD_NODE_ID nodeId, UINT8 index);
LOCAL  STATUS usbBulkPhysDevCreate (USBD_NODE_ID nodeId, UINT16 config, 
                                    UINT16 interface);
LOCAL  pUSB_BULK_DEV usbBulkDevFind (USBD_NODE_ID nodeId);
LOCAL  STATUS usbBulkDevBlkRd (BLK_DEV *blkDev, int offset, int num, 
			       char * buf);
LOCAL  STATUS usbBulkDevBlkWrt (BLK_DEV *blkDev, int offset, int num, 
				char * buf);
LOCAL  STATUS usbBulkDevStatusChk (BLK_DEV *blkDev);
LOCAL  STATUS usbBulkDevReset (BLK_DEV *blkDev);
LOCAL  void   usbBulkIrpCallback (pVOID p);
LOCAL  STATUS usbBulkFormScsiCmd (pUSB_BULK_DEV pBulkDev, UINT scsiCmd, 
                                  UINT cmdParam1, UINT cmdParam2);
                                   
LOCAL  USB_COMMAND_STATUS usbBulkCmdExecute (pUSB_BULK_DEV pBulkDev);
LOCAL  void   usbBulkDevDestroy (pUSB_BULK_DEV pBulkDev);
LOCAL  STATUS usbBulkDevResetRecovery (pUSB_BULK_DEV  pBulkDev);
LOCAL  VOID notifyAttach (USBD_NODE_ID nodeId, UINT16 attachCode);


/***************************************************************************
*
* usbBulkDevAttachCallback - called when BULK-ONLY/SCSI device is attached/
* removed
*
* This routine is called by USBD when a mass storage device with SCSI command 
* set as interface sub-class and with bulk-only as interface protocol, is 
* attached/detached.
*
* <nodeId> is the USBD_NODE_ID of the node being attached or removed.	
* <attachAction> is USBD_DYNA_ATTACH or USBD_DYNA_REMOVE.
* <configuration> and <interface> indicate the configuration/interface
* that reports itself as a MSC/SCSI/BULK-ONLY device.  
* <deviceClass>, <deviceSubClass>, and <deviceProtocol> will identify a 
* MSC/SCSI/BULK-ONLY device.
*
* NOTE: The USBD will invoke this function once for each configuration/
* interface which reports itself as a MSC/SCSI/BULK-ONLY.  So, it is possible 
* that a single device insertion/removal may trigger multiple callbacks. 
*
*
* RETURNS: N/A
*/

LOCAL VOID usbBulkDevAttachCallback
    (
    USBD_NODE_ID nodeId,         /* USBD Node ID of the device attached */
    UINT16       attachAction,   /* Whether device attached / detached */
    UINT16       configuration,  /* Configur'n value for  MSC/SCSI/BULK-ONLY */
    UINT16       interface,      /* Interface number for  MSC/SCSI/BULK-ONLY */
    UINT16       deviceClass,    /* Interface class   - 0x8  for MSC */
    UINT16       deviceSubClass, /* Device sub-class  - 0x6  for SCSI 
				  * command 
				  */ 
    UINT16       deviceProtocol  /* Interfaceprotocol - 0x50 for Bulk only */ 
    )
    {
    pUSB_BULK_DEV  pBulkDev;     /* Pointer to bulk device,in case of 
				  * removal 
				  */

    OSS_MUTEX_TAKE (bulkDevMutex, OSS_BLOCK);
 
    switch (attachAction)
        { 
        case USBD_DYNA_ATTACH: 

            /* MSC/SCSI/BULK-ONLY Device attached */

            /* Check out whether we already have a structure for this device */

            if (usbBulkDevFind (nodeId) != NULL)
                break;

            USB_BULK_DEBUG ("usbBulkDevAttachCallback : New Bulk-only device "\
                            "attached\n", 0, 0, 0, 0, 0, 0);

            USB_BULK_DEBUG ("usbBulkDevAttachCallback: Configuration = %d, " \
                            "Interface = %d, Node Id = %d \n", configuration,
                            interface, (UINT)nodeId, 0, 0, 0); 

            /* create a USB_BULK_DEV structure for the device attached */
           
            if ( usbBulkPhysDevCreate (nodeId, configuration,interface) != OK )
                {
                USB_BULK_ERR ("usbBulkDevAttachCallback : Error creating Bulk"\
                              "device\n", 0, 0, 0, 0, 0, 0);
                break; 
                } 

            /* Notify registered callers that a USB_BULK_DEV has been added */

	    notifyAttach (nodeId, USB_BULK_ATTACH); 
 
            break;

        case USBD_DYNA_REMOVE:

            /* MSC/SCSI/BULK-ONLY Device detached */

            if ((pBulkDev = usbBulkDevFind (nodeId)) == NULL)
                break;

            /* Check the connected flag  */

            if (pBulkDev->connected == FALSE)
                break;
            
            pBulkDev->connected = FALSE;

	    /* Notify registered callers that the SCSI/BULK-ONLY device has 
             * been removed 
	     *
	     * NOTE: We temporarily increment the device's lock count
	     * to prevent usbBulkDevUnlock() from destroying the
	     * structure while we're still using it.
	     */

            pBulkDev->lockCount++; 

            notifyAttach (pBulkDev->bulkDevId, USB_BULK_REMOVE); 

            pBulkDev->lockCount--; 
           
            if (pBulkDev->lockCount == 0) 
                usbBulkDevDestroy (pBulkDev); 

            USB_BULK_DEBUG ("usbBulkDevAttachCallback : Bulk only Mass \
			     storage device detached\n", 0, 0, 0, 0, 0, 0);

            break;

        default :
            break; 
        }

    OSS_MUTEX_RELEASE (bulkDevMutex);  
    }


/***************************************************************************
*
* usbBulkDevShutDown - shuts down the USB bulk-only class driver.
*
* This routine unregisters the driver from USBD and releases any resources 
* allocated for the devices.
*
* RETURNS: OK or ERROR.
*/

STATUS usbBulkDevShutDown 
    (
    int   errCode                /* Error code - reason for shutdown */
    )
    {

    pUSB_BULK_DEV pBulkDev;      /* Pointer to bulk device */
    pATTACH_REQUEST  pRequest;

    if (initCount == 0)
        return ossStatus (S_usbBulkDevLib_NOT_INITIALIZED);

    /* release any bulk devices */

    while ((pBulkDev = usbListFirst (&bulkDevList)) != NULL)
        usbBulkDevDestroy (pBulkDev); 

    /* Dispose of any outstanding notification requests */

    while ((pRequest = usbListFirst (&reqList)) != NULL)
        {
      	usbListUnlink (&pRequest->reqLink);
        OSS_FREE (pRequest); 
        }

    /* 
     * Unregister with the USBD. USBD will automatically release any pending
     * IRPs or attach requests.
     */

    if (usbdHandle != NULL)
        {
        usbdClientUnregister (usbdHandle);
        usbdHandle = NULL;
        USB_BULK_DEBUG ("usbBulkDevShutDown : Bulk Only class driver "\
                        "unregistered \n", 0, 0, 0, 0, 0, 0);
        }

    /* release resources */

    if (bulkDevMutex != NULL)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久网站| 精品国产区一区| 97久久久精品综合88久久| 狠狠色丁香婷综合久久| 日韩成人午夜电影| 毛片av一区二区三区| 麻豆精品新av中文字幕| 国产乱码精品一区二区三区忘忧草 | 日韩高清一级片| 香蕉av福利精品导航 | 日韩女优制服丝袜电影| 日韩视频中午一区| 久久久久久久精| 中文字幕日韩一区| 亚洲综合精品久久| 国产精品1024| 成人动漫一区二区在线| 欧美曰成人黄网| 欧美男生操女生| 欧美精品一区二区三区视频| 欧美韩国日本综合| 亚洲精品第一国产综合野| 午夜久久久久久久久久一区二区| 麻豆精品久久精品色综合| 国产精品一区二区在线看| 91色九色蝌蚪| 日韩午夜av电影| 中文字幕一区二区在线观看| 午夜欧美视频在线观看| 国产精品一区二区你懂的| 色哟哟欧美精品| 精品av综合导航| 一区二区三区鲁丝不卡| 狠狠色丁香久久婷婷综| 91社区在线播放| 精品成人在线观看| 亚洲五月六月丁香激情| 国产成人综合在线| 欧美肥大bbwbbw高潮| 日韩码欧中文字| 韩国精品免费视频| 欧美日韩国产免费一区二区| 中文字幕的久久| 麻豆91在线播放免费| 色综合久久88色综合天天6| 精品99999| 日韩制服丝袜av| 91视频你懂的| 中文字幕精品在线不卡| 日本大胆欧美人术艺术动态| 99国产精品国产精品久久| 欧美xxxxx裸体时装秀| 亚洲男人的天堂av| 成人高清伦理免费影院在线观看| 欧美一区二区视频在线观看| 亚洲精品菠萝久久久久久久| 国产精品一区二区三区四区| 欧美一级专区免费大片| 亚洲尤物在线视频观看| 成人亚洲精品久久久久软件| 欧美本精品男人aⅴ天堂| 婷婷国产在线综合| 欧美亚日韩国产aⅴ精品中极品| 国产精品美女久久久久久久| 国产一区二区在线观看免费| 欧美一区二区免费视频| 亚洲3atv精品一区二区三区| 在线中文字幕一区| 亚洲欧美日本在线| 日本高清不卡aⅴ免费网站| 日韩一区中文字幕| 99免费精品在线| 日韩一区中文字幕| 91小视频在线观看| 亚洲日本乱码在线观看| 一本色道a无线码一区v| 一区二区成人在线视频| 欧美视频一区二区三区四区| 亚洲自拍另类综合| 欧美日韩亚洲综合一区| 水蜜桃久久夜色精品一区的特点| 欧美日韩亚洲综合| 麻豆精品一区二区综合av| 26uuu另类欧美亚洲曰本| 国产一区二区精品久久99| 日本一二三四高清不卡| av成人免费在线| 又紧又大又爽精品一区二区| 欧美日韩一区视频| 日韩成人一区二区三区在线观看| 欧美成人精品福利| 国产91精品免费| 一区二区在线免费| 欧美女孩性生活视频| 极品少妇xxxx偷拍精品少妇| 国产亚洲视频系列| 91免费国产在线观看| 国产99精品视频| 亚洲欧美日韩在线不卡| 制服丝袜av成人在线看| 国产精品一区不卡| 亚洲综合精品久久| 亚洲精品一线二线三线| 93久久精品日日躁夜夜躁欧美| 亚洲午夜视频在线观看| 欧美精品一区二区三区视频| 99精品久久99久久久久| 日韩国产欧美在线播放| 国产欧美日韩久久| 欧美精品123区| 国产jizzjizz一区二区| 亚洲国产欧美日韩另类综合 | 国产精品一区一区三区| 亚洲乱码中文字幕| 精品国产3级a| 欧美日韩国产中文| 本田岬高潮一区二区三区| 日本三级亚洲精品| 亚洲人成电影网站色mp4| 欧美成人video| 色老汉av一区二区三区| 国内精品久久久久影院色| 亚洲国产成人av| 中文字幕一区二区在线观看| 91精品国产美女浴室洗澡无遮挡| 成人美女在线观看| 久草精品在线观看| 亚洲高清免费视频| 亚洲精选一二三| 国产精品欧美一级免费| 精品国产电影一区二区| 欧美三级电影精品| 色偷偷一区二区三区| 国产999精品久久久久久绿帽| 六月丁香婷婷色狠狠久久| 亚洲国产wwwccc36天堂| 一区二区三区不卡视频| 欧美激情一区不卡| 久久99精品久久久久久| 欧美国产日本视频| 久久久久久久综合| 久久久夜色精品亚洲| 日韩免费一区二区三区在线播放| 91玉足脚交白嫩脚丫在线播放| 一区二区三区免费在线观看| 91猫先生在线| 欧美成人乱码一区二区三区| 国产精品久久久久久妇女6080| 亚洲国产一区在线观看| 国产综合久久久久久久久久久久| 99精品国产91久久久久久| 欧美日韩在线不卡| 国产精品日产欧美久久久久| 日韩精品欧美成人高清一区二区| 国产成人综合自拍| 69久久99精品久久久久婷婷| 国产精品久久久99| 精品一区二区三区免费毛片爱| 97se亚洲国产综合自在线不卡| 欧美一区二区三区在线电影| 国产精品久久久久婷婷二区次| 日本va欧美va精品发布| 91蜜桃网址入口| 久久免费美女视频| 日韩综合在线视频| 色婷婷综合久久久中文一区二区| 精品国产乱码久久久久久图片 | 亚洲国产aⅴ天堂久久| 成人精品国产免费网站| 欧美成人国产一区二区| 亚洲第一久久影院| 99v久久综合狠狠综合久久| 久久久久99精品一区| 三级精品在线观看| 色88888久久久久久影院按摩 | 国产成人免费在线观看| 88在线观看91蜜桃国自产| 亚洲靠逼com| 99精品国产99久久久久久白柏| 久久久久久久网| 久久精品99国产精品日本| 欧洲一区在线观看| 一区二区三区 在线观看视频| 国产91在线看| 国产偷国产偷精品高清尤物| 极品少妇xxxx精品少妇| 欧美一区二区福利在线| 石原莉奈在线亚洲二区| 欧美久久久久免费| 亚洲第一会所有码转帖| 欧美三级三级三级| 亚洲午夜久久久久中文字幕久| 97se狠狠狠综合亚洲狠狠| 日韩一区在线看| 色呦呦国产精品| 亚洲国产精品一区二区久久恐怖片 | 日韩欧美在线不卡| 另类成人小视频在线| 26uuu国产在线精品一区二区| 色综合久久久久综合体|