Skip to content

Commit f236b1f

Browse files
committed
update KPSDK to RC1
- the update causes few more dependences which were reported. Will be removed later (usb, boards) - pit timer - hal use , pit driver uses us period
1 parent f02c535 commit f236b1f

File tree

114 files changed

+20514
-25470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+20514
-25470
lines changed

libraries/mbed/targets/hal/TARGET_Freescale/KPSDK/.tags

Lines changed: 8120 additions & 0 deletions
Large diffs are not rendered by default.

libraries/mbed/targets/hal/TARGET_Freescale/KPSDK/.tags_sorted_by_file

Lines changed: 8120 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
/*
2+
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without modification,
6+
* are permitted provided that the following conditions are met:
7+
*
8+
* o Redistributions of source code must retain the above copyright notice, this list
9+
* of conditions and the following disclaimer.
10+
*
11+
* o Redistributions in binary form must reproduce the above copyright notice, this
12+
* list of conditions and the following disclaimer in the documentation and/or
13+
* other materials provided with the distribution.
14+
*
15+
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16+
* contributors may be used to endorse or promote products derived from this
17+
* software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
#ifndef __FSL_SGTL_5000_DRIVER_H__
32+
#define __FSL_SGTL_5000_DRIVER_H__
33+
34+
#include "fsl_i2c_master_driver.h"
35+
36+
/*!
37+
* @addtogroup sgtl5000
38+
* @{
39+
*/
40+
41+
/*! @file */
42+
43+
/*******************************************************************************
44+
* Definitions
45+
******************************************************************************/
46+
47+
/*! @brief Define the register address of sgtl5000. */
48+
#define CHIP_ID 0x0000
49+
#define CHIP_DIG_POWER 0x0002
50+
#define CHIP_CLK_CTRL 0x0004
51+
#define CHIP_I2S_CTRL 0x0006
52+
#define CHIP_SSS_CTRL 0x000A
53+
#define CHIP_ADCDAC_CTRL 0x000E
54+
#define CHIP_DAC_VOL 0x0010
55+
#define CHIP_PAD_STRENGTH 0x0014
56+
#define CHIP_ANA_ADC_CTRL 0x0020
57+
#define CHIP_ANA_HP_CTRL 0x0022
58+
#define CHIP_ANA_CTRL 0x0024
59+
#define CHIP_LINREG_CTRL 0x0026
60+
#define CHIP_REF_CTRL 0x0028
61+
#define CHIP_MIC_CTRL 0x002A
62+
#define CHIP_LINE_OUT_CTRL 0x002C
63+
#define CHIP_LINE_OUT_VOL 0x002E
64+
#define CHIP_ANA_POWER 0x0030
65+
#define CHIP_PLL_CTRL 0x0032
66+
#define CHIP_CLK_TOP_CTRL 0x0034
67+
#define CHIP_ANA_STATUS 0x0036
68+
#define CHIP_ANA_TEST2 0x003A
69+
#define CHIP_SHORT_CTRL 0x003C
70+
#define DAP_CONTROL 0x0100
71+
#define DAP_PEQ 0x0102
72+
#define DAP_BASS_ENHANCE 0x0104
73+
#define DAP_BASS_ENHANCE_CTRL 0x0106
74+
#define DAP_AUDIO_EQ 0x0108
75+
#define DAP_SGTL_SURROUND 0x010A
76+
#define DAP_FILTER_COEF_ACCESS 0x010C
77+
#define DAP_COEF_WR_B0_MSB 0x010E
78+
#define DAP_COEF_WR_B0_LSB 0x0110
79+
#define DAP_AUDIO_EQ_BASS_BAND0 0x0116
80+
#define DAP_AUDIO_EQ_BAND1 0x0118
81+
#define DAP_AUDIO_EQ_BAND2 0x011A
82+
#define DAP_AUDIO_EQ_BAND3 0x011C
83+
#define DAP_AUDIO_EQ_TREBLE_BAND4 0x011E
84+
#define DAP_MAIN_CHAN 0x0120
85+
#define DAP_MIX_CHAN 0x0122
86+
#define DAP_AVC_CTRL 0x0124
87+
#define DAP_AVC_THRESHOLD 0x0126
88+
#define DAP_AVC_ATTACK 0x0128
89+
#define DAP_AVC_DECAY 0x012A
90+
#define DAP_COEF_WR_B1_MSB 0x012C
91+
#define DAP_COEF_WR_B1_LSB 0x012E
92+
#define DAP_COEF_WR_B2_MSB 0x0130
93+
#define DAP_COEF_WR_B2_LSB 0x0132
94+
#define DAP_COEF_WR_A1_MSB 0x0134
95+
#define DAP_COEF_WR_A1_LSB 0x0136
96+
#define DAP_COEF_WR_A2_MSB 0x0138
97+
#define DAP_COEF_WR_A2_LSB 0x013A
98+
/*! @brief SGTL5000 I2C address. */
99+
#define SGTL5000_I2C_ADDR 0x0A
100+
101+
/*! @brief Sgtl5000 return status. */
102+
typedef enum _sgtl5000_status
103+
{
104+
kStatus_SGTL_Success,
105+
kStatus_SGTL_Fail
106+
} sgtl_status_t;
107+
108+
/*! @brief sgtl configure definition. */
109+
typedef struct sgtl_handler
110+
{
111+
/* I2C revelant definition. */
112+
i2c_device_t device; /*!< I2C device setting */
113+
i2c_master_t master; /*!< I2C master setting */
114+
} sgtl_handler_t;
115+
116+
/*******************************************************************************
117+
* API
118+
******************************************************************************/
119+
#if defined(__cplusplus)
120+
extern "C" {
121+
#endif
122+
123+
/*!
124+
* @brief sgtl5000 initialize function.
125+
*
126+
* This function would call sgtl_i2c_init(), and in this fuction, some configurations
127+
* are fixed. The second parameter is NULL to sgtl5000 in this version. If users want
128+
* to change the settings, they have to use sgtl_write_reg() or sgtl_modify_reg()
129+
* to set the register value of sgtl5000.
130+
* @param handler Sgtl5000 handler structure.
131+
* @param codec_config sgtl5000 configuration structure. This parameter now is NULL.
132+
*/
133+
sgtl_status_t sgtl_init(sgtl_handler_t *handler, void *codec_config);
134+
135+
/*!
136+
* @brief Initialize the I2C module in sgtl.
137+
*
138+
* Sgtl now uses i2c to write/read the registers in it.
139+
* @param handler Sgtl5000 handler structure.
140+
*/
141+
sgtl_status_t sgtl_i2c_init(sgtl_handler_t *handler);
142+
143+
/*!
144+
* @brief Deinit the sgtl5000 codec. Mainly used to close the I2C controller.
145+
* @param handler Sgtl5000 handler structure pointer.
146+
*/
147+
sgtl_status_t sgtl_deinit(sgtl_handler_t *handler);
148+
149+
/*!
150+
* @brief Configure the data foramt of audio data.
151+
*
152+
* This function would configure the registers about the sample rate, bit depths.
153+
* @param handler Sgtl5000 handler structure pointer.
154+
* @param mclk Master clock frequency of I2S.
155+
* @param sample_rate Sample rate of audio file running in sgtl5000. Sgtl5000 now
156+
* supports 8k, 11.025k, 12k, 16k, 22.05k, 24k, 32k, 44.1k, 48k and 96k sample rate.
157+
* @param bits Bit depth of audio file (Sgtl5000 only supports 16bit, 20bit, 24bit
158+
* and 32 bit in HW).
159+
*/
160+
sgtl_status_t sgtl_configure_data_format(sgtl_handler_t *handler, uint32_t mclk, uint32_t sample_rate, uint8_t bits);
161+
162+
/*!
163+
* @brief Write register to sgtl using I2C.
164+
* @param handler Sgtl5000 handler structure.
165+
* @param reg The register address in sgtl.
166+
* @param val Value needs to write into the register.
167+
*/
168+
sgtl_status_t sgtl_write_reg(sgtl_handler_t *handler, uint16_t reg, uint16_t val);
169+
170+
/*!
171+
* @brief Read register from sgtl using I2C.
172+
* @param handler Sgtl5000 handler structure.
173+
* @param reg The register address in sgtl.
174+
* @param val Value written to.
175+
*/
176+
sgtl_status_t sgtl_read_reg(sgtl_handler_t * handler, uint16_t reg, uint16_t *val);
177+
178+
/*!
179+
* @brief Modify some bits in the register using I2C.
180+
* @param handler Sgtl5000 handler structure.
181+
* @param reg The register address in sgtl.
182+
* @param mask The mask code for the bits want to write. The bit you want to write should be 0.
183+
* @param val Value needs to write into the register.
184+
*/
185+
sgtl_status_t sgtl_modify_reg(sgtl_handler_t * handler, uint16_t reg, uint16_t mask, uint16_t val);
186+
187+
#if defined(__cplusplus)
188+
}
189+
#endif
190+
191+
/*! @} */
192+
193+
#endif/* __FSL_SGTL_5000_DRIVER_H__ */
194+
195+
/*******************************************************************************
196+
* API
197+
******************************************************************************/
198+

0 commit comments

Comments
 (0)