MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
tlv.h
1 //*****************************************************************************
2 //
3 // tlv.h - Driver for the TLV Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_TLV_H__
8 #define __MSP430WARE_TLV_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_TLV__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "inc/hw_memmap.h"
26 //******************************************************************************
27 //
28 // TLV Data Types
29 //
30 //******************************************************************************
31 struct s_TLV_Die_Record {
32  uint32_t wafer_id;
33  uint16_t die_x_position;
34  uint16_t die_y_position;
35  uint16_t test_results;
36 };
37 
38 struct s_TLV_ADC_Cal_Data {
39  uint16_t adc_gain_factor;
40  int16_t adc_offset;
41  uint16_t adc_ref15_30_temp;
42  uint16_t adc_ref15_85_temp;
43  uint16_t adc_ref20_30_temp;
44  uint16_t adc_ref20_85_temp;
45  uint16_t adc_ref25_30_temp;
46  uint16_t adc_ref25_85_temp;
47 };
48 
49 struct s_TLV_Timer_D_Cal_Data {
50  uint16_t TDH0CTL1_64;
51  uint16_t TDH0CTL1_128;
52  uint16_t TDH0CTL1_200;
53  uint16_t TDH0CTL1_256;
54 };
55 
56 struct s_TLV_REF_Cal_Data {
57  uint16_t ref_ref15;
58  uint16_t ref_ref20;
59  uint16_t ref_ref25;
60 };
61 
62 struct s_Peripheral_Memory_Data {
63  uint16_t memory_1;
64  uint16_t memory_2;
65  uint16_t memory_3;
66  uint16_t memory_4;
67 };
68 
69 //*****************************************************************************
70 //
71 // The following are values that can be passed to the tag parameter for
72 // functions: TLV_getInfo().
73 //
74 //*****************************************************************************
75 #define TLV_TAG_LDTAG TLV_LDTAG
76 #define TLV_TAG_PDTAG TLV_PDTAG
77 #define TLV_TAG_Reserved3 TLV_Reserved3
78 #define TLV_TAG_Reserved4 TLV_Reserved4
79 #define TLV_TAG_BLANK TLV_BLANK
80 #define TLV_TAG_Reserved6 TLV_Reserved6
81 #define TLV_TAG_Reserved7 TLV_Reserved7
82 #define TLV_TAG_TAGEND TLV_TAGEND
83 #define TLV_TAG_TAGEXT TLV_TAGEXT
84 #define TLV_TAG_TIMER_D_CAL TLV_TIMERDCAL
85 #define TLV_DEVICE_ID_0 0x1A04
86 #define TLV_DEVICE_ID_1 0x1A05
87 #define TLV_TAG_DIERECORD TLV_DIERECORD
88 #define TLV_TAG_ADCCAL TLV_ADCCAL
89 #define TLV_TAG_ADC12CAL TLV_ADC12CAL
90 #define TLV_TAG_ADC10CAL TLV_ADC10CAL
91 #define TLV_TAG_REFCAL TLV_REFCAL
92 
93 //*****************************************************************************
94 //
95 // The following are values that can be passed to the tag parameter for
96 // functions: TLV_getPeripheral().
97 //
98 //*****************************************************************************
99 #define TLV_PID_NO_MODULE (0x00)
100 #define TLV_PID_PORTMAPPING (0x10)
101 #define TLV_PID_MSP430CPUXV2 (0x23)
102 #define TLV_PID_JTAG (0x09)
103 #define TLV_PID_SBW (0x0F)
104 #define TLV_PID_EEM_XS (0x02)
105 #define TLV_PID_EEM_S (0x03)
106 #define TLV_PID_EEM_M (0x04)
107 #define TLV_PID_EEM_L (0x05)
108 #define TLV_PID_PMM (0x30)
109 #define TLV_PID_PMM_FR (0x32)
110 #define TLV_PID_FCTL (0x39)
111 #define TLV_PID_CRC16 (0x3C)
112 #define TLV_PID_CRC16_RB (0x3D)
113 #define TLV_PID_WDT_A (0x40)
114 #define TLV_PID_SFR (0x41)
115 #define TLV_PID_SYS (0x42)
116 #define TLV_PID_RAMCTL (0x44)
117 #define TLV_PID_DMA_1 (0x46)
118 #define TLV_PID_DMA_3 (0x47)
119 #define TLV_PID_UCS (0x48)
120 #define TLV_PID_DMA_6 (0x4A)
121 #define TLV_PID_DMA_2 (0x4B)
122 #define TLV_PID_PORT1_2 (0x51)
123 #define TLV_PID_PORT3_4 (0x52)
124 #define TLV_PID_PORT5_6 (0x53)
125 #define TLV_PID_PORT7_8 (0x54)
126 #define TLV_PID_PORT9_10 (0x55)
127 #define TLV_PID_PORT11_12 (0x56)
128 #define TLV_PID_PORTU (0x5E)
129 #define TLV_PID_PORTJ (0x5F)
130 #define TLV_PID_TA2 (0x60)
131 #define TLV_PID_TA3 (0x61)
132 #define TLV_PID_TA5 (0x62)
133 #define TLV_PID_TA7 (0x63)
134 #define TLV_PID_TB3 (0x65)
135 #define TLV_PID_TB5 (0x66)
136 #define TLV_PID_TB7 (0x67)
137 #define TLV_PID_RTC (0x68)
138 #define TLV_PID_BT_RTC (0x69)
139 #define TLV_PID_BBS (0x6A)
140 #define TLV_PID_RTC_B (0x6B)
141 #define TLV_PID_TD2 (0x6C)
142 #define TLV_PID_TD3 (0x6D)
143 #define TLV_PID_TD5 (0x6E)
144 #define TLV_PID_TD7 (0x6F)
145 #define TLV_PID_TEC (0x70)
146 #define TLV_PID_RTC_C (0x71)
147 #define TLV_PID_AES (0x80)
148 #define TLV_PID_MPY16 (0x84)
149 #define TLV_PID_MPY32 (0x85)
150 #define TLV_PID_MPU (0x86)
151 #define TLV_PID_USCI_AB (0x90)
152 #define TLV_PID_USCI_A (0x91)
153 #define TLV_PID_USCI_B (0x92)
154 #define TLV_PID_EUSCI_A (0x94)
155 #define TLV_PID_EUSCI_B (0x95)
156 #define TLV_PID_REF (0xA0)
157 #define TLV_PID_COMP_B (0xA8)
158 #define TLV_PID_COMP_D (0xA9)
159 #define TLV_PID_USB (0x98)
160 #define TLV_PID_LCD_B (0xB1)
161 #define TLV_PID_LCD_C (0xB2)
162 #define TLV_PID_DAC12_A (0xC0)
163 #define TLV_PID_SD16_B_1 (0xC8)
164 #define TLV_PID_SD16_B_2 (0xC9)
165 #define TLV_PID_SD16_B_3 (0xCA)
166 #define TLV_PID_SD16_B_4 (0xCB)
167 #define TLV_PID_SD16_B_5 (0xCC)
168 #define TLV_PID_SD16_B_6 (0xCD)
169 #define TLV_PID_SD16_B_7 (0xCE)
170 #define TLV_PID_SD16_B_8 (0xCF)
171 #define TLV_PID_ADC12_A (0xD1)
172 #define TLV_PID_ADC10_A (0xD3)
173 #define TLV_PID_ADC10_B (0xD4)
174 #define TLV_PID_SD16_A (0xD8)
175 #define TLV_PID_TI_BSL (0xFC)
176 
177 //*****************************************************************************
178 //
179 // Prototypes for the APIs.
180 //
181 //*****************************************************************************
182 
183 //*****************************************************************************
184 //
185 //! \brief Gets TLV Info
186 //!
187 //! The TLV structure uses a tag or base address to identify segments of the
188 //! table where information is stored. Some examples of TLV tags are Peripheral
189 //! Descriptor, Interrupts, Info Block and Die Record. This function retrieves
190 //! the value of a tag and the length of the tag.
191 //!
192 //! \param tag represents the tag for which the information needs to be
193 //! retrieved.
194 //! Valid values are:
195 //! - \b TLV_TAG_LDTAG
196 //! - \b TLV_TAG_PDTAG
197 //! - \b TLV_TAG_Reserved3
198 //! - \b TLV_TAG_Reserved4
199 //! - \b TLV_TAG_BLANK
200 //! - \b TLV_TAG_Reserved6
201 //! - \b TLV_TAG_Reserved7
202 //! - \b TLV_TAG_TAGEND
203 //! - \b TLV_TAG_TAGEXT
204 //! - \b TLV_TAG_TIMER_D_CAL
205 //! - \b TLV_DEVICE_ID_0
206 //! - \b TLV_DEVICE_ID_1
207 //! - \b TLV_TAG_DIERECORD
208 //! - \b TLV_TAG_ADCCAL
209 //! - \b TLV_TAG_ADC12CAL
210 //! - \b TLV_TAG_ADC10CAL
211 //! - \b TLV_TAG_REFCAL
212 //! \param instance In some cases a specific tag may have more than one
213 //! instance. For example there may be multiple instances of timer
214 //! calibration data present under a single Timer Cal tag. This variable
215 //! specifies the instance for which information is to be retrieved (0,
216 //! 1, etc.). When only one instance exists; 0 is passed.
217 //! \param length Acts as a return through indirect reference. The function
218 //! retrieves the value of the TLV tag length. This value is pointed to
219 //! by *length and can be used by the application level once the
220 //! function is called. If the specified tag is not found then the
221 //! pointer is null 0.
222 //! \param data_address acts as a return through indirect reference. Once the
223 //! function is called data_address points to the pointer that holds the
224 //! value retrieved from the specified TLV tag. If the specified tag is
225 //! not found then the pointer is null 0.
226 //!
227 //! \return None
228 //
229 //*****************************************************************************
230 extern void TLV_getInfo(uint8_t tag,
231  uint8_t instance,
232  uint8_t *length,
233  uint16_t **data_address);
234 
235 //*****************************************************************************
236 //
237 //! \brief Retrieves the unique device ID from the TLV structure.
238 //!
239 //!
240 //! \return The device ID is returned as type uint16_t.
241 //
242 //*****************************************************************************
243 extern uint16_t TLV_getDeviceType(void);
244 
245 //*****************************************************************************
246 //
247 //! \brief Gets memory information
248 //!
249 //! The Peripheral Descriptor tag is split into two portions a list of the
250 //! available flash memory blocks followed by a list of available peripherals.
251 //! This function is used to parse through the first portion and calculate the
252 //! total flash memory available in a device. The typical usage is to call the
253 //! TLV_getMemory which returns a non-zero value until the entire memory list
254 //! has been parsed. When a zero is returned, it indicates that all the memory
255 //! blocks have been counted and the next address holds the beginning of the
256 //! device peripheral list.
257 //!
258 //! \param instance In some cases a specific tag may have more than one
259 //! instance. This variable specifies the instance for which information
260 //! is to be retrieved (0, 1 etc). When only one instance exists; 0 is
261 //! passed.
262 //!
263 //! \return The returned value is zero if the end of the memory list is
264 //! reached.
265 //
266 //*****************************************************************************
267 extern uint16_t TLV_getMemory(uint8_t instance);
268 
269 //*****************************************************************************
270 //
271 //! \brief Gets peripheral information from the TLV
272 //!
273 //! he Peripheral Descriptor tag is split into two portions a list of the
274 //! available flash memory blocks followed by a list of available peripherals.
275 //! This function is used to parse through the second portion and can be used
276 //! to check if a specific peripheral is present in a device. The function
277 //! calls TLV_getPeripheral() recursively until the end of the memory list and
278 //! consequently the beginning of the peripheral list is reached. <
279 //!
280 //! \param tag represents represents the tag for a specific peripheral for
281 //! which the information needs to be retrieved. In the header file tlv.
282 //! h specific peripheral tags are pre-defined, for example USCIA_B and
283 //! TA0 are defined as TLV_PID_USCI_AB and TLV_PID_TA2 respectively.
284 //! Valid values are:
285 //! - \b TLV_PID_NO_MODULE - No Module
286 //! - \b TLV_PID_PORTMAPPING - Port Mapping
287 //! - \b TLV_PID_MSP430CPUXV2 - MSP430CPUXV2
288 //! - \b TLV_PID_JTAG - JTAG
289 //! - \b TLV_PID_SBW - SBW
290 //! - \b TLV_PID_EEM_XS - EEM X-Small
291 //! - \b TLV_PID_EEM_S - EEM Small
292 //! - \b TLV_PID_EEM_M - EEM Medium
293 //! - \b TLV_PID_EEM_L - EEM Large
294 //! - \b TLV_PID_PMM - PMM
295 //! - \b TLV_PID_PMM_FR - PMM FRAM
296 //! - \b TLV_PID_FCTL - Flash
297 //! - \b TLV_PID_CRC16 - CRC16
298 //! - \b TLV_PID_CRC16_RB - CRC16 Reverse
299 //! - \b TLV_PID_WDT_A - WDT_A
300 //! - \b TLV_PID_SFR - SFR
301 //! - \b TLV_PID_SYS - SYS
302 //! - \b TLV_PID_RAMCTL - RAMCTL
303 //! - \b TLV_PID_DMA_1 - DMA 1
304 //! - \b TLV_PID_DMA_3 - DMA 3
305 //! - \b TLV_PID_UCS - UCS
306 //! - \b TLV_PID_DMA_6 - DMA 6
307 //! - \b TLV_PID_DMA_2 - DMA 2
308 //! - \b TLV_PID_PORT1_2 - Port 1 + 2 / A
309 //! - \b TLV_PID_PORT3_4 - Port 3 + 4 / B
310 //! - \b TLV_PID_PORT5_6 - Port 5 + 6 / C
311 //! - \b TLV_PID_PORT7_8 - Port 7 + 8 / D
312 //! - \b TLV_PID_PORT9_10 - Port 9 + 10 / E
313 //! - \b TLV_PID_PORT11_12 - Port 11 + 12 / F
314 //! - \b TLV_PID_PORTU - Port U
315 //! - \b TLV_PID_PORTJ - Port J
316 //! - \b TLV_PID_TA2 - Timer A2
317 //! - \b TLV_PID_TA3 - Timer A1
318 //! - \b TLV_PID_TA5 - Timer A5
319 //! - \b TLV_PID_TA7 - Timer A7
320 //! - \b TLV_PID_TB3 - Timer B3
321 //! - \b TLV_PID_TB5 - Timer B5
322 //! - \b TLV_PID_TB7 - Timer B7
323 //! - \b TLV_PID_RTC - RTC
324 //! - \b TLV_PID_BT_RTC - BT + RTC
325 //! - \b TLV_PID_BBS - Battery Backup Switch
326 //! - \b TLV_PID_RTC_B - RTC_B
327 //! - \b TLV_PID_TD2 - Timer D2
328 //! - \b TLV_PID_TD3 - Timer D1
329 //! - \b TLV_PID_TD5 - Timer D5
330 //! - \b TLV_PID_TD7 - Timer D7
331 //! - \b TLV_PID_TEC - Timer Event Control
332 //! - \b TLV_PID_RTC_C - RTC_C
333 //! - \b TLV_PID_AES - AES
334 //! - \b TLV_PID_MPY16 - MPY16
335 //! - \b TLV_PID_MPY32 - MPY32
336 //! - \b TLV_PID_MPU - MPU
337 //! - \b TLV_PID_USCI_AB - USCI_AB
338 //! - \b TLV_PID_USCI_A - USCI_A
339 //! - \b TLV_PID_USCI_B - USCI_B
340 //! - \b TLV_PID_EUSCI_A - eUSCI_A
341 //! - \b TLV_PID_EUSCI_B - eUSCI_B
342 //! - \b TLV_PID_REF - Shared Reference
343 //! - \b TLV_PID_COMP_B - COMP_B
344 //! - \b TLV_PID_COMP_D - COMP_D
345 //! - \b TLV_PID_USB - USB
346 //! - \b TLV_PID_LCD_B - LCD_B
347 //! - \b TLV_PID_LCD_C - LCD_C
348 //! - \b TLV_PID_DAC12_A - DAC12_A
349 //! - \b TLV_PID_SD16_B_1 - SD16_B 1 Channel
350 //! - \b TLV_PID_SD16_B_2 - SD16_B 2 Channel
351 //! - \b TLV_PID_SD16_B_3 - SD16_B 3 Channel
352 //! - \b TLV_PID_SD16_B_4 - SD16_B 4 Channel
353 //! - \b TLV_PID_SD16_B_5 - SD16_B 5 Channel
354 //! - \b TLV_PID_SD16_B_6 - SD16_B 6 Channel
355 //! - \b TLV_PID_SD16_B_7 - SD16_B 7 Channel
356 //! - \b TLV_PID_SD16_B_8 - SD16_B 8 Channel
357 //! - \b TLV_PID_ADC12_A - ADC12_A
358 //! - \b TLV_PID_ADC10_A - ADC10_A
359 //! - \b TLV_PID_ADC10_B - ADC10_B
360 //! - \b TLV_PID_SD16_A - SD16_A
361 //! - \b TLV_PID_TI_BSL - BSL
362 //! \param instance In some cases a specific tag may have more than one
363 //! instance. For example a device may have more than a single USCI
364 //! module, each of which is defined by an instance number 0, 1, 2, etc.
365 //! When only one instance exists; 0 is passed.
366 //!
367 //! \return The returned value is zero if the specified tag value (peripheral)
368 //! is not available in the device.
369 //
370 //*****************************************************************************
371 extern uint16_t TLV_getPeripheral(uint8_t tag,
372  uint8_t instance);
373 
374 //*****************************************************************************
375 //
376 //! \brief Get interrupt information from the TLV
377 //!
378 //! This function is used to retrieve information on available interrupt
379 //! vectors. It allows the user to check if a specific interrupt vector is
380 //! defined in a given device.
381 //!
382 //! \param tag represents the tag for the interrupt vector. Interrupt vector
383 //! tags number from 0 to N depending on the number of available
384 //! interrupts. Refer to the device datasheet for a list of available
385 //! interrupts.
386 //!
387 //! \return The returned value is zero is the specified interrupt vector is not
388 //! defined.
389 //
390 //*****************************************************************************
391 extern uint8_t TLV_getInterrupt(uint8_t tag);
392 
393 //*****************************************************************************
394 //
395 // Mark the end of the C bindings section for C++ compilers.
396 //
397 //*****************************************************************************
398 #ifdef __cplusplus
399 }
400 #endif
401 
402 #endif
403 #endif // __MSP430WARE_TLV_H__

Copyright 2015, Texas Instruments Incorporated