projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added const where possible to the source functions in the Projects directory.
[pub/USBasp.git]
/
Projects
/
AVRISP
/
Lib
/
V2Protocol.c
diff --git
a/Projects/AVRISP/Lib/V2Protocol.c
b/Projects/AVRISP/Lib/V2Protocol.c
index
24f2080
..
4fcb5aa
100644
(file)
--- a/
Projects/AVRISP/Lib/V2Protocol.c
+++ b/
Projects/AVRISP/Lib/V2Protocol.c
@@
-43,6
+43,13
@@
uint32_t CurrentAddress;
bool MustSetAddress;
\r
\r
\r
bool MustSetAddress;
\r
\r
\r
+/** ISR for the management of the command execution timeout counter */
\r
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
\r
+{
\r
+ if (TimeoutMSRemaining)
\r
+ TimeoutMSRemaining--;
\r
+}
\r
+
\r
/** Master V2 Protocol packet handler, for received V2 Protocol packets from a connected host.
\r
* This routine decodes the issued command and passes off the handling of the command to the
\r
* appropriate function.
\r
/** Master V2 Protocol packet handler, for received V2 Protocol packets from a connected host.
\r
* This routine decodes the issued command and passes off the handling of the command to the
\r
* appropriate function.
\r
@@
-50,7
+57,10
@@
bool MustSetAddress;
void V2Protocol_ProcessCommand(void)
\r
{
\r
uint8_t V2Command = Endpoint_Read_Byte();
\r
void V2Protocol_ProcessCommand(void)
\r
{
\r
uint8_t V2Command = Endpoint_Read_Byte();
\r
-
\r
+
\r
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
\r
+ TIMSK0 |= (1 << OCIE0A);
\r
+
\r
switch (V2Command)
\r
{
\r
case CMD_SIGN_ON:
\r
switch (V2Command)
\r
{
\r
case CMD_SIGN_ON:
\r
@@
-66,7
+76,7
@@
void V2Protocol_ProcessCommand(void)
case CMD_RESET_PROTECTION:
\r
V2Protocol_ResetProtection();
\r
break;
\r
case CMD_RESET_PROTECTION:
\r
V2Protocol_ResetProtection();
\r
break;
\r
-#if defined(ENABLE_
SPI
_PROTOCOL)
\r
+#if defined(ENABLE_
ISP
_PROTOCOL)
\r
case CMD_ENTER_PROGMODE_ISP:
\r
ISPProtocol_EnterISPMode();
\r
break;
\r
case CMD_ENTER_PROGMODE_ISP:
\r
ISPProtocol_EnterISPMode();
\r
break;
\r
@@
-100,17
+110,19
@@
void V2Protocol_ProcessCommand(void)
#endif
\r
#if defined(ENABLE_XPROG_PROTOCOL)
\r
case CMD_XPROG_SETMODE:
\r
#endif
\r
#if defined(ENABLE_XPROG_PROTOCOL)
\r
case CMD_XPROG_SETMODE:
\r
-
PDIProtocol_XPROG
_SetMode();
\r
+
XPROGProtocol
_SetMode();
\r
break;
\r
case CMD_XPROG:
\r
break;
\r
case CMD_XPROG:
\r
-
PDIProtocol_XPROG
_Command();
\r
+
XPROGProtocol
_Command();
\r
break;
\r
#endif
\r
default:
\r
V2Protocol_UnknownCommand(V2Command);
\r
break;
\r
}
\r
break;
\r
#endif
\r
default:
\r
V2Protocol_UnknownCommand(V2Command);
\r
break;
\r
}
\r
-
\r
+
\r
+ TIMSK0 &= ~(1 << OCIE0A);
\r
+
\r
Endpoint_WaitUntilReady();
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
\r
}
\r
Endpoint_WaitUntilReady();
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
\r
}
\r
@@
-120,7
+132,7
@@
void V2Protocol_ProcessCommand(void)
*
\r
* \param[in] V2Command Issued V2 Protocol command byte from the host
\r
*/
\r
*
\r
* \param[in] V2Command Issued V2 Protocol command byte from the host
\r
*/
\r
-static void V2Protocol_UnknownCommand(uint8_t V2Command)
\r
+static void V2Protocol_UnknownCommand(
const
uint8_t V2Command)
\r
{
\r
/* Discard all incoming data */
\r
while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
\r
{
\r
/* Discard all incoming data */
\r
while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
\r
@@
-169,7
+181,7
@@
static void V2Protocol_ResetProtection(void)
*
\r
* \param[in] V2Command Issued V2 Protocol command byte from the host
\r
*/
\r
*
\r
* \param[in] V2Command Issued V2 Protocol command byte from the host
\r
*/
\r
-static void V2Protocol_GetSetParam(uint8_t V2Command)
\r
+static void V2Protocol_GetSetParam(
const
uint8_t V2Command)
\r
{
\r
uint8_t ParamID = Endpoint_Read_Byte();
\r
uint8_t ParamValue;
\r
{
\r
uint8_t ParamID = Endpoint_Read_Byte();
\r
uint8_t ParamValue;
\r