📄 usb_pri.h
字号:
void* pDevice; /* TBD //const MUSB_xxxDevice* pDevice; */ tUsbIpodVolume** ppVolStack; //TBD t_usb_vol_ID VolID; te_usb_device_type Type :8; uint8 bMounted; /* HID prepared */ uint8 bChange; /* if volume status changed */ te_usb_com_mode bMode :8; /* iPod communication/management mode */ //TBD// 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 flag_data_in; uint8 flag_data_out; uint8 bPad; MUSB_CisDeviceInfo DeviceInfo; union { tUsbPassthrough UsbPassthrough; //TBD - iAP mode will be added } Mode; } tUsbIpodVolume;#endif /*IPOD_PASSTHROUGH || IPOD_AP*/#if (1 == HAVE_WMDRM)typedef struct tagUsbMtpVolume tUsbMtpVolume;typedef struct tagUsbMtpVolume{ const MUSB_GmtpDevice* pMtpDevice; tUsbMtpVolume** ppVolStack; //TBD t_usb_vol_ID VolID; te_usb_device_type Type :8; uint8 bMounted; /* volume mounted */ uint8 bChange; uint8 flag_data_ready; MUSB_GmtpDeviceInfo MtpDeviceInfo; } tUsbMtpVolume;#endiftypedef union tagUsbVolume{ tUsbGenVolume GenVolume; tUsbMsdVolume MsdVolume;#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP)) //[LL]new tUsbIpodVolume IpodVolume;#endif /*IPOD_PASSTHROUGH || IPOD_AP*/#if (1 == HAVE_WMDRM) tUsbMtpVolume MtpVolume;#endif} tUsbVolume;typedef struct tagUsbDevice{ t_usb_state flag_error; //4B tUsbVolume* apUsbVolumes[C_USB_VOLUMES_COUNT]; /* driver status */ t_usb_dev_info LastDevInfo; int8 bVolCount; uint8 bReady; /* device is available */ uint8 bProcessing; /* device is processing */ uint8 flag_connect; /* device has been physically connected */ uint8 flag_mount; /* ready to start volume mount process */ uint8 flag_check_enum; uint8 flag_check_medium; uint8 flag_unsupported; uint8 flag_hub_unsupported; uint8 flag_change; uint8 flag_disconnect; /* device is physically unplugged */#ifdef _B32_BACK_COMPATIBILITY uint8 bMediumPresence; uint8 bAutoMCheck; uint8 bPad[2];#endif /*_B32_BACK_COMPATIBILITY*/} tUsbDevice;/**************************** PATCHING ****************************/void InitMGCPeriheralLists(void);//[MM]extern uint8 MGC_aHidPeripheralList1[];#ifdef _USB_HUBextern uint8 MGC_aHubPeripheralList[];#endifextern uint8 MGC_aMsdPeripheralList1[];extern uint8 MGC_aMsdPeripheralList2[];uint8 *MGC_aHidPeripheralList1_p;#ifdef _USB_HUBuint8 *MGC_aHubPeripheralList_p;#endifuint8 *MGC_aMsdPeripheralList1_p;uint8 *MGC_aMsdPeripheralList2_p;#if (1 == HAVE_WMDRM)extern uint8 MGC_aMtpPeripheralList1[];extern uint8 MGC_aMtpPeripheralList2[];uint8_t *MGC_aMtpPeripheralList1_p;uint8_t *MGC_aMtpPeripheralList2_p;#endif/***************************** MACROS ****************************//*---------------------------------------------------------------------------*//*!\brief flags handling *//*---------------------------------------------------------------------------*/#define M_SET_FLAG(flag) flag=USB_TRUE#define M_SET_FLAGS(flag,value) flag=value#define M_CLEAR_FLAG(flag) flag=USB_FALSE#define M_CLEAR_FLAGS(flag) flag=USB_FALSE;#define M_IS_SET(flag) flag!=USB_FALSE#define M_IS_SET_TO(flag,value) flag==value#define M_IS_CLEAR(flag) flag==USB_FALSE#define M_READ_FLAGS(flag) flag;flag=USB_FALSE#define M_IS_USB_ERROR(flag) ((flag&E_USB)==E_USB)/*---------------------------------------------------------------------------*//*!\brief iPod pass-through buffer handling *//*---------------------------------------------------------------------------*/#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP)) //[LL]new#define M_USB_UPSTREAM_COUNT_POSITION(_STRUCTURE_ITEM_) \ ( _STRUCTURE_ITEM_ = (_STRUCTURE_ITEM_<(C_USB_UP_BUF_COUNT-1)) ? (_STRUCTURE_ITEM_+1) : 0 )#define M_USB_IS_UPSTREAM_INVALID(_PSTRUCTURE_) \ ( (_PSTRUCTURE_->wFreePositions<0) || \ (_PSTRUCTURE_->wFreePositions>C_USB_UP_BUF_COUNT) )#define M_USB_PREPARE_UPSTREAM(_DESTINATION_,_SOURCE_) \ /*DESTINATION.DataTag = local_usb_upstream_cmd.DataTag;*/ \ _DESTINATION_.VolID = _SOURCE_.VolID; \ _DESTINATION_.pData = _SOURCE_.pData; \ _DESTINATION_.DataLength = _SOURCE_.DataLength; \ _DESTINATION_.bEndFlag = _SOURCE_.bEndFlag; \ _DESTINATION_.bStatus = _SOURCE_.bStatus#define M_USB_PREPARE_ERROR_UPSTREAM(_DESTINATION_, _ERROR_) \ /*DESTINATION.DataTag = local_usb_upstream_cmd.DataTag;*/ \ _DESTINATION_.VolID = 0; \ _DESTINATION_.pData = NULL; \ _DESTINATION_.DataLength = 0; \ _DESTINATION_.bEndFlag = 0; \ _DESTINATION_.bStatus = _ERROR_#endif /*IPOD_PASSTHROUGH || IPOD_AP*//*********************** FUNCTION PROTOTYPES **********************//*---------------------------------------------------------------------------*//*!\brief Usb volume stack *//*---------------------------------------------------------------------------*/tUsbVolume** USB_GetFreeStackVolumeAddress(uint8* Position);t_usb_state USB_VolAlloc(te_usb_device_type Type, void** pVolume, t_usb_vol_ID* pUsbVolID);t_usb_state USB_VolDealloc(tUsbVolume* pVolume);tUsbVolume* USB_GetVolume(te_usb_device_type Type, teUsbGetVolumeOption Option, uint8* Position);//tUsbVolume** UsbGetStackVolumeAddress(void* pDevice, te_usb_device_type Type); //TBD - will be removed/*---------------------------------------------------------------------------*//*!\brief Service functions *//*---------------------------------------------------------------------------*/void umull(uint32* Ah, uint32* Al, uint32 X, uint32 Y);void USB_CheckEnumeration(void);void USB_StartEnumTimer(uint32 time);void USB_StartCheckMediumTimer(uint32 time);void USB_StopEnumTimer(void);void USB_StopCheckMediumTimer(void);void USB_SetErrorForController(t_fsm *usb_fsm, t_usb_state error_reason);#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP)) //[LL]newteUsbFsmCompl USB_PassthroughUpstreamTransition(tUsbPassthrough* pUsbPassthrough);void USB_PassthroughStoreInputReportData(tUsbPassthrough* pUsbPassthrough, t_usb_vol_ID UsbVolID, const unsigned char* pInput, unsigned short wLength, unsigned char bEndFlag, MUSB_CisStatus bStatus);#endif /*IPOD_PASSTHROUGH || IPOD_AP*/void USB_VbusEnable(uint8 enable);/*---------------------------------------------------------------------------*//*!\brief Application initiaded processing *//*---------------------------------------------------------------------------*/void USB_RunBackground(void);t_usb_state USB_Init(void);void USB_Destroy(void);t_usb_state USB_ReinitializeUsb(void);t_usb_state USB_Read(tUsbMsdVolume* pUsbMsdVolume, uint32 dwStartBlockLo, uint32 dwStartBlockHi, uint16 wBlockCount, uint8* pReadBuffer/* , MUSB_pfHfiTransferComplete pfTransferComplete, uint8 bAllowDma*/ );#if (MUSB_DIAG!=0)t_usb_state USB_Write (tUsbMsdVolume* pUsbMsdVolume, uint32 dwStartBlockLo, uint32 dwStartBlockHi, uint16 wBlockCount, uint8* pWriteBuffer/* , uint8 bVerify, MUSB_pfHfiTransferComplete pfTransferComplete, uint8 bAllowDma*/ );#endif /*MUSB_DIAG*///t_bool UsbIsDeviceMounted(tUsbVolume* pVolume); //TBD will be removed#if (1 == HAVE_WMDRM)t_usb_state USB_DataReadWrite (tUsbMtpVolume* pUsbMtpVolume);#endif /* HAVE_WMDRM *//*---------------------------------------------------------------------------*//*!\brief Driver interface *//*---------------------------------------------------------------------------*//*** GENERAL ***/#ifndef _USB_HOST void MUSB_MsdNewOtgState(void* hClient, MUSB_BusHandle hBus, MUSB_OtgState State);void MUSB_MsdOtgError(void* hClient, MUSB_BusHandle hBus, uint32 dwStatus);#endif /* _USB_HOST *//*** HID - iPod ***/#if ((0!=IPOD_PASSTHROUGH) || (0!=IPOD_AP)) //[LL]newMUSB_CisClientHandle MUSB_IpodDeviceAddHandler( const MUSB_CisDeviceInfo* pDeviceInfo);void MUSB_IpodDeviceRemoveHandler( MUSB_CisClientHandle hClient, const MUSB_CisDeviceInfo* pDeviceInfo);void MUSB_IpodDeviceInputHandler( MUSB_CisClientHandle hClient, const unsigned char* pInput, unsigned short wLength, unsigned char bEndFlag, MUSB_CisStatus bStatus);void MUSB_IpodDeviceOutputHandler( MUSB_CisClientHandle hClient, MUSB_CisStatus bStatus);#endif /*IPOD_PASSTHROUGH || IPOD_AP*//*** Mass-storage ***/MUSB_HfiStatus MUSB_HfiAddDevice(MUSB_HfiVolumeHandle* phVolume, const MUSB_HfiDeviceInfo* pInfo, MUSB_HfiDevice* pDevice);void MUSB_HfiDeviceRemoved(MUSB_HfiVolumeHandle hVolume);void MUSB_HfiMediumInserted(MUSB_HfiVolumeHandle hVolume, const MUSB_HfiMediumInfo* pMediumInfo);void MUSB_HfiMediumRemoved(MUSB_HfiVolumeHandle hVolume);void MUSB_MsdMountVolume(tUsbMsdVolume* pMsdVolume, teUsbMountVolumeOption Option);void MUSB_MsdCheckMedium(teUsbMountVolumeOption Option);//void MUSB_MsdEnd(tUsbMsdVolume* pMsdVolume); //TBD - will be removed/* completion callbacks */void MUSB_MsdMountComplete(MUSB_HfiVolumeHandle hVolume, uint8 bSuccess);#ifdef _USB_CHECK_MEDIUM_NOTIFYvoid MUSB_MsdMediumCheckComplete(MUSB_HfiVolumeHandle hVolume);#endif /*_USB_CHECK_MEDIUM_NOTIFY*/void MUSB_MsdTransferComplete(MUSB_HfiVolumeHandle hVolume, uint16 wActualBlocks);#if (1 == HAVE_WMDRM)void MUSB_MtpTransferComplete(MUSB_GmtpVolumeHandle hVolume, uint32_t* pRespondParam, uint16 wMtpError);void MUSB_MtpMountComplete(MUSB_GmtpVolumeHandle hVolume, uint8 bSuccess);#endif#endif /*_USB_PRIVATE_H*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -