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

📄 mac_support.lst

📁 zigbee location examples
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \                     ??msupIsCspInCriticalSection_1:
   \   000017   7901         MOV     R1,#0x1
   \                     ??msupIsCspInCriticalSection_2:
   \   000019   80..         SJMP    ?Subroutine1
    192              }
    193          }
    194          
    195          
    196          
    197          //-------------------------------------------------------------------------------------------------------
    198          //  void msupInitRandomGenerator(void)
    199          //
    200          //  DESCRIPTION:
    201          //      Uses the IEEE extended address to seed the hardware random generator
    202          //-------------------------------------------------------------------------------------------------------

   \                                 In segment NEAR_CODE, align 1, keep-with-next
    203          ROOT void msupInitRandomGenerator(BYTE   *pExtendedAddr) {
   \                     msupInitRandomGenerator:
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    204              UINT8 n;
    205          
    206              // Initialize the LFSR
    207              RNDL = 0xFF;
   \   000004   75BCFF       MOV     0xbc,#-0x1
    208              RNDL = 0xFF;
   \   000007   75BCFF       MOV     0xbc,#-0x1
    209          
    210              // Make it "random"
    211              for (n = 0; n < sizeof(ADDRESS); n++) {
   \   00000A   7C08         MOV     R4,#0x8
    212                  RNDH = pExtendedAddr[n];
   \                     ??msupInitRandomGenerator_0:
   \   00000C   8A82         MOV     DPL,R2
   \   00000E   8B83         MOV     DPH,R3
   \   000010   E0           MOVX    A,@DPTR
   \   000011   F5BD         MOV     0xbd,A
    213              }
   \   000013   A3           INC     DPTR
   \   000014   AA82         MOV     R2,DPL
   \   000016   AB83         MOV     R3,DPH
   \   000018   1C           DEC     R4
   \   000019   EC           MOV     A,R4
   \   00001A   70F0         JNZ     ??msupInitRandomGenerator_0
    214          
    215          } // msupInitRandomGenerator
   \   00001C                REQUIRE ?Subroutine1
   \   00001C                ; // Fall through to label ?Subroutine1
    216          
    217          
    218          
    219          //-------------------------------------------------------------------------------------------------------
    220          //  BYTE msupGetRandomByte(void)
    221          //
    222          //  DESCRIPTION:
    223          //      Generates a single pseudo-random byte from the LFSR in the hardware random generator
    224          //      Use msupInitRandomGenerator() to seed the LFSR
    225          //
    226          //  RETURN VALUE:
    227          //      BYTE
    228          //          Random value
    229          //-------------------------------------------------------------------------------------------------------

   \                                 In segment NEAR_CODE, align 1, keep-with-next
    230          ROOT BYTE msupGetRandomByte(void) {
   \                     msupGetRandomByte:
   \   000000                ; Saved register size: 0
   \   000000                ; Auto size: 0
    231              ADCCON1 &= ~0x0C;
   \   000000   53B4F3       ANL     0xb4,#0xf3
   \   000003   E5B4         MOV     A,0xb4
    232              ADCCON1 |= 0x04;
   \   000005   43B404       ORL     0xb4,#0x4
    233              return RNDH;
   \   000008   A9BD         MOV     R1,0xbd
   \   00000A   22           RET
    234          } // msupGetRandomByte
    235          
    236          
    237          
    238          
    239          /*******************************************************************************************************
    240           *******************************************************************************************************
    241           **************************                RF CHANNEL SETTINGS                **************************
    242           *******************************************************************************************************
    243           *******************************************************************************************************/
    244          
    245          //-------------------------------------------------------------------------------------------------------
    246          //  BOOL msupChannelValid(UINT8 logicalChannel)
    247          //
    248          //  DESCRIPTION:
    249          //      Support function for verifying that the logicalChannel is within the valid range for the 2.4 GHz
    250          //      channels supported by CC2430, which are channels 11 (2405 MHz) through 26 (2480 MHz).
    251          //
    252          //  PARAMETERS:
    253          //      UINT8 logicalChannel
    254          //          The channel number
    255          //
    256          //  RETURN VALUE:
    257          //      BOOL
    258          //          TRUE for channels >= 11 and <= 26, otherwise FALSE
    259          //-------------------------------------------------------------------------------------------------------

   \                                 In segment NEAR_CODE, align 1, keep-with-next
    260          ROOT BOOL msupChannelValid(UINT8 logicalChannel) {
   \                     msupChannelValid:
   \   000000                ; Saved register size: 0
   \   000000                ; Auto size: 0
    261              return ((BOOL)((logicalChannel >= 11) && (logicalChannel <= 26)));
   \   000000   E9           MOV     A,R1
   \   000001   C3           CLR     C
   \   000002   940B         SUBB    A,#0xb
   \   000004   4009         JC      ??msupChannelValid_0
   \   000006   E9           MOV     A,R1
   \   000007   C3           CLR     C
   \   000008   941B         SUBB    A,#0x1b
   \   00000A   5003         JNC     ??msupChannelValid_0
   \   00000C   7901         MOV     R1,#0x1
   \   00000E   22           RET
   \                     ??msupChannelValid_0:
   \   00000F   7900         MOV     R1,#0x0
   \   000011   22           RET
    262          } // msupChannelValid
    263          
    264          
    265          
    266          
    267          //-------------------------------------------------------------------------------------------------------
    268          //  void msupSetChannel(UINT8 logicalChannel, BOOL changePib)
    269          //
    270          //  DESCRIPTION:
    271          //      Changes the radio channel if necessary. The function calculates the new value for the FSCTRL
    272          //      register, and compares it to the current value. When different, the frequency will be changed.
    273          //      The function will clean up the RX engine if we're interrupting a reception. When finished, it
    274          //      will restore the previous RX state.
    275          //
    276          //  PARAMETERS:
    277          //      UINT8 logicalChannel
    278          //          The channel number, 11 - 26
    279          //      BOOL changePib
    280          //          Set ppib.phyCurrentChannel = logicalChannel?
    281          //-------------------------------------------------------------------------------------------------------

   \                                 In segment NEAR_CODE, align 1, keep-with-next
    282          ROOT void msupSetChannel(UINT8 logicalChannel, BOOL changePib) {
   \                     msupSetChannel:
   \   000000   74F7         MOV     A,#-0x9
   \   000002   12....       LCALL   ?FUNC_ENTER_XDATA
   \   000005                ; Saved register size: 9
   \   000005                ; Auto size: 0
   \   000005   89..         MOV     ?V0 + 0,R1
   \   000007   8A..         MOV     ?V0 + 1,R2
    283              UINT16 newFreq, oldFreq;
    284          
    285              // Derive frequency programming from the given channel number
    286              newFreq = (UINT16) (logicalChannel - 11);      // Subtract the base channel
    287              newFreq = (UINT16) (newFreq + (newFreq << 2)); // Multiply with 5, which is the channel spacing
    288              newFreq = (UINT16) (newFreq + 357 + 0x4000);   // 357 is 2405-2048, 0x4000 is LOCK_THR = 1
   \   000009   E9           MOV     A,R1
   \   00000A   75F005       MOV     B,#0x5
   \   00000D   A4           MUL     AB
   \   00000E   F8           MOV     R0,A
   \   00000F   A9F0         MOV     R1,B
   \   000011   742E         MOV     A,#0x2e
   \   000013   28           ADD     A,R0
   \   000014   FE           MOV     R6,A
   \   000015   7441         MOV     A,#0x41
   \   000017   39           ADDC    A,R1
   \   000018   FF           MOV     R7,A
    289          
    290              // Do we need to change the frequency at all?
    291              #pragma diag_suppress=PA082
    292              oldFreq = READ_RFR16(FSCTRL);
   \   000019   90DF10       MOV     DPTR,#-0x20f0
   \   00001C   E0           MOVX    A,@DPTR
   \   00001D   F9           MOV     R1,A
   \   00001E   90DF11       MOV     DPTR,#-0x20ef
   \   000021   E0           MOVX    A,@DPTR
   \   000022   2400         ADD     A,#0x0
   \   000024   F8           MOV     R0,A
   \   000025   E4           CLR     A
   \   000026   39           ADDC    A,R1
   \   000027   F9           MOV     R1,A
    293              #pragma diag_default=PA082
    294          
    295              if ((newFreq ^ oldFreq) & 0x03FF) {
   \   000028   E8           MOV     A,R0
   \   000029   6E           XRL     A,R6
   \   00002A   F8           MOV     R0,A
   \   00002B   E9           MOV     A,R1
   \   00002C   6F           XRL     A,R7
   \   00002D   F9           MOV     R1,A
   \   00002E   7403         MOV     A,#0x3
   \   000030   59           ANL     A,R1
   \   000031   F9           MOV     R1,A
   \   000032   E8           MOV     A,R0
   \   000033   7001         JNZ     ??msupSetChannel_0
   \   000035   E9           MOV     A,R1
   \                     ??msupSetChannel_0:
   \   000036   6031         JZ      ??msupSetChannel_1
    296          
    297                  // Force RX off
    298                  DISABLE_GLOBAL_INT();
   \   000038   C2AF         CLR     0xa8.7
    299                  ISRFOFF;
   \   00003A   75E1E5       MOV     0xe1,#-0x1b
    300          
    301                  // Clean up if we interrupted the receiver
    302                  DisableRfInterrupts();
   \   00003D                ; Setup parameters for call to function DisableRfInterrupts
   \   00003D   12....       LCALL   DisableRfInterrupts
    303                  ENABLE_GLOBAL_INT();
   \   000040   D2AF         SETB    0xa8.7
    304                  mrxResetRxEngine();
   \   000042                ; Setup parameters for call to function mrxResetRxEngine
   \   000042   12....       LCALL   mrxResetRxEngine
    305                  EnableRfInterrupts();
   \   000045                ; Setup parameters for call to function EnableRfInterrupts
   \   000045   12....       LCALL   EnableRfInterrupts
    306          
    307                  // Change the PIB attribute (?) and update the frequency register
    308                  DISABLE_GLOBAL_INT();
   \   000048   C2AF         CLR     0xa8.7
    309                  if (changePib) ppib.phyCurrentChannel = logicalChannel;
   \   00004A   E5..         MOV     A,?V0 + 1
   \   00004C   6006         JZ      ??msupSetChannel_2
   \   00004E   E5..         MOV     A,?V0 + 0
   \   000050   90....       MOV     DPTR,#ppib
   \   000053   F0           MOVX    @DPTR,A
    310                  WRITE_RFR16(FSCTRL, newFreq);
   \                     ??msupSetChannel_2:
   \   000054   EF           MOV     A,R7
   \   000055   90DF10       MOV     DPTR,#-0x20f0
   \   000058   F0           MOVX    @DPTR,A
   \   000059   EE           MOV     A,R6
   \   00005A   90DF11       MOV     DPTR,#-0x20ef
   \   00005D   F0           MOVX    @DPTR,A
    311          
    312                  // Return to the previous RX state
    313                  if (mrxInfo.onCounter) {
   \   00005E   90....       MOV     DPTR,#(mrxInfo + 13)
   \   000061   E0           MOVX    A,@DPTR
   \   000062   6003         JZ      ??msupSetChannel_3
    314                      ISRXON;
   \   000064   75E1E2       MOV     0xe1,#-0x1e
    315                  }
    316                  ENABLE_GLOBAL_INT();
   \                     ??msupSetChannel_3:
   \   000067   D2AF         SETB    0xa8.7
    317              }

⌨️ 快捷键说明

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