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

📄 nwk_globals.s51

📁 用IAR开发的ZIGBEE网络路由例子
💻 S51
📖 第 1 页 / 共 3 页
字号:
//   50 #define NWK_MAX_DATABUFS_SCHEDULED  5     // Timed messages to be sent
//   51 #define NWK_MAX_DATABUFS_CONFIRMED  5     // Held after MAC confirms
//   52 #define NWK_MAX_DATABUFS_TOTAL      12    // Total number of buffers
//   53 
//   54 // 1-255 (0 -> 256) X RTG_TIMER_INTERVAL
//   55 // A known shortcoming is that when a message is enqueued as "hold" for a
//   56 // sleeping device, the timer tick may have counted down to 1, so that msg
//   57 // will not be held as long as expected. If NWK_INDIRECT_MSG_TIMEOUT is set to 1
//   58 // the hold time will vary randomly from 0 - CNT_RTG_TIMER ticks.
//   59 // So the hold time will vary within this interval:
//   60 // { (NWK_INDIRECT_MSG_TIMEOUT-1)*CNT_RTG_TIMER,
//   61 //                                    NWK_INDIRECT_MSG_TIMEOUT*CNT_RTG_TIMER }
//   62 #define NWK_INDIRECT_CNT_RTG_TMR    1  //ggg - need hours or days?
//   63 // To hold msg for sleeping end devices for 30 secs:
//   64 // #define CNT_RTG_TIMER            1
//   65 // #define NWK_INDIRECT_MSG_TIMEOUT 30
//   66 // To hold msg for sleeping end devices for 30 mins:
//   67 // #define CNT_RTG_TIMER            60
//   68 // #define NWK_INDIRECT_MSG_TIMEOUT 30
//   69 // To hold msg for sleeping end devices for 30 days:
//   70 // #define CNT_RTG_TIMER            60
//   71 // #define NWK_INDIRECT_MSG_TIMEOUT (30 * 24 * 60)
//   72 // Maximum msgs to hold per associated device.
//   73 #define NWK_INDIRECT_MSG_MAX_PER    3
//   74 // Maximum total msgs to hold for all associated devices.
//   75 #define NWK_INDIRECT_MSG_MAX_ALL    \ 
//   76                             (NWK_MAX_DATABUFS_TOTAL - NWK_INDIRECT_MSG_MAX_PER)
//   77 
//   78 
//   79 /*********************************************************************
//   80  * TYPEDEFS
//   81  */
//   82 
//   83 /*********************************************************************
//   84  * NWK GLOBAL VARIABLES
//   85  */
//   86 
//   87 // Variables for MAX list size

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   88 CONST uint16 gNWK_MAX_DEVICE_LIST = NWK_MAX_DEVICES;
gNWK_MAX_DEVICE_LIST:
        DW 21
//   89 
//   90 // Variables for MAX data buffer levels

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   91 CONST byte gNWK_MAX_DATABUFS_WAITING = NWK_MAX_DATABUFS_WAITING;
gNWK_MAX_DATABUFS_WAITING:
        DB 8

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   92 CONST byte gNWK_MAX_DATABUFS_SCHEDULED = NWK_MAX_DATABUFS_SCHEDULED;
gNWK_MAX_DATABUFS_SCHEDULED:
        DB 5

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   93 CONST byte gNWK_MAX_DATABUFS_CONFIRMED = NWK_MAX_DATABUFS_CONFIRMED;
gNWK_MAX_DATABUFS_CONFIRMED:
        DB 5

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   94 CONST byte gNWK_MAX_DATABUFS_TOTAL = NWK_MAX_DATABUFS_TOTAL;
gNWK_MAX_DATABUFS_TOTAL:
        DB 12
//   95 

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   96 CONST byte gNWK_INDIRECT_CNT_RTG_TMR = NWK_INDIRECT_CNT_RTG_TMR;
gNWK_INDIRECT_CNT_RTG_TMR:
        DB 1

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   97 CONST byte gNWK_INDIRECT_MSG_MAX_PER = NWK_INDIRECT_MSG_MAX_PER;
gNWK_INDIRECT_MSG_MAX_PER:
        DB 3

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//   98 CONST byte gNWK_INDIRECT_MSG_MAX_ALL = NWK_INDIRECT_MSG_MAX_ALL;
gNWK_INDIRECT_MSG_MAX_ALL:
        DB 9
//   99 
//  100 #if defined ( RTR_NWK )
//  101   // change this if using a different stack profile...
//  102   // Cskip array

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  103   uint16 *Cskip;
Cskip:
        DS 2
//  104 
//  105   #if ( STACK_PROFILE_ID == HOME_CONTROLS )

        RSEG XDATA_I:XDATA:NOROOT(0)
//  106     byte CskipRtrs[MAX_NODE_DEPTH+1] = {6,6,6,6,6,0};
CskipRtrs:
        DS 6
        REQUIRE `?<Initializer for CskipRtrs>`
        REQUIRE __INIT_XDATA_I

        RSEG XDATA_I:XDATA:NOROOT(0)
//  107     byte CskipChldrn[MAX_NODE_DEPTH+1] = {20,20,20,20,20,0};
CskipChldrn:
        DS 6
        REQUIRE `?<Initializer for CskipChldrn>`
        REQUIRE __INIT_XDATA_I
//  108   #elif ( STACK_PROFILE_ID == GENERIC_STAR )
//  109     byte CskipRtrs[MAX_NODE_DEPTH+1] = {5,5,5,5,5,0};
//  110     byte CskipChldrn[MAX_NODE_DEPTH+1] = {5,5,5,5,5,0};
//  111   #elif ( STACK_PROFILE_ID == NETWORK_SPECIFIC )
//  112     byte CskipRtrs[MAX_NODE_DEPTH+1] = {5,5,5,5,5,0};
//  113     byte CskipChldrn[MAX_NODE_DEPTH+1] = {5,5,5,5,5,0};
//  114   #endif // STACK_PROFILE_ID
//  115 #endif  // RTR_NWK
//  116 
//  117 
//  118 // Minimum lqi value that is required for association

        RSEG XDATA_I:XDATA:NOROOT(0)
//  119 byte gMIN_TREE_LINK_COST = MIN_LQI_COST_3;
gMIN_TREE_LINK_COST:
        DS 1
        REQUIRE `?<Initializer for gMIN_TREE_LINK_COST>`
        REQUIRE __INIT_XDATA_I
//  120 
//  121 #if defined(RTR_NWK)
//  122   // Statically defined Associated Device List

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  123   associated_devices_t AssociatedDevList[NWK_MAX_DEVICES];
AssociatedDevList:
        DS 294
//  124 #endif
//  125 

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  126 CONST byte gMAX_RTG_ENTRIES = MAX_RTG_ENTRIES;
gMAX_RTG_ENTRIES:
        DB 20

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  127 CONST byte gMAX_UNRESERVED_RTG_ENTRIES = MAX_UNRESERVED_RTG_ENTRIES;
gMAX_UNRESERVED_RTG_ENTRIES:
        DB 16

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  128 CONST byte gMAX_RREQ_ENTRIES = MAX_RREQ_ENTRIES;
gMAX_RREQ_ENTRIES:
        DB 10
//  129 

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  130 CONST byte gMAX_NEIGHBOR_ENTRIES = MAX_NEIGHBOR_ENTRIES;
gMAX_NEIGHBOR_ENTRIES:
        DB 8
//  131 
//  132  // Table of neighboring nodes (not including child nodes)

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  133 neighborEntry_t neighborTable[MAX_NEIGHBOR_ENTRIES];
neighborTable:
        DS 88
//  134 
//  135 #if defined ( RTR_NWK )
//  136   // Routing table

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  137   rtgEntry_t rtgTable[MAX_RTG_ENTRIES];
rtgTable:
        DS 120
//  138 
//  139   // Table of current RREQ packets in the network

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  140   rtDiscEntry_t rtDiscTable[MAX_RREQ_ENTRIES];
rtDiscTable:
        DS 80
//  141   
//  142   // Table of data broadcast packets currently in circulation.

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  143   bcastEntry_t bcastTable[MAX_BCAST];
bcastTable:
        DS 72
//  144   
//  145   // These 2 arrays are to be used as an array of struct { uint8, uint32 }.

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  146   uint8 bcastHoldHandle[MAX_BCAST];
bcastHoldHandle:
        DS 9

        RSEG XDATA_Z:XDATA:NOROOT(0)
        REQUIRE __INIT_XDATA_Z
//  147   uint32 bcastHoldAckMask[MAX_BCAST];
bcastHoldAckMask:
        DS 36
//  148   

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  149   CONST byte gMAX_BCAST = MAX_BCAST;
gMAX_BCAST:
        DB 9
//  150 #endif
//  151 
//  152 /*********************************************************************
//  153  * APS GLOBAL VARIABLES
//  154  */
//  155 
//  156 #if defined ( REFLECTOR )
//  157   // The Maximum number of binding records
//  158   // This number is defined in BindingTable.h - change it there.
//  159   CONST uint16 gNWK_MAX_BINDING_ENTRIES = NWK_MAX_BINDING_ENTRIES;
//  160 
//  161   // The Maximum number of cluster IDs in a binding record
//  162   // This number is defined in BindingTable.h - change it there.
//  163   CONST byte gMAX_BINDING_CLUSTER_IDS = MAX_BINDING_CLUSTER_IDS;
//  164 
//  165   CONST uint16 gBIND_REC_SIZE = sizeof( BindingEntry_t );
//  166 
//  167   // Binding Table
//  168   BindingEntry_t BindingTable[NWK_MAX_BINDING_ENTRIES];
//  169 #endif
//  170 
//  171 // Maximum number allowed in the groups table.

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  172 CONST uint8 gAPS_MAX_GROUPS = APS_MAX_GROUPS;
gAPS_MAX_GROUPS:
        DB 16
//  173 
//  174 // The size of a tx window when using fragmentation

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  175 CONST uint8 apscMaxWindowSize = APS_DEFAULT_WINDOW_SIZE;
apscMaxWindowSize:
        DB 5
//  176 
//  177 // The delay between tx packets when using fragmentaition

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  178 CONST uint16 gAPS_INTERFRAME_DELAY = APS_DEFAULT_INTERFRAME_DELAY;
gAPS_INTERFRAME_DELAY:
        DW 50
//  179 
//  180 
//  181 /*********************************************************************
//  182  * SECURITY GLOBAL VARIABLES
//  183  */
//  184 
//  185 // This is the default pre-configured key,
//  186 // change this to make a unique key
//  187 // SEC_KEY_LEN is defined in ssp.h.

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
//  188 CONST byte defaultKey[SEC_KEY_LEN] =
defaultKey:
        DB 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
//  189 {
//  190 #if defined ( APP_TP ) || defined ( APP_TP2 )
//  191   // Key for ZigBee Conformance Testing
//  192   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//  193   0x89, 0x67, 0x45, 0x23, 0x01, 0xEF, 0xCD, 0xAB
//  194 #else
//  195   // Key for In-House Testing
//  196   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
//  197   0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
//  198 #endif
//  199 };
//  200 
//  201 
//  202 /*********************************************************************
//  203  * STATUS STRINGS
//  204  */
//  205 #if defined ( LCD_SUPPORTED )
//  206   const char PingStr[]         = "Ping Rcvd from";
//  207   const char AssocCnfStr[]     = "Assoc Cnf";
//  208   const char SuccessStr[]      = "Success";
//  209   const char EndDeviceStr[]    = "EndDevice:";
//  210   const char ParentStr[]       = "Parent:";
//  211   const char ZigbeeCoordStr[]  = "ZigBee Coord";
//  212   const char NetworkIDStr[]    = "Network ID:";
//  213   const char RouterStr[]       = "Router:";
//  214   const char OrphanRspStr[]    = "Orphan Response";
//  215   const char SentStr[]         = "Sent";
//  216   const char FailedStr[]       = "Failed";
//  217   const char AssocRspFailStr[] = "Assoc Rsp fail";
//  218   const char AssocIndStr[]     = "Assoc Ind";
//  219   const char AssocCnfFailStr[] = "Assoc Cnf fail";
//  220   const char EnergyLevelStr[]  = "Energy Level";
//  221   const char ScanFailedStr[]   = "Scan Failed";
//  222 #endif
//  223 
//  224 /*********************************************************************
//  225  * @fn       nwk_globals_init()
//  226  *
//  227  * @brief
//  228  *
//  229  *   Initialize nwk layer globals.  These are the system defaults and
//  230  *   should be changed by the user here.  The default definitions are
//  231  *   defined in nwk.h or NLMEDE.h.
//  232  *
//  233  * @param   none
//  234  *
//  235  * @return  none
//  236  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  237 void nwk_globals_init( void )
nwk_globals_init:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function nwk_globals_init
//  238 {
        FUNCALL nwk_globals_init, AddrMgrInit
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL nwk_globals_init, osal_mem_alloc
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL nwk_globals_init, RTG_FillCSkipTable
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME XSTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME XSTACK, 2, STACK
        PUSH	DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH	DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  239   AddrMgrInit( NWK_MAX_ADDRESSES );
        ; Setup parameters for call to function AddrMgrInit
        MOV	R2,#0x16

⌨️ 快捷键说明

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