📄 nwk_globals.lst
字号:
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.
\ In segment CODE_C, align 1
188 CONST byte defaultKey[SEC_KEY_LEN] =
\ defaultKey:
\ 000000 00010203 DB 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
\ 04050607
\ 08090A0B
\ 0C0D0E0F
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 */
\ In segment BANKED_CODE, align 1, keep-with-next
237 void nwk_globals_init( void )
\ nwk_globals_init:
238 {
\ 000000 C082 PUSH DPL
\ 000002 C083 PUSH DPH
\ 000004 ; Saved register size: 2
\ 000004 ; Auto size: 0
239 AddrMgrInit( NWK_MAX_ADDRESSES );
\ 000004 ; Setup parameters for call to function AddrMgrInit
\ 000004 7A20 MOV R2,#0x20
\ 000006 7B00 MOV R3,#0x0
\ 000008 90.... MOV DPTR,#(AddrMgrInit & 0xffff)
\ 00000B 74.. MOV A,#((AddrMgrInit >> 16) & 0xff)
\ 00000D 12.... LCALL ?BCALL ; Banked call to: DPTR()
240
241 #if defined ( RTR_NWK )
242 // Initialize the Cskip Table
243 Cskip = osal_mem_alloc(sizeof(uint16) *(MAX_NODE_DEPTH+1));
\ 000010 ; Setup parameters for call to function osal_mem_alloc
\ 000010 7A0C MOV R2,#0xc
\ 000012 7B00 MOV R3,#0x0
\ 000014 90.... MOV DPTR,#(osal_mem_alloc & 0xffff)
\ 000017 74.. MOV A,#((osal_mem_alloc >> 16) & 0xff)
\ 000019 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 00001C 90.... MOV DPTR,#Cskip
\ 00001F EA MOV A,R2
\ 000020 F0 MOVX @DPTR,A
\ 000021 A3 INC DPTR
\ 000022 EB MOV A,R3
\ 000023 F0 MOVX @DPTR,A
244 RTG_FillCSkipTable(CskipChldrn, CskipRtrs, MAX_NODE_DEPTH, Cskip);
\ 000024 ; Setup parameters for call to function RTG_FillCSkipTable
\ 000024 90.... MOV DPTR,#Cskip
\ 000027 12.... LCALL ?PUSH_XSTACK8_X_TWO
\ 00002A 7905 MOV R1,#0x5
\ 00002C 7C.. MOV R4,#(CskipRtrs & 0xff)
\ 00002E 7D.. MOV R5,#((CskipRtrs >> 8) & 0xff)
\ 000030 7A.. MOV R2,#(CskipChldrn & 0xff)
\ 000032 7B.. MOV R3,#((CskipChldrn >> 8) & 0xff)
\ 000034 90.... MOV DPTR,#(RTG_FillCSkipTable & 0xffff)
\ 000037 74.. MOV A,#((RTG_FillCSkipTable >> 16) & 0xff)
\ 000039 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 00003C 7402 MOV A,#0x2
\ 00003E 12.... LCALL ?DEALLOC_XSTACK8
245 #endif
246 }
\ 000041 REQUIRE ?Subroutine0
\ 000041 ; // Fall through to label ?Subroutine0
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine0:
\ 000000 D083 POP DPH
\ 000002 D082 POP DPL
\ 000004 02.... LJMP ?BRET
247
248 /*********************************************************************
249 * @fn NIB_init()
250 *
251 * @brief
252 *
253 * Initialize attribute values in NIB
254 *
255 * @param none
256 *
257 * @return none
258 */
\ In segment BANKED_CODE, align 1, keep-with-next
259 void NIB_init()
\ NIB_init:
260 {
\ 000000 C082 PUSH DPL
\ 000002 C083 PUSH DPH
\ 000004 ; Saved register size: 2
\ 000004 ; Auto size: 0
261 #if defined ( AUTO_SOFT_START )
262 byte extAddr[Z_EXTADDR_LEN];
263 ZMacGetReq( ZMacExtAddr, extAddr );
264 _NIB.SequenceNum = extAddr[0];
265 #else
266 _NIB.SequenceNum = 1;
\ 000004 7401 MOV A,#0x1
\ 000006 90.... MOV DPTR,#_NIB
\ 000009 F0 MOVX @DPTR,A
267 #endif
268
269 _NIB.MaxDepth = MAX_NODE_DEPTH;
\ 00000A 7405 MOV A,#0x5
\ 00000C 90.... MOV DPTR,#(_NIB + 4)
\ 00000F F0 MOVX @DPTR,A
270
271 #if ( NWK_MODE == NWK_MODE_MESH )
272 _NIB.beaconOrder = BEACON_ORDER_NO_BEACONS;
\ 000010 740F MOV A,#0xf
\ 000012 90.... MOV DPTR,#(_NIB + 40)
\ 000015 F0 MOVX @DPTR,A
273 _NIB.superFrameOrder = BEACON_ORDER_NO_BEACONS;
\ 000016 90.... MOV DPTR,#(_NIB + 41)
\ 000019 F0 MOVX @DPTR,A
274 #endif
275
276 // BROADCAST SETTINGS:
277 // *******************
278 // Broadcast Delivery Time
279 // - set to multiples of 100ms
280 // - should be 500ms more than the retry time
281 // - "retry time" = PassiveAckTimeout * (MaxBroadcastRetries + 1)
282 // Passive Ack Timeout
283 // - set to multiples of 100ms
284 _NIB.BroadcastDeliveryTime = zgBcastDeliveryTime;
\ 00001A 90.... MOV DPTR,#zgBcastDeliveryTime
\ 00001D E0 MOVX A,@DPTR
\ 00001E 90.... MOV DPTR,#(_NIB + 7)
\ 000021 F0 MOVX @DPTR,A
285 _NIB.PassiveAckTimeout = zgPassiveAckTimeout;
\ 000022 90.... MOV DPTR,#zgPassiveAckTimeout
\ 000025 E0 MOVX A,@DPTR
\ 000026 90.... MOV DPTR,#(_NIB + 1)
\ 000029 F0 MOVX @DPTR,A
286 _NIB.MaxBroadcastRetries = zgMaxBcastRetires;
\ 00002A 90.... MOV DPTR,#zgMaxBcastRetires
\ 00002D E0 MOVX A,@DPTR
\ 00002E 90.... MOV DPTR,#(_NIB + 2)
\ 000031 F0 MOVX @DPTR,A
287
288 _NIB.ReportConstantCost = 0;
\ 000032 E4 CLR A
\ 000033 90.... MOV DPTR,#(_NIB + 8)
\ 000036 F0 MOVX @DPTR,A
289 _NIB.RouteDiscRetries = 0;
\ 000037 90.... MOV DPTR,#(_NIB + 9)
\ 00003A F0 MOVX @DPTR,A
290 _NIB.SecureAllFrames = USE_NWK_SECURITY;
\ 00003B 90.... MOV DPTR,#(_NIB + 11)
\ 00003E F0 MOVX @DPTR,A
291 _NIB.SecurityLevel = zgSecurityLevel;
\ 00003F 90.... MOV DPTR,#zgSecurityLevel
\ 000042 E0 MOVX A,@DPTR
\ 000043 90.... MOV DPTR,#(_NIB + 12)
\ 000046 F0 MOVX @DPTR,A
292 _NIB.SymLink = 0;
\ 000047 E4 CLR A
\ 000048 90.... MOV DPTR,#(_NIB + 13)
\ 00004B F0 MOVX @DPTR,A
293 _NIB.CapabilityInfo = ZDO_Config_Node_Descriptor.CapabilityFlags;
\ 00004C 90.... MOV DPTR,#(ZDO_Config_Node_Descriptor + 2)
\ 00004F E0 MOVX A,@DPTR
\ 000050 90.... MOV DPTR,#(_NIB + 14)
\ 000053 F0 MOVX @DPTR,A
294
295 _NIB.TransactionPersistenceTime = zgIndirectMsgTimeout;
\ 000054 90.... MOV DPTR,#zgIndirectMsgTimeout
\ 000057 E0 MOVX A,@DPTR
\ 000058 90.... MOV DPTR,#(_NIB + 15)
\ 00005B F0 MOVX @DPTR,A
\ 00005C A3 INC DPTR
\ 00005D E4 CLR A
\ 00005E F0 MOVX @DPTR,A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -