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

📄 tmt.asm

📁 电力系统中的保护装置全部代码
💻 ASM
📖 第 1 页 / 共 4 页
字号:
;/*************************************************************************/
;/*                                                                       */
;/*        Copyright (c) 1993-1998 Accelerated Technology, Inc.           */
;/*                                                                       */
;/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the      */
;/* subject matter of this material.  All manufacturing, reproduction,    */
;/* use, and sales rights pertaining to this subject matter are governed  */
;/* by the license agreement.  The recipient of this software implicitly  */
;/* accepts the terms of the license.                                     */
;/*                                                                       */
;/*************************************************************************/

;/*************************************************************************/
;/*                                                                       */
;/* FILE NAME                                            VERSION          */
;/*                                                                       */
;/*      tmt.asm                                         PLUS/C3XB/D 1.8  */
;/*                                                                       */
;/* COMPONENT                                                             */
;/*                                                                       */
;/*      TM - Timer Management                                            */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This file contains the target dependent routines of the timer    */
;/*      management component.                                            */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* DATA STRUCTURES                                                       */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* 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      */
;/*                                                                       */
;/* DEPENDENCIES                                                          */
;/*                                                                       */
;/*      tc_extr.h                           Thread Control functions     */
;/*      tm_extr.h                           Timer functions              */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      J. Trippi       03-11-1997       Modified for large memory model */
;/*      M. Trippi       03-12-1997       Released initial version 1.0    */
;/*      M. Trippi       05-18-1997       Registered LISRs now work.      */
;/*                                         (SPR284)                      */
;/*      M. Trippi       05-25-1997       IE register is now used to      */
;/*                                         control interrupts instead of */
;/*                                         the GIE bit in the ST.        */
;/*      M. Trippi       05-25-1997       Released version 1.1            */
;/*      M. Trippi       06-02-1997       Added conditional assembler     */
;/*                                         statments to allow user to    */
;/*                                         configure for SMALL memory    */
;/*                                         model.                        */
;/*      M. Trippi       06-03-1997       Released version 1.2            */
;/*      M. Trippi       06-16-1997       Corrected TMT_Timer_Interrupt   */
;/*                                         where it was activating the   */
;/*                                         wrong HISR.                   */
;/*      M. Trippi       07-01-1997       Released version 1.3            */
;/*      M. Trippi       07-09-1997       Added support for the REGISTER  */
;/*                                         argument model.               */
;/*      M. Trippi       07-09-1997       Released version 1.4            */
;/*      M. Trippi       11-06-1997       Added support for Microcomputer */
;/*                                         mode.                         */
;/*      M. Trippi       11-07-1997       Released version 1.5            */
;/*      M. Trippi       11-14-1997       Modifed TMT_Adjust_Timer to     */
;/*                                         restore the IE register to be */
;/*                                         consistent with the rest of   */
;/*      M. Trippi       11-14-1997       Stopped using the GIE bit to    */
;/*                                         mask out interrupts and used  */
;/*                                         the IE register which is now  */
;/*                                         configurable by the user.     */
;/*      M. Trippi       11-14-1997       Initialized variables where not */
;/*                                         being setup properly.         */
;/*      M. Trippi       11-21-1997       Released version 1.6            */
;/*      M. Trippi       02-24-1998       Released version 1.7 using      */
;/*                                         version 5.00 tools.           */
;/*      K. Pontzloff    04-03-1998       Released version 1.8            */
;/*                                                                       */
;/*************************************************************************/
;#define         NU_SOURCE_FILE
;
;NU_C30        .set 1    ; 1 to enable C30 support (PICK ONE) (DEFAULT)
;NU_C32        .set 0    ; 1 to enable C32 support (PICK ONE)
;;modify by jin  2000.12.11
NU_C30        .set 0    ; 1 to enable C30 support (PICK ONE) (DEFAULT)
NU_C32        .set 1    ; 1 to enable C32 support (PICK ONE)
                   ; Both 0 to enable C31 support (PICK ONE)
;
NU_BIG        .set 1    ; 1 to enable BIG memory model support (DEFAULT)
                        ; 0 to enable SMALL memory model support
;
NU_STACK      .set 1    ; 1 to enable STACK argument model support (DEFAULT)
                        ; 0 to enable REGISTER argument model support
;
NU_MCBL       .set 0    ; 1 to enable Microcomputer/Boot Loader mode
                        ; 0 to enable Microprocessor mode (DEFAULT)
                        ; NOTE: C31 or C32 MUST also be selected for MCBL mode
;
;   Define a pointer to the Nucleus PLUS Timer HISR control block
;
    .sect    ".cinit"
    .globl   _TMT_Timer_HISR
    .word    1,_TMT_Timer_HISR
    .word    _TMD_HISR+0
    .bss     _TMT_Timer_HISR,1
;
;
;#include        "tc_extr.h"                 /* Thread control functions  */
;#include        "tm_extr.h"                 /* Timer functions           */
;
;
;/* Define external inner-component global data references.  */
;
;extern VOID           *TCD_Current_Thread;
;extern INT             TCD_Interrupt_Level;
;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;
;
    .global    _TCD_Current_Thread
    .global    _TCD_Interrupt_Level
    .global    _TMD_System_Clock
    .global    _TMD_Timer
    .global    _TMD_Timer_State
    .global    _TMD_Time_Slice
    .global    _TMD_Time_Slice_Task
    .global    _TMD_Time_Slice_State
    .global    _TMD_HISR
;
;
;/* Define external function references.  */
; 
;VOID   TCT_Interrupt_Context_Save(VOID);
;VOID   TCT_Interrupt_Context_Restore(VOID);
;STATUS    TCT_Activate_HISR(NU_HISR *hisr_ptr);
;
    .global    _TCT_Interrupt_Context_Save
    .global    _TCT_Interrupt_Context_Restore
    .global    _TCT_Activate_HISR
;     
;     
;/* Define interrupt bit masks in the status register */
;
    .if NU_C32
GIENOT        equ    0DFFFh    ; mask to clear GIE bit in STatus register
    .else
GIENOT        equ    01FFFh    ; mask to clear GIE bit in STatus register
    .endif
;     
;/* Include constants defined in tm_defs.h */
;
TM_ACTIVE        equ    0
TM_NOT_ACTIVE    equ    1
TM_EXPIRED       equ    2
;
;/* Define offsets in TCB (task control block)
;
TCB_CURTIMESLC   equ    17        ; tc_cur_time_slice
;
;
    .text
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TMT_Set_Clock                                                    */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function sets the system clock to the specified value.      */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      Application                                                      */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      new_value                           New value for the clock      */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      D. Foxall       02-07-1996          TMS320C30 version 1.0        */
;/*      J. Trippi       03-11-1997       Modified for large memory model */
;/*                                                                       */
;/*************************************************************************/
    .global    _TMT_Set_Clock
_TMT_Set_Clock:
;VOID  TMT_Set_Clock(UNSIGNED new_value)
;{
;    /* Set the system clock to the specified value.  */
;    TMD_System_Clock =  new_value;
;
    .if NU_BIG
    LDP    @_TMD_System_Clock               ; Load Data Page Pointer
    .endif

    .if NU_STACK
    LDI    SP,AR0
    LDI    *-AR0(1),R0                      ; Pickup new value
    .else
    LDI    AR2,R0
    .endif

    STI    R0,@_TMD_System_Clock            ; Set the system clock
    RETS                                    ; Return to caller
;}
;
;
;/*************************************************************************/

⌨️ 快捷键说明

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