Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
c647c276
Commit
c647c276
authored
Nov 09, 2009
by
Dean Camera
Browse files
Minor changes to the AVRISP project for code clarity.
parent
8bb007f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Projects/AVRISP/AVRISP.c
View file @
c647c276
...
@@ -120,11 +120,11 @@ void Process_AVRISP_Commands(void)
...
@@ -120,11 +120,11 @@ void Process_AVRISP_Commands(void)
Endpoint_SelectEndpoint
(
AVRISP_DATA_EPNUM
);
Endpoint_SelectEndpoint
(
AVRISP_DATA_EPNUM
);
/* Check to see if a V2 Protocol command has been received
- if not, abort
*/
/* Check to see if a V2 Protocol command has been received */
if
(
!
(
Endpoint_IsOUTReceived
())
)
if
(
Endpoint_IsOUTReceived
())
return
;
{
/* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
/* Pass off processing of the
V2
Protocol
command to the V2 Protocol handler */
V2Protocol
_ProcessCommand
();
V2Protocol_ProcessCommand
();
}
}
}
Projects/AVRISP/Lib/V2Protocol.c
View file @
c647c276
...
@@ -301,11 +301,9 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command)
...
@@ -301,11 +301,9 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command)
uint8_t
ProgrammingCommands
[
3
];
uint8_t
ProgrammingCommands
[
3
];
uint8_t
PollValue1
;
uint8_t
PollValue1
;
uint8_t
PollValue2
;
uint8_t
PollValue2
;
uint8_t
ProgData
[
256
];
uint8_t
ProgData
[
256
];
// Note, the Jungo driver has a very short ACK timeout period, need to buffer the
}
Write_Memory_Params
;
}
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
));
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
);
Write_Memory_Params
.
BytesToWrite
=
SwapEndian_16
(
Write_Memory_Params
.
BytesToWrite
);
...
@@ -329,6 +327,8 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command)
...
@@ -329,6 +327,8 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command)
uint16_t
PollAddress
=
0
;
uint16_t
PollAddress
=
0
;
uint8_t
PollValue
=
(
V2Command
==
CMD_PROGRAM_FLASH_ISP
)
?
Write_Memory_Params
.
PollValue1
:
uint8_t
PollValue
=
(
V2Command
==
CMD_PROGRAM_FLASH_ISP
)
?
Write_Memory_Params
.
PollValue1
:
Write_Memory_Params
.
PollValue2
;
Write_Memory_Params
.
PollValue2
;
uint8_t
*
NextWriteByte
=
Write_Memory_Params
.
ProgData
;
if
(
Write_Memory_Params
.
ProgrammingMode
&
PROG_MODE_PAGED_WRITES_MASK
)
if
(
Write_Memory_Params
.
ProgrammingMode
&
PROG_MODE_PAGED_WRITES_MASK
)
{
{
uint16_t
StartAddress
=
(
CurrentAddress
&
0xFFFF
);
uint16_t
StartAddress
=
(
CurrentAddress
&
0xFFFF
);
...
...
Projects/AVRISP/Lib/V2ProtocolParams.c
View file @
c647c276
...
@@ -132,7 +132,7 @@ uint8_t V2Params_GetParameterValue(uint8_t ParamID)
...
@@ -132,7 +132,7 @@ uint8_t V2Params_GetParameterValue(uint8_t ParamID)
{
{
ParameterItem_t
*
ParamInfo
=
V2Params_GetParamFromTable
(
ParamID
);
ParameterItem_t
*
ParamInfo
=
V2Params_GetParamFromTable
(
ParamID
);
if
(
ParamInfo
==
NULL
)
if
(
(
ParamInfo
==
NULL
)
||
!
(
ParamInfo
->
ParamPrivellages
&
PARAM_PRIV_READ
))
return
0
;
return
0
;
return
ParamInfo
->
ParamValue
;
return
ParamInfo
->
ParamValue
;
...
@@ -149,7 +149,7 @@ void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value)
...
@@ -149,7 +149,7 @@ void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value)
{
{
ParameterItem_t
*
ParamInfo
=
V2Params_GetParamFromTable
(
ParamID
);
ParameterItem_t
*
ParamInfo
=
V2Params_GetParamFromTable
(
ParamID
);
if
(
ParamInfo
==
NULL
)
if
(
(
ParamInfo
==
NULL
)
||
!
(
ParamInfo
->
ParamPrivellages
&
PARAM_PRIV_WRITE
))
return
;
return
;
ParamInfo
->
ParamValue
=
Value
;
ParamInfo
->
ParamValue
=
Value
;
...
...
Projects/AVRISP/Lib/V2ProtocolTarget.c
View file @
c647c276
...
@@ -85,7 +85,7 @@ void V2Protocol_ChangeTargetResetLine(bool ResetTarget)
...
@@ -85,7 +85,7 @@ void V2Protocol_ChangeTargetResetLine(bool ResetTarget)
{
{
if
(
ResetTarget
)
if
(
ResetTarget
)
{
{
RESET_LINE_DDR
|=
RESET_LINE_MASK
;
RESET_LINE_DDR
|=
RESET_LINE_MASK
;
if
(
!
(
V2Params_GetParameterValue
(
PARAM_RESET_POLARITY
)))
if
(
!
(
V2Params_GetParameterValue
(
PARAM_RESET_POLARITY
)))
RESET_LINE_PORT
|=
RESET_LINE_MASK
;
RESET_LINE_PORT
|=
RESET_LINE_MASK
;
...
@@ -155,17 +155,14 @@ uint8_t V2Protocol_WaitWhileTargetBusy(void)
...
@@ -155,17 +155,14 @@ uint8_t V2Protocol_WaitWhileTargetBusy(void)
{
{
TCNT0
=
0
;
TCNT0
=
0
;
bool
DeviceBusy
;
do
do
{
{
SPI_SendByte
(
0xF0
);
SPI_SendByte
(
0xF0
);
SPI_SendByte
(
0x00
);
SPI_SendByte
(
0x00
);
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
)
if
(
TCNT0
>=
TARGET_BUSY_TIMEOUT_MS
)
return
STATUS_RDY_BSY_TOUT
;
return
STATUS_RDY_BSY_TOUT
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment