Added start of the Incomplete TMC demo's command parser code.
{
uint8_t FirstInterfaceNumber;
{
uint8_t FirstInterfaceNumber;
uint8_t CompatibleID[8];
uint8_t SubCompatibleID[8];
uint8_t CompatibleID[8];
uint8_t SubCompatibleID[8];
} USB_OSCompatibleSection_t;
typedef struct
} USB_OSCompatibleSection_t;
typedef struct
uint16_t Index;
uint8_t TotalSections;
uint16_t Index;
uint8_t TotalSections;
USB_OSCompatibleSection_t SideshowCompatID;
} USB_OSCompatibleIDDescriptor_t;
USB_OSCompatibleSection_t SideshowCompatID;
} USB_OSCompatibleIDDescriptor_t;
*/\r
TMC_Capabilities_t Capabilities =\r
{\r
*/\r
TMC_Capabilities_t Capabilities =\r
{\r
- .Status = TMC_REQUEST_STATUS_SUCCESS,\r
+ .Status = TMC_STATUS_SUCCESS,\r
.TMCVersion = VERSION_BCD(1.00),\r
\r
.Interface =\r
.TMCVersion = VERSION_BCD(1.00),\r
\r
.Interface =\r
};\r
\r
/** Current TMC control request that is being processed */\r
};\r
\r
/** Current TMC control request that is being processed */\r
-uint8_t RequestInProgess = 0;\r
+uint8_t RequestInProgess = 0;\r
\r
/** Stream callback abort flag for bulk IN data */\r
\r
/** Stream callback abort flag for bulk IN data */\r
-bool IsTMCBulkINReset = false;\r
+bool IsTMCBulkINReset = false;\r
\r
/** Stream callback abort flag for bulk OUT data */\r
\r
/** Stream callback abort flag for bulk OUT data */\r
-bool IsTMCBulkOUTReset = false;\r
+bool IsTMCBulkOUTReset = false;\r
-/** Last used tag value for bulk IN transfers */\r
-uint8_t NextTransferINTag = 0;\r
-\r
-/** Last used tag value for bulk IN transfers */\r
-uint8_t NextTransferOUTTag = 0;\r
+/** Last used tag value for data transfers */\r
+uint8_t CurrentTransferTag = 0;\r
\r
\r
/** Main program entry point. This routine contains the overall program flow, including initial\r
\r
\r
/** Main program entry point. This routine contains the overall program flow, including initial\r
*/\r
void EVENT_USB_Device_UnhandledControlRequest(void)\r
{\r
*/\r
void EVENT_USB_Device_UnhandledControlRequest(void)\r
{\r
- uint8_t TMCRequestStatus = TMC_REQUEST_STATUS_SUCCESS;\r
+ uint8_t TMCRequestStatus = TMC_STATUS_SUCCESS;\r
\r
/* Process TMC specific control requests */\r
switch (USB_ControlRequest.bRequest)\r
\r
/* Process TMC specific control requests */\r
switch (USB_ControlRequest.bRequest)\r
{\r
Endpoint_ClearSETUP();\r
\r
{\r
Endpoint_ClearSETUP();\r
\r
- /* Check that no split transaction is already in progress and the data OUT transfer tag is valid */\r
+ /* Check that no split transaction is already in progress and the data transfer tag is valid */\r
if (RequestInProgess != 0)\r
{\r
if (RequestInProgess != 0)\r
{\r
- TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS;\r
+ TMCRequestStatus = TMC_STATUS_SPLIT_IN_PROGRESS;\r
- else if (USB_ControlRequest.wValue != NextTransferOUTTag)\r
+ else if (USB_ControlRequest.wValue != CurrentTransferTag)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_TRANSFER_NOT_IN_PROGRESS;\r
+ TMCRequestStatus = TMC_STATUS_TRANSFER_NOT_IN_PROGRESS;\r
\r
/* Check that an ABORT BULK OUT transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateAbortBulkOut)\r
\r
/* Check that an ABORT BULK OUT transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateAbortBulkOut)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS; \r
+ TMCRequestStatus = TMC_STATUS_SPLIT_NOT_IN_PROGRESS; \r
else if (IsTMCBulkOUTReset)\r
else if (IsTMCBulkOUTReset)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_PENDING;\r
+ TMCRequestStatus = TMC_STATUS_PENDING;\r
else\r
RequestInProgess = 0; \r
\r
else\r
RequestInProgess = 0; \r
\r
{\r
Endpoint_ClearSETUP();\r
\r
{\r
Endpoint_ClearSETUP();\r
\r
- /* Check that no split transaction is already in progress and the data IN transfer tag is valid */\r
+ /* Check that no split transaction is already in progress and the data transfer tag is valid */\r
if (RequestInProgess != 0)\r
{\r
if (RequestInProgess != 0)\r
{\r
- TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS; \r
+ TMCRequestStatus = TMC_STATUS_SPLIT_IN_PROGRESS; \r
- else if (USB_ControlRequest.wValue != NextTransferINTag)\r
+ else if (USB_ControlRequest.wValue != CurrentTransferTag)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_TRANSFER_NOT_IN_PROGRESS;\r
+ TMCRequestStatus = TMC_STATUS_TRANSFER_NOT_IN_PROGRESS;\r
\r
/* Write the request response bytes */\r
Endpoint_Write_Byte(TMCRequestStatus);\r
\r
/* Write the request response bytes */\r
Endpoint_Write_Byte(TMCRequestStatus);\r
- Endpoint_Write_Byte(NextTransferINTag);\r
+ Endpoint_Write_Byte(CurrentTransferTag);\r
\r
Endpoint_ClearIN();\r
Endpoint_ClearStatusStage();\r
\r
Endpoint_ClearIN();\r
Endpoint_ClearStatusStage();\r
\r
/* Check that an ABORT BULK IN transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateAbortBulkIn)\r
\r
/* Check that an ABORT BULK IN transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateAbortBulkIn)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS;\r
+ TMCRequestStatus = TMC_STATUS_SPLIT_NOT_IN_PROGRESS;\r
else if (IsTMCBulkINReset)\r
else if (IsTMCBulkINReset)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_PENDING;\r
+ TMCRequestStatus = TMC_STATUS_PENDING;\r
else\r
RequestInProgess = 0;\r
\r
else\r
RequestInProgess = 0;\r
\r
/* Check that no split transaction is already in progress */\r
if (RequestInProgess != 0)\r
{\r
/* Check that no split transaction is already in progress */\r
if (RequestInProgess != 0)\r
{\r
- Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); \r
+ Endpoint_Write_Byte(TMC_STATUS_SPLIT_IN_PROGRESS); \r
\r
/* Check that a CLEAR transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateClear)\r
\r
/* Check that a CLEAR transaction has been requested and that the request has completed */\r
if (RequestInProgess != Req_InitiateClear)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS; \r
+ TMCRequestStatus = TMC_STATUS_SPLIT_NOT_IN_PROGRESS; \r
else if (IsTMCBulkINReset || IsTMCBulkOUTReset)\r
else if (IsTMCBulkINReset || IsTMCBulkOUTReset)\r
- TMCRequestStatus = TMC_REQUEST_STATUS_PENDING;\r
+ TMCRequestStatus = TMC_STATUS_PENDING;\r
else\r
RequestInProgess = 0;\r
\r
else\r
RequestInProgess = 0;\r
\r
\r
if (Endpoint_IsOUTReceived())\r
{\r
\r
if (Endpoint_IsOUTReceived())\r
{\r
- // TEMP - Indicate data received\r
- LEDs_SetAllLEDs(LEDS_ALL_LEDS);\r
+ TMC_MessageHeader_t MessageHeader;\r
+ \r
+ Endpoint_Read_Stream_LE(&MessageHeader, sizeof(MessageHeader), StreamCallback_AbortOUTOnRequest);\r
+ CurrentTransferTag = MessageHeader.Tag;\r
+\r
+ switch (MessageHeader.MessageID)\r
+ {\r
+ case TMC_MESSAGEID_DEV_DEP_MSG_OUT:\r
+\r
+ break;\r
+ case TMC_MESSAGEID_DEV_DEP_MSG_IN:\r
+\r
+ break;\r
+ case TMC_MESSAGEID_DEV_VENDOR_OUT:\r
+\r
+ break;\r
+ case TMC_MESSAGEID_DEV_VENDOR_IN:\r
+ break;\r
+ }\r
+ \r
Endpoint_ClearOUT();\r
}\r
\r
Endpoint_ClearOUT();\r
}\r
\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
\r
uint16_t TMCVersion;\r
\r
\r
uint16_t TMCVersion;\r
\r
unsigned char ListenOnly : 1;\r
unsigned char TalkOnly : 1;\r
unsigned char PulseIndicateSupported : 1;\r
unsigned char ListenOnly : 1;\r
unsigned char TalkOnly : 1;\r
unsigned char PulseIndicateSupported : 1;\r
- unsigned char _RESERVED : 5;\r
+ unsigned char Reserved : 5;\r
} Interface;\r
\r
struct\r
{\r
unsigned char SupportsAbortINOnMatch : 1;\r
} Interface;\r
\r
struct\r
{\r
unsigned char SupportsAbortINOnMatch : 1;\r
- unsigned char _RESERVED : 7;\r
+ unsigned char Reserved : 7;\r
- uint8_t _RESERVED2[6];\r
- uint8_t _RESERVED3[12]; \r
+ uint8_t Reserved2[6];\r
+ uint8_t Reserved3[12]; \r
+\r
+ typedef struct\r
+ {\r
+ uint8_t MessageID;\r
+ uint8_t Tag;\r
+ uint8_t InverseTag;\r
+ uint8_t Reserved;\r
+ } TMC_MessageHeader_t;\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
- unsigned char _RESERVED1 : 7;
+ unsigned char Reserved : 7;
unsigned char Removable : 1;
uint8_t Version;
unsigned char ResponseDataFormat : 4;
unsigned char Removable : 1;
uint8_t Version;
unsigned char ResponseDataFormat : 4;
- unsigned char _RESERVED2 : 1;
+ unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
unsigned char TrmTsk : 1;
unsigned char AERC : 1;
uint8_t AdditionalLength;
unsigned char NormACA : 1;
unsigned char TrmTsk : 1;
unsigned char AERC : 1;
uint8_t AdditionalLength;
unsigned char SoftReset : 1;
unsigned char CmdQue : 1;
unsigned char SoftReset : 1;
unsigned char CmdQue : 1;
- unsigned char _RESERVED4 : 1;
+ unsigned char Reserved4 : 1;
unsigned char Linked : 1;
unsigned char Sync : 1;
unsigned char WideBus16Bit : 1;
unsigned char Linked : 1;
unsigned char Sync : 1;
unsigned char WideBus16Bit : 1;
uint8_t SegmentNumber;
unsigned char SenseKey : 4;
uint8_t SegmentNumber;
unsigned char SenseKey : 4;
- unsigned char _RESERVED1 : 1;
+ unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
uint32_t SequenceNumber; /**< Data sequence number of the packet */
uint32_t AcknowledgmentNumber; /**< Data acknowledgment number of the packet */
uint32_t SequenceNumber; /**< Data sequence number of the packet */
uint32_t AcknowledgmentNumber; /**< Data acknowledgment number of the packet */
- unsigned char Reserved : 4; /**< Reserved, must be all 0 */
+ unsigned char Reserved : 4; /**< Reserved, must be all 0 */
unsigned char DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */
uint8_t Flags; /**< TCP packet flags */
uint16_t WindowSize; /**< Current data window size (bytes remaining in reception buffer) */
unsigned char DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */
uint8_t Flags; /**< TCP packet flags */
uint16_t WindowSize; /**< Current data window size (bytes remaining in reception buffer) */
(BlockAddress >> 16),
(BlockAddress >> 8),
(BlockAddress & 0xFF), // LSB of Block Address
(BlockAddress >> 16),
(BlockAddress >> 8),
(BlockAddress & 0xFF), // LSB of Block Address
- 0x00, // Unused (reserved)
0x00, // MSB of Total Blocks to Read
Blocks, // LSB of Total Blocks to Read
0x00 // Unused (control)
0x00, // MSB of Total Blocks to Read
Blocks, // LSB of Total Blocks to Read
0x00 // Unused (control)
uint8_t SegmentNumber;
unsigned char SenseKey : 4;
uint8_t SegmentNumber;
unsigned char SenseKey : 4;
- unsigned char _RESERVED1 : 1;
+ unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
- unsigned char _RESERVED1 : 7;
+ unsigned char Reserved : 7;
unsigned char Removable : 1;
uint8_t Version;
unsigned char ResponseDataFormat : 4;
unsigned char Removable : 1;
uint8_t Version;
unsigned char ResponseDataFormat : 4;
- unsigned char _RESERVED2 : 1;
+ unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
unsigned char TrmTsk : 1;
unsigned char AERC : 1;
uint8_t AdditionalLength;
unsigned char NormACA : 1;
unsigned char TrmTsk : 1;
unsigned char AERC : 1;
uint8_t AdditionalLength;
unsigned char SoftReset : 1;
unsigned char CmdQue : 1;
unsigned char SoftReset : 1;
unsigned char CmdQue : 1;
- unsigned char _RESERVED4 : 1;
+ unsigned char Reserved4 : 1;
unsigned char Linked : 1;
unsigned char Sync : 1;
unsigned char WideBus16Bit : 1;
unsigned char Linked : 1;
unsigned char Sync : 1;
unsigned char WideBus16Bit : 1;
uint8_t SegmentNumber;
unsigned char SenseKey : 4;
uint8_t SegmentNumber;
unsigned char SenseKey : 4;
- unsigned char _RESERVED1 : 1;
+ unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
- unsigned char _RESERVED1 : 7;
+ unsigned char Reserved : 7;
unsigned char Removable : 1;
uint8_t Version;
unsigned char ResponseDataFormat : 4;
unsigned char Removable : 1;
uint8_t Version;
unsigned char ResponseDataFormat : 4;
- unsigned char _RESERVED2 : 1;
+ unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
unsigned char TrmTsk : 1;
unsigned char AERC : 1;
uint8_t AdditionalLength;
unsigned char NormACA : 1;
unsigned char TrmTsk : 1;
unsigned char AERC : 1;
uint8_t AdditionalLength;
unsigned char SoftReset : 1;
unsigned char CmdQue : 1;
unsigned char SoftReset : 1;
unsigned char CmdQue : 1;
- unsigned char _RESERVED4 : 1;
+ unsigned char Reserved4 : 1;
unsigned char Linked : 1;
unsigned char Sync : 1;
unsigned char WideBus16Bit : 1;
unsigned char Linked : 1;
unsigned char Sync : 1;
unsigned char WideBus16Bit : 1;
(BlockAddress >> 16),
(BlockAddress >> 8),
(BlockAddress & 0xFF), // LSB of Block Address
(BlockAddress >> 16),
(BlockAddress >> 8),
(BlockAddress & 0xFF), // LSB of Block Address
- 0x00, // Unused (reserved)
0x00, // MSB of Total Blocks to Read
Blocks, // LSB of Total Blocks to Read
0x00 // Unused (control)
0x00, // MSB of Total Blocks to Read
Blocks, // LSB of Total Blocks to Read
0x00 // Unused (control)
(BlockAddress >> 16),
(BlockAddress >> 8),
(BlockAddress & 0xFF), // LSB of Block Address
(BlockAddress >> 16),
(BlockAddress >> 8),
(BlockAddress & 0xFF), // LSB of Block Address
- 0x00, // Unused (reserved)
0x00, // MSB of Total Blocks to Write
Blocks, // LSB of Total Blocks to Write
0x00 // Unused (control)
0x00, // MSB of Total Blocks to Write
Blocks, // LSB of Total Blocks to Write
0x00 // Unused (control)
* -# Multiple-Report HID device
* -# Device/Host USB bridge
* -# Alternative (USB-IF endorsed) USB-CDC Ethernet Class
* -# Multiple-Report HID device
* -# Device/Host USB bridge
* -# Alternative (USB-IF endorsed) USB-CDC Ethernet Class
- * -# USB Test and Measurement Class
+ * -# Finish Test and Measurement Class demo
* -# Finish BluetoothHost demo
* -# Finish SideShow demo
* -# Finish StandaloneProgrammer project
* -# Finish BluetoothHost demo
* -# Finish SideShow demo
* -# Finish StandaloneProgrammer project
{
unsigned int Min : 4;
unsigned int TenMin : 3;
{
unsigned int Min : 4;
unsigned int TenMin : 3;
- unsigned int _RESERVED : 1;
+ unsigned int Reserved : 1;
} Fields;
uint8_t IntVal;
} Fields;
uint8_t IntVal;
unsigned int Hour : 4;
unsigned int TenHour : 2;
unsigned int TwelveHourMode : 1;
unsigned int Hour : 4;
unsigned int TenHour : 2;
unsigned int TwelveHourMode : 1;
- unsigned int _RESERVED : 1;
+ unsigned int Reserved : 1;
} Fields;
uint8_t IntVal;
} Fields;
uint8_t IntVal;
{
unsigned int Day : 4;
unsigned int TenDay : 2;
{
unsigned int Day : 4;
unsigned int TenDay : 2;
- unsigned int _RESERVED : 2;
+ unsigned int Reserved : 2;
} Fields;
uint8_t IntVal;
} Fields;
uint8_t IntVal;
{
unsigned int Month : 4;
unsigned int TenMonth : 1;
{
unsigned int Month : 4;
unsigned int TenMonth : 1;
- unsigned int _RESERVED : 3;
+ unsigned int Reserved : 3;
} Fields;
uint8_t IntVal;
} Fields;
uint8_t IntVal;