[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / application / itopo / evmk2g / dcs7_params.c
2 /******************************************************************************
3 * Copyright (c) 2016, 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 #include <dcs7.h>
38 #include <dcs7_params.h>
40 #include "dcs7_medialayer.h"
42 #ifdef UARTCALLBACK
43 extern void UART_transferCallback(UART_Handle handle,
44 void *buffer, size_t count);
45 #endif
47 #ifdef SPICALLBACK
48 extern void SPI_transferCallback(UART_Handle handle,
49 void *buffer, size_t count);
50 #endif
52 /* SPI parameters structure Slave mode*/
53 SPI_Params spiParams =
54 {
55 #ifdef SPICALLBACK
56 SPI_MODE_CALLBACK, /* transferMode */
57 #else
58 SPI_MODE_BLOCKING, /* transferMode */
59 #endif
60 Semaphore_PendState_WAIT_FOREVER, /* transferTimeout */
61 #ifdef SPICALLBACK
62 &SPI_transferCallback,
63 #else
64 NULL, /* transferCallbackFxn */
65 #endif
66 SPI_SLAVE, /* mode */
67 1000000, /* bitRate */
68 8, /* dataSize */
69 SPI_POL0_PHA0, /* frameFormat */
70 NULL /* custom */
71 };
73 const DCS7_Params_Dev_Spi DCS7_PARAMS_DEV_SPI =
74 {
75 sizeof(DCS7_Params_Dev_Spi),
76 NULL,
77 &spiParams,
78 {0, NULL, NULL, NULL}
79 };
81 const DCS7_Params_Dev_I2c DCS7_PARAMS_DEV_I2C =
82 {
83 sizeof(DCS7_Params_Dev_I2c),
84 NULL,
85 {I2C_MODE_BLOCKING, NULL, I2C_100kHz, NULL, I2C_SLAVE},
86 {NULL, 0, NULL, 0, 0, NULL, NULL},
87 0x11
88 };
90 const DCS7_Params_Dev_Uart DCS7_PARAMS_DEV_UART =
91 {
92 sizeof(DCS7_Params_Dev_Uart),
93 0, // emask
94 NULL, // hUart
95 #ifdef UARTCALLBACK
96 &UART_transferCallback, // transferCallbackFxn
97 #endif
98 0, // isEMDAConfigured
99 SRECORD_RES_MAX_S1_CNT * 72 /*ASCII_SRECORD_S1_MAX_SIZE*/, // scratchBufSize
100 NULL, // scratchBuf
101 {0}, // uartParams
102 19200
103 };
105 const DCS7_Params_Dev DCS7_PARAMS_DEV =
106 {
107 /* Select the appropriate device from the following choices:
108 DCS7_PARAMS_DEV_SPI - Select SPI device
109 DCS7_PARAMS_DEV_I2C - Select I2C device
110 DCS7_PARAMS_DEV_UART - Select UART device */
111 // (Uint32)&DCS7_PARAMS_DEV_SPI,
112 // (Uint32)&DCS7_PARAMS_DEV_I2C,
113 (Uint32)&DCS7_PARAMS_DEV_UART,
114 };
116 Uint32 DCS7Trace = Diags_USER2;
118 const DCS7_Params DCS7_PARAMS =
119 {
120 sizeof(DCS7_Params),
121 /* DCS7 supports following values for device (dev):
122 DCS7_PARAMS_DEV_SPI0 - SPI0 device
123 DCS7_PARAMS_DEV_I2C0 - I2C0 device
124 DCS7_PARAMS_DEV_UART0 - UART0 device */
125 DCS7_PARAMS_DEV_UART0,
126 /* DCS7 supports following values for error detection and report (edr):
127 DCS7_PARAMS_EDR_DIS - disable error detection and report
128 DCS7_PARAMS_EDR_ENA - enable error detection and report */
129 DCS7_PARAMS_EDR_ENA,
130 /* Reserved fields */
131 0,0,
132 /* The receive buffer size, watermarks values and the transmit buffer size
133 values should be chosen depending upon the data rate, latency
134 requirements, application memory requirements, etc. */
135 512,
136 256,
137 512,
138 512,
139 /* DCS7 device parameters */
140 (DCS7_Params_Dev*)&DCS7_PARAMS_DEV,
141 /* DCS7 log param */
142 (void*) &DCS7Trace,
143 };
145 void DCS7_errorInit()
146 {
147 /* Initialize the physical interface that will be used for reporting
148 error occurence to the master */
149 }
151 void DCS7_errorAssert()
152 {
153 /* Configure the physical interface to indicate occurence of an error
154 to the master */
155 }
156 void DCS7_errorDeassert()
157 {
158 /* Configure the physical interface to indicate error recovery is
159 completed and the slave is ready to accept new data */
160 }