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

📄 mac_tx.lst

📁 CC2430上开关控制灯和温度传感器采集两个例子
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   000000                REQUIRE __INIT_XDATA_Z
     85          uint8 macTxBe;
   \                     macTxBe:
   \   000000                DS 1

   \                                 In segment XDATA_Z, align 1, keep-with-next
   \   000000                REQUIRE __INIT_XDATA_Z
     86          uint8 macTxCsmaBackoffDelay;
   \                     macTxCsmaBackoffDelay:
   \   000000                DS 1
     87          
     88          
     89          /* ------------------------------------------------------------------------------------------------
     90           *                                         Local Variables
     91           * ------------------------------------------------------------------------------------------------
     92           */

   \                                 In segment XDATA_Z, align 1, keep-with-next
   \   000000                REQUIRE __INIT_XDATA_Z
     93          static uint8 nb;
   \                     ??nb:
   \   000000                DS 1

   \                                 In segment XDATA_Z, align 1, keep-with-next
   \   000000                REQUIRE __INIT_XDATA_Z
     94          static uint8 txSeqn;
   \                     ??txSeqn:
   \   000000                DS 1

   \                                 In segment XDATA_Z, align 1, keep-with-next
   \   000000                REQUIRE __INIT_XDATA_Z
     95          static uint8 txAckReq;
   \                     ??txAckReq:
   \   000000                DS 1

   \                                 In segment XDATA_Z, align 1, keep-with-next
   \   000000                REQUIRE __INIT_XDATA_Z
     96          static uint8 txRetransmitFlag;
   \                     ??txRetransmitFlag:
   \   000000                DS 1
     97          
     98          
     99          /* ------------------------------------------------------------------------------------------------
    100           *                                         Local Prototypes
    101           * ------------------------------------------------------------------------------------------------
    102           */
    103          static void txCsmaPrep(void);
    104          static void txGo(void);
    105          static void txCsmaGo(void);
    106          static void txComplete(uint8 status);
    107          
    108          
    109          /**************************************************************************************************
    110           * @fn          macTxInit
    111           *
    112           * @brief       Initialize variables for tx module.
    113           *
    114           * @param       none
    115           *
    116           * @return      none
    117           **************************************************************************************************
    118           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    119          void macTxInit(void)
   \                     macTxInit:
    120          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    121            macTxActive      = MAC_TX_ACTIVE_NO_ACTIVITY;
   \   000004   02....       LJMP    ?Subroutine3 & 0xFFFF
    122            txRetransmitFlag = 0;
    123          }

   \                                 In segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine3:
   \   000000   E4           CLR     A
   \   000001   90....       MOV     DPTR,#macTxActive
   \   000004   F0           MOVX    @DPTR,A
   \   000005   90....       MOV     DPTR,#??txRetransmitFlag
   \   000008   F0           MOVX    @DPTR,A
   \                     ??Subroutine3_0:
   \   000009   D083         POP     DPH
   \   00000B   D082         POP     DPL
   \   00000D   02....       LJMP    ?BRET
    124          
    125          
    126          /**************************************************************************************************
    127           * @fn          macTxHaltCleanup
    128           *
    129           * @brief       -
    130           *
    131           * @param       none
    132           *
    133           * @return      none
    134           **************************************************************************************************
    135           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    136          void macTxHaltCleanup(void)
   \                     macTxHaltCleanup:
    137          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    138            MAC_RADIO_TX_RESET();
   \   000004                ; Setup parameters for call to function macCspTxReset
   \   000004   90....       MOV     DPTR,#(macCspTxReset & 0xffff)
   \   000007   74..         MOV     A,#((macCspTxReset >> 16) & 0xff)
   \   000009   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    139            macTxInit();
   \   00000C   02....       LJMP    ?Subroutine3 & 0xFFFF
    140          }
    141          
    142          
    143          /**************************************************************************************************
    144           * @fn          macTxFrame
    145           *
    146           * @brief       Transmit the frame pointed to by pMacDataTx with the specified type.
    147           *              NOTE! It is not legal to call this function from interrupt context.
    148           *
    149           * @param       txType - type of transmit
    150           *
    151           * @return      none
    152           **************************************************************************************************
    153           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    154          void macTxFrame(uint8 txType)
   \                     macTxFrame:
    155          {
   \   000000   74F7         MOV     A,#-0x9
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 9
   \   000005                ; Auto size: 0
   \   000005   E9           MOV     A,R1
   \   000006   FE           MOV     R6,A
    156            MAC_ASSERT(!macTxActive);            /* transmit on top of transmit */
   \   000007   90....       MOV     DPTR,#macTxActive
   \   00000A   E0           MOVX    A,@DPTR
   \   00000B   6008         JZ      ??macTxFrame_0
   \   00000D                ; Setup parameters for call to function halAssertHandler
   \   00000D   90....       MOV     DPTR,#(halAssertHandler & 0xffff)
   \   000010   74..         MOV     A,#((halAssertHandler >> 16) & 0xff)
   \   000012   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    157          
    158            /* mark transmit as active */
    159            macTxActive = MAC_TX_ACTIVE_INITIALIZE;
   \                     ??macTxFrame_0:
   \   000015   7401         MOV     A,#0x1
   \   000017   90....       MOV     DPTR,#macTxActive
   \   00001A   F0           MOVX    @DPTR,A
    160          
    161            /*
    162             *  The MAC will not enter sleep mode if there is an active transmit.  However, if macSleep() is
    163             *  ever called from interrupt context, it possible to enter sleep state after a transmit is
    164             *  intiated but before macTxActive is set.  To recover from this, the transmit must be aborted
    165             *  and proper notificiation given to high-level.
    166             */
    167            if (macSleepState != MAC_SLEEP_STATE_AWAKE)
   \   00001B   90....       MOV     DPTR,#macSleepState
   \   00001E   E0           MOVX    A,@DPTR
   \   00001F   600D         JZ      ??macTxFrame_1
    168            {
    169              /* notify high-level that transmit had to be aborted */
    170              txComplete(MAC_TX_ABORTED);
   \   000021                ; Setup parameters for call to function txComplete
   \   000021   791D         MOV     R1,#0x1d
   \   000023   90....       MOV     DPTR,#(??txComplete & 0xffff)
   \   000026   74..         MOV     A,#((??txComplete >> 16) & 0xff)
   \                     ??macTxFrame_2:
   \   000028   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    171          
    172              /* exit from transmit logic */
    173              return;
   \   00002B   02....       LJMP    ??macTxFrame_3 & 0xFFFF
    174            }
    175            
    176            /* save transmit type */
    177            macTxType = txType;
   \                     ??macTxFrame_1:
   \   00002E   EE           MOV     A,R6
   \   00002F   90....       MOV     DPTR,#macTxType
   \   000032   F0           MOVX    @DPTR,A
    178          
    179            /*-------------------------------------------------------------------------------
    180             *  Prepare for transmit.
    181             */
    182            if (macTxType == MAC_TX_TYPE_SLOTTED)
   \   000033   6402         XRL     A,#0x2
   \   000035   7007         JNZ     ??macTxFrame_4
    183            {
    184              MAC_RADIO_TX_PREP_SLOTTED();
   \   000037                ; Setup parameters for call to function macCspTxPrepSlotted
   \   000037   90....       MOV     DPTR,#(macCspTxPrepSlotted & 0xffff)
   \   00003A   74..         MOV     A,#((macCspTxPrepSlotted >> 16) & 0xff)
   \   00003C   804E         SJMP    ??macTxFrame_5
    185            }
    186            else
    187            {
    188              MAC_ASSERT((macTxType == MAC_TX_TYPE_SLOTTED_CSMA) || (macTxType == MAC_TX_TYPE_UNSLOTTED_CSMA));
   \                     ??macTxFrame_4:
   \   00003E   E0           MOVX    A,@DPTR
   \   00003F   600C         JZ      ??macTxFrame_6
   \   000041   6401         XRL     A,#0x1
   \   000043   6008         JZ      ??macTxFrame_6
   \   000045                ; Setup parameters for call to function halAssertHandler
   \   000045   90....       MOV     DPTR,#(halAssertHandler & 0xffff)
   \   000048   74..         MOV     A,#((halAssertHandler >> 16) & 0xff)
   \   00004A   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    189          
    190              nb = 0;
   \                     ??macTxFrame_6:
   \   00004D   E4           CLR     A
   \   00004E   90....       MOV     DPTR,#??nb
   \   000051   F0           MOVX    @DPTR,A
    191              macTxBe = (pMacDataTx->internal.txOptions & MAC_TXOPTION_ALT_BE) ? macPib.altBe : macPib.minBe;
   \   000052   90....       MOV     DPTR,#pMacDataTx
   \   000055   E0           MOVX    A,@DPTR
   \   000056   240E         ADD     A,#0xe
   \   000058   12....       LCALL   ?Subroutine1 & 0xFFFF
   \                     ??CrossCallReturnLabel_2:
   \   00005B   A2E6         MOV     C,0xE0 /* A   */.6
   \   00005D   5005         JNC     ??macTxFrame_7
   \   00005F   90....       MOV     DPTR,#(macPib + 58)
   \   000062   8003         SJMP    ??macTxFrame_8
   \                     ??macTxFrame_7:
   \   000064   90....       MOV     DPTR,#(macPib + 28)
   \                     ??macTxFrame_8:
   \   000067   E0           MOVX    A,@DPTR
   \   000068   FA           MOV     R2,A
   \   000069   EA           MOV     A,R2
   \   00006A   90....       MOV     DPTR,#macTxBe
   \   00006D   F0           MOVX    @DPTR,A
    192          
    193              if ((macTxType == MAC_TX_TYPE_SLOTTED_CSMA) && (macPib.battLifeExt))
   \   00006E   90....       MOV     DPTR,#macTxType
   \   000071   E0           MOVX    A,@DPTR
   \   000072   7013         JNZ     ??macTxFrame_9
   \   000074   90....       MOV     DPTR,#(macPib + 3)
   \   000077   E0           MOVX    A,@DPTR
   \   000078   600D         JZ      ??macTxFrame_9

⌨️ 快捷键说明

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