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

📄 tmt.s

📁 文件内包含了nuclues的内核代码和针对Power PC的编译器。需要用VirtNet生成一个虚拟网卡才可使用
💻 S
📖 第 1 页 / 共 3 页
字号:
#/*************************************************************************/
#/*                                                                       */
#/*        Copyright (c) 1993-1995 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.s                                       PLUS/MPC860/D 1.3    */
#/*                                                                       */
#/* COMPONENT                                                             */
#/*                                                                       */
#/*      TM - Timer Management                                            */
#/*                                                                       */
#/* DESCRIPTION                                                           */
#/*                                                                       */
#/*      This file contains the target dependent routines of the timer    */
#/*      management component.                                            */
#/*                                                                       */
#/* AUTHOR                                                                */
#/*                                                                       */
#/*      Barry Sellew, 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               */
#/*                                                                       */
#/*      Barry Sellew     06-24-1996        Created initial version 1.0   */
#/*      Barry Sellew     06-16-1997        Created and verified ver. 1.1 */
#/*      Barry Sellew     09-10-1997        Created and verified ver. 1.2 */
#/*      Barry Sellew     02-02-1998        Created and verified ver. 1.3 */
#/*                                                                       */
#/*************************************************************************/
         .file           "tmt.s"
##define         NU_SOURCE_FILE

##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;
#extern UNSIGNED        TCD_Interrupt_Level;

#/* Define external function references.  */

#VOID    TCT_Interrupt_Context_Save(INT vector);
#VOID    TCT_Interrupt_Context_Restore(VOID);

#/*************************************************************************/
#/*                                                                       */
#/* FUNCTION                                                              */
#/*                                                                       */
#/*      TMT_Set_Clock                                                    */
#/*                                                                       */
#/* DESCRIPTION                                                           */
#/*                                                                       */
#/*      This function sets the system clock to the specified value.      */
#/*                                                                       */
#/* AUTHOR                                                                */
#/*                                                                       */
#/*      Barry Sellew, Accelerated Technology, Inc.                       */
#/*                                                                       */
#/* CALLED BY                                                             */
#/*                                                                       */
#/*      Application                                                      */
#/*                                                                       */
#/* CALLS                                                                 */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* INPUTS                                                                */
#/*                                                                       */
#/*      new_value (argument r3)             New value for the clock      */
#/*                                                                       */
#/* OUTPUTS                                                               */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* HISTORY                                                               */
#/*                                                                       */
#/*         NAME            DATE                    REMARKS               */
#/*                                                                       */
#/*      Barry Sellew     06-24-1996       Created initial version 1.0    */
#/*                                                                       */
#/*************************************************************************/
#VOID  TMT_Set_Clock(UNSIGNED new_value)
#{
        .text
        .align          2
        .globl          TMT_Set_Clock
TMT_Set_Clock:
#
#   /*  Save the current SP and LR for the return */
#
    stwu        r1,-16(r1)
    mfspr       r0,LR
    stw         r0,20(r1)
#
#    /* Set the system clock to the specified value.  */
#    TMD_System_Clock =  new_value;
#
    addis       r12,0,TMD_System_Clock@ha  # upper 16 bits, < 16 bits
    stw         r3,TMD_System_Clock@l(r12)  # store to variable
#
#   /*  Restore the SP and LR for the return */
#
    lwz         r0,20(r1)
    mtspr       LR,r0
    addi        r1,r1,16
    blr
#
#}
#
#/*************************************************************************/
#/*                                                                       */
#/* FUNCTION                                                              */
#/*                                                                       */
#/*      TMT_Retrieve_Clock                                               */
#/*                                                                       */
#/* DESCRIPTION                                                           */
#/*                                                                       */
#/*      This function returns the current value of the system clock.     */
#/*                                                                       */
#/* AUTHOR                                                                */
#/*                                                                       */
#/*      Barry Sellew, Accelerated Technology, Inc.                       */
#/*                                                                       */
#/* CALLED BY                                                             */
#/*                                                                       */
#/*      Application                                                      */
#/*                                                                       */
#/* CALLS                                                                 */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* INPUTS                                                                */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* OUTPUTS                                                               */
#/*                                                                       */
#/*      TMD_System_Clock                    Value of system clock        */
#/*                                                                       */
#/* HISTORY                                                               */
#/*                                                                       */
#/*         NAME            DATE                    REMARKS               */
#/*                                                                       */
#/*      Barry Sellew     06-24-1996      Created initial version 1.0     */
#/*                                                                       */
#/*************************************************************************/
#UNSIGNED  TMT_Retrieve_Clock(VOID)
#{
    .text
    .align      2
    .globl      TMT_Retrieve_Clock
TMT_Retrieve_Clock:
#
#   /*  Save the SP and LR for the return */
#
    stwu        r1,-8(r1)
    mfspr       r0,LR
    stw         r0,12(r1)
#
#   /* Return the current value of the system clock.  */
#   return(TMD_System_Clock);
#
    addis       r3,0,TMD_System_Clock@ha
    lwz         r3,TMD_System_Clock@l(r3)
#
#   /*  restore the SP and the LR for the return */
#
    lwz         r0,12(r1)
    mtspr       LR,r0
    addi        r1,r1,8
    blr
#
#}
#
#/*************************************************************************/
#/*                                                                       */
#/* FUNCTION                                                              */
#/*                                                                       */
#/*      TMT_Read_Timer                                                   */
#/*                                                                       */
#/* DESCRIPTION                                                           */
#/*                                                                       */
#/*      This function returns the current value of the count-down timer. */
#/*                                                                       */
#/* AUTHOR                                                                */
#/*                                                                       */
#/*      Barry Sellew, Accelerated Technology, Inc.                       */
#/*                                                                       */
#/* CALLED BY                                                             */
#/*                                                                       */
#/*      TMC_Start_Timer                     Start timer function         */
#/*                                                                       */
#/* CALLS                                                                 */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* INPUTS                                                                */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* OUTPUTS                                                               */
#/*                                                                       */
#/*      TMD_Timer (returned in r3)          Value of count-down timer    */
#/*                                                                       */
#/* HISTORY                                                               */
#/*                                                                       */
#/*         NAME            DATE                    REMARKS               */
#/*                                                                       */
#/*      Barry Sellew    06-24-1996         Created initial version 1.0   */
#/*                                                                       */
#/*************************************************************************/
#UNSIGNED  TMT_Read_Timer(VOID)
#{
    .text
    .align      2
    .globl      TMT_Read_Timer
TMT_Read_Timer:
#
#   /*  Save the SP and LR for the return */
#
    stwu        r1,-8(r1)

⌨️ 快捷键说明

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