[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / application / itopo / evmk2g / dcs7_params.c
2 /******************************************************************************
3 * Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Texas Instruments Incorporated nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGE.
28 *****************************************************************************/
30 //
31 //
32 // DA10x SPI, I2C and UART slave control status (DCS7) implementation
33 //
34 //
35 //
37 /* I2C LLD Header files */
38 #include <ti/drv/i2c/I2C.h>
39 /* SPI LLD Header files */
40 #include <ti/drv/spi/SPI.h>
41 /* UART LLD Header files */
42 #include <ti/drv/uart/UART.h>
44 #include "dcs7.h"
45 #include "dcs7_params.h"
46 #include "dcs7_priv.h"
47 #include "dcs7_medialayer.h"
50 /* SPI parameters structure Slave mode*/
51 SPI_Params spiParams =
52 {
53 #ifdef SPICALLBACK
54 SPI_MODE_CALLBACK, /* transferMode */
55 #else
56 SPI_MODE_BLOCKING, /* transferMode */
57 #endif
58 Semaphore_PendState_WAIT_FOREVER, /* transferTimeout */
59 #ifdef SPICALLBACK
60 (SPI_CallbackFxn)&SPI_transferCallback,
61 #else
62 NULL, /* transferCallbackFxn */
63 #endif
64 SPI_SLAVE, /* mode */
65 1000000, /* bitRate */
66 DCS7_PARAMS_DEV_SPI_CLEN_16, /* dataSize */
67 SPI_POL0_PHA0, /* frameFormat */
68 NULL /* custom */
69 };
71 const DCS7_Params_Dev_Spi DCS7_PARAMS_DEV_SPI =
72 {
73 sizeof(DCS7_Params_Dev_Spi), /* size of the structure */
74 DCS7_PARAMS_DEV_SPI_NP_4_SCS, /* number of pins */
75 DCS7_PARAMS_DEV_SPI_ENAHIZ_DIS, /* SPIENA pin mode */
76 0,0,
77 0, /* error mask */
78 NULL, /* handle to SPI lld */
79 &spiParams, /* SPI Initialization param */
80 {0, NULL, NULL, NULL} /* SPI transfer info */
81 };
83 #if 0 // FL: temporary remove this since "I2C_SLAVE" is a PDK 1.0.1.2_eng customization not present in PDK 1.0.6
84 const DCS7_Params_Dev_I2c DCS7_PARAMS_DEV_I2C =
85 {
86 sizeof(DCS7_Params_Dev_I2c), /* size of the structure */
87 NULL, /* handle to I2C lld, only dynamic init parameter */
88 {I2C_MODE_BLOCKING, NULL, I2C_100kHz, NULL, I2C_SLAVE}, /* I2C Initialization parameters */
89 {NULL, 0, NULL, 0, 0, NULL, NULL}, /* I2C transfer info */
90 0x11, /* Own slave address of K2G */
91 0,0,0, /* reserved */
92 0 /* Error mask */
93 };
94 #endif
96 const DCS7_Params_Dev_Uart DCS7_PARAMS_DEV_UART =
97 {
98 sizeof(DCS7_Params_Dev_Uart), // size of the structure
99 0, // emask
100 NULL, // hUart
101 #ifdef UARTCALLBACK
102 &UART_transferCallback, // transferCallbackFxn
103 NULL, // hSwi
104 NULL, // hCallback
105 #endif
106 0, // isEMDAConfigured
107 SRECORD_RES_MAX_S1_CNT * ASCII_SRECORD_S1_MAX_SIZE, // scratchBufSize
108 NULL, // scratchBuf
109 {0}, // uartParams
110 19200 // Baudrate
111 };
113 const DCS7_Params_Dev DCS7_PARAMS_DEV =
114 {
115 /* Select the appropriate device from the following choices:
116 DCS7_PARAMS_DEV_SPI - Select SPI device
117 DCS7_PARAMS_DEV_I2C - Select I2C device
118 DCS7_PARAMS_DEV_UART - Select UART device */
119 // (Uint32)&DCS7_PARAMS_DEV_SPI,
120 // (Uint32)&DCS7_PARAMS_DEV_I2C,
121 (Uint32)&DCS7_PARAMS_DEV_UART,
122 };
124 Uint32 DCS7Trace = Diags_USER2;
126 const DCS7_Params DCS7_PARAMS =
127 {
128 sizeof(DCS7_Params),
129 /* DCS7 supports following values for device (dev):
130 DCS7_PARAMS_DEV_SPI0 - SPI0 device
131 DCS7_PARAMS_DEV_I2C0 - I2C0 device
132 DCS7_PARAMS_DEV_UART0 - UART0 device */
133 DCS7_PARAMS_DEV_UART0,
134 /* DCS7 supports following values for error detection and report (edr):
135 DCS7_PARAMS_EDR_DIS - disable error detection and report
136 DCS7_PARAMS_EDR_ENA - enable error detection and report */
137 DCS7_PARAMS_EDR_ENA,
138 /* Reserved fields */
139 0,0,
140 /* The receive buffer size, watermarks values and the transmit buffer size
141 values should be chosen depending upon the data rate, latency
142 requirements, application memory requirements, etc. */
143 512,
144 256,
145 512,
146 512,
147 /* DCS7 device parameters */
148 (DCS7_Params_Dev*)&DCS7_PARAMS_DEV,
149 };
151 void DCS7_errorInit()
152 {
153 /* Initialize the physical interface that will be used for reporting
154 error occurence to the master */
155 }
157 void DCS7_errorAssert()
158 {
159 /* Configure the physical interface to indicate occurence of an error
160 to the master */
161 }
162 void DCS7_errorDeassert()
163 {
164 /* Configure the physical interface to indicate error recovery is
165 completed and the slave is ready to accept new data */
166 }