projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Device mode class driver callbacks are now fired before the control request status...
[pub/USBasp.git]
/
Projects
/
AVRISP-MKII
/
Lib
/
V2Protocol.c
diff --git
a/Projects/AVRISP-MKII/Lib/V2Protocol.c
b/Projects/AVRISP-MKII/Lib/V2Protocol.c
index
8d8f200
..
096551d
100644
(file)
--- a/
Projects/AVRISP-MKII/Lib/V2Protocol.c
+++ b/
Projects/AVRISP-MKII/Lib/V2Protocol.c
@@
-43,8
+43,8
@@
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
+/** ISR
to manage timeouts whilst processing a V2Protocol command
*/
\r
+ISR(TIMER0_COMPA_vect, ISR_
NO
BLOCK)
\r
{
\r
if (TimeoutMSRemaining)
\r
TimeoutMSRemaining--;
\r
{
\r
if (TimeoutMSRemaining)
\r
TimeoutMSRemaining--;
\r
@@
-63,7
+63,7
@@
void V2Protocol_Init(void)
/* Millisecond timer initialization for managing the command timeout counter */
\r
OCR0A = ((F_CPU / 64) / 1000);
\r
TCCR0A = (1 << WGM01);
\r
/* Millisecond timer initialization for managing the command timeout counter */
\r
OCR0A = ((F_CPU / 64) / 1000);
\r
TCCR0A = (1 << WGM01);
\r
- T
CCR0B = ((1 << CS01) | (1 << CS00)
);
\r
+ T
IMSK0 = (1 << OCIE0A
);
\r
\r
V2Params_LoadNonVolatileParamValues();
\r
}
\r
\r
V2Params_LoadNonVolatileParamValues();
\r
}
\r
@@
-76,10
+76,10
@@
void V2Protocol_ProcessCommand(void)
{
\r
uint8_t V2Command = Endpoint_Read_Byte();
\r
\r
{
\r
uint8_t V2Command = Endpoint_Read_Byte();
\r
\r
- /* S
et total command processing timeout value, enable timeout management interrupt
*/
\r
+ /* S
tart the timeout management timer
*/
\r
TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
\r
TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
\r
- T
IMSK0 |= (1 << OCIE0A
);
\r
-
\r
+ T
CCR0B = ((1 << CS01) | (1 << CS00)
);
\r
+
\r
switch (V2Command)
\r
{
\r
case CMD_SIGN_ON:
\r
switch (V2Command)
\r
{
\r
case CMD_SIGN_ON:
\r
@@
-139,11
+139,12
@@
void V2Protocol_ProcessCommand(void)
V2Protocol_UnknownCommand(V2Command);
\r
break;
\r
}
\r
V2Protocol_UnknownCommand(V2Command);
\r
break;
\r
}
\r
-
\r
- /* Disable t
imeout management interrupt once processing has completed
*/
\r
- T
IMSK0 &= ~(1 << OCIE0A)
;
\r
+
\r
+ /* Disable t
he timeout management timer
*/
\r
+ T
CCR0B = 0
;
\r
\r
Endpoint_WaitUntilReady();
\r
\r
Endpoint_WaitUntilReady();
\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
\r
}
\r
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
\r
}
\r
\r
@@
-162,6
+163,7
@@
static void V2Protocol_UnknownCommand(const uint8_t V2Command)
}
\r
\r
Endpoint_ClearOUT();
\r
}
\r
\r
Endpoint_ClearOUT();
\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(V2Command);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(V2Command);
\r
@@
-173,6
+175,7
@@
static void V2Protocol_UnknownCommand(const uint8_t V2Command)
static void V2Protocol_SignOn(void)
\r
{
\r
Endpoint_ClearOUT();
\r
static void V2Protocol_SignOn(void)
\r
{
\r
Endpoint_ClearOUT();
\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(CMD_SIGN_ON);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(CMD_SIGN_ON);
\r
@@
-188,6
+191,7
@@
static void V2Protocol_SignOn(void)
static void V2Protocol_ResetProtection(void)
\r
{
\r
Endpoint_ClearOUT();
\r
static void V2Protocol_ResetProtection(void)
\r
{
\r
Endpoint_ClearOUT();
\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(CMD_RESET_PROTECTION);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(CMD_RESET_PROTECTION);
\r
@@
-210,6
+214,7
@@
static void V2Protocol_GetSetParam(const uint8_t V2Command)
ParamValue = Endpoint_Read_Byte();
\r
\r
Endpoint_ClearOUT();
\r
ParamValue = Endpoint_Read_Byte();
\r
\r
Endpoint_ClearOUT();
\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(V2Command);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
Endpoint_Write_Byte(V2Command);
\r
@@
-243,6
+248,7
@@
static void V2Protocol_LoadAddress(void)
Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NO_STREAM_CALLBACK);
\r
\r
Endpoint_ClearOUT();
\r
Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NO_STREAM_CALLBACK);
\r
\r
Endpoint_ClearOUT();
\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
MustSetAddress = true;
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
\r
MustSetAddress = true;
\r