From 0803cf00ac32f208fe5f8bbc6f29c49296feb977 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 26 Jul 2010 04:57:50 +0000 Subject: [PATCH] Add missing INTERRUPT_CONTROL_ENDPOINT compile time option to the Mass Storage device projects/demos and incomplete Test and Measurement Class demo, which was accidentally removed during the makefile updates. Alter Test and Measurement Class demo's request handlers to accept, process and correctly return the fields indicated in the specification. --- Demos/Device/ClassDriver/MassStorage/makefile | 1 + .../ClassDriver/MassStorageKeyboard/makefile | 1 + .../TestAndMeasurement/TestAndMeasurement.c | 101 ++++++++++-------- .../Incomplete/TestAndMeasurement/makefile | 1 + Demos/Device/LowLevel/MassStorage/makefile | 1 + Projects/TempDataLogger/makefile | 1 + Projects/Webserver/makefile | 1 + 7 files changed, 62 insertions(+), 45 deletions(-) diff --git a/Demos/Device/ClassDriver/MassStorage/makefile b/Demos/Device/ClassDriver/MassStorage/makefile index a7c1bed823..5c9fe05718 100644 --- a/Demos/Device/ClassDriver/MassStorage/makefile +++ b/Demos/Device/ClassDriver/MassStorage/makefile @@ -121,6 +121,7 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT # Create the LUFA source path variables by including the LUFA root makefile diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile index 9450ee5848..723dd91d60 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile @@ -121,6 +121,7 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT # Create the LUFA source path variables by including the LUFA root makefile diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c index c3e54ab3a1..184e2e23c2 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c +++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c @@ -61,6 +61,12 @@ bool IsTMCBulkINReset = false; /** Stream callback abort flag for bulk OUT data */ bool IsTMCBulkOUTReset = false; +/** Last used tag value for bulk IN transfers */ +uint8_t NextTransferINTag = 0; + +/** Last used tag value for bulk IN transfers */ +uint8_t NextTransferOUTTag = 0; + /** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. @@ -126,6 +132,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) void EVENT_USB_Device_UnhandledControlRequest(void) { + uint8_t TMCRequestStatus = TMC_REQUEST_STATUS_SUCCESS; + switch (USB_ControlRequest.bRequest) { case Req_InitiateAbortBulkOut: @@ -133,10 +141,13 @@ void EVENT_USB_Device_UnhandledControlRequest(void) { Endpoint_ClearSETUP(); - /* Check to see if a split request is already being processed before starting a new one */ if (RequestInProgess != 0) { - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); + TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS; + } + else if (USB_ControlRequest.wValue != NextTransferOUTTag) + { + TMCRequestStatus = TMC_REQUEST_STATUS_TRANSFER_NOT_IN_PROGRESS; } else { @@ -145,10 +156,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void) /* Save the split request for later checking when a new request is received */ RequestInProgess = Req_InitiateAbortBulkOut; - - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS); } + /* Write the request response byte */ + Endpoint_Write_Byte(TMCRequestStatus); + Endpoint_ClearIN(); Endpoint_ClearStatusStage(); } @@ -159,21 +171,18 @@ void EVENT_USB_Device_UnhandledControlRequest(void) { Endpoint_ClearSETUP(); - /* Check to see the correct split request is in progress before the status can be retrieved */ if (RequestInProgess != Req_InitiateAbortBulkOut) - { - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS); - } + TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS; + else if (IsTMCBulkOUTReset) + TMCRequestStatus = TMC_REQUEST_STATUS_PENDING; else - { - // TODO: CLEAR BULK OUT + RequestInProgess = 0; - /* Clear the pending split request value so that a new request can be made */ - RequestInProgess = 0; + /* Write the request response bytes */ + Endpoint_Write_Byte(TMCRequestStatus); + Endpoint_Write_Word_LE(0); + Endpoint_Write_DWord_LE(0); // TODO - Last transfer length - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS); - } - Endpoint_ClearIN(); Endpoint_ClearStatusStage(); } @@ -184,10 +193,13 @@ void EVENT_USB_Device_UnhandledControlRequest(void) { Endpoint_ClearSETUP(); - /* Check to see if a split request is already being processed before starting a new one */ if (RequestInProgess != 0) { - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); + TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS; + } + else if (USB_ControlRequest.wValue != NextTransferINTag) + { + TMCRequestStatus = TMC_REQUEST_STATUS_TRANSFER_NOT_IN_PROGRESS; } else { @@ -196,10 +208,12 @@ void EVENT_USB_Device_UnhandledControlRequest(void) /* Save the split request for later checking when a new request is received */ RequestInProgess = Req_InitiateAbortBulkIn; - - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS); } + /* Write the request response bytes */ + Endpoint_Write_Byte(TMCRequestStatus); + Endpoint_Write_Byte(NextTransferINTag); + Endpoint_ClearIN(); Endpoint_ClearStatusStage(); } @@ -210,23 +224,20 @@ void EVENT_USB_Device_UnhandledControlRequest(void) { Endpoint_ClearSETUP(); - /* Check to see the correct split request is in progress before the status can be retrieved */ if (RequestInProgess != Req_InitiateAbortBulkIn) - { - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS); - } + TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS; + else if (IsTMCBulkINReset) + TMCRequestStatus = TMC_REQUEST_STATUS_PENDING; else - { - // TODO: CLEAR BULK IN + RequestInProgess = 0; - /* Clear the pending split request value so that a new request can be made */ - RequestInProgess = 0; + /* Write the request response bytes */ + Endpoint_Write_Byte(TMCRequestStatus); + Endpoint_Write_Word_LE(0); + Endpoint_Write_DWord_LE(0); // TODO - Last transfer length - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS); - } - Endpoint_ClearIN(); - Endpoint_ClearStatusStage(); + Endpoint_ClearStatusStage(); } break; @@ -235,7 +246,6 @@ void EVENT_USB_Device_UnhandledControlRequest(void) { Endpoint_ClearSETUP(); - /* Check to see if a split request is already being processed before starting a new one */ if (RequestInProgess != 0) { Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_IN_PROGRESS); @@ -248,10 +258,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void) /* Save the split request for later checking when a new request is received */ RequestInProgess = Req_InitiateClear; - - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS); } + /* Write the request response byte */ + Endpoint_Write_Byte(TMCRequestStatus); + Endpoint_ClearIN(); Endpoint_ClearStatusStage(); } @@ -262,20 +273,16 @@ void EVENT_USB_Device_UnhandledControlRequest(void) { Endpoint_ClearSETUP(); - /* Check to see the correct split request is in progress before the status can be retrieved */ if (RequestInProgess != Req_InitiateClear) - { - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS); - } + TMCRequestStatus = TMC_REQUEST_STATUS_SPLIT_NOT_IN_PROGRESS; + else if (IsTMCBulkINReset || IsTMCBulkOUTReset) + TMCRequestStatus = TMC_REQUEST_STATUS_PENDING; else - { - // TODO: CLEAR STATUS + RequestInProgess = 0; - /* Clear the pending split request value so that a new request can be made */ - RequestInProgess = 0; - - Endpoint_Write_Byte(TMC_REQUEST_STATUS_SUCCESS); - } + /* Write the request response bytes */ + Endpoint_Write_Byte(TMCRequestStatus); + Endpoint_Write_Byte(0); Endpoint_ClearIN(); Endpoint_ClearStatusStage(); @@ -313,6 +320,10 @@ void TMC_Task(void) LEDs_SetAllLEDs(LEDS_ALL_LEDS); Endpoint_ClearOUT(); } + + /* All pending data has been processed - reset the data abort flags */ + IsTMCBulkINReset = false; + IsTMCBulkOUTReset = false; } /** Stream callback function for the Endpoint stream write functions. This callback will abort the current stream transfer diff --git a/Demos/Device/Incomplete/TestAndMeasurement/makefile b/Demos/Device/Incomplete/TestAndMeasurement/makefile index 43f8b8fbd8..856fc2bcbc 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/makefile +++ b/Demos/Device/Incomplete/TestAndMeasurement/makefile @@ -121,6 +121,7 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT # Create the LUFA source path variables by including the LUFA root makefile diff --git a/Demos/Device/LowLevel/MassStorage/makefile b/Demos/Device/LowLevel/MassStorage/makefile index 4ae0040ce3..e1447cea2b 100644 --- a/Demos/Device/LowLevel/MassStorage/makefile +++ b/Demos/Device/LowLevel/MassStorage/makefile @@ -121,6 +121,7 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT # Create the LUFA source path variables by including the LUFA root makefile diff --git a/Projects/TempDataLogger/makefile b/Projects/TempDataLogger/makefile index de751dd4cc..06f0954637 100644 --- a/Projects/TempDataLogger/makefile +++ b/Projects/TempDataLogger/makefile @@ -121,6 +121,7 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT #LUFA_OPTS += -D DUMMY_RTC diff --git a/Projects/Webserver/makefile b/Projects/Webserver/makefile index 093246e7ce..877b9261f9 100644 --- a/Projects/Webserver/makefile +++ b/Projects/Webserver/makefile @@ -121,6 +121,7 @@ LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D FAST_STREAM_TRANSFERS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT LUFA_OPTS += -D ENABLE_DHCP_CLIENT LUFA_OPTS += -D ENABLE_TELNET_SERVER