1 /* ============================================================================
2 * Copyright (c) 2016 Texas Instruments Incorporated.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * 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
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 ===============================================================================*/
34 #ifndef IDLELOOP_H_
35 #define IDLELOOP_H_
37 #include "pll_control.h"
39 /* DSP LDO setting */
40 #define DSP_LDO ( 105 )
41 //#define DSP_LDO ( 130 )
43 /* PLL output MHz setting */
44 #define PLL_MHZ ( PLL_FREQ_16P384MHZ )
45 //#define PLL_MHZ ( PLL_FREQ_32P768MHZ )
47 #define NUM_INSAMP_PER_MS ( 1024 ) // 1-bit samples per msec
48 #define NUM_IN32BW_PER_MS ( NUM_INSAMP_PER_MS/32 ) // 32-bit input words per msec
49 #define NUM_IN32BW_PER_MS_PER_CH ( NUM_IN32BW_PER_MS/2 ) // 32-bit input words per msec/channel
51 #define NUM_MS_PER_FRAME ( 20 ) // msec per frame
53 #define IN_FRAME_LEN_PER_CH ( NUM_IN32BW_PER_MS_PER_CH*NUM_MS_PER_FRAME) // input frame length per channel
55 #define FIR_DF ( 2 ) // FIR1/FIR2 decimation factor
57 #define CIC_OUT_FRAME_LEN ( NUM_INSAMP_PER_MS*NUM_MS_PER_FRAME / CIC_DF ) // output frame length
58 #define FIR1_OUT_FRAME_LEN ( CIC_OUT_FRAME_LEN / FIR_DF ) // FIR1 output frame length
59 #define FIR2_OUT_FRAME_LEN ( FIR1_OUT_FRAME_LEN / FIR_DF ) // FIR2 output frame length
60 #define DIGGAIN_OUT_FRAME_LEN ( FIR2_OUT_FRAME_LEN ) // digital gain output frame length
62 #define FIR1_NUM_COEFS ( 15 ) // FIR1 number of coefficients
63 #define FIR2_NUM_COEFS ( 58 ) // FIR2 number of coefficients
66 #define NUM_FRAMES_PER_CIRCBUF ( 10 ) // frames in circular buffer
68 #define IN_CIRCBUF_LEN ( NUM_IN32BW_PER_MS_PER_CH*NUM_MS_PER_FRAME*NUM_FRAMES_PER_CIRCBUF ) // input circular buffer length
69 #define CIC_OUT_CIRCBUF_LEN ( CIC_OUT_FRAME_LEN*NUM_FRAMES_PER_CIRCBUF)
70 #define FIR1_OUT_CIRCBUF_LEN ( FIR1_OUT_FRAME_LEN*NUM_FRAMES_PER_CIRCBUF )
71 #define FIR2_OUT_CIRCBUF_LEN ( FIR2_OUT_FRAME_LEN*NUM_FRAMES_PER_CIRCBUF )
72 #define DIGGAIN_OUT_CIRCBUF_LEN ( FIR2_OUT_CIRCBUF_LEN )
74 // ping pong buffer size 32 bits per sample, one frame for ping, one frame for pong
75 // *2 for ping/pong
76 #define I2S_DMA_BUF_LEN ( IN_FRAME_LEN_PER_CH*2 )
78 #endif /*IDLELOOP_H_*/