diff options
Diffstat (limited to 'firmware/target/arm/as3525/usb-drv-as3525v2.c')
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525v2.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c index 9954484f01..1897bced64 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525v2.c +++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c | |||
@@ -36,6 +36,14 @@ | |||
36 | #include "usb-drv-as3525v2.h" | 36 | #include "usb-drv-as3525v2.h" |
37 | #include "usb_core.h" | 37 | #include "usb_core.h" |
38 | 38 | ||
39 | /* Number of IN/OUT endpoints */ | ||
40 | #define NUM_IN_EP 3 | ||
41 | #define NUM_OUT_EP 2 | ||
42 | |||
43 | /* List of IN enpoints */ | ||
44 | #define IN_EP_LIST 0, 3, 5 | ||
45 | #define OUT_EP_LIST 2, 4 | ||
46 | |||
39 | static const uint8_t in_ep_list[NUM_IN_EP + 1] = {0, IN_EP_LIST}; | 47 | static const uint8_t in_ep_list[NUM_IN_EP + 1] = {0, IN_EP_LIST}; |
40 | static const uint8_t out_ep_list[NUM_OUT_EP + 1] = {0, OUT_EP_LIST}; | 48 | static const uint8_t out_ep_list[NUM_OUT_EP + 1] = {0, OUT_EP_LIST}; |
41 | 49 | ||
@@ -216,7 +224,7 @@ static void prepare_setup_ep0(void) | |||
216 | { | 224 | { |
217 | logf("usb-drv: prepare EP0"); | 225 | logf("usb-drv: prepare EP0"); |
218 | /* setup DMA */ | 226 | /* setup DMA */ |
219 | DOEPDMA(0) = (unsigned long)AS3525_PHYSICAL_ADDR(&_ep0_setup_pkt); | 227 | DOEPDMA(0) = (void*)AS3525_PHYSICAL_ADDR(&_ep0_setup_pkt); |
220 | 228 | ||
221 | /* Setup EP0 OUT with the following parameters: | 229 | /* Setup EP0 OUT with the following parameters: |
222 | * packet count = 1 | 230 | * packet count = 1 |
@@ -408,7 +416,7 @@ static void core_dev_init(void) | |||
408 | 416 | ||
409 | /* Setup FIFOs */ | 417 | /* Setup FIFOs */ |
410 | GRXFSIZ = 512; | 418 | GRXFSIZ = 512; |
411 | GNPTXFSIZ = MAKE_FIFOSIZE_DATA(512, 512); | 419 | GNPTXFSIZ = MAKE_FIFOSIZE_DATA(512); |
412 | 420 | ||
413 | /* Setup interrupt masks for endpoints */ | 421 | /* Setup interrupt masks for endpoints */ |
414 | /* Setup interrupt masks */ | 422 | /* Setup interrupt masks */ |
@@ -766,9 +774,9 @@ static int usb_drv_transfer(int ep, void *ptr, int len, bool dir_in, bool blocki | |||
766 | /* disable interrupts to avoid any race */ | 774 | /* disable interrupts to avoid any race */ |
767 | int oldlevel = disable_irq_save(); | 775 | int oldlevel = disable_irq_save(); |
768 | 776 | ||
769 | volatile unsigned long *epctl = dir_in ? &DIEPCTL(ep) : &DOEPCTL(ep); | 777 | volatile uint32_t *epctl = dir_in ? &DIEPCTL(ep) : &DOEPCTL(ep); |
770 | volatile unsigned long *eptsiz = dir_in ? &DIEPTSIZ(ep) : &DOEPTSIZ(ep); | 778 | volatile uint32_t *eptsiz = dir_in ? &DIEPTSIZ(ep) : &DOEPTSIZ(ep); |
771 | volatile unsigned long *epdma = dir_in ? &DIEPDMA(ep) : &DOEPDMA(ep); | 779 | const void * volatile * epdma = dir_in ? &DIEPDMA(ep) : &DOEPDMA(ep); |
772 | struct usb_endpoint *endpoint = &endpoints[ep][dir_in]; | 780 | struct usb_endpoint *endpoint = &endpoints[ep][dir_in]; |
773 | #define DEPCTL *epctl | 781 | #define DEPCTL *epctl |
774 | #define DEPTSIZ *eptsiz | 782 | #define DEPTSIZ *eptsiz |
@@ -790,12 +798,12 @@ static int usb_drv_transfer(int ep, void *ptr, int len, bool dir_in, bool blocki | |||
790 | 798 | ||
791 | if(len == 0) | 799 | if(len == 0) |
792 | { | 800 | { |
793 | DEPDMA = 0x10000000; | 801 | DEPDMA = (void*)0x10000000; |
794 | DEPTSIZ = 1 << DEPTSIZ_pkcnt_bitp; | 802 | DEPTSIZ = 1 << DEPTSIZ_pkcnt_bitp; |
795 | } | 803 | } |
796 | else | 804 | else |
797 | { | 805 | { |
798 | DEPDMA = (unsigned long)AS3525_PHYSICAL_ADDR(ptr); | 806 | DEPDMA = (void*)AS3525_PHYSICAL_ADDR(ptr); |
799 | DEPTSIZ = (nb_packets << DEPTSIZ_pkcnt_bitp) | len; | 807 | DEPTSIZ = (nb_packets << DEPTSIZ_pkcnt_bitp) | len; |
800 | if(dir_in) | 808 | if(dir_in) |
801 | clean_dcache_range(ptr, len); | 809 | clean_dcache_range(ptr, len); |