summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/usb-s3c6400x.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c
index 018694a..e65395d 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;
}