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

📄 tmt.asm

📁 电力系统中的保护装置全部代码
💻 ASM
📖 第 1 页 / 共 4 页
字号:
    LDI    SP,AR0
    LDI    *-AR0(1),R0                      ; Pickup new value
    .else
    LDI    AR2,R0
    .endif

    CMPI   @_TMD_Timer,R0                   ; Compare it with current
    BHS    _TMT_Skip_Adjust                 ; If current is less, skip adjust
;
;        /* Adjust the timer.  */
;        TMD_Timer =  time;
;
    STI    R0,@_TMD_Timer                   ; Setup new timer value
;
_TMT_Skip_Adjust:
;
;    /* Restore interrupts. */
;
;    .if NU_BIG
;    LDP    @_TCD_Interrupt_Level           ; Load Data Page Pointer
;    .endif
;    LDI    @_TCD_Interrupt_Level,IE        ; Pickup global interrupt level 
;
    RETI                                   ;  Return, setting GIE bit in ST
;
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TMT_Disable_Timer                                                */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function disables the count-down timer.                     */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      TMC_Start_Timer                     Start timer function         */
;/*      TMC_Timer_Task                      Timer expiration task        */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* 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_Disable_Timer
_TMT_Disable_Timer:
;VOID  TMT_Disable_Timer(void)
;{
;    /* Disable the count-down timer.  */
;    TMD_Timer_State =  TM_NOT_ACTIVE;
;
    .if NU_BIG
    LDP    @_TMD_Timer_State                ; Load Data Page Pointer
    .endif

    LDI    TM_NOT_ACTIVE,R0                 ; De-activate the timer

    STI    R0,@_TMD_Timer_State             ; De-activate the timer
    RETS                                    ; Return to caller
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TMT_Retrieve_TS_Task                                             */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function returns the time-sliced task pointer.              */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      TMC_Timer_HISR                      Timer HISR                   */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      TMD_Time_Slice_Task                 Time sliced task pointer     */
;/*                                                                       */
;/* 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_Retrieve_TS_Task
_TMT_Retrieve_TS_Task:
;NU_TASK  *TMT_Retrieve_TS_Task(VOID)
;{
;    /* Return the time slice task pointer.  */
;    return((NU_TASK *) TMD_Time_Slice_Task);
;
    .if NU_BIG
    LDP    @_TMD_Time_Slice_Task            ; Load Data Page Pointer
    .endif
    LDI    @_TMD_Time_Slice_Task,R0         ; Pickup time-sliced task pointer
    RETS                                    ; Return to caller
;}
;
;
;/*************************************************************************/
;/*                                                                       */
;/* FUNCTION                                                              */
;/*                                                                       */
;/*      TMT_Timer_Interrupt                                              */
;/*                                                                       */
;/* DESCRIPTION                                                           */
;/*                                                                       */
;/*      This function processes the actual hardware interrupt.           */
;/*      Processing includes updating the system clock, the count-down    */
;/*      timer and the time-slice timer. If one or both of the timers     */
;/*      expire, the timer HISR is activated.                             */
;/*                                                                       */
;/* AUTHOR                                                                */
;/*                                                                       */
;/*      William E. Lamie, Accelerated Technology, Inc.                   */
;/*                                                                       */
;/* CALLED BY                                                             */
;/*                                                                       */
;/*      Interrupt Vector                                                 */
;/*                                                                       */
;/* CALLS                                                                 */
;/*                                                                       */
;/*      TCT_Activate_HISR                   Activate timer HISR          */
;/*      TCT_Interrupt_Context_Save          Save interrupted context     */
;/*      TCT_Interrupt_Context_Restore       Restore interrupted context  */
;/*                                                                       */
;/* INPUTS                                                                */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* OUTPUTS                                                               */
;/*                                                                       */
;/*      None                                                             */
;/*                                                                       */
;/* HISTORY                                                               */
;/*                                                                       */
;/*         NAME            DATE                    REMARKS               */
;/*                                                                       */
;/*      D. Foxall       02-07-1996          TMS320C30 version 1.0        */
;/*      M. Trippi       03-04-1997          Corrected SPR263.            */
;/*      J. Trippi       03-11-1997       Modified for large memory model */
;/*      M. Trippi       05-18-1997        Registered LISRs now work.     */
;/*                                          (SPR284)                     */
;/*                                                                       */
;/*************************************************************************/
      .global     _Month_Day_Tab,_SoftCLK,_SoftTime,_TimeIndex

TIMELEN   .set   100
TMTBASE   .word  _SoftTime
pSoftCLK  .word  _SoftCLK
pDAYTAB   .word  _Month_Day_Tab
SECCNT    .word  60000

    .global    _TMT_Timer_Interrupt
_TMT_Timer_Interrupt:
;VOID  TMT_Timer_Interrupt(void)
;{
;    /* This is a hardware interrupt routine. At entry, interrupts are
;    disabled. */
;    /* Save minimal context on the stack.  */
;
    PUSH    ST
    PUSH    R0
    PUSH    AR0
    PUSH    DP
;
;    /* Increment the system clock.  */
;    TMD_System_Clock++;
;
    .if NU_BIG
    LDP    @_TMD_System_Clock               ; Load Data Page Pointer
    .endif
    LDI    1,R0
    ADDI   @_TMD_System_Clock,R0
    STI    R0,@_TMD_System_Clock

;===============================
    LDP    @_TimeIndex
    PUSH   R1
    PUSH   AR1
    LDI    1,R1
    LDI    @_TimeIndex,R0
    ADDI   R1,R0,R1
    CMPI   TIMELEN,R1
    LDIHS  0,R1
    STI    R1,@_TimeIndex
;-------------------------------
    LDP    @TMTBASE
    LDI    @TMTBASE,AR0
    LDP    @810000H
    ADDI   R0,AR0
    LDI    @0000H,R0
    AND    0FFFFH,R0
    LDI    @1000H,R1
    LSH    16,R1
    OR     R1,R0
    STI    R0,*+AR0(2*TIMELEN)

    LDP    @pSoftCLK
    LDI    1,R0
    LDI    @pSoftCLK,AR1
    LDP    @SECCNT

⌨️ 快捷键说明

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