⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arm_cm4.s

📁 Cortex-M4+example
💻 S
📖 第 1 页 / 共 2 页
字号:
//  103               break;
//  104     }              
//  105 }
??enable_irq_4:
        POP      {R4,PC}          ;; return
//  106 /***********************************************************************/
//  107 /*
//  108  * Initialize the NVIC to disable the specified IRQ.
//  109  * 
//  110  * NOTE: The function only initializes the NVIC to disable a single IRQ. 
//  111  * If you want to disable all interrupts, then use the DisableInterrupts
//  112  * macro instead. 
//  113  *
//  114  * Parameters:
//  115  * irq    irq number to be disabled (the irq number NOT the vector number)
//  116  */
//  117 

        SECTION `.text`:CODE:NOROOT(1)
        THUMB
//  118 void disable_irq (int irq)
//  119 {
disable_irq:
        PUSH     {R4,LR}
        MOVS     R4,R0
//  120     int div;
//  121     
//  122     /* Make sure that the IRQ is an allowable number. Right now up to 91 is 
//  123      * used.
//  124      */
//  125     if (irq > 91)
        CMP      R4,#+92
        BLT.N    ??disable_irq_0
//  126         printf("\nERR! Invalid IRQ value passed to disable irq function!\n");
        ADR.W    R0,`?<Constant "\\nERR! Invalid IRQ val...">_1`
        BL       printf
//  127     
//  128     /* Determine which of the NVICICERs corresponds to the irq */
//  129     div = irq/32;
??disable_irq_0:
        MOVS     R0,#+32
        SDIV     R0,R4,R0
//  130     
//  131     switch (div)
        CMP      R0,#+0
        BEQ.N    ??disable_irq_1
        CMP      R0,#+2
        BEQ.N    ??disable_irq_2
        BCC.N    ??disable_irq_3
        B.N      ??disable_irq_4
//  132     {
//  133     	case 0x0:
//  134                NVICICER0 |= 1 << (irq%32);
??disable_irq_1:
        LDR.N    R0,??DataTable9_8  ;; 0xe000e180
        LDR      R0,[R0, #+0]
        MOVS     R1,#+1
        MOVS     R2,#+32
        SDIV     R3,R4,R2
        MLS      R3,R3,R2,R4
        LSLS     R1,R1,R3
        ORRS     R0,R1,R0
        LDR.N    R1,??DataTable9_8  ;; 0xe000e180
        STR      R0,[R1, #+0]
//  135               break;
        B.N      ??disable_irq_4
//  136     	case 0x1:
//  137               NVICICER1 |= 1 << (irq%32);
??disable_irq_3:
        LDR.N    R0,??DataTable9_9  ;; 0xe000e184
        LDR      R0,[R0, #+0]
        MOVS     R1,#+1
        MOVS     R2,#+32
        SDIV     R3,R4,R2
        MLS      R3,R3,R2,R4
        LSLS     R1,R1,R3
        ORRS     R0,R1,R0
        LDR.N    R1,??DataTable9_9  ;; 0xe000e184
        STR      R0,[R1, #+0]
//  138               break;
        B.N      ??disable_irq_4
//  139     	case 0x2:
//  140               NVICICER2 |= 1 << (irq%32);
??disable_irq_2:
        LDR.N    R0,??DataTable9_10  ;; 0xe000e188
        LDR      R0,[R0, #+0]
        MOVS     R1,#+1
        MOVS     R2,#+32
        SDIV     R3,R4,R2
        MLS      R3,R3,R2,R4
        LSLS     R1,R1,R3
        ORRS     R0,R1,R0
        LDR.N    R1,??DataTable9_10  ;; 0xe000e188
        STR      R0,[R1, #+0]
//  141               break;
//  142     }              
//  143 }
??disable_irq_4:
        POP      {R4,PC}          ;; return
//  144 /***********************************************************************/
//  145 /*
//  146  * Initialize the NVIC to set specified IRQ priority.
//  147  * 
//  148  * NOTE: The function only initializes the NVIC to set a single IRQ priority. 
//  149  * Interrupts will also need to be enabled in the ARM core. This can be 
//  150  * done using the EnableInterrupts macro.
//  151  *
//  152  * Parameters:
//  153  * irq    irq number to be enabled (the irq number NOT the vector number)
//  154  * prio   irq priority. 0-15 levels. 0 max priority
//  155  */
//  156 

        SECTION `.text`:CODE:NOROOT(1)
        THUMB
//  157 void set_irq_priority (int irq, int prio)
//  158 {
set_irq_priority:
        PUSH     {R3-R5,LR}
        MOVS     R4,R0
        MOVS     R5,R1
//  159     /*irq priority pointer*/
//  160     uint8 *prio_reg;
//  161     
//  162     /* Make sure that the IRQ is an allowable number. Right now up to 91 is 
//  163      * used.
//  164      */
//  165     if (irq > 91)
        CMP      R4,#+92
        BLT.N    ??set_irq_priority_0
//  166         printf("\nERR! Invalid IRQ value passed to priority irq function!\n");
        ADR.W    R0,`?<Constant "\\nERR! Invalid IRQ val...">_2`
        BL       printf
//  167 
//  168     if (prio > 15)
??set_irq_priority_0:
        CMP      R5,#+16
        BLT.N    ??set_irq_priority_1
//  169         printf("\nERR! Invalid priority value passed to priority irq function!\n");
        ADR.W    R0,`?<Constant "\\nERR! Invalid priorit...">`
        BL       printf
//  170     
//  171     /* Determine which of the NVICIPx corresponds to the irq */
//  172     prio_reg = (uint8 *)(((uint32)&NVICIP0) + irq);
??set_irq_priority_1:
        LDR.N    R0,??DataTable9_11  ;; 0xe000e400
        ADDS     R0,R0,R4
//  173     /* Assign priority to IRQ */
//  174     *prio_reg = ( (prio&0xF) << (8 - ARM_INTERRUPT_LEVEL_BITS) );             
        LSLS     R1,R5,#+4
        STRB     R1,[R0, #+0]
//  175 }
        POP      {R0,R4,R5,PC}    ;; return

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9:
        DC32     0xe000ed10

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_1:
        DC32     0xe000ed08

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_2:
        DC32     0xe000e280

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_3:
        DC32     0xe000e100

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_4:
        DC32     0xe000e284

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_5:
        DC32     0xe000e104

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_6:
        DC32     0xe000e288

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_7:
        DC32     0xe000e108

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_8:
        DC32     0xe000e180

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_9:
        DC32     0xe000e184

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_10:
        DC32     0xe000e188

        SECTION `.text`:CODE:NOROOT(2)
        DATA
??DataTable9_11:
        DC32     0xe000e400

        SECTION `.text`:CODE:NOROOT(2)
        DATA
`?<Constant "\\nERR! Invalid IRQ val...">`:
        ; Initializer data, 56 bytes
        DC8 10, 69, 82, 82, 33, 32, 73, 110, 118, 97
        DC8 108, 105, 100, 32, 73, 82, 81, 32, 118, 97
        DC8 108, 117, 101, 32, 112, 97, 115, 115, 101, 100
        DC8 32, 116, 111, 32, 101, 110, 97, 98, 108, 101
        DC8 32, 105, 114, 113, 32, 102, 117, 110, 99, 116
        DC8 105, 111, 110, 33, 10, 0

        SECTION `.text`:CODE:NOROOT(2)
        DATA
`?<Constant "\\nERR! Invalid IRQ val...">_1`:
        ; Initializer data, 60 bytes
        DC8 10, 69, 82, 82, 33, 32, 73, 110, 118, 97
        DC8 108, 105, 100, 32, 73, 82, 81, 32, 118, 97
        DC8 108, 117, 101, 32, 112, 97, 115, 115, 101, 100
        DC8 32, 116, 111, 32, 100, 105, 115, 97, 98, 108
        DC8 101, 32, 105, 114, 113, 32, 102, 117, 110, 99
        DC8 116, 105, 111, 110, 33, 10, 0, 0, 0, 0

        SECTION `.text`:CODE:NOROOT(2)
        DATA
`?<Constant "\\nERR! Invalid IRQ val...">_2`:
        ; Initializer data, 60 bytes
        DC8 10, 69, 82, 82, 33, 32, 73, 110, 118, 97
        DC8 108, 105, 100, 32, 73, 82, 81, 32, 118, 97
        DC8 108, 117, 101, 32, 112, 97, 115, 115, 101, 100
        DC8 32, 116, 111, 32, 112, 114, 105, 111, 114, 105
        DC8 116, 121, 32, 105, 114, 113, 32, 102, 117, 110
        DC8 99, 116, 105, 111, 110, 33, 10, 0, 0, 0

        SECTION `.text`:CODE:NOROOT(2)
        DATA
`?<Constant "\\nERR! Invalid priorit...">`:
        ; Initializer data, 64 bytes
        DC8 10, 69, 82, 82, 33, 32, 73, 110, 118, 97
        DC8 108, 105, 100, 32, 112, 114, 105, 111, 114, 105
        DC8 116, 121, 32, 118, 97, 108, 117, 101, 32, 112
        DC8 97, 115, 115, 101, 100, 32, 116, 111, 32, 112
        DC8 114, 105, 111, 114, 105, 116, 121, 32, 105, 114
        DC8 113, 32, 102, 117, 110, 99, 116, 105, 111, 110
        DC8 33, 10, 0, 0

        SECTION __DLIB_PERTHREAD:DATA:REORDER:NOROOT(0)

        SECTION __DLIB_PERTHREAD_init:DATA:REORDER:NOROOT(0)

        END
//  176 /***********************************************************************/
//  177 
// 
// 662 bytes in section .text
// 
// 662 bytes of CODE memory
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -