projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
59ed102
)
Make the StandaloneProgrammer project seamlessly read out drive contents from either...
author
Dean Camera
<dean@fourwalledcubicle.com>
Tue, 24 Nov 2009 14:10:28 +0000
(14:10 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Tue, 24 Nov 2009 14:10:28 +0000
(14:10 +0000)
Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
patch
|
blob
|
blame
|
history
Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
patch
|
blob
|
blame
|
history
Projects/Incomplete/StandaloneProgrammer/DiskHost.c
patch
|
blob
|
blame
|
history
Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
patch
|
blob
|
blame
|
history
Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
patch
|
blob
|
blame
|
history
Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
patch
|
blob
|
blame
|
history
diff --git
a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
index
94d363f
..
cdce700
100644
(file)
--- a/
Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
+++ b/
Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
@@
-84,7
+84,7
@@
int main(void)
}
\r
\r
if (MS_Host_ConfigurePipes(&FlashDisk_MS_Interface,
\r
}
\r
\r
if (MS_Host_ConfigurePipes(&FlashDisk_MS_Interface,
\r
-
ConfigDescriptorSize, ConfigDescriptorData) != MS_ENUMERROR_NoError)
\r
+ ConfigDescriptorSize, ConfigDescriptorData) != MS_ENUMERROR_NoError)
\r
{
\r
printf("Attached Device Not a Valid Mass Storage Device.\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
{
\r
printf("Attached Device Not a Valid Mass Storage Device.\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
diff --git
a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
index
104893a
..
2bb27bd
100644
(file)
--- a/
Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
+++ b/
Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
@@
-77,8
+77,6
@@
void EVENT_USB_Device_ConfigurationChanged(void)
\r
if (!(MS_Device_ConfigureEndpoints(&DiskDevice_MS_Interface)))
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
\r
if (!(MS_Device_ConfigureEndpoints(&DiskDevice_MS_Interface)))
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
-
\r
- pf_mount(&DiskFATState);
\r
}
\r
\r
/** Event handler for the library USB Unhandled Control Request event. */
\r
}
\r
\r
/** Event handler for the library USB Unhandled Control Request event. */
\r
diff --git
a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
index
c554141
..
8e51820
100644
(file)
--- a/
Projects/Incomplete/StandaloneProgrammer/DiskHost.c
+++ b/
Projects/Incomplete/StandaloneProgrammer/DiskHost.c
@@
-59,16
+59,14
@@
void DiskHost_USBTask(void)
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
\r
{
\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
\r
{
\r
- printf("ERROR - GetConfig\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
}
\r
\r
if (MS_Host_ConfigurePipes(&DiskHost_MS_Interface,
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
}
\r
\r
if (MS_Host_ConfigurePipes(&DiskHost_MS_Interface,
\r
-
ConfigDescriptorSize, ConfigDescriptorData) != MS_ENUMERROR_NoError)
\r
+ ConfigDescriptorSize, ConfigDescriptorData) != MS_ENUMERROR_NoError)
\r
{
\r
{
\r
- printf("ERROR - Pipes\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
@@
-76,16
+74,16
@@
void DiskHost_USBTask(void)
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
\r
{
\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
\r
{
\r
- printf("ERROR - SetConfig\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
}
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
}
\r
-
\r
+
\r
+ USB_HostState = HOST_STATE_Configured;
\r
+
\r
uint8_t MaxLUNIndex;
\r
if (MS_Host_GetMaxLUN(&DiskHost_MS_Interface, &MaxLUNIndex))
\r
{
\r
uint8_t MaxLUNIndex;
\r
if (MS_Host_GetMaxLUN(&DiskHost_MS_Interface, &MaxLUNIndex))
\r
{
\r
- printf("ERROR - MaxLUN\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
@@
-93,7
+91,6
@@
void DiskHost_USBTask(void)
\r
if (MS_Host_ResetMSInterface(&DiskHost_MS_Interface))
\r
{
\r
\r
if (MS_Host_ResetMSInterface(&DiskHost_MS_Interface))
\r
{
\r
- printf("ERROR - ResetMS\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
@@
-102,7
+99,6
@@
void DiskHost_USBTask(void)
SCSI_Request_Sense_Response_t SenseData;
\r
if (MS_Host_RequestSense(&DiskHost_MS_Interface, 0, &SenseData) != 0)
\r
{
\r
SCSI_Request_Sense_Response_t SenseData;
\r
if (MS_Host_RequestSense(&DiskHost_MS_Interface, 0, &SenseData) != 0)
\r
{
\r
- printf("ERROR - Sense\r\n");
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
\r
return;
\r
@@
-111,7
+107,6
@@
void DiskHost_USBTask(void)
pf_mount(&DiskFATState);
\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);
\r
pf_mount(&DiskFATState);
\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);
\r
- USB_HostState = HOST_STATE_Configured;
\r
}
\r
\r
MS_Host_USBTask(&DiskHost_MS_Interface);
\r
}
\r
\r
MS_Host_USBTask(&DiskHost_MS_Interface);
\r
diff --git
a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
index
b40adf1
..
d46d9b9
100644
(file)
--- a/
Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
+++ b/
Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c
@@
-42,7
+42,7
@@
DRESULT disk_readp (
else if (MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp))
\r
ErrorCode = RES_ERROR;
\r
\r
else if (MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp))
\r
ErrorCode = RES_ERROR;
\r
\r
-
printf("BLOCK READ #%lu Ret %d\r\n", sector, MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp)
);
\r
+
MS_Host_ReadDeviceBlocks(&DiskHost_MS_Interface, 0, sector, 1, 512, BlockTemp
);
\r
#endif
\r
}
\r
else
\r
#endif
\r
}
\r
else
\r
diff --git
a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
index
e8a863f
..
5d86523
100644
(file)
--- a/
Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
+++ b/
Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
@@
-57,6
+57,16
@@
static int Disk_getchar(FILE* Stream)
return (ByteWasRead ? ReadByte : _FDEV_EOF);
\r
}
\r
\r
return (ByteWasRead ? ReadByte : _FDEV_EOF);
\r
}
\r
\r
+#if defined(USB_CAN_BE_BOTH)
\r
+/** Event to handle mode changes in the library, to clear the FAT library's drive state structure when transitioning
\r
+ * between modes. This ensures that the library always works with current disk data.
\r
+ */
\r
+void EVENT_USB_UIDChange(void)
\r
+{
\r
+ pf_mount(&DiskFATState);
\r
+}
\r
+#endif
\r
+
\r
/** Task to determine if the user is wishes to start the programming sequence, and if so executes the
\r
* required functions to program the attached target (if any) with the files loaded to the dataflash.
\r
*/
\r
/** Task to determine if the user is wishes to start the programming sequence, and if so executes the
\r
* required functions to program the attached target (if any) with the files loaded to the dataflash.
\r
*/
\r
diff --git
a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
index
698070a
..
744ad01
100644
(file)
--- a/
Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
+++ b/
Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
@@
-79,6
+79,8
@@
static int Disk_getchar(FILE* Stream);
\r
#endif
\r
\r
static int Disk_getchar(FILE* Stream);
\r
#endif
\r
\r
+ void EVENT_USB_UIDChange(void);
\r
+
\r
void SetupHardware(void);
\r
void Programmer_Task(void);
\r
\r
void SetupHardware(void);
\r
void Programmer_Task(void);
\r
\r