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

📄 os_time.lst

📁 在MC68HC908JB8上移植UCOSII成功
💻 LST
📖 第 1 页 / 共 2 页
字号:
ANSI-C/cC++ Compiler for HC08 V-5.0.12 ICG, Oct  6 2000

    1:  /*
    2:  *********************************************************************************************************
    3:  *                                                uC/OS-II
    4:  *                                          The Real-Time Kernel
    5:  *                                             TIME MANAGEMENT
    6:  *
    7:  *                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
    8:  *                                           All Rights Reserved
    9:  *
   10:  *                                                  V2.00
   11:  *
   12:  * File : OS_TIME.C
   13:  * By   : Jean J. Labrosse
   14:  *********************************************************************************************************
   15:  */
   16:  
   17:  #include "includes.h"
   18:  
   19:  
   20:  /*
   21:  *********************************************************************************************************
   22:  *                                DELAY TASK 'n' TICKS   (n from 0 to 65535)
   23:  *
   24:  * Description: This function is called to delay execution of the currently running task until the 
   25:  *              specified number of system ticks expires.  This, of course, directly equates to delaying
   26:  *              the current task for some time to expire.  No delay will result If the specified delay is 
   27:  *              0.  If the specified delay is greater than 0 then, a context switch will result.
   28:  *
   29:  * Arguments  : ticks     is the time delay that the task will be suspended in number of clock 'ticks'.  
   30:  *                        Note that by specifying 0, the task will not be delayed.
   31:  *
   32:  * Returns    : none
   33:  *********************************************************************************************************
   34:  */
   35:  
   36:  void OSTimeDly (INT16U ticks)
   37:  {

Function: OSTimeDly
Source  : C:\motoctest\ucos1\sources\Os_time.c
Options : -Cc -EnvGENPATH=C:\motoctest\ucos1;C:\motoctest\ucos1\bin;C:\motoctest\ucos1\cmd;C:\motoctest\ucos1\prm;C:\motoctest\ucos1\sources;C:\Metrowerks\lib\HC08c\LIB;C:\Metrowerks\lib\HC08c\src;C:\Metrowerks\lib\HC08c\INCLUDE -EnvLIBPATH=C:\Metrowerks\lib\HC08c\INCLUDE -EnvOBJPATH=C:\motoctest\ucos1\bin -EnvTEXTPATH=C:\motoctest\ucos1\bin -La=%f.inc -Lasm=%n.lst -ObjN=C:\motoctest\ucos1\ucos1_Data\MMDS-MMEVS\ObjectCode\Os_time.c.o

  0000 87               PSHA  
  0001 89               PSHX  
   38:      if (ticks > 0) {                                                      /* 0 means no delay!         */
  0002 95               TSX   
  0003 fa               ORA   ,X
  0004 2730             BEQ   L36 ;abs = 0036
   39:          OS_ENTER_CRITICAL();
  0006 9b               SEI   
   40:          if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) {  /* Delay current task        */
  0007 5500             LDHX  OSTCBCur
  0009 ee0b             LDX   11,X
  000b 89               PSHX  
  000c be01             LDX   OSTCBCur:1
  000e e60c             LDA   12,X
  0010 43               COMA  
  0011 8c               CLRH  
  0012 88               PULX  
  0013 e400             AND   @OSRdyTbl,X
  0015 e700             STA   @OSRdyTbl,X
  0017 260d             BNE   L26 ;abs = 0026
   41:              OSRdyGrp &= ~OSTCBCur->OSTCBBitY;
  0019 b600             LDA   OSTCBCur
  001b 87               PSHA  
  001c 8a               PULH  
  001d be01             LDX   OSTCBCur:1
  001f e60d             LDA   13,X
  0021 43               COMA  
  0022 b400             AND   OSRdyGrp
  0024 b700             STA   OSRdyGrp
  0026          L26:    
   42:          }
   43:          OSTCBCur->OSTCBDly = ticks;                                       /* Load ticks in TCB         */
  0026 9ee602           LDA   2,SP
  0029 5500             LDHX  OSTCBCur
  002b e707             STA   7,X
  002d 9ee601           LDA   1,SP
  0030 e706             STA   6,X
   44:          OS_EXIT_CRITICAL();
  0032 9a               CLI   
   45:          OSSched();                                                        /* Find next task to run!    */
  0033 cd0000           JSR   OSSched
  0036          L36:    
   46:      }
   47:  }
  0036 a702             AIS   #2
  0038 81               RTS   
   48:  /*$PAGE*/
   49:  /*
   50:  *********************************************************************************************************
   51:  *                                     DELAY TASK FOR SPECIFIED TIME
   52:  *
   53:  * Description: This function is called to delay execution of the currently running task until some time
   54:  *              expires.  This call allows you to specify the delay time in HOURS, MINUTES, SECONDS and
   55:  *              MILLISECONDS instead of ticks.
   56:  *
   57:  * Arguments  : hours     specifies the number of hours that the task will be delayed (max. is 255)
   58:  *              minutes   specifies the number of minutes (max. 59)    
   59:  *              seconds   specifies the number of seconds (max. 59)
   60:  *              milli     specifies the number of milliseconds (max. 999)
   61:  *
   62:  * Returns    : OS_NO_ERR
   63:  *              OS_TIME_INVALID_MINUTES
   64:  *              OS_TIME_INVALID_SECONDS
   65:  *              OS_TIME_INVALID_MS
   66:  *              OS_TIME_ZERO_DLY
   67:  *
   68:  * Note(s)    : The resolution on the milliseconds depends on the tick rate.  For example, you can't do
   69:  *              a 10 mS delay if the ticker interrupts every 100 mS.  In this case, the delay would be
   70:  *              set to 0.  The actual delay is rounded to the nearest tick.
   71:  *********************************************************************************************************
   72:  */
   73:  
   74:  INT8U OSTimeDlyHMSM (INT8U hours, INT8U minutes, INT8U seconds, INT16U milli)
   75:  {

Function: OSTimeDlyHMSM
Source  : C:\motoctest\ucos1\sources\Os_time.c
Options : -Cc -EnvGENPATH=C:\motoctest\ucos1;C:\motoctest\ucos1\bin;C:\motoctest\ucos1\cmd;C:\motoctest\ucos1\prm;C:\motoctest\ucos1\sources;C:\Metrowerks\lib\HC08c\LIB;C:\Metrowerks\lib\HC08c\src;C:\Metrowerks\lib\HC08c\INCLUDE -EnvLIBPATH=C:\Metrowerks\lib\HC08c\INCLUDE -EnvOBJPATH=C:\motoctest\ucos1\bin -EnvTEXTPATH=C:\motoctest\ucos1\bin -La=%f.inc -Lasm=%n.lst -ObjN=C:\motoctest\ucos1\ucos1_Data\MMDS-MMEVS\ObjectCode\Os_time.c.o

  0000 87               PSHA  
  0001 89               PSHX  
  0002 a7fa             AIS   #-6
   76:      INT32U ticks;
   77:      INT16U loops;
   78:  
   79:  
   80:      if (hours > 0 || minutes > 0 || seconds > 0 || milli > 0) {
  0004 95               TSX   
  0005 e60c             LDA   12,X
  0007 ea0b             ORA   11,X
  0009 ea0a             ORA   10,X
  000b 2609             BNE   L16 ;abs = 0016
  000d e607             LDA   7,X
  000f ea06             ORA   6,X
  0011 2603             BNE   L16 ;abs = 0016
  0013 cc00ee           JMP   LEE ;abs = 00ee
  0016          L16:    
   81:          if (minutes > 59) {
  0016 e60b             LDA   11,X
  0018 a13b             CMP   #59
  001a 2304             BLS   L20 ;abs = 0020
   82:              return (OS_TIME_INVALID_MINUTES);    /* Validate arguments to be within range              */
  001c a651             LDA   #81
  001e 2008             BRA   L28 ;abs = 0028
  0020          L20:    
   83:          }
   84:          if (seconds > 59) {
  0020 ee0a             LDX   10,X
  0022 a33b             CPX   #59
  0024 2304             BLS   L2A ;abs = 002a
   85:              return (OS_TIME_INVALID_SECONDS);
  0026 a652             LDA   #82
  0028          L28:    
  0028 200e             BRA   L38 ;abs = 0038
  002a          L2A:    
   86:          }
   87:          if (milli > 999) {
  002a 95               TSX   
  002b e606             LDA   6,X
  002d 87               PSHA  
  002e ee07             LDX   7,X
  0030 8a               PULH  
  0031 6503e7           CPHX  #999
  0034 2305             BLS   L3B ;abs = 003b
   88:              return (OS_TIME_INVALID_MILLI);
  0036 a653             LDA   #83
  0038          L38:    
  0038 cc00ed           JMP   LED ;abs = 00ed
  003b          L3B:    
   89:          }
   90:                                                   /* Compute the total number of clock ticks required.. */
   91:                                                   /* .. (rounded to the nearest tick)                   */
   92:          ticks = ((INT32U)hours * 3600L + (INT32U)minutes * 60L + (INT32U)seconds) * OS_TICKS_PER_SEC
  003b 9ee60d           LDA   13,SP
  003e 87               PSHA  
  003f 4f               CLRA  
  0040 87               PSHA  
  0041 87               PSHA  
  0042 87               PSHA  
  0043 89               PSHX  
  0044 95               TSX   
  0045 af01             AIX   #1
  0047 cd0000           JSR   _LMUL_RC
  004a 00000e10         DC.L  3600
  004e e60f             LDA   15,X
  0050 5f               CLRX  
  0051 87               PSHA  
  0052 89               PSHX  
  0053 89               PSHX  
  0054 89               PSHX  
  0055 95               TSX   
  0056 cd0000           JSR   _LMUL_RC
  0059 0000003c         DC.L  60
  005d 95               TSX   
  005e 89               PSHX  
  005f 8b               PSHH  
  0060 af08             AIX   #8
  0062 cd0000           JSR   _LADD
  0065 e613             LDA   19,X
  0067 5f               CLRX  
  0068 87               PSHA  
  0069 89               PSHX  
  006a 89               PSHX  
  006b 89               PSHX  
  006c 95               TSX   
  006d 89               PSHX  
  006e 8b               PSHH  
  006f af04             AIX   #4
  0071 cd0000           JSR   _LADD
  0074 95               TSX   
  0075 cd0000           JSR   _LMUL_RC
  0078 00000014         DC.L  20
  007c e618             LDA   24,X
  007e ee23             LDX   35,X
  0080 9ee71d           STA   29,SP
  0083 87               PSHA  
  0084 89               PSHX  
  0085 4f               CLRA  
  0086 87               PSHA  
  0087 87               PSHA  
  0088 95               TSX   
  0089 cd0000           JSR   _LADD_RC
  008c 00000019         DC.L  25
  0090 95               TSX   
  0091 cd0000           JSR   _LMUL_RC
  0094 00000014         DC.L  20
  0098 95               TSX   
  0099 cd0000           JSR   _LDIVU_RC
  009c 000003e8         DC.L  1000
  00a0 95               TSX   
  00a1 89               PSHX  
  00a2 8b               PSHH  
  00a3 af10             AIX   #16
  00a5 cd0000           JSR   _LADD
  00a8 af21             AIX   #33
  00aa cd0000           JSR   _POP32
   93:                + OS_TICKS_PER_SEC * ((INT32U)milli + 500L / OS_TICKS_PER_SEC) / 1000L;
   94:          loops = ticks / 65536L;                  /* Compute the integral number of 65536 tick delays   */
  00ad 95               TSX   
  00ae e632             LDA   50,X
  00b0 e736             STA   54,X
  00b2 e631             LDA   49,X
  00b4 e735             STA   53,X
   95:          ticks = ticks % 65536L;                  /* Obtain  the fractional number of ticks             */
  00b6 e634             LDA   52,X
  00b8 e734             STA   52,X

⌨️ 快捷键说明

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