File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -72,4 +72,21 @@ config UDC_AMBIQ_ISR_PARAM_COUNT
72
72
default 5 if SOC_SERIES_APOLLO5X
73
73
default 3
74
74
75
+ config UDC_AMBIQ_DEB_ENABLE
76
+ hex "EP Double Buffer Enable"
77
+ default 0x0000
78
+ depends on SOC_SERIES_APOLLO5X
79
+ help
80
+ Double Endpoint Buffer acceleration (DEB) is doubles an EP's FIFO size
81
+ so that USB transfer could continue to happen while waiting for DMA/CPU to
82
+ load/unload data from the EP FIFO.
83
+ This hex value is a bitmap of endpoints for DEB to be enabled. BIT0-4
84
+ represents OUT_EP 1-5, while BIT16-20 represents IN_EP 1-8.
85
+ Take note that this feature is limited by total EP FIFO size. Proper
86
+ calculation should be done before enabling DEB such that the total usage
87
+ of FIFO for all endpoint doesn't exceed the FIFO available on SoC.
88
+ The list of Soc with its FIFO size is listed below. The FIFO size here
89
+ includes 128 bytes required by control endpoints.
90
+ - Apollo510: (4096 Bytes FIFO)
91
+
75
92
endif # UDC_AMBIQ
Original file line number Diff line number Diff line change @@ -579,6 +579,36 @@ static int init_apollo5x(const struct udc_ambiq_data *priv)
579
579
}
580
580
#endif
581
581
582
+ #if CONFIG_UDC_AMBIQ_DEB_ENABLE
583
+ static void init_double_buffers (const struct udc_ambiq_data * priv )
584
+ {
585
+ uint8_t idx ;
586
+ uint32_t mask ;
587
+
588
+ idx = 1 ;
589
+ mask = CONFIG_UDC_AMBIQ_DEB_ENABLE & 0xFFFF ;
590
+ while (mask ) {
591
+ if (mask & 0x1 ) {
592
+ am_hal_usb_enable_ep_double_buffer (priv -> usb_handle , idx ,
593
+ AM_HAL_USB_OUT_DIR , true);
594
+ }
595
+ idx ++ ;
596
+ mask >>= 1 ;
597
+ }
598
+
599
+ idx = 1 ;
600
+ mask = (CONFIG_UDC_AMBIQ_DEB_ENABLE >> 16 ) & 0xFFFF ;
601
+ while (mask ) {
602
+ if (mask & 0x1 ) {
603
+ am_hal_usb_enable_ep_double_buffer (priv -> usb_handle , idx , AM_HAL_USB_IN_DIR ,
604
+ true);
605
+ }
606
+ idx ++ ;
607
+ mask >>= 1 ;
608
+ }
609
+ }
610
+ #endif
611
+
582
612
static int udc_ambiq_init (const struct device * dev )
583
613
{
584
614
struct udc_ambiq_data * priv = udc_get_private (dev );
@@ -613,6 +643,10 @@ static int udc_ambiq_init(const struct device *dev)
613
643
}
614
644
#endif
615
645
646
+ #if CONFIG_UDC_AMBIQ_DEB_ENABLE
647
+ init_double_buffers (priv );
648
+ #endif
649
+
616
650
/* Set USB Speed */
617
651
am_hal_usb_set_dev_speed (priv -> usb_handle , priv -> usb_speed );
618
652
/* Enable USB interrupt */
You can’t perform that action at this time.
0 commit comments