mpfs_pac/
usb.rs

1use super::bindings::*;
2
3pub const USB: *mut MSS_USB_TypeDef = USB_BASE as *mut MSS_USB_TypeDef;
4
5const MSS_USB_ADDR_UPPER_OFFSET: u32 = 0x3FC;
6
7pub fn set_usb_dma_upper_address(upper_address: u8) {
8    unsafe {
9        *((USB_BASE + MSS_USB_ADDR_UPPER_OFFSET) as *mut u8) = upper_address;
10    }
11}
12
13/// Set the upper address bits of the address of the USB DMA
14pub fn init_usb_dma_upper_address() {
15    if cfg!(feature = "upper-memory-layout") {
16        set_usb_dma_upper_address(0x10);
17    } else {
18        set_usb_dma_upper_address(0x00);
19    }
20}