X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/9798440ca4f694e7cd8312a51b82e59589f1ebeb..f3e4fbe5126fc8edf40a0b0ace2d3437ee988d2e:/Demos/Device/ClassDriver/MassStorage/MassStorage.c diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 66bba8f50..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 @@ -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,19 +95,19 @@ 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); @@ -109,17 +115,17 @@ void EVENT_USB_ConfigurationChanged(void) 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) { - MS_Device_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_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo) +bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo) { bool CommandSuccess;