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

📄 int.s

📁 test file nucleus source
💻 S
📖 第 1 页 / 共 5 页
字号:
;************************************
    AREA    Heap, DATA, NOINIT

    ; Allocates memory for use by ARM Libraries that utilize
    ; a Heap

    ALIGN   4

bottom_of_heap

    SPACE   HEAP_SIZE

;**********************************
;* FIRST AVAIL MEMORY DECLARATION *
;**********************************
    AREA    INT_local_data, CODE

    ; The following label holds the address of the first
    ; available memory location usable by applications.  This
    ; address is passed to Application_Initialize.

INT_First_Avail_Mem
    DCD     |Image$$bss$$ZI$$Limit|

;**********************************
;* LOCAL VARIABLES                *
;**********************************

    ; The following are local variables.  ARM Architecture uses
    ; PC relative addressing, so all global data accessed must
    ; reside within close proximity (<4Kb in ARM, <1Kb in THUMB)
    ; to the instructions that access them.
    ; These are essentially pointers to global data.

INT_bss_start
    DCD     |Image$$bss$$ZI$$Base|

INT_bss_end
    DCD     |Image$$bss$$ZI$$Limit|

INT_rom_data_start
    DCD     |Image$$text$$Limit|

INT_ram_data_start
    DCD     |Image$$data$$Base|

INT_ram_data_end
    DCD     |Image$$bss$$ZI$$Base|

INT_Loaded_Flag1
    DCD     INT_Loaded_Flag

INT_Spurious_Count1
    DCD     INT_Spurious_Count

INT_HISR_Stack_Ptr
    DCD     TMD_HISR_Stack_Ptr

INT_HISR_Stack_Size
    DCD     TMD_HISR_Stack_Size

INT_HISR_Priority
    DCD     TMD_HISR_Priority

INT_System_Stack
    DCD     TCD_System_Stack

INT_System_Limit
    DCD     TCT_System_Limit


;*****************************
;* GENERIC FUNCTIONS         *
;*****************************

    AREA INT_Code, CODE, READONLY
;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Initialize
;*
;*  DESCRIPTION
;*
;*      This assembly performs all low-level initialization of Nucleus
;*      PLUS on the target system.  Function calls are made to do the
;*      following:
;*              - Initialize the target processor/board
;*              - Initialize C memory (copy ROM data to RAM / clear BSS)
;*              - Initialize Nucleus global variables / resources
;*              - Initialize interrupts on the target
;*              - Initialize the Nucleus PLUS timer interrupt
;*
;*      After this initialization is complete, control is passed to
;*      high-level initialization of PLUS at INC_Initialize.
;*
;*  CALLED BY
;*
;*      Reset Vector
;*
;*  CALLS
;*
;*      INT_Target_Initialize
;*      INT_C_Memory_Initialize
;*      INT_System_Initialize
;*      INT_Interrupts_Initialize
;*      INT_Timer_Initialize
;*      INC_Initialize
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r3
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;static VOID    INT_Initialize(void)

INT_Initialize

    ; Lock-out interrupts

    MRS     r0,CPSR
    BIC     r0,r0,#MODE_MASK                ; Clear the mode bits

    IF NU_SUPERV_USER_MODE
    
    ORR     r0,r0,#SYS_MODE                 ; Set the system mode bits
    
    ELSE
    
    ORR     r0,r0,#SUP_MODE                 ; Set the supervisor mode bits
    
    ENDIF
    
    ORR     r0,r0,#LOCKOUT
    MSR     CPSR_cxsf,r0

    ; Set-up the stack pointer

    LDR     sp,=INT_System_SP

    ; Intialize Memory on the HW

    BL      INT_HW_Memory_Initialize

    ; Initialized C memory (copy ROM to RAM and clear BSS)

    BL      INT_C_Memory_Initialize

    ; Initialize target hardware

    BL      INT_Target_Initialize

    ; Initialize Nucleus PLUS system settings

    BL      INT_System_Initialize

    ; Initialize interrupts for Nucleus PLUS

    BL      INT_Interrupts_Initialize

    ; Call the initialization code for the Nucleus system timer

    BL      INT_Timer_Initialize

    ; Get address of first available memory in r0 (parameter to function)

    LDR     r0,INT_First_Avail_Mem

    ; Call INC_Initialize to finish PLUS initialization

    LDR     r3,=INC_Initialize
    BX      r3


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Vectors_Loaded
;*
;*  DESCRIPTION
;*
;*      This function returns the flag that indicates whether or not
;*      all the default vectors have been loaded.  If it is false,
;*      each LISR register also loads the ISR shell into the actual
;*      vector table.
;*
;*  CALLED BY
;*
;*      TCC_Register_LISR
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      r0  -   value of INT_Loaded_Flag
;*
;*  REGISTERS MODIFIED
;*
;*      r0
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;INT    INT_Vectors_Loaded(void)

    EXPORT  INT_Vectors_Loaded
INT_Vectors_Loaded

    ; Get address of INT_Loaded_Flag

    LDR     r0, INT_Loaded_Flag1

    ; Put the value of INT_Loaded_Flag in the return register

    LDR     r0, [r0]

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Setup_Vector
;*
;*  DESCRIPTION
;*
;*      This function sets up the specified vector with the new vector
;*      value.  The previous vector value is returned to the caller.
;*
;*  CALLED BY
;*
;*      Application
;*      TCC_Register_LISR
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      r0  -   vector number
;*      r1  -   new interrupt service routine address
;*
;*  OUTPUTS
;*
;*      r0  -   old interrupt service routine address
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r1, r2, r3
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*     C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;VOID  *INT_Setup_Vector(INT vector, VOID *new)

    EXPORT  INT_Setup_Vector
INT_Setup_Vector

    ; Get address of the interrupt handler table

    LDR     r2, =INT_IRQ_Vectors

    ; Multiply vector by 4 to get offset into table

    MOV     r0, r0, LSL #2

    ; Read the current entry and write the new entry

    LDR     r3, [r2,r0]
    STR     r1, [r2,r0]

    ; Put the old pointer into the return register

    MOV     r0, r3

    ; Return to caller

    BX      lr


    IF  NU_FIQ_SUPPORT
;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Setup_FIQ_Vector
;*
;*  DESCRIPTION
;*
;*      This function sets up the specified FIQ vector with the new vector
;*      value.  The previous vector value is returned to the caller.
;*
;*  CALLED BY
;*
;*      Application
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      r0  -   vector number
;*      r1  -   new interrupt service routine address
;*
;*  OUTPUTS
;*
;*      r0  -   old interrupt service routine address
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r1, r2, r3
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;VOID  *INT_Setup_FIQ_Vector(INT vector, VOID *new)

    EXPORT  INT_Setup_FIQ_Vector
INT_Setup_FIQ_Vector

    ; Get address of the interrupt handler table

    LDR     r2, =INT_FIQ_Vectors

    ; Multiply vector by 4 to get offset into table

    MOV     r0, r0, LSL #2

    ; Read the current entry and write the new entry

    LDR     r3, [r2,r0]
    STR     r1, [r2,r0]

    ; Put the old pointer into the return register

    MOV     r0, r3

    ; Return to caller

    BX      lr

    ENDIF   ; NU_FIQ_SUPPORT


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Retrieve_Shell
;*
;*  DESCRIPTION
;*
;*      This function retrieves the pointer to the shell interrupt
;*      service routine.  The shell interrupt service routine calls
;*      the LISR dispatch routine.
;*
;*  CALLED BY
;*
;*      TCC_Register_LISR
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      r0  -   vector number
;*
;*  OUTPUTS
;*
;*      r0  -   shell address
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r1
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      C. March     07/15/2003      Released Version 1.14.9
;************************************************************************
;VOID  *INT_Retrieve_Shell(INT vector)

    EXPORT  INT_Retrieve_Shell
INT_Retrieve_Shell

    ; Load the vector table address

    LDR     r1, =INT_IRQ_Vectors

    ; Multiply vector by 4 to get offset into table

    MOV     r0, r0, LSL #2

    ; Load interrupt handler pointer into return register

    LDR     r0, [r1,r0]

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Undef_Inst
;*
;*  DESCRIPTION
;*
;*      This assembly function is a code stub to trap any undefined
;*      instruction exceptions generated by the ARM Architecture
;*
;*  CALLED BY
;*
;*      Undefined Instruction 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_Undef_Inst(VOID)

INT_Undef_Inst
    B       INT_Undef_Inst

;************************************************************************
;*
;*  FUNCTION
;*
;*      INT_Software
;*
;*  DESCRIPTION
;*
;*      This assembly function is a code stub to trap any software
;*      interrupts generated by the ARM Architecture
;*
;*  CALLED BY
;*
;*      Software Interrupt
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS

⌨️ 快捷键说明

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