# HG changeset patch # User jlarmour # Date 1157632714 0 # Node ID dcfe5eba9ea764b971f774d8d0c5435d3409ec8f # Parent d2e08e32ef0440b56ef07642256b13fce688cdfb * cdl/usbs_at91.c: Read actual EP addresses from the EP configuartion rather than relying on the order in the configuration list. diff --git a/packages/devs/usb/at91/current/ChangeLog b/packages/devs/usb/at91/current/ChangeLog --- a/packages/devs/usb/at91/current/ChangeLog +++ b/packages/devs/usb/at91/current/ChangeLog @@ -1,3 +1,8 @@ +2006-09-07 John Eigelaar + + * cdl/usbs_at91.c: Read actual EP addresses from the EP configuartion + rather than relying on the order in the configuration list. + 2006-06-06 Andrew Lunn * cdl/usbs_at91.cdl: Allow EP0 to be enabled when there are no diff --git a/packages/devs/usb/at91/current/src/usbs_at91.c b/packages/devs/usb/at91/current/src/usbs_at91.c --- a/packages/devs/usb/at91/current/src/usbs_at91.c +++ b/packages/devs/usb/at91/current/src/usbs_at91.c @@ -472,6 +472,8 @@ usbs_at91_handle_reset (void) const usb_endpoint_descriptor *usb_endpoints; cyg_uint8 endpoint_type; + cyg_uint8 endpoint_number; + usbs_end_all_transfers (-EPIPE); HAL_WRITE_UINT32 (AT91_UDP + AT91_UDP_IDR, 0xffffffff); @@ -502,9 +504,13 @@ usbs_at91_handle_reset (void) USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN ? USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_OUT)); - usbs_at91_endpoint_init((usbs_rx_endpoint *)usbs_at91_endpoints[epn], - endpoint_type, - true); + endpoint_number = usb_endpoints[epn-1].endpoint & ~(USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN); + if ( endpoint_number < AT91_USB_ENDPOINTS ) + { + usbs_at91_endpoint_init((usbs_rx_endpoint *)usbs_at91_endpoints[endpoint_number], + endpoint_type, + true); + } } }