]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - psdk_cust/pdk_k2g_1_0_1_2_eng/packages/ti/board/src/skAM437x/skAM437x.c
Merge pull request #1 in PASDK/pasdk_sr from PASDK-318-input-task-code-repetition...
[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_2_eng / packages / ti / board / src / skAM437x / skAM437x.c
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 #include <stdint.h>
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include "board_internal.h"
37 #include "error.h"
38 #include "chipdb.h"
39 #include "prcm.h"
40 #include "board_cfg.h"
42 /* starterware header files */
43 #include "hw_prm_per.h"
44 #include "am437x.h"
45 #include "hw_types.h"
48 /* EEPROM data on IDK AM437x  */
49 char eepromData[I2C_EEPROM_RX_LENGTH] = {0x55, 0x33, 0xEE, 0x41, 0x4D,
50                                          0x34, 0x33, 0x5F, 0x5F, 0x53};
53 /* Set the desired DDR3 configuration -- assumes 66.67 MHz DDR3 clock input */
54 Board_STATUS Board_DDR3Init()
55 {
56     return BOARD_SOK;
57 }
59 /* Set the desired DDR3 configuration -- assumes 66.67 MHz DDR3 clock input */
60 Board_STATUS Board_PLLInit()
61 {
62     return BOARD_SOK;
63 }
65 /* Set the desired DDR3 configuration -- assumes 66.67 MHz DDR3 clock input */
66 Board_STATUS Board_moduleClockInit()
67 {
68     int32_t status;
70     /* UART */
71     status = PRCMModuleEnable(CHIPDB_MOD_ID_UART, 0U, 0U);
73     /* I2C */
74     if(S_PASS == status)
75     {
76         status = PRCMModuleEnable(CHIPDB_MOD_ID_I2C, 0U, 0U);
77     }
79     /* EDMA3CC */
80     if(S_PASS == status)
81     {
82         status = PRCMModuleEnable(CHIPDB_MOD_ID_EDMA3CC, 0U, 0U);
83     }
85     /* EDMA3TC0 */
86     if(S_PASS == status)
87     {
88         status = PRCMModuleEnable(CHIPDB_MOD_ID_EDMA3TC, 0U, 0U);
89     }
91     /* EDMA3TC1 */
92     if(S_PASS == status)
93     {
94         status = PRCMModuleEnable(CHIPDB_MOD_ID_EDMA3TC, 1U, 0U);
95     }
97     /* EDMA3TC2 */
98     if(S_PASS == status)
99     {
100         status = PRCMModuleEnable(CHIPDB_MOD_ID_EDMA3TC, 2U, 0U);
101     }
103     /* MMCSD */
104     if(S_PASS == status)
105     {
106         status = PRCMModuleEnable(CHIPDB_MOD_ID_MMCSD, 0U, 0U);
107     }
109     /* QSPI */
110     if(S_PASS == status)
111     {
112         status = PRCMModuleEnable(CHIPDB_MOD_ID_QSPI, 0U, 0U);
113     }
115      /*GPIO*/
116      if(S_PASS == status)
117     {
118         status = PRCMModuleEnable(CHIPDB_MOD_ID_GPIO, 0U, 0U);
119     }
120     if(S_PASS == status)
121     {
122         status = PRCMModuleEnable(CHIPDB_MOD_ID_GPIO, 5U, 0U);
123     }
125     /* CPSW */
126     if(S_PASS == status)
127     {
128         status = PRCMModuleEnable(CHIPDB_MOD_ID_CPSW, 0U, 0U);
129     }
131     return BOARD_SOK;
134 Board_STATUS Board_init(Board_initCfg cfg)
136     Board_STATUS ret = BOARD_SOK;
138     if (cfg & BOARD_INIT_PLL)
139         ret = Board_PLLInit();
140     if (ret != BOARD_SOK)
141         return ret;
143     if (cfg & BOARD_INIT_MODULE_CLOCK)
144         ret = Board_moduleClockInit();
145     if (ret != BOARD_SOK)
146         return ret;
148     if (cfg & BOARD_INIT_DDR)
149         ret = Board_DDR3Init();
150     if (ret != BOARD_SOK)
151         return ret;
153     if (cfg & BOARD_INIT_PINMUX_CONFIG)
154     {
155         ret = Board_pinmuxConfig();
156     }
157     if (ret != BOARD_SOK)
158         return ret;
160     if (cfg & BOARD_INIT_UART_STDIO)
161         ret = Board_uartStdioInit();
162     if (ret != BOARD_SOK)
163         return ret;
165     return ret;