📄 iai_ebid.lst
字号:
C51 COMPILER V8.00 IAI_EBID 11/17/2008 10:50:35 PAGE 1
C51 COMPILER V8.00, COMPILATION OF MODULE IAI_EBID
OBJECT MODULE PLACED IN IAI_EBID.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.exe IAI_EBID.c DB OE BR
line level source
1 /*
2 ** ============================================================================
3 **
4 ** FILE
5 ** IAI_EBID.c
6 **
7 ** DESCRIPTION
8 ** Testcard Board Identification EEPROM handling
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 "IAI_EBID.h"
23 #include <string.h>
24 #include "IA443x_rf.h"
25
26 /*------------------------------------------------------------------------*/
27 /* GLOBAL variables */
28 /*------------------------------------------------------------------------*/
29 xdata EBID_DATA TestcardData;
30 xdata SPECIAL_REGISTERS SpecialRegisters;
31
32 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33 +
34 + FUNCTION NAME: EBID_DATABASES GetEBIDDataFromEEPROM(void)
35 +
36 + DESCRIPTION: It read the data from the EEPROM and set the variables accordingly
37 +
38 + RETURN: the EEPROM database
39 +
40 + NOTES:
41 +
42 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
43 EBID_DATABASES GetEBIDDataFromEEPROM(void)
44 {
45 1 xdata uint8 temp8, i, string[9];
46 1 xdata uint16 temp16;
47 1
48 1 TestcardData.valid_info = FALSE;
49 1
50 1 //figure out what database (s) are available
51 1 temp8 = SpiReadByteFromTestcardEEPROM( 0x0000 );
52 1 if( (temp8 & POWER_DB) == POWER_DB )
53 1 {//the Power Description Database is implemented, use this
54 2 return POWER_DB;
55 2 }
C51 COMPILER V8.00 IAI_EBID 11/17/2008 10:50:35 PAGE 2
56 1 if( (temp8 & WIRELINE_DB) == WIRELINE_DB )
57 1 {//the Wireline Description Database is implemented, use this
58 2 return WIRELINE_DB;
59 2 }
60 1 if( (temp8 & WIRELESS_DB) == WIRELESS_DB )
61 1 {//the Wireless Description Database is implemented, use this
62 2 TestcardData.valid_info = TRUE;
63 2 //find out the chip type
64 2 TestcardData.chip_type = NOT_AVAILABLE;
65 2 SpiReadSegmentFromTestcardEEPROM(0x0010, string, 8);
66 2 if( memcmp(&string[2], "4020", 4) == 0 ) TestcardData.chip_type = SI4020;
67 2 if( memcmp(&string[2], "4021", 4) == 0 ) TestcardData.chip_type = SI4021;
68 2 if( memcmp(&string[2], "4022", 4) == 0 ) TestcardData.chip_type = SI4022;
69 2 if( memcmp(&string[2], "4030", 4) == 0 ) TestcardData.chip_type = SI4030;
70 2 if( memcmp(&string[2], "4031", 4) == 0 ) TestcardData.chip_type = SI4031;
71 2 if( memcmp(&string[2], "4032", 4) == 0 ) TestcardData.chip_type = SI4032;
72 2 if( memcmp(&string[2], "4315", 4) == 0 ) TestcardData.chip_type = SI4315;
73 2 if( memcmp(&string[2], "4320", 4) == 0 ) TestcardData.chip_type = SI4320;
74 2 if( memcmp(&string[2], "4322", 4) == 0 ) TestcardData.chip_type = SI4322;
75 2 if( memcmp(&string[2], "4330", 4) == 0 ) TestcardData.chip_type = SI4330;
76 2 if( memcmp(&string[2], "4322", 4) == 0 ) TestcardData.chip_type = SI4322;
77 2 if( memcmp(&string[2], "4420", 4) == 0 ) TestcardData.chip_type = SI4420;
78 2 if( memcmp(&string[2], "4421", 4) == 0 ) TestcardData.chip_type = SI4421;
79 2 if( memcmp(&string[2], "4430", 4) == 0 ) TestcardData.chip_type = SI4430;
80 2 if( memcmp(&string[2], "4431", 4) == 0 ) TestcardData.chip_type = SI4431;
81 2 if( memcmp(&string[2], "4432", 4) == 0 ) TestcardData.chip_type = SI4432;
82 2 if( memcmp(&string[2], "4520", 4) == 0 ) TestcardData.chip_type = SI4520;
83 2 //get chip revision
84 2 SpiReadSegmentFromTestcardEEPROM(0x0018, &TestcardData.chip_revision[0], 2);
85 2 //get serial number
86 2 temp8 = SpiReadByteFromTestcardEEPROM( 0x0034 );
87 2 TestcardData.serial_nmbr = ((uint16)temp8 << 8) + SpiReadByteFromTestcardEEPROM( 0x0035 );
88 2 //get supported frequency bands
89 2 temp8 = SpiReadByteFromTestcardEEPROM( 0x0043 );
90 2 TestcardData.freq_band = ((uint16)temp8 << 8) + SpiReadByteFromTestcardEEPROM( 0x0044 );
91 2 //get antenna connection type
92 2 TestcardData.ant_type = SpiReadByteFromTestcardEEPROM( 0x0045 );
93 2 //get special registers
94 2 temp8 = SpiReadByteFromTestcardEEPROM( 0x004F);
95 2 SpecialRegisters.nmbr_of_registers = temp8;
96 2 if( temp8 > 0 )
97 2 {
98 3 for(i=0;i<temp8;i++)
99 3 {
100 4 temp16 = ((uint16)SpiReadByteFromTestcardEEPROM(0x0050 + (i << 1) )) << 8;
101 4 temp16 += (uint16)SpiReadByteFromTestcardEEPROM(0x0050 + ((i << 1)+1));
102 4 SpecialRegisters.registers[i] = temp16;
103 4 }
104 3 }
105 2 return WIRELESS_DB;
106 2 }
107 1 //check whether demo specific database is implemented or not
108 1 switch( temp8 & 0x0F )
109 1 {
110 2 case EZRADIO_PRO:
111 2 TestcardData.valid_info = TRUE;
112 2 TestcardData.chip_type = SI4432;
113 2 TestcardData.chip_revision[0] = 'X';
114 2 TestcardData.chip_revision[1] = '2';
115 2 TestcardData.serial_nmbr = (uint16)SpiReadByteFromTestcardEEPROM( 0x0001 );
116 2 TestcardData.freq_band = 0x0300; //868-960MHz
117 2 TestcardData.ant_type = SEPARATE_SMA;
C51 COMPILER V8.00 IAI_EBID 11/17/2008 10:50:35 PAGE 3
118 2 //set special registers
119 2 SpecialRegisters.nmbr_of_registers = 2;
120 2 SpecialRegisters.registers[0] = ((uint16)(VCOCurrentTrimming | 0x80) << 8) + (uint16)SpiReadByteFromTes
-tcardEEPROM( 0x0002 );
121 2 SpecialRegisters.registers[1] = ((uint16)( CrystalOscillatorLoadCapacitance | 0x80) << 8) + (uint16)Spi
-ReadByteFromTestcardEEPROM( 0x0003 );
122 2 break;
123 2
124 2 case EZRADIO_PRO_OFFSET:
125 2 TestcardData.valid_info = TRUE;
126 2 TestcardData.chip_type = SI4432;
127 2 TestcardData.chip_revision[0] = 'X';
128 2 TestcardData.chip_revision[1] = '2';
129 2 TestcardData.serial_nmbr = (uint16)SpiReadByteFromTestcardEEPROM( 0x0001 );
130 2 //figure out the frequency band
131 2 temp8 = SpiReadByteFromTestcardEEPROM( 0x0004 );
132 2 switch( temp8 )
133 2 {
134 3 case 0xFE:
135 3 TestcardData.freq_band = 0x0010; //434MHz
136 3 break;
137 3
138 3 case 0xFF:
139 3 default:
140 3 TestcardData.freq_band = 0x0300; //868-960MHz
141 3 break;
142 3 }
143 2 //figure out the antenna connection type
144 2 temp8 = SpiReadByteFromTestcardEEPROM( 0x0005 );
145 2 switch( temp8 )
146 2 {
147 3 case 0xFD:
148 3 TestcardData.ant_type = ANT_DIVERSITY;
149 3 break;
150 3
151 3 case 0xFE:
152 3 TestcardData.ant_type = SMA_TRX_SWITCH;
153 3 break;
154 3
155 3 case 0xFF:
156 3 default:
157 3 TestcardData.ant_type = SEPARATE_SMA;
158 3 break;
159 3 }
160 2 //set special registers
161 2 SpecialRegisters.nmbr_of_registers = 4;
162 2 SpecialRegisters.registers[0] = ((uint16)(VCOCurrentTrimming | 0x80) << 8) + (uint16)SpiReadByteFromTes
-tcardEEPROM( 0x0002 );
163 2 SpecialRegisters.registers[1] = ((uint16)(CrystalOscillatorLoadCapacitance | 0x80) << 8) + (uint16)SpiR
-eadByteFromTestcardEEPROM( 0x0003 );
164 2 SpecialRegisters.registers[2] = ((uint16)(0x80 | FrequencyOffset) << 8) + 0x00E3;
165 2 SpecialRegisters.registers[3] = ((uint16)(0x80 | FrequencyChannelControl) << 8) + 0x0003;
166 2 break;
167 2
168 2 default:
169 2 //no special database is available
170 2 return NO_EEPROM;
171 2 break;
172 2 }
173 1 return NO_EEPROM;
174 1 }
175
C51 COMPILER V8.00 IAI_EBID 11/17/2008 10:50:35 PAGE 4
176 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
177 +
178 + FUNCTION NAME: void SetSpecialRegisters(void)
179 +
180 + DESCRIPTION: set all the special (not default) registers of the chip
181 +
182 + RETURN: None
183 +
184 + INPUT: None
185 +
186 + NOTES:
187 +
188 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
189 void SetSpecialRegisters(void)
190 {
191 1 xdata uint8 i;
192 1 xdata UU16 temp;
193 1
194 1 for(i=0;i<SpecialRegisters.nmbr_of_registers;i++)
195 1 {
196 2 temp.U16 = SpecialRegisters.registers[i];
197 2 SpiRfWriteWord( temp );
198 2 }
199 1
200 1 if( (TestcardData.chip_type) && (TestcardData.chip_revision[0] == 'V') )
201 1 {
202 2 SpiRfWriteAddressData((REG_WRITE | ChargepumpCurrentTrimming_Override), 0xC0);
203 2 SpiRfWriteAddressData((REG_WRITE | DividerCurrentTrimming), 0x40);
204 2 SpiRfWriteAddressData((REG_WRITE | VCOCurrentTrimming), 0x7F);
205 2 }
206 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1170 ----
CONSTANT SIZE = 80 ----
XDATA SIZE = 42 16
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -