aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/usb
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-08-25 06:05:41 +0000
committerGitHub <[email protected]>2024-08-25 06:05:41 +0000
commit1cfd5370ac012814b7b386ba9ad8499529bdde4e (patch)
treea19c6713ed3ca680e361ed18c0baf061bf72749b /embassy-stm32/src/usb
parentf4c7ec746282e762f651f9544d120af483f8e7d5 (diff)
parent557cff708505eb02c2b4c7f264a726bb9c17812a (diff)
Merge pull request #3281 from elagil/ulpi_add_fs_support
feat: Add support for a full-speed ULPI mode
Diffstat (limited to 'embassy-stm32/src/usb')
-rw-r--r--embassy-stm32/src/usb/otg.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/embassy-stm32/src/usb/otg.rs b/embassy-stm32/src/usb/otg.rs
index 8ee8dcc36..e27b164e4 100644
--- a/embassy-stm32/src/usb/otg.rs
+++ b/embassy-stm32/src/usb/otg.rs
@@ -97,6 +97,55 @@ impl<'d, T: Instance> Driver<'d, T> {
97 } 97 }
98 } 98 }
99 99
100 /// Initializes USB OTG peripheral with external Full-speed PHY (usually, a High-speed PHY in Full-speed mode).
101 ///
102 /// # Arguments
103 ///
104 /// * `ep_out_buffer` - An internal buffer used to temporarily store received packets.
105 /// Must be large enough to fit all OUT endpoint max packet sizes.
106 /// Endpoint allocation will fail if it is too small.
107 pub fn new_fs_ulpi(
108 _peri: impl Peripheral<P = T> + 'd,
109 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
110 ulpi_clk: impl Peripheral<P = impl UlpiClkPin<T>> + 'd,
111 ulpi_dir: impl Peripheral<P = impl UlpiDirPin<T>> + 'd,
112 ulpi_nxt: impl Peripheral<P = impl UlpiNxtPin<T>> + 'd,
113 ulpi_stp: impl Peripheral<P = impl UlpiStpPin<T>> + 'd,
114 ulpi_d0: impl Peripheral<P = impl UlpiD0Pin<T>> + 'd,
115 ulpi_d1: impl Peripheral<P = impl UlpiD1Pin<T>> + 'd,
116 ulpi_d2: impl Peripheral<P = impl UlpiD2Pin<T>> + 'd,
117 ulpi_d3: impl Peripheral<P = impl UlpiD3Pin<T>> + 'd,
118 ulpi_d4: impl Peripheral<P = impl UlpiD4Pin<T>> + 'd,
119 ulpi_d5: impl Peripheral<P = impl UlpiD5Pin<T>> + 'd,
120 ulpi_d6: impl Peripheral<P = impl UlpiD6Pin<T>> + 'd,
121 ulpi_d7: impl Peripheral<P = impl UlpiD7Pin<T>> + 'd,
122 ep_out_buffer: &'d mut [u8],
123 config: Config,
124 ) -> Self {
125 config_ulpi_pins!(
126 ulpi_clk, ulpi_dir, ulpi_nxt, ulpi_stp, ulpi_d0, ulpi_d1, ulpi_d2, ulpi_d3, ulpi_d4, ulpi_d5, ulpi_d6,
127 ulpi_d7
128 );
129
130 let regs = T::regs();
131
132 let instance = OtgInstance {
133 regs: T::regs(),
134 state: T::state(),
135 fifo_depth_words: T::FIFO_DEPTH_WORDS,
136 extra_rx_fifo_words: RX_FIFO_EXTRA_SIZE_WORDS,
137 endpoint_count: T::ENDPOINT_COUNT,
138 phy_type: PhyType::ExternalFullSpeed,
139 quirk_setup_late_cnak: quirk_setup_late_cnak(regs),
140 calculate_trdt_fn: calculate_trdt::<T>,
141 };
142
143 Self {
144 inner: OtgDriver::new(ep_out_buffer, instance, config),
145 phantom: PhantomData,
146 }
147 }
148
100 /// Initializes USB OTG peripheral with external High-Speed PHY. 149 /// Initializes USB OTG peripheral with external High-Speed PHY.
101 /// 150 ///
102 /// # Arguments 151 /// # Arguments