📄 ref_node.lst
字号:
##############################################################################
# #
# IAR 8051 C/C++ Compiler V7.20H/W32 16/Jan/2007 15:34:00 #
# 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\ref_node.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 #
# USE_LED -D SOC_BB -lCN "E:\公司产品资料\Zigbee\cc #
# 2431\cc2431定位\LOC_Engine\Test\mac\mac_loc\SOC_B #
# B, hex\List\" -lA "E:\公司产品资料\Zigbee\cc2431\ #
# cc2431定位\LOC_Engine\Test\mac\mac_loc\SOC_BB, #
# hex\List\" -o "E:\公司产品资料\Zigbee\cc2431\cc24 #
# 31定位\LOC_Engine\Test\mac\mac_loc\SOC_BB, #
# hex\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\ref_node.c #
# List file = E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\SOC_BB, hex\List\ref_node.lst #
# Object file = E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engi #
# ne\Test\mac\mac_loc\SOC_BB, hex\Obj\ref_node.r51 #
# #
# #
##############################################################################
E:\公司产品资料\Zigbee\cc2431\cc2431定位\LOC_Engine\apps\ref_node.c
1 /******************************************************************************
2 * *
3 * ********** *
4 * ************ *
5 * *** *** *
6 * *** ++ *** *
7 * *** + + *** CHIPCON *
8 * *** + *
9 * *** + + *** *
10 * *** ++ *** *
11 * *** *** *
12 * ************ *
13 * ********** *
14 * *
15 *******************************************************************************
16
17 Filename: refNode.c
18 Author: KJA/ EFU
19 Revised: 14/02-2006
20 Revision: 1.0
21
22 Description:
23 This file contains all main functions for reference node.
24
25 Only X and Y dimensions are implemented, but the system is prepared for a
26 Z dimension in addition.
27
28 Coordinates are written to flash. To aviod writting to the same location in
29 flash each time, the coordinates will be moved for each writting. Each time
30 coordinates are written a 8 bytes block will be updated. To invalidate a
31 block, byte 0 is set to 0x00. For a valid block byte 0 is set to 0xFF.
32
33 Format for xyz-item in FLASH (8 byte)
34 Valid: ----------------------------------------------
35 | 0xFF | -- | -- | X_H | X_L | Y_H | Y_L | Z |
36 ----------------------------------------------
37 Invalid: ----------------------------------------------
38 | 0x00 | -- | -- | X_H | X_L | Y_H | Y_L | Z |
39 ----------------------------------------------
40
41
42 ******************************************************************************/
43
44 #include "mac_headers.h"
\ In segment SFR_AN, at 0x95
\ unsigned char volatile __sfr ST0
\ ST0:
\ 000000 DS 1
\ In segment SFR_AN, at 0x96
\ unsigned char volatile __sfr ST1
\ ST1:
\ 000000 DS 1
\ In segment SFR_AN, at 0x97
\ unsigned char volatile __sfr ST2
\ ST2:
\ 000000 DS 1
\ In segment SFR_AN, at 0xab
\ unsigned char volatile __sfr FWT
\ FWT:
\ 000000 DS 1
\ In segment SFR_AN, at 0xac
\ unsigned char volatile __sfr FADDRL
\ FADDRL:
\ 000000 DS 1
\ In segment SFR_AN, at 0xad
\ unsigned char volatile __sfr FADDRH
\ FADDRH:
\ 000000 DS 1
\ In segment SFR_AN, at 0xae
\ unsigned char volatile __sfr FCTL
\ FCTL:
\ 000000 DS 1
\ In segment SFR_AN, at 0xc6
\ unsigned char volatile __sfr CLKCON
\ CLKCON:
\ 000000 DS 1
\ In segment SFR_AN, at 0xc7
\ unsigned char volatile __sfr MEMCTR
\ MEMCTR:
\ 000000 DS 1
\ In segment SFR_AN, at 0xc9
\ unsigned char volatile __sfr WDCTL
\ WDCTL:
\ 000000 DS 1
\ In segment SFR_AN, at 0xd1
\ unsigned char volatile __sfr DMAIRQ
\ DMAIRQ:
\ 000000 DS 1
\ In segment SFR_AN, at 0xd4
\ unsigned char volatile __sfr DMA0CFGL
\ DMA0CFGL:
\ 000000 DS 1
\ In segment SFR_AN, at 0xd5
\ unsigned char volatile __sfr DMA0CFGH
\ DMA0CFGH:
\ 000000 DS 1
\ In segment SFR_AN, at 0xd6
\ unsigned char volatile __sfr DMAARM
\ DMAARM:
\ 000000 DS 1
45 #include "node.h"
46
47 // flags
48 extern BOOL msgReceived;
49
50 // node parameters
51 extern MSG_BUFFER buffer;
52 extern UINT16_2 x;
53 extern UINT16_2 y;
54 extern UINT8 z;
55 extern BOOL parametersReceived;
56 extern BOOL blinkLed;
57 extern UINT8 ledBlinkCounter;
58
59 // Flash storing
60 #define XYZ_FLASH_ADDRESS 0xF000
61 #define PAGE_NUMBER ((XYZ_FLASH_ADDRESS >> 11) + 32)
62 #define XYZ_BANK 3
63 #define FLASH_PAGE_SIZE 2048
64 #define NUMBER_OF_FLASH_ENTRIES (FLASH_PAGE_SIZE / sizeof(FLASH_ENTRY))
65 #define SET_MEMORY_BANK(bank) do{ MEMCTR = (MEMCTR & ~0x30) | (bank << 4); } while(0)
66
67
68 // Reference node states
69 enum {
70 AWAKE_STATE,
71 SLEEP_STATE,
72 BLINK_LED_STATE
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
73 } refNodeState;
\ refNodeState:
\ 000000 DS 1
74
75
76 // Flash storage struct
77 typedef struct{
78 BYTE status[3];
79 struct{
80 UINT16_2 x;
81 UINT16_2 y;
82 UINT8 z;
83 }xyz_coordinates;
84 }FLASH_ENTRY;
85
86 // Pointers, arrays, variables
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
87 FLASH_ENTRY __code* pFlashEntry;
\ pFlashEntry:
\ 000000 DS 2
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
88 FLASH_ENTRY flashEntries[2];
\ flashEntries:
\ 000000 DS 16
\ In segment XDATA_Z, align 1, keep-with-next
\ 000000 REQUIRE __INIT_XDATA_Z
89 volatile DMA_DESC dmaChannel;
\ dmaChannel:
\ 000000 DS 8
\ In segment PM0_XDATA, align 1
90 __no_init BYTE pRamBuffer[10] @ "PM0_XDATA";
\ pRamBuffer:
\ 000000 DS 10
91
92
93 /******************************************************************************
94 *
95 * This function is the main loop for Reference Node
96 ******************************************************************************/
\ In segment NEAR_CODE, align 1, keep-with-next
97 __near_func void RunRefNode(BOOL resetCoordinates){
\ RunRefNode:
\ 000000 74F1 MOV A,#-0xf
\ 000002 12.... LCALL ?FUNC_ENTER_XDATA
\ 000005 ; Saved register size: 15
\ 000005 ; Auto size: 8
\ 000005 74F8 MOV A,#-0x8
\ 000007 12.... LCALL ?ALLOC_XSTACK8
\ 00000A E9 MOV A,R1
\ 00000B FE MOV R6,A
98 BYTE packetType;
99 UINT32 msgTimerValue, msgTimerValueNextSend, sleepTimerValue;
100
101 SendText("RefNode Powerup");
\ 00000C ; Setup parameters for call to function SendText
\ 00000C 7A.. MOV R2,#(`?<Constant "RefNode Powerup">` & 0xff)
\ 00000E 7B.. MOV R3,#((`?<Constant "RefNode Powerup">` >> 8) & 0xff)
\ 000010 90.... MOV DPTR,#(SendText & 0xffff)
\ 000013 74.. MOV A,#((SendText >> 16) & 0xff)
\ 000015 12.... LCALL ?BCALL ; Banked call to: DPTR()
102
103 setUpDmaToFlash();
\ 000018 ; Setup parameters for call to function setUpDmaToFlash
\ 000018 12.... LCALL setUpDmaToFlash
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -