{\r
.ListenOnly = false,\r
.TalkOnly = false,\r
- .PulseIndicateSupported = true,\r
+ .PulseIndicateSupported = false,\r
},\r
\r
.Device =\r
},\r
};\r
\r
+/** Current TMC control request that is being processed */\r
+uint8_t RequestInProgess = 0;\r
+\r
+/** Stream callback abort flag for bulk IN data */\r
+bool IsTMCBulkINReset = false;\r
+\r
+/** Stream callback abort flag for bulk OUT data */\r
+bool IsTMCBulkOUTReset = false;\r
+\r
\r
/** Main program entry point. This routine contains the overall program flow, including initial\r
* setup of all components and the main program loop.\r
case Req_InitiateAbortBulkOut:\r
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT))\r
{\r
- \r
+ Endpoint_ClearSETUP();\r
+ \r
+ /* Check to see if a split request is already being processed before starting a new one */\r
+ if (RequestInProgess != 0)\r
+ {\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); \r
+ }\r
+ else\r
+ {\r
+ /* Indicate that all in-progress/pending data OUT requests should be aborted */\r
+ IsTMCBulkOUTReset = true;\r
+ \r
+ /* Save the split request for later checking when a new request is received */\r
+ RequestInProgess = Req_InitiateAbortBulkOut;\r
+\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS);\r
+ }\r
+ \r
+ Endpoint_ClearIN();\r
+ Endpoint_ClearStatusStage();\r
}\r
\r
break;\r
case Req_CheckAbortBulkOutStatus:\r
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT))\r
{\r
- \r
+ Endpoint_ClearSETUP();\r
+ \r
+ /* Check to see the correct split request is in progress before the status can be retrieved */\r
+ if (RequestInProgess != Req_InitiateAbortBulkOut)\r
+ {\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS); \r
+ }\r
+ else\r
+ {\r
+ // TODO: CLEAR BULK OUT\r
+ \r
+ /* Clear the pending split request value so that a new request can be made */\r
+ RequestInProgess = 0;\r
+\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS);\r
+ }\r
+ \r
+ Endpoint_ClearIN();\r
+ Endpoint_ClearStatusStage(); \r
}\r
\r
break;\r
case Req_InitiateAbortBulkIn:\r
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT))\r
{\r
- \r
+ Endpoint_ClearSETUP();\r
+ \r
+ /* Check to see if a split request is already being processed before starting a new one */\r
+ if (RequestInProgess != 0)\r
+ {\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); \r
+ }\r
+ else\r
+ {\r
+ /* Indicate that all in-progress/pending data IN requests should be aborted */\r
+ IsTMCBulkINReset = true;\r
+ \r
+ /* Save the split request for later checking when a new request is received */\r
+ RequestInProgess = Req_InitiateAbortBulkIn;\r
+\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS);\r
+ }\r
+ \r
+ Endpoint_ClearIN();\r
+ Endpoint_ClearStatusStage();\r
}\r
\r
break;\r
case Req_CheckAbortBulkInStatus:\r
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT))\r
{\r
- \r
+ Endpoint_ClearSETUP();\r
+ \r
+ /* Check to see the correct split request is in progress before the status can be retrieved */\r
+ if (RequestInProgess != Req_InitiateAbortBulkIn)\r
+ {\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS); \r
+ }\r
+ else\r
+ {\r
+ // TODO: CLEAR BULK IN\r
+ \r
+ /* Clear the pending split request value so that a new request can be made */\r
+ RequestInProgess = 0;\r
+\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS);\r
+ }\r
+ \r
+ Endpoint_ClearIN();\r
+ Endpoint_ClearStatusStage(); \r
}\r
\r
break;\r
case Req_InitiateClear:\r
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
{\r
- \r
+ Endpoint_ClearSETUP();\r
+ \r
+ /* Check to see if a split request is already being processed before starting a new one */\r
+ if (RequestInProgess != 0)\r
+ {\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); \r
+ }\r
+ else\r
+ {\r
+ /* Indicate that all in-progress/pending data IN and OUT requests should be aborted */\r
+ IsTMCBulkINReset = true;\r
+ IsTMCBulkOUTReset = true;\r
+ \r
+ /* Save the split request for later checking when a new request is received */\r
+ RequestInProgess = Req_InitiateClear;\r
+\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS);\r
+ }\r
+ \r
+ Endpoint_ClearIN();\r
+ Endpoint_ClearStatusStage();\r
}\r
\r
break;\r
case Req_CheckClearStatus:\r
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
{\r
- \r
+ Endpoint_ClearSETUP();\r
+ \r
+ /* Check to see the correct split request is in progress before the status can be retrieved */\r
+ if (RequestInProgess != Req_InitiateClear)\r
+ {\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS); \r
+ }\r
+ else\r
+ {\r
+ // TODO: CLEAR STATUS\r
+ \r
+ /* Clear the pending split request value so that a new request can be made */\r
+ RequestInProgess = 0;\r
+\r
+ Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS);\r
+ }\r
+ \r
+ Endpoint_ClearIN();\r
+ Endpoint_ClearStatusStage(); \r
}\r
\r
break;\r
Endpoint_ClearOUT();\r
}\r
}\r
+\r
+/** Stream callback function for the Endpoint stream write functions. This callback will abort the current stream transfer\r
+ * if a TMC Abort Bulk IN request has been issued to the control endpoint.\r
+ */\r
+uint8_t StreamCallback_AbortINOnRequest(void)\r
+{ \r
+ /* Abort if a TMC Bulk Data IN abort was received */\r
+ if (IsTMCBulkINReset)\r
+ return STREAMCALLBACK_Abort;\r
+ \r
+ /* Continue with the current stream operation */\r
+ return STREAMCALLBACK_Continue;\r
+}\r
+\r
+/** Stream callback function for the Endpoint stream read functions. This callback will abort the current stream transfer\r
+ * if a TMC Abort Bulk OUT request has been issued to the control endpoint.\r
+ */\r
+uint8_t StreamCallback_AbortOUTOnRequest(void)\r
+{ \r
+ /* Abort if a TMC Bulk Data IN abort was received */\r
+ if (IsTMCBulkOUTReset)\r
+ return STREAMCALLBACK_Abort;\r
+ \r
+ /* Continue with the current stream operation */\r
+ return STREAMCALLBACK_Continue;\r
+}\r