X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b9b03aadb219d06fbad9d110e508db93e45461af..f3e4fbe5126fc8edf40a0b0ace2d3437ee988d2e:/Demos/Device/ClassDriver/MassStorage/MassStorage.c diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 5dbc4a2cc..3895555d1 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -40,17 +40,22 @@ * passed to all Mass Storage Class driver functions, so that multiple instances of the same class * within a device can be differentiated from one another. */ -USB_ClassInfo_MS_t Disk_MS_Interface = +USB_ClassInfo_MS_Device_t Disk_MS_Interface = { - .InterfaceNumber = 0, + .Config = + { + .InterfaceNumber = 0, - .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM, - .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE, + .DataINEndpointNumber = MASS_STORAGE_IN_EPNUM, + .DataINEndpointSize = MASS_STORAGE_IO_EPSIZE, + .DataINEndpointDoubleBank = false, - .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM, - .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE, + .DataOUTEndpointNumber = MASS_STORAGE_OUT_EPNUM, + .DataOUTEndpointSize = MASS_STORAGE_IO_EPSIZE, + .DataOUTEndpointDoubleBank = false, - .TotalLUNs = TOTAL_LUNS, + .TotalLUNs = TOTAL_LUNS, + }, }; /** Main program entry point. This routine contains the overall program flow, including initial @@ -64,7 +69,7 @@ int main(void) for (;;) { - USB_MS_USBTask(&Disk_MS_Interface); + MS_Device_USBTask(&Disk_MS_Interface); USB_USBTask(); } } @@ -81,7 +86,8 @@ void SetupHardware(void) /* Hardware Initialization */ LEDs_Init(); - Dataflash_Init(SPI_SPEED_FCPU_DIV_2); + SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); + Dataflash_Init(); USB_Init(); /* Clear Dataflash sector protections, if enabled */ @@ -89,37 +95,37 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); - if (!(USB_MS_ConfigureEndpoints(&Disk_MS_Interface))) + if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface))) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - USB_MS_ProcessControlPacket(&Disk_MS_Interface); + MS_Device_ProcessControlRequest(&Disk_MS_Interface); } /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. * - * \param MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced + * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced */ -bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo) +bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo) { bool CommandSuccess;