📄 mac_loc.lst
字号:
##############################################################################
# #
# IAR 8051 C/C++ Compiler V7.20H/W32 16/Jan/2007 15:30:20 #
# 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\apps\mac_loc.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\apps\mac_loc.c #
# List file = E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\CC2430EB\List\mac_loc.lst #
# Object file = E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\CC2430EB\Obj\mac_loc.r51 #
# #
# #
##############################################################################
E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engine\apps\mac_loc.c
1 /******************************************************************************
2 * *
3 * ********** *
4 * ************ *
5 * *** *** *
6 * *** ++ *** *
7 * *** + + *** CHIPCON *
8 * *** + *
9 * *** + + *** *
10 * *** ++ *** *
11 * *** *** *
12 * ************ *
13 * ********** *
14 * *
15 *******************************************************************************
16
17 Filename: mac_loc.c
18 Target: cc2431/ cc2430
19 Author: KJA
20 Revised: 14/02-2006
21 Revision: 1.0
22
23 Description:
24 This file implements all function which is common for both Blind and Reference
25 Node.
26
27 ******************************************************************************/
28
29
30 /******************************************************************************
31 *******************************************************************************
32 ** CONFIDENTIAL **
33 ** The use of this file is restricted by the signed MAC software license **
34 ** agreement. **
35 ** **
36 ** Copyright Chipcon AS, 2006 **
37 *******************************************************************************
38 ******************************************************************************/
39
40
41
42 #include <mac_headers.h>
\ In segment SFR_AN, at 0xb4
\ unsigned char volatile __sfr ADCCON1
\ ADCCON1:
\ 000000 DS 1
\ In segment SFR_AN, at 0xbd
\ unsigned char volatile __sfr RNDH
\ RNDH:
\ 000000 DS 1
\ In segment SFR_AN, at 0xc7
\ unsigned char volatile __sfr MEMCTR
\ MEMCTR:
\ 000000 DS 1
\ In segment SFR_AN, at 0xf4
\ unsigned char volatile __sfr P1SEL
\ P1SEL:
\ 000000 DS 1
\ In segment SFR_AN, at 0xfd
\ unsigned char volatile __sfr P0DIR
\ P0DIR:
\ 000000 DS 1
\ In segment SFR_AN, at 0xfe
\ unsigned char volatile __sfr P1DIR
\ P1DIR:
\ 000000 DS 1
43 #include "hal.h"
44 #include "node.h"
45 #ifdef CC2430EB
46 #include "lcd.h"
47 #endif
48
49 #define INVALID_STATUS 0x80
50
51 // Addresses
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
52 WORD myShortAddr; // The short address
\ myShortAddr:
\ 000000 DS 2
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
53 ADDRESS extAddr; // The extended address
\ extAddr:
\ 000000 DS 8
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
54 WORD panId; // The PAN ID
\ panId:
\ 000000 DS 2
55
56
57 // hold node type, blind node or reference node
58 extern NODE_TYPE nodeType;
59
60 // The payload of the packets transmitted by the device
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
61 BYTE pBuffer[128];
\ pBuffer:
\ 000000 DS 128
62
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
63 BYTE msduHandle, txOptions;
\ msduHandle:
\ 000000 DS 1
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
\ txOptions:
\ 000000 DS 1
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
64 MAC_ENUM dataConfirmStatus, pollConfirmStatus;
\ dataConfirmStatus:
\ 000000 DS 1
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
\ pollConfirmStatus:
\ 000000 DS 1
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
65 BYTE dataConfirmMsduHandle;
\ dataConfirmMsduHandle:
\ 000000 DS 1
66
67
68 // Prototypes
69 ROOT void FetchIeeeAddress(unsigned char *ieeeAddress);
70 static void StartDevice(void);
71 static void WaitForDeviceModeSelection (NODE_TYPE *deviceMode);
72 static void WaitForPacketTransmission (BYTE msduHandle);
73
74 #ifdef SOC_BB
75 void RunHWTest(void);
76 #endif
77
78
79 /******************************************************************************
80 *
81 * Startup sequence and main loop.
82 ******************************************************************************/
\ In segment BANKED_CODE, align 1, keep-with-next
83 void main(void)
\ main:
84 {
\ 000000 ; Auto size: 0
85 BOOL resetCoordinates;
86
87 INIT_BUTTON();
\ 000000 53FDFD ANL 0xfd,#0xfd
88 #if defined CC2430EB
89 INIT_JOYSTICK();
\ 000003 53FDBF ANL 0xfd,#0xbf
90 initLcd();
\ 000006 ; Setup parameters for call to function initLcd
\ 000006 90.... MOV DPTR,#(initLcd & 0xffff)
\ 000009 74.. MOV A,#((initLcd >> 16) & 0xff)
\ 00000B 12.... LCALL ?BCALL ; Banked call to: DPTR()
91 lcdUpdate("Chipcon","Location Engine");
\ 00000E ; Setup parameters for call to function lcdUpdate
\ 00000E 7C.. MOV R4,#(`?<Constant "Location Engine">` & 0xff)
\ 000010 7D.. MOV R5,#((`?<Constant "Location Engine">` >> 8) & 0xff)
\ 000012 7A.. MOV R2,#(`?<Constant "Chipcon">` & 0xff)
\ 000014 7B.. MOV R3,#((`?<Constant "Chipcon">` >> 8) & 0xff)
\ 000016 90.... MOV DPTR,#(lcdUpdate & 0xffff)
\ 000019 74.. MOV A,#((lcdUpdate >> 16) & 0xff)
\ 00001B 12.... LCALL ?BCALL ; Banked call to: DPTR()
92 #elif defined CC2430DB
93 INIT_JOYSTICK();
94 ENABLE_DB_PERIPHERALS();
95 #endif
96
97 #ifdef USE_LED
98 INIT_LED1();
\ 00001E D290 SETB 0x90.0
\ 000020 43FE01 ORL 0xfe,#0x1
\ 000023 53F4FE ANL 0xf4,#0xfe
99 #if defined CC2430EB
100 INIT_LED3();
\ 000026 D293 SETB 0x90.3
\ 000028 43FE08 ORL 0xfe,#0x8
\ 00002B 53F4F7 ANL 0xf4,#0xf7
101 #elif defined CC2430DB
102 INIT_LED2();
103 #endif
104 #endif
105
106
107 #ifdef SOC_BB
108 RunHWTest();
109 #endif
110
111 // Setup MAC framework
112 MAC_INIT();
\ 00002E C2AF CLR 0xa8.7
\ 000030 E4 CLR A
\ 000031 90.... MOV DPTR,#(mpib + 8)
\ 000034 F0 MOVX @DPTR,A
\ 000035 90.... MOV DPTR,#(mpib + 31)
\ 000038 F0 MOVX @DPTR,A
\ 000039 ; Setup parameters for call to function mschInit
\ 000039 12.... LCALL mschInit & 0xFFFF
\ 00003C ; Setup parameters for call to function mtimInit
\ 00003C 7900 MOV R1,#0x0
\ 00003E 12.... LCALL mtimInit & 0xFFFF
\ 000041 D2BA SETB 0xb8.2
\ 000043 E4 CLR A
\ 000044 90.... MOV DPTR,#macInfo
\ 000047 F0 MOVX @DPTR,A
\ 000048 7402 MOV A,#0x2
\ 00004A 90.... MOV DPTR,#mpmInfo
\ 00004D F0 MOVX @DPTR,A
\ 00004E 90.... MOV DPTR,#(mpmInfo + 1)
\ 000051 F0 MOVX @DPTR,A
\ 000052 7401 MOV A,#0x1
\ 000054 90.... MOV DPTR,#(mrxInfo + 15)
\ 000057 F0 MOVX @DPTR,A
\ 000058 ; Setup parameters for call to function InitializeCommonStorage
\ 000058 12.... LCALL InitializeCommonStorage & 0xFFFF
\ 00005B ; Setup parameters for call to function InitializeDma
\ 00005B 12.... LCALL InitializeDma & 0xFFFF
\ 00005E ; Setup parameters for call to function InitializeRfInterrupts
\ 00005E 12.... LCALL InitializeRfInterrupts & 0xFFFF
\ 000061 D2AF SETB 0xa8.7
113
114 // Power up
115 mpmSetRequest(MPM_CC2430_ON);
\ 000063 ; Setup parameters for call to function mpmSetRequest
\ 000063 7900 MOV R1,#0x0
\ 000065 12.... LCALL mpmSetRequest & 0xFFFF
116 while (mpmGetState() != MPM_CC2430_ON);
\ ??main_0:
\ 000068 ; Setup parameters for call to function mpmGetState
\ 000068 12.... LCALL mpmGetState & 0xFFFF
\ 00006B E9 MOV A,R1
\ 00006C 70FA JNZ ??main_0
\ ??main_1:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -