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

📄 int.s

📁 test file nucleus source
💻 S
📖 第 1 页 / 共 5 页
字号:
;*
;*      C. March    07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID    INT_Software(VOID)

INT_Software
    B       INT_Software

;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Prefetch_Abort
;*
;*  DESCRIPTION
;*
;*      This assembly function is a code stub to trap any prefetch abort
;*      exceptions generated by the ARM Architecture
;*
;*  CALLED BY
;*
;*      Prefetch Abort Exception
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID    INT_Prefetch_Abort(VOID)

INT_Prefetch_Abort
    B       INT_Prefetch_Abort

;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Data_Abort
;*
;*  DESCRIPTION
;*
;*      This assembly function is a code stub to trap any data abort
;*      exceptions generated by the ARM Architecture
;*
;*  CALLED BY
;*
;*      Data Abort Exception
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID    INT_Data_Abort(VOID)

INT_Data_Abort
    B       INT_Data_Abort

;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Reserved
;*
;*  DESCRIPTION
;*
;*      This assembly function is a code stub to trap any reserved
;*      exceptions generated by the ARM Architecture
;*
;*  CALLED BY
;*
;*      Reserved Exception
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March    07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID    INT_Reserved(VOID)

INT_Reserved
    B       INT_Reserved


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_IRQ_Shell
;*
;*  DESCRIPTION
;*
;*      This assembly function is responsible for handling all IRQs
;*      handled by NU_Register_LISR.  This function saves the context of
;*      the system, calls the LISR dispatch function, and restores
;*      the system's context upon completion with servicing the interrupt.
;*
;*  CALLED BY
;*
;*      INT_IRQ
;*
;*  CALLS
;*
;*      TCT_Interrupt_Context_Save
;*      TCC_Dispatch_LISR
;*      TCT_Interrupt_Context_Restore
;*
;*  INPUTS
;*
;*      r0  -   vector number
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID   INT_IRQ_Shell(INT vector)

INT_IRQ_Shell

    ; Put IRQ return address into r4

    MOV     r4,lr

    ; Lock out all interrupts before any saving context

    MRS     r2,CPSR                         ; Pickup current CPSR
    ORR     r2,r2,#LOCKOUT                  ; Build lockout CPSR
    MSR     CPSR_cxsf,r2                    ; Lockout interrupts temporarily

    ; Call function to save context of system

    BL      TCT_Interrupt_Context_Save

    ; Clear IRQ bit to allow nesting

    MRS     r2,CPSR                         ; Pickup current CPSR
    BIC     r2,r2,#IRQ_BIT                  ; Clear IRQ bit
    MSR     CPSR_cxsf,r2                    ; Enable IRQs

    ; Call function to dispatch LISR associated with vector (in r0)

    BL      TCC_Dispatch_LISR

    ; Execute macro to unmask IRQ interrupts masked during nesting process
    
    UNNEST_INTERRUPT    IRQ_MODE

    ; Jump to function to restore context to system (control doesn't return)

    B       TCT_Interrupt_Context_Restore


    IF      NU_FIQ_SUPPORT
;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_FIQ_Shell
;*
;*  DESCRIPTION
;*
;*      This assembly function is responsible for handling all FIQs
;*      handled by NU_Register_LISR.  This function saves the context of
;*      the system, calls the LISR dispatch function, and restores
;*      the system's context upon completion with servicing the interrupt.
;*
;*  CALLED BY
;*
;*      INT_FIQ
;*
;*  CALLS
;*
;*      TCT_Interrupt_Context_Save
;*      TCC_Dispatch_LISR
;*      TCT_Interrupt_Context_Restore
;*
;*  INPUTS
;*
;*      r0  -   vector number
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID   INT_FIQ_Shell(INT vector)

INT_FIQ_Shell

    ; Put FIQ return address into r4

    MOV     r4,lr

    ; Call function to save context of system

    BL      TCT_Interrupt_Context_Save

    ; Call function to dispatch LISR associated with vector (in r0)

    BL      TCC_Dispatch_LISR

    ; Execute macro to unmask FIQ interrupts masked during nesting process

    UNNEST_INTERRUPT    FIQ_MODE

    ; Jump to function to restore context to system (control doesn't return)

    B       TCT_Interrupt_Context_Restore

    ENDIF   ; NU_FIQ_SUPPORT


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Spurious_Interrupt
;*
;*  DESCRIPTION
;*
;*      This assembly function is responsible for handling any spurious
;*      interrupts.  A spurious interrupt occurs when the interrupt
;*      is generated (IRQ / FIQ), but the interrupt controller shows
;*      no pending interrupts.
;*
;*      A counter is incremented and control is returned
;*      to the point of interrupt.
;*
;*  CALLED BY
;*
;*      INT_IRQ / INT_FIQ
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      PC, CPSR
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID INT_Spurious_Interrupt(VOID)

INT_Spurious_Interrupt

    ; Get address of spurious interrupt count variable

    LDR     r0,INT_Spurious_Count1

    ; Get value of variable

    LDR     r1,[r0]

    ; Increment count

    ADD     r1,r1,#1

    ; Save new count

    STR     r1,[r0]

    ; Restore interrupts

    UNNEST_MIN_INTERRUPT

    ; Put return address on stack

    STMDB   sp!,{lr}

    ; Return to point of interrupt and restore CPSR

    LDMIA   sp!,{pc}^


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_C_Memory_Initialize
;*
;*  DESCRIPTION
;*
;*      This assembly function is responsible for clearing the BSS
;*      memory and copying initialized data from ROM to RAM when
;*      running in ROM.
;*
;*  CALLED BY
;*
;*      INT_Initialize
;*
;*  CALLS
;*
;*      INT_ROM_Data_Copy
;*      INT_Clear_BSS
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID   INT_C_Memory_Initialize(VOID)

INT_C_Memory_Initialize

    ; Save lr in r4

    MOV     r4,lr

    IF (NU_MODULE_SUPPORT :LOR: NU_ROM_SUPPORT)

    ; Call function to copy initialized data from ROM to RAM

    BL      INT_ROM_Data_Copy

    ENDIF ; (NU_MODULE_SUPPORT :LOR: NU_ROM_SUPPORT)

    ; Call function to clear BSS memory

    BL      INT_Clear_BSS
   
    ; Return to caller

    BX      r4


    IF (NU_MODULE_SUPPORT :LOR: NU_ROM_SUPPORT)
;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_ROM_Data_Copy
;*
;*  DESCRIPTION
;*
;*      This assembly function is responsible for copying initialized
;*      data from ROM to RAM when running in ROM.
;*
;*  CALLED BY
;*
;*      INT_C_Memory_Initialize
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID   INT_ROM_Data_Copy(VOID)

INT_ROM_Data_Copy

    ; Get start address of data in ROM

    LDR     r0,INT_rom_data_start

    ; Get start and end addresses of where data needs to be placed in RAM

    LDR     r1,INT_ram_data_start
    LDR     r2,INT_ram_data_end

    ; Copy data from ROM memory to RAM

INT_ROM_Vars_Copy

    CMP     r1,r2                           ; Is start and end of RAM equal?
    LDRCC   r3, [r0], #4                    ; If not done copying, get another value from ROM
    STRCC   r3, [r1], #4                    ; If not done copying, put another value in RAM
    BCC     INT_ROM_Vars_Copy               ; Keep looping until done

    ; Return to caller

    BX      lr

    ENDIF   ; (NU_MODULE_SUPPORT :LOR: NU_ROM_SUPPORT)


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Clear_BSS
;*
;*  DESCRIPTION
;*
;*      This assembly function is responsible for clearing the BSS
;*
;*  CALLED BY
;*
;*      INT_C_Memory_Initialize
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*

⌨️ 快捷键说明

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