2 * @brief Common definitions and declarations for the library USB Still Image Class driver
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * Copyright(C) Dean Camera, 2011, 2012
\r
7 * All rights reserved.
\r
10 * Software that is described herein is for illustrative purposes only
\r
11 * which provides customers with programming information regarding the
\r
12 * LPC products. This software is supplied "AS IS" without any warranties of
\r
13 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
14 * all warranties, express or implied, including all implied warranties of
\r
15 * merchantability, fitness for a particular purpose and non-infringement of
\r
16 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
17 * or liability for the use of the software, conveys no license or rights under any
\r
18 * patent, copyright, mask work right, or any other intellectual property rights in
\r
19 * or to any products. NXP Semiconductors reserves the right to make changes
\r
20 * in the software without notification. NXP Semiconductors also makes no
\r
21 * representation or warranty that such application will be suitable for the
\r
22 * specified use without further testing or modification.
\r
25 * Permission to use, copy, modify, and distribute this software and its
\r
26 * documentation is hereby granted, under NXP Semiconductors' and its
\r
27 * licensor's relevant copyrights in the software, without fee, provided that it
\r
28 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
29 * copyright, permission, and disclaimer notice must appear in all copies of
\r
33 /** @ingroup Group_USBClassSI
\r
34 * @defgroup Group_USBClassSICommon Common Class Definitions
\r
36 * @section Sec_ModDescription Module Description
\r
37 * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
\r
38 * Still Image Class.
\r
43 #ifndef _SI_CLASS_COMMON_H_
\r
44 #define _SI_CLASS_COMMON_H_
\r
47 #include "../../Core/StdDescriptors.h"
\r
49 /* Enable C linkage for C++ Compilers: */
\r
50 #if defined(__cplusplus)
\r
54 /* Preprocessor Checks: */
\r
55 #if !defined(__INCLUDE_FROM_SI_DRIVER)
\r
56 #error Do not include this file directly. Include LPCUSBlib/Drivers/USB.h instead.
\r
60 /** Length in bytes of a given Unicode string's character length.
\r
62 * @param Chars Total number of Unicode characters in the string.
\r
64 * @return Number of bytes of the given unicode string.
\r
66 #define UNICODE_STRING_LENGTH(Chars) ((Chars) << 1)
\r
68 /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
\r
69 * a command container.
\r
71 * @param Params Number of parameters which are to be sent in the \c Param field of the container.
\r
73 #define PIMA_COMMAND_SIZE(Params) ((sizeof(PIMA_Container_t) - 12) + ((Params) * sizeof(uint32_t)))
\r
75 /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
\r
78 * @param DataLen Length in bytes of the data in the container.
\r
80 #define PIMA_DATA_SIZE(DataLen) ((sizeof(PIMA_Container_t) - 12) + (DataLen))
\r
83 /** Enum for the possible PIMA contains types. */
\r
84 enum PIMA_Container_Types_t
\r
86 PIMA_CONTAINER_Undefined = 0, /**< Undefined container type. */
\r
87 PIMA_CONTAINER_CommandBlock = 1, /**< Command Block container type. */
\r
88 PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */
\r
89 PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */
\r
90 PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */
\r
94 /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the
\r
95 * Still Image device class.
\r
97 enum SI_Descriptor_ClassSubclassProtocol_t
\r
99 SI_CSCP_StillImageClass = 0x06, /**< Descriptor Class value indicating that the device or interface
\r
100 * belongs to the Still Image class.
\r
102 SI_CSCP_StillImageSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface
\r
103 * belongs to the Still Image subclass.
\r
105 SI_CSCP_BulkOnlyProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface
\r
106 * belongs to the Bulk Only Transport protocol of the Still Image class.
\r
110 /** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */
\r
111 enum PIMA_ResponseCodes_t
\r
113 PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */
\r
114 PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the
\r
117 PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open
\r
118 * session before being issued.
\r
120 PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */
\r
121 PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported
\r
122 * by the attached device.
\r
124 PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's
\r
125 * parameters are not supported by the device.
\r
129 /* Type Defines: */
\r
130 /** @brief PIMA Still Image Device Command/Response Container.
\r
132 * Type define for a PIMA container, use to send commands and receive responses to and from an
\r
133 * attached Still Image device.
\r
135 * @note Regardless of CPU architecture, these values should be stored as little endian.
\r
139 uint32_t DataLength; /**< Length of the container and data, in bytes. */
\r
140 uint16_t Type; /**< Container type, a value from the @ref PIMA_Container_Types_t enum. */
\r
141 uint16_t Code; /**< Command, event or response code of the container. */
\r
142 uint32_t TransactionID; /**< Unique container ID to link blocks together. */
\r
143 uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only). */
\r
144 } ATTR_PACKED PIMA_Container_t;
\r
146 /* Disable C linkage for C++ Compilers: */
\r
147 #if defined(__cplusplus)
\r