Fix for error where USB host could send NAK, but isn't considered in jackdaw, resulting in jackdaw hanging
This commit is contained in:
parent
123c612614
commit
15ffaeed86
@ -210,13 +210,17 @@ uint8_t send_encapsulated_command(uint16_t wLength)
|
||||
|
||||
uint8_t nb_counter;
|
||||
|
||||
//Clear NAK bit
|
||||
Usb_ack_nak_in();
|
||||
|
||||
while (wLength) {
|
||||
nb_counter = EP_CONTROL_LENGTH;
|
||||
|
||||
//Wait for data to come in
|
||||
while (!(Is_usb_receive_out()));
|
||||
//Wait for data to come in or nak
|
||||
while((!Is_usb_receive_out()) & (!Is_usb_receive_nak_in()));
|
||||
|
||||
//Received OUT
|
||||
if (Is_usb_receive_out()) {
|
||||
while(nb_counter && wLength) {
|
||||
encapsulated_buffer[i] = Usb_read_byte();
|
||||
i++;
|
||||
@ -226,6 +230,11 @@ uint8_t send_encapsulated_command(uint16_t wLength)
|
||||
|
||||
Usb_ack_receive_out();
|
||||
|
||||
//Received NAK, no more data
|
||||
} else {
|
||||
Usb_ack_nak_in();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Usb_send_control_in();
|
||||
|
@ -530,6 +530,8 @@ typedef enum endpoint_parameter{ep_num, ep_type, ep_direction, ep_size, ep_bank,
|
||||
#define Usb_ack_nak_out() (UEINTX &= ~(1<<NAKOUTI))
|
||||
//! acks receive SETUP
|
||||
#define Usb_ack_receive_setup() (UEINTX &= ~(1<<RXSTPI))
|
||||
//! tests if NAK IN received
|
||||
#define Is_usb_receive_nak_in() (UEINTX &(1<<NAKINI))
|
||||
//! acks reveive OUT
|
||||
#define Usb_ack_receive_out() (UEINTX &= ~(1<<RXOUTI), Usb_ack_fifocon())
|
||||
//! acks STALL sent
|
||||
|
Loading…
Reference in New Issue
Block a user