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

📄 mac_radio.lst

📁 CC2431无线定位程序非常有参考价值
💻 LST
📖 第 1 页 / 共 5 页
字号:
    214          

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    215          void macRadioSetTxPower(uint8 txPower)
   \                     macRadioSetTxPower:
    216          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
    217            halIntState_t  s;
    218          
    219            /* if the selected dBm is out of range, use the closest available */
    220            if (txPower > MAC_RADIO_TX_POWER_MAX_MINUS_DBM)
   \   000005   E9           MOV     A,R1
   \   000006   C3           CLR     C
   \   000007   941A         SUBB    A,#0x1a
   \   000009   4002         JC      ??macRadioSetTxPower_0
    221            {
    222              txPower = MAC_RADIO_TX_POWER_MAX_MINUS_DBM;
   \   00000B   7919         MOV     R1,#0x19
    223            }
    224          
    225            /*
    226             *  Set the global variable reqTxPower.  This variable is referenced
    227             *  by the function macRadioUpdateTxPower() to write the radio register.
    228             *
    229             *  A lookup table is used to translate the power level to the register
    230             *  value.
    231             */
    232            HAL_ENTER_CRITICAL_SECTION(s);
   \                     ??macRadioSetTxPower_0:
   \   00000D   A2AF         MOV     C,0xa8.7
   \   00000F   E4           CLR     A
   \   000010   92E0         MOV     0xE0 /* A   */.0,C
   \   000012   FA           MOV     R2,A
   \   000013   C2AF         CLR     0xa8.7
    233            reqTxPower = macRadioDefsTxPowerTable[txPower];
   \   000015   89..         MOV     ?V0 + 0,R1
   \   000017   E5..         MOV     A,?V0 + 0
   \   000019   24..         ADD     A,#(macRadioDefsTxPowerTable & 0xff)
   \   00001B   F582         MOV     DPL,A
   \   00001D   E4           CLR     A
   \   00001E   34..         ADDC    A,#((macRadioDefsTxPowerTable >> 8) & 0xff)
   \   000020   F583         MOV     DPH,A
   \   000022   E4           CLR     A
   \   000023   93           MOVC    A,@A+DPTR
   \   000024   90....       MOV     DPTR,#??reqTxPower
   \   000027   F0           MOVX    @DPTR,A
    234            HAL_EXIT_CRITICAL_SECTION(s);
   \   000028   EA           MOV     A,R2
   \   000029   A2E0         MOV     C,0xE0 /* A   */.0
   \   00002B   92AF         MOV     0xa8.7,C
    235          
    236            /* update the radio power setting */
    237            macRadioUpdateTxPower();
   \   00002D                ; Setup parameters for call to function macRadioUpdateTxPower
   \   00002D   90....       MOV     DPTR,#(macRadioUpdateTxPower & 0xffff)
   \   000030   74..         MOV     A,#((macRadioUpdateTxPower >> 16) & 0xff)
   \   000032   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    238          }
   \   000035   7F02         MOV     R7,#0x2
   \   000037   02....       LJMP    ?BANKED_LEAVE_XDATA
    239          
    240          #else
    241          /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
    242          
    243          void macRadioSetTxPower(uint8 txPower)
    244          {
    245            halIntState_t  s;
    246          
    247            /* same as above but with no lookup table, use raw register value */
    248            HAL_ENTER_CRITICAL_SECTION(s);
    249            reqTxPower = txPower;
    250            HAL_EXIT_CRITICAL_SECTION(s);
    251          
    252            /* update the radio power setting */
    253            macRadioUpdateTxPower();
    254          }
    255          
    256          #endif
    257          
    258          
    259          /**************************************************************************************************
    260           * @fn          macRadioUpdateTxPower
    261           *
    262           * @brief       Update the radio's transmit power if a new power level has been requested
    263           *
    264           * @param       reqTxPower - file scope variable that holds the last request power level
    265           *              macPhyTxPower - global variable that holds radio's set power level
    266           *
    267           * @return      none
    268           **************************************************************************************************
    269           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    270          void macRadioUpdateTxPower(void)
   \                     macRadioUpdateTxPower:
    271          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    272            halIntState_t  s;
    273          
    274            /*
    275             *  If the requested power setting is different from the actual radio setting,
    276             *  attempt to udpate to the new power setting.
    277             */
    278            HAL_ENTER_CRITICAL_SECTION(s);
   \   000004   A2AF         MOV     C,0xa8.7
   \   000006   E4           CLR     A
   \   000007   92E0         MOV     0xE0 /* A   */.0,C
   \   000009   FB           MOV     R3,A
   \   00000A   C2AF         CLR     0xa8.7
    279            if (reqTxPower != macPhyTxPower)
   \   00000C   90....       MOV     DPTR,#??reqTxPower
   \   00000F   E0           MOVX    A,@DPTR
   \   000010   FA           MOV     R2,A
   \   000011   90....       MOV     DPTR,#macPhyTxPower
   \   000014   E0           MOVX    A,@DPTR
   \   000015   6A           XRL     A,R2
   \   000016   601A         JZ      ??macRadioUpdateTxPower_0
    280            {
    281              /*
    282               *  Radio power cannot be updated when the radio is physically transmitting.
    283               *  If there is a possibility radio is transmitting, do not change the power
    284               *  setting.  This function will be called again after the current transmit
    285               *  completes.
    286               */
    287              if (!macRxOutgoingAckFlag && !MAC_TX_IS_PHYSICALLY_ACTIVE())
   \   000018   90....       MOV     DPTR,#macRxOutgoingAckFlag
   \   00001B   E0           MOVX    A,@DPTR
   \   00001C   7014         JNZ     ??macRadioUpdateTxPower_0
   \   00001E   90....       MOV     DPTR,#macTxActive
   \   000021   E0           MOVX    A,@DPTR
   \   000022   A2E7         MOV     C,0xE0 /* A   */.7
   \   000024   400C         JC      ??macRadioUpdateTxPower_0
    288              {
    289                /*
    290                 *  Set new power level;  update the shadow value and write
    291                 *  the new value to the radio hardware.
    292                 */
    293                macPhyTxPower = reqTxPower;
   \   000026   90....       MOV     DPTR,#??reqTxPower
   \   000029   E0           MOVX    A,@DPTR
   \   00002A   90....       MOV     DPTR,#macPhyTxPower
   \   00002D   F0           MOVX    @DPTR,A
    294                MAC_RADIO_SET_TX_POWER(macPhyTxPower);
   \   00002E   90DF0B       MOV     DPTR,#-0x20f5
   \   000031   F0           MOVX    @DPTR,A
    295              }
    296            }
    297            HAL_EXIT_CRITICAL_SECTION(s);
   \                     ??macRadioUpdateTxPower_0:
   \   000032   EB           MOV     A,R3
   \   000033   A2E0         MOV     C,0xE0 /* A   */.0
   \   000035   92AF         MOV     0xa8.7,C
    298          }
   \   000037   02....       LJMP    ??Subroutine0_1 & 0xFFFF
    299          
    300          
    301          /**************************************************************************************************
    302           * @fn          macRadioSetChannel
    303           *
    304           * @brief       Set radio channel.
    305           *
    306           * @param       channel - channel number, valid range is 11 through 26
    307           *
    308           * @return      none
    309           **************************************************************************************************
    310           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    311          void macRadioSetChannel(uint8 channel)
   \                     macRadioSetChannel:
    312          {
   \   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
    313            halIntState_t  s;
    314          
    315            MAC_ASSERT((channel >= 11) && (channel <= 28));  /* illegal channel */
   \   000007   C3           CLR     C
   \   000008   940B         SUBB    A,#0xb
   \   00000A   4006         JC      ??macRadioSetChannel_0
   \   00000C   EE           MOV     A,R6
   \   00000D   C3           CLR     C
   \   00000E   941D         SUBB    A,#0x1d
   \   000010   4008         JC      ??macRadioSetChannel_1
   \                     ??macRadioSetChannel_0:
   \   000012                ; Setup parameters for call to function halAssertHandler
   \   000012   90....       MOV     DPTR,#(halAssertHandler & 0xffff)
   \   000015   74..         MOV     A,#((halAssertHandler >> 16) & 0xff)
   \   000017   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    316          
    317            /* critical section to make sure transmit does not start while updating channel */
    318            HAL_ENTER_CRITICAL_SECTION(s);
   \                     ??macRadioSetChannel_1:
   \   00001A   A2AF         MOV     C,0xa8.7
   \   00001C   E4           CLR     A
   \   00001D   92E0         MOV     0xE0 /* A   */.0,C
   \   00001F   FF           MOV     R7,A
   \   000020   C2AF         CLR     0xa8.7
    319          
    320            /* set requested channel */
    321            reqChannel = channel;
   \   000022   EE           MOV     A,R6
   \   000023   90....       MOV     DPTR,#??reqChannel
   \   000026   F0           MOVX    @DPTR,A
    322          
    323            /*
    324             *  If transmit is not active, update the radio hardware immediately.  If transmit is active,
    325             *  the channel will be updated at the end of the current transmit.
    326             */
    327            if (!macTxActive)
   \   000027   90....       MOV     DPTR,#macTxActive
   \   00002A   E0           MOVX    A,@DPTR
   \   00002B   7008         JNZ     ??macRadioSetChannel_2
    328            {
    329              macRadioUpdateChannel();
   \   00002D                ; Setup parameters for call to function macRadioUpdateChannel
   \   00002D   90....       MOV     DPTR,#(macRadioUpdateChannel & 0xffff)
   \   000030   74..         MOV     A,#((macRadioUpdateChannel >> 16) & 0xff)
   \   000032   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    330            }
    331            
    332            HAL_EXIT_CRITICAL_SECTION(s);
   \                     ??macRadioSetChannel_2:
   \   000035   EF           MOV     A,R7
   \   000036   A2E0         MOV     C,0xE0 /* A   */.0
   \   000038   92AF         MOV     0xa8.7,C
    333          }
   \   00003A                REQUIRE ?Subroutine1
   \   00003A                ; // Fall through to label ?Subroutine1

   \                                 In segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine1:
   \   000000   7F01         MOV     R7,#0x1
   \   000002   02....       LJMP    ?BANKED_LEAVE_XDATA
    334          
    335          
    336          /**************************************************************************************************
    337           * @fn          macRadioUpdateChannel
    338           *

⌨️ 快捷键说明

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