]> git.karo-electronics.de Git - oswald.git/blob - metawatch/F5xx_F6xx_Core_Lib/HAL_TLV.h
Power saving changes, add new fonts, bitmaps and screens
[oswald.git] / metawatch / F5xx_F6xx_Core_Lib / HAL_TLV.h
1 /*******************************************************************************
2  *
3  * HAL_TLV.c
4  * Provides Functions to Read the TLV Data Section of the MSP430 Devices
5  * 
6  *
7  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
8  * 
9  * 
10  *  Redistribution and use in source and binary forms, with or without 
11  *  modification, are permitted provided that the following conditions 
12  *  are met:
13  *
14  *    Redistributions of source code must retain the above copyright 
15  *    notice, this list of conditions and the following disclaimer.
16  *
17  *    Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the 
19  *    documentation and/or other materials provided with the   
20  *    distribution.
21  *
22  *    Neither the name of Texas Instruments Incorporated nor the names of
23  *    its contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
27  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
28  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
30  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
31  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
32  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
35  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
36  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  * 
38  * Updated: Version 2.0 01/17/2011
39  *  
40  ******************************************************************************/
41
42 #ifndef HAL_TLV_H
43 #define HAL_TLV_H
44
45 /*******************************************************************************
46  * Device Descriptors - Fixed Memory Locations
47  ******************************************************************************/
48 #define DEVICE_ID_0             (0x1A04)
49 #define DEVICE_ID_1             (0x1A05)
50
51 /*******************************************************************************
52  * Data Types
53  ******************************************************************************/
54 struct s_TLV_Die_Record {
55   unsigned char die_record[10];
56 };
57
58 struct s_TLV_ADC_Cal_Data {
59   unsigned int adc_gain_factor;
60   unsigned int adc_offset;
61   unsigned int adc_ref15_30_temp;
62   unsigned int adc_ref15_85_temp;
63   unsigned int adc_ref20_30_temp;
64   unsigned int adc_ref20_85_temp;
65   unsigned int adc_ref25_30_temp;
66   unsigned int adc_ref25_85_temp;
67 };
68
69 struct s_TLV_Timer_D_Cal_Data {
70   unsigned int TDH0CTL1_64;
71   unsigned int TDH0CTL1_128;
72   unsigned int TDH0CTL1_200;
73   unsigned int TDH0CTL1_256;
74 };
75
76 struct s_TLV_REF_Cal_Data {
77   unsigned int ref_ref15;
78   unsigned int ref_ref20;
79   unsigned int adc_ref25;
80 };
81
82 /*******************************************************************************
83  * Tag Defines
84  ******************************************************************************/
85 #define TLV_LDTAG             (0x01)      /*  Legacy descriptor (1xx, 2xx,
86                                               4xx families) */
87 #define TLV_PDTAG             (0x02)      /*  Peripheral discovery descriptor */
88 #define TLV_Reserved3         (0x03)      /*  Future usage */
89 #define TLV_Reserved4         (0x04)      /*  Future usage */
90 #define TLV_BLANK             (0x05)      /*  Blank descriptor */
91 #define TLV_Reserved6         (0x06)      /*  Future usage */
92 #define TLV_Reserved7         (0x07)      /*  Serial Number */
93 #define TLV_DIERECORD         (0x08)      /*  Die Record  */
94 #define TLV_ADCCAL            (0x11)      /*  ADC12 calibration */
95 #define TLV_ADC12CAL          (0x11)      /*  ADC12 calibration */
96 #define TLV_ADC10CAL          (0x13)      /*  ADC10 calibration */
97 #define TLV_REFCAL            (0x12)      /*  REF calibration */
98 #define TLV_TIMER_D_CAL       (0x15)      /*  Timer_Dx calibration */
99 #define TLV_TAGEXT            (0xFE)      /*  Tag extender */
100 #define TLV_TAGEND            (0xFF)      /*  Tag End of Table */
101
102 /*******************************************************************************
103  * Peripheral Defines
104  ******************************************************************************/
105 #define TLV_PID_NO_MODULE     (0x00)      /*  No Module */
106 #define TLV_PID_PORTMAPPING   (0x10)      /*  Port Mapping */
107 #define TLV_PID_MSP430CPUXV2  (0x23)      /*  MSP430CPUXV2 */
108 #define TLV_PID_JTAG          (0x09)      /*  JTAG */
109 #define TLV_PID_SBW           (0x0F)      /*  SBW */
110 #define TLV_PID_EEM_XS        (0x02)      /*  EEM X-Small */
111 #define TLV_PID_EEM_S         (0x03)      /*  EEM Small */
112 #define TLV_PID_EEM_M         (0x04)      /*  EEM Medium */
113 #define TLV_PID_EEM_L         (0x05)      /*  EEM Large */
114 #define TLV_PID_PMM           (0x30)      /*  PMM */
115 #define TLV_PID_PMM_FR        (0x32)      /*  PMM FRAM */
116 #define TLV_PID_FCTL          (0x39)      /*  Flash */
117 #define TLV_PID_CRC16         (0x3C)      /*  CRC16 */
118 #define TLV_PID_CRC16_RB      (0x3D)      /*  CRC16 Reverse */
119 #define TLV_PID_WDT_A         (0x40)      /*  WDT_A */
120 #define TLV_PID_SFR           (0x41)      /*  SFR */
121 #define TLV_PID_SYS           (0x42)      /*  SYS */
122 #define TLV_PID_RAMCTL        (0x44)      /*  RAMCTL */
123 #define TLV_PID_DMA_1         (0x46)      /*  DMA 1 */
124 #define TLV_PID_DMA_3         (0x47)      /*  DMA 3 */
125 #define TLV_PID_UCS           (0x48)      /*  UCS */
126 #define TLV_PID_DMA_6         (0x4A)      /*  DMA 6 */
127 #define TLV_PID_DMA_2         (0x4B)      /*  DMA 2 */
128 #define TLV_PID_PORT1_2       (0x51)      /*  Port 1 + 2 / A */
129 #define TLV_PID_PORT3_4       (0x52)      /*  Port 3 + 4 / B */
130 #define TLV_PID_PORT5_6       (0x53)      /*  Port 5 + 6 / C */
131 #define TLV_PID_PORT7_8       (0x54)      /*  Port 7 + 8 / D */
132 #define TLV_PID_PORT9_10      (0x55)      /*  Port 9 + 10 / E */
133 #define TLV_PID_PORT11_12     (0x56)      /*  Port 11 + 12 / F */
134 #define TLV_PID_PORTU         (0x5E)      /*  Port U */
135 #define TLV_PID_PORTJ         (0x5F)      /*  Port J */
136 #define TLV_PID_TA2           (0x60)      /*  Timer A2 */
137 #define TLV_PID_TA3           (0x61)      /*  Timer A1 */
138 #define TLV_PID_TA5           (0x62)      /*  Timer A5 */
139 #define TLV_PID_TA7           (0x63)      /*  Timer A7 */
140 #define TLV_PID_TB3           (0x65)      /*  Timer B3 */
141 #define TLV_PID_TB5           (0x66)      /*  Timer B5 */
142 #define TLV_PID_TB7           (0x67)      /*  Timer B7 */
143 #define TLV_PID_RTC           (0x68)      /*  RTC */
144 #define TLV_PID_BT_RTC        (0x69)      /*  BT + RTC */
145 #define TLV_PID_BBS           (0x6A)      /*  Battery Backup Switch */
146 #define TLV_PID_RTC_B         (0x6B)      /*  RTC_B */
147 #define TLV_PID_TD2           (0x6C)      /*  Timer D2 */
148 #define TLV_PID_TD3           (0x6D)      /*  Timer D1 */
149 #define TLV_PID_TD5           (0x6E)      /*  Timer D5 */
150 #define TLV_PID_TD7           (0x6F)      /*  Timer D7 */
151 #define TLV_PID_TEC           (0x70)      /*  Imer Event Control */
152 #define TLV_PID_RTC_C         (0x71)      /*  RTC_C */
153 #define TLV_PID_AES           (0x80)      /*  AES */
154 #define TLV_PID_MPY16         (0x84)      /*  MPY16 */
155 #define TLV_PID_MPY32         (0x85)      /*  MPY32 */
156 #define TLV_PID_MPU           (0x86)      /*  MPU */
157 #define TLV_PID_USCI_AB       (0x90)      /*  USCI_AB */
158 #define TLV_PID_USCI_A        (0x91)      /*  USCI_A */
159 #define TLV_PID_USCI_B        (0x92)      /*  USCI_B */
160 #define TLV_PID_EUSCI_A       (0x94)      /*  eUSCI_A */
161 #define TLV_PID_EUSCI_B       (0x95)      /*  eUSCI_B */
162 #define TLV_PID_REF           (0xA0)      /*  Shared Reference */
163 #define TLV_PID_COMP_B        (0xA8)      /*  COMP_B */
164 #define TLV_PID_COMP_D        (0xA9)      /*  COMP_D */
165 #define TLV_PID_USB           (0x98)      /*  USB */
166 #define TLV_PID_LCD_B         (0xB1)      /*  LCD_B */
167 #define TLV_PID_LCD_C         (0xB2)      /*  LCD_C */
168 #define TLV_PID_DAC12_A       (0xC0)      /*  DAC12_A */
169 #define TLV_PID_SD16_B_1      (0xC8)      /*  SD16_B 1 Channel */
170 #define TLV_PID_SD16_B_2      (0xC9)      /*  SD16_B 2 Channel */
171 #define TLV_PID_SD16_B_3      (0xCA)      /*  SD16_B 3 Channel */
172 #define TLV_PID_SD16_B_4      (0xCB)      /*  SD16_B 4 Channel */
173 #define TLV_PID_SD16_B_5      (0xCC)      /*  SD16_B 5 Channel */
174 #define TLV_PID_SD16_B_6      (0xCD)      /*  SD16_B 6 Channel */
175 #define TLV_PID_SD16_B_7      (0xCE)      /*  SD16_B 7 Channel */
176 #define TLV_PID_SD16_B_8      (0xCF)      /*  SD16_B 8 Channel */
177 #define TLV_PID_ADC12_A       (0xD1)      /*  ADC12_A */
178 #define TLV_PID_ADC10_A       (0xD3)      /*  ADC10_A */
179 #define TLV_PID_ADC10_B       (0xD4)      /*  ADC10_B */
180 #define TLV_PID_SD16_A        (0xD8)      /*  SD16_A */
181 #define TLV_PID_TI_BSL        (0xFC)      /*  BSL */
182
183 /*******************************************************************************
184  * \brief   Get Information out of the TLV Table
185  *
186  * \param tag               Tag of the TLV entry
187  * \param instance          Instance of the Tag of the TLV entry
188  * \param *length           return: Length of the information if found
189  * \param **data_address    return: start pointer of Data
190  ******************************************************************************/
191 void Get_TLV_Info(unsigned char tag, unsigned char instance, unsigned char *length,
192     unsigned int **data_address);
193
194 /*******************************************************************************
195  * \brief   Get Device Type out of the TLV Table
196  *
197  * \return  Device dependent value
198  ******************************************************************************/
199 unsigned int Get_Device_Type(void);
200
201 /*******************************************************************************
202  * \brief   Get Memory Info out of the TLV Table
203  *
204  * \param instance  Index of the Instance [0..]
205  * \return          Memory Data found
206  ******************************************************************************/
207 unsigned int Get_TLV_Memory(unsigned char instance);
208
209 /*******************************************************************************
210  * \brief Get Peripheral Info out of the TLV Table
211  *
212  * \param tag       Tag of the TLV entry
213  * \param instance  Index of the Instance [0..]
214  * \return          Peripheral Data found
215  ******************************************************************************/
216 unsigned int Get_TLV_Peripheral(unsigned char tag, unsigned char instance);
217
218 /*******************************************************************************
219  * \brief   Get Interrupt Info out of the TLV Table
220  *
221  * \param tag   Tag of the TLV entry
222  * \return      Interrupt Data found
223  ******************************************************************************/
224 unsigned char Get_TLV_Interrupt(unsigned char tag);
225
226 #endif /* HAL_TLV_H */