| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
StillImageClassHost.h
Go to the documentation of this file.
1 /*
2 * @brief Host mode driver for the library USB Still Image Class driver
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * Copyright(C) Dean Camera, 2011, 2012
7 * All rights reserved.
8 *
9 * @par
10 * Software that is described herein is for illustrative purposes only
11 * which provides customers with programming information regarding the
12 * LPC products. This software is supplied "AS IS" without any warranties of
13 * any kind, and NXP Semiconductors and its licensor disclaim any and
14 * all warranties, express or implied, including all implied warranties of
15 * merchantability, fitness for a particular purpose and non-infringement of
16 * intellectual property rights. NXP Semiconductors assumes no responsibility
17 * or liability for the use of the software, conveys no license or rights under any
18 * patent, copyright, mask work right, or any other intellectual property rights in
19 * or to any products. NXP Semiconductors reserves the right to make changes
20 * in the software without notification. NXP Semiconductors also makes no
21 * representation or warranty that such application will be suitable for the
22 * specified use without further testing or modification.
23 *
24 * @par
25 * Permission to use, copy, modify, and distribute this software and its
26 * documentation is hereby granted, under NXP Semiconductors' and its
27 * licensor's relevant copyrights in the software, without fee, provided that it
28 * is used in conjunction with NXP Semiconductors microcontrollers. This
29 * copyright, permission, and disclaimer notice must appear in all copies of
30 * this code.
31 */
32
46 #ifndef __SI_CLASS_HOST_H__
47 #define __SI_CLASS_HOST_H__
48
49 /* Includes: */
50 #include "../../USB.h"
51 #include "../Common/StillImageClassCommon.h"
52
53 /* Enable C linkage for C++ Compilers: */
54 #if defined(__cplusplus)
55 extern "C" {
56 #endif
57
58 /* Preprocessor Checks: */
59 #if !defined(__INCLUDE_FROM_SI_DRIVER)
60 #error Do not include this file directly. Include LPCUSBlib/Drivers/USB.h instead.
61 #endif
62
63 /* Public Interface - May be used in end-application: */
64 /* Macros: */
66 #define SI_ERROR_LOGICAL_CMD_FAILED 0x80
67
68 /* Type Defines: */
75 typedef struct
76 {
77 const struct
78 {
79 uint8_t DataINPipeNumber;
80 bool DataINPipeDoubleBank;
82 uint8_t DataOUTPipeNumber;
83 bool DataOUTPipeDoubleBank;
85 uint8_t EventsPipeNumber;
86 bool EventsPipeDoubleBank;
87 uint8_t PortNumber;
89 } Config;
92 struct
93 {
94 bool IsActive;
98 uint8_t InterfaceNumber;
100 uint16_t DataINPipeSize;
101 uint16_t DataOUTPipeSize;
102 uint16_t EventsPipeSize;
104 bool IsSessionOpen;
105 uint32_t TransactionID;
106 } State;
110 } USB_ClassInfo_SI_Host_t;
111
112 /* Enums: */
114 enum SI_Host_EnumerationFailure_ErrorCodes_t
115 {
116 SI_ENUMERROR_NoError = 0,
117 SI_ENUMERROR_InvalidConfigDescriptor = 1,
118 SI_ENUMERROR_NoCompatibleInterfaceFound = 2,
121 SI_ENUMERROR_PipeConfigurationFailed = 3,
122 };
123
124 /* Function Prototypes: */
137 uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
138 uint16_t ConfigDescriptorSize,
139 void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
140
152 uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
153
165 uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
166
178 uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
179 PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
180 ATTR_NON_NULL_PTR_ARG(2);
181
193 uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
194 PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
195 ATTR_NON_NULL_PTR_ARG(2);
196
210 uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
211 const uint16_t Operation,
212 const uint8_t TotalParams,
213 uint32_t* const Params) ATTR_NON_NULL_PTR_ARG(1);
214
226 uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
227
237 bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
238
250 uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
251 PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
252 ATTR_NON_NULL_PTR_ARG(2);
253
266 uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
267 void* Buffer,
268 const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
269
282 uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
283 void* Buffer,
284 const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
285
286 /* Inline Functions: */
294 static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
295 static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
296 {
297 (void)SIInterfaceInfo;
298 }
299
300 /* Private Interface - For use in library only: */
301 #if !defined(__DOXYGEN__)
302 /* Macros: */
303 #define SI_COMMAND_DATA_TIMEOUT_MS 10000
304
305 /* Function Prototypes: */
306 #if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C)
307 static uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor)
308 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
309 static uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor)
310 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
311 #endif
312 #endif
313
314 /* Disable C linkage for C++ Compilers: */
315 #if defined(__cplusplus)
316 }
317 #endif
318
319 #endif
320