Oops - with new changes to the way the device Configuration Descriptor is retrieved...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Common / StillImage.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \ingroup Group_USBClassSI
32 * @defgroup Group_USBClassSICommon Common Class Definitions
33 *
34 * \section Module Description
35 * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
36 * Still Image Class.
37 *
38 * @{
39 */
40
41 #ifndef _SI_CLASS_COMMON_H_
42 #define _SI_CLASS_COMMON_H_
43
44 /* Includes: */
45 #include "../../USB.h"
46
47 #include <string.h>
48
49 /* Enable C linkage for C++ Compilers: */
50 #if defined(__cplusplus)
51 extern "C" {
52 #endif
53
54 /* Macros: */
55 /** Length in bytes of a given Unicode string's character length
56 *
57 * \param[in] chars Total number of Unicode characters in the string
58 */
59 #define UNICODE_STRING_LENGTH(chars) (chars << 1)
60
61 /** Timeout period between the issuing of a command to a device, and the reception of the first packet */
62 #define COMMAND_DATA_TIMEOUT_MS 5000
63
64 /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
65 * a command container.
66 *
67 * \param[in] params Number of parameters which are to be sent in the Param field of the container
68 */
69 #define PIMA_COMMAND_SIZE(params) ((sizeof(PIMA_SendBlock) - sizeof(PIMA_SendBlock.Params)) + \
70 (params * sizeof(PIMA_SendBlock.Params[0])))
71
72 /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
73 * a data container.
74 *
75 * \param[in] datalen Length in bytes of the data in the container
76 */
77 #define PIMA_DATA_SIZE(datalen) ((sizeof(PIMA_SendBlock) - sizeof(PIMA_SendBlock.Params)) + datalen)
78
79 /* Type defines: */
80 /** Type define for a PIMA container, use to send commands and receive responses to and from an
81 * attached Still Image device.
82 */
83 typedef struct
84 {
85 uint32_t DataLength; /**< Length of the container and data, in bytes */
86 uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */
87 uint16_t Code; /**< Command, event or response code of the container */
88 uint32_t TransactionID; /**< Unique container ID to link blocks together */
89 uint32_t Params[4]; /**< Block parameters to be issued along with the block code (command blocks only) */
90 } SI_PIMA_Container_t;
91
92 /* Enums: */
93 /** Enum for the possible PIMA contains types. */
94 enum SI_PIMA_Container_Types_t
95 {
96 CType_Undefined = 0, /**< Undefined container type */
97 CType_CommandBlock = 1, /**< Command Block container type */
98 CType_DataBlock = 2, /**< Data Block container type */
99 CType_ResponseBlock = 3, /**< Response container type */
100 CType_EventBlock = 4, /**< Event Block container type */
101 };
102
103 /* Enums: */
104
105
106 /* Type Defines: */
107
108
109 /* Disable C linkage for C++ Compilers: */
110 #if defined(__cplusplus)
111 }
112 #endif
113
114 #endif
115
116 /** @} */