]> git.donarmstrong.com Git - qmk_firmware.git/blob - protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h
Change TOP_DIR to TMK_DIR in makefiles
[qmk_firmware.git] / protocol / lufa / LUFA-120730 / LUFA / Drivers / USB / Class / Common / StillImageClassCommon.h
1 /*\r
2              LUFA Library\r
3      Copyright (C) Dean Camera, 2012.\r
4 \r
5   dean [at] fourwalledcubicle [dot] com\r
6            www.lufa-lib.org\r
7 */\r
8 \r
9 /*\r
10   Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
11 \r
12   Permission to use, copy, modify, distribute, and sell this\r
13   software and its documentation for any purpose is hereby granted\r
14   without fee, provided that the above copyright notice appear in\r
15   all copies and that both that the copyright notice and this\r
16   permission notice and warranty disclaimer appear in supporting\r
17   documentation, and that the name of the author not be used in\r
18   advertising or publicity pertaining to distribution of the\r
19   software without specific, written prior permission.\r
20 \r
21   The author disclaim all warranties with regard to this\r
22   software, including all implied warranties of merchantability\r
23   and fitness.  In no event shall the author be liable for any\r
24   special, indirect or consequential damages or any damages\r
25   whatsoever resulting from loss of use, data or profits, whether\r
26   in an action of contract, negligence or other tortious action,\r
27   arising out of or in connection with the use or performance of\r
28   this software.\r
29 */\r
30 \r
31 /** \file\r
32  *  \brief Common definitions and declarations for the library USB Still Image Class driver.\r
33  *\r
34  *  Common definitions and declarations for the library USB Still Image Class driver.\r
35  *\r
36  *  \note This file should not be included directly. It is automatically included as needed by the USB module driver\r
37  *        dispatch header located in LUFA/Drivers/USB.h.\r
38  */\r
39 \r
40 /** \ingroup Group_USBClassSI\r
41  *  \defgroup Group_USBClassSICommon  Common Class Definitions\r
42  *\r
43  *  \section Sec_ModDescription Module Description\r
44  *  Constants, Types and Enum definitions that are common to both Device and Host modes for the USB\r
45  *  Still Image Class.\r
46  *\r
47  *  @{\r
48  */\r
49 \r
50 #ifndef _SI_CLASS_COMMON_H_\r
51 #define _SI_CLASS_COMMON_H_\r
52 \r
53         /* Includes: */\r
54                 #include "../../Core/StdDescriptors.h"\r
55 \r
56         /* Enable C linkage for C++ Compilers: */\r
57                 #if defined(__cplusplus)\r
58                         extern "C" {\r
59                 #endif\r
60 \r
61         /* Preprocessor Checks: */\r
62                 #if !defined(__INCLUDE_FROM_SI_DRIVER)\r
63                         #error Do not include this file directly. Include LUFA/Drivers/USB.h instead.\r
64                 #endif\r
65 \r
66         /* Macros: */\r
67                 /** Length in bytes of a given Unicode string's character length.\r
68                  *\r
69                  *  \param[in] Chars  Total number of Unicode characters in the string.\r
70                  *\r
71                  *  \return Number of bytes of the given unicode string.\r
72                  */\r
73                 #define UNICODE_STRING_LENGTH(Chars)  ((Chars) << 1)\r
74 \r
75                 /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for\r
76                  *  a command container.\r
77                  *\r
78                  *  \param[in] Params  Number of parameters which are to be sent in the \c Param field of the container.\r
79                  */\r
80                 #define PIMA_COMMAND_SIZE(Params)     ((sizeof(PIMA_Container_t) - 12) + ((Params) * sizeof(uint32_t)))\r
81 \r
82                 /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for\r
83                  *  a data container.\r
84                  *\r
85                  *  \param[in] DataLen  Length in bytes of the data in the container.\r
86                  */\r
87                 #define PIMA_DATA_SIZE(DataLen)       ((sizeof(PIMA_Container_t) - 12) + (DataLen))\r
88 \r
89         /* Enums: */\r
90                 /** Enum for the possible PIMA contains types. */\r
91                 enum PIMA_Container_Types_t\r
92                 {\r
93                         PIMA_CONTAINER_Undefined     = 0, /**< Undefined container type. */\r
94                         PIMA_CONTAINER_CommandBlock  = 1, /**< Command Block container type. */\r
95                         PIMA_CONTAINER_DataBlock     = 2, /**< Data Block container type. */\r
96                         PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */\r
97                         PIMA_CONTAINER_EventBlock    = 4, /**< Event Block container type. */\r
98                 };\r
99 \r
100         /* Enums: */\r
101                 /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the\r
102                  *  Still Image device class.\r
103                  */\r
104                 enum SI_Descriptor_ClassSubclassProtocol_t\r
105                 {\r
106                         SI_CSCP_StillImageClass             = 0x06, /**< Descriptor Class value indicating that the device or interface\r
107                                                                      *   belongs to the Still Image class.\r
108                                                                      */\r
109                         SI_CSCP_StillImageSubclass          = 0x01, /**< Descriptor Subclass value indicating that the device or interface\r
110                                                                      *   belongs to the Still Image subclass.\r
111                                                                      */\r
112                         SI_CSCP_BulkOnlyProtocol            = 0x01, /**< Descriptor Protocol value indicating that the device or interface\r
113                                                                      *   belongs to the Bulk Only Transport protocol of the Still Image class.\r
114                                                                      */\r
115                 };\r
116 \r
117                 /** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */\r
118                 enum PIMA_ResponseCodes_t\r
119                 {\r
120                         PIMA_RESPONSE_OK                    = 1, /**< Response code indicating no error in the issued command. */\r
121                         PIMA_RESPONSE_GeneralError          = 2, /**< Response code indicating a general error while processing the\r
122                                                                      *  issued command.\r
123                                                                      */\r
124                         PIMA_RESPONSE_SessionNotOpen        = 3, /**< Response code indicating that the sent command requires an open\r
125                                                                      *   session before being issued.\r
126                                                                      */\r
127                         PIMA_RESPONSE_InvalidTransaction    = 4, /**< Response code indicating an invalid transaction occurred. */\r
128                         PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported\r
129                                                                      *   by the attached device.\r
130                                                                      */\r
131                         PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's\r
132                                                                      *   parameters are not supported by the device.\r
133                                                                      */\r
134                 };\r
135 \r
136         /* Type Defines: */\r
137                 /** \brief PIMA Still Image Device Command/Response Container.\r
138                  *\r
139                  *  Type define for a PIMA container, use to send commands and receive responses to and from an\r
140                  *  attached Still Image device.\r
141                  *\r
142                  *  \note Regardless of CPU architecture, these values should be stored as little endian.\r
143                  */\r
144                 typedef struct\r
145                 {\r
146                         uint32_t DataLength; /**< Length of the container and data, in bytes. */\r
147                         uint16_t Type; /**< Container type, a value from the \ref PIMA_Container_Types_t enum. */\r
148                         uint16_t Code; /**< Command, event or response code of the container. */\r
149                         uint32_t TransactionID; /**< Unique container ID to link blocks together. */\r
150                         uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only). */\r
151                 } ATTR_PACKED PIMA_Container_t;\r
152 \r
153         /* Disable C linkage for C++ Compilers: */\r
154                 #if defined(__cplusplus)\r
155                         }\r
156                 #endif\r
157 \r
158 #endif\r
159 \r
160 /** @} */\r
161 \r