1 /*
2 * audio_evmInit.c
3 *
4 * This file contains Audio application related EVM (platform) specific routines
5 * implementation.
6 * This is part of the EVM Initialization library (evmInit) which contains pinmux
7 * enabling routines for peripherals used by the application, and may contain
8 * related device pre-driver initialization routines.
9 *
10 * Copyright (C) 2009-2017 Texas Instruments Incorporated - http://www.ti.com/
11 *
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the
23 * distribution.
24 *
25 * Neither the name of Texas Instruments Incorporated nor the names of
26 * its contributors may be used to endorse or promote products derived
27 * from this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 */
43 /**
44 * \file audio_evmInit.c
45 *
46 * \brief This file contains the board specific code for enabling the use of
47 * audio driver.
48 *
49 * (C) Copyright 2009-2017, Texas Instruments, Inc
50 *
51 */
52 #include "stdint.h"
53 #include "stdio.h"
54 #include "string.h"
55 #include <stdbool.h>
56 #include <ti/csl/hw_types.h>
57 #include <ti/csl/csl_mcasp.h>
58 #include <ti/csl/csl_edma.h>
59 #include <ti/csl/src/ip/mcspi/V1/spi.h>
60 #include <ti/csl/src/ip/gpio/V0/gpio.h>
61 #include <ti/csl/src/ip/i2c/V0/i2c.h>
62 #ifdef _TMS320C6X
63 #include <ti/csl/arch/c67x/interrupt.h>
64 #else
65 #include <ti/csl/arch/arm9/interrupt.h>
66 #endif
67 #include <ti/csl/soc.h>
68 #include <ti/csl/csl_syscfg.h>
69 #include <ti/csl/csl_syscfgAux.h>
70 #include "mcasp_audiodc_bios.h"
72 #include <xdc/std.h>
73 #define SW_I2C
74 #ifndef SW_I2C
75 #include <ti/drv/i2c/I2c.h>
76 #endif
78 #include <Audio_evmInit.h>
79 #include <mcasp_cfg.h>
80 #include <ti/drv/mcasp/soc/mcasp_soc.h>
81 #include <ti/csl/cslr_device.h>
82 #include <ti/csl/csl_bootcfg.h>
83 #include <board.h>
84 #include <ti/csl/cslr_syscfg.h>
86 #include <ti/csl/hw_types.h>
87 #include <ti/drv/uart/UART_stdio.h>
89 #include "cmb.h"
91 extern Board_STATUS Board_init(Board_initCfg);
93 /*
94 ** Configures McASP pin muxing
95 */
96 void configMcaspPinMux(void)
97 {
98 // Pinmux settings for for McASP1
99 /*
100 ** Clearing the bits in context and retaining the other bit values
101 ** of PINMUX8 register.
102 */
103 hSysCfg->PINMUX8 &= (~(CSL_SYSCFG_PINMUX8_PINMUX8_23_20_MASK));
105 /*
106 ** Performing the actual Pin Multiplexing to select mandatory pins in
107 ** PINMUX8 register.
108 */
109 hSysCfg->PINMUX8 |= PINMUX8_MCASP1_AXR10_ENABLE;
111 // Pinmux settings for for McASP1
112 /*
113 ** Clearing the bits in context and retaining the other bit values
114 ** of PINMUX11 register.
115 */
116 hSysCfg->PINMUX11 &= (~(CSL_SYSCFG_PINMUX11_PINMUX11_31_28_MASK
117 | CSL_SYSCFG_PINMUX11_PINMUX11_27_24_MASK
118 | CSL_SYSCFG_PINMUX11_PINMUX11_23_20_MASK));
120 /*
121 ** Performing the actual Pin Multiplexing to select mandatory pins in
122 ** PINMUX11 register.
123 */
124 hSysCfg->PINMUX11 |= (PINMUX11_MCASP1_AFSX_ENABLE
125 | PINMUX11_MCASP1_ACLKX_ENABLE |
126 PINMUX11_MCASP1_AHCLKX_ENABLE);
128 /*
129 ** Clearing the bits in context and retaining the other bit values
130 ** of PINMUX12 register.
131 */
132 hSysCfg->PINMUX12 &= (~(CSL_SYSCFG_PINMUX12_PINMUX12_19_16_MASK
133 | CSL_SYSCFG_PINMUX12_PINMUX12_15_12_MASK
134 | CSL_SYSCFG_PINMUX12_PINMUX12_11_8_MASK
135 | CSL_SYSCFG_PINMUX12_PINMUX12_7_4_MASK
136 | CSL_SYSCFG_PINMUX12_PINMUX12_3_0_MASK
137 | CSL_SYSCFG_PINMUX12_PINMUX12_23_20_MASK
138 | CSL_SYSCFG_PINMUX12_PINMUX12_27_24_MASK
139 | CSL_SYSCFG_PINMUX12_PINMUX12_31_28_MASK));
141 /*
142 ** Performing the actual Pin Multiplexing to select mandatory pins in
143 ** PINMUX12 register.
144 */
145 hSysCfg->PINMUX12 |= (PINMUX12_MCASP1_AXR0_ENABLE |
146 PINMUX12_MCASP1_AMUTE_ENABLE | PINMUX12_MCASP1_AFSR_ENABLE |
147 PINMUX12_MCASP1_ACLKR_ENABLE | PINMUX12_MCASP1_AHCLKR_ENABLE |
148 PINMUX12_MCASP1_AXR0_ENABLE | PINMUX12_MCASP1_AXR1_ENABLE |
149 PINMUX12_MCASP1_AXR2_ENABLE | PINMUX12_MCASP1_AXR3_ENABLE);
151 /*
152 ** Clearing the bits in context and retaining the other bit values
153 ** of PINMUX13 register.
154 */
155 hSysCfg->PINMUX13 &= (~(CSL_SYSCFG_PINMUX13_PINMUX13_7_4_MASK));
157 /*
158 ** Performing the actual Pin Multiplexing to select mandatory pins in
159 ** PINMUX13 register.
160 */
161 hSysCfg->PINMUX13 |= (PINMUX13_MCASP1_AXR5_ENABLE);
163 // Pinmux settings for enable AMUTE0
164 /*
165 ** Clearing the bits in context and retaining the other bit values
166 ** of PINMUX10 register.
167 */
168 hSysCfg->PINMUX10 &= (~(CSL_SYSCFG_PINMUX10_PINMUX10_3_0_MASK));
170 /*
171 ** Performing the actual Pin Multiplexing to select mandatory pins in
172 ** PINMUX10 register.
173 */
174 hSysCfg->PINMUX10 |= (PINMUX10_AMUTE0_ENABLE);
175 }
177 void configureAudio(void)
178 {
179 Board_STATUS stat = BOARD_SOK;
180 Board_initCfg arg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_UART_STDIO;
181 stat = Board_init(arg);
183 configMcaspPinMux();
185 cmb_AudioInit();
187 return;
188 }
190 void configMcASP_SocHwInfo(void)
191 {
192 /* Configure the interrupts for the McASP Instance MCASP_NUM */
193 Mcasp_HwInfo hwInfo;
195 Mcasp_socGetInitCfg(MCASP_NUM, &hwInfo);
198 /* Change anything if needed */
199 Mcasp_socSetInitCfg(MCASP_NUM,&hwInfo);
200 }
202 /* ========================================================================== */
203 /* END OF FILE */
204 /* ========================================================================== */