1 /*
2 * audioSample_main.c
3 *
4 * This file contains the test / demo code to demonstrate the Audio component
5 * driver functionality on SYS/BIOS 6.
6 *
7 * Copyright (C) 2009-2018 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 */
40 /** \file audioSample_main.c
41 *
42 * \brief sample application for demonstration of audio driver usage
43 *
44 * This file contains the implementation of the sample appliation for the
45 * demonstration of audio playing through the audio interface layer.
46 *
47 * (C) Copyright 2009-2018, Texas Instruments, Inc
48 */
50 /* ========================================================================== */
51 /* INCLUDE FILES */
52 /* ========================================================================== */
54 #include <xdc/std.h>
55 #include <string.h>
56 #include <xdc/runtime/Error.h>
57 #include <xdc/runtime/Log.h>
58 #include <xdc/runtime/System.h>
59 #include <ti/sysbios/BIOS.h>
60 #include <ti/sysbios/knl/Semaphore.h>
61 #include <ti/sysbios/knl/Task.h>
62 #include <mcasp_drv.h>
63 #ifdef AIC_CODEC
64 #include <Aic31.h>
65 #endif
66 #include <ti/drv/uart/UART.h>
67 #include <ti/drv/uart/UART_stdio.h>
69 #if !defined(SOC_AM65XX) && !defined(SOC_J721E)
70 #include <ti/sdo/edma3/drv/edma3_drv.h>
71 #include <ti/csl/csl_edma3.h>
72 #endif
74 #include <ti/drv/mcasp/soc/mcasp_soc.h>
76 #if defined(BUILD_MPU) || defined (__C7100__)
77 extern void Osal_initMmuDefault(void);
78 Void InitMmu()
79 {
80 Osal_initMmuDefault();
81 }
83 #endif
85 #if !defined(SOC_AM65XX) && !defined(SOC_J721E)
86 /* Handle to the EDMA driver instance */
87 EDMA3_DRV_Handle hEdma;
88 #endif
90 void configureAudio(void);
91 void configMcASP_SocHwInfo(void);
93 extern void Audio_echo_Task(void);
94 /* ========================================================================== */
95 /* FUNCTION DEFINITIONS */
96 /* ========================================================================== */
99 /**
100 * \brief Void main(Void)
101 *
102 * Main function of the sample application. This function enables
103 * the mcasp instance in the power sleep controller and also
104 * enables the pinmux for the mcasp instance. This also powers up
105 * any codecs if attached to McASP like the AIC codec, before switching to
106 * the task to Audio_echo_task().
107 *
108 * \param None
109 * \return None
110 */
111 int main(Void)
112 {
113 /* enable the pinmux & PSC-enable for the mcasp device */
114 configureAudio();
116 /* Initializing McASP HwInfo parameters */
117 McaspDevice_init();
119 /* Perform SOC specific McASP HwInfo Configuration for non-default parameters
120 * using the socGetConfig() and socSetConfig(). Please note that
121 this is being called AFTER McaspDevice_init() which initializes with the
122 default parameters */
123 configMcASP_SocHwInfo();
124 #if defined(AIC_CODEC)
125 Aic31_init();
126 #endif
127 Log_info0("\r\nAudio Sample Main\n");
129 BIOS_start();
131 return 0;
132 }
133 /*
134 * Mcasp init function called when creating the driver.
135 */
140 /* ========================================================================== */
141 /* END OF FILE */
142 /* ========================================================================== */