Add branch for the conversion of demos to use standard C header files for configuration, rather than makefile defined macros.

This commit is contained in:
Dean Camera 2012-05-10 19:24:58 +00:00
parent e8570c4a37
commit 359fbfe14d
395 changed files with 9912 additions and 2756 deletions

View file

@ -118,20 +118,20 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | MASS_STORAGE_IN_EPNUM),
.EndpointAddress = MASS_STORAGE_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
},
.MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM),
.EndpointAddress = MASS_STORAGE_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x01
.PollingIntervalMS = 0x05
}
};

View file

@ -42,11 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPNUM 3
/** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPNUM 4
/** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64

View file

@ -118,10 +118,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup Mass Storage Data Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
MASS_STORAGE_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
MASS_STORAGE_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPADDR, EP_TYPE_BULK, MASS_STORAGE_IO_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPADDR, EP_TYPE_BULK, MASS_STORAGE_IO_EPSIZE, 1);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
@ -180,7 +178,7 @@ void MassStorage_Task(void)
/* Check direction of command, select Data IN endpoint if data is from the device */
if (CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
/* Decode the received SCSI command, set returned status code */
CommandStatus.Status = SCSI_DecodeSCSICommand() ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
@ -206,13 +204,13 @@ void MassStorage_Task(void)
if (IsMassStoreReset)
{
/* Reset the data endpoint banks */
Endpoint_ResetEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_ResetEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_ResetEndpoint(MASS_STORAGE_OUT_EPADDR);
Endpoint_ResetEndpoint(MASS_STORAGE_IN_EPADDR);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPADDR);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
@ -231,7 +229,7 @@ static bool ReadInCommandBlock(void)
uint16_t BytesTransferred;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPADDR);
/* Abort if no command has been sent from the host */
if (!(Endpoint_IsOUTReceived()))
@ -256,7 +254,7 @@ static bool ReadInCommandBlock(void)
{
/* Stall both data pipes until reset by host */
Endpoint_StallTransaction();
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
Endpoint_StallTransaction();
return false;
@ -286,7 +284,7 @@ static void ReturnCommandStatus(void)
uint16_t BytesTransferred;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPADDR);
/* While data pipe is stalled, wait until the host issues a control request to clear the stall */
while (Endpoint_IsStalled())
@ -297,7 +295,7 @@ static void ReturnCommandStatus(void)
}
/* Select the Data In endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPADDR);
/* While data pipe is stalled, wait until the host issues a control request to clear the stall */
while (Endpoint_IsStalled())