📄 mac_beacon_handler.lst
字号:
##############################################################################
# #
# IAR 8051 C/C++ Compiler V7.20H/W32 16/Jan/2007 15:29:57 #
# Copyright 2004-2006 IAR Systems. All rights reserved. #
# #
# Core = plain #
# Code model = banked #
# Data model = large #
# Calling convention = xdata reentrant #
# Constant location = data #
# Dptr setup = 1,16 #
# Source file = E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\lib\mac\CC2430\mac_beacon_handler.c #
# Command line = -I "C:\Program Files\IAR Systems\Embedded #
# Workbench 4.05 Evaluation version\8051\INC\" -I #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.05 Evaluation version\8051\SRC\LIB\" -I #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.05 Evaluation version\8051\INC\CLIB\" -I #
# E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\..\..\..\include\ -I #
# E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\..\..\..\include\mac\cc2430\ #
# -I E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_E #
# ngine\Test\mac\mac_loc\..\..\..\include\hal\cc243 #
# 0\ -I E:\公司产品资料\Zigbee\cc2431\cc2431定位\LO #
# C_Engine\Test\mac\mac_loc\..\..\..\apps\ -D #
# CC2430EB -D USE_LED -lCN #
# E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\CC2430EB\List\ -lA #
# E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\CC2430EB\List\ -o #
# E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\CC2430EB\Obj\ -e -s9 --debug #
# --core=plain --dptr=16,1 --data_model=large #
# --code_model=banked --calling_convention=xdata_re #
# entrant --place_constants=data --nr_virtual_regs #
# 8 E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_En #
# gine\lib\mac\CC2430\mac_beacon_handler.c #
# List file = E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\CC2430EB\List\mac_beacon_hand #
# ler.lst #
# Object file = E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\CC2430EB\Obj\mac_beacon_handl #
# er.r51 #
# #
# #
##############################################################################
E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engine\lib\mac\CC2430\mac_beacon_handler.c
1 /*******************************************************************************************************
2 * *
3 * ********** *
4 * ************ *
5 * *** *** *
6 * *** +++ *** *
7 * *** + + *** *
8 * *** + CHIPCON CC2430 INTEGRATED 802.15.4 MAC AND PHY *
9 * *** + + *** Beacon TX and Tracking + Related *
10 * *** +++ *** *
11 * *** *** *
12 * ************ *
13 * ********** *
14 * *
15 *******************************************************************************************************
16 * CONFIDENTIAL *
17 * The use of this file is restricted by the signed MAC software license agreement. *
18 * *
19 * Copyright Chipcon AS, 2005 *
20 *******************************************************************************************************
21 * This module contains functions the functions responsible for receiving and transmitting beacons, *
22 * and related functions, such as synchronization and coordinator realignment. *
23 *******************************************************************************************************/
24 #include "mac_headers.h"
25
26
27 //-------------------------------------------------------------------------------------------------------
28 // Beacon-related variables
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
29 MAC_BEACON_INFO mbcnInfo;
\ mbcnInfo:
\ 000000 DS 10
30 //-------------------------------------------------------------------------------------------------------
31
32
33
34
35 /*******************************************************************************************************
36 *******************************************************************************************************
37 ************************** BEACON RECEPTION **************************
38 *******************************************************************************************************
39 *******************************************************************************************************/
40
41
42
43
44 //-------------------------------------------------------------------------------------------------------
45 // void mbcnRxPeriodicalBeacon(void)
46 //
47 // DESCRIPTION:
48 // Creates the task that handles reception of periodical beacons (in a beacon-enabled PAN)
49 //-------------------------------------------------------------------------------------------------------
\ In segment NEAR_CODE, align 1, keep-with-next
50 void mbcnRxPeriodicalBeacon(void) NEAR {
\ mbcnRxPeriodicalBeacon:
\ 000000 74F5 MOV A,#-0xb
\ 000002 12.... LCALL ?BANKED_ENTER_XDATA
\ 000005 ; Saved register size: 11
\ 000005 ; Auto size: 0
51 mschAddTask(mbcnInfo.rxTaskNumber, MAC_TASK_PRI_HIGHEST, mbcnRxPeriodicalBeaconTask, NULL);
\ 000005 ; Setup parameters for call to function mschAddTask
\ 000005 75.... MOV ?V0 + 0,#(mbcnRxPeriodicalBeaconTask & 0xff)
\ 000008 75.... MOV ?V0 + 1,#((mbcnRxPeriodicalBeaconTask >> 8) & 0xff)
\ 00000B 75.... MOV ?V0 + 2,#((mbcnRxPeriodicalBeaconTask >> 16) & 0xff)
\ 00000E 78.. MOV R0,#?V0 + 0
\ 000010 12.... LCALL ?PUSH_XSTACK_I_THREE
\ 000013 7C00 MOV R4,#0x0
\ 000015 7D00 MOV R5,#0x0
\ 000017 7A03 MOV R2,#0x3
\ 000019 90.... MOV DPTR,#(mbcnInfo + 1)
\ 00001C REQUIRE ?Subroutine0
\ 00001C ; // Fall through to label ?Subroutine0
52 } // mbcnRxPeriodicalBeacon
\ In segment NEAR_CODE, align 1, keep-with-next
\ ?Subroutine0:
\ 000000 E0 MOVX A,@DPTR
\ 000001 F9 MOV R1,A
\ ??Subroutine0_0:
\ 000002 12.... LCALL mschAddTask & 0xFFFF
\ 000005 7403 MOV A,#0x3
\ 000007 12.... LCALL ?DEALLOC_XSTACK8
\ 00000A 7F03 MOV R7,#0x3
\ 00000C 02.... LJMP ?BANKED_LEAVE_XDATA
53
54
55
56
57 //-------------------------------------------------------------------------------------------------------
58 // void mbcnRxPeriodicalBeaconTask(MAC_TASK_INFO *pTask)
59 //
60 // DESCRIPTION:
61 // Handles configuration of timers related to beacon reception (including starting RX and the
62 // timeout to be generated when no beacon is received). It also handles beacon loss.
63 //
64 // Note: When a beacon is received, the current mbcnRxPeriodicalBeacon callback must be cancelled,
65 // and a new callback must be set up.
66 //
67 // TASK DATA:
68 // 0
69 //-------------------------------------------------------------------------------------------------------
\ In segment NEAR_CODE, align 1, keep-with-next
70 void mbcnRxPeriodicalBeaconTask(MAC_TASK_INFO *pTask) NEAR {
\ mbcnRxPeriodicalBeaconTask:
\ 000000 74F0 MOV A,#-0x10
\ 000002 12.... LCALL ?BANKED_ENTER_XDATA
\ 000005 ; Saved register size: 16
\ 000005 ; Auto size: 0
71
72 // Beacon loss?
73 if (!mbcnInfo.noBcnCountdown) {
\ 000005 EA MOV A,R2
\ 000006 2408 ADD A,#0x8
\ 000008 FE MOV R6,A
\ 000009 EB MOV A,R3
\ 00000A 3400 ADDC A,#0x0
\ 00000C FF MOV R7,A
\ 00000D 90.... MOV DPTR,#(mbcnInfo + 7)
\ 000010 E0 MOVX A,@DPTR
\ 000011 7038 JNZ ??mbcnRxPeriodicalBeaconTask_0
74
75 // Stop the search/tracking
76 if (mbcnInfo.findBeacon) mrxDecrOnCounter();
\ 000013 90.... MOV DPTR,#(mbcnInfo + 6)
\ 000016 E0 MOVX A,@DPTR
\ 000017 6008 JZ ??mbcnRxPeriodicalBeaconTask_1
\ 000019 ; Setup parameters for call to function mrxDecrOnCounter
\ 000019 90.... MOV DPTR,#(mrxDecrOnCounter & 0xffff)
\ 00001C 74.. MOV A,#((mrxDecrOnCounter >> 16) & 0xff)
\ 00001E 12.... LCALL ?BCALL ; Banked call to: DPTR()
77
78 mbcnInfo.findBeacon = FALSE;
\ ??mbcnRxPeriodicalBeaconTask_1:
\ 000021 E4 CLR A
\ 000022 90.... MOV DPTR,#(mbcnInfo + 6)
\ 000025 F0 MOVX @DPTR,A
79 mbcnInfo.trackBeacon = FALSE;
\ 000026 90.... MOV DPTR,#(mbcnInfo + 5)
\ 000029 F0 MOVX @DPTR,A
80
81 // Update buffered PIB attributes
82 mbcnUpdateBufferedPibAttributes();
\ 00002A ; Setup parameters for call to function mbcnUpdateBufferedPibAttributes
\ 00002A 90.... MOV DPTR,#(mbcnUpdateBufferedPibAttributes & 0xffff)
\ 00002D 74.. MOV A,#((mbcnUpdateBufferedPibAttributes >> 16) & 0xff)
\ 00002F 12.... LCALL ?BCALL ; Banked call to: DPTR()
83
84 // Remove and release the task
85 mschRemoveTask(pTask->priority, 0);
\ 000032 ; Setup parameters for call to function mschRemoveTask
\ 000032 7A00 MOV R2,#0x0
\ 000034 8E82 MOV DPL,R6
\ 000036 8F83 MOV DPH,R7
\ 000038 E0 MOVX A,@DPTR
\ 000039 F9 MOV R1,A
\ 00003A 12.... LCALL mschRemoveTask & 0xFFFF
86 mbcnInfo.rxTaskNumber = NO_TASK;
\ 00003D 74FF MOV A,#-0x1
\ 00003F 90.... MOV DPTR,#(mbcnInfo + 1)
\ 000042 F0 MOVX @DPTR,A
87
88 // Make the call to the higher layer
89 mlmeSyncLossIndication(BEACON_LOSS);
\ 000043 ; Setup parameters for call to function mlmeSyncLossIndication
\ 000043 79E0 MOV R1,#-0x20
\ 000045 12.... LCALL mlmeSyncLossIndication & 0xFFFF
\ 000048 02.... LJMP ??mbcnRxPeriodicalBeaconTask_2 & 0xFFFF
90
91 } else {
92 mrxIncrOnCounter();
\ ??mbcnRxPeriodicalBeaconTask_0:
\ 00004B ; Setup parameters for call to function mrxIncrOnCounter
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -