Debian Codegraph @

ports/stm32/usbhost/Class/MTP/Inc/usbh_mtp.h

raw
1 /**
2 ******************************************************************************
3 * @file usbh_mtp.h
4 * @author MCD Application Team
5 * @version V3.0.0
6 * @date 18-February-2014
7 * @brief This file contains all the prototypes for the usbh_mtp.c
8 ******************************************************************************
9 * @attention
10 *
11 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
12 *
13 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 * You may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at:
16 *
17 * http://www.st.com/software_license_agreement_liberty_v2
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 ******************************************************************************
26 */
27
28 /* Define to prevent recursive ----------------------------------------------*/
29 #ifndef __USBH_MTP_CORE_H
30 #define __USBH_MTP_CORE_H
31
32 /* Includes ------------------------------------------------------------------*/
33 #include "usbh_mtp_ptp.h"
34 #include "usbh_core.h"
35
36
37 /** @addtogroup USBH_LIB
38 * @{
39 */
40
41 /** @addtogroup USBH_CLASS
42 * @{
43 */
44
45 /** @addtogroup USBH_MTP_CLASS
46 * @{
47 */
48
49 /** @defgroup USBH_MTP_CORE
50 * @brief This file is the Header file for USBH_MTP_CORE.c
51 * @{
52 */
53
54
55
56
57 /*Communication Class codes*/
58 #define USB_MTP_CLASS 0x06 /* Still Image Class)*/
59 #define MTP_MAX_STORAGE_UNITS_NBR PTP_MAX_STORAGE_UNITS_NBR
60
61 /**
62 * @}
63 */
64
65 /** @defgroup USBH_MTP_CORE_Exported_Types
66 * @{
67 */
68 typedef enum
69 {
70 MTP_IDLE = 0,
71 MTP_GETDEVICEINFO ,
72 MTP_OPENSESSION ,
73 MTP_CLOSESESSION ,
74 MTP_GETSTORAGEIDS ,
75 MTP_GETSTORAGEINFO ,
76 }
77 MTP_StateTypeDef;
78
79
80 typedef enum
81 {
82 MTP_EVENTS_INIT = 0,
83 MTP_EVENTS_GETDATA ,
84 }
85 MTP_EventsStateTypeDef;
86
87
88 typedef struct
89 {
90 MTP_EventsStateTypeDef state;
91 uint32_t timer;
92 uint16_t poll;
93 PTP_EventContainerTypedef container;
94 }
95 MTP_EventHandleTypedef;
96
97 typedef struct
98 {
99
100 uint32_t CurrentStorageId;
101 uint32_t ObjectFormatCode;
102 uint32_t CurrentObjectHandler;
103 uint8_t ObjectHandlerNbr;
104 uint32_t Objdepth;
105 }
106 MTP_ParamsTypedef;
107
108
109 typedef struct
110 {
111 PTP_DeviceInfoTypedef devinfo;
112 PTP_StorageIDsTypedef storids;
113 PTP_StorageInfoTypedef storinfo[MTP_MAX_STORAGE_UNITS_NBR];
114 PTP_ObjectHandlesTypedef Handles;
115 }
116 MTP_InfoTypedef;
117
118 /* Structure for MTP process */
119 typedef struct _MTP_Process
120 {
121 MTP_InfoTypedef info;
122 MTP_ParamsTypedef params;
123
124 uint8_t DataInPipe;
125 uint8_t DataOutPipe;
126 uint8_t NotificationPipe;
127
128 uint8_t DataOutEp;
129 uint8_t DataInEp;
130 uint8_t NotificationEp;
131
132 uint16_t DataOutEpSize;
133 uint16_t DataInEpSize;
134 uint16_t NotificationEpSize;
135 MTP_StateTypeDef state;
136 MTP_EventHandleTypedef events;
137 PTP_HandleTypeDef ptp;
138 uint32_t current_storage_unit;
139 uint32_t is_ready;
140 }
141 MTP_HandleTypeDef;
142
143 #define MTP_StorageInfoTypedef PTP_StorageInfoTypedef
144 #define MTP_ObjectHandlesTypedef PTP_ObjectHandlesTypedef
145 #define MTP_ObjectInfoTypedef PTP_ObjectInfoTypedef
146 /**
147 * @}
148 */
149
150 /** @defgroup USBH_MTP_CORE_Exported_Defines
151 * @{
152 */
153
154 /**
155 * @}
156 */
157
158 /** @defgroup USBH_MTP_CORE_Exported_Macros
159 * @{
160 */
161 /**
162 * @}
163 */
164
165 /** @defgroup USBH_MTP_CORE_Exported_Variables
166 * @{
167 */
168 extern USBH_ClassTypeDef MTP_Class;
169 #define USBH_MTP_CLASS &MTP_Class
170
171 /**
172 * @}
173 */
174
175 /** @defgroup USBH_MTP_CORE_Exported_FunctionsPrototype
176 * @{
177 */
178 uint8_t USBH_MTP_IsReady (USBH_HandleTypeDef *phost);
179 USBH_StatusTypeDef USBH_MTP_SelectStorage (USBH_HandleTypeDef *phost, uint8_t storage_idx);
180 USBH_StatusTypeDef USBH_MTP_GetNumStorage (USBH_HandleTypeDef *phost, uint8_t *storage_num);
181 USBH_StatusTypeDef USBH_MTP_GetNumObjects (USBH_HandleTypeDef *phost,
182 uint32_t storage_id,
183 uint32_t objectformatcode,
184 uint32_t associationOH,
185 uint32_t* numobs);
186 USBH_StatusTypeDef USBH_MTP_GetStorageInfo (USBH_HandleTypeDef *phost,
187 uint8_t storage_idx,
188 MTP_StorageInfoTypedef *info);
189
190 USBH_StatusTypeDef USBH_MTP_GetObjectHandles (USBH_HandleTypeDef *phost,
191 uint32_t storage_id,
192 uint32_t objectformatcode,
193 uint32_t associationOH,
194 PTP_ObjectHandlesTypedef* objecthandles);
195
196 USBH_StatusTypeDef USBH_MTP_GetObjectInfo (USBH_HandleTypeDef *phost,
197 uint32_t handle,
198 PTP_ObjectInfoTypedef* objectinfo);
199
200 USBH_StatusTypeDef USBH_MTP_DeleteObject (USBH_HandleTypeDef *phost,
201 uint32_t handle,
202 uint32_t objectformatcode);
203
204 USBH_StatusTypeDef USBH_MTP_GetObject (USBH_HandleTypeDef *phost,
205 uint32_t handle,
206 uint8_t *object);
207
208 USBH_StatusTypeDef USBH_MTP_GetPartialObject(USBH_HandleTypeDef *phost,
209 uint32_t handle,
210 uint32_t offset,
211 uint32_t maxbytes,
212 uint8_t *object,
213 uint32_t *len);
214
215 USBH_StatusTypeDef USBH_MTP_GetObjectPropsSupported (USBH_HandleTypeDef *phost,
216 uint16_t ofc,
217 uint32_t *propnum,
218 uint16_t *props);
219
220 USBH_StatusTypeDef USBH_MTP_GetObjectPropDesc (USBH_HandleTypeDef *phost,
221 uint16_t opc,
222 uint16_t ofc,
223 PTP_ObjectPropDescTypeDef *opd);
224
225 USBH_StatusTypeDef USBH_MTP_GetObjectPropList (USBH_HandleTypeDef *phost,
226 uint32_t handle,
227 MTP_PropertiesTypedef *pprops,
228 uint32_t *nrofprops);
229
230 USBH_StatusTypeDef USBH_MTP_SendObject (USBH_HandleTypeDef *phost,
231 uint32_t handle,
232 uint8_t *object,
233 uint32_t size);
234
235 USBH_StatusTypeDef USBH_MTP_GetDevicePropDesc (USBH_HandleTypeDef *phost,
236 uint16_t propcode,
237 PTP_DevicePropDescTypdef* devicepropertydesc);
238
239 void USBH_MTP_EventsCallback(USBH_HandleTypeDef *phost, uint32_t event, uint32_t param);
240 /**
241 * @}
242 */
243
244
245 #endif /* __USBH_MTP_CORE_H */
246
247 /**
248 * @}
249 */
250
251 /**
252 * @}
253 */
254
255 /**
256 * @}
257 */
258
259 /**
260 * @}
261 */
262 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
263