Nirvana Jay / Mbed 2 deprecated F7DISCO_Demo

Dependencies:   BSP_DISCO_F746NG_patch mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usbh_mtp.h Source File

usbh_mtp.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    usbh_mtp.h
00004   * @author  MCD Application Team
00005   * @version V3.2.2
00006   * @date    07-July-2015
00007   * @brief   This file contains all the prototypes for the usbh_mtp.c
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
00012   *
00013   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00014   * You may not use this file except in compliance with the License.
00015   * You may obtain a copy of the License at:
00016   *
00017   *        http://www.st.com/software_license_agreement_liberty_v2
00018   *
00019   * Unless required by applicable law or agreed to in writing, software 
00020   * distributed under the License is distributed on an "AS IS" BASIS, 
00021   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00022   * See the License for the specific language governing permissions and
00023   * limitations under the License.
00024   *
00025   ******************************************************************************
00026   */ 
00027 
00028 /* Define to prevent recursive  ----------------------------------------------*/
00029 #ifndef __USBH_MTP_H
00030 #define __USBH_MTP_H
00031 
00032 #ifdef __cplusplus
00033  extern "C" {
00034 #endif
00035 
00036 /* Includes ------------------------------------------------------------------*/
00037 #include "usbh_mtp_ptp.h"
00038 #include "usbh_core.h"
00039 
00040 
00041 /** @addtogroup USBH_LIB
00042 * @{
00043 */
00044 
00045 /** @addtogroup USBH_CLASS
00046 * @{
00047 */
00048 
00049 /** @addtogroup USBH_MTP_CLASS
00050 * @{
00051 */
00052 
00053 /** @defgroup USBH_MTP_CORE
00054 * @brief This file is the Header file for usbh_mtp.c
00055 * @{
00056 */ 
00057 
00058 
00059 
00060 
00061 /*Communication Class codes*/
00062 #define USB_MTP_CLASS                                           0x06 /* Still Image Class)*/
00063 #define MTP_MAX_STORAGE_UNITS_NBR                               PTP_MAX_STORAGE_UNITS_NBR
00064 
00065 /**
00066   * @}
00067   */ 
00068 
00069 /** @defgroup USBH_MTP_CORE_Exported_Types
00070 * @{
00071 */ 
00072 typedef enum
00073 {   
00074   MTP_IDLE = 0,
00075   MTP_GETDEVICEINFO ,           
00076   MTP_OPENSESSION ,             
00077   MTP_CLOSESESSION ,            
00078   MTP_GETSTORAGEIDS ,           
00079   MTP_GETSTORAGEINFO ,          
00080 }
00081 MTP_StateTypeDef;
00082 
00083 
00084 typedef enum
00085 {   
00086   MTP_EVENTS_INIT = 0,
00087   MTP_EVENTS_GETDATA ,                   
00088 }
00089 MTP_EventsStateTypeDef;
00090 
00091 
00092 typedef struct
00093 {
00094    MTP_EventsStateTypeDef   state;
00095    uint32_t timer;
00096    uint16_t poll;
00097    PTP_EventContainerTypedef  container;       
00098 } 
00099 MTP_EventHandleTypedef;
00100 
00101 typedef struct
00102 {
00103     
00104   uint32_t        CurrentStorageId;
00105   uint32_t        ObjectFormatCode;
00106   uint32_t        CurrentObjectHandler;
00107   uint8_t         ObjectHandlerNbr;
00108   uint32_t        Objdepth;
00109 } 
00110 MTP_ParamsTypedef;
00111 
00112 
00113 typedef struct
00114 {
00115   PTP_DeviceInfoTypedef     devinfo;
00116   PTP_StorageIDsTypedef     storids;
00117   PTP_StorageInfoTypedef    storinfo[MTP_MAX_STORAGE_UNITS_NBR]; 
00118   PTP_ObjectHandlesTypedef  Handles;
00119 } 
00120 MTP_InfoTypedef;
00121 
00122 /* Structure for MTP process */
00123 typedef struct _MTP_Process
00124 {
00125   MTP_InfoTypedef       info;
00126   MTP_ParamsTypedef     params;
00127   
00128   uint8_t               DataInPipe; 
00129   uint8_t               DataOutPipe;
00130   uint8_t               NotificationPipe;  
00131   
00132   uint8_t               DataOutEp;
00133   uint8_t               DataInEp;
00134   uint8_t               NotificationEp;  
00135 
00136   uint16_t              DataOutEpSize;
00137   uint16_t              DataInEpSize;
00138   uint16_t              NotificationEpSize; 
00139   MTP_StateTypeDef      state;
00140   MTP_EventHandleTypedef events;
00141   PTP_HandleTypeDef     ptp;
00142   uint32_t              current_storage_unit;
00143   uint32_t              is_ready;  
00144 }
00145 MTP_HandleTypeDef;
00146 
00147 #define MTP_StorageInfoTypedef      PTP_StorageInfoTypedef
00148 #define MTP_ObjectHandlesTypedef    PTP_ObjectHandlesTypedef
00149 #define MTP_ObjectInfoTypedef       PTP_ObjectInfoTypedef
00150 /**
00151 * @}
00152 */ 
00153 
00154 /** @defgroup USBH_MTP_CORE_Exported_Defines
00155 * @{
00156 */ 
00157 
00158 /**
00159 * @}
00160 */ 
00161 
00162 /** @defgroup USBH_MTP_CORE_Exported_Macros
00163 * @{
00164 */ 
00165 /**
00166 * @}
00167 */ 
00168 
00169 /** @defgroup USBH_MTP_CORE_Exported_Variables
00170 * @{
00171 */ 
00172 extern USBH_ClassTypeDef  MTP_Class;
00173 #define USBH_MTP_CLASS    &MTP_Class
00174 
00175 /**
00176 * @}
00177 */ 
00178 
00179 /** @defgroup USBH_MTP_CORE_Exported_FunctionsPrototype
00180 * @{
00181 */ 
00182 uint8_t            USBH_MTP_IsReady (USBH_HandleTypeDef *phost);
00183 USBH_StatusTypeDef USBH_MTP_SelectStorage (USBH_HandleTypeDef *phost, uint8_t storage_idx);
00184 USBH_StatusTypeDef USBH_MTP_GetNumStorage (USBH_HandleTypeDef *phost, uint8_t *storage_num);
00185 USBH_StatusTypeDef USBH_MTP_GetNumObjects (USBH_HandleTypeDef *phost, 
00186                                            uint32_t storage_id, 
00187                                            uint32_t objectformatcode, 
00188                                            uint32_t associationOH,
00189                                            uint32_t* numobs);
00190 USBH_StatusTypeDef USBH_MTP_GetStorageInfo (USBH_HandleTypeDef *phost, 
00191                                             uint8_t storage_idx, 
00192                                             MTP_StorageInfoTypedef *info);
00193 
00194 USBH_StatusTypeDef USBH_MTP_GetObjectHandles (USBH_HandleTypeDef *phost, 
00195                                            uint32_t storage_id, 
00196                                            uint32_t objectformatcode, 
00197                                            uint32_t associationOH,
00198                                            PTP_ObjectHandlesTypedef* objecthandles);
00199 
00200 USBH_StatusTypeDef USBH_MTP_GetObjectInfo (USBH_HandleTypeDef *phost, 
00201                                            uint32_t handle, 
00202                                            PTP_ObjectInfoTypedef* objectinfo);
00203 
00204 USBH_StatusTypeDef USBH_MTP_DeleteObject (USBH_HandleTypeDef *phost,
00205                                           uint32_t handle,
00206                                           uint32_t objectformatcode);
00207 
00208 USBH_StatusTypeDef USBH_MTP_GetObject (USBH_HandleTypeDef *phost, 
00209                                            uint32_t handle, 
00210                                            uint8_t *object);
00211 
00212 USBH_StatusTypeDef USBH_MTP_GetPartialObject(USBH_HandleTypeDef *phost, 
00213                                            uint32_t handle, 
00214                                            uint32_t offset,
00215                                            uint32_t maxbytes, 
00216                                            uint8_t *object,
00217                                            uint32_t *len);
00218 
00219 USBH_StatusTypeDef USBH_MTP_GetObjectPropsSupported (USBH_HandleTypeDef *phost,
00220                                                      uint16_t ofc,
00221                                                      uint32_t *propnum, 
00222                                                      uint16_t *props);
00223 
00224 USBH_StatusTypeDef USBH_MTP_GetObjectPropDesc (USBH_HandleTypeDef *phost,
00225                                                 uint16_t opc, 
00226                                                 uint16_t ofc, 
00227                                                 PTP_ObjectPropDescTypeDef *opd);
00228 
00229 USBH_StatusTypeDef USBH_MTP_GetObjectPropList (USBH_HandleTypeDef *phost,
00230                                                 uint32_t handle, 
00231                                                 MTP_PropertiesTypedef *pprops, 
00232                                                 uint32_t *nrofprops);
00233 
00234 USBH_StatusTypeDef USBH_MTP_SendObject (USBH_HandleTypeDef *phost, 
00235                                            uint32_t handle, 
00236                                            uint8_t *object,
00237                                            uint32_t size);
00238 
00239 USBH_StatusTypeDef USBH_MTP_GetDevicePropDesc (USBH_HandleTypeDef *phost,
00240                                                 uint16_t propcode, 
00241                                     PTP_DevicePropDescTypdef* devicepropertydesc);
00242 
00243 void USBH_MTP_EventsCallback(USBH_HandleTypeDef *phost, uint32_t event, uint32_t param);
00244 /**
00245 * @}
00246 */ 
00247 
00248 #ifdef __cplusplus
00249 }
00250 #endif
00251 
00252 #endif /* __USBH_MTP_H */
00253 
00254 /**
00255 * @}
00256 */ 
00257 
00258 /**
00259 * @}
00260 */ 
00261 
00262 /**
00263 * @}
00264 */ 
00265 
00266 /**
00267 * @}
00268 */ 
00269 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
00270