diff options
author | Brian Cully <bjc@kublai.com> | 2022-10-29 21:48:07 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2022-10-29 21:48:07 -0400 |
commit | fc0d9fe0e73348e5599bbc232c7dbf4f98d65ea5 (patch) | |
tree | b80eb240bd430ed5213ba0536508a68b2757cccf /src-riscv/usb.rs | |
parent | 06fa7f990885ec17220df66094cbe6663719a4da (diff) | |
download | luchie-fc0d9fe0e73348e5599bbc232c7dbf4f98d65ea5.tar.gz luchie-fc0d9fe0e73348e5599bbc232c7dbf4f98d65ea5.zip |
riscv: remove code
all previous functionality has been replicated, and the code lives in
a branch anyway.
Diffstat (limited to 'src-riscv/usb.rs')
-rwxr-xr-x | src-riscv/usb.rs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src-riscv/usb.rs b/src-riscv/usb.rs deleted file mode 100755 index 1ec36af..0000000 --- a/src-riscv/usb.rs +++ /dev/null @@ -1,42 +0,0 @@ -use gd32vf103xx_hal::pac; -use gd32vf103xx_hal::gpio::{Input, Floating, gpioa::{PA11, PA12}}; -use gd32vf103xx_hal::time::Hertz; -pub use synopsys_usb_otg::UsbBus; -use synopsys_usb_otg::UsbPeripheral; - -#[allow(dead_code)] -pub struct USB { - pub usb_global: pac::USBFS_GLOBAL, - pub usb_device: pac::USBFS_DEVICE, - pub usb_pwrclk: pac::USBFS_PWRCLK, - pub pin_dm: PA11<Input<Floating>>, - pub pin_dp: PA12<Input<Floating>>, - pub hclk: Hertz, -} - -unsafe impl Sync for USB {} - -unsafe impl UsbPeripheral for USB { - const REGISTERS: *const () = pac::USBFS_GLOBAL::ptr() as *const (); - - const HIGH_SPEED: bool = false; - const FIFO_DEPTH_WORDS: usize = 320; - const ENDPOINT_COUNT: usize = 4; - - fn enable() { - let rcu = unsafe { &*pac::RCU::ptr() }; - - riscv::interrupt::free(|_| { - // Enable USB peripheral - rcu.ahben.modify(|_, w| w.usbfsen().set_bit()); - - // Reset USB peripheral - rcu.ahbrst.modify(|_, w| w.usbfsrst().set_bit()); - rcu.ahbrst.modify(|_, w| w.usbfsrst().clear_bit()); - }); - } - - fn ahb_frequency_hz(&self) -> u32 { - self.hclk.0 - } -} |