Add new Incomplete device subdirectory for work-in-progress demos. Add incomplete...
[pub/lufa.git] / Demos / Device / Incomplete / Sideshow / SideshowCommon.h
diff --git a/Demos/Device/Incomplete/Sideshow/SideshowCommon.h b/Demos/Device/Incomplete/Sideshow/SideshowCommon.h
new file mode 100644 (file)
index 0000000..cea81ce
--- /dev/null
@@ -0,0 +1,101 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2009.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\r
+  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, and distribute this software\r
+  and its documentation for any purpose and without fee is hereby\r
+  granted, provided that the above copyright notice appear in all\r
+  copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting\r
+  documentation, and that the name of the author not be used in\r
+  advertising or publicity pertaining to distribution of the\r
+  software without specific, written prior permission.\r
+\r
+  The author disclaim all warranties with regard to this\r
+  software, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+#ifndef _SIDESHOW_COMMON_H_\r
+#define _SIDESHOW_COMMON_H_\r
+\r
+       /* Includes: */\r
+               #include <avr/io.h>\r
+               #include <string.h>     \r
+       \r
+               #include <LUFA/Drivers/USB/USB.h>\r
+\r
+       /* Macros: */\r
+               #define ARRAY_ELEMENTS(x)                 (sizeof(x) / sizeof(x[0]))\r
+               \r
+               #define UNICODE_STRING_t(x)               struct                          \\r
+                                                         {                               \\r
+                                                             uint16_t LengthInBytes;     \\r
+                                                             int      UnicodeString[x];  \\r
+                                                         }\r
+\r
+               // {A33F248B-882F-4531-82C2-ED3B90C5C520}\r
+               #define STANDARD_PROTOCOL_GUID            {0xA33F248B, 0x4531882F, 0x3BEDC282, 0x20C5C590}\r
+               // {A9A5353F-2D4B-47CE-93EE-759F3A7DDA4F}\r
+               #define SIMPLE_CONTENT_FORMAT_GUID        {0xA9A5353F, 0x47CE2D4B, 0x9F75EE93, 0x4FDA7D3A}\r
+               // {8ABC88A8-857B-4ad7-A35A-B5942F492B99}\r
+               #define SIDESHOW_PROPERTY_GUID            {0x8ABC88A8, 0x4AD7857B, 0x94B55AA3, 0x992B492F}\r
+               // {26D4979A-E643-4626-9E2B-736DC0C92FDC}\r
+               #define DEVICE_PROPERTY_GUID              {0x26D4979A, 0x4626E643, 0x6D732B9E, 0xDC2FC9C0}\r
+\r
+               #define SECURITY_INTERACTIVE_RID_SID      L"S-1-5-4"\r
+\r
+               #define MAX_APPLICATIONS                  4\r
+               #define MAX_CONTENTBUFFER_PER_APP         1024\r
+\r
+       /* Type Defines: */\r
+               typedef struct\r
+               {\r
+                       uint32_t         Chunks[4];\r
+               } GUID_t;\r
+               \r
+               typedef struct\r
+               {\r
+                       uint16_t         LengthInBytes;\r
+                       int              UnicodeString[];\r
+               } Unicode_String_t;     \r
+\r
+               typedef union\r
+               {\r
+                       uint32_t TypeLong;\r
+\r
+                       struct\r
+                       {\r
+                               uint8_t TypeBytes[3];\r
+\r
+                               int ErrorCode     : 6;\r
+                               int NAK           : 1;\r
+                               int Response      : 1;                          \r
+                       };\r
+               } SideShowPacketType_t;\r
+       \r
+               typedef struct\r
+               {\r
+                       uint32_t               Length;\r
+                       SideShowPacketType_t   Type;\r
+                       uint16_t               Number;\r
+               } SideShow_PacketHeader_t;\r
+\r
+       /* Function Prototypes: */\r
+               uint16_t SideShow_Read_Unicode_String(void* UnicodeString, uint16_t MaxBytes);\r
+               void     SideShow_Write_Unicode_String(void* UnicodeString);\r
+               void     SideShow_Discard_Byte_Stream(void);\r
+\r
+#endif
\ No newline at end of file