diff options
Diffstat (limited to 'Projects/AVRISP')
-rw-r--r-- | Projects/AVRISP/AVRISP.c | 12 | ||||
-rw-r--r-- | Projects/AVRISP/Lib/V2Protocol.c | 8 | ||||
-rw-r--r-- | Projects/AVRISP/Lib/V2ProtocolParams.c | 4 | ||||
-rw-r--r-- | Projects/AVRISP/Lib/V2ProtocolTarget.c | 7 |
4 files changed, 14 insertions, 17 deletions
diff --git a/Projects/AVRISP/AVRISP.c b/Projects/AVRISP/AVRISP.c index 44b8356cd..4eb02d2bf 100644 --- a/Projects/AVRISP/AVRISP.c +++ b/Projects/AVRISP/AVRISP.c @@ -120,11 +120,11 @@ void Process_AVRISP_Commands(void) Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM);
- /* Check to see if a V2 Protocol command has been received - if not, abort */ - if (!(Endpoint_IsOUTReceived())) - return; - - /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */ - V2Protocol_ProcessCommand();
+ /* Check to see if a V2 Protocol command has been received */ + if (Endpoint_IsOUTReceived())
+ { + /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */ + V2Protocol_ProcessCommand();
+ }
} diff --git a/Projects/AVRISP/Lib/V2Protocol.c b/Projects/AVRISP/Lib/V2Protocol.c index 6099234fa..d7343aad6 100644 --- a/Projects/AVRISP/Lib/V2Protocol.c +++ b/Projects/AVRISP/Lib/V2Protocol.c @@ -301,11 +301,9 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command) uint8_t ProgrammingCommands[3];
uint8_t PollValue1;
uint8_t PollValue2;
- uint8_t ProgData[256];
- } Write_Memory_Params;
+ uint8_t ProgData[256]; // Note, the Jungo driver has a very short ACK timeout period, need to buffer the
+ } Write_Memory_Params; // whole page and ACK the packet as fast as possible to prevent it from aborting
- uint8_t* NextWriteByte = Write_Memory_Params.ProgData;
-
Endpoint_Read_Stream_LE(&Write_Memory_Params, sizeof(Write_Memory_Params) - sizeof(Write_Memory_Params.ProgData));
Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
@@ -329,6 +327,8 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command) uint16_t PollAddress = 0;
uint8_t PollValue = (V2Command == CMD_PROGRAM_FLASH_ISP) ? Write_Memory_Params.PollValue1 :
Write_Memory_Params.PollValue2;
+ uint8_t* NextWriteByte = Write_Memory_Params.ProgData;
+
if (Write_Memory_Params.ProgrammingMode & PROG_MODE_PAGED_WRITES_MASK)
{
uint16_t StartAddress = (CurrentAddress & 0xFFFF);
diff --git a/Projects/AVRISP/Lib/V2ProtocolParams.c b/Projects/AVRISP/Lib/V2ProtocolParams.c index 6aaa9558e..6b4568a94 100644 --- a/Projects/AVRISP/Lib/V2ProtocolParams.c +++ b/Projects/AVRISP/Lib/V2ProtocolParams.c @@ -132,7 +132,7 @@ uint8_t V2Params_GetParameterValue(uint8_t ParamID) {
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
- if (ParamInfo == NULL)
+ if ((ParamInfo == NULL) || !(ParamInfo->ParamPrivellages & PARAM_PRIV_READ))
return 0;
return ParamInfo->ParamValue;
@@ -149,7 +149,7 @@ void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value) {
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
- if (ParamInfo == NULL)
+ if ((ParamInfo == NULL) || !(ParamInfo->ParamPrivellages & PARAM_PRIV_WRITE))
return;
ParamInfo->ParamValue = Value;
diff --git a/Projects/AVRISP/Lib/V2ProtocolTarget.c b/Projects/AVRISP/Lib/V2ProtocolTarget.c index 9f8978a70..169e49ac7 100644 --- a/Projects/AVRISP/Lib/V2ProtocolTarget.c +++ b/Projects/AVRISP/Lib/V2ProtocolTarget.c @@ -85,7 +85,7 @@ void V2Protocol_ChangeTargetResetLine(bool ResetTarget) {
if (ResetTarget)
{
- RESET_LINE_DDR |= RESET_LINE_MASK;
+ RESET_LINE_DDR |= RESET_LINE_MASK;
if (!(V2Params_GetParameterValue(PARAM_RESET_POLARITY)))
RESET_LINE_PORT |= RESET_LINE_MASK;
@@ -155,17 +155,14 @@ uint8_t V2Protocol_WaitWhileTargetBusy(void) {
TCNT0 = 0;
- bool DeviceBusy;
-
do
{
SPI_SendByte(0xF0);
SPI_SendByte(0x00);
SPI_SendByte(0x00);
- DeviceBusy = (SPI_ReceiveByte() & 0x01);
}
- while (DeviceBusy && (TCNT0 < TARGET_BUSY_TIMEOUT_MS));
+ while ((SPI_ReceiveByte() & 0x01) && (TCNT0 < TARGET_BUSY_TIMEOUT_MS));
if (TCNT0 >= TARGET_BUSY_TIMEOUT_MS)
return STATUS_RDY_BSY_TOUT;
|