      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329

    //! CMSIS: Cortex Microcontroller Software Interface Standard
    //!
    //! The version 5 of the standard can be found at:
    //!
    //! http://arm-software.github.io/CMSIS_5/Core/html/index.html
    //!
    //! The API reference of the standard can be found at:
    //!
    //! - Core function access -- http://arm-software.github.io/CMSIS_5/Core/html/group__Core__Register__gr.html
    //! - Intrinsic functions for CPU instructions -- http://arm-software.github.io/CMSIS_5/Core/html/group__intrinsic__CPU__gr.html
    //!
    //! The reference C implementation used as the base of this Rust port can be found at
    //!
    //! https://github.com/ARM-software/CMSIS_5/blob/5.3.0/CMSIS/Core/Include/cmsis_gcc.h

    #![allow(non_snake_case)]

    /* Core function access */

    /// Enable IRQ Interrupts
    ///
    /// Enables IRQ interrupts by clearing the I-bit in the CPSR. Can only be
    /// executed in Privileged modes.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(cpsie))]
    pub unsafe fn __enable_irq() {
        asm!("cpsie i" : : : "memory" : "volatile");
    }

    /// Disable IRQ Interrupts
    ///
    /// Disables IRQ interrupts by setting the I-bit in the CPSR. Can only be
    /// executed in Privileged modes.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(cpsid))]
    pub unsafe fn __disable_irq() {
        asm!("cpsid i" : : : "memory" : "volatile");
    }

    /// Get Control Register
    ///
    /// Returns the content of the Control Register.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(mrs))]
    pub unsafe fn __get_CONTROL() -> u32 {
        let result: u32;
        asm!("mrs $0, CONTROL" : "=r"(result) : : : "volatile");
        result
    }

    /// Set Control Register
    ///
    /// Writes the given value to the Control Register.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(msr))]
    pub unsafe fn __set_CONTROL(control: u32) {
        asm!("msr CONTROL, $0" : : "r"(control) : "memory" : "volatile");
    }

    /// Get IPSR Register
    ///
    /// Returns the content of the IPSR Register.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(mrs))]
    pub unsafe fn __get_IPSR() -> u32 {
        let result: u32;
        asm!("mrs $0, IPSR" : "=r"(result) : : : "volatile");
        result
    }

    /// Get APSR Register
    ///
    /// Returns the content of the APSR Register.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(mrs))]
    pub unsafe fn __get_APSR() -> u32 {
        let result: u32;
        asm!("mrs $0, APSR" : "=r"(result) : : : "volatile");
        result
    }

    /// Get xPSR Register
    ///
    /// Returns the content of the xPSR Register.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(mrs))]
    pub unsafe fn __get_xPSR() -> u32 {
        let result: u32;
        asm!("mrs $0, XPSR" : "=r"(result) : : : "volatile");
        result
    }

    /// Get Process Stack Pointer
    ///
    /// Returns the current value of the Process Stack Pointer (PSP).
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(mrs))]
    pub unsafe fn __get_PSP() -> u32 {
        let result: u32;
        asm!("mrs $0, PSP" : "=r"(result) : : : "volatile");
        result
    }

    /// Set Process Stack Pointer
    ///
    /// Assigns the given value to the Process Stack Pointer (PSP).
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(msr))]
    pub unsafe fn __set_PSP(top_of_proc_stack: u32) {
        asm!("msr PSP, $0" : : "r"(top_of_proc_stack) : : "volatile");
    }

    /// Get Main Stack Pointer
    ///
    /// Returns the current value of the Main Stack Pointer (MSP).
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(mrs))]
    pub unsafe fn __get_MSP() -> u32 {
        let result: u32;
        asm!("mrs $0, MSP" : "=r"(result) : : : "volatile");
        result
    }

    /// Set Main Stack Pointer
    ///
    /// Assigns the given value to the Main Stack Pointer (MSP).
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(msr))]
    pub unsafe fn __set_MSP(top_of_main_stack: u32) {
        asm!("msr MSP, $0" : : "r"(top_of_main_stack) : : "volatile");
    }

    /// Get Priority Mask
    ///
    /// Returns the current state of the priority mask bit from the Priority Mask
    /// Register.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(mrs))]
    pub unsafe fn __get_PRIMASK() -> u32 {
        let result: u32;
        asm!("mrs $0, PRIMASK" : "=r"(result) : : "memory" : "volatile");
        result
    }

    /// Set Priority Mask
    ///
    /// Assigns the given value to the Priority Mask Register.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(msr))]
    pub unsafe fn __set_PRIMASK(pri_mask: u32) {
        asm!("msr PRIMASK, $0" : : "r"(pri_mask) : : "volatile");
    }

    #[cfg(any(target_feature = "v7", dox))]
    mod v7 {
        /// Enable FIQ
        ///
        /// Enables FIQ interrupts by clearing the F-bit in the CPSR. Can only be
        /// executed in Privileged modes.
        #[inline]
        #[target_feature(enable = "mclass")]
        #[cfg_attr(test, assert_instr(cpsie))]
        pub unsafe fn __enable_fault_irq() {
            asm!("cpsie f" : : : "memory" : "volatile");
        }

        /// Disable FIQ
        ///
        /// Disables FIQ interrupts by setting the F-bit in the CPSR. Can only be
        /// executed in Privileged modes.
        #[inline]
        #[target_feature(enable = "mclass")]
        #[cfg_attr(test, assert_instr(cpsid))]
        pub unsafe fn __disable_fault_irq() {
            asm!("cpsid f" : : : "memory" : "volatile");
        }

        /// Get Base Priority
        ///
        /// Returns the current value of the Base Priority register.
        #[inline]
        #[target_feature(enable = "mclass")]
        #[cfg_attr(test, assert_instr(mrs))]
        pub unsafe fn __get_BASEPRI() -> u32 {
            let result: u32;
            asm!("mrs $0, BASEPRI" : "=r"(result) : : : "volatile");
            result
        }

        /// Set Base Priority
        ///
        /// Assigns the given value to the Base Priority register.
        #[inline]
        #[target_feature(enable = "mclass")]
        #[cfg_attr(test, assert_instr(msr))]
        pub unsafe fn __set_BASEPRI(base_pri: u32) {
            asm!("msr BASEPRI, $0" : : "r"(base_pri) : "memory" : "volatile");
        }

        /// Set Base Priority with condition
        ///
        /// Assigns the given value to the Base Priority register only if BASEPRI
        /// masking is disabled, or the new value increases the BASEPRI
        /// priority level.
        #[inline]
        #[target_feature(enable = "mclass")]
        #[cfg_attr(test, assert_instr(mrs))]
        pub unsafe fn __set_BASEPRI_MAX(base_pri: u32) {
            asm!("msr BASEPRI_MAX, $0" : : "r"(base_pri) : "memory" : "volatile");
        }

        /// Get Fault Mask
        ///
        /// Returns the current value of the Fault Mask register.
        #[inline]
        #[target_feature(enable = "mclass")]
        #[cfg_attr(test, assert_instr(mrs))]
        pub unsafe fn __get_FAULTMASK() -> u32 {
            let result: u32;
            asm!("mrs $0, FAULTMASK" : "=r"(result) : : : "volatile");
            result
        }

        /// Set Fault Mask
        ///
        /// Assigns the given value to the Fault Mask register.
        #[inline]
        #[target_feature(enable = "mclass")]
        #[cfg_attr(test, assert_instr(msr))]
        pub unsafe fn __set_FAULTMASK(fault_mask: u32) {
            asm!("msr FAULTMASK, $0" : : "r"(fault_mask) : "memory" : "volatile");
        }
    }

    #[cfg(any(target_feature = "v7", dox))]
    pub use self::v7::*;

    /* Core instruction access */

    /// No Operation
    ///
    /// No Operation does nothing. This instruction can be used for code alignment
    /// purposes.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(nop))]
    pub unsafe fn __NOP() {
        asm!("nop" : : : : "volatile");
    }

    /// Wait For Interrupt
    ///
    /// Wait For Interrupt is a hint instruction that suspends execution until one
    /// of a number of events occurs.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(wfi))]
    pub unsafe fn __WFI() {
        asm!("wfi" : : : : "volatile");
    }

    /// Wait For Event
    ///
    /// Wait For Event is a hint instruction that permits the processor to enter a
    /// low-power state until one of a number of events occurs.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(wfe))]
    pub unsafe fn __WFE() {
        asm!("wfe" : : : : "volatile");
    }

    /// Send Event
    ///
    /// Send Event is a hint instruction. It causes an event to be signaled to the
    /// CPU.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(sev))]
    pub unsafe fn __SEV() {
        asm!("sev" : : : : "volatile");
    }

    /// Instruction Synchronization Barrier
    ///
    /// Instruction Synchronization Barrier flushes the pipeline in the processor,
    /// so that all instructions following the ISB are fetched from cache or
    /// memory, after the instruction has been completed.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(isb))]
    pub unsafe fn __ISB() {
        asm!("isb 0xF" : : : "memory" : "volatile");
    }

    /// Data Synchronization Barrier
    ///
    /// Acts as a special kind of Data Memory Barrier. It completes when all
    /// explicit memory accesses before this instruction complete.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(dsb))]
    pub unsafe fn __DSB() {
        asm!("dsb 0xF" : : : "memory" : "volatile");
    }

    /// Data Memory Barrier
    ///
    /// Ensures the apparent order of the explicit memory operations before and
    /// after the instruction, without ensuring their completion.
    #[inline]
    #[target_feature(enable = "mclass")]
    #[cfg_attr(test, assert_instr(dmb))]
    pub unsafe fn __DMB() {
        asm!("dmb 0xF" : : : "memory" : "volatile");
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)