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

📄 mac_backoff_timer.lst

📁 用IAR开发的ZIGBEE网络路由例子
💻 LST
📖 第 1 页 / 共 5 页
字号:
##############################################################################
#                                                                            #
# IAR 8051 C/C++ Compiler V7.20H/W32                   06/Nov/2008  11:13:23 #
# Copyright 2004-2006 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Core               =  plain                                             #
#    Code model         =  banked                                            #
#    Data model         =  large                                             #
#    Calling convention =  xdata reentrant                                   #
#    Constant location  =  data                                              #
#    Dptr setup         =  1,16                                              #
#    Source file        =  E:\解决\路由\Components\mac\low_level\srf03\mac_b #
#                          ackoff_timer.c                                    #
#    Command line       =  -f E:\解决\路由\Projects\zstack\Samples\SampleApp #
#                          \CC2430DB\..\..\..\Tools\CC2430DB\f8wCoord.cfg    #
#                          (-DCPU32MHZ -DFORCE_MAC_NEAR -DROOT=__near_func   #
#                          -DMAC_CFG_APP_PENDING_QUEUE=TRUE                  #
#                          -DZDO_COORDINATOR -DRTR_NWK -DBLINK_LEDS          #
#                          "-DCONST=const __code" -DGENERIC=__generic) -f    #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\..\..\..\Tools\CC2430DB\f8wConfig.cfg      #
#                          (-DSECURE=0 -DDEFAULT_CHANLIST=0x00000800         #
#                          -DZDAPP_CONFIG_PAN_ID=0xFFFF                      #
#                          -DNWK_START_DELAY=100 -DEXTENDED_JOINING_RANDOM_M #
#                          ASK=0x007F -DBEACON_REQUEST_DELAY=100             #
#                          -DBEACON_REQ_DELAY_MASK=0x00FF                    #
#                          -DROUTE_EXPIRY_TIME=30 -DAPSC_ACK_WAIT_DURATION_P #
#                          OLLED=3000 -DNWK_INDIRECT_MSG_TIMEOUT=7           #
#                          -DMAX_RREQ_ENTRIES=10 -DAPSC_MAX_FRAME_RETRIES=3  #
#                          -DNWK_MAX_DATA_RETRIES=2                          #
#                          -DMAX_POLL_FAILURE_RETRIES=2 -DMAX_BCAST=9        #
#                          -DAPS_MAX_GROUPS=16 -DMAX_RTG_ENTRIES=20          #
#                          -DNWK_MAX_BINDING_ENTRIES=10                      #
#                          -DMAX_BINDING_CLUSTER_IDS=5                       #
#                          "-DDEFAULT_KEY={0x01, 0x03, 0x05, 0x07, 0x09,     #
#                          0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08,   #
#                          0x0A, 0x0C, 0x0D}" -DRFD_RCVC_ALWAYS_ON=FALSE     #
#                          -DPOLL_RATE=1000 -DQUEUED_POLL_RATE=100           #
#                          -DRESPONSE_POLL_RATE=100 -DREJOIN_POLL_RATE=440   #
#                          -DTOP_BOOT_PAGES=0) -I "D:\Program Files\IAR      #
#                          Systems\Embedded Workbench 4.05 Evaluation        #
#                          version\8051\inc\" -I "D:\Program Files\IAR       #
#                          Systems\Embedded Workbench 4.05 Evaluation        #
#                          version\8051\inc\clib\" -I                        #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\ -I E:\解决\路由\Projects\zstack\Samples\S #
#                          ampleApp\CC2430DB\..\Source\ -I                   #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\..\..\..\ZMain\TI2430DB\ -I                #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\..\..\..\..\..\Components\mt\ -I           #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\..\..\..\..\..\Components\hal\include\ -I  #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\..\..\..\..\..\Components\hal\target\CC243 #
#                          0DB\ -I E:\解决\路由\Projects\zstack\Samples\Samp #
#                          leApp\CC2430DB\..\..\..\..\..\Components\osal\mcu #
#                          \ccsoc\ -I E:\解决\路由\Projects\zstack\Samples\S #
#                          ampleApp\CC2430DB\..\..\..\..\..\Components\osal\ #
#                          include\ -I E:\解决\路由\Projects\zstack\Samples\ #
#                          SampleApp\CC2430DB\..\..\..\..\..\Components\stac #
#                          k\af\ -I E:\解决\路由\Projects\zstack\Samples\Sam #
#                          pleApp\CC2430DB\..\..\..\..\..\Components\stack\n #
#                          wk\ -I E:\解决\路由\Projects\zstack\Samples\Sampl #
#                          eApp\CC2430DB\..\..\..\..\..\Components\stack\sec #
#                          \ -I E:\解决\路由\Projects\zstack\Samples\SampleA #
#                          pp\CC2430DB\..\..\..\..\..\Components\stack\sys\  #
#                          -I E:\解决\路由\Projects\zstack\Samples\SampleApp #
#                          \CC2430DB\..\..\..\..\..\Components\stack\zdo\    #
#                          -I E:\解决\路由\Projects\zstack\Samples\SampleApp #
#                          \CC2430DB\..\..\..\..\..\Components\zmac\f8w\ -I  #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\..\..\..\..\..\Components\zmac\ -I         #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\..\..\..\..\..\Components\services\saddr\  #
#                          -I E:\解决\路由\Projects\zstack\Samples\SampleApp #
#                          \CC2430DB\..\..\..\..\..\Components\services\sdat #
#                          a\ -I E:\解决\路由\Projects\zstack\Samples\Sample #
#                          App\CC2430DB\..\..\..\..\..\Components\mac\includ #
#                          e\ -I E:\解决\路由\Projects\zstack\Samples\Sample #
#                          App\CC2430DB\..\..\..\..\..\Components\mac\high_l #
#                          evel\ -I E:\解决\路由\Projects\zstack\Samples\Sam #
#                          pleApp\CC2430DB\..\..\..\..\..\Components\mac\low #
#                          _level\srf03\ -I E:\解决\路由\Projects\zstack\Sam #
#                          ples\SampleApp\CC2430DB\..\..\..\..\..\Components #
#                          \mac\low_level\srf03\single_chip\ -D CC2430DB     #
#                          -lC E:\解决\路由\Projects\zstack\Samples\SampleAp #
#                          p\CC2430DB\CoordinatorDB\List\ -lA                #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\CoordinatorDB\List\ --diag_suppress        #
#                          Pe001,Pa010 --diag_remark pe550 -o                #
#                          E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\CoordinatorDB\Obj\ -e                      #
#                          --require_prototypes -z9 --no_code_motion         #
#                          --debug --core=plain --dptr=16,1                  #
#                          --data_model=large --code_model=banked            #
#                          --calling_convention=xdata_reentrant              #
#                          --place_constants=data --nr_virtual_regs 8        #
#                          E:\解决\路由\Components\mac\low_level\srf03\mac_b #
#                          ackoff_timer.c                                    #
#    List file          =  E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\CoordinatorDB\List\mac_backoff_timer.lst   #
#    Object file        =  E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
#                          2430DB\CoordinatorDB\Obj\mac_backoff_timer.r51    #
#                                                                            #
#                                                                            #
##############################################################################

E:\解决\路由\Components\mac\low_level\srf03\mac_backoff_timer.c
      1          /**************************************************************************************************
      2              Filename:
      3              Revised:        $Date: 2007-03-26 16:18:09 -0700 (Mon, 26 Mar 2007) $
      4              Revision:       $Revision: 13860 $
      5          
      6              Description:
      7          
      8              Describe the purpose and contents of the file.
      9          
     10              Copyright (c) 2006 by Texas Instruments, Inc.
     11              All Rights Reserved.  Permission to use, reproduce, copy, prepare
     12              derivative works, modify, distribute, perform, display or sell this
     13              software and/or its documentation for any purpose is prohibited
     14              without the express written consent of Texas Instruments, Inc.
     15          **************************************************************************************************/
     16          
     17          
     18          
     19          /* ------------------------------------------------------------------------------------------------
     20           *                                           Includes
     21           * ------------------------------------------------------------------------------------------------
     22           */
     23          
     24          /* hal */
     25          #include "hal_types.h"
     26          #include "hal_mcu.h"

   \                                 In segment SFR_AN, at 0xa6
   \   unsigned char volatile __sfr T2TLD
   \                     T2TLD:
   \   000000                DS 1

   \                                 In segment SFR_AN, at 0xa7
   \   unsigned char volatile __sfr T2THD
   \                     T2THD:
   \   000000                DS 1

   \                                 In segment SFR_AN, at 0xc3
   \   unsigned char volatile __sfr T2CNF
   \                     T2CNF:
   \   000000                DS 1
     27          
     28          /* high-level specific */
     29          #include "mac_spec.h"
     30          
     31          /* exported low-level */
     32          #include "mac_low_level.h"
     33          
     34          /* low-level specific */
     35          #include "mac_backoff_timer.h"
     36          #include "mac_tx.h"
     37          
     38          /* target specific */
     39          #include "mac_radio_defs.h"
     40          
     41          /* debug */
     42          #include "mac_assert.h"
     43          
     44          
     45          /* ------------------------------------------------------------------------------------------------
     46           *                                            Defines
     47           * ------------------------------------------------------------------------------------------------
     48           */
     49          #define COMPARE_STATE_ROLLOVER_BV                 BV(0)
     50          #define COMPARE_STATE_TRIGGER_BV                  BV(1)
     51          #define COMPARE_STATE_ARM_BV                      BV(2)
     52          
     53          #define COMPARE_STATE_TRIGGER                     COMPARE_STATE_TRIGGER_BV
     54          #define COMPARE_STATE_ROLLOVER                    COMPARE_STATE_ROLLOVER_BV
     55          #define COMPARE_STATE_ROLLOVER_AND_TRIGGER        (COMPARE_STATE_ROLLOVER_BV | COMPARE_STATE_TRIGGER_BV)
     56          #define COMPARE_STATE_ROLLOVER_AND_ARM_TRIGGER    (COMPARE_STATE_ROLLOVER_BV | COMPARE_STATE_ARM_BV)
     57          
     58          
     59          /*
     60           *  The datasheet mentions a small delay on both receive and transmit side of approximately
     61           *  two microseconds.  The precise characterization is given below.
     62           *  (This data is not given in rev 1.03 datasheet)
     63           */
     64          #define RX_TX_PROP_DELAY_AVG_USEC         ((MAC_RADIO_RX_TX_PROP_DELAY_MIN_USEC + MAC_RADIO_RX_TX_PROP_DELAY_MAX_USEC) / 2)
     65          #define RX_TX_PROP_DELAY_AVG_TIMER_TICKS  ((uint16)(MAC_RADIO_TIMER_TICKS_PER_USEC() * RX_TX_PROP_DELAY_AVG_USEC + 0.5))
     66          
     67          /*
     68           *  For slotted receives, the SFD signal is expected to occur on a specifc symbol boundary.
     69           *  This does *not* correspond to the backoff boundary.  The SFD signal occurs at an
     70           *  offset from the backoff boundary.  This is done for efficiency of related algorithms.
     71           *
     72           *  Once transmit is strobed there is a fixed delay until the SFD signal occurs.  The frame
     73           *  does not start over-the-air transmit until after an internal radio delay of 12 symbols.
     74           *  Once transmitting over-the-air, the preamble is sent (8 symbols) followed by the
     75           *  SFD field (2 symbols). After the SFD field completes, the SFD signal occurs.  This
     76           *  adds up to a total of 22 symbols from strobe to SFD signal.
     77           *
     78           *  Since 22 symbols spans more than a backoff (20 symbols) the modulus operation is used
     79           *  to find the symbol offset which is 2 symbols.
     80           *
     81           *  This math is derived formally via the pre-processor.
     82           */
     83          #define SYMBOLS_FROM_STROBE_TO_PREAMBLE   12 /* from datasheet */
     84          #define SYMBOLS_FROM_PREAMBLE_TO_SFD      (MAC_SPEC_PREAMBLE_FIELD_LENGTH + MAC_SPEC_SFD_FIELD_LENGTH)
     85          #define SYMBOLS_FROM_STROBE_TO_SFD        (SYMBOLS_FROM_STROBE_TO_PREAMBLE + SYMBOLS_FROM_PREAMBLE_TO_SFD)
     86          #define SYMBOLS_EXPECTED_AT_SFD           (SYMBOLS_FROM_STROBE_TO_SFD % MAC_A_UNIT_BACKOFF_PERIOD)
     87          
     88          /* after all that formal math, make sure the result is as expected */
     89          #if (SYMBOLS_EXPECTED_AT_SFD != 2)
     90          #error "ERROR! Internal problem with pre-processor math of slotted alignment."
     91          #endif
     92          
     93          
     94          /*
     95           *  The expected SFD signal occurs at the symbol offset *plus* a small internal propagation delay
     96           *  internal to the radio.  This delay is given as the sum of a receive side delay and a transmit
     97           *  side delay.  When this delay is subtracted from the internal timer, the internal time base
     98           *  actually becomes the actual receive time *minus* the transmit delay.  This works out though.
     99           *  The transmit logic does *not* take into account this delay.  Since the timer is skewed by the
    100           *  transmit delay already, the transmits go out precisely on time.
    101           */
    102          #define TIMER_TICKS_EXPECTED_AT_SFD   ((SYMBOLS_EXPECTED_AT_SFD * MAC_RADIO_TIMER_TICKS_PER_SYMBOL()) \
    103                                                    + RX_TX_PROP_DELAY_AVG_TIMER_TICKS)
    104          
    105          
    106          /* ------------------------------------------------------------------------------------------------
    107           *                                         Local Variables
    108           * ------------------------------------------------------------------------------------------------
    109           */

⌨️ 快捷键说明

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