📄 usb_pri.h
字号:
/************************************************** * * usb_pri.h * * CVS ID: $Id: usb_pri.h,v 1.10 2007/09/21 01:52:45 mishima Exp $ * Author: Leos Longauer [LL], Michal Chlapik [MC] - STM * Date: $Date: 2007/09/21 01:52:45 $ * Revision: $Revision: 1.10 $ * * Description: * * usb task: private header * *************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * ***************************************************/ #ifndef _USB_PRIVATE_H#define _USB_PRIVATE_H#include "configuration.h"#include "usb.h" /* public usb header */#include "mu_cdi.h"#include "mu_mem.h"#include "mu_hfi.h"#include "mu_stdio.h"#include "mu_strng.h"/**************************** EXTERNALS ***************************//* defined in uHAL.c */extern void (*pfServiceUsb)(unsigned int InterruptNumber);extern void (*pfServiceUsbTimer)(); //[LL] moved from the accordotimer.c/* application decides if hub is permitted - driver work-around */extern uint8_t APP_HUB_ON;/*************************** DEFINITIONS **************************/#define USB_TRUE TRUE#define USB_FALSE FALSE/*---------------------------------------------------------------------------*//*!\brief Usb compilation switches *//*---------------------------------------------------------------------------*//* OTG or HOST mode *///#define _USB_HOST/* if notification is requested after medium check is done */#define _USB_CHECK_MEDIUM_NOTIFY //going to be obsolete.../* supported USB classes *//* HID is not working *///#define _USB_HID#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP)) //[LL]new#ifndef _USB_HID#define _USB_HID#endif#endif /*IPOD_PASSTHROUGH || IPOD_AP*//* it works with one HUB in the chain with one active port */#define _USB_HUB/* enhanced usb task debugging *///#define _USB_DEBUG /* -> need to resize usb_stack!!! *///#define _USB_DEBUG_PASSTHROUGH/* iAP emulation *///#define _HID_TEST/*---------------------------------------------------------------------------*//*!\brief Usb conditional settings *//*---------------------------------------------------------------------------*/#ifdef _USB_HID#define C_USB_HID 1#else#define C_USB_HID 0#endif#ifdef _USB_HUB#define C_USB_HUB 1#else#define C_USB_HUB 0#endif#if (1 == HAVE_WMDRM)#define C_USB_MTP 1#endif#ifdef _USB_HID#include "mu_hidif.h"#include "mu_cis.h"#ifdef _HID_TEST#include "mu_kii.h" //keyboard#include "mu_spi.h" //pointing device#endif /*_HID_TEST*/#endif /*_USB_HID*/#ifdef _USB_HUB#include "mu_hapi.h"#endif /*_USB_HUB*/#include "mu_mapi.h"#include "class/mu_msd.h"#include "mu_none.h" /* 'none' system declaration */#if (1 == HAVE_WMDRM) #include "mu_mtpapi.h" #include "mu_mtpcsi.h" #include "mu_gmtp.h" #include "allocation.h" // for warning of MALLOC() #include "mtp_types.h"#endif/*---------------------------------------------------------------------------*//*!\brief Maximal number of the usb volumes mounted concurently *//*---------------------------------------------------------------------------*/#define C_USB_VOLUMES_COUNT 2/*---------------------------------------------------------------------------*//*!\brief Usb Read retry counter *//*---------------------------------------------------------------------------*/#define C_USB_READ_ERROR_COUNT 3/*---------------------------------------------------------------------------*//*!\brief number of the iPod upstream pass-through buffers available *//*---------------------------------------------------------------------------*/#define C_USB_UP_BUF_COUNT 5/*---------------------------------------------------------------------------*//*!\brief Usb Task transition results *//*---------------------------------------------------------------------------*/typedef enum{ S_USB_FSM_END = 0, S_USB_FSM_MORE} teUsbFsmCompl;enum{ S_USB_GET_DATA_FSM_IDLE, S_USB_GET_DATA_FSM_WAIT_1ST, S_USB_GET_DATA_FSM_WAIT_MIDDLE, S_USB_GET_DATA_FSM_WAIT_LAST} teUsbFsmXferStates;#if (1 == HAVE_WMDRM)enum{ S_USB_MTP_TREAT_COMMAND, S_USB_MTP_WAIT_RESULT} teUsbFsmMtpState;#endif/*---------------------------------------------------------------------------*//*!\brief Usb timouts *//*---------------------------------------------------------------------------*/#define C_USB_ENUM_TIM_EXPIRED T10000ms#define C_USB_CHECK_MEDIUM_TIM_EXPIRED T1000ms#define C_USB_INIT_RECOVERY_TIME T1000ms/*********************** STRUCTURES & TYPES **********************///#define t_usb_inevent uint32//#define t_usb_outevent uint32typedef enum{ S_USB_GET_POSITION, S_USB_GET_FIRST, S_USB_GET_NEXT, S_USB_GET_LAST} teUsbGetVolumeOption; /* !fit into uint8! */typedef enum{ S_USB_MOUNT_ALL, S_USB_MOUNT_ONE, S_USB_MOUNT_RESET} teUsbMountVolumeOption; /* !fit into uint8! *//*---------------------------------------------------------------------------*//*!\brief last read settings *//*---------------------------------------------------------------------------*/typedef struct{ uint8* pReadBuffer; uint32 dwStartBlockLo; uint32 dwStartBlockHi; uint16 wBlockCount; uint8 wPad[2]; uint32 ReadErrorCounter;} tUsbMsdReadParams;/*---------------------------------------------------------------------------*//*!\brief iPod pass-through buffer *//*---------------------------------------------------------------------------*/#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP)) //[LL]newtypedef struct{ int16 wReadPosition; int16 wWritePosition; int16 wFreePositions; uint8 bUpstreamPending; uint8 bPad; t_usb_upstream_status_event aUpstreamBuffer[C_USB_UP_BUF_COUNT];} tUsbPassthrough;#endif /*IPOD_PASSTHROUGH || IPOD_AP*//*---------------------------------------------------------------------------*//*!\brief Usb working instance *//*---------------------------------------------------------------------------*/typedef struct tagUsbGenVolume tUsbGenVolume;typedef struct tagUsbGenVolume{ void* pDevice; /* TBD //const MUSB_xxxDevice* pDevice; */ tUsbGenVolume** ppVolStack; //TBD t_usb_vol_ID VolID; te_usb_device_type Type :8; uint8 bMounted; /* if volume is ready for use */ uint8 bChange; /* if volume status changed */// uint8 flag_mount; /* set when msd is mounted and prepared with volume */// uint8 flag_umount; /* set when msd is unmounted */// uint8 flag_disconnect; /* set when msd is physically unplugged */} tUsbGenVolume;typedef struct tagUsbMsdVolume tUsbMsdVolume;typedef struct tagUsbMsdVolume{ const MUSB_HfiDevice* pDevice; tUsbMsdVolume** ppVolStack; //TBD t_usb_vol_ID VolID; te_usb_device_type Type :8; uint8 bMounted; /* volume mounted */ uint8 bChange; /* if volume status changed */// uint8 flag_mount; /* set when msd is mounted and prepared with volume */// uint8 flag_umount; /* set when msd is unmounted */// uint8 flag_disconnect; /* set when msd is physically unplugged */ uint8 bPad1; uint8 flag_data_in; uint8 bPad2[2]; MUSB_HfiDeviceInfo DeviceInfo; tUsbMsdReadParams ReadParams; /* to store last read parameters */ } tUsbMsdVolume;#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP)) //[LL]newtypedef struct tagUsbIpodVolume tUsbIpodVolume;typedef struct tagUsbIpodVolume{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -