mac_radio.lst
来自「TI的基于ZIGBEE2006的协议栈」· LST 代码 · 共 1,202 行 · 第 1/5 页
LST
1,202 行
\ 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 *
339 * @brief Update the radio channel if a new channel has been requested.
340 *
341 * @param none
342 *
343 * @return none
344 **************************************************************************************************
345 */
\ In segment BANKED_CODE, align 1, keep-with-next
346 void macRadioUpdateChannel(void)
\ macRadioUpdateChannel:
347 {
\ 000000 C082 PUSH DPL
\ 000002 C083 PUSH DPH
\ 000004 ; Saved register size: 2
\ 000004 ; Auto size: 0
348 halIntState_t s;
349
350 MAC_ASSERT(!macTxActive); /* cannot change channel during a transmit */
\ 000004 90.... MOV DPTR,#macTxActive
\ 000007 E0 MOVX A,@DPTR
\ 000008 6008 JZ ??macRadioUpdateChannel_0
\ 00000A ; Setup parameters for call to function halAssertHandler
\ 00000A 90.... MOV DPTR,#(halAssertHandler & 0xffff)
\ 00000D 74.. MOV A,#((halAssertHandler >> 16) & 0xff)
\ 00000F 12.... LCALL ?BCALL ; Banked call to: DPTR()
351
352 /* if the channel has changed, set the radio to the new channel */
353 HAL_ENTER_CRITICAL_SECTION(s);
\ ??macRadioUpdateChannel_0:
\ 000012 A2AF MOV C,0xa8.7
\ 000014 E4 CLR A
\ 000015 92E0 MOV 0xE0 /* A */.0,C
\ 000017 C2AF CLR 0xa8.7
354 if (reqChannel != macPhyChannel)
\ 000019 90.... MOV DPTR,#??reqChannel
\ 00001C E0 MOVX A,@DPTR
\ 00001D FA MOV R2,A
\ 00001E 90.... MOV DPTR,#macPhyChannel
\ 000021 E0 MOVX A,@DPTR
\ 000022 6A XRL A,R2
\ 000023 602A JZ ??macRadioUpdateChannel_1
355 {
356 macPhyChannel = reqChannel;
\ 000025 90.... MOV DPTR,#??reqChannel
\ 000028 E0 MOVX A,@DPTR
\ 000029 90.... MOV DPTR,#macPhyChannel
\ 00002C F0 MOVX @DPTR,A
357 HAL_EXIT_CRITICAL_SECTION(s);
\ 00002D 92AF MOV 0xa8.7,C
358
359 /* changing the channel stops any receive in progress */
360 macRxOff();
\ 00002F ; Setup parameters for call to function macRxOff
\ 00002F 90.... MOV DPTR,#(macRxOff & 0xffff)
\ 000032 74.. MOV A,#((macRxOff >> 16) & 0xff)
\ 000034 12.... LCALL ?BCALL ; Banked call to: DPTR()
361 MAC_RADIO_SET_CHANNEL(macPhyChannel);
\ 000037 75F005 MOV B,#0x5
\ 00003A 90.... MOV DPTR,#macPhyChannel
\ 00003D E0 MOVX A,@DPTR
\ 00003E A4 MUL AB
\ 00003F 242E ADD A,#0x2e
\ 000041 90DF11 MOV DPTR,#-0x20ef
\ 000044 F0 MOVX @DPTR,A
362 macRxOnRequest();
\ 000045 ; Setup parameters for call to function macRxOnRequest
\ 000045 90.... MOV DPTR,#(macRxOnRequest & 0xffff)
\ 000048 74.. MOV A,#((macRxOnRequest >> 16) & 0xff)
\ 00004A 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 00004D 8002 SJMP ??macRadioUpdateChannel_2
363 }
364 else
365 {
366 HAL_EXIT_CRITICAL_SECTION(s);
\ ??macRadioUpdateChannel_1:
\ 00004F 92AF MOV 0xa8.7,C
367 }
368 }
\ ??macRadioUpdateChannel_2:
\ 000051 02.... LJMP ??Subroutine0_1 & 0xFFFF
369
370
371 /**************************************************************************************************
372 * @fn macRadioStartScan
373 *
374 * @brief Puts radio into selected scan mode.
375 *
376 * @param scanMode - scan mode, see #defines in .h file
377 *
378 * @return none
379 **************************************************************************************************
380 */
\ In segment BANKED_CODE, align 1, keep-with-next
381 void macRadioStartScan(uint8 scanMode)
\ macRadioStartScan:
382 {
\ 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
383 MAC_ASSERT(macSleepState == MAC_SLEEP_STATE_AWAKE); /* radio must be awake */
\ 000007 90.... MOV DPTR,#macSleepState
\ 00000A E0 MOVX A,@DPTR
\ 00000B 6008 JZ ??macRadioStartScan_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()
384 MAC_ASSERT(macRxFilter == RX_FILTER_OFF); /* all filtering must be off to start scan */
\ ??macRadioStartScan_0:
\ 000015 90.... MOV DPTR,#macRxFilter
\ 000018 E0 MOVX A,@DPTR
\ 000019 6008 JZ ??macRadioStartScan_1
\ 00001B ; Setup parameters for call to function halAssertHandler
\ 00001B 90.... MOV DPTR,#(halAssertHandler & 0xffff)
\ 00001E 74.. MOV A,#((halAssertHandler >> 16) & 0xff)
\ 000020 12.... LCALL ?BCALL ; Banked call to: DPTR()
385
386 /* set the receive filter based on the selected scan mode */
387 if (scanMode == MAC_SCAN_ED)
\ ??macRadioStartScan_1:
\ 000023 EE MOV A,R6
\ 000024 7007 JNZ ??macRadioStartScan_2
388 {
389 macRxFilter = RX_FILTER_ALL;
\ 000026 7401 MOV A,#0x1
\ ??macRadioStartScan_3:
\ 000028 90.... MOV DPTR,#macRxFilter
\ 00002B 802A SJMP ??macRadioStartScan_4
390 }
391 else if (scanMode == MAC_SCAN_ORPHAN)
\ ??macRadioStartScan_2:
\ 00002D 7403 MOV A,#0x3
\ 00002F 6E XRL A,R6
\ 000030 7004 JNZ ??macRadioStartScan_5
392 {
393 macRxFilter = RX_FILTER_NON_COMMAND_FRAMES;
\ 000032 7403 MOV A,#0x3
\ 000034 80F2 SJMP ??macRadioStartScan_3
394 }
395 else
396 {
397 MAC_ASSERT((scanMode == MAC_SCAN_ACTIVE) || (scanMode == MAC_SCAN_PASSIVE)); /* invalid scan type */
\ ??macRadioStartScan_5:
\ 000036 7401 MOV A,#0x1
\ 000038 6E XRL A,R6
\ 000039 600D JZ ??macRadioStartScan_6
\ 00003B 7402 MOV A,#0x2
\ 00003D 6E XRL A,R6
\ 00003E 6008 JZ ??macRadioStartScan_6
\ 000040 ; Setup parameters for call to function halAssertHandler
\ 000040 90.... MOV DPTR,#(halAssertHandler & 0xffff)
\ 000043 74.. MOV A,#((halAssertHandler >> 16) & 0xff)
\ 000045 12.... LCALL ?BCALL ; Banked call to: DPTR()
398 macRxFilter = RX_FILTER_NON_BEACON_FRAMES;
\ ??macRadioStartScan_6:
\ 000048 7402 MOV A,#0x2
\ 00004A 90.... MOV DPTR,#macRxFilter
\ 00004D F0 MOVX @DPTR,A
399
400 /* for active and passive scans, per spec the pan ID must be 0xFFFF */
401 MAC_RADIO_SET_PAN_ID(0xFFFF);
\ 00004E 74FF MOV A,#-0x1
\ 000050 90DF4C MOV DPTR,#-0x20b4
\ 000053 F0 MOVX @DPTR,A
\ 000054 90DF4B MOV DPTR,#-0x20b5
\ ??macRadioStartScan_4:
\ 000057 F0 MOVX @DPTR,A
402 }
403 }
\ 000058 02.... LJMP ?Subroutine1 & 0xFFFF
404
405
406 /**************************************************************************************************
407 * @fn macRadioStopScan
408 *
409 * @brief Takes radio out of scan mode. Note can be called if
410 *
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?