diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-13 06:29:56 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-13 06:29:56 +0000 |
commit | 5c81130b488fcf7193c65efc80a82aee6abf5edb (patch) | |
tree | 5e56f2800ef18acecf7fc2e1a9bdeaaf23dd676c /firmware/target/arm/as3525 | |
parent | 89fa72f13f8fd841a67f8bd606ccecaa8ed74991 (diff) |
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
Diffstat (limited to 'firmware/target/arm/as3525')
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525v2.c | 27 |
1 files changed, 11 insertions, 16 deletions
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); } } |