From 5c81130b488fcf7193c65efc80a82aee6abf5edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Tue, 13 Dec 2011 06:29:56 +0000 Subject: usb-drv-as3525v2: don't include ep0 twice in the IN ep list simplify git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31225 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/usb-drv-as3525v2.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'firmware/target/arm/as3525') diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c index b9030b850a..c8557297c2 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525v2.c +++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c @@ -38,14 +38,9 @@ /* Number of IN/OUT endpoints */ #define NUM_IN_EP 3 -#define NUM_OUT_EP 2 -/* List of IN enpoints */ -#define IN_EP_LIST 0, 3, 5 -#define OUT_EP_LIST 2, 4 - -static const uint8_t in_ep_list[NUM_IN_EP + 1] = {0, IN_EP_LIST}; -static const uint8_t out_ep_list[NUM_OUT_EP + 1] = {0, OUT_EP_LIST}; +static const uint8_t in_ep_list[NUM_IN_EP + 1] = {0, 3, 5}; +static const uint8_t out_ep_list[] = {0, 2, 4}; /* iterate through each in/out ep except EP0 * 'i' is the counter, 'ep' is the actual value */ @@ -54,16 +49,16 @@ static const uint8_t out_ep_list[NUM_OUT_EP + 1] = {0, OUT_EP_LIST}; i < (sizeof(list)/sizeof(*list)); \ i++, ep = list[i]) -#define FOR_EACH_IN_EP_EX(include_ep0, i, ep) \ - FOR_EACH_EP(in_ep_list, (include_ep0) ? 0 : 1, i, ep) +#define FOR_EACH_IN_EP(include_ep0, i, ep) \ + FOR_EACH_EP(in_ep_list, !include_ep0, i, ep) -#define FOR_EACH_OUT_EP_EX(include_ep0, i, ep) \ - FOR_EACH_EP(out_ep_list, (include_ep0) ? 0 : 1, i, ep) +#define FOR_EACH_OUT_EP(include_ep0, i, ep) \ + FOR_EACH_EP(out_ep_list, !include_ep0, i, ep) -#define FOR_EACH_IN_EP(i, ep) FOR_EACH_IN_EP_EX (false, i, ep) -#define FOR_EACH_IN_EP_AND_EP0(i, ep) FOR_EACH_IN_EP_EX (true, i, ep) -#define FOR_EACH_OUT_EP(i, ep) FOR_EACH_OUT_EP_EX(false, i, ep) -#define FOR_EACH_OUT_EP_AND_EP0(i, ep) FOR_EACH_OUT_EP_EX(true, i, ep) +#define FOR_EACH_IN_EP(i, ep) FOR_EACH_IN_EP(false, i, ep) +#define FOR_EACH_IN_EP_AND_EP0(i, ep) FOR_EACH_IN_EP(true, i, ep) +#define FOR_EACH_OUT_EP(i, ep) FOR_EACH_OUT_EP(false, i, ep) +#define FOR_EACH_OUT_EP_AND_EP0(i, ep) FOR_EACH_OUT_EP(true, i, ep) /* store per endpoint, per direction, information */ struct usb_endpoint @@ -328,7 +323,7 @@ static void reset_endpoints(void) /* Setup next chain for IN eps */ FOR_EACH_IN_EP_AND_EP0(i, ep) { - int next_ep = in_ep_list[(i + 1) % (NUM_IN_EP + 1)]; + int next_ep = in_ep_list[(i + 1) % sizeof(in_ep_list)]; DEPCTL(ep, false) = (DEPCTL(ep, false) & ~bitm(DEPCTL, nextep)) | (next_ep << DEPCTL_nextep_bitp); } } -- cgit v1.2.3