📄 ia443x_demo.lst
字号:
C51 COMPILER V8.00 IA443X_DEMO 11/17/2008 10:50:31 PAGE 1
C51 COMPILER V8.00, COMPILATION OF MODULE IA443X_DEMO
OBJECT MODULE PLACED IN IA443x_demo.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.exe IA443x_demo.c DB OE BR
line level source
1 /*
2 ** ============================================================================
3 **
4 ** FILE
5 ** IA443x_demo.c
6 **
7 ** DESCRIPTION
8 ** Contains the RF dependent functions
9 **
10 ** CREATED
11 ** Silicon Laboratories Hungary Ltd
12 **
13 ** COPYRIGHT
14 ** Copyright 2008 Silicon Laboratories, Inc.
15 ** http://www.silabs.com
16 **
17 ** ============================================================================
18 */
19 /*------------------------------------------------------------------------*/
20 /* INCLUDE */
21 /*------------------------------------------------------------------------*/
22 #include "IA443x_demo.h"
23 #include "global_definitions.h"
24 #include "IA443x_rf.h"
25 #include "IA443x_rf_callback.h"
26 #include "menu.h"
27 #include "IAI_EBID.h"
28
29
30 /*------------------------------------------------------------------------*/
31 /* GLOBAL variables */
32 /*------------------------------------------------------------------------*/
33 idata DEMO_STATES DemoStates, NewDemoStates;
34 bit fChangeDemoStates, AutoTx;
35 idata UU16 DemoTimer;
36 idata uint8 LongDelay;
37 xdata PACKET_TYPE fWaitForPacketOrAck,fPacketSent;
38 xdata uint8 rf_param[10];
39
40 xdata uint16 NmbrOfSentPackets, NmbrOfReceivedPackets,NmbrOfMissedPackets,LastPacketId;
41 xdata ANTENNA_TYPE SelectedAntennaType;
42
43 idata PHY_STATUS RfStatus;
44 xdata uint8 RxTxBuffer[MAX_LENGTH_OF_PAYLOAD];
45 xdata HEADER HeaderBuffer;
46 xdata MESSAGE MessageBuffer;
47 xdata RECEIVE_COMMAND RxCommand;
48 xdata RECEIVED_DATA ReceivedData;
49
50 //EXTERN variables
51 //global_constans.c
52 extern code DEMO_FREQ demo_freqs[MAX_FREQ_SETTING];
53 extern code DEMO_FREQ arib_freqs[MAX_ARIB_FREQ_SETTING];
54 //IAI_EBID.c
55 extern xdata EBID_DATA TestcardData;
C51 COMPILER V8.00 IA443X_DEMO 11/17/2008 10:50:31 PAGE 2
56 //menu.c
57 extern xdata MENU_ITEM_VALUE MenuItems;
58 extern code uint16 v_max_packets[8];
59
60 /*------------------------------------------------------------------------*/
61 /* LOCAL function prototypes */
62 /*------------------------------------------------------------------------*/
63 void DemoAckSent(uint8 success);
64 void DemoPingReceived(void);
65 void DemoAckReceived(uint8 success);
66
67 /*------------------------------------------------------------------------*/
68 /* LOCAL definitions */
69 /*------------------------------------------------------------------------*/
70 #define PER_RESET_INPUT PB2_PIN
71 #define SEND_PACKET_INPUT PB1_PIN
72 #define LED_TX LED1_PIN
73 #define LED_RX LED2_PIN
74 #define LED_ANT1 LED3_PIN
75 #define LED_ANT2 LED4_PIN
76
77 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
78 +
79 + FUNCTION NAME: void DemoInit(void)
80 +
81 + DESCRIPTION: initializes the demo
82 +
83 + RETURN: None
84 +
85 + NOTES:
86 +
87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
88 void DemoInit(void)
89 {
90 1 //initialize the demo variables
91 1 DemoStates = sDemoInit;
92 1 }
93
94 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
95 +
96 + FUNCTION NAME: void DemoStateMachine(void)
97 +
98 + DESCRIPTION: state machine of the demo
99 +
100 + RETURN: None
101 +
102 + NOTES:
103 +
104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
105 void DemoStateMachine(void)
106 {
107 1 uint8 temp8,i,string[6];
108 1 uint16 temp16;
109 1 float temp_float;
110 1
111 1 switch( DemoStates )
112 1 {
113 2 case sDemoInit:
114 2 //set default variables
115 2 DemoStates = sDemoStartScreen;
116 2 //find out what kind of testcard is plugged into the PIC SW Dev board
117 2 GetEBIDDataFromEEPROM();
C51 COMPILER V8.00 IA443X_DEMO 11/17/2008 10:50:31 PAGE 3
118 2 if( TestcardData.valid_info == FALSE )
119 2 {//there is no Testcard inserted or there is no EEPROM on the testcard
120 3 PerformMenu(sMenuTestcardOrEEPROMError);
121 3 DemoStates = sDemoDoNothing;
122 3 return;
123 3 }
124 2 //find out whether the chip is supported by the current FW or not
125 2 switch( TestcardData.chip_type )
126 2 {
127 3 case SI4030:
128 3 case SI4031:
129 3 case SI4032:
130 3 temp8 = TRUE;
131 3 break;
132 3 case SI4330:
133 3 temp8 = TRUE;
134 3 break;
135 3 case SI4430:
136 3 case SI4431:
137 3 case SI4432:
138 3 if( TestcardData.chip_revision[0] == 'V' )
139 3 {
140 4 temp8 = TRUE;
141 4 }
142 3 break;
143 3
144 3 default:
145 3 temp8 = FALSE;
146 3 break;
147 3 }
148 2 if( temp8 == TRUE )
149 2 {//the chip is supported, check the POR
150 3 //initialize the RF chip
151 3 temp8 = RfInitHw();
152 3 if( temp8 == RF_ERROR_TIMING )
153 3 {//POR Timeout error
154 4 PerformMenu( sMenuPORTimeout );
155 4 DemoStates = sDemoDoNothing;
156 4 return;
157 4 }
158 3 }
159 2 else
160 2 {//the chip is not supported by the current FW
161 3 PerformMenu(sMenuNotSupportedChip);
162 3 DemoStates = sDemoDoNothing;
163 3 return;
164 3 }
165 2 //disable hidden menu
166 2 MenuItems.name.show_hidden_menu = FALSE;
167 2 //set the antenna type
168 2 switch( TestcardData.ant_type )
169 2 {
170 3 case SMA_TRX_SWITCH: SelectedAntennaType = RX_TX_SWITCH; break;
171 3 case SEPARATE_SMA: SelectedAntennaType = SEPARATE_RX_TX; break;
172 3 case ANT_DIVERSITY: SelectedAntennaType = ANTENNA_DIVERSITY; break;
173 3 default: SelectedAntennaType = SEPARATE_RX_TX; break;
174 3 }
175 2 break;
176 2
177 2 case sDemoStartScreen:
178 2 //draw the startup screen
179 2 PerformMenu( sMenuStartScreen );
C51 COMPILER V8.00 IA443X_DEMO 11/17/2008 10:50:31 PAGE 4
180 2 //start long timeout -> ~3s
181 2 LongDelay = START_SCREEN_DELAY_SW_DIV;
182 2 DemoTimer.U16 = START_SCREEN_DELAY;
183 2 StartTmr3(START_SCREEN_DELAY_DIV, DemoTimer, FALSE);
184 2
185 2 DemoStates = sDemoDelayAfterScreens;
186 2 break;
187 2
188 2 case sDemoDelayAfterScreens:
189 2 //check whether the timer expired or not
190 2 if( Tmr3Expired() == TRUE )
191 2 {//TMR expired
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -