📄 usbd_protstorage.h
字号:
/*
* description: USB Protocol Storage definition
* Maker : Tsuyoshi Yamashita
* Copyright : (C)2004,SEIKO EPSON Corp. All Rights Reserved.
*
*--------------------------------------------------------------------------
* $Revision: 1.6 $ $Date: 2006/12/22 05:33:27 $
*/
#include "SPRDEF.h"
/*
Prevention for double include
*/
#ifndef USBD_PROT_STORAGE_H
#define USBD_PROT_STORAGE_H
/*=== Define ==============================================================*/
#define USBD_PROT_STORAGE_START_STATE (0x01) /* Storage Start */
#define USBD_PROT_STORAGE_RESET_STATE (0x02) /* Storage Reset */
#define USBD_PROT_STORAGE_STOP_STATE (0x00) /* Storage Stop */
/*--- USBD_FuncSetParameter -----------------------------------------------------*/
#define USBD_PROT_STORAGE_TYPE_MAXLUN (0x01) /* GetMaxLUN */
#define USBD_PROT_STORAGE_TYPE_EPINFO (0x02) /* Bulk Endpoint Info */
/*--- USBD_FuncGetStatus ---------------------------------------------------*/
#define USBD_PROT_STORAGE_APISTATUS (0x01) /* API Status */
#define USBD_PROT_STORAGE_IDLE_STATE (0x00)
#define USBD_PROT_STORAGE_COMMAND_STATE (0x01)
#define USBD_PROT_STORAGE_TRANSFER_STATE (0x02)
#define USBD_PROT_STORAGE_COMMANDSTATUS_STATE (0x03)
#define USBD_PROT_STORAGE_STALL_STATE (0x0F)
#define USBD_PROT_STORAGE_BULKONLYRESET (0x10)
#define USBD_PROT_STORAGE_GETMAXLUN (0x20)
#define USBD_PROT_STORAGE_EVENTSTATUS (0x02) /* Event Status */
#define USBD_PROT_STORAGE_ACTIVECHANGE_EVENT (0x01) /* Storage Class Active Change */
#define USBD_PROT_STORAGE_BULKONLYRESET_EVENT (0x02) /* BulkOnlyReset */
#define USBD_PROT_STORAGE_GETMAXLUN_EVENT (0x03) /* GetMaxLUN */
#define USBD_PROT_STORAGE_COMMAND_RCVED_EVENT (0x04) /* Command Rcved */
#define USBD_PROT_STORAGE_BULK_XFER_ABORT_EVENT (0x05) /* Bulk Xfer Abort */
#define USBD_PROT_STORAGE_BULK_XFER_FLUSH_EVENT (0x06) /* Bulk Xfer Flush Cmp */
#define USBD_PROT_STORAGE_BULK_XFER_CMP_EVENT (0x07) /* Bulk Xfer Cmp */
#define USBD_PROT_STORAGE_COMMANDSTATUS_SENT_EVENT (0x09) /* Status Sent */
#define USBD_PROT_STORAGE_ACTIVE (0x01) /* Storage Class Active */
#define USBD_PROT_STORAGE_INACTIVE (0x00) /* Storage Class InActive */
/*--- USBD_ProtStorageSetCommandStatus ------------------------------------------*/
#define USBD_PROT_STORAGE_COMMAND_SUCCESS (0x01)
#define USBD_PROT_STORAGE_COMMAND_FAIL (0x02)
#define USBD_PROT_STORAGE_PHASE_ERR (0x03) /* Phase Error (Add for USBCV MSC Test) */
/*--- USBD_ProtStorageSetCommandStatus ------------------------------------------*/
#define USBD_PROT_STORAGE_BULKIN (0x01)
#define USBD_PROT_STORAGE_BULKOUT (0x00)
/*--- USBD_ProtStorageXferStart -------------------------------------------------*/
#define USBD_PROT_STORAGE_PIOMODE (0x00)
#define USBD_PROT_STORAGE_DMAMODE (0x01)
#define USBD_PROT_STORAGE_DMACH0 (0x00)
#define USBD_PROT_STORAGE_DMACH1 (0x01)
#define USBD_PROT_STORAGE_DMACH2 (0x02)
#define USBD_PROT_STORAGE_SHORTENB (0x00)
#define USBD_PROT_STORAGE_SHORTDIS (0x01)
/*=== Structure ===========================================================*/
typedef struct {
UCHAR bLength; /* Length of parameter */
UCHAR bType; /* Type of parameter */
UCHAR bMaxLUN; /* Return value by GetMaxLUN */
UCHAR bReserved; /* Reserved */
} USBD_PROT_STORAGE_PARAM_MAXLUN;
typedef struct {
UCHAR bLength; /* Length of parameter */
UCHAR bType; /* Type of parameter */
UCHAR bBulkInEPNumber; /* Bulk-In Endpoint Number */
UCHAR bBulkOutEPNumber; /* Bulk-Out Endpoint Number */
} USBD_PROT_STORAGE_PARAM_EPINFO;
typedef struct {
UCHAR bXferDir; /* Direction of transfer */
UCHAR bLUN; /* LUN */
ULONG dwXferSize; /* Size of transfer */
UCHAR pbCommand[16]; /* Packet of storage command */
} USBD_PROT_STORAGE_CMD;
/*=== Function Prototype ==================================================*/
LONG USBD_ProtStorageReset(void);
LONG USBD_ProtStorageOpen(void);
LONG USBD_ProtStorageClose(void);
LONG USBD_ProtStorageGetParameter(UCHAR type,void *ptr,USHORT count);
LONG USBD_ProtStorageSetParameter(void *ptr);
LONG USBD_ProtStorageGetStatus(UCHAR type,ULONG *status);
LONG USBD_ProtStorageSetState(ULONG state);
LONG USBD_ProtStorageGetCommand(USBD_PROT_STORAGE_CMD *cmd);
LONG USBD_ProtStorageSetCommandStatus(ULONG xferedSize,UCHAR status);
LONG USBD_ProtStorageRequestSuccess(void);
LONG USBD_ProtStorageRequestFail(void);
LONG USBD_ProtStorageRegisterCBRStorageEvent(CALLBACK_PROC pfnCallback);
LONG USBD_ProtStorageUnregisterCBRStorageEvent(CALLBACK_PROC pfnCallback);
LONG USBD_ProtStorageEndpointHalt(ULONG lParam0,ULONG lParam1,void *pParam);
LONG USBD_ProtStorageConfigured(ULONG lParam0,ULONG lParam1,void *pParam);
LONG USBD_ProtStorageDeconfigured(ULONG lParam0,ULONG lParam1,void *pParam);
LONG USBD_ProtStorageXferStart(UCHAR *bufferPtr,ULONG xferSize,UCHAR xferDir,UCHAR xferType,UCHAR dmaCh,UCHAR xferMode);
LONG USBD_ProtStorageXferAbort(void);
LONG USBD_ProtStorageXferFlush(void);
LONG USBD_ProtStorageRegisterCBRStorageXferEvent(CALLBACK_PROC pfnCallback);
LONG USBD_ProtStorageUnregisterCBRStorageXferEvent(CALLBACK_PROC pfnCallback);
#endif /* USBD_PROT_STORAGE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -