Commit ce044844 authored by Dean Camera's avatar Dean Camera
Browse files

Combine AVRISP project TPI and PDI lib directories - these protocols use the...

Combine AVRISP project TPI and PDI lib directories - these protocols use the same underlying XPROG wrapper for the host-to-programmer command wrapping.
parent 26bc1f3c
This diff is collapsed.
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
* -# Add ability to get number of bytes not written with pipe/endpoint write routines after an error * -# Add ability to get number of bytes not written with pipe/endpoint write routines after an error
* -# Add standardized descriptor names to class driver structures * -# Add standardized descriptor names to class driver structures
* -# Correct mishandling of error cases in Mass Storage demos * -# Correct mishandling of error cases in Mass Storage demos
* -# Add TPI programming support to the AVRISP project
* - Documentation/Support * - Documentation/Support
* -# Remake AVRStudio project files * -# Remake AVRStudio project files
* -# Add detailed overviews of how each demo works * -# Add detailed overviews of how each demo works
......
...@@ -70,6 +70,7 @@ void SetupHardware(void) ...@@ -70,6 +70,7 @@ void SetupHardware(void)
/* Hardware Initialization */ /* Hardware Initialization */
LEDs_Init(); LEDs_Init();
USB_Init(); USB_Init();
Serial_Init(9600, true);
#if defined(ADC) #if defined(ADC)
/* Initialize the ADC converter for VTARGET level detection on supported AVR models */ /* Initialize the ADC converter for VTARGET level detection on supported AVR models */
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "Descriptors.h" #include "Descriptors.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
......
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
* <tr> * <tr>
* <td><b>Programmer Pin:</b></td> * <td><b>Programmer Pin:</b></td>
* <td><b>Target Device Pin:</b></td> * <td><b>Target Device Pin:</b></td>
* <td><b>PDI 6 Pin Layout:</b></td> * <td><b>TPI 6 Pin Layout:</b></td>
* </tr> * </tr>
* <tr> * <tr>
* <td>MISO</td> * <td>MISO</td>
......
...@@ -51,6 +51,8 @@ void V2Protocol_ProcessCommand(void) ...@@ -51,6 +51,8 @@ void V2Protocol_ProcessCommand(void)
{ {
uint8_t V2Command = Endpoint_Read_Byte(); uint8_t V2Command = Endpoint_Read_Byte();
Serial_TxByte(V2Command);
switch (V2Command) switch (V2Command)
{ {
case CMD_SIGN_ON: case CMD_SIGN_ON:
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
/* Includes: */ /* Includes: */
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SPI.h> #include <LUFA/Drivers/Peripheral/SPI.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
#include "../Descriptors.h" #include "../Descriptors.h"
#include "V2ProtocolConstants.h" #include "V2ProtocolConstants.h"
......
...@@ -58,6 +58,8 @@ void PDIProtocol_XPROG_SetMode(void) ...@@ -58,6 +58,8 @@ void PDIProtocol_XPROG_SetMode(void)
Endpoint_ClearOUT(); Endpoint_ClearOUT();
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN); Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Serial_TxByte(SetMode_XPROG_Params.Protocol);
Endpoint_Write_Byte(CMD_XPROG_SETMODE); Endpoint_Write_Byte(CMD_XPROG_SETMODE);
Endpoint_Write_Byte((SetMode_XPROG_Params.Protocol == XPRG_PROTOCOL_PDI) ? STATUS_CMD_OK : STATUS_CMD_FAILED); Endpoint_Write_Byte((SetMode_XPROG_Params.Protocol == XPRG_PROTOCOL_PDI) ? STATUS_CMD_OK : STATUS_CMD_FAILED);
Endpoint_ClearIN(); Endpoint_ClearIN();
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
#define XPRG_PROTOCOL_PDI 0x00 #define XPRG_PROTOCOL_PDI 0x00
#define XPRG_PROTOCOL_JTAG 0x01 #define XPRG_PROTOCOL_JTAG 0x01
#define XPRG_PROTOCOL_TPI 0x02
#define XPRG_PAGEMODE_WRITE (1 << 1) #define XPRG_PAGEMODE_WRITE (1 << 1)
#define XPRG_PAGEMODE_ERASE (1 << 0) #define XPRG_PAGEMODE_ERASE (1 << 0)
......
...@@ -320,7 +320,7 @@ bool TPITarget_WaitWhileNVMBusBusy(void) ...@@ -320,7 +320,7 @@ bool TPITarget_WaitWhileNVMBusBusy(void)
/* Poll the STATUS register to check to see if NVM access has been enabled */ /* Poll the STATUS register to check to see if NVM access has been enabled */
while (TimeoutMS) while (TimeoutMS)
{ {
/* Send the LDCS command to read the TPI STATUS register to see the NVM bus is active */ /* Send the SLDCS command to read the TPI STATUS register to see the NVM bus is active */
TPITarget_SendByte(TPI_CMD_SLDCS | TPI_STATUS_REG); TPITarget_SendByte(TPI_CMD_SLDCS | TPI_STATUS_REG);
if (TPITarget_ReceiveByte() & TPI_STATUS_NVM) if (TPITarget_ReceiveByte() & TPI_STATUS_NVM)
return true; return true;
......
...@@ -131,12 +131,13 @@ SRC = $(TARGET).c \ ...@@ -131,12 +131,13 @@ SRC = $(TARGET).c \
Lib/V2ProtocolParams.c \ Lib/V2ProtocolParams.c \
Lib/ISP/ISPProtocol.c \ Lib/ISP/ISPProtocol.c \
Lib/ISP/ISPTarget.c \ Lib/ISP/ISPTarget.c \
Lib/PDI/PDIProtocol.c \ Lib/XPROG/PDIProtocol.c \
Lib/PDI/PDITarget.c \ Lib/XPROG/PDITarget.c \
Lib/PDI/XMEGANVM.c \ Lib/XPROG/XMEGANVM.c \
Lib/TPI/TPIProtocol.c \ Lib/XPROG/TPIProtocol.c \
Lib/TPI/TPITarget.c \ Lib/XPROG/TPITarget.c \
Lib/TPI/TINYNVM.c \ Lib/XPROG/TINYNVM.c \
$(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment