usbd_common.h
来自「F:worksip2440a board可启动u-boot-like.tar.g」· C头文件 代码 · 共 160 行
H
160 行
/* * A EEEE SSSS OOO PPPP * A A E S O O P P * AAAAA EEEE SSSS O O PPPP * A A E S O O P * A A EEEE SSSS OOO P * * An Entertainment Solution On a Platform (AESOP) is a completely Open Source * based graphical user environment and suite of applications for PDAs and other * devices running Linux. It is included in various embedded Linux distributions * such as OpenZaurus - http://www.aesop-embedded.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 of the License, 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. * * * Title : usbd_common.h * Author : * Created date : 2005. 06. 26. 23:09:39 KST * Description : * * $Revision: 1.1.1.1 $ * $Log: usbd_common.h,v $ * Revision 1.1.1.1 2005/06/27 17:04:29 linuxpark * Initial import. * * * */ #ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_common.h,v 1.1.1.1 2005/06/27 17:04:29 linuxpark Exp $"/* * Copyright (c) 2005 * Junyoung Song, kernelproject.org <jun0song@kornet.net> * * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */#ifndef __USBD_COMMON_H__#define __USBD_COMMON_H__#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#define IGNORE_VBUS#ifdef DEBUGJY#define debugvs(level,fmt,args...) if (DEBUGJY>=level) debug_vsprintf(fmt,##args);#define debughd(level,str,len) if (DEBUGJY>=level) debug_hexdump(str,len);#else#define debugvs(level,fmt,args...)#define debughd(level,str,len)#endif /* DEBUGJY */#define DEBUG_MSG_BUFF 0x33000000#define MSG_PTR_MASK 0xffefffff /* message buffer size = 1Mbytes */#define MASS_BUFF_SIZE 512#define CSW_STATUS_CommandPassed 0#define CSW_STATUS_CommandFailed 1#define CSW_STATUS_PhaseError 2#define led1_on() gpio->GPCDAT &= ~(1 << 6)#define led1_off() gpio->GPCDAT |= (1 << 6)/* USB Mass Storage Class Bulk only protocol Command Block Wrapper */typedef struct cbw { unsigned long dCBWSignature; unsigned long dCBWTag; unsigned long dCBWDataTransferLength; unsigned char bmCMWFlags; unsigned char bCBWLUN; unsigned char bCBWCBLength; unsigned char CBWCB[16];} __attribute__ ((packed)) cbw;/* USB Mass Storage Class Bulk only protocol Command Status Wrapper */typedef struct csw { unsigned long dCSWSignature; unsigned long dCSWTag; unsigned long dCSWDataResidue; unsigned char bCSWStatus;} __attribute__ ((packed)) csw;typedef struct media_info { enum {RAM, SD, NAND} type; enum {ABSENT, PRESENT, CHANGED} status; unsigned char NoOfHead; unsigned char SectorPerTrack; unsigned short BytePerSector; unsigned short NoOfCylinder; unsigned long total_sector;} media_info;/* SCSI Error Information structure */typedef struct scsi_error_info { unsigned char ErrorCode; unsigned char SenseKey; unsigned char SenseData; unsigned char SenseExt; unsigned long ErrInfo;} __attribute__ ((packed)) scsi_error_info;/* USB Mass Storage Class Bulk only protocol Instance */typedef enum {WAIT_CBW, PROCESS_CBW, MASS_TRANS, MASS_RECV, SEND_CSW, CBW_ERROR} mass_status;typedef enum {NONE, IN_STALL, OUT_STALL, INOUT_STALL} mass_stall;typedef struct usbd_mass_instance { mass_status state; mass_stall stall; cbw cbw; csw csw; media_info media; int usb_reset; unsigned char scsi_error; unsigned long scsi_error_info; unsigned char scsi_rw_option; unsigned char scsi_rw_rdretry; unsigned char scsi_rw_wrretry; unsigned long lba; unsigned short req_sector_count; int buff_length; int buff_ptr; unsigned char buff[MASS_BUFF_SIZE]; /* Sector buffer */} usbd_mass_instance;int debug_vsprintf(const char *, ...);void debug_hexdump(unsigned char *, int);void debug_display(void);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?