lib.rs 18 KB

12
  1. # ! [ doc = "Peripheral access API for CH569 microcontrollers (generated using svd2rust v0.19.0 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next]
  2. svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.19.0/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust" ] # ! [ deny ( const_err ) ] # ! [ deny ( dead_code ) ] # ! [ deny ( improper_ctypes ) ] # ! [ deny ( missing_docs ) ] # ! [ deny ( no_mangle_generic_items ) ] # ! [ deny ( non_shorthand_field_patterns ) ] # ! [ deny ( overflowing_literals ) ] # ! [ deny ( path_statements ) ] # ! [ deny ( patterns_in_fns_without_body ) ] # ! [ deny ( private_in_public ) ] # ! [ deny ( unconditional_recursion ) ] # ! [ deny ( unused_allocation ) ] # ! [ deny ( unused_comparisons ) ] # ! [ deny ( unused_parens ) ] # ! [ deny ( while_true ) ] # ! [ allow ( non_camel_case_types ) ] # ! [ allow ( non_snake_case ) ] # ! [ no_std ] use core :: ops :: Deref ; use core :: marker :: PhantomData ; # [ allow ( unused_imports ) ] use generic :: * ; # [ doc = r"Common register and bit access and modify traits" ] pub mod generic ; # [ doc = "SYS register" ] pub struct SYS { _marker : PhantomData < * const ( ) > } unsafe impl Send for SYS { } impl SYS { # [ doc = r"Pointer to the register block" ] pub const PTR : * const sys :: RegisterBlock = 0x4000_1000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const sys :: RegisterBlock { Self :: PTR } } impl Deref for SYS { type Target = sys :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for SYS { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "SYS" ) . finish ( ) } } # [ doc = "SYS register" ] pub mod sys ; # [ doc = "TMR0 register" ] pub struct TMR0 { _marker : PhantomData < * const ( ) > } unsafe impl Send for TMR0 { } impl TMR0 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const tmr0 :: RegisterBlock = 0x4000_2000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const tmr0 :: RegisterBlock { Self :: PTR } } impl Deref for TMR0 { type Target = tmr0 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for TMR0 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "TMR0" ) . finish ( ) } } # [ doc = "TMR0 register" ] pub mod tmr0 ; # [ doc = "TMR1 register" ] pub struct TMR1 { _marker : PhantomData < * const ( ) > } unsafe impl Send for TMR1 { } impl TMR1 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const tmr1 :: RegisterBlock = 0x4000_2400 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const tmr1 :: RegisterBlock { Self :: PTR } } impl Deref for TMR1 { type Target = tmr1 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for TMR1 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "TMR1" ) . finish ( ) } } # [ doc = "TMR1 register" ] pub mod tmr1 ; # [ doc = "TMR2 register" ] pub struct TMR2 { _marker : PhantomData < * const ( ) > } unsafe impl Send for TMR2 { } impl TMR2 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const tmr2 :: RegisterBlock = 0x4000_2800 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const tmr2 :: RegisterBlock { Self :: PTR } } impl Deref for TMR2 { type Target = tmr2 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for TMR2 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "TMR2" ) . finish ( ) } } # [ doc = "TMR2 register" ] pub mod tmr2 ; # [ doc = "UART0 register" ] pub struct UART0 { _marker : PhantomData < * const ( ) > } unsafe impl Send for UART0 { } impl UART0 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const uart0 :: RegisterBlock = 0x4000_3000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const uart0 :: RegisterBlock { Self :: PTR } } impl Deref for UART0 { type Target = uart0 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for UART0 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "UART0" ) . finish ( ) } } # [ doc = "UART0 register" ] pub mod uart0 ; # [ doc = "UART1 register" ] pub struct UART1 { _marker : PhantomData < * const ( ) > } unsafe impl Send for UART1 { } impl UART1 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const uart1 :: RegisterBlock = 0x4000_3400 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const uart1 :: RegisterBlock { Self :: PTR } } impl Deref for UART1 { type Target = uart1 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for UART1 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "UART1" ) . finish ( ) } } # [ doc = "UART1 register" ] pub mod uart1 ; # [ doc = "UART2 register" ] pub struct UART2 { _marker : PhantomData < * const ( ) > } unsafe impl Send for UART2 { } impl UART2 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const uart2 :: RegisterBlock = 0x4000_3800 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const uart2 :: RegisterBlock { Self :: PTR } } impl Deref for UART2 { type Target = uart2 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for UART2 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "UART2" ) . finish ( ) } } # [ doc = "UART2 register" ] pub mod uart2 ; # [ doc = "UART3 register" ] pub struct UART3 { _marker : PhantomData < * const ( ) > } unsafe impl Send for UART3 { } impl UART3 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const uart3 :: RegisterBlock = 0x4000_3c00 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const uart3 :: RegisterBlock { Self :: PTR } } impl Deref for UART3 { type Target = uart3 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for UART3 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "UART3" ) . finish ( ) } } # [ doc = "UART3 register" ] pub mod uart3 ; # [ doc = "SPI0 register" ] pub struct SPI0 { _marker : PhantomData < * const ( ) > } unsafe impl Send for SPI0 { } impl SPI0 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const spi0 :: RegisterBlock = 0x4000_4000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const spi0 :: RegisterBlock { Self :: PTR } } impl Deref for SPI0 { type Target = spi0 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for SPI0 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "SPI0" ) . finish ( ) } } # [ doc = "SPI0 register" ] pub mod spi0 ; # [ doc = "SPI1 register" ] pub struct SPI1 { _marker : PhantomData < * const ( ) > } unsafe impl Send for SPI1 { } impl SPI1 { # [ doc = r"Pointer to the register block" ] pub const PTR : * const spi1 :: RegisterBlock = 0x4000_4400 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const spi1 :: RegisterBlock { Self :: PTR } } impl Deref for SPI1 { type Target = spi1 :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for SPI1 { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "SPI1" ) . finish ( ) } } # [ doc = "SPI1 register" ] pub mod spi1 ; # [ doc = "PWMX register" ] pub struct PWMX { _marker : PhantomData < * const ( ) > } unsafe impl Send for PWMX { } impl PWMX { # [ doc = r"Pointer to the register block" ] pub const PTR : * const pwmx :: RegisterBlock = 0x4000_5000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const pwmx :: RegisterBlock { Self :: PTR } } impl Deref for PWMX { type Target = pwmx :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for PWMX { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "PWMX" ) . finish ( ) } } # [ doc = "PWMX register" ] pub mod pwmx ; # [ doc = "HSPI register" ] pub struct HSPI { _marker : PhantomData < * const ( ) > } unsafe impl Send for HSPI { } impl HSPI { # [ doc = r"Pointer to the register block" ] pub const PTR : * const hspi :: RegisterBlock = 0x4000_6000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const hspi :: RegisterBlock { Self :: PTR } } impl Deref for HSPI { type Target = hspi :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for HSPI { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "HSPI" ) . finish ( ) } } # [ doc = "HSPI register" ] pub mod hspi ; # [ doc = "ECDC register" ] pub struct ECDC { _marker : PhantomData < * const ( ) > } unsafe impl Send for ECDC { } impl ECDC { # [ doc = r"Pointer to the register block" ] pub const PTR : * const ecdc :: RegisterBlock = 0x4000_7000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const ecdc :: RegisterBlock { Self :: PTR } } impl Deref for ECDC { type Target = ecdc :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for ECDC { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "ECDC" ) . finish ( ) } } # [ doc = "ECDC register" ] pub mod ecdc ; # [ doc = "USBHS register" ] pub struct USBHS { _marker : PhantomData < * const ( ) > } unsafe impl Send for USBHS { } impl USBHS { # [ doc = r"Pointer to the register block" ] pub const PTR : * const usbhs :: RegisterBlock = 0x4000_9000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const usbhs :: RegisterBlock { Self :: PTR } } impl Deref for USBHS { type Target = usbhs :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for USBHS { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "USBHS" ) . finish ( ) } } # [ doc = "USBHS register" ] pub mod usbhs ; # [ doc = "ETH register (Please refer to subprogram library)" ] pub struct ETH { _marker : PhantomData < * const ( ) > } unsafe impl Send for ETH { } impl ETH { # [ doc = r"Pointer to the register block" ] pub const PTR : * const eth :: RegisterBlock = 0x4000_c000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const eth :: RegisterBlock { Self :: PTR } } impl Deref for ETH { type Target = eth :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for ETH { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "ETH" ) . finish ( ) } } # [ doc = "ETH register (Please refer to subprogram library)" ] pub mod eth ; # [ doc = "DVP register" ] pub struct DVP { _marker : PhantomData < * const ( ) > } unsafe impl Send for DVP { } impl DVP { # [ doc = r"Pointer to the register block" ] pub const PTR : * const dvp :: RegisterBlock = 0x4000_e000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const dvp :: RegisterBlock { Self :: PTR } } impl Deref for DVP { type Target = dvp :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for DVP { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "DVP" ) . finish ( ) } } # [ doc = "DVP register" ] pub mod dvp ; # [ doc = "Program Fast Interrupt Controller" ] pub struct PFIC { _marker : PhantomData < * const ( ) > } unsafe impl Send for PFIC { } impl PFIC { # [ doc = r"Pointer to the register block" ] pub const PTR : * const pfic :: RegisterBlock = 0xe000_e000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const pfic :: RegisterBlock { Self :: PTR } } impl Deref for PFIC { type Target = pfic :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for PFIC { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "PFIC" ) . finish ( ) } } # [ doc = "Program Fast Interrupt Controller" ] pub mod pfic ; # [ doc = "Systick register" ] pub struct SYSTICK { _marker : PhantomData < * const ( ) > } unsafe impl Send for SYSTICK { } impl SYSTICK { # [ doc = r"Pointer to the register block" ] pub const PTR : * const systick :: RegisterBlock = 0xe000_f000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const systick :: RegisterBlock { Self :: PTR } } impl Deref for SYSTICK { type Target = systick :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for SYSTICK { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "SYSTICK" ) . finish ( ) } } # [ doc = "Systick register" ] pub mod systick ; # [ doc = "EMMC register" ] pub struct EMMC { _marker : PhantomData < * const ( ) > } unsafe impl Send for EMMC { } impl EMMC { # [ doc = r"Pointer to the register block" ] pub const PTR : * const emmc :: RegisterBlock = 0x4000_a000 as * const _ ; # [ doc = r"Return the pointer to the register block" ] # [ inline ( always ) ] pub const fn ptr ( ) -> * const emmc :: RegisterBlock { Self :: PTR } } impl Deref for EMMC { type Target = emmc :: RegisterBlock ; # [ inline ( always ) ] fn deref ( & self ) -> & Self :: Target { unsafe { & * Self :: PTR } } } impl core :: fmt :: Debug for EMMC { fn fmt ( & self , f : & mut core :: fmt :: Formatter ) -> core :: fmt :: Result { f . debug_struct ( "EMMC" ) . finish ( ) } } # [ doc = "EMMC register" ] pub mod emmc ; # [ no_mangle ] static mut DEVICE_PERIPHERALS : bool = false ; # [ doc = r"All the peripherals" ] # [ allow ( non_snake_case ) ] pub struct Peripherals { # [ doc = "SYS" ] pub SYS : SYS , # [ doc = "TMR0" ] pub TMR0 : TMR0 , # [ doc = "TMR1" ] pub TMR1 : TMR1 , # [ doc = "TMR2" ] pub TMR2 : TMR2 , # [ doc = "UART0" ] pub UART0 : UART0 , # [ doc = "UART1" ] pub UART1 : UART1 , # [ doc = "UART2" ] pub UART2 : UART2 , # [ doc = "UART3" ] pub UART3 : UART3 , # [ doc = "SPI0" ] pub SPI0 : SPI0 , # [ doc = "SPI1" ] pub SPI1 : SPI1 , # [ doc = "PWMX" ] pub PWMX : PWMX , # [ doc = "HSPI" ] pub HSPI : HSPI , # [ doc = "ECDC" ] pub ECDC : ECDC , # [ doc = "USBHS" ] pub USBHS : USBHS , # [ doc = "ETH" ] pub ETH : ETH , # [ doc = "DVP" ] pub DVP : DVP , # [ doc = "PFIC" ] pub PFIC : PFIC , # [ doc = "SYSTICK" ] pub SYSTICK : SYSTICK , # [ doc = "EMMC" ] pub EMMC : EMMC , } impl Peripherals { # [ doc = r"Returns all the peripherals *once*" ] # [ inline ] pub fn take ( ) -> Option < Self > { riscv :: interrupt :: free ( | _ | { if unsafe { DEVICE_PERIPHERALS } { None } else { Some ( unsafe { Peripherals :: steal ( ) } ) } } ) } # [ doc = r"Unchecked version of `Peripherals::take`" ] # [ inline ] pub unsafe fn steal ( ) -> Self { DEVICE_PERIPHERALS = true ; Peripherals { SYS : SYS { _marker : PhantomData } , TMR0 : TMR0 { _marker : PhantomData } , TMR1 : TMR1 { _marker : PhantomData } , TMR2 : TMR2 { _marker : PhantomData } , UART0 : UART0 { _marker : PhantomData } , UART1 : UART1 { _marker : PhantomData } , UART2 : UART2 { _marker : PhantomData } , UART3 : UART3 { _marker : PhantomData } , SPI0 : SPI0 { _marker : PhantomData } , SPI1 : SPI1 { _marker : PhantomData } , PWMX : PWMX { _marker : PhantomData } , HSPI : HSPI { _marker : PhantomData } , ECDC : ECDC { _marker : PhantomData } , USBHS : USBHS { _marker : PhantomData } , ETH : ETH { _marker : PhantomData } , DVP : DVP { _marker : PhantomData } , PFIC : PFIC { _marker : PhantomData } , SYSTICK : SYSTICK { _marker : PhantomData } , EMMC : EMMC { _marker : PhantomData } , } } }