121 USBH_MTP_InterfaceInit,
122 USBH_MTP_InterfaceDeInit,
123 USBH_MTP_ClassRequest,
146 uint8_t interface, endpoint;
155 if(interface == 0xFF)
158 USBH_DbgLog (
"Cannot Find the interface for Still Image Class.");
164 endpoint = MTP_FindCtlEndpoint(phost);
169 if( MTP_Handle ==
NULL)
172 USBH_DbgLog (
"Cannot allocate RAM for MTP Handle");
176 MTP_Handle->
NotificationEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bEndpointAddress;
177 MTP_Handle->
NotificationEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].wMaxPacketSize;
179 MTP_Handle->
events.
poll = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bInterval;
185 phost->device.address,
193 endpoint = MTP_FindDataInEndpoint(phost);
196 MTP_Handle->
DataInEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bEndpointAddress;
197 MTP_Handle->
DataInEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].wMaxPacketSize;
204 phost->device.address,
211 endpoint = MTP_FindDataOutEndpoint(phost);
214 MTP_Handle->
DataOutEp = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bEndpointAddress;
215 MTP_Handle->
DataOutEpSize = phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].wMaxPacketSize;
222 phost->device.address,
246 uint8_t interface, endpoint;
252 for (endpoint = 0; endpoint < USBH_MAX_NUM_ENDPOINTS ; endpoint ++ )
254 if((phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bEndpointAddress & 0x80)&&
255 (phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].wMaxPacketSize > 0)&&
256 ((phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bmAttributes & USBH_EP_INTERRUPT) == USBH_EP_INTERRUPT))
275 uint8_t interface, endpoint;
281 for (endpoint = 0; endpoint < USBH_MAX_NUM_ENDPOINTS ; endpoint ++ )
284 if(((phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bEndpointAddress & 0x80) == 0)&&
285 (phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].wMaxPacketSize > 0)&&
286 ((phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bmAttributes & USBH_EP_BULK) == USBH_EP_BULK))
304 uint8_t interface, endpoint;
310 for (endpoint = 0; endpoint < USBH_MAX_NUM_ENDPOINTS ; endpoint ++ )
313 if((phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bEndpointAddress & 0x80)&&
314 (phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].wMaxPacketSize > 0)&&
315 ((phost->device.CfgDesc.Itf_Desc[interface].Ep_Desc[endpoint].bmAttributes & USBH_EP_BULK) == USBH_EP_BULK))
375 #if (USBH_USE_OS == 1) 394 switch(MTP_Handle->
state)
404 #if (USBH_USE_OS == 1) 428 #if (USBH_USE_OS == 1) 447 #if (USBH_USE_OS == 1) 474 #if (USBH_USE_OS == 1) 481 USBH_MTP_Events(phost);
482 #if (USBH_USE_OS == 1) 550 if((storage_idx < MTP_Handle->info.storids.n) && (MTP_Handle->
is_ready))
570 if((storage_idx < MTP_Handle->info.storids.n) && (MTP_Handle->
is_ready))
585 uint32_t storage_idx,
586 uint32_t objectformatcode,
587 uint32_t associationOH,
592 uint32_t timeout = phost->
Timer;
593 if((storage_idx < MTP_Handle->info.storids.n) && (MTP_Handle->
is_ready))
618 uint32_t storage_idx,
619 uint32_t objectformatcode,
620 uint32_t associationOH,
625 uint32_t timeout = phost->
Timer;
627 if((storage_idx < MTP_Handle->info.storids.n) && (MTP_Handle->
is_ready))
657 uint32_t timeout = phost->
Timer;
680 uint32_t objectformatcode)
684 uint32_t timeout = phost->
Timer;
712 uint32_t timeout = phost->
Timer;
743 uint32_t timeout = phost->
Timer;
777 uint32_t timeout = phost->
Timer;
809 uint32_t timeout = phost->
Timer;
841 uint32_t timeout = phost->
Timer;
873 uint32_t timeout = phost->
Timer;
902 if((phost->
Timer & 1) == 0)
917 MTP_DecodeEvent(phost);
1038 uint32_t timeout = phost->
Timer;
USBH_StatusTypeDef USBH_InterruptReceiveData(USBH_HandleTypeDef *phost, uint8_t *buff, uint8_t length, uint8_t hc_num)
USBH_InterruptReceiveData Receives the Device Response to the Interrupt IN token. ...
USBH_StatusTypeDef USBH_PTP_GetPartialObject(USBH_HandleTypeDef *phost, uint32_t handle, uint32_t offset, uint32_t maxbytes, uint8_t *object, uint32_t *len)
USBH_PTP_GetPartialObject Gets object partially.
uint8_t Model[PTP_MAX_STR_SIZE]
#define MTP_StorageInfoTypedef
#define PTP_EC_UnreportedStatus
uint8_t VolumeLabel[PTP_MAX_STR_SIZE]
#define PTP_EC_CancelTransaction
USBH_StatusTypeDef USBH_PTP_GetStorageInfo(USBH_HandleTypeDef *phost, uint32_t storage_id, PTP_StorageInfoTypedef *storage_info)
USBH_PTP_GetDeviceInfo Gets device info dataset and fills deviceinfo structure.
USBH_DeviceTypeDef device
USBH_StatusTypeDef USBH_PTP_GetObjectPropDesc(USBH_HandleTypeDef *phost, uint16_t opc, uint16_t ofc, PTP_ObjectPropDescTypeDef *opd)
USBH_PTP_GetObjectPropDesc Gets object partially.
uint32_t DevicePropertiesSupported_len
#define PTP_EC_StorageInfoChanged
USBH_StatusTypeDef USBH_MTP_GetPartialObject(USBH_HandleTypeDef *phost, uint32_t handle, uint32_t offset, uint32_t maxbytes, uint8_t *object, uint32_t *len)
USBH_MTP_GetPartialObject Gets object.
USBH_StatusTypeDef USBH_OpenPipe(USBH_HandleTypeDef *phost, uint8_t ch_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
USBH_Open_Pipe Open a pipe.
uint32_t EventsSupported_len
USBH_StatusTypeDef USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface)
USBH_SelectInterface Select current interface.
#define PTP_EC_StoreRemoved
#define PTP_EC_ObjectAdded
USBH_StatusTypeDef USBH_PTP_GetObjectPropList(USBH_HandleTypeDef *phost, uint32_t handle, MTP_PropertiesTypedef *pprops, uint32_t *nrofprops)
USBH_PTP_GetObjectPropList Gets object partially.
uint8_t USBH_AllocPipe(USBH_HandleTypeDef *phost, uint8_t ep_addr)
USBH_Alloc_Pipe Allocate a new Pipe.
#define PTP_EC_DevicePropChanged
#define HOST_USER_CLASS_ACTIVE
#define PTP_EC_DeviceReset
uint8_t USBH_MTP_IsReady(USBH_HandleTypeDef *phost)
USBH_MTP_IsReady Select the storage Unit to be used.
USBH_StatusTypeDef USBH_MTP_GetNumStorage(USBH_HandleTypeDef *phost, uint8_t *storage_num)
USBH_MTP_GetNumStorage Select the storage Unit to be used.
uint8_t DeviceVersion[PTP_MAX_STR_SIZE]
uint32_t current_storage_unit
uint32_t OperationsSupported_len
USBH_StatusTypeDef USBH_PTP_GetObjectPropsSupported(USBH_HandleTypeDef *phost, uint16_t ofc, uint32_t *propnum, uint16_t *props)
USBH_PTP_GetObjectPropsSupported Gets object partially.
USBH_StatusTypeDef USBH_FreePipe(USBH_HandleTypeDef *phost, uint8_t idx)
USBH_Free_Pipe Free the USB Pipe.
uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol)
USBH_FindInterface Find the interface index for a specific class.
void(* pUser)(struct _USBH_HandleTypeDef *pHandle, uint8_t id)
USBH_InterfaceDescTypeDef Itf_Desc[USBH_MAX_NUM_INTERFACES]
uint8_t Manufacturer[PTP_MAX_STR_SIZE]
#define PTP_EC_StoreAdded
USBH_CfgDescTypeDef CfgDesc
This file contains all the prototypes for the usbh_mtp.c.
USBH_StatusTypeDef USBH_PTP_GetObject(USBH_HandleTypeDef *phost, uint32_t handle, uint8_t *object)
USBH_PTP_GetObject Gets object.
USBH_StatusTypeDef USBH_MTP_GetObjectPropsSupported(USBH_HandleTypeDef *phost, uint16_t ofc, uint32_t *propnum, uint16_t *props)
USBH_MTP_GetObjectPropsSupported Gets object partially.
USBH_StatusTypeDef USBH_PTP_GetDevicePropDesc(USBH_HandleTypeDef *phost, uint16_t propcode, PTP_DevicePropDescTypdef *devicepropertydesc)
USBH_PTP_GetDevicePropDesc Gets object partially.
USBH_StatusTypeDef USBH_MTP_GetObjectPropList(USBH_HandleTypeDef *phost, uint32_t handle, MTP_PropertiesTypedef *pprops, uint32_t *nrofprops)
USBH_MTP_GetObjectPropList Gets object partially.
USBH_StatusTypeDef USBH_PTP_GetObjectHandles(USBH_HandleTypeDef *phost, uint32_t storage_id, uint32_t objectformatcode, uint32_t associationOH, PTP_ObjectHandlesTypedef *objecthandles)
USBH_PTP_GetObjectHandles Gets device info dataset and fills deviceinfo structure.
uint32_t VendorExtensionID
#define USBH_MAX_NUM_INTERFACES
USBH_StatusTypeDef USBH_PTP_GetNumObjects(USBH_HandleTypeDef *phost, uint32_t storage_id, uint32_t objectformatcode, uint32_t associationOH, uint32_t *numobs)
USBH_PTP_GetNumObjects Gets device info dataset and fills deviceinfo structure.
USBH_StatusTypeDef USBH_PTP_DeleteObject(USBH_HandleTypeDef *phost, uint32_t handle, uint32_t objectformatcode)
USBH_PTP_DeleteObject Delete an object.
MTP_EventHandleTypedef events
USBH_StatusTypeDef USBH_MTP_GetDevicePropDesc(USBH_HandleTypeDef *phost, uint16_t propcode, PTP_DevicePropDescTypdef *devicepropertydesc)
USBH_MTP_GetDevicePropDesc Gets object partially.
PTP_StorageIDsTypedef storids
USBH_StatusTypeDef USBH_MTP_GetObjectPropDesc(USBH_HandleTypeDef *phost, uint16_t opc, uint16_t ofc, PTP_ObjectPropDescTypeDef *opd)
USBH_MTP_GetObjectPropDesc Gets object partially.
#define PTP_EC_CaptureComplete
#define PTP_EC_RequestObjectTransfer
PTP_StorageInfoTypedef storinfo[MTP_MAX_STORAGE_UNITS_NBR]
uint32_t Storage[PTP_MAX_STORAGE_UNITS_NBR]
USBH_StatusTypeDef USBH_LL_SetToggle(USBH_HandleTypeDef *phost, uint8_t, uint8_t)
USBH_LL_SetToggle Set toggle for a pipe.
MTP_EventsStateTypeDef state
USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef *phost, uint8_t)
USBH_LL_GetURBState Get a URB state from the low level driver.
USBH_StatusTypeDef USBH_MTP_DeleteObject(USBH_HandleTypeDef *phost, uint32_t handle, uint32_t objectformatcode)
USBH_MTP_DeleteObject Delete an object.
USBH_ClassTypeDef MTP_Class
uint8_t SerialNumber[PTP_MAX_STR_SIZE]
PTP_DeviceInfoTypedef devinfo
USBH_StatusTypeDef USBH_MTP_GetObject(USBH_HandleTypeDef *phost, uint32_t handle, uint8_t *object)
USBH_MTP_GetObject Gets object.
USBH_StatusTypeDef USBH_MTP_SelectStorage(USBH_HandleTypeDef *phost, uint8_t storage_idx)
USBH_MTP_SelectStorage Select the storage Unit to be used.
uint32_t CurrentStorageId
USBH_StatusTypeDef USBH_MTP_GetObjectHandles(USBH_HandleTypeDef *phost, uint32_t storage_idx, uint32_t objectformatcode, uint32_t associationOH, PTP_ObjectHandlesTypedef *objecthandles)
USBH_MTP_GetStorageInfo Get the storage Unit info.
PTP_EventContainerTypedef container
USBH_StatusTypeDef USBH_PTP_GetObjectInfo(USBH_HandleTypeDef *phost, uint32_t handle, PTP_ObjectInfoTypedef *objectinfo)
USBH_PTP_GetObjectInfo Gets objert info.
USBH_StatusTypeDef USBH_PTP_SendObject(USBH_HandleTypeDef *phost, uint32_t handle, uint8_t *object, uint32_t size)
USBH_PTP_SendObject Send an object.
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
USBH_StatusTypeDef USBH_MTP_SendObject(USBH_HandleTypeDef *phost, uint32_t handle, uint8_t *object, uint32_t size)
USBH_MTP_SendObject Send an object.
USBH_StatusTypeDef USBH_MTP_GetNumObjects(USBH_HandleTypeDef *phost, uint32_t storage_idx, uint32_t objectformatcode, uint32_t associationOH, uint32_t *numobs)
USBH_MTP_GetStorageInfo Get the storage Unit info.
USBH_StatusTypeDef USBH_PTP_GetStorageIds(USBH_HandleTypeDef *phost, PTP_StorageIDsTypedef *storage_ids)
USBH_PTP_GetStorageIds Gets device info dataset and fills deviceinfo structure.
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
USBH_StatusTypeDef USBH_MTP_GetStorageInfo(USBH_HandleTypeDef *phost, uint8_t storage_idx, MTP_StorageInfoTypedef *info)
USBH_MTP_GetStorageInfo Get the storage Unit info.
USBH_ClassTypeDef * pActiveClass
#define PTP_EC_ObjectRemoved
USBH_StatusTypeDef USBH_PTP_Init(USBH_HandleTypeDef *phost)
USBH_PTP_Init The function Initializes the BOT protocol.
__weak void USBH_MTP_EventsCallback(USBH_HandleTypeDef *phost, uint32_t event, uint32_t param)
The function informs that host has received an event.
USBH_StatusTypeDef USBH_MTP_GetObjectInfo(USBH_HandleTypeDef *phost, uint32_t handle, PTP_ObjectInfoTypedef *objectinfo)
USBH_PTP_GetObjectInfo Gets objert info.
uint16_t NotificationEpSize
USBH_StatusTypeDef USBH_PTP_GetDeviceInfo(USBH_HandleTypeDef *phost, PTP_DeviceInfoTypedef *dev_info)
USBH_PTP_GetDeviceInfo Gets device info dataset and fills deviceinfo structure.
uint8_t StorageDescription[PTP_MAX_STR_SIZE]
#define PTP_EC_ObjectInfoChanged
__IO uint8_t is_connected
USBH_StatusTypeDef USBH_PTP_OpenSession(USBH_HandleTypeDef *phost, uint32_t session)
USBH_PTP_OpenSession Open a new session.
USBH_StatusTypeDef USBH_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe_num)
USBH_ClosePipe Close a pipe.
#define PTP_EC_DeviceInfoChanged