📄 zdobject.lst
字号:
\ 000065 E0 MOVX A,@DPTR
\ 000066 FE MOV R6,A
\ 000067 A3 INC DPTR
\ 000068 E0 MOVX A,@DPTR
\ 000069 FF MOV R7,A
411 }
\ ??ZDO_UpdateNwkStatus_0:
\ 00006A EE MOV A,R6
\ 00006B 7001 JNZ ??ZDO_UpdateNwkStatus_4
\ 00006D EF MOV A,R7
\ ??ZDO_UpdateNwkStatus_4:
\ 00006E 70B9 JNZ ??ZDO_UpdateNwkStatus_1
412 }
\ 000070 02.... LJMP ?Subroutine22 & 0xFFFF
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine18:
\ 000000 E0 MOVX A,@DPTR
\ 000001 F8 MOV R0,A
\ ??Subroutine18_0:
\ 000002 A3 INC DPTR
\ 000003 E0 MOVX A,@DPTR
\ 000004 F583 MOV DPH,A
\ 000006 8882 MOV DPL,R0
\ 000008 22 RET
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine10:
\ 000000 12.... LCALL ?Subroutine15 & 0xFFFF
\ ??CrossCallReturnLabel_40:
\ 000003 22 RET
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine15:
\ 000000 E0 MOVX A,@DPTR
\ 000001 F8 MOV R0,A
\ 000002 A3 INC DPTR
\ 000003 E0 MOVX A,@DPTR
\ 000004 F583 MOV DPH,A
\ 000006 8882 MOV DPL,R0
\ 000008 E0 MOVX A,@DPTR
\ 000009 22 RET
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine5:
\ 000000 12.... LCALL ?Subroutine18 & 0xFFFF
\ ??CrossCallReturnLabel_47:
\ 000003 A3 INC DPTR
\ 000004 12.... LCALL ?Subroutine15 & 0xFFFF
\ ??CrossCallReturnLabel_38:
\ 000007 F9 MOV R1,A
\ 000008 90.... MOV DPTR,#(osal_msg_send & 0xffff)
\ 00000B 74.. MOV A,#((osal_msg_send >> 16) & 0xff)
\ 00000D 22 RET
413
414 #if defined ( REFLECTOR )
415 /*********************************************************************
416 * @fn ZDO_RemoveEndDeviceBind
417 *
418 * @brief Remove the end device bind
419 *
420 * @param none
421 *
422 * @return none
423 */
424 static void ZDO_RemoveEndDeviceBind( void )
425 {
426 if ( ZDO_EDBind )
427 {
428 // Free the RAM
429 if ( ZDO_EDBind->inClusters )
430 osal_mem_free( ZDO_EDBind->inClusters );
431 if ( ZDO_EDBind->outClusters )
432 osal_mem_free( ZDO_EDBind->outClusters );
433 osal_mem_free( ZDO_EDBind );
434 ZDO_EDBind = NULL;
435 }
436 }
437 #endif // REFLECTOR
438
439 #if defined ( REFLECTOR )
440 /*********************************************************************
441 * @fn ZDO_RemoveEndDeviceBind
442 *
443 * @brief Remove the end device bind
444 *
445 * @param none
446 *
447 * @return none
448 */
449 static void ZDO_SendEDBindRsp( byte TransSeq, zAddrType_t *dstAddr, byte Status, byte secUse )
450 {
451 ZDP_EndDeviceBindRsp( TransSeq, dstAddr, Status, secUse );
452
453 #if defined( LCD_SUPPORTED )
454 HalLcdWriteString( "End Device Bind", HAL_LCD_LINE_1 );
455 if ( Status == ZDP_SUCCESS )
456 HalLcdWriteString( "Success Sent", HAL_LCD_LINE_2 );
457 else
458 HalLcdWriteString( "Timeout", HAL_LCD_LINE_2 );
459 #endif
460
461 }
462 #endif // REFLECTOR
463
464 #if defined ( REFLECTOR ) || defined ( ZDO_COORDINATOR )
465 /*********************************************************************
466 * @fn ZDO_CompareClusterLists
467 *
468 * @brief Compare one list to another list
469 *
470 * @param numList1 - number of items in list 1
471 * @param list1 - first list of cluster IDs
472 * @param numList2 - number of items in list 2
473 * @param list2 - second list of cluster IDs
474 * @param pMatches - buffer to put matches
475 *
476 * @return number of matches
477 */
478 static byte ZDO_CompareClusterLists( byte numList1, uint16 *list1,
479 byte numList2, uint16 *list2, uint16 *pMatches )
480 {
481 byte x, y;
482 uint16 z;
483 byte numMatches = 0;
484
485 // Check the first in against the seconds out
486 for ( x = 0; x < numList1; x++ )
487 {
488 for ( y = 0; y < numList2; y++ )
489 {
490 z = list2[y];
491 if ( list1[x] == z )
492 pMatches[numMatches++] = z;
493 }
494 }
495
496 return ( numMatches );
497 }
498 #endif // REFLECTOR || ZDO_COORDINATOR
499
500 #if defined ( REFLECTOR )
501 /*********************************************************************
502 * @fn ZDO_DoEndDeviceBind
503 *
504 * @brief Process the End Device Bind Req from ZDApp
505 *
506 * @param bindReq - Bind Request Information
507 * @param SecurityUse - Security enable/disable
508 *
509 * @return none
510 */
511 void ZDO_DoEndDeviceBind( ZDEndDeviceBind_t *bindReq )
512 {
513 uint8 numMatches;
514 uint8 Status;
515 BindingEntry_t *pBind;
516 AddrMgrEntry_t addrEntry;
517 zAddrType_t SrcAddr;
518
519 SrcAddr.addrMode = Addr16Bit;
520 SrcAddr.addr.shortAddr = bindReq->srcAddr;
521
522 // Ask for IEEE address
523 if ( (bindReq->srcAddr != ZDAppNwkAddr.addr.shortAddr) )
524 {
525 addrEntry.user = ADDRMGR_USER_BINDING;
526 addrEntry.nwkAddr = bindReq->srcAddr;
527 Status = AddrMgrEntryLookupNwk( &addrEntry );
528 if ( Status == TRUE)
529 {
530 // Add a reference to entry
531 AddrMgrEntryAddRef( &addrEntry );
532 }
533 else
534 {
535 // If we have the extended address
536 if ( NLME_GetProtocolVersion() != ZB_PROT_V1_0 )
537 {
538 osal_cpyExtAddr( addrEntry.extAddr, bindReq->ieeeAddr );
539 }
540
541 // Not in address manager?
542 AddrMgrEntryUpdate( &addrEntry ); // Add it
543 }
544
545 if ( AddrMgrExtAddrValid( addrEntry.extAddr ) == FALSE )
546 {
547 ZDP_IEEEAddrReq( bindReq->srcAddr, ZDP_ADDR_REQTYPE_SINGLE, 0, false );
548 }
549 }
550
551 if ( ZDO_EDBind ) // End Device Bind in progress
552 {
553 Status = ZDP_NO_MATCH;
554
555 if ( bindReq->profileID == ZDO_EDBind->ProfileID )
556 {
557 // Check the first in against the seconds out
558 numMatches = ZDO_CompareClusterLists(
559 ZDO_EDBind->numOutClusters, ZDO_EDBind->outClusters,
560 bindReq->numInClusters, bindReq->inClusters, ZDOBuildBuf );
561
562 if ( numMatches )
563 {
564 // if existing bind exists, remove it
565 pBind = bindFindExisting( &(ZDO_EDBind->SrcAddr), ZDO_EDBind->epIntf,
566 &SrcAddr, bindReq->endpoint );
567 if ( pBind )
568 {
569 bindRemoveEntry( pBind );
570 Status = ZDP_SUCCESS;
571 }
572 // else add new binding table entry
573 else if ( bindAddEntry( &(ZDO_EDBind->SrcAddr), ZDO_EDBind->epIntf,
574 &SrcAddr, bindReq->endpoint, numMatches, ZDOBuildBuf ) )
575 Status = ZDP_SUCCESS;
576 else
577 Status = ZDP_TABLE_FULL;
578 }
579
580 // Check the second in against the first out
581 numMatches = ZDO_CompareClusterLists( bindReq->numOutClusters, bindReq->outClusters,
582 ZDO_EDBind->numInClusters, ZDO_EDBind->inClusters,
583 ZDOBuildBuf );
584
585 if ( numMatches )
586 {
587 // if existing bind exists, remove it
588 pBind = bindFindExisting( &SrcAddr, bindReq->endpoint, &(ZDO_EDBind->SrcAddr),
589 ZDO_EDBind->epIntf );
590 if ( pBind )
591 {
592 bindRemoveEntry( pBind );
593 Status = ZDP_SUCCESS;
594 }
595 // else add new binding table entry
596 else if ( bindAddEntry( &SrcAddr, bindReq->endpoint, &(ZDO_EDBind->SrcAddr),
597 ZDO_EDBind->epIntf, numMatches, ZDOBuildBuf ) )
598 Status = ZDP_SUCCESS;
599 else
600 Status = ZDP_TABLE_FULL;
601 }
602 }
603
604 if ( Status == ZDP_SUCCESS )
605 {
606 // We've found a match, so we don't have to wait for the timeout
607 APS_SetEndDeviceBindTimeout( 10, ZDO_EndDeviceTimeoutCB ); // psuedo stop end device timeout
608
609 // Notify to save info into NV
610 osal_start_timerEx( ZDAppTaskID, ZDO_NWK_UPDATE_NV, 250 );
611 }
612
613 ZDO_EDBind->status = Status;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -