X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/a9602f02509432e2a0e531b33d491558b69c14d8..2f95eea14689d30a3172a7e1e30980072bf23fac:/Projects/Unfinished/AVRISP/Lib/V2Protocol.c diff --git a/Projects/Unfinished/AVRISP/Lib/V2Protocol.c b/Projects/Unfinished/AVRISP/Lib/V2Protocol.c index dfa27ad9e..e55a7002e 100644 --- a/Projects/Unfinished/AVRISP/Lib/V2Protocol.c +++ b/Projects/Unfinished/AVRISP/Lib/V2Protocol.c @@ -36,6 +36,9 @@ #define INCLUDE_FROM_V2PROTOCOL_C #include "V2Protocol.h" +uint32_t CurrentAddress; + + /* Table of masks for SPI_Init() from a given PARAM_SCK_DURATION value */ static const uint8_t SPIMaskFromSCKDuration[MAX_SPI_SETTINGS] = { @@ -88,6 +91,9 @@ void V2Protocol_ProcessCommand(void) case CMD_GET_PARAMETER: V2Protocol_Command_GetSetParam(V2Command); break; + case CMD_LOAD_ADDRESS: + V2Protocol_Command_LoadAddress(); + break; case CMD_SPI_MULTI: V2Protocol_Command_SPIMulti(); break; @@ -127,6 +133,7 @@ static void V2Protocol_Command_SignOn(void) Endpoint_WaitUntilReady(); V2Protocol_ReconfigureSPI(); + CurrentAddress = 0; Endpoint_Write_Byte(CMD_SIGN_ON); Endpoint_Write_Byte(STATUS_CMD_OK); @@ -166,6 +173,19 @@ static void V2Protocol_Command_GetSetParam(uint8_t V2Command) Endpoint_ClearIN(); } +static void V2Protocol_Command_LoadAddress(void) +{ + CurrentAddress = Endpoint_Read_DWord_LE(); + + Endpoint_ClearOUT(); + Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN); + Endpoint_WaitUntilReady(); + + Endpoint_Write_Byte(CMD_LOAD_ADDRESS); + Endpoint_Write_Byte(STATUS_CMD_OK); + Endpoint_ClearIN(); +} + static void V2Protocol_Command_SPIMulti(void) { uint8_t TxBytes = Endpoint_Read_Byte();