📄 zdobject.s51
字号:
// 561
// 562 if ( bindReq->profileID == ZDO_EDBind->ProfileID )
// 563 {
// 564 // Check the first in against the seconds out
// 565 numMatches = ZDO_CompareClusterLists(
// 566 ZDO_EDBind->numOutClusters, ZDO_EDBind->outClusters,
// 567 bindReq->numInClusters, bindReq->inClusters, ZDOBuildBuf );
// 568
// 569 if ( numMatches )
// 570 {
// 571 // if existing bind exists, remove it
// 572 pBind = bindFindExisting( &(ZDO_EDBind->SrcAddr), ZDO_EDBind->epIntf,
// 573 &SrcAddr, bindReq->endpoint );
// 574 if ( pBind )
// 575 {
// 576 bindRemoveEntry( pBind );
// 577 Status = ZDP_SUCCESS;
// 578 }
// 579 // else add new binding table entry
// 580 else if ( bindAddEntry( &(ZDO_EDBind->SrcAddr), ZDO_EDBind->epIntf,
// 581 &SrcAddr, bindReq->endpoint, numMatches, ZDOBuildBuf ) )
// 582 Status = ZDP_SUCCESS;
// 583 else
// 584 Status = ZDP_TABLE_FULL;
// 585 }
// 586
// 587 // Check the second in against the first out
// 588 numMatches = ZDO_CompareClusterLists( bindReq->numOutClusters, bindReq->outClusters,
// 589 ZDO_EDBind->numInClusters, ZDO_EDBind->inClusters,
// 590 ZDOBuildBuf );
// 591
// 592 if ( numMatches )
// 593 {
// 594 // if existing bind exists, remove it
// 595 pBind = bindFindExisting( &SrcAddr, bindReq->endpoint, &(ZDO_EDBind->SrcAddr),
// 596 ZDO_EDBind->epIntf );
// 597 if ( pBind )
// 598 {
// 599 bindRemoveEntry( pBind );
// 600 Status = ZDP_SUCCESS;
// 601 }
// 602 // else add new binding table entry
// 603 else if ( bindAddEntry( &SrcAddr, bindReq->endpoint, &(ZDO_EDBind->SrcAddr),
// 604 ZDO_EDBind->epIntf, numMatches, ZDOBuildBuf ) )
// 605 Status = ZDP_SUCCESS;
// 606 else
// 607 Status = ZDP_TABLE_FULL;
// 608 }
// 609 }
// 610
// 611 if ( Status == ZDP_SUCCESS )
// 612 {
// 613 // We've found a match, so we don't have to wait for the timeout
// 614 APS_SetEndDeviceBindTimeout( 10, ZDO_EndDeviceTimeoutCB ); // psuedo stop end device timeout
// 615
// 616 // Notify to save info into NV
// 617 osal_start_timerEx( ZDAppTaskID, ZDO_NWK_UPDATE_NV, 250 );
// 618 }
// 619
// 620 ZDO_EDBind->status = Status;
// 621
// 622 // Send the response message to the device sending this message
// 623 ZDO_SendEDBindRsp( bindReq->TransSeq, &SrcAddr, Status, bindReq->SecurityUse );
// 624 }
// 625 else // Start a new End Device Bind
// 626 {
// 627 // Copy the info
// 628 ZDO_EDBind = osal_mem_alloc( sizeof( ZDO_EDBind_t ) );
// 629 if ( ZDO_EDBind )
// 630 {
// 631 osal_memcpy( &(ZDO_EDBind->SrcAddr), &SrcAddr, sizeof( zAddrType_t ) );
// 632 ZDO_EDBind->LocalCoordinator = bindReq->localCoordinator;
// 633 ZDO_EDBind->epIntf = bindReq->endpoint;
// 634 ZDO_EDBind->ProfileID = bindReq->profileID;
// 635 ZDO_EDBind->SrcTransSeq = bindReq->TransSeq;
// 636
// 637 ZDO_EDBind->numInClusters = bindReq->numInClusters;
// 638 if ( bindReq->numInClusters )
// 639 {
// 640 ZDO_EDBind->inClusters = osal_mem_alloc( (short)(bindReq->numInClusters * sizeof(uint16)) );
// 641 if ( ZDO_EDBind->inClusters )
// 642 {
// 643 osal_memcpy( ZDO_EDBind->inClusters, bindReq->inClusters, (bindReq->numInClusters * sizeof( uint16 )) );
// 644 }
// 645 else
// 646 {
// 647 // Force no clusters
// 648 ZDO_EDBind->numInClusters = 0;
// 649 }
// 650 }
// 651 else
// 652 ZDO_EDBind->inClusters = NULL;
// 653
// 654 ZDO_EDBind->numOutClusters = bindReq->numOutClusters;
// 655 if ( bindReq->numOutClusters )
// 656 {
// 657 ZDO_EDBind->outClusters = osal_mem_alloc( (short)(bindReq->numOutClusters*sizeof(uint16)) );
// 658 if ( ZDO_EDBind->outClusters )
// 659 {
// 660 osal_memcpy( ZDO_EDBind->outClusters, bindReq->outClusters, (bindReq->numOutClusters * sizeof( uint16 )) );
// 661 }
// 662 else
// 663 {
// 664 ZDO_EDBind->numOutClusters = 0;
// 665 }
// 666 }
// 667 else
// 668 ZDO_EDBind->outClusters = NULL;
// 669
// 670 ZDO_EDBind->SecurityUse = bindReq->SecurityUse;
// 671 ZDO_EDBind->status = ZDP_TIMEOUT;
// 672
// 673 // Setup the timer
// 674 APS_SetEndDeviceBindTimeout( AIB_MaxBindingTime, ZDO_EndDeviceTimeoutCB );
// 675 }
// 676 }
// 677 }
// 678 #endif // REFLECTOR
// 679
// 680 /*********************************************************************
// 681 * Utility functions
// 682 */
// 683
// 684 /*********************************************************************
// 685 * @fn ZDO_CreateAlignedUINT16List
// 686 *
// 687 * @brief Creates a list of cluster IDs that is guaranteed to be aligned.
// 688 * according to the needs of the target. If thre device is running
// 689 * Protocol version 1.0 the incoming buffer will have only a single
// 690 * byte for the cluster ID.
// 691 *
// 692 * Depends on the malloc taking care of alignment.
// 693 *
// 694 * When cluster ID went to 16 bits alignment for cluster IDs became
// 695 * an issue.
// 696 *
// 697 * @param num - number of entries in list
// 698 * @param buf - pointer to list
// 699 *
// 700 * @return pointer to aligned list. Null if can't allocate memory.
// 701 * Caller's responsibility to free memory.
// 702 */
RSEG BANKED_CODE:CODE:NOROOT(0)
// 703 static uint16 *ZDO_CreateAlignedUINT16List(uint8 num, uint8 *buf)
??ZDO_CreateAlignedUINT16List:
CFI Block cfiBlock7 Using cfiCommon0
CFI Function ??ZDO_CreateAlignedUINT16List
// 704 {
FUNCALL ??ZDO_CreateAlignedUINT16List, osal_mem_alloc
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
FUNCALL ??ZDO_CreateAlignedUINT16List, NLME_GetProtocolVersion
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
MOV A,#-0xe
LCALL ?BANKED_ENTER_XDATA
CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-7)))
CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-8)))
CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-9)))
CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-10)))
CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-11)))
CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-12)))
CFI VB load(1, XDATA, add(CFA_XSP16, literal(-13)))
CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-14)))
CFI CFA_SP SP+0
CFI CFA_XSP16 add(XSP16, 14)
; Saved register size: 14
; Auto size: 0
MOV ?V0 + 2,R1
MOV A,R2
MOV R6,A
MOV A,R3
MOV R7,A
// 705 uint16 *ptr;
// 706
// 707 if ((ptr=osal_mem_alloc((short)(num*sizeof(uint16))))) {
; Setup parameters for call to function osal_mem_alloc
MOV A,R1
CLR C
RLC A
MOV R2,A
CLR A
RLC A
MOV R3,A
MOV DPTR,#(osal_mem_alloc & 0xffff)
MOV A,#((osal_mem_alloc >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
MOV ?V0 + 0,R2
MOV ?V0 + 1,R3
MOV A,R2
JNZ ??ZDO_CreateAlignedUINT16List_1
MOV A,R3
??ZDO_CreateAlignedUINT16List_1:
JZ ??ZDO_CreateAlignedUINT16List_2
// 708 uint8 i, ubyte, inc;
// 709
// 710 inc = (ZB_PROT_V1_1 == NLME_GetProtocolVersion()) ? 2 : 1;
; Setup parameters for call to function NLME_GetProtocolVersion
MOV DPTR,#(NLME_GetProtocolVersion & 0xffff)
MOV A,#((NLME_GetProtocolVersion >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
MOV A,R1
XRL A,#0x2
JNZ ??ZDO_CreateAlignedUINT16List_3
MOV R3,#0x2
SJMP ??ZDO_CreateAlignedUINT16List_4
??ZDO_CreateAlignedUINT16List_3:
MOV R3,#0x1
// 711
// 712 for (i=0; i<num; ++i) {
??ZDO_CreateAlignedUINT16List_4:
MOV R2,#0x0
SJMP ??ZDO_CreateAlignedUINT16List_5
// 713 // set upper byte to 0 if we're talking Version 1.0. otherwise
// 714 // the buffer contains 16 bit cluster IDs.
// 715 ubyte = (2 == inc) ? buf[1] : 0;
??ZDO_CreateAlignedUINT16List_6:
MOV ?V0 + 3,#0x0
// 716 ptr[i] = BUILD_UINT16(buf[0], ubyte);
??ZDO_CreateAlignedUINT16List_7:
MOV DPL,R6
MOV DPH,R7
MOVX A,@DPTR
MOV R4,A
CLR A
ADD A,R4
MOV A,?V0 + 3
ADDC A,#0x0
MOV R5,A
MOV A,R2
CLR C
RLC A
MOV R0,A
CLR A
RLC A
MOV R1,A
MOV A,?V0 + 0
ADD A,R0
MOV DPL,A
MOV A,?V0 + 1
ADDC A,R1
MOV DPH,A
MOV A,R4
MOVX @DPTR,A
INC DPTR
MOV A,R5
MOVX @DPTR,A
// 717 buf += inc;
MOV ?V0 + 4,R3
MOV A,R6
ADD A,?V0 + 4
MOV R6,A
MOV A,R7
ADDC A,#0x0
MOV R7,A
INC R2
??ZDO_CreateAlignedUINT16List_5:
MOV A,R2
CLR C
SUBB A,?V0 + 2
JNC ??ZDO_CreateAlignedUINT16List_2
MOV A,#0x2
XRL A,R3
JNZ ??ZDO_CreateAlignedUINT16List_6
MOV DPL,R6
MOV DPH,R7
INC DPTR
MOVX A,@DPTR
MOV ?V0 + 3,A
SJMP ??ZDO_CreateAlignedUINT16List_7
// 718 }
// 719 }
// 720
// 721 return ptr;
??ZDO_CreateAlignedUINT16List_2:
MOV R2,?V0 + 0
MOV R3,?V0 + 1
CFI EndBlock cfiBlock7
REQUIRE ?Subroutine27
; // Fall through to label ?Subroutine27
// 722 }
RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine27:
CFI Block cfiBlock8 Using cfiCommon0
CFI NoFunction
CFI CFA_SP SP+0
CFI CFA_XSP16 add(XSP16, 14)
CFI VB load(1, XDATA, add(CFA_XSP16, literal(-13)))
CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-14)))
CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-12)))
CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-11)))
CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-10)))
CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-9)))
CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-8)))
CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-7)))
CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
MOV R7,#0x6
LJMP ?BANKED_LEAVE_XDATA
CFI EndBlock cfiBlock8
// 723
// 724 /*********************************************************************
// 725 * @fn ZDO_CompareByteLists
// 726 *
// 727 * @brief Compares two lists for matches.
// 728 *
// 729 * @param ACnt - number of entries in list A
// 730 * @param AList - List A
// 731 * @param BCnt - number of entries in list B
// 732 * @param BList - List B
// 733 *
// 734 * @return true if a match is found
// 735 */
RSEG BANKED_CODE:CODE:NOROOT(0)
// 736 byte ZDO_AnyClusterMatches( byte ACnt, uint16 *AList, byte BCnt, uint16 *BList )
ZDO_AnyClusterMatches:
CFI Block cfiBlock9 Using cfiCommon0
CFI Function ZDO_AnyClusterMatches
// 737 {
MOV A,#-0xc
LCALL ?BANKED_ENTER_XDATA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -