Update UC3 platform driver support to use the bitmasks defined in the header files...
[pub/USBasp.git] / Demos / Device / Incomplete / TestAndMeasurement / TestAndMeasurement.h
index 53f65a1..53f32a2 100644 (file)
@@ -1,13 +1,13 @@
 /*\r
              LUFA Library\r
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
+     Copyright (C) Dean Camera, 2011.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
-      www.fourwalledcubicle.com\r
+           www.lufa-lib.org\r
 */\r
 \r
 /*\r
 */\r
 \r
 /*\r
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
 \r
        /* Macros: */\r
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
 \r
        /* Macros: */\r
                /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
-               #define LEDMASK_USB_NOTREADY                   LEDS_LED1\r
+               #define LEDMASK_USB_NOTREADY                  LEDS_LED1\r
 \r
                /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
 \r
                /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
-               #define LEDMASK_USB_ENUMERATING               (LEDS_LED2 | LEDS_LED3)\r
+               #define LEDMASK_USB_ENUMERATING              (LEDS_LED2 | LEDS_LED3)\r
 \r
                /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
 \r
                /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
-               #define LEDMASK_USB_READY                     (LEDS_LED2 | LEDS_LED4)\r
+               #define LEDMASK_USB_READY                    (LEDS_LED2 | LEDS_LED4)\r
 \r
                /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
 \r
                /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
-               #define LEDMASK_USB_ERROR                     (LEDS_LED1 | LEDS_LED3)\r
+               #define LEDMASK_USB_ERROR                    (LEDS_LED1 | LEDS_LED3)\r
                \r
                \r
+               /** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
+               #define LEDMASK_USB_BUSY                      LEDS_LED2\r
+\r
                #define Req_InitiateAbortBulkOut              0x01\r
                #define Req_CheckAbortBulkOutStatus           0x02\r
                #define Req_InitiateAbortBulkIn               0x03\r
                #define Req_InitiateAbortBulkOut              0x01\r
                #define Req_CheckAbortBulkOutStatus           0x02\r
                #define Req_InitiateAbortBulkIn               0x03\r
                #define Req_GetCapabilities                   0x07\r
                #define Req_IndicatorPulse                    0x40\r
                \r
                #define Req_GetCapabilities                   0x07\r
                #define Req_IndicatorPulse                    0x40\r
                \r
-               #define TMC_REQUEST_STATUS_SUCCESS                   0x01\r
-               #define TMC_REQUEST_STATUS_PENDING                   0x02\r
-               #define TMC_REQUEST_STATUS_FAILED                    0x80\r
-               #define TMC_REQUEST_STATUS_TRANSFER_NOT_IN_PROGRESS  0x81\r
-               #define TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS     0x82\r
-               #define TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS         0x83\r
+               #define TMC_STATUS_SUCCESS                    0x01\r
+               #define TMC_STATUS_PENDING                    0x02\r
+               #define TMC_STATUS_FAILED                     0x80\r
+               #define TMC_STATUS_TRANSFER_NOT_IN_PROGRESS   0x81\r
+               #define TMC_STATUS_SPLIT_NOT_IN_PROGRESS      0x82\r
+               #define TMC_STATUS_SPLIT_IN_PROGRESS          0x83\r
+               \r
+               #define TMC_MESSAGEID_DEV_DEP_MSG_OUT         0x01\r
+               #define TMC_MESSAGEID_DEV_DEP_MSG_IN          0x02\r
+               #define TMC_MESSAGEID_DEV_VENDOR_OUT          0x7E\r
+               #define TMC_MESSAGEID_DEV_VENDOR_IN           0x7F\r
 \r
        /* Type Defines */\r
                typedef struct\r
                {\r
                        uint8_t  Status;\r
 \r
        /* Type Defines */\r
                typedef struct\r
                {\r
                        uint8_t  Status;\r
-                       uint8_t  _RESERVED1;\r
+                       uint8_t  Reserved;\r
 \r
                        uint16_t TMCVersion;\r
                        \r
                        struct\r
                        {\r
 \r
                        uint16_t TMCVersion;\r
                        \r
                        struct\r
                        {\r
-                               unsigned char ListenOnly             : 1;\r
-                               unsigned char TalkOnly               : 1;\r
-                               unsigned char PulseIndicateSupported : 1;\r
-                               unsigned char _RESERVED              : 5;\r
+                               unsigned ListenOnly             : 1;\r
+                               unsigned TalkOnly               : 1;\r
+                               unsigned PulseIndicateSupported : 1;\r
+                               unsigned Reserved               : 5;\r
                        } Interface;\r
                        \r
                        struct\r
                        {\r
                        } Interface;\r
                        \r
                        struct\r
                        {\r
-                               unsigned char SupportsAbortINOnMatch : 1;\r
-                               unsigned char _RESERVED              : 7;\r
+                               unsigned SupportsAbortINOnMatch : 1;\r
+                               unsigned Reserved               : 7;\r
                        } Device;\r
                        \r
                        } Device;\r
                        \r
-                       uint8_t _RESERVED2[6];\r
-                       uint8_t _RESERVED3[12];                 \r
+                       uint8_t Reserved2[6];\r
+                       uint8_t Reserved3[12];                  \r
                } TMC_Capabilities_t;\r
                \r
                } TMC_Capabilities_t;\r
                \r
+               typedef struct\r
+               {\r
+                       unsigned LastMessageTransaction     : 1;\r
+                       unsigned Reserved                   : 7;\r
+\r
+                       uint8_t Reserved2[3];\r
+               } TMC_DevOUTMessageHeader_t;\r
+\r
+               typedef struct\r
+               {\r
+                       unsigned TermCharEnabled            : 1;\r
+                       unsigned Reserved                   : 7;\r
+\r
+                       uint8_t TermChar;\r
+                       uint8_t Reserved2[2];\r
+               } TMC_DevINMessageHeader_t;\r
+\r
+               typedef struct\r
+               {\r
+                       uint8_t  MessageID;\r
+                       uint8_t  Tag;\r
+                       uint8_t  InverseTag;\r
+                       uint8_t  Reserved;\r
+                       uint32_t TransferSize;\r
+                       \r
+                       union\r
+                       {\r
+                               TMC_DevOUTMessageHeader_t DeviceOUT;\r
+                               TMC_DevINMessageHeader_t  DeviceIN;\r
+                               uint32_t                  VendorSpecific;\r
+                       } MessageIDSpecific;\r
+               } TMC_MessageHeader_t;\r
+\r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r
                void TMC_Task(void);\r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r
                void TMC_Task(void);\r
+               bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader);\r
+               bool WriteTMCHeader(TMC_MessageHeader_t* const MessageHeader);\r
 \r
                void EVENT_USB_Device_Connect(void);\r
                void EVENT_USB_Device_Disconnect(void);\r
                void EVENT_USB_Device_ConfigurationChanged(void);\r
 \r
                void EVENT_USB_Device_Connect(void);\r
                void EVENT_USB_Device_Disconnect(void);\r
                void EVENT_USB_Device_ConfigurationChanged(void);\r
-               void EVENT_USB_Device_UnhandledControlRequest(void);\r
-\r
-               uint8_t StreamCallback_AbortINOnRequest(void);\r
-               uint8_t StreamCallback_AbortOUTOnRequest(void);\r
+               void EVENT_USB_Device_ControlRequest(void);\r
 \r
 #endif\r
 \r
 #endif\r
+