mac_tx.lst
来自「TI的基于ZIGBEE2006的协议栈」· LST 代码 · 共 1,206 行 · 第 1/5 页
LST
1,206 行
373 void macTxStartQueuedFrame(void)
\ macTxStartQueuedFrame:
374 {
\ 000000 C082 PUSH DPL
\ 000002 C083 PUSH DPH
\ 000004 ; Saved register size: 2
\ 000004 ; Auto size: 0
375 halIntState_t s;
376
377 MAC_ASSERT(!macRxActive && !macRxOutgoingAckFlag); /* queued frames should not transmit in middle of a receive */
\ 000004 90.... MOV DPTR,#macRxActive
\ 000007 E0 MOVX A,@DPTR
\ 000008 7006 JNZ ??macTxStartQueuedFrame_0
\ 00000A 90.... MOV DPTR,#macRxOutgoingAckFlag
\ 00000D E0 MOVX A,@DPTR
\ 00000E 6008 JZ ??macTxStartQueuedFrame_1
\ ??macTxStartQueuedFrame_0:
\ 000010 ; Setup parameters for call to function halAssertHandler
\ 000010 90.... MOV DPTR,#(halAssertHandler & 0xffff)
\ 000013 74.. MOV A,#((halAssertHandler >> 16) & 0xff)
\ 000015 12.... LCALL ?BCALL ; Banked call to: DPTR()
378
379 /*
380 * Critical sections around the state change prevents any sort of race condition
381 * with macTxFrame(). This guarantees function txGo() will only be be called once.
382 */
383 HAL_ENTER_CRITICAL_SECTION(s);
\ ??macTxStartQueuedFrame_1:
\ 000018 A2AF MOV C,0xa8.7
\ 00001A E4 CLR A
\ 00001B 92E0 MOV 0xE0 /* A */.0,C
\ 00001D C2AF CLR 0xa8.7
384 if (macTxActive == MAC_TX_ACTIVE_QUEUED)
\ 00001F 90.... MOV DPTR,#macTxActive
\ 000022 E0 MOVX A,@DPTR
\ 000023 6402 XRL A,#0x2
\ 000025 700A JNZ ??macTxStartQueuedFrame_2
385 {
386 macTxActive = MAC_TX_ACTIVE_GO;
\ 000027 7483 MOV A,#-0x7d
\ 000029 12.... LCALL ?Subroutine2 & 0xFFFF
387 HAL_EXIT_CRITICAL_SECTION(s);
388 txGo();
\ ??CrossCallReturnLabel_5:
\ 00002C 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 00002F 8002 SJMP ??macTxStartQueuedFrame_3
389 }
390 else
391 {
392 HAL_EXIT_CRITICAL_SECTION(s);
\ ??macTxStartQueuedFrame_2:
\ 000031 92AF MOV 0xa8.7,C
393 }
394 }
\ ??macTxStartQueuedFrame_3:
\ 000033 80.. SJMP ??Subroutine3_0
395
396
397 /**************************************************************************************************
398 * @fn macTxChannelBusyCallback
399 *
400 * @brief This callback is executed if a CSMA transmit was attempted but the channel
401 * was busy.
402 *
403 * @param none
404 *
405 * @return none
406 **************************************************************************************************
407 */
\ In segment BANKED_CODE, align 1, keep-with-next
408 void macTxChannelBusyCallback(void)
\ macTxChannelBusyCallback:
409 {
\ 000000 C082 PUSH DPL
\ 000002 C083 PUSH DPH
\ 000004 ; Saved register size: 2
\ 000004 ; Auto size: 0
410 MAC_ASSERT((macTxType == MAC_TX_TYPE_SLOTTED_CSMA) || (macTxType == MAC_TX_TYPE_UNSLOTTED_CSMA));
\ 000004 90.... MOV DPTR,#macTxType
\ 000007 E0 MOVX A,@DPTR
\ 000008 600C JZ ??macTxChannelBusyCallback_0
\ 00000A 6401 XRL A,#0x1
\ 00000C 6008 JZ ??macTxChannelBusyCallback_0
\ 00000E ; Setup parameters for call to function halAssertHandler
\ 00000E 90.... MOV DPTR,#(halAssertHandler & 0xffff)
\ 000011 74.. MOV A,#((halAssertHandler >> 16) & 0xff)
\ 000013 12.... LCALL ?BCALL ; Banked call to: DPTR()
411
412 /* clear channel assement failed, follow through with CSMA algorithm */
413 nb++;
\ ??macTxChannelBusyCallback_0:
\ 000016 90.... MOV DPTR,#??nb
\ 000019 E0 MOVX A,@DPTR
\ 00001A 04 INC A
\ 00001B F0 MOVX @DPTR,A
414 if (nb > macPib.maxCsmaBackoffs)
\ 00001C 90.... MOV DPTR,#(macPib + 27)
\ 00001F E0 MOVX A,@DPTR
\ 000020 C0E0 PUSH A
\ 000022 90.... MOV DPTR,#??nb
\ 000025 E0 MOVX A,@DPTR
\ 000026 FA MOV R2,A
\ 000027 D0E0 POP A
\ 000029 C3 CLR C
\ 00002A 9A SUBB A,R2
\ 00002B 5009 JNC ??macTxChannelBusyCallback_1
415 {
416 txComplete(MAC_CHANNEL_ACCESS_FAILURE);
\ 00002D ; Setup parameters for call to function txComplete
\ 00002D 79E1 MOV R1,#-0x1f
\ 00002F 90.... MOV DPTR,#(??txComplete & 0xffff)
\ 000032 74.. MOV A,#((??txComplete >> 16) & 0xff)
\ 000034 8035 SJMP ??macTxChannelBusyCallback_2
417 }
418 else
419 {
420 macTxBe = MIN(macTxBe+1, macPib.maxBe);
\ ??macTxChannelBusyCallback_1:
\ 000036 90.... MOV DPTR,#macTxBe
\ 000039 E0 MOVX A,@DPTR
\ 00003A F8 MOV R0,A
\ 00003B 7401 MOV A,#0x1
\ 00003D 28 ADD A,R0
\ 00003E 08 INC R0
\ 00003F E4 CLR A
\ 000040 3400 ADDC A,#0x0
\ 000042 F9 MOV R1,A
\ 000043 90.... MOV DPTR,#(macPib + 39)
\ 000046 E0 MOVX A,@DPTR
\ 000047 FA MOV R2,A
\ 000048 E8 MOV A,R0
\ 000049 9A SUBB A,R2
\ 00004A E9 MOV A,R1
\ 00004B 9400 SUBB A,#0x0
\ 00004D C3 CLR C
\ 00004E 65D0 XRL A,PSW
\ 000050 33 RLC A
\ 000051 5006 JNC ??macTxChannelBusyCallback_3
\ 000053 90.... MOV DPTR,#macTxBe
\ 000056 E0 MOVX A,@DPTR
\ 000057 04 INC A
\ 000058 FA MOV R2,A
\ ??macTxChannelBusyCallback_3:
\ 000059 EA MOV A,R2
\ 00005A 90.... MOV DPTR,#macTxBe
\ 00005D F0 MOVX @DPTR,A
421 txCsmaPrep();
\ 00005E ; Setup parameters for call to function txCsmaPrep
\ 00005E 90.... MOV DPTR,#(??txCsmaPrep & 0xffff)
\ 000061 74.. MOV A,#((??txCsmaPrep >> 16) & 0xff)
\ 000063 12.... LCALL ?BCALL ; Banked call to: DPTR()
422 txCsmaGo();
\ 000066 ; Setup parameters for call to function txCsmaGo
\ 000066 90.... MOV DPTR,#(??txCsmaGo & 0xffff)
\ 000069 74.. MOV A,#((??txCsmaGo >> 16) & 0xff)
\ ??macTxChannelBusyCallback_2:
\ 00006B 02.... LJMP ?Subroutine5 & 0xFFFF
423 }
424 }
425
426
427 /**************************************************************************************************
428 * @fn macTxDoneCallback
429 *
430 * @brief This callback is executed when transmit completes.
431 *
432 * @param none
433 *
434 * @return none
435 **************************************************************************************************
436 */
\ In segment BANKED_CODE, align 1, keep-with-next
437 void macTxDoneCallback(void)
\ macTxDoneCallback:
438 {
\ 000000 74F7 MOV A,#-0x9
\ 000002 12.... LCALL ?BANKED_ENTER_XDATA
\ 000005 ; Saved register size: 9
\ 000005 ; Auto size: 0
439 halIntState_t s;
440
441 /*
442 * There is a small chance this function could be called twice for a single transmit.
443 * To prevent logic from executing twice, the state variable macTxActive is used as
444 * a gating mechanism to guarantee single time execution.
445 */
446 HAL_ENTER_CRITICAL_SECTION(s);
\ 000005 A2AF MOV C,0xa8.7
\ 000007 E4 CLR A
\ 000008 92E0 MOV 0xE0 /* A */.0,C
\ 00000A FE MOV R6,A
\ 00000B C2AF CLR 0xa8.7
447 if (macTxActive == MAC_TX_ACTIVE_GO)
\ 00000D 90.... MOV DPTR,#macTxActive
\ 000010 E0 MOVX A,@DPTR
\ 000011 6483 XRL A,#0x83
\ 000013 702B JNZ ??macTxDoneCallback_0
448 {
449 /* see if ACK was requested */
450 if (!txAckReq)
\ 000015 90.... MOV DPTR,#??txAckReq
\ 000018 E0 MOVX A,@DPTR
\ 000019 7014 JNZ ??macTxDoneCallback_1
451 {
452 macTxActive = MAC_TX_ACTIVE_DONE;
\ 00001B 7484 MOV A,#-0x7c
\ 00001D 90.... MOV DPTR,#macTxActive
\ 000020 F0 MOVX @DPTR,A
453 HAL_EXIT_CRITICAL_SECTION(s);
\ 000021 92AF MOV 0xa8.7,C
454
455 /* ACK was not requested, transmit is complete */
456 txComplete(MAC_SUCCESS);
\ 000023 ; Setup parameters for call to function txComplete
\ 000023 7900 MOV R1,#0x0
\ 000025 90.... MOV DPTR,#(??txComplete & 0xffff)
\ 000028 74.. MOV A,#((??txComplete >> 16) & 0xff)
\ 00002A 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 00002D 8013 SJMP ??macTxDoneCallback_2
457 }
458 else
459 {
460 /*
461 * ACK was requested - must wait to receive it. A timer is set
462 * to expire after the timeout duration for waiting for an ACK.
463 * If an ACK is received, the function macTxAckReceived() is called.
464 * If an ACK is not received within the timeout period,
465 * the function macTxAckTimeoutCallback() is called.
466 */
467 macTxActive = MAC_TX_ACTIVE_LISTEN_FOR_ACK;
\ ??macTxDoneCallback_1:
\ 00002F 7485 MOV A,#-0x7b
\ 000031 90.... MOV DPTR,#macTxActive
\ 000034 F0 MOVX @DPTR,A
468 MAC_RADIO_TX_REQUEST_ACK_TIMEOUT_CALLBACK();
\ 000035 ; Setup parameters for call to function macCs
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?