[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_0_eng / packages / ti / board / diag / eeprom / src / eeprom_test.c
1 /**
2 * \file main.c
3 *
4 * \brief Example application main file. This application will toggle the led.
5 * The led toggling will be done inside an callback function, which
6 * will be called by Interrupt Service Routine. Interrupts are
7 * triggered manually and no external source is used to trigger
8 * interrupts.
9 *
10 */
12 /*
13 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 *
19 * Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 *
22 * Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the
25 * distribution.
26 *
27 * Neither the name of Texas Instruments Incorporated nor the names of
28 * its contributors may be used to endorse or promote products derived
29 * from this software without specific prior written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 */
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <string.h>
49 #include <ti/drv/uart/UART_stdio.h>
51 #include "board.h"
52 #include "board_cfg.h"
54 int eeprom_test()
55 {
56 int ret = 0;
57 int i;
58 Board_IDInfo eepromInfo;
59 Board_STATUS stat;
61 UART_printf("\n*********************************************\n");
62 UART_printf ("* EEPROM Test *\n");
63 UART_printf ("*********************************************\n");
64 stat = Board_getIDInfo(&eepromInfo);
65 UART_printf("header: ");
66 for (i = 0; i<BOARD_EEPROM_HEADER_LENGTH; i++)
67 UART_printf("%x", eepromInfo.header[i]);
68 UART_printf("\nboardName: %s\n", eepromInfo.boardName);
69 UART_printf("version: %s\n", eepromInfo.version);
70 UART_printf("serialNum: %s\n", eepromInfo.serialNum);
71 if (stat != BOARD_SOK)
72 {
73 UART_printf("Test FAILED!\n");
74 ret = -1;
75 }
76 else
77 {
78 UART_printf("Test PASSED!\n");
79 }
80 return ret;
81 }
83 /*
84 * ======== main ========
85 */
86 int main(void)
87 {
88 Board_initCfg boardCfg;
89 #ifdef PDK_RAW_BOOT
90 boardCfg = BOARD_INIT_PINMUX_CONFIG |
91 BOARD_INIT_UART_STDIO;
92 #else
93 boardCfg = BOARD_INIT_UART_STDIO;
94 #endif
95 Board_init(boardCfg);
97 return eeprom_test();
98 }