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

📄 tmt.s

📁 test file nucleus source
💻 S
📖 第 1 页 / 共 2 页
字号:
;************************************************************************
;*
;*               Copyright Mentor Graphics Corporation 2003
;*                         All Rights Reserved.
;*
;* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS
;* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
;* SUBJECT TO LICENSE TERMS.
;*
;************************************************************************
;************************************************************************
;*
;*  FILE NAME                           VERSION
;*
;*      tmt.s                         Nucleus PLUS\Integrator\ADS 1.14.9 
;*
;*  COMPONENT
;*
;*      TM - Timer Management
;*
;*  DESCRIPTION
;*
;*      This file contains the target dependent routines of the timer
;*      management component.
;*
;*  GLOBAL FUNCTIONS
;*
;*
;*      *****************************
;*      * GENERIC FUNCTIONS         *
;*      *****************************
;*
;*      TMT_Set_Clock                   Set system clock
;*      TMT_Retrieve_Clock              Retrieve system clock
;*      TMT_Read_Timer                  Read count-down timer
;*      TMT_Enable_Timer                Enable count-down timer
;*      TMT_Adjust_Timer                Adjust count-down timer
;*      TMT_Disable_Timer               Disable count-down timer
;*      TMT_Retrieve_TS_Task            Retrieve time-sliced task ptr
;*      TMT_Timer_Interrupt             Process timer interrupt
;*
;*      *****************************
;*      * TARGET SPECIFIC FUNCTIONS *
;*      *****************************
;*
;*  LOCAL FUNCTIONS
;*
;*      None
;*
;************************************************************************

;**********************************
;* INCLUDE ASSEMBLY CONSTANTS     *
;**********************************

    INCLUDE         asm_defs.inc

    IF NU_MMU_MODE
    
    INCLUDE ../MMU/mmu_defs.inc             ; MMU macros
    
    ENDIF
;**********************************
;* EXTERNAL VARIABLE DECLARATIONS *
;**********************************

;extern VOID        *TCD_Current_Thread;
;extern UNSIGNED    TMD_System_Clock;
;extern UNSIGNED    TMD_Timer;
;extern INT         TMD_Timer_State;
;extern UNSIGNED    TMD_Time_Slice;
;extern TC_TCB      *TMD_Time_Slice_Task;
;extern INT         TMD_Time_Slice_State;
;extern TC_HCB      TMD_HISR;

    IMPORT          TCD_Current_Thread
    IMPORT          TMD_System_Clock
    IMPORT          TMD_Timer
    IMPORT          TMD_Timer_State
    IMPORT          TMD_Time_Slice
    IMPORT          TMD_Time_Slice_Task
    IMPORT          TMD_Time_Slice_State
    IMPORT          TMD_HISR

;**********************************
;* EXTERNAL FUNCTION DECLARATIONS *
;**********************************

;VOID   TCT_Activate_HISR(TC_HISR *hisr);
;VOID   TCT_Interrupt_Context_Save(VOID);
;VOID   TCT_Interrupt_Context_Restore(VOID);

    IMPORT          TCT_Activate_HISR
    IMPORT          TCT_Interrupt_Context_Save
    IMPORT          TCT_Interrupt_Context_Restore

;**********************************
;* GLOBAL VARIABLE DECLARATIONS   *
;**********************************

    ; No global variable declarations

;**********************************
;* LOCAL VARIABLES                *
;**********************************
    AREA    TMT_local_data, CODE

    ; 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.

TMT_System_Clock
    DCD     TMD_System_Clock

TMT_Timer
    DCD     TMD_Timer

TMT_Timer_State
    DCD     TMD_Timer_State

TMT_Slice_State
    DCD     TMD_Time_Slice_State

TMT_Time_Slice
    DCD     TMD_Time_Slice

TMT_Current_Thread
    DCD     TCD_Current_Thread

TMT_Slice_Task
    DCD     TMD_Time_Slice_Task

TMT_HISR
    DCD     TMD_HISR


    AREA TMT_Code, CODE, READONLY
;************************************************************************
;*
;*  FUNCTION
;*
;*      TMT_Set_Clock
;*
;*  DESCRIPTION
;*
;*      This function sets the system clock to the specified value.
;*
;*  CALLED BY
;*
;*      Application
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      r0 -    new clock value
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      r1
;*
;************************************************************************
;VOID  TMT_Set_Clock(UNSIGNED new_value)

    EXPORT  TMT_Set_Clock
TMT_Set_Clock

    ; Set the system clock to the specified value.

    LDR     r1,TMT_System_Clock             ; Build address of system clock
    STR     r0,[r1]                         ; Store new system clock value

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  FUNCTION
;*
;*      TMT_Retrieve_Clock
;*
;*  DESCRIPTION
;*
;*      This function returns the current value of the system clock.
;*
;*  CALLED BY
;*
;*      Application
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      r0 -    TMD_System_Clock
;*
;*  REGISTERS MODIFIED
;*
;*      None
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      Driscoll, D     01/24/2003      Released Version 1.14.1
;************************************************************************
;UNSIGNED  TMT_Retrieve_Clock(void)

    EXPORT  TMT_Retrieve_Clock
TMT_Retrieve_Clock

    ; Return the current value of the system clock.

    LDR     r0,TMT_System_Clock             ; Build address to system clock
    LDR     r0,[r0]                         ; Pickup system clock contents

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  FUNCTION
;*
;*      TMT_Read_Timer
;*
;*  DESCRIPTION
;*
;*      This function returns the current value of the count-down timer.
;*
;*  CALLED BY
;*
;*      TMC_Start_Timer                 Start timer function
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      None
;*
;*  OUTPUTS
;*
;*      r0 -    value of count-down timer
;*
;*  REGISTERS MODIFIED
;*
;*      r0
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      Driscoll, D     01/24/2003      Released Version 1.14.1
;************************************************************************
;UNSIGNED  TMT_Read_Timer(void)

    EXPORT  TMT_Read_Timer
TMT_Read_Timer

    ; Return the current value of the count-down timer.

    LDR     r0,TMT_Timer                    ; Build address to timer
    LDR     r0,[r0]                         ; Pickup timer contents

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  FUNCTION
;*
;*      TMT_Enable_Timer
;*
;*  DESCRIPTION
;*
;*      This function enables the count-down timer with the specified
;*      value.
;*
;*  CALLED BY
;*
;*      TMC_Start_Timer                 Start timer function
;*      TMC_Timer_Task                  Timer expiration task
;*
;*  CALLS
;*
;*      None
;*
;*  INPUTS
;*
;*      r0 -    New count-down time
;*
;*  OUTPUTS
;*
;*      None
;*
;*  REGISTERS MODIFIED
;*
;*      r0, r1
;*
;*  HISTORY
;*
;*      NAME            DATE            REMARKS
;*
;*      Driscoll, D     01/24/2003      Released Version 1.14.1
;************************************************************************
;VOID  TMT_Enable_Timer(UNSIGNED time)

    EXPORT  TMT_Enable_Timer
TMT_Enable_Timer

    ; Place the new time value into the count-down timer.

    LDR     r1,TMT_Timer                    ; Build address of timer
    STR     r0,[r1]                         ; Store new timer value

    ; Indicate that the timer is active.

    MOV     r0,#0                           ; Build TM_ACTIVE value
    LDR     r1,TMT_Timer_State              ; Build address of timer state var
    STR     r0,[r1]                         ; Change the state to active

    ; Return to caller

    BX      lr


;************************************************************************
;*
;*  FUNCTION
;*
;*      TMT_Adjust_Timer
;*
;*  DESCRIPTION
;*
;*      This function adjusts the count-down timer with the specified
;*      value - if the new value is less than the current.
;*
;*  CALLED BY
;*
;*      TMC_Start_Timer                 Start timer function
;*
;*  CALLS

⌨️ 快捷键说明

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