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

📄 mac_support.s51

📁 zigbee location examples
💻 S51
📖 第 1 页 / 共 5 页
字号:
        INC	DPTR
        MOVX	A,@DPTR
        MOV	R3,A
        MOV	A,#0x14
        LCALL	?XSTACK_DISP0_8
        MOVX	A,@DPTR
        MOV	R0,A
        INC	DPTR
        MOVX	A,@DPTR
        MOV	DPH,A
        MOV	DPL,R0
        MOVX	A,@DPTR
        XRL	A,R2
        JNZ	??msupPrepareHeader_10
        INC	DPTR
        MOVX	A,@DPTR
        XRL	A,R3
??msupPrepareHeader_10:
        JNZ	??msupPrepareHeader_11
        SETB	B.0
        SJMP	??msupPrepareHeader_12
??msupPrepareHeader_5:
        MOV	A,?V0 + 2
        ADD	A,#-0x7c
        MOV	DPL,A
        MOV	A,?V0 + 3
        ADDC	A,#0x0
        MOV	DPH,A
        CLR	A
        SJMP	??msupPrepareHeader_13
??msupPrepareHeader_11:
        CLR	B.0
??msupPrepareHeader_12:
        MOV	C,B.0
        CLR	A
        MOV	0xE0 /* A   */.0,C
        SJMP	??msupPrepareHeader_14
//  410     } else if ((addrModes & DEST_ADDR_BM) == DEST_ADDR_EXT) {
??msupPrepareHeader_9:
        MOV	A,#0xc
        XRL	A,R4
        JNZ	??msupPrepareHeader_15
//  411         memcpy(pPacket->pHeader + length, pDestAddr->pExtended, 8);
        ; Setup parameters for call to function memcpy
        MOV	?V0 + 4,#0x8
        MOV	?V0 + 5,#0x0
        MOV	R0,#?V0 + 4
        LCALL	?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 16)
        MOV	A,#0x16
        LCALL	?XSTACK_DISP0_8
        MOVX	A,@DPTR
        MOV	R4,A
        INC	DPTR
        MOVX	A,@DPTR
        MOV	R5,A
        MOV	DPTR,#(memcpy & 0xffff)
        MOV	A,#((memcpy >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
        MOV	A,#0x2
        LCALL	?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 14)
//  412         length += 8;
        MOV	?V0 + 0,#0xd
//  413         pPacket->toCoord &= msupCompareExtendedAddress((ADDRESS  *) mpib.pMacCoordExtendedAddress, pDestAddr);
        ; Setup parameters for call to function msupCompareExtendedAddress
        MOV	A,#0x14
        LCALL	?XSTACK_DISP0_8
        MOVX	A,@DPTR
        MOV	R4,A
        INC	DPTR
        MOVX	A,@DPTR
        MOV	R5,A
        MOV	R2,#((mpib + 14) & 0xff)
        MOV	R3,#(((mpib + 14) >> 8) & 0xff)
        LCALL	msupCompareExtendedAddress
        MOV	A,R1
??msupPrepareHeader_14:
        MOV	R2,A
        MOV	A,?V0 + 2
        ADD	A,#-0x7c
        MOV	DPL,A
        MOV	A,?V0 + 3
        ADDC	A,#0x0
        MOV	DPH,A
        MOVX	A,@DPTR
        ANL	A,R2
??msupPrepareHeader_13:
        MOVX	@DPTR,A
//  414     }
//  415 
//  416     // Source PAN ID
//  417     if (!(temp & INTRA_PAN_BM) && (addrModes & SRC_ADDR_BM)) {
??msupPrepareHeader_15:
        MOV	A,#-0x40
        ANL	A,?V0 + 6
        MOV	R4,A
        MOV	A,?V0 + 1
        MOV	C,0xE0 /* A   */.6
        JC	??msupPrepareHeader_16
        MOV	A,R4
        JZ	??msupPrepareHeader_16
//  418         pPacket->pHeader[length++] = LOBYTE(srcPanId);
        MOV	?V0 + 4,?V0 + 0
        MOV	A,?V0 + 2
        ADD	A,?V0 + 4
        MOV	DPL,A
        MOV	A,?V0 + 3
        ADDC	A,#0x0
        MOV	DPH,A
        INC	DPTR
        INC	DPTR
        INC	DPTR
        MOV	A,R6
        MOVX	@DPTR,A
        INC	?V0 + 0
//  419         pPacket->pHeader[length++] = HIBYTE(srcPanId);
        MOV	?V0 + 4,?V0 + 0
        MOV	A,?V0 + 2
        ADD	A,?V0 + 4
        MOV	DPL,A
        MOV	A,?V0 + 3
        ADDC	A,#0x0
        MOV	DPH,A
        INC	DPTR
        INC	DPTR
        INC	DPTR
        MOV	A,R7
        MOVX	@DPTR,A
        INC	?V0 + 0
//  420     }
//  421 
//  422     // Source address
//  423     if ((addrModes & SRC_ADDR_BM) == SRC_ADDR_SHORT) {
??msupPrepareHeader_16:
        MOV	?V0 + 4,?V0 + 0
        MOV	?V0 + 5,#0x0
        MOV	A,?V0 + 2
        ADD	A,?V0 + 4
        MOV	R0,A
        MOV	A,?V0 + 3
        ADDC	A,#0x0
        MOV	R1,A
        MOV	A,#0x3
        ADD	A,R0
        MOV	R2,A
        CLR	A
        ADDC	A,R1
        MOV	R3,A
        MOV	A,#-0x80
        XRL	A,R4
        JNZ	??msupPrepareHeader_17
//  424         pPacket->pHeader[length++] = LOBYTE(pSrcAddr->Short);
        MOV	A,#0x10
        LCALL	?XSTACK_DISP0_8
        MOVX	A,@DPTR
        MOV	R0,A
        INC	DPTR
        MOVX	A,@DPTR
        MOV	DPH,A
        MOV	DPL,R0
        MOVX	A,@DPTR
        MOV	DPL,R2
        MOV	DPH,R3
        MOVX	@DPTR,A
        INC	?V0 + 0
//  425         pPacket->pHeader[length++] = HIBYTE(pSrcAddr->Short);
        MOV	A,#0x10
        LCALL	?XSTACK_DISP0_8
        MOVX	A,@DPTR
        MOV	R0,A
        INC	DPTR
        MOVX	A,@DPTR
        MOV	DPH,A
        MOV	DPL,R0
        INC	DPTR
        MOVX	A,@DPTR
        PUSH	A
        CFI CFA_SP SP+-1
        MOV	?V0 + 4,?V0 + 0
        MOV	A,?V0 + 2
        ADD	A,?V0 + 4
        MOV	DPL,A
        MOV	A,?V0 + 3
        ADDC	A,#0x0
        MOV	DPH,A
        INC	DPTR
        INC	DPTR
        INC	DPTR
        POP	A
        CFI CFA_SP SP+0
        MOVX	@DPTR,A
        INC	?V0 + 0
        SJMP	??msupPrepareHeader_18
//  426     } else if ((addrModes & SRC_ADDR_BM) == SRC_ADDR_EXT) {
??msupPrepareHeader_17:
        MOV	A,#-0x40
        XRL	A,R4
        JNZ	??msupPrepareHeader_18
//  427         memcpy(pPacket->pHeader + length, pSrcAddr->pExtended, 8);
        ; Setup parameters for call to function memcpy
        MOV	?V0 + 4,#0x8
        MOV	R0,#?V0 + 4
        LCALL	?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 16)
        MOV	A,#0x12
        LCALL	?XSTACK_DISP0_8
        MOVX	A,@DPTR
        MOV	R4,A
        INC	DPTR
        MOVX	A,@DPTR
        MOV	R5,A
        MOV	DPTR,#(memcpy & 0xffff)
        MOV	A,#((memcpy >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
        MOV	A,#0x2
        LCALL	?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 14)
//  428         length += 8;
        MOV	A,#0x8
        ADD	A,?V0 + 0
        MOV	?V0 + 0,A
//  429     }
//  430 
//  431     pPacket->headerLength = length;
??msupPrepareHeader_18:
        MOV	DPL,?V0 + 2
        MOV	DPH,?V0 + 3
        INC	DPTR
        MOV	A,?V0 + 0
        MOVX	@DPTR,A
//  432 
//  433 #if MAC_OPT_SECURITY
//  434     // By default, set cleartextLenght to header length
//  435     // Include command frame identifier for MAC command frames
//  436     // Note: clearTextLength must be incremented for beacon frames
//  437     pPacket->securitySetup.clearTextLength = length + (type == FT_MAC_COMMAND);
//  438 
//  439     // Decode security suite and find setup information
//  440     // Set clearTextLength to 0 for CBC-MAC
//  441     msecDecodeSecuritySuite(&pPacket->securitySetup, pPacket->securitySuite);
//  442 #endif
//  443 
//  444 } // msupPrepareHeader
        MOV	R7,#0x7
        LJMP	?FUNC_LEAVE_XDATA
        CFI EndBlock cfiBlock13
//  445 
//  446 
//  447 
//  448 
//  449 //-------------------------------------------------------------------------------------------------------
//  450 //  UINT8 msupCalcPacketDuration(UINT8 length, BOOL ackRequest)
//  451 //
//  452 //  DESCRIPTION:
//  453 //      Calculates the number of backoff slots required to transmit a packet, including (turnaround time,
//  454 //      acknowledgment and) inter-frame spacing.
//  455 //
//  456 //  PARAMETERS:
//  457 //      UINT8 length
//  458 //          The packet length in bytes (PHY frame length field)
//  459 //      BOOL ackRequest
//  460 //          Acknowledged packet?
//  461 //
//  462 //  RETURN VALUE:
//  463 //      UINT8
//  464 //          The number of backoff slots required to transmit the packet
//  465 //-------------------------------------------------------------------------------------------------------

        RSEG NEAR_CODE:CODE:NOROOT(0)
//  466 ROOT UINT8 msupCalcPacketDuration(UINT8 length, BOOL ackRequest) {
msupCalcPacketDuration:
        CFI Block cfiBlock14 Using cfiCommon1
        CFI Function msupCalcPacketDuration
        PUSH	?V0 + 0
        CFI V0 Frame(CFA_SP, 3)
        CFI CFA_SP SP+-3
        ; Saved register size: 2
        ; Auto size: 0
//  467     UINT8 totalByteCount, lastBosByteCount;
//  468 
//  469     // Calculate the number of bytes in the whole packet (not including the preamble, but including
//  470     // SFD, length-byte and PSDU)
//  471     totalByteCount = (BYTE)(1 + 1 + length);
        MOV	A,#0x2
        ADD	A,R1
        MOV	R3,A
//  472 
//  473     // Acknowledgment request
//  474     if (ackRequest) {
        MOV	A,R2
        JZ	??msupCalcPacketDuration_0
//  475 
//  476         // The number of bytes in the last backoff slot
//  477         lastBosByteCount = (BYTE)(totalByteCount % (aUnitBackoffPeriod / 2));
        MOV	A,R3
        MOV	B,#0xa
        DIV	AB
        MOV	R2,B
//  478 
//  479         // Round up the total count to N * (aUnitBackoffPeriod / 2), and add an extra slot if there isn't enough turnaround time before the ack (12-32 symbols)
//  480         if (lastBosByteCount)
        MOV	A,R2
        JZ	??msupCalcPacketDuration_1
//  481            totalByteCount = (BYTE)(totalByteCount + (aUnitBackoffPeriod / 2) - lastBosByteCount);
        MOV	A,#0xa
        ADD	A,R3
        CLR	C
        SUBB	A,R2
        MOV	R3,A
//  482 
//  483         // Add the bytes in the acknowledgment frame
//  484         totalByteCount += (aUnitBackoffPeriod / 2) + (1 + 1 + 5);
??msupCalcPacketDuration_1:
        MOV	A,#0x11
        ADD	A,R3
        MOV	R3,A
//  485     }
//  486 
//  487     // Add interframe spacing
//  488     if (length > aMaxSIFSFrameSize) {
??msupCalcPacketDuration_0:
        MOV	A,R1
        CLR	C
        SUBB	A,#0x13
        JC	??msupCalcPacketDuration_2
//  489         totalByteCount += (aMinLIFSPeriod / 2);
        MOV	A,#0x14
        SJMP	??msupCalcPacketDuration_3
//  490     } else {
//  491         totalByteCount += (aMinSIFSPeriod / 2);
??msupCalcPacketDuration_2:
        MOV	A,#0x6
??msupCalcPacketDuration_3:
        ADD	A,R3
        MOV	R3,A
//  492     }
//  493 
//  494     // Round up
//  495     return ((BYTE) (((totalByteCount + ((aUnitBackoffPeriod / 2) - 1))) / (aUnitBackoffPeriod / 2)));
        MOV	?V0 + 0,R3
        MOV	A,#0x9
        ADD	A,?V0 + 0
        MOV	R0,A
        CLR	A
        ADDC	A,#0x0
        MOV	R1,A
        MOV	R2,#0xa
        MOV	R3,#0x0
        LCALL	?S_DIV_MOD
        MOV	A,R0
        MOV	R1,A
        POP	?V0 + 0
        CFI V0 SameValue
        CFI CFA_SP SP+-2
        RET
        CFI EndBlock cfiBlock14
//  496 
//  497 } // msupCalcPacketDuration
//  498 
//  499 
//  500 
//  501 
//  502 /*******************************************************************************************************
//  503  *******************************************************************************************************
//  504  **************************               CC2430 RAM/FIFO ACCESS              **************************
//  505  *******************************************************************************************************
//  506  *******************************************************************************************************/
//  507 

        RSEG NEAR_CODE:CODE:NOROOT(0)
//  508 ROOT void msupWriteExtendedAddress(BYTE   *pExtendedAddress) {
msupWriteExtendedAddress:
   

⌨️ 快捷键说明

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