File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -56,4 +56,20 @@ config UDC_AMBIQ_PIO_MODE
56
56
Select this option when cache coherency handling is to be avoided.
57
57
endchoice
58
58
59
+ config UDC_AMBIQ_DEB_ENABLE
60
+ hex "EP Double Buffer Enable"
61
+ default 0x0000
62
+ depends on SOC_SERIES_APOLLO5X
63
+ help
64
+ Double Endpoint Buffer acceleration (DEB) is doubles an EP's FIFO size so
65
+ that USB transfer could continue to happen while waiting for DMA/CPU to
66
+ load/unload data from the EP FIFO. This hex value is a bitmap of endpoints
67
+ for DEB to be enabled. BIT0-4 represents OUT_EP 1-5, while BIT16-20
68
+ represents IN_EP 1-5. Take note that this feature is limited by total EP
69
+ FIFO size. Proper calculation should be done before enabling DEB such that
70
+ the total usage of FIFO for all endpoint doesn't exceed the FIFO available
71
+ on SoC. The list of Soc with its FIFO size is listed below. The FIFO size
72
+ here includes 128 bytes required by control endpoints.
73
+ - Apollo510: (4096 Bytes FIFO)
74
+
59
75
endif # UDC_AMBIQ
Original file line number Diff line number Diff line change @@ -565,6 +565,29 @@ static int init_apollo5x(const struct udc_ambiq_data *priv)
565
565
}
566
566
#endif
567
567
568
+ #if CONFIG_UDC_AMBIQ_DEB_ENABLE
569
+ static void init_double_buffers (const struct udc_ambiq_data * priv )
570
+ {
571
+ uint32_t mask ;
572
+
573
+ mask = CONFIG_UDC_AMBIQ_DEB_ENABLE & 0xFFFF ;
574
+ while (mask ) {
575
+ uint32_t ep = find_lsb_set (mask );
576
+
577
+ am_hal_usb_enable_ep_double_buffer (priv -> usb_handle , ep , AM_HAL_USB_OUT_DIR , true);
578
+ mask &= ~(1U << (ep - 1 ));
579
+ }
580
+
581
+ mask = (CONFIG_UDC_AMBIQ_DEB_ENABLE >> 16 ) & 0xFFFF ;
582
+ while (mask ) {
583
+ uint32_t ep = find_lsb_set (mask );
584
+
585
+ am_hal_usb_enable_ep_double_buffer (priv -> usb_handle , ep , AM_HAL_USB_IN_DIR , true);
586
+ mask &= ~(1U << (ep - 1 ));
587
+ }
588
+ }
589
+ #endif
590
+
568
591
static int udc_ambiq_init (const struct device * dev )
569
592
{
570
593
struct udc_ambiq_data * priv = udc_get_private (dev );
@@ -599,6 +622,10 @@ static int udc_ambiq_init(const struct device *dev)
599
622
}
600
623
#endif
601
624
625
+ #if CONFIG_UDC_AMBIQ_DEB_ENABLE
626
+ init_double_buffers (priv );
627
+ #endif
628
+
602
629
/* Set USB Speed */
603
630
am_hal_usb_set_dev_speed (priv -> usb_handle , priv -> usb_speed );
604
631
/* Enable USB interrupt */
You can’t perform that action at this time.
0 commit comments