⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb.h

📁 本程序为ST公司开发的源代码
💻 H
字号:
/************************************************** * * usb.h * * CVS ID:   $Id: usb.h,v 1.38 2007/09/21 01:53:16 mishima Exp $ * Author:   Leos Longauer [LL], Michal Chlapik [MC] - STM * Date:     $Date: 2007/09/21 01:53:16 $ * Revision: $Revision: 1.38 $ *  * Description: *  *   usb task: public header * *************************************************** *  * COPYRIGHT (C) ST Microelectronics  2005 *            All Rights Reserved * ***************************************************/ #ifndef _USB_H#define _USB_H/*************************** DEFINITIONS **************************//*---------------------------------------------------------------------------*//*!\brief Compilation switch                                                 *//*---------------------------------------------------------------------------*/#define _B32_BACK_COMPATIBILITY		//provisional/*---------------------------------------------------------------------------*//*!\brief Usb limitations                                                    *//*---------------------------------------------------------------------------*//* block size limitation */#define C_USB_MAX_DEV_BLOCK_SIZE              2048#define C_USB_MAX_READ_ATTEMPTS               2048#if (1 == HAVE_WMDRM) /* prepared temp buffer size */ #define MTP_TEMP_BUF_SIZE					2400 #define UNKNOWN_READ_SIZE					MTP_TEMP_BUF_SIZE#endif#define C_USB_IPOD_VID                       0x05AC#define C_USB_IPOD_PID_MASK                  0x1200#define CFG_VBUS_CNTRL	(module_config.data.usb_options.field.enable_vbus_control)/*********************** STRUCTURES & TYPES **********************/typedef uint8 t_usb_vol_ID;		/* DO NOT CHANGE THE SIZE OF THE TYPE! */typedef void* t_usb_volume_handle;/*---------------------------------------------------------------------------*//*!\brief Usb device types                                                   *//*---------------------------------------------------------------------------*/typedef enum{	S_USB_TYPE_NONE,	S_USB_TYPE_MSD,	S_USB_TYPE_IPOD,#if (1 == HAVE_WMDRM)	S_USB_TYPE_MTP#endif} te_usb_device_type; /* !fits into uint8! */#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP))	//[LL]new/*---------------------------------------------------------------------------*//*!\brief Ipod communication modes                                           *//*---------------------------------------------------------------------------*/typedef enum{	S_USB_IPOD_MODE_NONE,	S_USB_IPOD_MODE_PASSTHROUGH,	S_USB_IPOD_MODE_IAP} te_usb_com_mode; /* !fits into uint8! *//*---------------------------------------------------------------------------*//*!\brief iPod pass-through events - downstream                              *//*---------------------------------------------------------------------------*//* command from hostif to USB */typedef struct tag_usb_downstream_cmd_event{  t_usb_vol_ID VolID;   /* which volume */  uint16 DataLength; /* num of valid data */  uint8  bEndFlag;  /* last packet flag */  uint8* pData;     /* ptr to available data packet */  uint32 DataTag;   /* packet counter */} t_usb_downstream_cmd_event;/* status from USB to hostif */typedef struct tag_usb_downstream_status_event{  t_usb_state bStatus;  /* tbd */  uint32 DataTag;   /* succesfully read packet nr (same as packet counter) *///  t_usb_vol_ID VolID;   /* which volume */} t_usb_downstream_status_event;/*---------------------------------------------------------------------------*//*!\brief iPod pass-through events - upstream                                *//*---------------------------------------------------------------------------*//* command from hostif to USB (finally it's status named command)*/typedef struct tag_usb_upstream_cmd_event{  t_usb_state bStatus;  uint32 DataTag;//  t_usb_vol_ID VolID;   /* which volume */} t_usb_upstream_cmd_event;/* status from USB to hostif (finally it's command named status)*/typedef struct tag_usb_upstream_status_event{  t_usb_vol_ID VolID;   /* which volume */  uint16 DataLength;  uint8  bEndFlag;  uint8* pData;  uint32 DataTag;  t_usb_state  bStatus;} t_usb_upstream_status_event;#endif /*IPOD_PASSTHROUGH || IPOD_AP*//*---------------------------------------------------------------------------*//*!\brief Usb mount                                                          *//*---------------------------------------------------------------------------*/typedef struct	//TBD - will be replaced{    uint32 USB_state;//	t_usb_volume_handle hUsbVolume;    struct    {	    uint32 block_size;    	uint16 wVendorId;	    uint16 wProductId;    	uint16 bcdDevice;    } Info;} t_usb_status_event;typedef struct{   	uint16 vid;    uint16 pid;   	uint16 string_ser_num[32];    //uint16 string_vendor[16];    //uint16 string_product[32];    //uint16 string_revision[8];    uint32 block_size;		// only for MSD    uint32 medium_size_lo;	// only for MSD    uint32 medium_size_hi;	// only for MSD    uint16 version;} t_usb_dev_info;typedef union{	uint8 vol_all;	struct	{		uint8 vol0	:1;		uint8 vol1	:1;		uint8 vol2	:1;		uint8 vol3	:1;		uint8 vol4	:1;		uint8 vol5	:1;		uint8 vol6	:1;		uint8 vol7	:1;	} vol;} t_usb_change_info;/*********************** FUNCTION PROTOTYPES **********************//*---------------------------------------------------------------------------*//*!\brief Usb Task functions                                                 *//*---------------------------------------------------------------------------*/RETVAL usb_cmd(t_child_cmd_event* cmd_event);#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP))	//[LL]newvoid usb_downstream_command(t_usb_downstream_cmd_event * usb_downstream_cmd);void usb_upstream_command(t_usb_upstream_cmd_event * usb_upstream_cmd);void usb_downstream_status(t_usb_downstream_status_event * usb_downstream_status);void usb_upstream_status(t_usb_upstream_status_event * usb_upstream_status);#endif /*IPOD_PASSTHROUGH || IPOD_AP*/void InitUSBTask(void);void USBTask(void *unused);/*---------------------------------------------------------------------------*//*!\brief Usb task interface functions                                       *//*---------------------------------------------------------------------------*/void usb_call_back(void);void usb_check_enumeration(void);void usb_check_medium(void);#if (MUSB_DIAG!=0)//t_bool usb_is_device_connected(void);	//x//t_bool usb_is_device_mounted(void);	//x#endif /*MUSB_DIAG*/void usb_get_changes(t_usb_change_info* change_info);t_usb_state usb_get_vol_info(t_usb_vol_ID usb_vol_ID, t_usb_dev_info* p_usb_vol_info);#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP))	//[LL]newt_usb_state usb_set_ipod_mode(t_usb_vol_ID usb_vol_ID, te_usb_com_mode bMode);	//TBD#endif /*IPOD_PASSTHROUGH || IPOD_AP*/void usb_set_medium_auto_check(t_bool check_on);#if (1 == HAVE_WMDRM)  extern t_bool USB_is_currnt_device_mtp(void);#endif#endif /*_USB_H*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -