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

📄 zdcache.s51

📁 用IAR开发的ZIGBEE网络路由例子
💻 S51
📖 第 1 页 / 共 4 页
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR 8051 C/C++ Compiler V7.20H/W32                  18/Sep/2008  17:36:44 /
// 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        =  C:\Texas Instruments\ZStack-1.4.2\Components\sta /
//                          ck\zdo\ZDCache.c                                 /
//    Command line       =  -f "C:\Texas Instruments\ZStack-1.4.2\Projects\z /
//                          stack\Samples\SampleApp\CC2430DB\..\..\..\Tools\ /
//                          CC2430DB\f8wRouter.cfg" (-DCPU32MHZ              /
//                          -DFORCE_MAC_NEAR -DROOT=__near_func              /
//                          -DMAC_CFG_APP_PENDING_QUEUE=TRUE -DRTR_NWK       /
//                          -DBLINK_LEDS "-DCONST=const __code"              /
//                          -DGENERIC=__generic) -f "C:\Texas                /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\Tools\CC2430DB\f8wC /
//                          onfig.cfg" (-DSECURE=0 -DDEFAULT_CHANLIST=0x0000 /
//                          0800 -DZDAPP_CONFIG_PAN_ID=0xFFFF                /
//                          -DNWK_START_DELAY=100 -DEXTENDED_JOINING_RANDOM_ /
//                          MASK=0x007F -DBEACON_REQUEST_DELAY=100           /
//                          -DBEACON_REQ_DELAY_MASK=0x00FF                   /
//                          -DROUTE_EXPIRY_TIME=30 -DAPSC_ACK_WAIT_DURATION_ /
//                          POLLED=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 "C:\Program Files\IAR     /
//                          Systems\Embedded Workbench 4.05 Evaluation       /
//                          version\8051\inc\" -I "C:\Program Files\IAR      /
//                          Systems\Embedded Workbench 4.05 Evaluation       /
//                          version\8051\inc\clib\" -I "C:\Texas             /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\" -I "C:\Texas               /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\Source\" -I "C:\Texas     /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\ZMain\TI2430DB\"    /
//                          -I "C:\Texas Instruments\ZStack-1.4.2\Projects\z /
//                          stack\Samples\SampleApp\CC2430DB\..\..\..\..\..\ /
//                          Components\mt\" -I "C:\Texas                     /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\ha /
//                          l\include\" -I "C:\Texas                         /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\ha /
//                          l\target\CC2430DB\" -I "C:\Texas                 /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\os /
//                          al\mcu\ccsoc\" -I "C:\Texas                      /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\os /
//                          al\include\" -I "C:\Texas                        /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\st /
//                          ack\af\" -I "C:\Texas Instruments\ZStack-1.4.2\P /
//                          rojects\zstack\Samples\SampleApp\CC2430DB\..\..\ /
//                          ..\..\..\Components\stack\nwk\" -I "C:\Texas     /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\st /
//                          ack\sec\" -I "C:\Texas Instruments\ZStack-1.4.2\ /
//                          Projects\zstack\Samples\SampleApp\CC2430DB\..\.. /
//                          \..\..\..\Components\stack\sys\" -I "C:\Texas    /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\st /
//                          ack\zdo\" -I "C:\Texas Instruments\ZStack-1.4.2\ /
//                          Projects\zstack\Samples\SampleApp\CC2430DB\..\.. /
//                          \..\..\..\Components\zmac\f8w\" -I "C:\Texas     /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\zm /
//                          ac\" -I "C:\Texas Instruments\ZStack-1.4.2\Proje /
//                          cts\zstack\Samples\SampleApp\CC2430DB\..\..\..\. /
//                          .\..\Components\services\saddr\" -I "C:\Texas    /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\se /
//                          rvices\sdata\" -I "C:\Texas                      /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\ma /
//                          c\include\" -I "C:\Texas                         /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\ma /
//                          c\high_level\" -I "C:\Texas                      /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\ma /
//                          c\low_level\srf03\" -I "C:\Texas                 /
//                          Instruments\ZStack-1.4.2\Projects\zstack\Samples /
//                          \SampleApp\CC2430DB\..\..\..\..\..\Components\ma /
//                          c\low_level\srf03\single_chip\" -D CC2430DB -D   /
//                          SOFT_START -D ZAPP_P1 -D HOLD_AUTO_START -lC     /
//                          "C:\Texas Instruments\ZStack-1.4.2\Projects\zsta /
//                          ck\Samples\SampleApp\CC2430DB\RouterDB\List\"    /
//                          -lA "C:\Texas Instruments\ZStack-1.4.2\Projects\ /
//                          zstack\Samples\SampleApp\CC2430DB\RouterDB\List\ /
//                          " --diag_suppress Pe001,Pa010 --diag_remark      /
//                          pe550 -o "C:\Texas Instruments\ZStack-1.4.2\Proj /
//                          ects\zstack\Samples\SampleApp\CC2430DB\RouterDB\ /
//                          Obj\" -e --require_prototypes -z9                /
//                          --no_code_motion --debug --core=plain            /
//                          --dptr=16,1 --data_model=large                   /
//                          --code_model=banked --calling_convention=xdata_r /
//                          eentrant --place_constants=data                  /
//                          --nr_virtual_regs 8 "C:\Texas                    /
//                          Instruments\ZStack-1.4.2\Components\stack\zdo\ZD /
//                          Cache.c"                                         /
//    List file          =  C:\Texas Instruments\ZStack-1.4.2\Projects\zstac /
//                          k\Samples\SampleApp\CC2430DB\RouterDB\List\ZDCac /
//                          he.s51                                           /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME ZDCache

        RTMODEL "__calling_convention", "xdata_reentrant"
        RTMODEL "__code_model", "banked"
        RTMODEL "__core", "plain"
        RTMODEL "__data_model", "large"
        RTMODEL "__dptr_size", "16"
        RTMODEL "__extended_stack", "disabled"
        RTMODEL "__location_for_constants", "data"
        RTMODEL "__number_of_dptrs", "1"
        RTMODEL "__rt_version", "1"

        RSEG DOVERLAY:DATA:NOROOT(0)
        RSEG IOVERLAY:IDATA:NOROOT(0)
        RSEG ISTACK:IDATA:NOROOT(0)
        RSEG PSTACK:XDATA:NOROOT(0)
        RSEG XSTACK:XDATA:NOROOT(0)


        END
// C:\Texas Instruments\ZStack-1.4.2\Components\stack\zdo\ZDCache.c
//    1 /*********************************************************************
//    2     Filename:       ZDCache.c
//    3     Revised:        $Date: 2007-02-15 15:11:28 -0800 (Thu, 15 Feb 2007) $
//    4     Revision:       $Revision: 13481 $
//    5 
//    6     Description: Implementation of the ZDO Discovery Cache functionality.
//    7 
//    8     Notes:
//    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 #if defined( ZDO_CACHE )
//   17 
//   18 /*********************************************************************
//   19  * INCLUDES
//   20  */
//   21 #include "AF.h"
//   22 #include "nwk_globals.h"
//   23 #include "nwk_util.h"
//   24 #include "OSAL.h"
//   25 #include "ZDCache.h"
//   26 #include "ZDConfig.h"
//   27 #include "ZDObject.h"
//   28 
//   29 
//   30 /*********************************************************************
//   31  * MACROS
//   32  */
//   33 
//   34 /*********************************************************************
//   35  * CONSTANTS
//   36  */
//   37 
//   38 #define MAX_PKT_LEN  (MAX_DATA_PACKET_LEN - NWK_HDR_LEN)
//   39 
//   40 #if ( CACHE_DEV_MAX == 0 )
//   41   #define WAIT_ON_RESP_CACHE  5
//   42 
//   43   #define FIND_RSP_MAX  16
//   44 #endif
//   45 
//   46 #define SendMsg( CMD, LEN, DATA ) \ 
//   47   afAddOrSendMessage(   &msgAddr,             /* *DestAddr         */\ 
//   48                         ZDO_EP,               /*  Endpoint         */\ 
//   49                         (CMD),                /*  ClusterId        */\ 
//   50                         SEND_MESSAGE,         /*  TransCount       */\ 
//   51                         FRAMETYPE_MSG,        /*  FrameType        */\ 
//   52                         &tranSeq,             /* *TransSeqNumber   */\ 
//   53                         NULL,                 /*  CommandType      */\ 
//   54                         NULL,                 /*  AttribDataType   */\ 
//   55                         NULL,                 /*  AttribId         */\ 
//   56                         NULL,                 /*  ErrorCode        */\ 
//   57                         (LEN),                /*  DataLength       */\ 
//   58                         (DATA),               /* *Data             */\ 
//   59                         AF_TX_OPTIONS_NONE,   \ 
//   60                         FALSE,                /*  Discover route   */\ 
//   61                         radius )
//   62 
//   63 /*********************************************************************
//   64  * TYPEDEFS
//   65  */
//   66 
//   67 #if ( CACHE_DEV_MAX == 0 )
//   68 typedef enum {
//   69   eCacheWait,
//   70   eCacheClean,
//   71   eCacheFind,
//   72   eCacheRequest,
//   73   eNodeDescStore,
//   74   ePwrDescStore,
//   75   eActiveEPStore,
//   76   eSimpDescStore,
//   77   eCacheDone
//   78 } eCacheState;
//   79 #endif
//   80 
//   81 /*********************************************************************
//   82  * GLOBAL VARIABLES
//   83  */
//   84 
//   85 /*********************************************************************
//   86  * EXTERNAL VARIABLES
//   87  */
//   88 
//   89 /*********************************************************************
//   90  * EXTERNAL FUNCTIONS
//   91  */
//   92 
//   93 /*********************************************************************
//   94  * LOCAL FUNCTIONS
//   95  */
//   96 
//   97 #if ( CACHE_DEV_MAX > 0 )
//   98 static byte processDiscoveryStoreReq  ( byte *data );
//   99 static byte processSimpleDescStoreReq ( byte *data, byte idx );
//  100 static void processFindNodeCacheReq   ( byte *data );
//  101 
//  102 static byte getCnt    ( void );
//  103 static byte getIdx    ( uint16 addr );
//  104 static byte getNth    ( byte Nth );
//  105 static byte getIdxExt ( byte *ieee );
//  106 static byte getIdxEP  ( byte idx, byte ep );
//  107 static byte purgeAddr ( uint16 addr );
//  108 static byte purgeIEEE ( byte *ieee );
//  109 #endif
//  110 
//  111 /*********************************************************************
//  112  * LOCAL VARIABLES
//  113  */
//  114 
//  115 static afAddrType_t msgAddr;
//  116 static byte radius;
//  117 static byte tranSeq;
//  118 static byte secUse;
//  119 
//  120 #if ( CACHE_DEV_MAX > 0 )
//  121 static uint16                      NwkAddr[CACHE_DEV_MAX];
//  122 static byte                        ExtAddr[CACHE_DEV_MAX][Z_EXTADDR_LEN];
//  123 static uint32                       Expiry[CACHE_DEV_MAX];
//  124 static NodeDescriptorFormat_t     NodeDesc[CACHE_DEV_MAX];
//  125 static NodePowerDescriptorFormat_t NodePwr[CACHE_DEV_MAX];
//  126 static byte                          EPCnt[CACHE_DEV_MAX];
//  127 static byte                          EPArr[CACHE_DEV_MAX][CACHE_EP_MAX];
//  128 static SimpleDescriptionFormat_t  SimpDesc[CACHE_DEV_MAX][CACHE_EP_MAX];
//  129 static uint16               InClusters[CACHE_DEV_MAX][CACHE_EP_MAX][CACHE_CR_MAX];
//  130 static uint16              OutClusters[CACHE_DEV_MAX][CACHE_EP_MAX][CACHE_CR_MAX];
//  131 #elif ( CACHE_DEV_MAX == 0 )
//  132 static uint16 cacheFindAddr[FIND_RSP_MAX];
//  133 static byte EPArr[CACHE_EP_MAX];
//  134 static byte EPCnt;
//  135 static byte cacheCnt;  // Count of responding cache devices.
//  136 static byte cacheRsp;  // Results of last discovery cache request.
//  137 #endif
//  138 
//  139 
//  140 
//  141 #if ( CACHE_DEV_MAX > 0 )
//  142 /*********************************************************************
//  143  * @fn          processDiscoveryStoreReq
//  144  *
//  145  * @brief       Process a Discovery_store_req
//  146  *
//  147  * @return      none
//  148  */
//  149 static byte processDiscoveryStoreReq( byte *data )
//  150 {
//  151   uint16 aoi = BUILD_UINT16( data[0], data[1] );
//  152   byte rtrn = ZDP_INSUFFICIENT_SPACE;
//  153   byte idx;
//  154 
//  155   data += 2;
//  156   // First purge any outdated cache with this network address or IEEE.
//  157   purgeAddr( aoi );
//  158   purgeIEEE( data );
//  159 
//  160   // If an invalid addr cannot be found, the cache arrays are full.
//  161   if ( (idx = getIdx( INVALID_NODE_ADDR )) != CACHE_DEV_MAX )
//  162   {
//  163     osal_cpyExtAddr( ExtAddr[idx], data );
//  164     data += Z_EXTADDR_LEN;
//  165 
//  166     if ( (*data++ == sizeof( NodeDescriptorFormat_t )) &&
//  167          (*data++ == sizeof( NodePowerDescriptorFormat_t )) &&
//  168          (*data++ <= CACHE_EP_MAX) &&
//  169          (*data   < CACHE_EP_MAX) )
//  170     {
//  171       rtrn = ZDP_SUCCESS;
//  172       NwkAddr[idx] = aoi;
//  173       Expiry[idx] = 0;  //TBD - what value & how to keep alive?
//  174       EPCnt[idx] = 0;
//  175     }
//  176   }
//  177 
//  178   return rtrn;
//  179 }
//  180 
//  181 /*********************************************************************
//  182  * @fn          processSimpleDescStoreReq
//  183  *
//  184  * @brief       Process a Simple_Desc_store_req
//  185  *
//  186  * @return      none
//  187  */
//  188 static byte processSimpleDescStoreReq( byte *data, byte idx )
//  189 {
//  190   byte rtrn = ZDP_INSUFFICIENT_SPACE;
//  191   SimpleDescriptionFormat_t desc;
//  192 

⌨️ 快捷键说明

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