projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Complete combining of PDI and TPI target communication code files, stub out TINY...
[pub/USBasp.git]
/
Projects
/
AVRISP
/
Lib
/
XPROG
/
XPROGProtocol.c
diff --git
a/Projects/AVRISP/Lib/XPROG/XPROGProtocol.c
b/Projects/AVRISP/Lib/XPROG/XPROGProtocol.c
index
d919413
..
f83561c
100644
(file)
--- a/
Projects/AVRISP/Lib/XPROG/XPROGProtocol.c
+++ b/
Projects/AVRISP/Lib/XPROG/XPROGProtocol.c
@@
-44,7
+44,7
@@
uint32_t XPROG_Param_NVMBase = 0x010001C0;
uint32_t XPROG_Param_EEPageSize;
\r
\r
/** Currently selected XPROG programming protocol */
\r
uint32_t XPROG_Param_EEPageSize;
\r
\r
/** Currently selected XPROG programming protocol */
\r
-uint8_t XPROG_SelectedProtocol;
\r
+uint8_t XPROG_SelectedProtocol
= XPRG_PROTOCOL_PDI
;
\r
\r
\r
/** Handler for the CMD_XPROG_SETMODE command, which sets the programmer-to-target protocol used for PDI/TPI
\r
\r
\r
/** Handler for the CMD_XPROG_SETMODE command, which sets the programmer-to-target protocol used for PDI/TPI
\r
@@
-113,23
+113,26
@@
static void XPROGProtocol_EnterXPROGMode(void)
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
\r
{
\r
/* Enable PDI programming mode with the attached target */
\r
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
\r
{
\r
/* Enable PDI programming mode with the attached target */
\r
-
PDI
Target_EnableTargetPDI();
\r
+
XPROG
Target_EnableTargetPDI();
\r
\r
/* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
\r
\r
/* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
\r
- PDITarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
-
PDI
Target_SendByte(PDI_RESET_KEY);
\r
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
+
XPROG
Target_SendByte(PDI_RESET_KEY);
\r
\r
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
\r
\r
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
\r
- PDITarget_SendByte(PDI_CMD_KEY);
\r
+ XPROGTarget_SendByte(PDI_CMD_KEY);
\r
for (uint8_t i = sizeof(PDI_NVMENABLE_KEY); i > 0; i--)
\r
for (uint8_t i = sizeof(PDI_NVMENABLE_KEY); i > 0; i--)
\r
-
PDI
Target_SendByte(PDI_NVMENABLE_KEY[i - 1]);
\r
+
XPROG
Target_SendByte(PDI_NVMENABLE_KEY[i - 1]);
\r
\r
/* Wait until the NVM bus becomes active */
\r
\r
/* Wait until the NVM bus becomes active */
\r
- NVMBusEnabled =
PDITarget
_WaitWhileNVMBusBusy();
\r
+ NVMBusEnabled =
XMEGANVM
_WaitWhileNVMBusBusy();
\r
}
\r
else
\r
{
\r
}
\r
else
\r
{
\r
- // TODO
\r
+ /* Enable TPI programming mode with the attached target */
\r
+ XPROGTarget_EnableTargetTPI();
\r
+
\r
+ // TODO - enable NVM bus via KEY
\r
}
\r
\r
Endpoint_Write_Byte(CMD_XPROG);
\r
}
\r
\r
Endpoint_Write_Byte(CMD_XPROG);
\r
@@
-149,14
+152,16
@@
static void XPROGProtocol_LeaveXPROGMode(void)
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
\r
{
\r
/* Clear the RESET key in the RESET PDI register to allow the XMEGA to run */
\r
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
\r
{
\r
/* Clear the RESET key in the RESET PDI register to allow the XMEGA to run */
\r
- PDITarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
-
PDI
Target_SendByte(0x00);
\r
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
\r
+
XPROG
Target_SendByte(0x00);
\r
\r
\r
-
PDI
Target_DisableTargetPDI();
\r
+
XPROG
Target_DisableTargetPDI();
\r
}
\r
else
\r
{
\r
}
\r
else
\r
{
\r
- // TODO
\r
+ // TODO - Disable TPI via register
\r
+
\r
+ XPROGTarget_DisableTargetTPI();
\r
}
\r
\r
Endpoint_Write_Byte(CMD_XPROG);
\r
}
\r
\r
Endpoint_Write_Byte(CMD_XPROG);
\r
@@
-381,7
+386,8
@@
static void XPROGProtocol_ReadCRC(void)
}
\r
else
\r
{
\r
}
\r
else
\r
{
\r
- // TODO
\r
+ /* TPI does not support memory CRC */
\r
+ ReturnStatus = XPRG_ERR_FAILED;
\r
}
\r
\r
Endpoint_Write_Byte(CMD_XPROG);
\r
}
\r
\r
Endpoint_Write_Byte(CMD_XPROG);
\r