From d048c324b31c685b6123098b415222b4ee6699bc Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 11 Jul 2008 06:45:36 +0000 Subject: Fix BCSP sent/receive handling --- tools/csr_bcsp.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/csr_bcsp.c b/tools/csr_bcsp.c index 0dc334cb..bcf56a35 100644 --- a/tools/csr_bcsp.c +++ b/tools/csr_bcsp.c @@ -188,19 +188,6 @@ static int do_command(uint16_t command, uint16_t seqnum, uint16_t varid, uint8_t while (1) { delay = ubcsp_poll(&activity); - if (activity & UBCSP_PACKET_RECEIVED) { - if (sent && receive_packet.channel == 5 && - receive_packet.payload[0] == 0xff) { - memcpy(rp, receive_packet.payload, - receive_packet.length); - break; - } - - receive_packet.length = 512; - ubcsp_receive_packet(&receive_packet); - timeout = 0; - } - if (activity & UBCSP_PACKET_SENT) { switch (varid) { case CSR_VARID_COLD_RESET: @@ -214,6 +201,19 @@ static int do_command(uint16_t command, uint16_t seqnum, uint16_t varid, uint8_t timeout = 0; } + if (activity & UBCSP_PACKET_RECEIVED) { + if (sent && receive_packet.channel == 5 && + receive_packet.payload[0] == 0xff) { + memcpy(rp, receive_packet.payload, + receive_packet.length); + break; + } + + receive_packet.length = 512; + ubcsp_receive_packet(&receive_packet); + timeout = 0; + } + if (delay) { usleep(delay * 100); -- cgit