From b73dd01f2c36abcaddcdeb07ae5b929ba3d7933a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Wed, 14 Dec 2011 15:31:27 +0000 Subject: [PATCH] usb-s3c6400: fix confusion between USB_DIR_IN and DIR_IN usb_drv_request_endpoint() would return an endpoint with the other direction git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31248 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/usb-s3c6400x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c index 018694ae12..e65395dfd9 100644 --- a/firmware/target/arm/usb-s3c6400x.c +++ b/firmware/target/arm/usb-s3c6400x.c @@ -106,11 +106,12 @@ static void reset_endpoints(int reinit) int usb_drv_request_endpoint(int type, int dir) { - for(size_t ep = (dir == USB_DIR_IN) ? 1 : 2; ep < USB_NUM_ENDPOINTS; ep += 2) + bool out = dir == USB_DIR_OUT; + for(size_t ep = out ? 2 : 1; ep < USB_NUM_ENDPOINTS; ep += 2) if (!endpoints[ep].active) { endpoints[ep].active = true; - DEPCTL(ep, !dir) = (DEPCTL(ep, !dir) & ~(DEPCTL_eptype_bits << DEPCTL_eptype_bitp)) | + DEPCTL(ep, out) = (DEPCTL(ep, out) & ~(DEPCTL_eptype_bits << DEPCTL_eptype_bitp)) | (type << DEPCTL_eptype_bitp) | DEPCTL_epena; return ep | dir; }