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

📄 timer.lst

📁 移植uIP1.0到51单片机上的版本mcu_netV1.00 uIP ARP / ICMP / TCP协议的完全移植
💻 LST
字号:
C51 COMPILER V7.06   TIMER                                                                 05/02/2009 15:51:24 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE TIMER
OBJECT MODULE PLACED IN .\timer.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\src\timer.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\timer.lst) OBJECT(.\
                    -timer.obj)

stmt level    source

   1          /**
   2           * \addtogroup timer
   3           * @{
   4           */
   5          
   6          /**
   7           * \file
   8           * Timer library implementation.
   9           * \author
  10           * Adam Dunkels <adam@sics.se>
  11           */
  12          
  13          /*
  14           * Copyright (c) 2004, Swedish Institute of Computer Science.
  15           * All rights reserved.
  16           *
  17           * Redistribution and use in source and binary forms, with or without
  18           * modification, are permitted provided that the following conditions
  19           * are met:
  20           * 1. Redistributions of source code must retain the above copyright
  21           *    notice, this list of conditions and the following disclaimer.
  22           * 2. Redistributions in binary form must reproduce the above copyright
  23           *    notice, this list of conditions and the following disclaimer in the
  24           *    documentation and/or other materials provided with the distribution.
  25           * 3. Neither the name of the Institute nor the names of its contributors
  26           *    may be used to endorse or promote products derived from this software
  27           *    without specific prior written permission.
  28           *
  29           * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
  30           * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31           * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32           * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
  33           * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  34           * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  35           * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  36           * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  37           * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  38           * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  39           * SUCH DAMAGE.
  40           *
  41           * This file is part of the uIP TCP/IP stack
  42           *
  43           * Author: Adam Dunkels <adam@sics.se>
  44           *
  45           * $Id: timer.c,v 1.2 2006/06/12 08:00:30 adam Exp $
  46           */
  47          
  48          #include "Timer.h"
  49          
  50          /*---------------------------------------------------------------------------*/
  51          /**
  52           * Set a timer.
  53           *
  54           * This function is used to set a timer for a time sometime in the
C51 COMPILER V7.06   TIMER                                                                 05/02/2009 15:51:24 PAGE 2   

  55           * future. The function timer_expired() will evaluate to true after
  56           * the timer has expired.
  57           *
  58           * \param t A pointer to the timer
  59           * \param interval The interval before the timer expires.
  60           *
  61           */
  62          void
  63          timer_set(struct timer *t, clock_time_t interval)
  64          {
  65   1        t->interval = interval;
  66   1        t->start = clock_time();
  67   1      }
  68          /*---------------------------------------------------------------------------*/
  69          /**
  70           * Reset the timer with the same interval.
  71           *
  72           * This function resets the timer with the same interval that was
  73           * given to the timer_set() function. The start point of the interval
  74           * is the exact time that the timer last expired. Therefore, this
  75           * function will cause the timer to be stable over time, unlike the
  76           * timer_rester() function.
  77           *
  78           * \param t A pointer to the timer.
  79           *
  80           * \sa timer_restart()
  81           */
  82          void
  83          timer_reset(struct timer *t)
  84          {
  85   1        t->start += t->interval;
  86   1      }
  87          /*---------------------------------------------------------------------------*/
  88          /**
  89           * Restart the timer from the current point in time
  90           *
  91           * This function restarts a timer with the same interval that was
  92           * given to the timer_set() function. The timer will start at the
  93           * current time.
  94           *
  95           * \note A periodic timer will drift if this function is used to reset
  96           * it. For preioric timers, use the timer_reset() function instead.
  97           *
  98           * \param t A pointer to the timer.
  99           *
 100           * \sa timer_reset()
 101           */
 102          void
 103          timer_restart(struct timer *t)
 104          {
 105   1        t->start = clock_time();
 106   1      }
 107          /*---------------------------------------------------------------------------*/
 108          /**
 109           * Check if a timer has expired.
 110           *
 111           * This function tests if a timer has expired and returns true or
 112           * false depending on its status.
 113           *
 114           * \param t A pointer to the timer
 115           *
 116           * \return Non-zero if the timer has expired, zero otherwise.
C51 COMPILER V7.06   TIMER                                                                 05/02/2009 15:51:24 PAGE 3   

 117           *
 118           */
 119          int
 120          timer_expired(struct timer *t)
 121          {
 122   1        return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval;
 123   1      }
 124          /*---------------------------------------------------------------------------*/
 125          
 126          /** @} */


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    154    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----       9
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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