1 /******************************************************************************
2 	TORNADO AMC modules Software Development Kit (SDK). Rev 3B.
3 	(C) MicroLAB Systems, 2014-2017
4 
5 	File:	TORNADO AMC SDK functions for DSP environment declarations
6 	-----
7 
8 	Notes:
9 	------
10 	1.	This C-header file contains TORNADO AMC modules SDK functions
11 		for DSP environment declarations and is an include file for
12 		TI C6xxx C/C++ Code Generation Tools, which must be invoked to compile
13 		for TORNADO AMC platform.
14 
15 	2.	This file is best viewed with the TAB setting set to '4'.
16 
17 ******************************************************************************/
18 
19 
20 /**
21  * @file  TA66XX_DSP_BC_FUNCTIONS.hxx
22  *
23  * @brief  Board control (BC) SDK functions declarations
24  *
25  * This file contains declarations of TORNADO AMC modules SDK functions for
26  * board control
27  *
28  */
29 
30 
31 #ifndef __TA66XX_DSP_BC_FUNCTIONS_HXX__						// check for this file has been already included
32 #define __TA66XX_DSP_BC_FUNCTIONS_HXX__						1
33 
34 
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
41 
42 //=============================================================================
43 //============ DSP environment functions ======================================
44 //=============================================================================
45 
46 /** @addtogroup  TA66XX_BC_INIT  TORNADO AMC DSP environment init functions
47  *  @{
48  */
49 
50 
51 /** Default DSP interrupt vector for DSP I2C interrupt */
52 #define TA66XX_BC_I2C_INTERRUPT_NUMBER_USED					4
53 
54 
55 /*------------ TA66XX_BC_set_i2c_interrupt_number() function -------------*//**
56  * @brief  Function should be called before calling TA66XX_BC_init() function
57  * and is used to select DSP interrupt vector number for DSP I2C interrupt.
58  *
59  * @param[in]  dsp_vector_id - DSP interrupt vector number, which will be used
60  *				for DSP I2C interrupt.
61  *
62  * @return  Error code
63  *
64 -----------------------------------------------------------------------------*/
65 int32_t TA66XX_BC_set_i2c_interrupt_number(uint32_t dsp_vector_id);
66 
67 
68 /*------------ TA66XX_BC_get_i2c_interrupt_number() function -------------*//**
69  * @brief  Function returns current DSP interrupt vector number for DSP I2C
70  * interrupt.
71  *
72  * @return  DSP interrupt vector number, which is used for DSP I2C interrupt.
73  *
74 -----------------------------------------------------------------------------*/
75 uint32_t TA66XX_BC_get_i2c_interrupt_number(void);
76 
77 
78 /** Default DSP interrupt vector for DSP UART interrupt */
79 #define TA66XX_BC_UART_INTERRUPT_NUMBER_USED				5
80 
81 
82 /*------------ TA66XX_BC_set_uart_interrupt_number() function ------------*//**
83  * @brief  Function should be called before calling TA66XX_BC_init() function
84  * and is used to select DSP interrupt vector number for DSP UART interrupt.
85  *
86  * @param[in]  dsp_vector_id - DSP interrupt vector number, which will be used
87  *				for DSP UART interrupt.
88  *
89  * @return  Error code
90  *
91 -----------------------------------------------------------------------------*/
92 int32_t TA66XX_BC_set_uart_interrupt_number(uint32_t dsp_vector_id);
93 
94 
95 /*------------ TA66XX_BC_get_uart_interrupt_number() function ------------*//**
96  * @brief  Function returns current DSP interrupt vector number for DSP UART
97  * interrupt.
98  *
99  * @return  DSP interrupt vector number, which is used for DSP UART interrupt.
100  *
101 -----------------------------------------------------------------------------*/
102 uint32_t TA66XX_BC_get_uart_interrupt_number(void);
103 
104 
105 /*------------ TA66XX_BC_init() function ---------------------------------*//**
106  * @brief  Function performs initialization of TORNADO AMC modules
107  * DSP environment in accordance with board type
108  *
109  * The function does the following:
110  * 1. DSP on-chip caches are configured by default: L1P and L1D caches are
111  *    enabled and set to max available size, L2 cache is disabled so L2 memory
112  *    acts as SRAM.
113  * 2. DSP main PLL, DDR3 PLL and PASS PLL are configured by default: DSP core
114  *    clock is set to TA66XX_BC_DSP_CORE_SPEED_VALUE, DDR3 and PASS controllers
115  *    to default values
116  * 3. DDR3 memory is configured and ready to use
117  * 4. All DSP power domains are enabled
118  * 5. DSP EMIF-16 bus is configured.
119  * 6. In case external 1GE interface is installed then DSP SGMII port is
120  *    initialized.
121  * 7. DSP GPIO pins are configured as outputs and cleared.
122  * 8. DSP LEDs are enabled.
123  *
124  * @return  Error code
125  *
126 -----------------------------------------------------------------------------*/
127 int32_t TA66XX_BC_init(void);
128 
129 
130 /*------------ TA66XX_BC_get_ddr_area_base_addr() function ---------------*//**
131  * @brief  Function returns DDR3 area base address
132  *
133  * @return  DDR3 area base address
134  *
135 -----------------------------------------------------------------------------*/
136 uint32_t TA66XX_BC_get_ddr_area_base_addr(void);
137 
138 
139 /*------------ TA66XX_BC_get_ddr_area_length() function ------------------*//**
140  * @brief  Function returns DDR3 area length in bytes
141  *
142  * @return  DDR3 area length in bytes
143  *
144 -----------------------------------------------------------------------------*/
145 uint64_t TA66XX_BC_get_ddr_area_length(void);
146 
147 
148 //-----------------------------------------------------------------------------
149 // These functions are used to map either lower 2 GB DDR3 page or high 2 GB
150 // DDR3 page of 4GB DDR3 memory area to DSP 32-bit logical memory map.
151 
152 /** The lower 2GB DDR3 memory page */
153 #define TA66XX_BC_DDR3_MEM_PAGE0							0
154 /** The high 2GB DDR3 memory page */
155 #define TA66XX_BC_DDR3_MEM_PAGE1							1
156 //-----------------------------------------------------------------------------
157 
158 /*------------ TA66XX_BC_set_ddr_area_page() function --------------------*//**
159  * @brief  Function sets the specified 2 GB DDR3 memory page (0 or 1) to be
160  * mapped to DSP 32-bit logical memory map.
161  *
162  * This function should be used only in case of 4 GB and more DDR3 memory is
163  * installed otherwise it does nothing.
164  *
165  * @param[in]  page - 2 GB DDR3 memory page (0 or 1);
166  *
167  * @return  Error code
168  *
169 -----------------------------------------------------------------------------*/
170 int32_t TA66XX_BC_set_ddr_area_page(uint32_t page);
171 
172 
173 /*------------ TA66XX_BC_get_ddr_area_page() function --------------------*//**
174  * @brief  Function returns current selected 2 GB DDR3 memory page (0 or 1)
175  * which is mapped to DSP 32-bit logical memory map.
176  *
177  * @return  Current selected 2 GB DDR3 memory page (0 or 1)
178  *
179 -----------------------------------------------------------------------------*/
180 uint32_t TA66XX_BC_get_ddr_area_page(void);
181 
182 
183 /** @}*/
184 //=============================================================================
185 
186 
187 
188 //=============================================================================
189 //============ DSP LED functions ==============================================
190 //=============================================================================
191 
192 /** @addtogroup  TA66XX_BC_DSP_LED  TORNADO AMC DSP LED functions
193  *  @{
194  */
195 
196 /** DSP LED definitions */
197 enum TA66XX_BC_DSP_LEDS
198 {
199 	TA66XX_BC_DSP_LED0 = 0,						/**< DSP LED-0 */
200 	TA66XX_BC_DSP_LED1,							/**< DSP LED-1 */
201 	TA66XX_BC_DSP_LED2,							/**< DSP LED-2 */
202 	TA66XX_BC_DSP_LED3,							/**< DSP LED-3 */
203 	TA66XX_BC_DSP_LED4,							/**< DSP LED-4 */
204 	TA66XX_BC_DSP_LED5,							/**< DSP LED-5 */
205 	TA66XX_BC_DSP_LED6,							/**< DSP LED-6 */
206 	TA66XX_BC_DSP_LED7							/**< DSP LED-7 */
207 };
208 
209 /** DSP LED bitmask definitions */
210 enum TA66XX_BC_DSP_LED_BITMASKS
211 {
212 	TA66XX_BC_DSP_LED0_BITMASK = 0x0001,		/**< DSP LED-0 bitmask */
213 	TA66XX_BC_DSP_LED1_BITMASK = 0x0002,		/**< DSP LED-1 bitmask */
214 	TA66XX_BC_DSP_LED2_BITMASK = 0x0004,		/**< DSP LED-2 bitmask */
215 	TA66XX_BC_DSP_LED3_BITMASK = 0x0008,		/**< DSP LED-3 bitmask */
216 	TA66XX_BC_DSP_LED4_BITMASK = 0x0010,		/**< DSP LED-4 bitmask */
217 	TA66XX_BC_DSP_LED5_BITMASK = 0x0020,		/**< DSP LED-5 bitmask */
218 	TA66XX_BC_DSP_LED6_BITMASK = 0x0040,		/**< DSP LED-6 bitmask */
219 	TA66XX_BC_DSP_LED7_BITMASK = 0x0080,		/**< DSP LED-7 bitmask */
220 	TA66XX_BC_DSP_LEDS_BITMASK = 0x00ff			/**< DSP LEDs bitmask */
221 };
222 
223 // Definitions for DSP LEDs used for TORNADO-A6678/FMC rev.1A and later boards
224 /** DSP LED GREEN-0 */
225 #define TA66XX_BC_DSP_LED_GREEN0							TA66XX_BC_DSP_LED0
226 #define TA66XX_BC_DSP_LED_GREEN0_BITMASK					TA66XX_BC_DSP_LED0_BITMASK
227 /** DSP LED RED-0 */
228 #define TA66XX_BC_DSP_LED_RED0								TA66XX_BC_DSP_LED1
229 #define TA66XX_BC_DSP_LED_RED0_BITMASK						TA66XX_BC_DSP_LED1_BITMASK
230 /** DSP LED GREEN-1 */
231 #define TA66XX_BC_DSP_LED_GREEN1							TA66XX_BC_DSP_LED2
232 #define TA66XX_BC_DSP_LED_GREEN1_BITMASK					TA66XX_BC_DSP_LED2_BITMASK
233 /** DSP LED RED-1 */
234 #define TA66XX_BC_DSP_LED_RED1								TA66XX_BC_DSP_LED3
235 #define TA66XX_BC_DSP_LED_RED1_BITMASK						TA66XX_BC_DSP_LED3_BITMASK
236 /** DSP LED GREEN-2 */
237 #define TA66XX_BC_DSP_LED_GREEN2							TA66XX_BC_DSP_LED4
238 #define TA66XX_BC_DSP_LED_GREEN2_BITMASK					TA66XX_BC_DSP_LED4_BITMASK
239 /** DSP LED YELLOW-0 */
240 #define TA66XX_BC_DSP_LED_YELLOW0							TA66XX_BC_DSP_LED5
241 #define TA66XX_BC_DSP_LED_YELLOW0_BITMASK					TA66XX_BC_DSP_LED5_BITMASK
242 /** DSP LED YELLOW-1 */
243 #define TA66XX_BC_DSP_LED_YELLOW1							TA66XX_BC_DSP_LED6
244 #define TA66XX_BC_DSP_LED_YELLOW1_BITMASK					TA66XX_BC_DSP_LED6_BITMASK
245 /** DSP LED RED-2 */
246 #define TA66XX_BC_DSP_LED_RED2								TA66XX_BC_DSP_LED7
247 #define TA66XX_BC_DSP_LED_RED2_BITMASK						TA66XX_BC_DSP_LED7_BITMASK
248 
249 /** DSP LED aliases for compatibility with TORNADO-A6678 rev.1B-1 board definitions */
250 #define TA66XX_BC_DSP_LED_RED								TA66XX_BC_DSP_LED_RED0
251 #define TA66XX_BC_DSP_LED_AMBER								TA66XX_BC_DSP_LED_YELLOW0
252 #define TA66XX_BC_DSP_LED_BLUE								TA66XX_BC_DSP_LED_GREEN2
253 #define TA66XX_BC_DSP_LED_WHITE								TA66XX_BC_DSP_LED_RED2
254 
255 
256 // Aliases for DSP LEDs used for TORNADO-A6678 rev.1B-1 board
257 /** DSP LED GREEN-0 */
258 #define TA6678_REV1B_BC_DSP_LED_GREEN0						TA66XX_BC_DSP_LED0
259 #define TA6678_REV1B_BC_DSP_LED_GREEN0_BITMASK				TA66XX_BC_DSP_LED0_BITMASK
260 /** DSP LED GREEN-1 */
261 #define TA6678_REV1B_BC_DSP_LED_GREEN1						TA66XX_BC_DSP_LED1
262 #define TA6678_REV1B_BC_DSP_LED_GREEN1_BITMASK				TA66XX_BC_DSP_LED1_BITMASK
263 /** DSP LED YELLOW-0 */
264 #define TA6678_REV1B_BC_DSP_LED_YELLOW0						TA66XX_BC_DSP_LED2
265 #define TA6678_REV1B_BC_DSP_LED_YELLOW0_BITMASK				TA66XX_BC_DSP_LED2_BITMASK
266 /** DSP LED YELLOW-1 */
267 #define TA6678_REV1B_BC_DSP_LED_YELLOW1						TA66XX_BC_DSP_LED3
268 #define TA6678_REV1B_BC_DSP_LED_YELLOW1_BITMASK				TA66XX_BC_DSP_LED3_BITMASK
269 /** DSP LED AMBER */
270 #define TA6678_REV1B_BC_DSP_LED_AMBER						TA66XX_BC_DSP_LED4
271 #define TA6678_REV1B_BC_DSP_LED_AMBER_BITMASK				TA66XX_BC_DSP_LED4_BITMASK
272 /** DSP LED RED */
273 #define TA6678_REV1B_BC_DSP_LED_RED							TA66XX_BC_DSP_LED5
274 #define TA6678_REV1B_BC_DSP_LED_RED_BITMASK					TA66XX_BC_DSP_LED5_BITMASK
275 /** DSP LED BLUE */
276 #define TA6678_REV1B_BC_DSP_LED_BLUE						TA66XX_BC_DSP_LED6
277 #define TA6678_REV1B_BC_DSP_LED_BLUE_BITMASK				TA66XX_BC_DSP_LED6_BITMASK
278 /** DSP LED WHITE */
279 #define TA6678_REV1B_BC_DSP_LED_WHITE						TA66XX_BC_DSP_LED7
280 #define TA6678_REV1B_BC_DSP_LED_WHITE_BITMASK				TA66XX_BC_DSP_LED7_BITMASK
281 
282 
283 
284 /*------------ TA66XX_BC_set_dsp_leds_enable() function ------------------*//**
285  * @brief  Function enables or disables on-board DSP LEDs
286  *
287  * @param[in]  state - DSP LEDs enable state: TA66XX_ON or TA66XX_OFF;
288  *
289  * @return  None
290  *
291 -----------------------------------------------------------------------------*/
292 void TA66XX_BC_set_dsp_leds_enable(uint32_t enable);
293 
294 
295 /*------------ TA66XX_BC_get_dsp_leds_enable_status() function -----------*//**
296  * @brief  Function returns enable status of on-board DSP LEDs
297  *
298  * @return  DSP LEDs enable state: TA66XX_ON or TA66XX_OFF
299  *
300 -----------------------------------------------------------------------------*/
301 uint32_t TA66XX_BC_get_dsp_leds_enable_status(void);
302 
303 
304 /*------------ TA66XX_BC_set_dsp_led_state() function --------------------*//**
305  * @brief  Function sets selected DSP LED to the desired state: ON or OFF
306  *
307  * @param[in]  led_number - DSP LED number definition;
308  * @param[in]  state - DSP LED state: TA66XX_ON or TA66XX_OFF;
309  *
310  * @return  None
311  *
312 -----------------------------------------------------------------------------*/
313 void TA66XX_BC_set_dsp_led_state(uint32_t led_number, uint32_t state);
314 
315 
316 /*------------ TA66XX_BC_get_dsp_led_state() function --------------------*//**
317  * @brief  Function returns selected DSP LED state: ON or OFF
318  *
319  * @param[in]  led_number - DSP LED number definition;
320  *
321  * @return  DSP LED state: TA66XX_ON or TA66XX_OFF
322  *
323 -----------------------------------------------------------------------------*/
324 uint32_t TA66XX_BC_get_dsp_led_state(uint32_t led_number);
325 
326 
327 /*------------ TA66XX_BC_set_dsp_leds() function -------------------------*//**
328  * @brief  Function sets selected DSP LEDs to the desired state: ON or OFF
329  *
330  * @param[in]  led_bitmask - DSP LEDs (ORed) bitmask;
331  * @param[in]  state - DSP LEDs state: TA66XX_ON or TA66XX_OFF;
332  *
333  * @return  None
334  *
335 -----------------------------------------------------------------------------*/
336 void TA66XX_BC_set_dsp_leds(uint32_t led_bitmask, uint32_t state);
337 
338 
339 /*------------ TA66XX_BC_get_dsp_leds() function -------------------------*//**
340  * @brief  Function returns selected DSP LEDs state: ON or OFF
341  *
342  * @param[in]  led_bitmask - DSP LEDs (ORed) bitmask;
343  *
344  * @return  DSP LEDs state
345  *
346 -----------------------------------------------------------------------------*/
347 uint32_t TA66XX_BC_get_dsp_leds(uint32_t led_bitmask);
348 
349 
350 /** @}*/
351 //=============================================================================
352 
353 
354 
355 //=============================================================================
356 //============ DSP-to-FPGA GPIO functions =====================================
357 //=============================================================================
358 
359 /** @addtogroup  TA66XX_BC_DSP_FPGA_GPIO  TORNADO AMC DSP-to-FPGA GPIO functions
360  *  @{
361  */
362 
363 /** DSP-to-FPGA GPIO pins definitions */
364 enum TA66XX_BC_DSP_FPGA_GPIO
365 {
366 	TA66XX_BC_DSP_FPGA_GPIO0 = 0,					/**< DSP-to-FPGA GPIO pin 0 */
367 	TA66XX_BC_DSP_FPGA_GPIO1,						/**< DSP-to-FPGA GPIO pin 1 */
368 	TA66XX_BC_DSP_FPGA_GPIO2,						/**< DSP-to-FPGA GPIO pin 2 */
369 	TA66XX_BC_DSP_FPGA_GPIO3,						/**< DSP-to-FPGA GPIO pin 3 */
370 	TA66XX_BC_DSP_FPGA_GPIO4,						/**< DSP-to-FPGA GPIO pin 4 */
371 	TA66XX_BC_DSP_FPGA_GPIO5,						/**< DSP-to-FPGA GPIO pin 5 */
372 	TA66XX_BC_DSP_FPGA_GPIO6,						/**< DSP-to-FPGA GPIO pin 6 */
373 	TA66XX_BC_DSP_FPGA_GPIO7						/**< DSP-to-FPGA GPIO pin 7 */
374 };
375 
376 /** DSP-to-FPGA GPIO pins bitmask definitions */
377 enum TA66XX_BC_DSP_FPGA_GPIO_BITMASKS
378 {
379 	TA66XX_BC_DSP_FPGA_GPIO0_BITMASK = 0x0001,		/**< DSP-to-FPGA GPIO pin 0 bitmask */
380 	TA66XX_BC_DSP_FPGA_GPIO1_BITMASK = 0x0002,		/**< DSP-to-FPGA GPIO pin 1 bitmask */
381 	TA66XX_BC_DSP_FPGA_GPIO2_BITMASK = 0x0004,		/**< DSP-to-FPGA GPIO pin 2 bitmask */
382 	TA66XX_BC_DSP_FPGA_GPIO3_BITMASK = 0x0008,		/**< DSP-to-FPGA GPIO pin 3 bitmask */
383 	TA66XX_BC_DSP_FPGA_GPIO4_BITMASK = 0x0010,		/**< DSP-to-FPGA GPIO pin 4 bitmask */
384 	TA66XX_BC_DSP_FPGA_GPIO5_BITMASK = 0x0020,		/**< DSP-to-FPGA GPIO pin 5 bitmask */
385 	TA66XX_BC_DSP_FPGA_GPIO6_BITMASK = 0x0040,		/**< DSP-to-FPGA GPIO pin 6 bitmask */
386 	TA66XX_BC_DSP_FPGA_GPIO7_BITMASK = 0x0080,		/**< DSP-to-FPGA GPIO pin 7 bitmask */
387 	TA66XX_BC_DSP_FPGA_GPIO_BITMASK = 0x00ff		/**< DSP-to-FPGA GPIO pins bitmask */
388 };
389 
390 
391 /** DSP-to-FPGA GPIO pins direction definitions */
392 #define TA66XX_BC_DSP_FPGA_GPIO_DIR_OUT						C66XX_GPIO_DIR_OUT
393 #define TA66XX_BC_DSP_FPGA_GPIO_DIR_IN						C66XX_GPIO_DIR_IN
394 
395 
396 /*------------ TA66XX_BC_set_dsp_to_fpga_gpio_enable() function ----------*//**
397  * @brief  Function enables or disables on-board DSP-to-FPGA GPIO pins
398  *
399  * @param[in]  state - DSP-to-FPGA GPIO pins enable state: TA66XX_ON or
400  *					TA66XX_OFF;
401  *
402  * @return  None
403  *
404 -----------------------------------------------------------------------------*/
405 void TA66XX_BC_set_dsp_to_fpga_gpio_enable(uint32_t enable);
406 
407 
408 /*------------ TA66XX_BC_get_dsp_to_fpga_gpio_enable_status() function ---*//**
409  * @brief  Function returns enable status of on-board DSP-to-FPGA GPIO pins
410  *
411  * @return  DSP-to-FPGA GPIO pins enable state: TA66XX_ON or TA66XX_OFF;
412  *
413 -----------------------------------------------------------------------------*/
414 uint32_t TA66XX_BC_get_dsp_to_fpga_gpio_enable_status(void);
415 
416 
417 /*------------ TA66XX_BC_set_dsp_to_fpga_gpio_pin_dir() function ---------*//**
418  * @brief  Function sets selected DSP-to-FPGA GPIO pin direction: IN or OUT
419  *
420  * @param[in]  pin - DSP-to-FPGA GPIO pin number;
421  * @param[in]  dir - DSP-to-FPGA GPIO pin direction: IN or OUT
422  *
423  * @return  None
424  *
425 -----------------------------------------------------------------------------*/
426 void TA66XX_BC_set_dsp_to_fpga_gpio_pin_dir(uint32_t pin, uint32_t dir);
427 
428 
429 /*------------ TA66XX_BC_get_dsp_to_fpga_gpio_pin_dir() function ---------*//**
430  * @brief  Function returns selected DSP-to-FPGA GPIO pin direction: IN or OUT
431  *
432  * @param[in]  pin - DSP-to-FPGA GPIO pin number;
433  *
434  * @return  DSP-to-FPGA GPIO pin direction: IN or OUT
435  *
436 -----------------------------------------------------------------------------*/
437 uint32_t TA66XX_BC_get_dsp_to_fpga_gpio_pin_dir(uint32_t pin);
438 
439 
440 /*------------ TA66XX_BC_set_dsp_to_fpga_gpio_pin_data() function --------*//**
441  * @brief  Function sets selected DSP-to-FPGA GPIO pin to the desired state: ON
442  * or OFF
443  *
444  * @param[in]  pin - DSP-to-FPGA GPIO pin number;
445  * @param[in]  data - DSP-to-FPGA GPIO pin state: TA66XX_ON or TA66XX_OFF;
446  *
447  * @return  None
448  *
449 -----------------------------------------------------------------------------*/
450 void TA66XX_BC_set_dsp_to_fpga_gpio_pin_data(uint32_t pin, uint32_t data);
451 
452 
453 /*------------ TA66XX_BC_get_dsp_to_fpga_gpio_pin_data() function --------*//**
454  * @brief  Function returns selected DSP-to-FPGA GPIO pin state: ON or OFF
455  *
456  * @param[in]  pin - DSP-to-FPGA GPIO pin number;
457  *
458  * @return  DSP-to-FPGA GPIO pin state: TA66XX_ON or TA66XX_OFF
459  *
460 -----------------------------------------------------------------------------*/
461 uint32_t TA66XX_BC_get_dsp_to_fpga_gpio_pin_data(uint32_t pin);
462 
463 
464 /*------------ TA66XX_BC_set_dsp_to_fpga_gpio_dir() function -------------*//**
465  * @brief  Function sets selected DSP-to-FPGA GPIO pins direction: IN or OUT
466  *
467  * @param[in]  pin_bitmask - DSP-to-FPGA GPIO pins (ORed) bitmask;
468  * @param[in]  dir - DSP-to-FPGA GPIO pin direction: IN or OUT
469  *
470  * @return  None
471  *
472 -----------------------------------------------------------------------------*/
473 void TA66XX_BC_set_dsp_to_fpga_gpio_dir(uint32_t pin_bitmask, uint32_t dir);
474 
475 
476 /*------------ TA66XX_BC_get_dsp_to_fpga_gpio_dir() function -------------*//**
477  * @brief  Function returns selected DSP-to-FPGA GPIO pins direction: IN or OUT
478  *
479  * @param[in]  pin - DSP-to-FPGA GPIO pins (ORed) bitmask;
480  *
481  * @return  DSP-to-FPGA GPIO pins direction: IN or OUT
482  *
483 -----------------------------------------------------------------------------*/
484 uint32_t TA66XX_BC_get_dsp_to_fpga_gpio_dir(uint32_t pin_bitmask);
485 
486 
487 /*------------ TA66XX_BC_set_dsp_to_fpga_gpio_data() function ------------*//**
488  * @brief  Function sets selected DSP-to-FPGA GPIO pins to the desired state: ON
489  * or OFF
490  *
491  * @param[in]  pin_bitmask - DSP-to-FPGA GPIO pins (ORed) bitmask;
492  * @param[in]  data - DSP-to-FPGA GPIO pins state: TA66XX_ON or TA66XX_OFF;
493  *
494  * @return  None
495  *
496 -----------------------------------------------------------------------------*/
497 void TA66XX_BC_set_dsp_to_fpga_gpio_data(uint32_t pin_bitmask, uint32_t data);
498 
499 
500 /*------------ TA66XX_BC_get_dsp_to_fpga_gpio_data() function ------------*//**
501  * @brief  Function returns selected DSP-to-FPGA GPIO pins state: ON or OFF
502  *
503  * @param[in]  pin - DSP-to-FPGA GPIO pins (ORed) bitmask;
504  *
505  * @return  DSP-to-FPGA GPIO pins state
506  *
507 -----------------------------------------------------------------------------*/
508 uint32_t TA66XX_BC_get_dsp_to_fpga_gpio_data(uint32_t pin_bitmask);
509 
510 
511 /** @}*/
512 //=============================================================================
513 
514 
515 
516 //=============================================================================
517 //============ DSP GPIO IRQ functions =========================================
518 //=============================================================================
519 
520 /** @addtogroup  TA66XX_BC_DSP_GPIO_IRQ  TORNADO AMC DSP GPIO IRQ mapping functions
521  *  @{
522  */
523 
524 /** DSP GPIO pins IRQ source definitions */
525 enum TA66XX_BC_DSP_GPIO_IRQ_SEL_SOURCE
526 {
527 	TA66XX_BC_DSP_GPIO_IRQ_SEL_OFF = 0,					/**< DSP IRQ is disabled */
528 	TA66XX_BC_DSP_GPIO_IRQ_SEL_MMC_TO_DSP_PD_ALERT,		/**< MMC-to-DSP power-down alert is used to generate DSP IRQ */
529 	TA66XX_BC_DSP_GPIO_IRQ_SEL_MMC_TO_DSP_COMM_RQ,		/**< MMC-to-DSP communication request is used to generate DSP IRQ */
530 	TA66XX_BC_DSP_GPIO_IRQ_SEL_1GE_PHY_IRQ				/**< 1GE PHY IRQ is used to generate DSP IRQ */
531 };
532 
533 /** DSP GPIO-6 and GPIO-7 pins definitions for TA6678 rev.1B and TA6678/FMC rev.1A boards */
534 #define TA66XX_BC_DSP_GPIO6_PIN								6
535 #define TA66XX_BC_DSP_GPIO7_PIN								7
536 /** DSP GPIO-8 and GPIO-9 pins definitions for TA6678/FMC rev.1B and later boards */
537 #define TA66XX_BC_DSP_GPIO8_PIN								8
538 #define TA66XX_BC_DSP_GPIO9_PIN								9
539 
540 
541 /*------------ TA66XX_BC_map_dsp_gpio_interrupt() function ---------------*//**
542  * @brief  Function maps IRQ source to selected DSP GPIO pin
543  *
544  * @param[in]  gpio_pin - DSP GPIO pin;
545  * @param[in]  irq_src - IRQ source;
546  *
547  * @return  Error code
548  *
549 -----------------------------------------------------------------------------*/
550 int32_t TA66XX_BC_map_dsp_gpio_interrupt(uint32_t gpio_pin, uint32_t irq_src);
551 
552 
553 /*------------ TA66XX_BC_unmap_dsp_gpio_interrupt() function -------------*//**
554  * @brief  Function unmaps IRQ source from selected DSP GPIO pin
555  *
556  * @param[in]  gpio_pin - DSP GPIO pin;
557  *
558  * @return  Error code
559  *
560 -----------------------------------------------------------------------------*/
561 int32_t TA66XX_BC_unmap_dsp_gpio_interrupt(uint32_t gpio_pin);
562 
563 
564 /** @}*/
565 //=============================================================================
566 
567 
568 
569 //=============================================================================
570 //============ UART functions =================================================
571 //=============================================================================
572 
573 /** @addtogroup  TA66XX_BC_UART  TORNADO AMC UART functions
574  *  @{
575  */
576 
577 /** DSP UART printf-like string max length */
578 #define TA66XX_BC_UART_PRINTF_LEN_MAX						1023
579 
580 
581 /*------------ TA66XX_BC_init_uart() function ---------------------------*//**
582  * @brief  Function inits the DSP UART peripheral
583  *
584  * @param[in]  baud_rate - desired baud rate;
585  * @param[in]  data_bits - number of data bits;
586  * @param[in]  parity - parity bit;
587  * @param[in]  stop_bits - number of stop bits;
588  *
589  * @return  Error code
590  *
591 -----------------------------------------------------------------------------*/
592 int32_t TA66XX_BC_init_uart(uint32_t baud_rate, uint32_t data_bits, uint32_t parity, uint32_t stop_bits);
593 
594 
595 /*------------ TA66XX_BC_uart_receiver_is_ready() function ---------------*//**
596  * @brief  Function checks if a character is received over DSP UART
597  *
598  * @return  1 - a character is received over DSP UART,
599  *		    0 - otherwise
600  *
601 -----------------------------------------------------------------------------*/
602 #define TA66XX_BC_uart_receiver_is_ready()					C66XX_UART_receiver_is_ready()
603 
604 
605 /*------------ TA66XX_BC_uart_receive_char() function --------------------*//**
606  * @brief  Function receives a character over DSP UART
607  *
608  * @return  Received character
609  *
610 -----------------------------------------------------------------------------*/
611 #define TA66XX_BC_uart_receive_char()						C66XX_UART_receive_char()
612 
613 
614 /*------------ TA66XX_BC_uart_transmit_char() function -------------------*//**
615  * @brief  Function transmits a character over DSP UART
616  *
617  * @param[in]  c - A character to transmit
618  *
619  * @return  None
620  *
621 -----------------------------------------------------------------------------*/
622 #define TA66XX_BC_uart_transmit_char(c)						C66XX_UART_transmit_char(c)
623 
624 
625 /*------------ TA66XX_BC_uart_transmit_string() function -----------------*//**
626  * @brief  Function transmits a string until '0' charachter
627  *
628  * @param[in]  s - A pointer to the string to transmit
629  *
630  * @return  None
631  *
632 -----------------------------------------------------------------------------*/
633 #define TA66XX_BC_uart_transmit_string(s)					C66XX_UART_transmit_string(s)
634 
635 
636 /*------------ TA66XX_BC_uart_receive_line_string() function -------------*//**
637  * @brief  Function receives a line ended with CR character, and stores
638  * received characters into string with '\0' symbol.
639  *
640  * @param[in]  s - Pointer to a string to store received characters
641  *
642  * @return  Number of received characters without '\0' symbol.
643  *
644 -----------------------------------------------------------------------------*/
645 #define TA66XX_BC_uart_receive_line_string(s)				C66XX_UART_receive_line_string(s)
646 
647 
648 /*------------ TA66XX_BC_uart_printf() function --------------------------*//**
649  * @brief  Function prints messages to UART
650  *
651  * @param[in]  format - format string;
652  *
653  * @return  None
654  *
655 -----------------------------------------------------------------------------*/
656 void TA66XX_BC_uart_printf(const char *format, ...);
657 
658 
659 /** @}*/
660 //=============================================================================
661 
662 
663 
664 //=============================================================================
665 //============ EEPROM functions ===============================================
666 //=============================================================================
667 
668 /** @addtogroup  TA66XX_BC_EEPROM  TORNADO AMC EEPROM memory functions
669  *  @{
670  */
671 
672 /*------------ TA66XX_BC_get_eeprom_length() function --------------------*//**
673  * @brief  Function returns on-board EEPROM memory length in bytes
674  *
675  * @return  On-board EEPROM memory length in bytes
676  *
677 -----------------------------------------------------------------------------*/
678 uint32_t TA66XX_BC_get_eeprom_length(void);
679 
680 
681 /*------------ TA66XX_BC_write_eeprom() function -------------------------*//**
682  * @brief  Function writes data[len] to EEPROM memory starting at memory
683  * address addr
684  *
685  * @param[in]  addr - memory address within the chip;
686  * @param[in]  data - pointer to data;
687  * @param[in]  len - data len in bytes;
688  *
689  * @return  Error code
690  *
691 -----------------------------------------------------------------------------*/
692 int32_t TA66XX_BC_write_eeprom(uint32_t addr, uint8_t *data, uint32_t len);
693 
694 
695 /*------------ TA66XX_BC_read_eeprom() function --------------------------*//**
696  * @brief  Function reads data[len] from EEPROM memory starting at memory
697  * address addr
698  *
699  * @param[in]  addr - memory address within the chip;
700  * @param[out]  buf - pointer to data buffer to store data;
701  * @param[in]  len - data len in bytes;
702  *
703  * @return  Error code
704  *
705 -----------------------------------------------------------------------------*/
706 int32_t TA66XX_BC_read_eeprom(uint32_t addr, uint8_t *buf, uint32_t len);
707 
708 
709 /*------------ TA66XX_BC_erase_eeprom() function -------------------------*//**
710  * @brief  Function erases len bytes from EEPROM memory starting at memory
711  * address addr
712  *
713  * @param[in]  addr - memory address within the chip;
714  * @param[in]  len - number of bytes to erase;
715  *
716  * @return  Error code
717  *
718 -----------------------------------------------------------------------------*/
719 int32_t TA66XX_BC_erase_eeprom(uint32_t addr, uint32_t len);
720 
721 
722 /** @}*/
723 //=============================================================================
724 
725 
726 
727 //=============================================================================
728 //============ Board info functions ===========================================
729 //=============================================================================
730 
731 /** @addtogroup  TA66XX_BC_BOARD_INFO  TORNADO AMC board info functions
732  *  @{
733  */
734 
735 
736 /** Board info data descriptor IDs */
737 #define TA66XX_BC_BOARD_INFO_ID_TA6678_REV1B				1
738 #define TA66XX_BC_BOARD_INFO_ID_TA6678FMC_REV1A				2
739 #define TA66XX_BC_BOARD_INFO_ID_TA6678FMC_REV1B				3
740 
741 
742 /** Board temperature data descriptor */
743 typedef struct
744 {
745 	float						temp_pcb,								/**< PCB current temperature */
746 								temp_dsp,								/**< DSP current temperature */
747 								temp_fpga;								/**< FPGA current temperature */
748 
749 	// TEMP zone classification status
750 	// This var is set according to TA6678_MC_TEMP_ZONE_ID_xxxx defs.
751 	uint32_t					temp_zone_id;							/**< Temperature zone ID */
752 
753 	// 8-bit integer thresholds for MMC TEMP zones
754 	// These thresholds are used to classify summary temparature, which MMC derives
755 	// from PCB, DSP and FPGA temperatures.
756 	char						overheated_low_zone_threshold,			/**< OVERHEATED low threshold (P/S will be switched OFF at this threshold and upper) */
757 								hot_low_zone_threshold,					/**< HOT low threshold (P/S will be not switched ON at this threshold and upper) */
758 								warm3_low_zone_threshold,				/**< WARM3 low threshold */
759 								warm2_low_zone_threshold,				/**< WARM2 low threshold */
760 								warm1_low_zone_threshold,				/**< WARM1 low threshold */
761 								normal_low_zone_threshold,				/**< NORMAL low threshold */
762 								cold1_low_zone_threshold,				/**< COLD1 low threshold */
763 								cold2_low_zone_threshold,				/**< COLD2 low threshold */
764 								cold3_low_zone_threshold,				/**< COLD3 low threshold (P/S will be not switched ON below this threshold) */
765 								frosty_low_zone_threshold;				/**< FROSTY low threshold (P/S will be switched OFF below this threshold) */
766 
767 	// 8-bit integer thresholds for AMC TEMP zones for every on-board temp sensor
768 	char						amc_pcb_temp_noncritical_threshold,		/**< PCB temperature AMC UPPER NON-CRITICAL ASSERTING EVENT threshold */
769 								amc_pcb_temp_critical_threshold,		/**< PCB temperature AMC UPPER CRITICAL ASSERTING EVENT threshold */
770 								amc_pcb_temp_nonrecoverable_threshold,	/**< PCB temperature AMC UPPER NON-RECOVERABLE ASSERTING EVENT threshold */
771 								amc_pcb_temp_hysteresis,				/**< PCB temperature AMC positive going hysteresis */
772 
773 								amc_dsp_temp_noncritical_threshold,		/**< DSP temperature AMC UPPER NON-CRITICAL ASSERTING EVENT threshold */
774 								amc_dsp_temp_critical_threshold,		/**< DSP temperature AMC UPPER CRITICAL ASSERTING EVENT threshold */
775 								amc_dsp_temp_nonrecoverable_threshold,	/**< DSP temperature AMC UPPER NON-RECOVERABLE ASSERTING EVENT threshold */
776 								amc_dsp_temp_hysteresis,				/**< DSP temperature AMC positive going hysteresis */
777 
778 								amc_fpga_temp_noncritical_threshold,	/**< FPGA temperature AMC UPPER NON-CRITICAL ASSERTING EVENT threshold */
779 								amc_fpga_temp_critical_threshold,		/**< FPGA temperature AMC UPPER CRITICAL ASSERTING EVENT threshold */
780 								amc_fpga_temp_nonrecoverable_threshold,	/**< FPGA temperature AMC UPPER NON-RECOVERABLE ASSERTING EVENT threshold */
781 								amc_fpga_temp_hysteresis;				/**< FPGA temperature AMC positive going hysteresis */
782 
783 } TA66XX_BC_TEMP_DATA_DD;
784 // Board temperature data descriptor length
785 #define TA66XX_BC_TEMP_DATA_DD_LEN							sizeof(TA66XX_BC_TEMP_DATA_DD)
786 
787 
788 /** Board current power data descriptor for TA6678 rev.1B-1 board */
789 typedef struct
790 {
791 	float						v_12v,									/**< Input +12V power supply voltage value */
792 								i_12v,									/**< Input +12V power supply current value */
793 								v_3v3_aux,								/**< On-board auxiliary +3.3V power supply voltage value */
794 								i_3v3_aux,								/**< On-board auxiliary +3.3V power supply current value */
795 								v_mc,									/**< Module management power supply voltage value */
796 								i_mc,									/**< Module management power supply current value */
797 								v_3v3,									/**< On-board +3.3V power supply voltage value */
798 								i_3v3,									/**< On-board +3.3V power supply current value */
799 								v_2v5,									/**< On-board +2.5V power supply voltage value */
800 								i_2v5,									/**< On-board +2.5V power supply current value */
801 								v_1v8,									/**< On-board +1.8V power supply voltage value */
802 								i_1v8,									/**< On-board +1.8V power supply current value */
803 								v_1v5,									/**< On-board +1.5V power supply voltage value */
804 								i_1v5,									/**< On-board +1.5V power supply current value */
805 								v_1v0,									/**< On-board +1.0V power supply voltage value */
806 								i_1v0,									/**< On-board +1.0V power supply current value */
807 								v_ddr_vtt,								/**< On-board DDR3 VTT power supply voltage value */
808 								v_dsp_vcore,							/**< On-board DSP core power supply voltage value */
809 								i_dsp_vcore,							/**< On-board DSP core power supply current value */
810 								v_fpga_vcore,							/**< On-board FPGA core power supply voltage value */
811 								i_fpga_vcore,							/**< On-board FPGA core power supply current value */
812 								v_fpga_mgtavcc,							/**< On-board FPGA MGTAVCC power supply voltage value */
813 								v_fpga_mgtavtt;							/**< On-board FPGA MGTAVTT power supply voltage value */
814 
815 } TA6678_REV1B_BC_POWER_DATA_DD;
816 // Board current power data descriptor for TA6678 rev.1B-1 board length
817 #define TA6678_REV1B_BC_POWER_DATA_DD_LEN					sizeof(TA6678_REV1B_BC_POWER_DATA_DD)
818 
819 
820 /** Board current power data descriptor for TA6678/FMC rev.1A and later boards */
821 typedef struct
822 {
823 	float						power_12v,								/**< Input +12V power supply value */
824 								power_fpga_core,						/**< On-board FPGA core power supply value */
825 								power_dsp_core,							/**< On-board DSP core power supply value */
826 								v_12v,									/**< Input +12V power supply voltage value */
827 								i_12v,									/**< Input +12V power supply current value */
828 								i_fpga_core,							/**< On-board FPGA core power supply current value */
829 								i_dsp_core;								/**< On-board DSP core power supply current value */
830 
831 } TA66XX_BC_PRIMARY_POWER_DATA_DD;
832 // Board current power data descriptor length
833 #define TA66XX_BC_PRIMARY_POWER_DATA_DD_LEN					sizeof(TA66XX_BC_PRIMARY_POWER_DATA_DD)
834 
835 
836 /** Board current power data union */
837 typedef union
838 {
839 	TA6678_REV1B_BC_POWER_DATA_DD			ta6678_rev1b_dd;
840 	TA66XX_BC_PRIMARY_POWER_DATA_DD			primary_power_dd;
841 } POWER_DATA_DD;
842 
843 
844 /** Board current power data descriptor */
845 typedef struct
846 {
847 	unsigned					id;										// ID to decode the UNION structure type
848 	POWER_DATA_DD				power_data_dd;
849 
850 } TA66XX_BC_POWER_DATA_DD;
851 // Board current power data descriptor length
852 #define TA66XX_BC_POWER_DATA_DD_LEN							sizeof(TA66XX_BC_POWER_DATA_DD)
853 
854 
855 /** FMC interface power data descriptor for TA6678/FMC rev.1A and later boards */
856 typedef struct
857 {
858 	float						power_fmc_12v,							/**< FMC I/F +12V power supply value */
859 								power_fmc_3v3,							/**< FMC I/F +3.3V power supply value */
860 								power_fmc_vadj,							/**< FMC I/F Vadj power supply value */
861 								v_fmc_12v,								/**< FMC I/F +12V power supply voltage value */
862 								i_fmc_12v,								/**< FMC I/F +12V power supply current value */
863 								v_fmc_3v3,								/**< FMC I/F +3.3V power supply voltage value */
864 								i_fmc_3v3,								/**< FMC I/F +3.3V power supply current value */
865 								v_fmc_vadj,								/**< FMC I/F Vadj power supply voltage value */
866 								i_fmc_vadj,								/**< FMC I/F Vadj power supply current value */
867 								v_fmc_vio_b_m2c,						/**< FMC I/F VIO_B_M2C power supply voltage value */
868 								v_fmc_vref_a_m2c,						/**< FMC I/F VREF_A_M2C power supply voltage value */
869 								v_fmc_vref_b_m2c;						/**< FMC I/F VREF_B_M2C power supply voltage value */
870 
871 } TA66XX_BC_FMC_POWER_DATA_DD;
872 // FMC interface power data descriptor length
873 #define TA66XX_BC_FMC_POWER_DATA_DD_LEN						sizeof(TA66XX_BC_FMC_POWER_DATA_DD)
874 
875 
876 /** Max string length in device info structure */
877 #define TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX				32
878 #define TA66XX_BC_DEVICE_PN_STRING_LEN_MAX					64
879 #define TA66XX_BC_DEVICE_HW_REVISION_STRING_LEN_MAX			16
880 
881 
882 /** Board info data descriptor for TA6678 rev.1B-1 board */
883 typedef struct
884 {
885 	uint32_t					op_mode;													/**< Operation mode: '0' - stand-alone mode, '1' - AMC host mode */
886 	uint32_t					amc_slot_id;												/**< AMC slot ID (in case AMC host mode is used) */
887 	uint8_t						manufacturing_date_day_of_month;							/**< Manufacturing day: 1..31 */
888 	uint8_t						manufacturing_date_month;									/**< Manufacturing month: 1..12 ('1' - January) */
889 	uint16_t					manufacturing_date_year;									/**< Manufacturing year: 2015.. */
890 	char						device_sn[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];			/**< Device serial number */
891 	char						mmc_fw_rev[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];			/**< MMC firmware revision string */
892 	char						tammc_fw_rev[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];			/**< TAMMC firmware revision string */
893 	char						mmc_core_fw_rev[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];		/**< MMC core firmware revision string */
894 } TA6678_REV1B_BC_DEVICE_INFO_DATA_DD;
895 // Board info data descriptor for TA6678 rev.1B-1 board length
896 #define TA6678_REV1B_BC_DEVICE_INFO_DATA_DD_LEN				sizeof(TA6678_REV1B_BC_DEVICE_INFO_DATA_DD)
897 
898 
899 /** Board info data descriptor for TA6678/FMC rev.1A and later boards */
900 typedef struct
901 {
902 	uint32_t					op_mode;															/**< Operation mode: '0' - stand-alone mode, '1' - AMC host mode */
903 	uint32_t					amc_slot_id;														/**< AMC slot ID (in case AMC host mode is used) */
904 	uint8_t						manufacturing_date_day_of_month;									/**< Manufacturing day: 1..31 */
905 	uint8_t						manufacturing_date_month;											/**< Manufacturing month: 1..12 ('1' - January) */
906 	uint16_t					manufacturing_date_year;											/**< Manufacturing year: 2015.. */
907 	char						manufacturer_name[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];			/**< Manufacturer name */
908 	char						device_name[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];					/**< Device name */
909 	char						device_pn[TA66XX_BC_DEVICE_PN_STRING_LEN_MAX];						/**< Device part number */
910 	char						device_sn[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];					/**< Device serial number */
911 	char						device_hw_revision[TA66XX_BC_DEVICE_HW_REVISION_STRING_LEN_MAX];	/**< Device H/W revision */
912 	char						mmc_fw_rev[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];					/**< MMC firmware revision string */
913 	char						tammc_fw_rev[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];					/**< TAMMC firmware revision string */
914 	char						mmc_core_fw_rev[TA66XX_BC_DEVICE_INFO_STRING_LEN_MAX];				/**< MMC core firmware revision string */
915 } TA66XX_BC_FULL_DEVICE_INFO_DATA_DD;
916 // Board info data descriptor length
917 #define TA66XX_BC_FULL_DEVICE_INFO_DATA_DD_LEN				sizeof(TA66XX_BC_FULL_DEVICE_INFO_DATA_DD)
918 
919 
920 /** Board current power data union */
921 typedef union
922 {
923 	TA6678_REV1B_BC_DEVICE_INFO_DATA_DD			ta6678_rev1b_dd;
924 	TA66XX_BC_FULL_DEVICE_INFO_DATA_DD			ta66xx_full_device_info_dd;
925 } DEVICE_INFO_DATA_DD;
926 
927 
928 /** Board current power data descriptor */
929 typedef struct
930 {
931 	uint32_t					id;										// ID to decode the UNION structure type
932 	DEVICE_INFO_DATA_DD			device_info_data_dd;
933 
934 } TA66XX_BC_DEVICE_INFO_DATA_DD;
935 // Board current power data descriptor length
936 #define TA66XX_BC_DEVICE_INFO_DATA_DD_LEN					sizeof(TA66XX_BC_DEVICE_INFO_DATA_DD)
937 
938 
939 /** Hardware configuration info data descriptor for TA6678/FMC rev.1A and later boards */
940 typedef struct
941 {
942 	uint32_t					fpga_ddr0_len;														/**< FPGA DDR memory bank #0 length in MB: 0 - not installed */
943 	uint32_t					fpga_ddr1_len;														/**< FPGA DDR memory bank #1 length in MB: 0 - not installed */
944 	uint32_t					cpu_ddr_len;														/**< CPU DDR memory length in MB: 0 - not installed */
945 	uint32_t					flash_len;															/**< FLASH memory length in MB: 0 - not installed */
946 	uint32_t					mram_len;															/**< MRAM memory length in KB: 0 - not installed */
947 	uint32_t					i2c_eeprom_len;														/**< I2C EEPROM memory length in KB: 0 - not installed */
948 	uint32_t					cpu_clk_freq_id;													/**< CPU input clock frequency in MHz: 0 - not available */
949 	uint32_t					x1ge0_phy_installed_id;												/**< External 1GE PHY #0 installed ID: 0 - not installed */
950 	uint32_t					x1ge1_phy_installed_id;												/**< External 1GE PHY #1 installed ID: 0 - not installed */
951 	uint32_t					sfp0_if_installed_id;												/**< SFP interface #0 installed ID: 0 - not installed */
952 	uint32_t					sfp1_if_installed_id;												/**< SFP interface #1 installed ID: 0 - not installed */
953 	uint32_t					qsfp_if_installed_id;												/**< QSFP interface installed ID: 0 - not installed */
954 	uint32_t					fmc_if_installed_id;												/**< FMC interface installed ID: 0 - not installed */
955 	uint32_t					sd_slot_installed_id;												/**< uSD slot installed ID: 0 - not installed */
956 } TA66XX_BC_HW_CFG_INFO_DATA_DD;
957 // Hardware configuration info data descriptor length
958 #define TA66XX_BC_HW_CFG_INFO_DATA_DD_LEN					sizeof(TA66XX_BC_HW_CFG_INFO_DATA_DD)
959 
960 
961 /** Max string length in FMC info structure */
962 #define TA66XX_BC_FMC_STATUS_STRING_LEN_MAX					48
963 #define TA66XX_BC_FMC_INFO_STRING_LEN_MAX					64
964 #define TA66XX_BC_MANUFACTURING_TIME_STRING_LEN_MAX			32
965 
966 
967 /** FMC info data descriptor for TA6678/FMC rev.1A and later boards */
968 typedef struct
969 {
970 	char						fmc_status_text[TA66XX_BC_FMC_STATUS_STRING_LEN_MAX];				/**< FMC status */
971 	char						manufacturer_name[TA66XX_BC_FMC_INFO_STRING_LEN_MAX];				/**< Manufacturer name */
972 	char						device_name[TA66XX_BC_FMC_INFO_STRING_LEN_MAX];						/**< Device name */
973 	char						device_pn[TA66XX_BC_FMC_INFO_STRING_LEN_MAX];						/**< Device part number */
974 	char						device_sn[TA66XX_BC_FMC_INFO_STRING_LEN_MAX];						/**< Device serial number */
975 	char						device_version[TA66XX_BC_FMC_INFO_STRING_LEN_MAX];					/**< Device version */
976 	char						manufacturing_time[TA66XX_BC_MANUFACTURING_TIME_STRING_LEN_MAX];	/**< Manufacturing time */
977 } TA66XX_BC_FMC_INFO_DATA_DD;
978 // FMC info data descriptor length
979 #define TA66XX_BC_FMC_INFO_DATA_DD_LEN						sizeof(TA66XX_BC_FMC_INFO_DATA_DD)
980 
981 
982 
983 /*------------ TA66XX_BC_get_device_info() function ----------------------*//**
984  * @brief  Function returns AMC module device info: operation mode, serial
985  * number, manufacturing date, firmware revisions
986  *
987  * @param[out]  info_dd - pointer to a buffer that receives device info data
988  *				descriptor in case function is completed without errors.
989  *
990  * @return  Error code
991  *
992 -----------------------------------------------------------------------------*/
993 int32_t TA66XX_BC_get_device_info(TA66XX_BC_DEVICE_INFO_DATA_DD *info_dd);
994 
995 
996 /*------------ TA66XX_BC_get_hw_cfg_info() function ----------------------*//**
997  * @brief  Function returns AMC module hardware configuration info: installed
998  * memories, interfaces, etc.
999  *
1000  * @param[out]  info_dd - pointer to a buffer that receives hardware
1001  *				configuration data descriptor in case function is completed
1002  *				without errors.
1003  *
1004  * @return  Error code
1005  *
1006 -----------------------------------------------------------------------------*/
1007 int32_t TA66XX_BC_get_hw_cfg_info(TA66XX_BC_HW_CFG_INFO_DATA_DD *info_dd);
1008 
1009 
1010 /*------------ TA66XX_BC_get_fmc_info() function -------------------------*//**
1011  * @brief  Function returns FMC module device info: installed status, device
1012  * name, serial number, manufacturing date, firmware revisions, etc.
1013  *
1014  * @param[out]  info_dd - pointer to a buffer that receives FMC info data
1015  *				descriptor in case function is completed without errors.
1016  *
1017  * @return  Error code
1018  *
1019 -----------------------------------------------------------------------------*/
1020 int32_t TA66XX_BC_get_fmc_info(TA66XX_BC_FMC_INFO_DATA_DD *info_dd);
1021 
1022 
1023 /*------------ TA66XX_BC_get_temp_state() function -----------------------*//**
1024  * @brief  Function returns AMC module temperature monitor current info
1025  *
1026  * @param[out]  temp_data_dd - pointer to a buffer that receives board
1027  *				temperature data descriptor in case function is completed
1028  *				without errors.
1029  *
1030  * @return  Error code
1031  *
1032 -----------------------------------------------------------------------------*/
1033 int32_t TA66XX_BC_get_temp_state(TA66XX_BC_TEMP_DATA_DD *temp_data_dd);
1034 
1035 
1036 /*------------ TA66XX_BC_get_power_state() function ----------------------*//**
1037  * @brief  Function returns AMC module power monitor current info
1038  *
1039  * @param[out]  power_data_dd - pointer to a buffer that receives board power
1040  *				data descriptor in case function is completed without errors.
1041  *
1042  * @return  Error code
1043  *
1044 -----------------------------------------------------------------------------*/
1045 int32_t TA66XX_BC_get_power_state(TA66XX_BC_POWER_DATA_DD *power_data_dd);
1046 
1047 
1048 /*------------ TA66XX_BC_get_fmc_power_state() function ------------------*//**
1049  * @brief  Function returns FMC module power monitor current info
1050  *
1051  * @param[out]  fmc_power_data_dd - pointer to a buffer that receives FMC
1052  *				module power data descriptor in case function is completed
1053  *				without errors.
1054  *
1055  * @return  Error code
1056  *
1057 -----------------------------------------------------------------------------*/
1058 int32_t TA66XX_BC_get_fmc_power_state(TA66XX_BC_FMC_POWER_DATA_DD *fmc_power_data_dd);
1059 
1060 
1061 /*------------ TA66XX_BC_set_mmc_to_dsp_rq() function --------------------*//**
1062  * @brief  Function sets MMC-to-DSP request from DSP (for test purposes)
1063  *
1064  * @return  Error code
1065  *
1066 -----------------------------------------------------------------------------*/
1067 int32_t TA66XX_BC_set_mmc_to_dsp_rq(void);
1068 
1069 
1070 /*------------ TA66XX_BC_set_mmc_power_down_notification() function ------*//**
1071  * @brief  Function sets MMC-to-DSP power down notification from DSP
1072  * (for test purposes)
1073  *
1074  * @return  Error code
1075  *
1076 -----------------------------------------------------------------------------*/
1077 int32_t TA66XX_BC_set_mmc_power_down_notification(void);
1078 
1079 
1080 /*------------ TA66XX_BC_get_sfp_info() function -------------------------*//**
1081  * @brief  Function returns identification info about installed SFP
1082  * transceiver: 256-byte array read from address 0x50 (identification info
1083  * according to SFF-8472) and 256-byte array read from address 0x51 (digital
1084  * diagnostic monitoring interface (DDMI) data)
1085  *
1086  * @param[out]  id_data - pointer to a buffer that receives 256-byte array read
1087  *				from address 0x50 (identification info according to SFF-8472).
1088  *				In case pointer is NULL, then no data are filled in;
1089  * @param[out]  ddmi_data - pointer to a buffer that receives 256-byte array
1090  *				read from address 0x51 (DDMI data). In case pointer is NULL,
1091  *				then no data are filled in;
1092  *
1093  * @return  Error code
1094  *
1095 -----------------------------------------------------------------------------*/
1096 int32_t TA66XX_BC_get_sfp_info(uint8_t *id_data, uint8_t *ddmi_data);
1097 
1098 
1099 /** @}*/
1100 
1101 //=============================================================================
1102 
1103 
1104 
1105 //=============================================================================
1106 //============ FPGA functions =================================================
1107 //=============================================================================
1108 
1109 /** @addtogroup  TA66XX_BC_FPGA  TORNADO AMC FPGA functions
1110  *  @{
1111  */
1112 
1113 /** FPGA host interface (HIF) configuration data descriptor */
1114 typedef struct
1115 {
1116 	uint32_t					w_setup;			/**< Write strobe setup EMIF-16 cycles */
1117 	uint32_t					w_strobe;			/**< Write strobe duration EMIF-16 cycles */
1118 	uint32_t					w_hold;				/**< Write strobe hold EMIF-16 cycles */
1119 	uint32_t					r_setup;			/**< Read strobe setup EMIF-16 cycles */
1120 	uint32_t					r_strobe;			/**< Read strobe duration EMIF-16 cycles */
1121 	uint32_t					r_hold;				/**< Read strobe hold EMIF-16 cycles */
1122 	uint32_t					turn_around;		/**< Turn around EMIF-16 cycles */
1123 } TA66XX_BC_FPGA_HIF_CNF_DD;
1124 // FPGA HIF configuration data descriptor length in bytes
1125 #define TA66XX_BC_FPGA_HIF_CNF_DD_LEN						sizeof(TA66XX_BC_FPGA_HIF_CNF_DD)
1126 
1127 
1128 /*------------ TA66XX_BC_set_fpga_hif_cnf() function ---------------------*//**
1129  * @brief  Function sets new configuration to FPGA host interface according to
1130  * supplied parameters
1131  *
1132  * @param[in]  cfg_dd - pointer to new FPGA HIF configuration data descriptor;
1133  *
1134  * @return  Error code
1135  *
1136 -----------------------------------------------------------------------------*/
1137 int32_t TA66XX_BC_set_fpga_hif_cnf(TA66XX_BC_FPGA_HIF_CNF_DD *cfg_dd);
1138 
1139 
1140 /*------------ TA66XX_BC_get_fpga_hif_cnf() function ---------------------*//**
1141  * @brief  Function returns current configuration of FPGA host interface
1142  *
1143  * @param[in]  cfg_dd - pointer to buffer to receive current FPGA HIF
1144  *				configuration data descriptor;
1145  *
1146  * @return  Error code
1147  *
1148 -----------------------------------------------------------------------------*/
1149 int32_t TA66XX_BC_get_fpga_hif_cnf(TA66XX_BC_FPGA_HIF_CNF_DD *cfg_dd);
1150 
1151 
1152 /*------------ TA66XX_BC_get_fpga_hif_base_addr() function ---------------*//**
1153  * @brief  Function returns FPGA host interface base address
1154  *
1155  * @return  FPGA host interface base address
1156  *
1157 -----------------------------------------------------------------------------*/
1158 uint32_t TA66XX_BC_get_fpga_hif_base_addr(void);
1159 
1160 
1161 /*------------ TA66XX_BC_get_fpga_hif_length() function ------------------*//**
1162  * @brief  Function returns FPGA host interface length in bytes
1163  *
1164  * @return  FPGA host interface length in bytes
1165  *
1166 -----------------------------------------------------------------------------*/
1167 uint32_t TA66XX_BC_get_fpga_hif_length(void);
1168 
1169 
1170 /*------------ TA66XX_BC_set_fpga_hif_reset() function -------------------*//**
1171  * @brief  Function sets or releases FPGA host interface reset
1172  *
1173  * @param[in]  state - FPGA host interface reset state: ON or OFF
1174  *
1175  * @return  None
1176  *
1177 -----------------------------------------------------------------------------*/
1178 void TA66XX_BC_set_fpga_hif_reset(uint32_t state);
1179 
1180 
1181 /*------------ TA66XX_BC_get_fpga_hif_reset_state() function -------------*//**
1182  * @brief  Function returns FPGA host interface reset state
1183  *
1184  * @return  FPGA host interface reset state: ON or OFF
1185  *
1186 -----------------------------------------------------------------------------*/
1187 uint32_t TA66XX_BC_get_fpga_hif_reset_state(void);
1188 
1189 
1190 /*------------ TA66XX_BC_read_fpga_hif_byte() function -------------------*//**
1191  * @brief  Function reads a byte from FPGA host interface at address addr.
1192  *
1193  * @param[in]  addr - FPGA address to read from
1194  *
1195  * @return  A byte read from FPGA host interface
1196  *
1197 -----------------------------------------------------------------------------*/
1198 uint8_t TA66XX_BC_read_fpga_hif_byte(uint32_t addr);
1199 
1200 
1201 /*------------ TA66XX_BC_write_fpga_hif_byte() function ------------------*//**
1202  * @brief  Function writes a byte to FPGA host interface at address addr.
1203  *
1204  * @param[in]  addr - FPGA address to write to
1205  * @param[in]  v - A byte to write
1206  *
1207  * @return  None
1208  *
1209 -----------------------------------------------------------------------------*/
1210 void TA66XX_BC_write_fpga_hif_byte(uint32_t addr, uint8_t v);
1211 
1212 
1213 /*------------ TA66XX_BC_read_fpga_hif_w16() function --------------------*//**
1214  * @brief  Function reads a 16-bit word from FPGA host interface at address
1215  * addr.
1216  *
1217  * @param[in]  addr - FPGA address to read from
1218  *
1219  * @return  A 16-bit word read from FPGA host interface
1220  *
1221 -----------------------------------------------------------------------------*/
1222 uint16_t TA66XX_BC_read_fpga_hif_w16(uint32_t addr);
1223 
1224 
1225 /*------------ TA66XX_BC_write_fpga_hif_w16() function -------------------*//**
1226  * @brief  Function writes a 16-bit word to FPGA host interface at address
1227  * addr.
1228  *
1229  * @param[in]  addr - FPGA address to write to
1230  * @param[in]  v - A 16-bit word to write
1231  *
1232  * @return  None
1233  *
1234 -----------------------------------------------------------------------------*/
1235 void TA66XX_BC_write_fpga_hif_w16(uint32_t addr, uint16_t v);
1236 
1237 
1238 /*------------ TA66XX_BC_read_fpga_hif_w32() function --------------------*//**
1239  * @brief  Function reads a 32-bit word from FPGA host interface at address
1240  * addr.
1241  *
1242  * @param[in]  addr - FPGA address to read from
1243  *
1244  * @return  A 32-bit word read from FPGA host interface
1245  *
1246 -----------------------------------------------------------------------------*/
1247 uint32_t TA66XX_BC_read_fpga_hif_w32(uint32_t addr);
1248 
1249 
1250 /*------------ TA66XX_BC_write_fpga_hif_w32() function -------------------*//**
1251  * @brief  Function writes a 32-bit word to FPGA host interface at address
1252  * addr.
1253  *
1254  * @param[in]  addr - FPGA address to write to
1255  * @param[in]  v - A 32-bit word to write
1256  *
1257  * @return  None
1258  *
1259 -----------------------------------------------------------------------------*/
1260 void TA66XX_BC_write_fpga_hif_w32(uint32_t addr, uint32_t v);
1261 
1262 
1263 /*------------ TA66XX_BC_read_fpga_hif_w64() function --------------------*//**
1264  * @brief  Function reads a 64-bit word from FPGA host interface at address
1265  * addr.
1266  *
1267  * @param[in]  addr - FPGA address to read from
1268  *
1269  * @return  A 64-bit word read from FPGA host interface
1270  *
1271 -----------------------------------------------------------------------------*/
1272 uint64_t TA66XX_BC_read_fpga_hif_w64(uint32_t addr);
1273 
1274 
1275 /*------------ TA66XX_BC_write_fpga_hif_w64() function -------------------*//**
1276  * @brief  Function writes a 64-bit word to FPGA host interface at address
1277  * addr.
1278  *
1279  * @param[in]  addr - FPGA address to write to
1280  * @param[in]  v - A 64-bit word to write
1281  *
1282  * @return  None
1283  *
1284 -----------------------------------------------------------------------------*/
1285 void TA66XX_BC_write_fpga_hif_w64(uint32_t addr, uint64_t v);
1286 
1287 
1288 /*------------ TA66XX_BC_clear_fpga_cnf() function -----------------------*//**
1289  * @brief  Function clears FPGA configuration memory
1290  *
1291  * @return  Error code
1292  *
1293 -----------------------------------------------------------------------------*/
1294 int32_t TA66XX_BC_clear_fpga_cnf(void);
1295 
1296 
1297 /*------------ TA66XX_BC_load_fpga_cnf() function ------------------------*//**
1298  * @brief  Function loads FPGA firmware file using the supported configuration
1299  * interfaces (serial or parallel)
1300  *
1301  * @param[in]  addr - address where FPGA firmware file data were saved;
1302  *
1303  * @return  Error code
1304  *
1305 -----------------------------------------------------------------------------*/
1306 int32_t TA66XX_BC_load_fpga_cnf(uint32_t addr);
1307 
1308 
1309 /*------------ TA66XX_BC_get_fpga_cnf_status() function ------------------*//**
1310  * @brief  Function returns FPGA configuration memory status: either
1311  * loaded by FPGA firmware file or not
1312  *
1313  * @return  TA66XX_OK - FPGA configuration memory is loaded,
1314  *			TA66XX_FPGA_CNF_LOAD_ERR - FPGA configuration memory is cleared.
1315  *
1316 -----------------------------------------------------------------------------*/
1317 int32_t TA66XX_BC_get_fpga_cnf_status(void);
1318 
1319 
1320 /** @}*/
1321 //=============================================================================
1322 
1323 
1324 
1325 //=============================================================================
1326 //============ FLASH functions ================================================
1327 //=============================================================================
1328 
1329 /** @addtogroup  TA66XX_BC_FLASH  TORNADO AMC FLASH API functions
1330  *  @{
1331  */
1332 
1333 
1334 /** FLASH memory sector is protected for write/erase operations */
1335 #define TA66XX_BC_FLASH_SECTOR_PROTECTED					1
1336 /** FLASH memory sector is unprotected for write/erase operations */
1337 #define TA66XX_BC_FLASH_SECTOR_UNPROTECTED					0
1338 
1339 
1340 /*------------ TA66XX_BC_get_flash_area_base_addr() function -------------*//**
1341  * @brief  Function returns FLASH area base address
1342  *
1343  * @return  FLASH area base address
1344  *
1345 -----------------------------------------------------------------------------*/
1346 uint32_t TA66XX_BC_get_flash_area_base_addr(void);
1347 
1348 
1349 /*------------ TA66XX_BC_get_flash_length() function ---------------------*//**
1350  * @brief  Function returns on-board FLASH memory length in bytes
1351  *
1352  * @return  On-board FLASH memory length in bytes
1353  *
1354 -----------------------------------------------------------------------------*/
1355 uint32_t TA66XX_BC_get_flash_length(void);
1356 
1357 
1358 /*------------ TA66XX_BC_get_flash_hw_wp_enable_status() function --------*//**
1359  * @brief  Function returns enable status of on-board FLASH memory hardware
1360  * (via on-board switch) write-protection
1361  *
1362  * @return  On-board FLASH memory hardware write-protection enable state:
1363  * TA66XX_ON or TA66XX_OFF
1364  *
1365 -----------------------------------------------------------------------------*/
1366 uint32_t TA66XX_BC_get_flash_hw_wp_enable_status(void);
1367 
1368 
1369 /*------------ TA66XX_BC_get_flash_sw_wp_enable_status() function --------*//**
1370  * @brief  Function returns enable status of on-board FLASH memory software
1371  * write-protection
1372  *
1373  * @return  On-board FLASH memory software write-protection enable state:
1374  * TA66XX_ON or TA66XX_OFF
1375  *
1376 -----------------------------------------------------------------------------*/
1377 uint32_t TA66XX_BC_get_flash_sw_wp_enable_status(void);
1378 
1379 
1380 /*------------ TA66XX_BC_set_flash_sw_wp_enable() function ---------------*//**
1381  * @brief  Function enables or disables on-board FLASH memory software
1382  * write-protection
1383  *
1384  * @param[in]  enable - on-board FLASH memory software write-protection enable
1385  *				state: TA66XX_ON or TA66XX_OFF;
1386  *
1387  * @return  None
1388  *
1389 -----------------------------------------------------------------------------*/
1390 void TA66XX_BC_set_flash_sw_wp_enable(uint32_t enable);
1391 
1392 
1393 /*------------ TA66XX_BC_erase_flash() function --------------------------*//**
1394  * @brief  Function erases FLASH block, which starts from address a
1395  * and of size len (in bytes)
1396  *
1397  * @param[in]  addr - Block start address (in bytes)
1398  * @param[in]  len - block length (in bytes)
1399  *
1400  * @return  Error code
1401  *
1402 -----------------------------------------------------------------------------*/
1403 int32_t TA66XX_BC_erase_flash(uint32_t addr, uint32_t len);
1404 
1405 
1406 /** Flag to disable FLASH memory erasing before write operation */
1407 #define TA66XX_BC_FLASH_ERASE_IS_DISABLED					0
1408 /** Flag to enable FLASH memory erasing before write operation */
1409 #define TA66XX_BC_FLASH_ERASE_IS_ENABLED					1
1410 
1411 
1412 /*------------ TA66XX_BC_write_flash() function --------------------------*//**
1413  * @brief  Function writes data block of size len to FLASH address a
1414  * The function erases FLASH before writing data to FLASH if erase input
1415  * parameter is set.
1416  *
1417  * @param[in]  a - FLASH address (in bytes)
1418  * @param[in]  ptr - data block to write
1419  * @param[in]  len - data block length (in bytes)
1420  * @param[in]  erase - flag to enable FLASH erasing before write operation
1421  *
1422  * @return  Error code
1423  *
1424 -----------------------------------------------------------------------------*/
1425 int32_t TA66XX_BC_write_flash(uint32_t a, void *ptr, uint32_t len, uint32_t erase);
1426 
1427 
1428 /*------------ TA66XX_BC_write_flash_byte() function ---------------------*//**
1429  * @brief  Function writes data byte d to FLASH address a
1430  *
1431  * @param[in]  a - FLASH address (in bytes)
1432  * @param[in]  d - data byte to write
1433  *
1434  * @return  Error code
1435  *
1436 -----------------------------------------------------------------------------*/
1437 int32_t TA66XX_BC_write_flash_byte(uint32_t addr, uint8_t d);
1438 
1439 
1440 /*------------ TA66XX_BC_write_flash_w16() function ----------------------*//**
1441  * @brief  Function writes 16-bit data word d to FLASH address a
1442  *
1443  * @param[in]  addr - FLASH address (in bytes)
1444  * @param[in]  d - 16-bit data word to write
1445  *
1446  * @return  Error code
1447  *
1448 -----------------------------------------------------------------------------*/
1449 int32_t TA66XX_BC_write_flash_w16(uint32_t addr, uint16_t d);
1450 
1451 
1452 /*------------ TA66XX_BC_write_flash_w32() function ----------------------*//**
1453  * @brief  Function writes 32-bit data word d to FLASH address a
1454  *
1455  * @param[in]  addr - FLASH address (in bytes)
1456  * @param[in]  d - 32-bit data word to write
1457  *
1458  * @return  Error code
1459  *
1460 -----------------------------------------------------------------------------*/
1461 int32_t TA66XX_BC_write_flash_w32(uint32_t addr, uint32_t d);
1462 
1463 
1464 /*------------ TA66XX_BC_read_flash() function ---------------------------*//**
1465  * @brief  Function reads data block of size len from FLASH address a
1466  *
1467  * @param[in]  addr - FLASH address (in bytes)
1468  * @param[in]  ptr - pointer to data buffer to store data block
1469  * @param[in]  len - data block length (in bytes)
1470  *
1471  * @return  Error code
1472  *
1473 -----------------------------------------------------------------------------*/
1474 int32_t TA66XX_BC_read_flash(uint32_t addr, void *ptr, uint32_t len);
1475 
1476 
1477 /** @}*/
1478 //=============================================================================
1479 
1480 
1481 
1482 //=============================================================================
1483 //============ MRAM functions =================================================
1484 //=============================================================================
1485 
1486 /** @addtogroup  TA66XX_BC_MRAM  TORNADO AMC MRAM API functions
1487  *  @{
1488  */
1489 
1490 
1491 /*------------ TA66XX_BC_get_mram_area_base_addr() function --------------*//**
1492  * @brief  Function returns MRAM area base address
1493  *
1494  * @return  MRAM area base address
1495  *
1496 -----------------------------------------------------------------------------*/
1497 uint32_t TA66XX_BC_get_mram_area_base_addr(void);
1498 
1499 
1500 /*------------ TA66XX_BC_get_mram_length() function ----------------------*//**
1501  * @brief  Function returns on-board MRAM memory length in bytes
1502  *
1503  * @return  On-board MRAM memory length in bytes
1504  *
1505 -----------------------------------------------------------------------------*/
1506 uint32_t TA66XX_BC_get_mram_length(void);
1507 
1508 
1509 /*------------ TA66XX_BC_get_mram_sw_wp_enable_status() function ---------*//**
1510  * @brief  Function returns enable status of on-board MRAM memory software
1511  * write-protection
1512  *
1513  * @return  On-board MRAM memory software write-protection enable state:
1514  * TA66XX_ON or TA66XX_OFF
1515  *
1516 -----------------------------------------------------------------------------*/
1517 uint32_t TA66XX_BC_get_mram_sw_wp_enable_status(void);
1518 
1519 
1520 /*------------ TA66XX_BC_set_mram_sw_wp_enable() function ----------------*//**
1521  * @brief  Function enables or disables on-board MRAM memory software
1522  * write-protection
1523  *
1524  * @param[in]  enable - on-board MRAM memory software write-protection enable
1525  *				state: TA66XX_ON or TA66XX_OFF;
1526  *
1527  * @return  None
1528  *
1529 -----------------------------------------------------------------------------*/
1530 void TA66XX_BC_set_mram_sw_wp_enable(uint32_t enable);
1531 
1532 
1533 /*------------ TA66XX_BC_read_mram_byte() function -----------------------*//**
1534  * @brief  Function reads a byte from MRAM memory at address addr.
1535  *
1536  * @param[in]  addr - MRAM memory address to read from
1537  *
1538  * @return  A byte read from MRAM memory
1539  *
1540 -----------------------------------------------------------------------------*/
1541 uint8_t TA66XX_BC_read_mram_byte(uint32_t addr);
1542 
1543 
1544 /*------------ TA66XX_BC_write_mram_byte() function ----------------------*//**
1545  * @brief  Function writes a byte to MRAM memory at address addr.
1546  *
1547  * @param[in]  addr - MRAM memory address to write to
1548  * @param[in]  v - A byte to write
1549  *
1550  * @return  None
1551  *
1552 -----------------------------------------------------------------------------*/
1553 void TA66XX_BC_write_mram_byte(uint32_t addr, uint8_t v);
1554 
1555 
1556 /*------------ TA66XX_BC_read_mram_w16() function ------------------------*//**
1557  * @brief  Function reads a 16-bit word from MRAM memory at address addr.
1558  *
1559  * @param[in]  addr - MRAM memory address to read from
1560  *
1561  * @return  A 16-bit word read from MRAM memory
1562  *
1563 -----------------------------------------------------------------------------*/
1564 uint16_t TA66XX_BC_read_mram_w16(uint32_t addr);
1565 
1566 
1567 /*------------ TA66XX_BC_write_mram_w16() function -----------------------*//**
1568  * @brief  Function writes a 16-bit word to MRAM memory at address addr.
1569  *
1570  * @param[in]  addr - MRAM memory address to write to
1571  * @param[in]  v - A 16-bit word to write
1572  *
1573  * @return  None
1574  *
1575 -----------------------------------------------------------------------------*/
1576 void TA66XX_BC_write_mram_w16(uint32_t addr, uint16_t v);
1577 
1578 
1579 /*------------ TA66XX_BC_read_mram_w32() function ------------------------*//**
1580  * @brief  Function reads a 32-bit word from MRAM memory at address addr.
1581  *
1582  * @param[in]  addr - MRAM memory address to read from
1583  *
1584  * @return  A 32-bit word read from MRAM memory
1585  *
1586 -----------------------------------------------------------------------------*/
1587 uint32_t TA66XX_BC_read_mram_w32(uint32_t addr);
1588 
1589 
1590 /*------------ TA66XX_BC_write_mram_w32() function -----------------------*//**
1591  * @brief  Function writes a 32-bit word to MRAM memory at address addr.
1592  *
1593  * @param[in]  addr - MRAM memory address to write to
1594  * @param[in]  v - A 32-bit word to write
1595  *
1596  * @return  None
1597  *
1598 -----------------------------------------------------------------------------*/
1599 void TA66XX_BC_write_mram_w32(uint32_t addr, uint32_t v);
1600 
1601 
1602 /*------------ TA66XX_BC_read_mram_w64() function ------------------------*//**
1603  * @brief  Function reads a 64-bit word from MRAM memory at address addr.
1604  *
1605  * @param[in]  addr - MRAM memory address to read from
1606  *
1607  * @return  A 64-bit word read from MRAM memory
1608  *
1609 -----------------------------------------------------------------------------*/
1610 uint64_t TA66XX_BC_read_mram_w64(uint32_t addr);
1611 
1612 
1613 /*------------ TA66XX_BC_write_mram_w64() function -----------------------*//**
1614  * @brief  Function writes a 64-bit word to MRAM memory at address addr.
1615  *
1616  * @param[in]  addr - MRAM memory address to write to
1617  * @param[in]  v - A 64-bit word to write
1618  *
1619  * @return  None
1620  *
1621 -----------------------------------------------------------------------------*/
1622 void TA66XX_BC_write_mram_w64(uint32_t addr, uint64_t v);
1623 
1624 
1625 /** @}*/
1626 //=============================================================================
1627 
1628 
1629 
1630 //=============================================================================
1631 //============ Gigabit Ethernet (GbE) Switch functions ========================
1632 //=============================================================================
1633 
1634 /** @addtogroup  TA66XX_BC_GBE  TORNADO AMC Gigabit Ethernet Switch functions
1635  *  @{
1636  */
1637 
1638 /** Gigabit Ethernet ports count available at the board */
1639 #define TA66XX_BC_GBE_PORT_COUNT							2
1640 
1641 /** DSP SGMII port number which is routed to AMC connector */
1642 #define TA66XX_BC_GBE_PORT_AMC_PORT_NUMBER					0
1643 /** Alias for DSP SGMII port-0 number */
1644 #define TA66XX_BC_GBE_PORT_AMC0_PORT_NUMBER					TA66XX_BC_GBE_PORT_AMC_PORT_NUMBER
1645 /** DSP SGMII port number which is routed to external PHY */
1646 #define TA66XX_BC_GBE_PORT_X1GE_PORT_NUMBER					1
1647 /** Alias for DSP SGMII port-1 number */
1648 #define TA66XX_BC_GBE_PORT_AMC1_PORT_NUMBER					TA66XX_BC_GBE_PORT_X1GE_PORT_NUMBER
1649 
1650 
1651 /** Gigabit Ethernet port type */
1652 typedef enum
1653 {
1654 	TA66XX_BC_GBE_PORT_TYPE_NONE = 0,					/**< Gigabit Ethernet port is not used */
1655 	TA66XX_BC_GBE_PORT_TYPE_PHY,						/**< Gigabit Ethernet port is connected to on-board PHY */
1656 	TA66XX_BC_GBE_PORT_TYPE_AMC,						/**< Gigabit Ethernet port is connected to the backplane AMC chassis */
1657 	TA66XX_BC_GBE_PORT_TYPE_MAX							/**< End of port type */
1658 } TA66XX_BC_GBE_PORT_TYPE;
1659 
1660 
1661 /** Gigabit Ethernet port link status */
1662 typedef enum
1663 {
1664 	TA66XX_BC_GBE_PORT_LINK_STATUS_DOWN = 0,			/**< Gigabit Ethernet port link is down */
1665 	TA66XX_BC_GBE_PORT_LINK_STATUS_UP,					/**< Gigabit Ethernet port link is up */
1666 	TA66XX_BC_GBE_PORT_LINK_STATUS_MAX					/**< End of link status */
1667 } TA66XX_BC_GBE_PORT_LINK_STATUS;
1668 
1669 
1670 /** T-AMC Gigabit Ethernet port data descriptor */
1671 typedef struct
1672 {
1673 	uint32_t							number;					/**< Port number */
1674 	TA66XX_BC_GBE_PORT_TYPE				type;					/**< Gigabit Ethernet port type */
1675 	TA66XX_BC_GBE_PORT_LINK_STATUS		link_status;			/**< Gigabit Ethernet port link status */
1676 	uint8_t								mac_address[6];			/**< MAC (physical) address of the port */
1677 } TA66XX_BC_GBE_PORT_DD;
1678 // T-AMC Gigabit Ethernet port data descriptor length in bytes
1679 #define TA66XX_BC_GBE_PORT_DD_LEN							sizeof(TA66XX_BC_GBE_PORT_DD)
1680 
1681 
1682 /** IP address string max size in bytes*/
1683 #define TA66XX_BC_IP_ADDRESS_LEN_MAX						16
1684 /** Host name max size in bytes*/
1685 #define TA66XX_BC_HOSTNAME_LEN_MAX							256
1686 
1687 
1688 /** Static IP configuration */
1689 #define TA66XX_BC_IP_CFG_TYPE_STATIC						0
1690 /** Dynamic (DHCP) IP configuration */
1691 #define TA66XX_BC_IP_CFG_TYPE_DYNAMIC						1
1692 
1693 
1694 /*------------ TA66XX_BC_init_gbe_port() function ------------------------*//**
1695  * @brief  Function initializes selected DSP Gigabit Ethernet port
1696  *
1697  * @param[in]  port - DSP Gigabit Ethernet port number
1698  *
1699  * @return  Error code
1700  *
1701 -----------------------------------------------------------------------------*/
1702 int32_t TA66XX_BC_init_gbe_port(uint32_t port);
1703 
1704 
1705 /*------------ TA66XX_BC_get_gbe_port_info() function --------------------*//**
1706  * @brief  Function returns Gigabit Ethernet port info: port mode, MAC address,
1707  * link status
1708  *
1709  * @param[in]  port - Gigabit Ethernet port number for which port info should
1710  *					be returned
1711  * @param[out]  port_dd - pointer to a buffer to which Gigabit Ethernet port
1712  *					data descriptor should be returned
1713  *
1714  * @return  Error code
1715  *
1716 -----------------------------------------------------------------------------*/
1717 int32_t TA66XX_BC_get_gbe_port_info(uint32_t port, TA66XX_BC_GBE_PORT_DD *port_dd);
1718 
1719 
1720 /** @}*/
1721 //=============================================================================
1722 
1723 
1724 
1725 #ifdef __cplusplus
1726 }
1727 #endif
1728 
1729 
1730 
1731 //=============================================================================
1732 #endif /* __TA66XX_BC_DSP_BC_FUNCTIONS_HXX__ */
1733