diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-14 04:39:16 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-14 04:39:16 +0000 |
commit | 8a55d80e7e1214b8625b413fa0123a8b6ce9c825 (patch) | |
tree | c1ba3cd0e67766f19c6501c1e649d13c0b2eef97 /Projects/AVRISP/Lib/PDIProtocol.c | |
parent | 1fa27139f5c195c0d7147dac0c5332a6ea10229a (diff) | |
download | lufa-8a55d80e7e1214b8625b413fa0123a8b6ce9c825.tar.gz lufa-8a55d80e7e1214b8625b413fa0123a8b6ce9c825.tar.bz2 lufa-8a55d80e7e1214b8625b413fa0123a8b6ce9c825.zip |
Fix NVM commands so that memory reads and CRC generations now work correctly using unoptimized PDI commands.
Diffstat (limited to 'Projects/AVRISP/Lib/PDIProtocol.c')
-rw-r--r-- | Projects/AVRISP/Lib/PDIProtocol.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Projects/AVRISP/Lib/PDIProtocol.c b/Projects/AVRISP/Lib/PDIProtocol.c index a7b11557c..e3255a0c6 100644 --- a/Projects/AVRISP/Lib/PDIProtocol.c +++ b/Projects/AVRISP/Lib/PDIProtocol.c @@ -216,20 +216,17 @@ static void PDIProtocol_ReadMemory(void) Endpoint_ClearOUT();
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
- if (ReadMemory_XPROG_Params.MemoryType == XPRG_MEM_TYPE_USERSIG)
- {
- PDITarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_1BYTE << 2));
- NVMTarget_SendNVMRegAddress(NVM_REG_CMD);
- PDITarget_SendByte(NVM_CMD_READUSERSIG);
- // TODO
- }
-
+ uint8_t ReadBuffer[ReadMemory_XPROG_Params.Length];
+ NVMTarget_ReadMemory(ReadMemory_XPROG_Params.Address, ReadBuffer, ReadMemory_XPROG_Params.Length);
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_READ_MEM);
Endpoint_Write_Byte(ReturnStatus);
+ if (ReturnStatus == XPRG_ERR_OK)
+ Endpoint_Write_Stream_LE(ReadBuffer, ReadMemory_XPROG_Params.Length);
+
Endpoint_ClearIN();
}
@@ -250,13 +247,16 @@ static void PDIProtocol_ReadCRC(void) Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint32_t MemoryCRC;
+ uint8_t CRCCommand;
if (ReadCRC_XPROG_Params.CRCType == XPRG_CRC_APP)
- MemoryCRC = NVMTarget_GetMemoryCRC(NVM_CMD_APPCRC);
+ CRCCommand = NVM_CMD_APPCRC;
else if (ReadCRC_XPROG_Params.CRCType == XPRG_CRC_BOOT)
- MemoryCRC = NVMTarget_GetMemoryCRC(NVM_CMD_BOOTCRC);
+ CRCCommand = NVM_CMD_BOOTCRC;
else
- MemoryCRC = NVMTarget_GetMemoryCRC(NVM_CMD_FLASHCRC);
+ CRCCommand = NVM_CMD_FLASHCRC;
+
+ MemoryCRC = NVMTarget_GetMemoryCRC(CRCCommand);
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_CRC);
|