projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change spinloop in the AVRISP project Unknown V2 Protocol Command handler to use...
[pub/USBasp.git]
/
Projects
/
Unfinished
/
AVRISP
/
Lib
/
V2Protocol.c
diff --git
a/Projects/Unfinished/AVRISP/Lib/V2Protocol.c
b/Projects/Unfinished/AVRISP/Lib/V2Protocol.c
index
4038892
..
dfa27ad
100644
(file)
--- a/
Projects/Unfinished/AVRISP/Lib/V2Protocol.c
+++ b/
Projects/Unfinished/AVRISP/Lib/V2Protocol.c
@@
-103,15
+103,17
@@
void V2Protocol_ProcessCommand(void)
}
\r
static void V2Protocol_Command_Unknown(uint8_t V2Command)
\r
}
\r
static void V2Protocol_Command_Unknown(uint8_t V2Command)
\r
-{
\r
+{
\r
+ /* Discard all incomming data */
\r
while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
\r
{
\r
Endpoint_ClearOUT();
\r
while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
\r
{
\r
Endpoint_ClearOUT();
\r
-
while (!(Endpoint_IsOUTReceived())
);
\r
+
Endpoint_WaitUntilReady(
);
\r
}
\r
\r
Endpoint_ClearOUT();
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
}
\r
\r
Endpoint_ClearOUT();
\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
\r
+ Endpoint_WaitUntilReady();
\r
\r
Endpoint_Write_Byte(V2Command);
\r
Endpoint_Write_Byte(STATUS_CMD_UNKNOWN);
\r
\r
Endpoint_Write_Byte(V2Command);
\r
Endpoint_Write_Byte(STATUS_CMD_UNKNOWN);
\r
@@
-166,8
+168,8
@@
static void V2Protocol_Command_GetSetParam(uint8_t V2Command)
\r
static void V2Protocol_Command_SPIMulti(void)
\r
{
\r
\r
static void V2Protocol_Command_SPIMulti(void)
\r
{
\r
- uint8_t TxBytes = Endpoint_Read_Byte();
\r
- uint8_t RxBytes = Endpoint_Read_Byte();
\r
+ uint8_t TxBytes
= Endpoint_Read_Byte();
\r
+ uint8_t RxBytes
= Endpoint_Read_Byte();
\r
uint8_t RxStartAddr = Endpoint_Read_Byte();
\r
uint8_t TxData[255];
\r
\r
uint8_t RxStartAddr = Endpoint_Read_Byte();
\r
uint8_t TxData[255];
\r
\r
@@
-183,6
+185,7
@@
static void V2Protocol_Command_SPIMulti(void)
uint8_t CurrTxPos = 0;
\r
uint8_t CurrRxPos = 0;
\r
\r
uint8_t CurrTxPos = 0;
\r
uint8_t CurrRxPos = 0;
\r
\r
+ /* Write out bytes to transmit until the start of the bytes to receive is met */
\r
while (CurrTxPos < RxStartAddr)
\r
{
\r
if (CurrTxPos < TxBytes)
\r
while (CurrTxPos < RxStartAddr)
\r
{
\r
if (CurrTxPos < TxBytes)
\r
@@
-193,6
+196,7
@@
static void V2Protocol_Command_SPIMulti(void)
CurrTxPos++;
\r
}
\r
\r
CurrTxPos++;
\r
}
\r
\r
+ /* Transmit remaining bytes with padding as needed, read in response bytes */
\r
while (CurrRxPos < RxBytes)
\r
{
\r
if (CurrTxPos < TxBytes)
\r
while (CurrRxPos < RxBytes)
\r
{
\r
if (CurrTxPos < TxBytes)
\r