SDK v2.11.1

This commit is contained in:
imi415 2022-04-08 22:48:22 +08:00
parent 0ab2448a3e
commit 864dc66c9e
Signed by: imi415
GPG Key ID: 885EC2B5A8A6F8A7
520 changed files with 4494 additions and 12922 deletions

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ksdk:manifest xmlns:ksdk="http://nxp.com/ksdk/2.0/ksdk_manifest_v3.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="SDK_2.x_LPC55S69" name="LPC55S69" brief="This is SDK version 2.11.0 manifest file. It describes the content of the LPC55S69 and additional settings for tools that support SDK version 2.11.0" format_version="3.9" api_version="2.0.0" configuration="f30e89ea41e7bad154eb22d8e458836d" xsi:schemaLocation="http://nxp.com/ksdk/2.0/ksdk_manifest_v3.0.xsd http://nxp.com/mcuxpresso/sdk/sdk_manifest_v3.9.xsd">
<!--Timestamp (UTC): 2022-01-14 23:12:05.332913-->
<!--This manifest is generated based on sdk repo commit: 8b51d89d559eab0d6f538a2026d1d5438333b315-->
<ksdk:manifest xmlns:ksdk="http://nxp.com/ksdk/2.0/ksdk_manifest_v3.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="SDK_2.x_LPC55S69" name="LPC55S69" brief="This is SDK version 2.11.1 manifest file. It describes the content of the LPC55S69 and additional settings for tools that support SDK version 2.11.1" format_version="3.9" api_version="2.0.0" configuration="a975ea70b76dfee1c9520eceb7e0bdf1" xsi:schemaLocation="http://nxp.com/ksdk/2.0/ksdk_manifest_v3.0.xsd http://nxp.com/mcuxpresso/sdk/sdk_manifest_v3.9.xsd">
<!--Timestamp (UTC): 2022-03-24 13:43:06.497920-->
<!--This manifest is generated based on sdk repo commit: ffad758dc1bcbaea4db7161533a769680421b275-->
<defines>
<define name="CPU_$|package|" value=""/>
<define name="CPU_$|package|_$|core|" value=""/>
<define name="CPU_$|package|_$|core_name|" value=""/>
</defines>
<ksdk id="MCUXpresso2110" name="MCUXpresso2110" version="2.11.0" revision="541 2022-01-14"/>
<ksdk id="MCUXpresso2111" name="MCUXpresso2111" version="2.11.1" revision="563 2022-03-24"/>
<compilers>
<compiler id="compiler_gcc" name="gcc" type="gcc"/>
</compilers>
@ -37,7 +37,7 @@
</toolchainSetting>
</toolchainSettings>
<toolchains>
<toolchain id="armgcc" name="GCC_ARM_Embedded" version="10.2.1" full_name="GCC ARM Embedded" compiler="compiler_gcc" type="armgcc" vendor="GCC ARM Embedded" vendor_url="http://launchpad.net/gcc-arm-embedded"/>
<toolchain id="armgcc" name="GCC_ARM_Embedded" version="10.3.1" full_name="GCC ARM Embedded" compiler="compiler_gcc" type="armgcc" vendor="GCC ARM Embedded" vendor_url="http://launchpad.net/gcc-arm-embedded"/>
<toolchain id="mcuxpresso" name="MCUXpresso_IDE" version="11.5.0" full_name="MCUXpresso IDE" compiler="compiler_gcc" type="mcuxpresso" vendor="NXP Semiconductors" vendor_url="http://www.nxp.com">
<debug>
<debug_configuration id="com.crt.advproject.config.exe.release" name="Release Configuration" probe="LinkServer">
@ -957,6 +957,11 @@ ${load}</script>
<files mask="maestro_playback_v3_9.xml"/>
</external>
</example>
<example id="lpcxpresso55s69_maestro_record" name="maestro_record" brief="Audio maestro framework demo example." toolchain="armgcc mcuxpresso" compiler="compiler_gcc" category="audio_examples" path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0">
<external path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" type="xml">
<files mask="maestro_record_v3_9.xml"/>
</external>
</example>
<example id="lpcxpresso55s69_maestro_usb_mic" name="maestro_usb_mic" brief="Audio maestro framework USB microphone example." toolchain="armgcc mcuxpresso" compiler="compiler_gcc" category="audio_examples" path="boards/lpcxpresso55s69/audio_examples/maestro_usb_mic/cm33_core0">
<external path="boards/lpcxpresso55s69/audio_examples/maestro_usb_mic/cm33_core0" type="xml">
<files mask="maestro_usb_mic_v3_9.xml"/>
@ -1529,34 +1534,6 @@ ${load}</script>
</example>
</examples>
</board>
<board id="lpcxpresso55s69_agm01" name="LPCXPRESSO55S69-AGM01" href="https://www.nxp.com/pip/FRDM-STBC-AGM01" version="1.0.0" package="LPC55S69JBD100" type="kit">
<description>LPCXpresso Development Board for LPC55S6x family of MCUs with 9-Axis sensor shield board FRDM-STBC-AGM01 having FXAS21002C Gyroscope &amp; FXOS8700CQ E-compass sensors</description>
<image path="boards/lpcxpresso55s69_agm01" type="image">
<files mask="lpcxpresso55s69_agm01.png"/>
</image>
<examples>
<example id="lpcxpresso55s69_agm01_fxas21002_fifo_niobe4" name="fxas21002_fifo_niobe4" brief="The FXAS21002 FIFO example application demonstrates the use of the FXAS21002 sensor in Buffered (FIFO) Mode.The example demonstrates configuration of all registers reguired to put the sensor in FIFO Mode and read out samples.The sensor reads samples and are buffered upto the configured Water Mark Level and then a Flag is set.The application consistently checks the Flag and when set, reads out all(count=Water Mark Level) samples." toolchain="armgcc mcuxpresso" compiler="compiler_gcc" category="issdk/sensors" path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxas21002/fxas21002_fifo">
<external path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxas21002/fxas21002_fifo" type="xml">
<files mask="fxas21002_fifo_niobe4_v3_9.xml"/>
</external>
</example>
<example id="lpcxpresso55s69_agm01_fxas21002_poll_niobe4" name="fxas21002_poll_niobe4" brief="The FXAS21002 Poll example application demonstrates the use of the FXAS21002 sensor in the Poll (Non-Buffered) Mode. The example demonstrates configuration of all registers reguired to put the sensor into Poll Mode and read out a sample." toolchain="armgcc mcuxpresso" compiler="compiler_gcc" category="issdk/sensors" path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxas21002/fxas21002_poll">
<external path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxas21002/fxas21002_poll" type="xml">
<files mask="fxas21002_poll_niobe4_v3_9.xml"/>
</external>
</example>
<example id="lpcxpresso55s69_agm01_fxos8700_fifo_niobe4" name="fxos8700_fifo_niobe4" brief="The FXAS8700 FIFO example application demonstrates the use of the FXAS8700 sensor in Buffered (FIFO) Mode.The example demonstrates configuration of all registers reguired to put the sensor in FIFO Mode and read out samples.The sensor reads samples and are buffered upto the configured Water Mark Level and then a Flag is set.The application consistently checks the Flag and when set, reads out all(count=Water Mark Level) samples." toolchain="armgcc mcuxpresso" compiler="compiler_gcc" category="issdk/sensors" path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxos8700/fxos8700_fifo">
<external path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxos8700/fxos8700_fifo" type="xml">
<files mask="fxos8700_fifo_niobe4_v3_9.xml"/>
</external>
</example>
<example id="lpcxpresso55s69_agm01_fxos8700_poll_niobe4" name="fxos8700_poll_niobe4" brief="The FXOS8700 Poll example application demonstrates the use of the FXOS8700 sensor in the Poll (Non-Buffered) Mode. The example demonstrates configuration of all registers reguired to put the sensor into Poll Mode and read out a sample." toolchain="armgcc mcuxpresso" compiler="compiler_gcc" category="issdk/sensors" path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxos8700/fxos8700_poll">
<external path="boards/lpcxpresso55s69_agm01/issdk_examples/sensors/fxos8700/fxos8700_poll" type="xml">
<files mask="fxos8700_poll_niobe4_v3_9.xml"/>
</external>
</example>
</examples>
</board>
</boards>
<devices>
<device id="LPC55S69" name="LPC55S69" version="1.0.0" full_name="LPC55S69" family="LPC55S6x" platform="LPC">
@ -1653,39 +1630,6 @@ ${load}</script>
<include_path relative_path="./" type="c_include"/>
</include_paths>
</component>
<component id="project_template.lpcxpresso55s69_agm01.LPC55S69" name="lpcxpresso55s69_agm01" brief="Board_project_template lpcxpresso55s69_agm01" version="1.0.0" full_name="Board_project_template lpcxpresso55s69_agm01" devices="LPC55S69" device_cores="cm33_core0_LPC55S69 cm33_core1_LPC55S69" slave_roles="M33SLAVE" category="Board Support/SDK Project Template" user_visible="true" type="project_template" package_base_path="boards/lpcxpresso55s69_agm01/project_template" project_base_path="lpcxpresso55s69_agm01/project_template">
<dependencies>
<all>
<component_dependency value="platform.drivers.flexcomm_usart.LPC55S69"/>
<component_dependency value="platform.drivers.flexcomm.LPC55S69"/>
<component_dependency value="platform.drivers.lpc_iocon.LPC55S69"/>
<component_dependency value="platform.drivers.lpc_gpio.LPC55S69"/>
<component_dependency value="platform.drivers.common.LPC55S69"/>
<component_dependency value="platform.drivers.clock.LPC55S69"/>
<component_dependency value="platform.drivers.power.LPC55S69"/>
<component_dependency value="utility.debug_console.LPC55S69"/>
<component_dependency value="component.usart_adapter.LPC55S69"/>
<component_dependency value="component.serial_manager_uart.LPC55S69"/>
<component_dependency value="component.serial_manager.LPC55S69"/>
<component_dependency value="platform.devices.LPC55S69_startup.LPC55S69"/>
</all>
</dependencies>
<source relative_path="./" type="src">
<files mask="board.c"/>
<files mask="clock_config.c"/>
<files mask="pin_mux.c"/>
<files mask="peripherals.c"/>
</source>
<source relative_path="./" type="c_include">
<files mask="board.h"/>
<files mask="clock_config.h"/>
<files mask="pin_mux.h"/>
<files mask="peripherals.h"/>
</source>
<include_paths>
<include_path relative_path="./" type="c_include"/>
</include_paths>
</component>
<component id="CMSIS_DSP_Library.LPC55S69" name="CMSIS_DSP_Library" brief="CMSIS-DSP Library for Cortex-M, SC000, and SC300" version="1.7.0" full_name="CMSIS DSP Library" devices="LPC55S69" user_visible="true" type="CMSIS_driver" package_base_path="CMSIS/DSP" project_base_path="CMSIS/DSP">
<source relative_path="Include" type="c_include">
<files mask="arm_common_tables.h"/>
@ -39141,6 +39085,7 @@ ${load}</script>
</source>
<include_paths>
<include_path relative_path="libraries/coreHTTP/source/include" type="c_include"/>
<include_path relative_path="libraries/coreHTTP/source/interface" type="c_include"/>
</include_paths>
</component>
<component id="middleware.freertos-aws_iot.libraries.corehttp.test.LPC55S69" name="AWS IoT coreHTTP test" brief="AWS IoT coreHTTP test" version="202107.00.0" revision="1" full_name="AWS IoT coreHTTP test" devices="LPC55S69" category="AWS IoT/AWS common libraries" user_visible="true" type="middleware" package_base_path="rtos/freertos" project_base_path="freertos">
@ -44816,6 +44761,15 @@ ${load}</script>
<source toolchain="armgcc mcuxpresso" relative_path="libs/cm33f/armgcc/release" type="lib" device_cores="cm33_core0_LPC55S69 cm33_core1_LPC55S69">
<files mask="libwav.a"/>
</source>
<source exclude="true" relative_path="mcu-audio/ogg" type="other">
<files mask="COPYING" hidden="true"/>
</source>
<source exclude="true" relative_path="mcu-audio/opus" type="other">
<files mask="COPYING" hidden="true"/>
</source>
<source exclude="true" relative_path="mcu-audio/opusfile" type="other">
<files mask="COPYING" hidden="true"/>
</source>
<source toolchain="armgcc" relative_path="." type="workspace" device_cores="cm33_core0_LPC55S69">
<files mask="middleware_maestro_framework_LPC55S69_cm33_core0.cmake" hidden="true"/>
</source>

View File

@ -1,5 +1,5 @@
Release Name: MCUXpresso Software Development Kit (SDK)
Release Version: 2.11.0
Release Version: 2.11.1
Package License: LA_OPT_NXP_Software_License.txt - Additional Distribution License granted, license in Section 2.3 applies
SDK_Peripheral_Driver Name: SDK Peripheral Driver
@ -270,7 +270,7 @@ fatfs Name: FatFs
Url: http://elm-chan.org/fsw/ff/00index_e.html
mbedtls Name: Mbed TLS
Version: 2.26.0
Version: 2.27.0
Outgoing License: Apache-2.0
License File: middleware/mbedtls/LICENSE
Format: source code
@ -466,7 +466,11 @@ maestro Name: Maestro Audio Framework
Format: Source
Description: Maestro MCU Audio Framework
Location: middleware/maestro
Origin: NXP
Origin: NXP (Proprietary) Ogg (BSD 3-clause) Opus
(BSD 3-clause) Opusfile (BSD 3-clause)
Url: https://github.com/xiph/ogg
https://github.com/xiph/opus
https://github.com/xiph/opusfile
EAP Name: EAP
Version: 3.0.12
@ -573,7 +577,7 @@ freertos_corehttp name: FreeRTOS coreHTTP library
version: 2.0.1
Outgoing License: MIT
License File:
rtos/freertos/librarires/coreHTTP/LICENSE
rtos/freertos/libraries/coreHTTP/LICENSE
Format: source code, header files
Description: C language HTTP client library
designed for embedded platforms

View File

@ -78,7 +78,7 @@
#endif
#define configAPPLICATION_ALLOCATED_HEAP 0
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configRECORD_STACK_HIGH_ADDRESS 1
/* Hook function related definitions. */

View File

@ -11,7 +11,11 @@
#include <stdint.h>
#include <streamer_element_properties.h>
#ifdef CPU_LPC55S69JBD100_cm33_core0
#define EAP_MAX_PRESET 6
#else
#define EAP_MAX_PRESET 10
#endif
typedef struct _app_data
{

View File

@ -18,11 +18,8 @@
#define DEMO_I2C (I2C4)
#define DEMO_I2S_MASTER_CLOCK_FREQUENCY (24576000)
#define DEMO_I2S_TX (I2S7)
#define DEMO_I2S_RX (I2S6)
#define DEMO_DMA (DMA0)
#define DEMO_I2S_TX_CHANNEL (19)
#define DEMO_I2S_RX_CHANNEL (16)
#define DEMO_I2S_RX_MODE (kI2S_MasterSlaveNormalSlave)
#define DEMO_I2S_TX_MODE (kI2S_MasterSlaveNormalMaster)
#define DEMO_CHANNEL_NUM (2)
/*${macro:end}*/

View File

@ -50,63 +50,63 @@ typedef struct _eap_preset_t
LVM_HeadroomParams_t *headroomParams;
} eap_preset_t;
eap_preset_t eap_presets[EAP_MAX_PRESET] = {{.name = "AllEffectOff",
.controlParams = &ControlParamSet_allEffectOff,
.instParams = &InstParams_allEffectOff,
.headroomParams = &HeadroomParams_allEffectOff},
{.name = "VoiceEnhancer",
eap_preset_t eap_presets[] = {{.name = "AllEffectOff",
.controlParams = &ControlParamSet_allEffectOff,
.instParams = &InstParams_allEffectOff,
.headroomParams = &HeadroomParams_allEffectOff},
{.name = "VoiceEnhancer",
#ifdef CPU_LPC55S69JBD100_cm33_core0
.controlParams = &ControlParamSet_voiceEnhancer_lowMIPS,
.instParams = &InstParams_voiceEnhancer_lowMIPS,
.headroomParams = &HeadroomParams_voiceEnhancer_lowMIPS},
.controlParams = &ControlParamSet_voiceEnhancer_lowMIPS,
.instParams = &InstParams_voiceEnhancer_lowMIPS,
.headroomParams = &HeadroomParams_voiceEnhancer_lowMIPS},
#else
.controlParams = &ControlParamSet_voiceEnhancer,
.instParams = &InstParams_voiceEnhancer,
.headroomParams = &HeadroomParams_voiceEnhancer},
#endif
{.name = "MusicEnhancer",
{.name = "MusicEnhancer",
#ifdef CPU_LPC55S69JBD100_cm33_core0
.controlParams = &ControlParamSet_musicEnhancerRmsLimiter_lowMIPS,
.instParams = &InstParams_musicEnhancerRmsLimiter_lowMIPS,
.headroomParams = &HeadroomParams_musicEnhancerRmsLimiter_lowMIPS},
.controlParams = &ControlParamSet_musicEnhancerRmsLimiter_lowMIPS,
.instParams = &InstParams_musicEnhancerRmsLimiter_lowMIPS,
.headroomParams = &HeadroomParams_musicEnhancerRmsLimiter_lowMIPS},
#else
.controlParams = &ControlParamSet_musicEnhancerRmsLimiter,
.instParams = &InstParams_musicEnhancerRmsLimiter,
.headroomParams = &HeadroomParams_musicEnhancerRmsLimiter},
#endif
{.name = "AutoVolumeLeveler",
.controlParams = &ControlParamSet_autoVolumeLeveler,
.instParams = &InstParams_autoVolumeLeveler,
.headroomParams = &HeadroomParams_autoVolumeLeveler},
{.name = "LoudnessMaximiser",
.controlParams = &ControlParamSet_loudnessMaximiser,
.instParams = &InstParams_loudnessMaximiser,
.headroomParams = &HeadroomParams_loudnessMaximiser},
{.name = "AutoVolumeLeveler",
.controlParams = &ControlParamSet_autoVolumeLeveler,
.instParams = &InstParams_autoVolumeLeveler,
.headroomParams = &HeadroomParams_autoVolumeLeveler},
{.name = "LoudnessMaximiser",
.controlParams = &ControlParamSet_loudnessMaximiser,
.instParams = &InstParams_loudnessMaximiser,
.headroomParams = &HeadroomParams_loudnessMaximiser},
#if (ALGORITHM_CS == 1)
{.name = "ConcertSound",
.controlParams = &ControlParamSet_concertSound,
.instParams = &InstParams_concertSound,
.headroomParams = &HeadroomParams_concertSound},
{.name = "ConcertSound",
.controlParams = &ControlParamSet_concertSound,
.instParams = &InstParams_concertSound,
.headroomParams = &HeadroomParams_concertSound},
#endif
#ifndef CPU_LPC55S69JBD100_cm33_core0
{.name = "Custom",
.controlParams = &ControlParamSet_custom,
.instParams = &InstParams_custom,
.headroomParams = &HeadroomParams_custom},
{.name = "Custom",
.controlParams = &ControlParamSet_custom,
.instParams = &InstParams_custom,
.headroomParams = &HeadroomParams_custom},
#endif
{.name = "ToneGenerator",
.controlParams = &ControlParamSet_toneGenerator,
.instParams = &InstParams_toneGenerator,
.headroomParams = &HeadroomParams_toneGenerator},
{.name = "ToneGenerator",
.controlParams = &ControlParamSet_toneGenerator,
.instParams = &InstParams_toneGenerator,
.headroomParams = &HeadroomParams_toneGenerator},
#if (ALGORITHM_XO == 1)
{.name = "Crossover2WaySpeakers",
.controlParams = &ControlParamSet_Crossover2WaySpeaker,
.instParams = &InstParams_Crossover2WaySpeaker,
.headroomParams = &HeadroomParams_Crossover2WaySpeaker},
{.name = "CrossoverForSubwoofer",
.controlParams = &ControlParamSet_CrossoverForSubwoofer,
.instParams = &InstParams_CrossoverForSubwoofer,
.headroomParams = &HeadroomParams_CrossoverForSubwoofer}
{.name = "Crossover2WaySpeakers",
.controlParams = &ControlParamSet_Crossover2WaySpeaker,
.instParams = &InstParams_Crossover2WaySpeaker,
.headroomParams = &HeadroomParams_Crossover2WaySpeaker},
{.name = "CrossoverForSubwoofer",
.controlParams = &ControlParamSet_CrossoverForSubwoofer,
.instParams = &InstParams_CrossoverForSubwoofer,
.headroomParams = &HeadroomParams_CrossoverForSubwoofer}
#endif
};
@ -142,8 +142,10 @@ static LVM_INT16 MallocAlign = 4; /* 4 byte Malloc alignment */
int EAP_Init(void *arg)
{
LVM_ReturnStatus_en LVM_Status; /* Function call status */
LVM_UINT16 i; /* loop index */
LVM_UINT16 i, minIdx; /* loop index */
LVM_INT32 temp32; /* temporary address */
LVM_INT16 j;
LVM_UINT16 order[LVM_NR_MEMORY_REGIONS];
/******************************************************************************
GET VERSION INFORMATION
@ -224,17 +226,38 @@ int EAP_Init(void *arg)
return LVM_Status;
}
/* Initialize order variable */
for (i = 0; i < LVM_NR_MEMORY_REGIONS; i++)
{
order[i] = i;
}
/* Sort region indexes by region size */
for (i = 0; i < (LVM_NR_MEMORY_REGIONS - 1); i++)
{
minIdx = i;
for (j = i + 1; j < LVM_NR_MEMORY_REGIONS; j++)
if (EAP_MemTab.Region[order[j]].Size < EAP_MemTab.Region[order[minIdx]].Size)
minIdx = j;
/* Swap indexes */
temp32 = order[minIdx];
order[minIdx] = order[i];
order[i] = temp32;
}
/* Allocate regions in order from largest to smallest */
for (j = (LVM_NR_MEMORY_REGIONS - 1); j >= 0; j--)
{
/* Log the memory size */
if (EAP_MemTab.Region[i].Size != 0)
if (EAP_MemTab.Region[order[j]].Size != 0)
{
temp32 = (LVM_INT32)osa_malloc(EAP_MemTab.Region[i].Size + (LVM_UINT32)MallocAlign);
temp32 = (LVM_INT32)osa_malloc(EAP_MemTab.Region[order[j]].Size + (LVM_UINT32)MallocAlign);
if (!temp32)
{
return LVM_NULLADDRESS;
}
EAP_MemTab.Region[i].pBaseAddress = (LVM_INT8 *)(temp32 + MallocAlign);
EAP_MemTab.Region[order[j]].pBaseAddress = (LVM_INT8 *)(temp32 + MallocAlign);
}
}

View File

@ -40,9 +40,9 @@ Type "help" to see the command list. Similar description will be displayed on se
Toolchain supported
===================
- GCC ARM Embedded 10.2.1
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
- IAR embedded Workbench 9.10.2
- IAR embedded Workbench 9.20.2
Hardware requirements
=====================

View File

@ -37,8 +37,6 @@ void streamer_pcm_init(void)
/* Dummy I2S TX init for the EAP */
I2S_TxGetDefaultConfig(&pcmHandle.tx_config);
I2S_TxInit(DEMO_I2S_TX, &pcmHandle.tx_config);
pcmHandle.isFirstTx = 1;
}
pcm_rtos_t *streamer_pcm_open(uint32_t num_buffers)
@ -74,36 +72,33 @@ void streamer_pcm_rx_close(pcm_rtos_t *pcm)
int streamer_pcm_write(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
{
pcm->i2sTxTransfer.dataSize = size;
pcm->i2sTxTransfer.data = data;
/* Ensure write size is a multiple of 32, otherwise EDMA will assert
* failure. Round down for the last chunk of a file/stream. */
if (size % 32)
{
pcm->i2sTxTransfer.dataSize = size - (size % 32);
}
pcm->i2sTxTransfer.dataSize = size - (size % 32);
pcm->i2sTxTransfer.data = data;
if (pcm->isFirstTx)
{
/* need to queue two transmit buffers so when the first one
* finishes transfer, the other immediatelly starts */
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
pcm->isFirstTx = 0;
}
else
{
/* Wait for transfer to finish */
/* Wait for the previous transfer to finish */
if (xSemaphoreTake(pcm->semaphoreTX, portMAX_DELAY) != pdTRUE)
{
return -1;
}
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
}
return 0;
}
int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint8_t *data2, uint32_t size)
int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
{
return 0;
}
@ -111,8 +106,10 @@ int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint8_t *data2, uint32_t s
int streamer_pcm_setparams(
pcm_rtos_t *pcm, uint32_t sample_rate, uint32_t bit_width, uint8_t num_channels, bool tx, bool dummy_tx, int volume)
{
int ret = 0;
int divider = 0;
int ret = 0;
int divider = 0;
pcm->isFirstTx = tx ? 1U : pcm->isFirstTx;
pcm->sample_rate = sample_rate;
pcm->bit_width = bit_width;
pcm->num_channels = num_channels;
@ -169,7 +166,7 @@ int streamer_pcm_setparams(
I2S_TxTransferCreateHandleDMA(DEMO_I2S_TX, &pcmHandle.i2sTxHandle, &pcmHandle.i2sTxDmaHandle, TxCallback,
(void *)&pcmHandle);
ret = CODEC_SetMute(&codecHandle, kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight, true);
ret = streamer_pcm_set_volume(pcm, 0);
if (ret != kStatus_Success)
{
return 1;
@ -214,11 +211,6 @@ int streamer_pcm_set_volume(pcm_rtos_t *pcm, int volume)
{
int channel;
if (get_eap_att_control()->status == kAttPaused)
{
pcm->isFirstTx = 1;
}
channel = (pcm->num_channels == 1) ? kCODEC_PlayChannelHeadphoneLeft :
kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight;

View File

@ -62,8 +62,6 @@ BOARD_InitPins:
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '21', peripheral: FLEXCOMM6, signal: SCK, pin_signal: PIO0_10/FC6_SCK/CT_INP10/CTIMER2_MAT0/FC1_TXD_SCL_MISO_WS/SCT0_OUT2/SWO/SECURE_GPIO0_10/ADC0_1,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled, asw: enabled}
- {pin_num: '2', peripheral: FLEXCOMM6, signal: RXD_SDA_MOSI_DATA, pin_signal: PIO1_13/FC6_RXD_SDA_MOSI_DATA/CT_INP6/USB0_OVERCURRENTN/USB0_FRAME/SD0_CARD_DET_N,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '87', peripheral: FLEXCOMM6, signal: TXD_SCL_MISO_WS, pin_signal: PIO1_16/FC6_TXD_SCL_MISO_WS/CTIMER1_MAT3/SD0_CMD, mode: pullUp, slew_rate: fast, invert: disabled,
open_drain: disabled}
- {pin_num: '6', peripheral: SDIF, signal: SD0_CLK, pin_signal: PIO0_7/FC3_RTS_SCL_SSEL1/SD0_CLK/FC5_SCK/FC1_SCK/SECURE_GPIO0_7, mode: inactive, slew_rate: fast,
@ -192,21 +190,6 @@ void BOARD_InitPins(void)
/* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */
IOCON_PinMuxSet(IOCON, 0U, 30U, port0_pin30_config);
const uint32_t port1_pin13_config = (/* Pin is configured as FC6_RXD_SDA_MOSI_DATA */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN13 (coords: 2) is configured as FC6_RXD_SDA_MOSI_DATA */
IOCON_PinMuxSet(IOCON, 1U, 13U, port1_pin13_config);
const uint32_t port1_pin16_config = (/* Pin is configured as FC6_TXD_SCL_MISO_WS */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */

View File

@ -0,0 +1,194 @@
/*
* FreeRTOS Kernel V10.4.3
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
/* Ensure stdint is only used by the compiler, and not the assembler. */
#if defined( __ICCARM__ ) || defined( __ARMCC_VERSION ) || defined( __GNUC__)
#include <stdint.h>
extern uint32_t SystemCoreClock;
extern int DbgConsole_Printf( const char *fmt_s, ... );
extern void vLoggingPrintf( const char *pcFormat, ... );
#endif
#define configUSE_PREEMPTION 1
#define configUSE_TICKLESS_IDLE 0
#define configCPU_CLOCK_HZ (SystemCoreClock)
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES 7
#define configMINIMAL_STACK_SIZE ((unsigned short)90)
#define configMAX_TASK_NAME_LEN 20
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configUSE_QUEUE_SETS 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 0
#define configUSE_APPLICATION_TASK_TAG 0
/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#if (defined(CPU_MIMXRT1051DVL6B) || defined(CPU_MIMXRT1052DVL6B))
#define configTOTAL_HEAP_SIZE ((size_t) (252 * 1024))
#elif defined(CPU_LPC55S69JBD100_cm33_core0)
#define configTOTAL_HEAP_SIZE ((size_t) (220 * 1024))
#else
#define configTOTAL_HEAP_SIZE ((size_t) (734 * 1024))
#endif
#define configAPPLICATION_ALLOCATED_HEAP 0
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configRECORD_STACK_HIGH_ADDRESS 1
/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
#define configUSE_TRACE_FACILITY 0
/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 3)
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 4)
/* Define to trap errors during development. */
#define configASSERT(x) if((x) == 0) {taskDISABLE_INTERRUPTS(); for (;;);}
/* Optional functions - most linkers will remove unused functions anyway. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetIdleTaskHandle 0
#define INCLUDE_eTaskGetState 0
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTaskAbortDelay 0
#define INCLUDE_xTaskGetHandle 0
/* Demo specific macros that allow the application writer to insert code to be
* executed immediately before the MCU's STOP low power mode is entered and exited
* respectively. These macros are in addition to the standard
* configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros, which are
* called pre and post the low power SLEEP mode being entered and exited. These
* macros can be used to turn turn off and on IO, clocks, the Flash etc. to obtain
* the lowest power possible while the tick is off. */
#if defined( __ICCARM__ ) || defined( __CC_ARM ) || defined( __GNUC__ )
void vMainPreStopProcessing( void );
void vMainPostStopProcessing( void );
#endif /* defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) */
#define configPRE_STOP_PROCESSING vMainPreStopProcessing
#define configPOST_STOP_PROCESSING vMainPostStopProcessing
#if defined(__ICCARM__)||defined(__CC_ARM)||defined(__GNUC__)
/* Clock manager provides in this variable system core clock frequency */
#include <stdint.h>
extern uint32_t SystemCoreClock;
#endif
#ifndef configENABLE_FPU
#define configENABLE_FPU 1
#endif
#ifndef configENABLE_MPU
#define configENABLE_MPU 0
#endif
#ifndef configENABLE_TRUSTZONE
#define configENABLE_TRUSTZONE 0
#endif
#ifndef configRUN_FREERTOS_SECURE_ONLY
#define configRUN_FREERTOS_SECURE_ONLY 1
#endif
/* Interrupt nesting behaviour configuration. Cortex-M specific. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 3 /* 8 priority levels */
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1U << (configPRIO_BITS)) - 1)
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names. */
#define vPortSVCHandler SVC_Handler
#define vPortPendSVHandler PendSV_Handler
#define vPortSysTickHandler SysTick_Handler
#endif /* FREERTOS_CONFIG_H */

View File

@ -0,0 +1,32 @@
/*
* Copyright 2021 NXP
* All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _APP_DEFINITIONS_H_
#define _APP_DEFINITIONS_H_
/*${header:start}*/
/*${header:end}*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*${macro:start}*/
#define DEMO_I2C (I2C4)
#define DEMO_I2S_MASTER_CLOCK_FREQUENCY (24576000)
#define DEMO_I2S_TX (I2S7)
#define DEMO_I2S_RX (I2S6)
#define DEMO_DMA (DMA0)
#define DEMO_I2S_TX_CHANNEL (19)
#define DEMO_I2S_RX_CHANNEL (16)
#define DEMO_I2S_RX_MODE (kI2S_MasterSlaveNormalSlave)
#define DEMO_I2S_TX_MODE (kI2S_MasterSlaveNormalMaster)
#define DEMO_CHANNEL_NUM (2)
#define DEMO_VOLUME (75)
/*${macro:end}*/
#endif /* _APP_DEFINITIONS_H_ */

View File

@ -0,0 +1,439 @@
/*
* Copyright 2020-2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "osa_common.h"
#include "fsl_common.h"
#include "fsl_debug_console.h"
#include "app_streamer.h"
#include "streamer_pcm_app.h"
#ifdef VIT_PROC
#include "vit_proc.h"
#endif
#include "app_definitions.h"
#define APP_STREAMER_MSG_QUEUE "app_queue"
#define STREAMER_TASK_NAME "Streamer"
#define STREAMER_MESSAGE_TASK_NAME "StreamerMessage"
#ifdef OPUS_ENCODE
#define STREAMER_OPUS_TASK_STACK_SIZE 60 * 1024
#endif
#define STREAMER_TASK_STACK_SIZE 4 * 1024
#define STREAMER_MESSAGE_TASK_STACK_SIZE 512
#define MAX_FILE_NAME_LENGTH 100
ringbuf_t *audioBuffer;
OsaMutex audioMutex;
OsaThread msg_thread;
/*!
* @brief Streamer task for communicating messages
*
* This function is the entry point of a task that is manually created by
* STREAMER_Create. It listens on a message queue and receives status updates
* about errors, audio playback state and position. The application can make
* use of this data.
*
* @param arg Data to be passed to the task
*/
static void STREAMER_MessageTask(void *arg)
{
OsaMq mq;
STREAMER_MSG_T msg;
streamer_handle_t *handle;
bool exit_thread = false;
int ret;
handle = (streamer_handle_t *)arg;
PRINTF("[STREAMER] Message Task started\r\n");
ret = osa_mq_open(&mq, APP_STREAMER_MSG_QUEUE, STREAMER_MSG_SIZE, true);
if (ERRCODE_NO_ERROR != ret)
{
PRINTF("osa_mq_open failed: %d\r\n", ret);
return;
}
do
{
ret = osa_mq_receive(&mq, (void *)&msg, STREAMER_MSG_SIZE, 0, NULL);
if (ret != ERRCODE_NO_ERROR)
{
PRINTF("osa_mq_receiver error: %d\r\n", ret);
continue;
}
switch (msg.id)
{
case STREAM_MSG_ERROR:
PRINTF("STREAM_MSG_ERROR\r\n");
exit_thread = true;
STREAMER_Stop(handle);
break;
case STREAM_MSG_EOS:
PRINTF("\nSTREAM_MSG_EOS\r\n");
exit_thread = true;
/* Indicate to other software layers that playing has ended. */
STREAMER_Stop(handle);
break;
case STREAM_MSG_UPDATE_POSITION:
PRINTF("STREAM_MSG_UPDATE_POSITION..");
PRINTF(" position: %d ms\r", msg.event_data);
break;
case STREAM_MSG_CLOSE_TASK:
PRINTF("STREAM_MSG_CLOSE_TASK\r\n");
exit_thread = true;
break;
default:
break;
}
} while (!exit_thread);
osa_mq_close(&mq);
osa_mq_destroy(APP_STREAMER_MSG_QUEUE);
osa_thread_destroy(msg_thread);
}
int STREAMER_Read(uint8_t *data, uint32_t size)
{
uint32_t bytes_read;
osa_mutex_lock(&audioMutex);
bytes_read = ringbuf_read(audioBuffer, data, size);
osa_mutex_unlock(&audioMutex);
if (bytes_read != size)
{
PRINTF("[STREAMER WARN] read underrun: size: %d, read: %d\r\n", size, bytes_read);
}
return bytes_read;
}
int STREAMER_Write(uint8_t *data, uint32_t size)
{
uint32_t written;
osa_mutex_lock(&audioMutex);
written = ringbuf_write(audioBuffer, data, size);
osa_mutex_unlock(&audioMutex);
if (written != size)
{
PRINTF("[STREAMER ERR] write overflow: size %d, written %d\r\n", size, written);
}
return written;
}
bool STREAMER_IsPlaying(streamer_handle_t *handle)
{
return handle->audioPlaying;
}
void STREAMER_Start(streamer_handle_t *handle)
{
PRINTF("[STREAMER] start \r\n");
handle->audioPlaying = true;
streamer_set_state(handle->streamer, 0, STATE_PLAYING, true);
}
void STREAMER_Stop(streamer_handle_t *handle)
{
PRINTF("[STREAMER] stop \r\n");
handle->audioPlaying = false;
streamer_set_state(handle->streamer, 0, STATE_NULL, true);
/* Empty input ringbuffer. */
if (audioBuffer)
{
ringbuf_clear(audioBuffer);
}
}
status_t STREAMER_Create(streamer_handle_t *handle)
{
STREAMER_CREATE_PARAM params;
ELEMENT_PROPERTY_T prop;
OsaThreadAttr thread_attr;
int ret;
osa_mutex_create(&audioMutex, false);
audioBuffer = ringbuf_create(AUDIO_BUFFER_SIZE);
if (!audioBuffer)
{
return kStatus_Fail;
}
/* Create message process thread */
osa_thread_attr_init(&thread_attr);
osa_thread_attr_set_name(&thread_attr, STREAMER_MESSAGE_TASK_NAME);
osa_thread_attr_set_stack_size(&thread_attr, STREAMER_MESSAGE_TASK_STACK_SIZE);
ret = osa_thread_create(&msg_thread, &thread_attr, STREAMER_MessageTask, (void *)handle);
osa_thread_attr_destroy(&thread_attr);
if (ERRCODE_NO_ERROR != ret)
{
return kStatus_Fail;
}
/* Create streamer */
strcpy(params.out_mq_name, APP_STREAMER_MSG_QUEUE);
params.stack_size = STREAMER_TASK_STACK_SIZE;
params.pipeline_type = STREAM_PIPELINE_NETBUF;
params.task_name = STREAMER_TASK_NAME;
params.in_dev_name = "";
params.out_dev_name = "";
handle->streamer = streamer_create(&params);
if (!handle->streamer)
{
return kStatus_Fail;
}
prop.prop = PROP_NETBUFSRC_SET_CALLBACK;
prop.val = (uintptr_t)STREAMER_Read;
streamer_set_property(handle->streamer, prop, true);
prop.prop = PROP_DECODER_DECODER_TYPE;
prop.val = DECODER_TYPE_MP3;
streamer_set_property(handle->streamer, prop, true);
handle->audioPlaying = false;
return kStatus_Success;
}
status_t STREAMER_mic_Create(streamer_handle_t *handle, out_sink_t out_sink, char *file_name)
{
STREAMER_CREATE_PARAM params;
OsaThreadAttr thread_attr;
ELEMENT_PROPERTY_T prop;
int ret;
/* Create message process thread */
osa_thread_attr_init(&thread_attr);
osa_thread_attr_set_name(&thread_attr, STREAMER_MESSAGE_TASK_NAME);
osa_thread_attr_set_stack_size(&thread_attr, STREAMER_MESSAGE_TASK_STACK_SIZE);
ret = osa_thread_create(&msg_thread, &thread_attr, STREAMER_MessageTask, (void *)handle);
osa_thread_attr_destroy(&thread_attr);
if (ERRCODE_NO_ERROR != ret)
{
return kStatus_Fail;
}
/* Create streamer */
strcpy(params.out_mq_name, APP_STREAMER_MSG_QUEUE);
params.stack_size = STREAMER_TASK_STACK_SIZE;
switch (out_sink)
{
case AUDIO_SINK:
params.pipeline_type = STREAM_PIPELINE_PCM;
params.out_dev_name = "";
break;
case FILE_SINK:
params.pipeline_type = STREAM_PIPELINE_MIC2FILE;
params.out_dev_name = "file";
break;
case VIT_SINK:
params.pipeline_type = STREAM_PIPELINE_VIT;
params.out_dev_name = "";
break;
default:
PRINTF("[STREAMER ERR] wrong type of sink\r\n");
return kStatus_InvalidArgument;
}
params.task_name = STREAMER_TASK_NAME;
params.in_dev_name = "microphone";
handle->streamer = streamer_create(&params);
if (!handle->streamer)
{
return kStatus_Fail;
}
#ifdef VIT_PROC
if (params.pipeline_type == STREAM_PIPELINE_VIT)
{
EXT_PROCESS_DESC_T vit_proc = {VIT_Initialize_func, VIT_Execute_func, VIT_Deinit_func, &Vit_Language, 0};
prop.prop = PROP_VITSINK_FPOINT;
prop.val = (uintptr_t)&vit_proc;
streamer_set_property(handle->streamer, prop, true);
}
#else
if (params.pipeline_type == STREAM_PIPELINE_VIT)
{
PRINTF("[STREAMER] VIT pipeline not available for this config\r\n switching to audio sink");
params.pipeline_type = STREAM_PIPELINE_PCM;
}
#endif
prop.prop = PROP_AUDIOSRC_SET_SAMPLE_RATE;
prop.val = 16000;
streamer_set_property(handle->streamer, prop, true);
#if DEMO_CODEC_CS42448
prop.prop = PROP_AUDIOSRC_SET_NUM_CHANNELS;
prop.val = 8;
streamer_set_property(handle->streamer, prop, true);
prop.prop = PROP_AUDIOSRC_SET_BITS_PER_SAMPLE;
prop.val = 32;
streamer_set_property(handle->streamer, prop, true);
#endif
if (out_sink == FILE_SINK)
{
char file_name_val[MAX_FILE_NAME_LENGTH];
memcpy(file_name_val, file_name == NULL ? "tmp" : file_name, MAX_FILE_NAME_LENGTH);
strcat(file_name_val, ".pcm");
prop.prop = PROP_FILESINK_LOCATION;
prop.val = (uintptr_t)file_name_val;
streamer_set_property(handle->streamer, prop, true);
}
return kStatus_Success;
}
#ifdef OPUS_ENCODE
status_t STREAMER_opusmem2mem_Create(streamer_handle_t *handle,
CeiBitstreamInfo *info,
MEMSRC_SET_BUFFER_T *inBuf,
SET_BUFFER_DESC_T *outBuf)
{
STREAMER_CREATE_PARAM params;
OsaThreadAttr thread_attr;
ELEMENT_PROPERTY_T prop;
int ret;
/* Create message process thread */
osa_thread_attr_init(&thread_attr);
osa_thread_attr_set_name(&thread_attr, STREAMER_MESSAGE_TASK_NAME);
osa_thread_attr_set_stack_size(&thread_attr, STREAMER_MESSAGE_TASK_STACK_SIZE);
ret = osa_thread_create(&msg_thread, &thread_attr, STREAMER_MessageTask, (void *)handle);
osa_thread_attr_destroy(&thread_attr);
if (ERRCODE_NO_ERROR != ret)
{
return kStatus_Fail;
}
/* Create streamer */
strcpy(params.out_mq_name, APP_STREAMER_MSG_QUEUE);
params.stack_size = STREAMER_OPUS_TASK_STACK_SIZE;
params.pipeline_type = STREAM_PIPELINE_OPUS_MEM2MEM;
params.task_name = STREAMER_TASK_NAME;
handle->streamer = streamer_create(&params);
if (!handle->streamer)
{
return kStatus_Fail;
}
prop.prop = PROP_MEMSRC_SET_BUFF;
prop.val = (uintptr_t)inBuf;
ret = streamer_set_property(handle->streamer, prop, true);
if (ret != STREAM_OK)
{
streamer_destroy(handle->streamer);
handle->streamer = NULL;
return kStatus_Fail;
}
prop.prop = PROP_MEMSINK_BUFFER_DESC;
prop.val = (uintptr_t)outBuf;
ret = streamer_set_property(handle->streamer, prop, true);
if (ret != STREAM_OK)
{
streamer_destroy(handle->streamer);
handle->streamer = NULL;
return kStatus_Fail;
}
prop.prop = PROP_ENCODER_TYPE;
prop.val = (uintptr_t)CEIENC_OPUS;
ret = streamer_set_property(handle->streamer, prop, true);
if (ret != STREAM_OK)
{
streamer_destroy(handle->streamer);
handle->streamer = NULL;
return kStatus_Fail;
}
prop.prop = PROP_ENCODER_BITSTREAMINFO;
prop.val = (uintptr_t)info;
ret = streamer_set_property(handle->streamer, prop, true);
if (ret != STREAM_OK)
{
streamer_destroy(handle->streamer);
handle->streamer = NULL;
return kStatus_Fail;
}
return kStatus_Success;
}
#endif
void STREAMER_Destroy(streamer_handle_t *handle)
{
streamer_destroy(handle->streamer);
handle->streamer = NULL;
if (audioMutex != NULL)
{
osa_mutex_destroy(&audioMutex);
audioMutex = NULL;
}
if (audioBuffer != NULL)
{
ringbuf_destroy(audioBuffer);
audioBuffer = NULL;
}
deinit_logging();
osa_deinit();
}
void STREAMER_Init(void)
{
/* Initialize OSA*/
osa_init();
/* Initialize logging */
init_logging();
add_module_name(LOGMDL_STREAMER, "STREAMER");
/* Uncomment below to turn on full debug logging for the streamer. */
// set_debug_module(0xffffffff);
// set_debug_level(LOGLVL_DEBUG);
// get_debug_state();
/* Initialize streamer PCM management library. */
streamer_pcm_init();
}

View File

@ -0,0 +1,164 @@
/*
* Copyright 2020-2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _FSL_STREAMER_H_
#define _FSL_STREAMER_H_
/* streamer library includes. */
#include "streamer_api.h"
#include "streamer_element_properties.h"
#include "streamer_error.h"
#ifdef OPUS_ENCODE
#include "opus.h"
#endif
#include "cei.h"
#include "cei_enctypes.h"
#ifdef VIT_PROC
#include "vit_proc.h"
#endif
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief Maestro network audio buffer size */
#define AUDIO_BUFFER_SIZE (30 * 1024)
/*! @brief Maestro Streamer interface structure */
typedef struct _streamer_handle_t
{
STREAMER_T *streamer;
volatile bool audioPlaying;
} streamer_handle_t;
typedef enum
{
AUDIO_SINK,
FILE_SINK,
VIT_SINK
} out_sink_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @brief Initialize the Maestro streamer interface
*
* This function initializes the Maestro streamer library, and initializes the PCM
* output interface. This function should be called before creating a streamer
* handle.
*/
void STREAMER_Init(void);
/*!
* @brief Create a Maestro streamer interface handle
*
* This function creates a Maestro streamer interface and starts a task for
* handling media playback, and a task for sending status and error messages
* back to the application.
*
* @param handle Pointer to input handle
* @return kStatus_Success on success, otherwise an error.
*/
status_t STREAMER_Create(streamer_handle_t *handle);
/*!
* @brief Create a Maestro streamer interface handle
*
* This function creates a Maestro streamer interface and starts a task for
* handling mic
*
* @param handle Pointer to input handle
* @param out sink type
* @param file_name The specified file name for saving samples. If not used, use NULL.
* @return kStatus_Success on success, otherwise an error.
*/
status_t STREAMER_mic_Create(streamer_handle_t *handle, out_sink_t out_sink, char *file_name);
#ifdef OPUS_ENCODE
status_t STREAMER_opusmem2mem_Create(streamer_handle_t *handle,
CeiBitstreamInfo *info,
MEMSRC_SET_BUFFER_T *inBuf,
SET_BUFFER_DESC_T *outBuf);
#endif
/*!
* @brief Destroy an Maestro streamer interface handle
*
* This function destroys an Maestro streamer interface and frees associated memory.
*
* @param handle Pointer to input handle
*/
void STREAMER_Destroy(streamer_handle_t *handle);
/*!
* @brief Start audio playback for the streamer interface
*
* This function puts the streamer in a playing state, and begins pulling data
* from the internal ring buffer, filled with calls to STREAMER_Start.
*
* @param handle Pointer to input handle
*/
void STREAMER_Start(streamer_handle_t *handle);
/*!
* @brief Stop audio playback for the streamer interface
*
* This function puts the streamer in a stopped state, and ends playback from
* the audio buffer. The internal audio buffer is cleared of any data.
*
* @param handle Pointer to input handle
*/
void STREAMER_Stop(streamer_handle_t *handle);
/*!
* @brief Check if streamer interface is playing
*
* This function returns true/false of the playing state for the interface
*
* @param handle Pointer to input handle
* @return true if playing, false if not
*/
bool STREAMER_IsPlaying(streamer_handle_t *handle);
/*!
* @brief Write audio data to the streamer interface
*
* This function pushes data onto the internal audio ring buffer for processing
* by the audio streamer.
*
* @param data Pointer to audio data
* @param size Size in bytes of the audio data
* @return Number of bytes successfully written. If this is less than the
* 'size' parameter, an overflow has occured.
*/
int STREAMER_Write(uint8_t *data, uint32_t size);
/*!
* @brief Read audio data from the internal audio ring buffer
*
* This function is called internally by the streamer (passed as a callback
* function) to consume and process data from the ring buffer.
*
* @param data Pointer to buffer to copy audio data into
* @param size Size in bytes of the buffer to fill
* @return Number of bytes successfully read. If this is less than the
* 'size' parameter, an underflow has occured.
*/
int STREAMER_Read(uint8_t *data, uint32_t size);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,248 @@
# CROSS COMPILER SETTING
SET(CMAKE_SYSTEM_NAME Generic)
CMAKE_MINIMUM_REQUIRED (VERSION 3.10.0)
# THE VERSION NUMBER
SET (Tutorial_VERSION_MAJOR 1)
SET (Tutorial_VERSION_MINOR 0)
# ENABLE ASM
ENABLE_LANGUAGE(ASM)
SET(CMAKE_STATIC_LIBRARY_PREFIX)
SET(CMAKE_STATIC_LIBRARY_SUFFIX)
SET(CMAKE_EXECUTABLE_LIBRARY_PREFIX)
SET(CMAKE_EXECUTABLE_LIBRARY_SUFFIX)
# CURRENT DIRECTORY
SET(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR})
SET(EXECUTABLE_OUTPUT_PATH ${ProjDirPath}/${CMAKE_BUILD_TYPE})
SET(LIBRARY_OUTPUT_PATH ${ProjDirPath}/${CMAKE_BUILD_TYPE})
project(maestro_record)
set(MCUX_SDK_PROJECT_NAME maestro_record.elf)
include(${ProjDirPath}/flags.cmake)
include(${ProjDirPath}/config.cmake)
add_executable(${MCUX_SDK_PROJECT_NAME}
"${ProjDirPath}/../streamer_pcm.c"
"${ProjDirPath}/../streamer_pcm_app.h"
"${ProjDirPath}/../app_streamer.c"
"${ProjDirPath}/../app_streamer.h"
"${ProjDirPath}/../cmd.c"
"${ProjDirPath}/../cmd.h"
"${ProjDirPath}/../main.c"
"${ProjDirPath}/../main.h"
"${ProjDirPath}/../../pin_mux.c"
"${ProjDirPath}/../../pin_mux.h"
"${ProjDirPath}/../FreeRTOSConfig.h"
"${ProjDirPath}/../ffconf.h"
"${ProjDirPath}/../sdmmc_config.c"
"${ProjDirPath}/../sdmmc_config.h"
"${ProjDirPath}/../app_definitions.h"
"${ProjDirPath}/../board.c"
"${ProjDirPath}/../board.h"
"${ProjDirPath}/../clock_config.c"
"${ProjDirPath}/../clock_config.h"
)
target_include_directories(${MCUX_SDK_PROJECT_NAME} PRIVATE
${ProjDirPath}/..
${ProjDirPath}/../..
${ProjDirPath}/../../../..
)
set(CMAKE_MODULE_PATH
${ProjDirPath}/../../../../../../rtos/freertos/freertos_kernel
${ProjDirPath}/../../../../../../components/codec/wm8904
${ProjDirPath}/../../../../../../components/codec
${ProjDirPath}/../../../../../../devices/LPC55S69/drivers
${ProjDirPath}/../../../../../../components/codec/i2c
${ProjDirPath}/../../../../../../components/i2c
${ProjDirPath}/../../../../../../middleware/sdmmc
${ProjDirPath}/../../../../../../devices/LPC55S69/utilities
${ProjDirPath}/../../../../../../middleware/maestro
${ProjDirPath}/../../../../../../middleware/fatfs
${ProjDirPath}/../../../../../../devices/LPC55S69
${ProjDirPath}/../../../../../../components/uart
${ProjDirPath}/../../../../../../components/serial_manager
${ProjDirPath}/../../../../../../components/lists
${ProjDirPath}/../../../../../../CMSIS/Core/Include
${ProjDirPath}/../../../../../../components/osa
)
# include modules
include(middleware_freertos-kernel_cm33_nonsecure_port_LPC55S69_cm33_core0)
include(driver_wm8904_LPC55S69_cm33_core0)
include(driver_codec_LPC55S69_cm33_core0)
include(driver_common_LPC55S69_cm33_core0)
include(component_wm8904_adapter_LPC55S69_cm33_core0)
include(component_codec_i2c_LPC55S69_cm33_core0)
include(component_flexcomm_i2c_adapter_LPC55S69_cm33_core0)
include(driver_sysctl_LPC55S69_cm33_core0)
include(middleware_sdmmc_sd_LPC55S69_cm33_core0)
include(middleware_sdmmc_common_LPC55S69_cm33_core0)
include(middleware_sdmmc_host_sdif_LPC55S69_cm33_core0)
include(middleware_sdmmc_host_sdif_freertos_LPC55S69_cm33_core0)
include(driver_lpc_iocon_LPC55S69_cm33_core0)
include(driver_flexcomm_i2c_LPC55S69_cm33_core0)
include(driver_flexcomm_i2s_LPC55S69_cm33_core0)
include(utility_shell_LPC55S69_cm33_core0)
include(driver_flexcomm_usart_LPC55S69_cm33_core0)
include(driver_lpc_dma_LPC55S69_cm33_core0)
include(driver_flexcomm_i2s_dma_LPC55S69_cm33_core0)
include(middleware_freertos-kernel_heap_4_LPC55S69_cm33_core0)
include(middleware_maestro_framework_LPC55S69_cm33_core0)
include(middleware_fatfs_LPC55S69_cm33_core0)
include(middleware_fatfs_sd_LPC55S69_cm33_core0)
include(driver_clock_LPC55S69_cm33_core0)
include(driver_power_LPC55S69_cm33_core0)
include(device_LPC55S69_CMSIS_LPC55S69_cm33_core0)
include(device_LPC55S69_startup_LPC55S69_cm33_core0)
include(driver_flexcomm_LPC55S69_cm33_core0)
include(driver_lpc_gpio_LPC55S69_cm33_core0)
include(utility_assert_LPC55S69_cm33_core0)
include(utility_debug_console_LPC55S69_cm33_core0)
include(component_usart_adapter_LPC55S69_cm33_core0)
include(component_serial_manager_LPC55S69_cm33_core0)
include(component_lists_LPC55S69_cm33_core0)
include(component_serial_manager_uart_LPC55S69_cm33_core0)
include(middleware_freertos-kernel_LPC55S69_cm33_core0)
include(middleware_freertos-kernel_extension_LPC55S69_cm33_core0)
include(driver_reset_LPC55S69_cm33_core0)
include(CMSIS_Include_core_cm_LPC55S69_cm33_core0)
include(middleware_sdmmc_osa_freertos_LPC55S69_cm33_core0)
include(component_osa_free_rtos_LPC55S69_cm33_core0)
include(driver_sdif_LPC55S69_cm33_core0)
include(middleware_maestro_framework_doc_LPC55S69_cm33_core0)
include(utilities_misc_utilities_LPC55S69_cm33_core0)
include(device_LPC55S69_system_LPC55S69_cm33_core0)
TARGET_LINK_LIBRARIES(${MCUX_SDK_PROJECT_NAME} PRIVATE -Wl,--start-group)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE m)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE c)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE gcc)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE nosys)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmaestro_streamer.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmaestro_cci.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmaestro_utils.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmp3.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libopus.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libogg.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libsrc48.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL debug)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libwav.a)
endif(CMAKE_BUILD_TYPE STREQUAL debug)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmaestro_streamer.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmaestro_cci.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmaestro_utils.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libmp3.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libopus.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libogg.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libsrc48.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
if(CMAKE_BUILD_TYPE STREQUAL release)
target_link_libraries(${MCUX_SDK_PROJECT_NAME} PRIVATE ${ProjDirPath}/../../../../../../middleware/maestro/libs/cm33f/armgcc/release/libwav.a)
endif(CMAKE_BUILD_TYPE STREQUAL release)
TARGET_LINK_LIBRARIES(${MCUX_SDK_PROJECT_NAME} PRIVATE -Wl,--end-group)

View File

@ -7,13 +7,13 @@
** Compiler: GNU C Compiler
** Reference manual: LPC55S6x/LPC55S2x/LPC552x User manual(UM11126) Rev.1.3 16 May 2019
** Version: rev. 1.1, 2019-05-16
** Build: b210928
** Build: b200722
**
** Abstract:
** Linker file for the GNU C Compiler
**
** Copyright 2016 Freescale Semiconductor, Inc.
** Copyright 2016-2021 NXP
** Copyright 2016-2020 NXP
** All rights reserved.
**
** SPDX-License-Identifier: BSD-3-Clause
@ -29,32 +29,23 @@
/* Entry Point */
ENTRY(Reset_Handler)
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800;
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x2000;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
RPMSG_SHMEM_SIZE = DEFINED(__use_shmem__) ? 0x1800 : 0;
/* Specify the memory areas */
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200
m_text (RX) : ORIGIN = 0x00000200, LENGTH = 0x00071E00
m_core1_image (RX) : ORIGIN = 0x00072000, LENGTH = 0x0002B800
m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00033000 - RPMSG_SHMEM_SIZE
rpmsg_sh_mem (RW) : ORIGIN = 0x20033000 - RPMSG_SHMEM_SIZE, LENGTH = RPMSG_SHMEM_SIZE
m_text (RX) : ORIGIN = 0x00000200, LENGTH = 0x00097E00
m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00040000 - RPMSG_SHMEM_SIZE
rpmsg_sh_mem (RW) : ORIGIN = 0x20040000 - RPMSG_SHMEM_SIZE, LENGTH = RPMSG_SHMEM_SIZE
m_usb_sram (RW) : ORIGIN = 0x40100000, LENGTH = 0x00004000
}
/* Define output sections */
SECTIONS
{
/* section for storing the secondary core image */
.core1_code :
{
. = ALIGN(4) ;
KEEP (*(.core1_code))
*(.core1_code*)
. = ALIGN(4) ;
} > m_core1_image
/* NOINIT section for rpmsg_sh_mem */
.noinit_rpmsg_sh_mem (NOLOAD) : ALIGN(4)

View File

@ -2,14 +2,14 @@ if exist CMakeFiles (RD /s /Q CMakeFiles)
if exist Makefile (DEL /s /Q /F Makefile)
if exist cmake_install.cmake (DEL /s /Q /F cmake_install.cmake)
if exist CMakeCache.txt (DEL /s /Q /F CMakeCache.txt)
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=debug .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=debug .
mingw32-make -j
if exist CMakeFiles (RD /s /Q CMakeFiles)
if exist Makefile (DEL /s /Q /F Makefile)
if exist cmake_install.cmake (DEL /s /Q /F cmake_install.cmake)
if exist CMakeCache.txt (DEL /s /Q /F CMakeCache.txt)
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=release .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=release .
mingw32-make -j
IF "%1" == "" ( pause )

View File

@ -3,13 +3,13 @@ if [ -d "CMakeFiles" ];then rm -rf CMakeFiles; fi
if [ -f "Makefile" ];then rm -f Makefile; fi
if [ -f "cmake_install.cmake" ];then rm -f cmake_install.cmake; fi
if [ -f "CMakeCache.txt" ];then rm -f CMakeCache.txt; fi
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug .
make -j
if [ -d "CMakeFiles" ];then rm -rf CMakeFiles; fi
if [ -f "Makefile" ];then rm -f Makefile; fi
if [ -f "cmake_install.cmake" ];then rm -f cmake_install.cmake; fi
if [ -f "CMakeCache.txt" ];then rm -f CMakeCache.txt; fi
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=release .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=release .
make -j

View File

@ -2,5 +2,5 @@ if exist CMakeFiles (RD /s /Q CMakeFiles)
if exist Makefile (DEL /s /Q /F Makefile)
if exist cmake_install.cmake (DEL /s /Q /F cmake_install.cmake)
if exist CMakeCache.txt (DEL /s /Q /F CMakeCache.txt)
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=debug .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=debug .
mingw32-make -j 2> build_log.txt

View File

@ -3,5 +3,5 @@ if [ -d "CMakeFiles" ];then rm -rf CMakeFiles; fi
if [ -f "Makefile" ];then rm -f Makefile; fi
if [ -f "cmake_install.cmake" ];then rm -f cmake_install.cmake; fi
if [ -f "CMakeCache.txt" ];then rm -f CMakeCache.txt; fi
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug .
make -j 2>&1 | tee build_log.txt

View File

@ -2,5 +2,5 @@ if exist CMakeFiles (RD /s /Q CMakeFiles)
if exist Makefile (DEL /s /Q /F Makefile)
if exist cmake_install.cmake (DEL /s /Q /F cmake_install.cmake)
if exist CMakeCache.txt (DEL /s /Q /F CMakeCache.txt)
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=debug .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=release .
mingw32-make -j 2> build_log.txt

View File

@ -3,5 +3,5 @@ if [ -d "CMakeFiles" ];then rm -rf CMakeFiles; fi
if [ -f "Makefile" ];then rm -f Makefile; fi
if [ -f "cmake_install.cmake" ];then rm -f cmake_install.cmake; fi
if [ -f "CMakeCache.txt" ];then rm -f CMakeCache.txt; fi
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug .
cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=release .
make -j 2>&1 | tee build_log.txt

View File

@ -0,0 +1,9 @@
# config to select component, the format is CONFIG_USE_${component}
set(CONFIG_USE_component_wm8904_adapter_LPC55S69_cm33_core0 true)
set(CONFIG_USE_component_flexcomm_i2c_adapter_LPC55S69_cm33_core0 true)
set(CONFIG_USE_middleware_sdmmc_host_sdif_LPC55S69_cm33_core0 true)
set(CONFIG_USE_middleware_sdmmc_host_sdif_freertos_LPC55S69_cm33_core0 true)
set(CONFIG_USE_middleware_fatfs_sd_LPC55S69_cm33_core0 true)
set(CONFIG_USE_driver_power_LPC55S69_cm33_core0 true)
set(CONFIG_USE_component_serial_manager_uart_LPC55S69_cm33_core0 true)
set(CONFIG_USE_driver_flexcomm_usart_LPC55S69_cm33_core0 true)

View File

@ -37,8 +37,15 @@ SET(CMAKE_C_FLAGS_DEBUG " \
${CMAKE_C_FLAGS_DEBUG} \
-DDEBUG \
-DCPU_LPC55S69JBD100_cm33_core0 \
-DSDK_I2C_BASED_COMPONENT_USED=1 \
-DBOARD_USE_CODEC=1 \
-DCODEC_WM8904_ENABLE \
-DSD_ENABLED \
-DDEBUG_CONSOLE_RX_ENABLE=0 \
-DPRINTF_ADVANCED_ENABLE=1 \
-DPRINTF_FLOAT_ENABLE=1 \
-DSERIAL_PORT_TYPE_UART=1 \
-DSDK_OS_FREE_RTOS \
-DMCUXPRESSO_SDK \
-g \
-O0 \
@ -61,8 +68,15 @@ SET(CMAKE_C_FLAGS_RELEASE " \
${CMAKE_C_FLAGS_RELEASE} \
-DNDEBUG \
-DCPU_LPC55S69JBD100_cm33_core0 \
-DSDK_I2C_BASED_COMPONENT_USED=1 \
-DBOARD_USE_CODEC=1 \
-DCODEC_WM8904_ENABLE \
-DSD_ENABLED \
-DDEBUG_CONSOLE_RX_ENABLE=0 \
-DPRINTF_ADVANCED_ENABLE=1 \
-DPRINTF_FLOAT_ENABLE=1 \
-DSERIAL_PORT_TYPE_UART=1 \
-DSDK_OS_FREE_RTOS \
-DMCUXPRESSO_SDK \
-Os \
-mcpu=cortex-m33 \
@ -154,6 +168,10 @@ SET(CMAKE_EXE_LINKER_FLAGS_DEBUG " \
-Xlinker \
-Map=output.map \
-Wl,--print-memory-usage \
-Xlinker \
--defsym=__stack_size__=0x1000 \
-Xlinker \
--defsym=__heap_size__=0x2000 \
-T${ProjDirPath}/LPC55S69_cm33_core0_flash.ld -static \
")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE " \
@ -182,5 +200,9 @@ SET(CMAKE_EXE_LINKER_FLAGS_RELEASE " \
-Xlinker \
-Map=output.map \
-Wl,--print-memory-usage \
-Xlinker \
--defsym=__stack_size__=0x1000 \
-Xlinker \
--defsym=__heap_size__=0x2000 \
-T${ProjDirPath}/LPC55S69_cm33_core0_flash.ld -static \
")

View File

@ -0,0 +1,290 @@
/*
* Copyright 2019 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*${header:start}*/
#include "cmd.h"
#include <string.h>
#include <stdint.h>
#include "fsl_debug_console.h"
#include "fsl_shell.h"
#include "app_streamer.h"
#include "fsl_sd_disk.h"
#include "portable.h"
#ifdef VIT_PROC
#include "PL_platformTypes_CortexM7.h"
#include "VIT.h"
#include "vit_proc.h"
#endif
/*${header:end}*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*${macro:start}*/
/*${macro:end}*/
/*******************************************************************************
* Prototypes
******************************************************************************/
/*${prototype:start}*/
static shell_status_t shellEcho(shell_handle_t shellHandle, int32_t argc, char **argv);
static shell_status_t shellRecMIC(shell_handle_t shellHandle, int32_t argc, char **argv);
#ifdef OPUS_ENCODE
static shell_status_t shellOpusEncode(shell_handle_t shellHandle, int32_t argc, char **argv);
#endif
/*${prototype:end}*/
/*******************************************************************************
* Variables
******************************************************************************/
/*${variable:start}*/
SHELL_COMMAND_DEFINE(version, "\r\n\"version\": Display component versions\r\n", shellEcho, 0);
SHELL_COMMAND_DEFINE(record_mic,
"\r\n\"record_mic\": Record MIC audio and either:\r\n"
#ifdef VIT_PROC
" - perform voice recognition (VIT)\r\n"
#endif
" - playback on WM8904 codec\r\n"
" - store samples to file.\r\n"
"\r\n"
#ifdef VIT_PROC
" USAGE: record_mic [audio|file|<file_name>|vit] 20 [en|cn]\r\n"
#else
" USAGE: record_mic [audio|file|<file_name>] 20\r\n"
#endif
" The number defines length of recording in seconds.\r\n"
#ifdef VIT_PROC
" For voice recognition say supported WakeWord and in 3s frame supported command.\r\n"
" Please note that this VIT demo is near-field and uses 1 on-board microphone.\r\n"
#endif
" NOTES: This command returns to shell after record finished.\r\n"
" To store samples to a file, the \"file\" option can be used to create a file\r\n"
" with a predefined name, or any file name (without whitespaces) can be specified\r\n"
" instead of the \"file\" option.\r\n",
shellRecMIC,
SHELL_IGNORE_PARAMETER_COUNT);
#ifdef OPUS_ENCODE
SHELL_COMMAND_DEFINE(opus_encode,
"\r\n\"opus_encode\": Initializes the streamer with the Opus memory-to-memory pipeline and\r\n"
"encodes a hardcoded buffer.\r\n",
shellOpusEncode,
0);
#endif
SDK_ALIGN(static uint8_t s_shellHandleBuffer[SHELL_HANDLE_SIZE], 4);
static shell_handle_t s_shellHandle;
extern serial_handle_t g_serialHandle;
streamer_handle_t streamerHandle;
/*${variable:end}*/
/*******************************************************************************
* Code
******************************************************************************/
/*${function:start}*/
static shell_status_t shellEcho(shell_handle_t shellHandle, int32_t argc, char **argv)
{
PRINTF(" Maestro version: 1.2\r\n");
#ifdef VIT_PROC
PRINTF(" VIT version: 5.4.0\r\n");
#endif
return kStatus_SHELL_Success;
}
static shell_status_t shellRecMIC(shell_handle_t shellHandle, int32_t argc, char **argv)
{
status_t ret;
out_sink_t out_sink;
int duration = 20;
char *file_name = NULL;
#ifdef VIT_PROC
Vit_Language = EN;
#endif
if ((argc > 1) && (strcmp(argv[1], "file") == 0))
{
out_sink = FILE_SINK;
}
else if ((argc > 1) && (strcmp(argv[1], "audio") == 0))
{
out_sink = AUDIO_SINK;
}
#ifdef VIT_PROC
else if ((argc > 1) && (strcmp(argv[1], "vit") == 0))
{
out_sink = VIT_SINK;
}
#endif
else
{
PRINTF("Undefined command - recording to a file on sd-card.\r\n");
/* Save the samples to the file with the defined name */
out_sink = FILE_SINK;
file_name = argv[1];
}
if ((argc > 2))
{
if (strcmp(argv[2], "\0") != 0)
{
duration = abs(atoi(argv[2]));
}
}
#ifdef VIT_PROC
if ((argc > 3))
{
if (strcmp(argv[3], "cn") == 0)
{
Vit_Language = CN;
}
}
#endif
PRINTF("\r\nStarting streamer demo application for %d sec\r\n", duration);
STREAMER_Init();
ret = STREAMER_mic_Create(&streamerHandle, out_sink, file_name);
if (ret != kStatus_Success)
{
PRINTF("STREAMER_Create failed\r\n");
goto error;
}
PRINTF("Starting recording\r\n");
#ifdef VIT_PROC
if (out_sink == VIT_SINK)
{
PRINTF("\r\nTo see VIT functionality say wake-word and command.\r\n");
}
#endif
STREAMER_Start(&streamerHandle);
osa_time_delay(duration * 1000);
STREAMER_Stop(&streamerHandle);
error:
PRINTF("Cleanup\r\n");
STREAMER_Destroy(&streamerHandle);
/* Delay for cleanup */
osa_time_delay(100);
return kStatus_SHELL_Success;
}
#ifdef OPUS_ENCODE
static shell_status_t shellOpusEncode(shell_handle_t shellHandle, int32_t argc, char **argv)
{
void *inBuf = NULL;
void *outBuf = NULL;
MEMSRC_SET_BUFFER_T inBufInfo = {0};
SET_BUFFER_DESC_T outBufInfo = {0};
bool streamerInitialized = false;
status_t ret;
CeiBitstreamInfo info = {
.sample_rate = 48000, .num_channels = 1, .endian = 0, .sign = TRUE, .sample_size = 16, .interleaved = TRUE};
PRINTF("Starting streamer with the preliminary Opus memory-to-memory pipeline.\r\n");
PRINTF("Allocating buffers...\r\n");
inBuf = pvPortMalloc(OPUSMEM2MEM_INBUF_SIZE);
if (inBuf == NULL)
{
PRINTF("Inbuf allocation failed\r\n");
goto error;
}
memcpy(inBuf, &OPUSMEM2MEM_INBUF_CONTENT, OPUSMEM2MEM_INBUF_SIZE);
outBuf = pvPortMalloc(OPUSMEM2MEM_OUTBUF_SIZE);
if (outBuf == NULL)
{
PRINTF("Outbuf allocation failed\r\n");
goto error;
}
memset(outBuf, 0, OPUSMEM2MEM_OUTBUF_SIZE);
inBufInfo = (MEMSRC_SET_BUFFER_T){.location = (int8_t *)inBuf, .size = OPUSMEM2MEM_INBUF_SIZE};
outBufInfo = (SET_BUFFER_DESC_T){.ptr = (int8_t *)outBuf, .size = OPUSMEM2MEM_OUTBUF_SIZE};
PRINTF("Initializing streamer...\r\n");
STREAMER_Init();
streamerInitialized = true;
ret = STREAMER_opusmem2mem_Create(&streamerHandle, &info, &inBufInfo, &outBufInfo);
if (ret != kStatus_Success)
{
PRINTF("Streamer create failed\r\n");
goto error;
}
CeiOpusConfig cfg;
streamer_get_property(streamerHandle.streamer, PROP_ENCODER_CONFIG, (uint32_t *)&cfg, true);
cfg.application = OPUS_APPLICATION_VOIP;
streamer_set_property(streamerHandle.streamer,
(ELEMENT_PROPERTY_T){.prop = PROP_ENCODER_CONFIG, .val = (uintptr_t)&cfg}, true);
PRINTF("Start encoding...\r\n");
STREAMER_Start(&streamerHandle);
while (streamerHandle.audioPlaying)
;
PRINTF("Encoding finished.\r\n");
error:
PRINTF("Cleanup\r\n");
vPortFree(inBuf);
vPortFree(outBuf);
if (streamerInitialized)
{
STREAMER_Destroy(&streamerHandle);
}
/* Delay for cleanup */
osa_time_delay(100);
return kStatus_SHELL_Success;
}
#endif
void shellCmd(void)
{
/* Init SHELL */
s_shellHandle = &s_shellHandleBuffer[0];
SHELL_Init(s_shellHandle, g_serialHandle, ">> ");
/* Add new command to commands list */
SHELL_RegisterCommand(s_shellHandle, SHELL_COMMAND(version));
SHELL_RegisterCommand(s_shellHandle, SHELL_COMMAND(record_mic));
#ifdef OPUS_ENCODE
SHELL_RegisterCommand(s_shellHandle, SHELL_COMMAND(opus_encode));
#endif
#if !(defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U))
while (1)
{
SHELL_Task(s_shellHandle);
}
#endif
}
/*${function:end}*/

View File

@ -0,0 +1,41 @@
/*
* Copyright 2019 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*${header:start}*/
#include "main.h"
#ifdef OPUS_ENCODE
#include "opusmem2mem_file.h"
#endif
/*${header:end}*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*${macro:start}*/
typedef void handleShellMessageCallback_t(void *arg);
/*${macro:end}*/
/*******************************************************************************
* Prototypes
******************************************************************************/
/*!
* @brief Common function for getting user input using shell console.
*
* @param[in] handleShellMessageCallback Callback to function which should
* handle serialized message.
* @param[in] arg Data to pass to callback handler.
*/
void shellCmd(void);
/*${prototype:end}*/
/** Constants **/
#ifdef OPUS_ENCODE
#define OPUSMEM2MEM_INBUF_SIZE 96100
#define OPUSMEM2MEM_OUTBUF_SIZE 96100
#endif

View File

@ -0,0 +1,314 @@
#ifndef _FFCONF_H_
#define _FFCONF_H_
/*---------------------------------------------------------------------------/
/ FatFs Functional Configurations
/---------------------------------------------------------------------------*/
#define FFCONF_DEF 86631 /* Revision ID */
/*---------------------------------------------------------------------------/
/ MSDK adaptation configuration
/---------------------------------------------------------------------------*/
#define SD_DISK_ENABLE
/*---------------------------------------------------------------------------/
/ Function Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_READONLY 0
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
/ and optional writing functions as well. */
#define FF_FS_MINIMIZE 0
/* This option defines minimization level to remove some basic API functions.
/
/ 0: Basic functions are fully enabled.
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
/ are removed.
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
/ 3: f_lseek() function is removed in addition to 2. */
#define FF_USE_FIND 0
/* This option switches filtered directory read functions, f_findfirst() and
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
#define FF_USE_MKFS 0
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
#define FF_USE_FASTSEEK 0
/* This option switches fast seek function. (0:Disable or 1:Enable) */
#define FF_USE_EXPAND 0
/* This option switches f_expand function. (0:Disable or 1:Enable) */
#define FF_USE_CHMOD 0
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
#define FF_USE_LABEL 0
/* This option switches volume label functions, f_getlabel() and f_setlabel().
/ (0:Disable or 1:Enable) */
#define FF_USE_FORWARD 0
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
#define FF_USE_STRFUNC 1
#define FF_PRINT_LLI 0
#define FF_PRINT_FLOAT 0
#define FF_STRF_ENCODE 3
/* FF_USE_STRFUNC switches string functions, f_gets(), f_putc(), f_puts() and
/ f_printf().
/
/ 0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect.
/ 1: Enable without LF-CRLF conversion.
/ 2: Enable with LF-CRLF conversion.
/
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
makes f_printf() support floating point argument. These features want C99 or later.
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
/ to be read/written via those functions.
/
/ 0: ANSI/OEM in current CP
/ 1: Unicode in UTF-16LE
/ 2: Unicode in UTF-16BE
/ 3: Unicode in UTF-8
*/
/*---------------------------------------------------------------------------/
/ Locale and Namespace Configurations
/---------------------------------------------------------------------------*/
#define FF_CODE_PAGE 932
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect code page setting can cause a file open failure.
/
/ 437 - U.S.
/ 720 - Arabic
/ 737 - Greek
/ 771 - KBL
/ 775 - Baltic
/ 850 - Latin 1
/ 852 - Latin 2
/ 855 - Cyrillic
/ 857 - Turkish
/ 860 - Portuguese
/ 861 - Icelandic
/ 862 - Hebrew
/ 863 - Canadian French
/ 864 - Arabic
/ 865 - Nordic
/ 866 - Russian
/ 869 - Greek 2
/ 932 - Japanese (DBCS)
/ 936 - Simplified Chinese (DBCS)
/ 949 - Korean (DBCS)
/ 950 - Traditional Chinese (DBCS)
/ 0 - Include all code pages above and configured by f_setcp()
*/
#define FF_USE_LFN 3
#define FF_MAX_LFN 255
/* The FF_USE_LFN switches the support for LFN (long file name).
/
/ 0: Disable LFN. FF_MAX_LFN has no effect.
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
/ 2: Enable LFN with dynamic working buffer on the STACK.
/ 3: Enable LFN with dynamic working buffer on the HEAP.
/
/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
/ be in range of 12 to 255. It is recommended to be set it 255 to fully support LFN
/ specification.
/ When use stack for the working buffer, take care on stack overflow. When use heap
/ memory for the working buffer, memory management functions, ff_memalloc() and
/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */
#define FF_LFN_UNICODE 0
/* This option switches the character encoding on the API when LFN is enabled.
/
/ 0: ANSI/OEM in current CP (TCHAR = char)
/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
/ 2: Unicode in UTF-8 (TCHAR = char)
/ 3: Unicode in UTF-32 (TCHAR = DWORD)
/
/ Also behavior of string I/O functions will be affected by this option.
/ When LFN is not enabled, this option has no effect. */
#define FF_LFN_BUF 255
#define FF_SFN_BUF 12
/* This set of options defines size of file name members in the FILINFO structure
/ which is used to read out directory items. These values should be suffcient for
/ the file names to read. The maximum possible length of the read file name depends
/ on character encoding. When LFN is not enabled, these options have no effect. */
#define FF_FS_RPATH 2
/* This option configures support for relative path.
/
/ 0: Disable relative path and remove related functions.
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
/ 2: f_getcwd() function is available in addition to 1.
*/
/*---------------------------------------------------------------------------/
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/
#define FF_VOLUMES 3
/* Number of volumes (logical drives) to be used. (1-10) */
#define FF_STR_VOLUME_ID 0
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
/ not defined, a user defined volume string table needs to be defined as:
/
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
*/
#define FF_MULTI_PARTITION 0
/* This option switches support for multiple volumes on the physical drive.
/ By default (0), each logical drive number is bound to the same physical drive
/ number and only an FAT volume found on the physical drive will be mounted.
/ When this function is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */
#define FF_MIN_SS 512
#define FF_MAX_SS 4096
/* This set of options configures the range of sector size to be supported. (512,
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
/ harddisk, but a larger value may be required for on-board flash memory and some
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
/ for variable sector size mode and disk_ioctl() function needs to implement
/ GET_SECTOR_SIZE command. */
#define FF_LBA64 0
/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable)
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
#define FF_MIN_GPT 0x10000000
/* Minimum number of sectors to switch GPT as partitioning format in f_mkfs and
/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
#define FF_USE_TRIM 0
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
/ disk_ioctl() function. */
/*---------------------------------------------------------------------------/
/ System Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_TINY 0
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
#define FF_FS_EXFAT 0
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
#define FF_FS_NORTC 1
#define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2021
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
/
/ bit0=0: Use free cluster count in the FSINFO if available.
/ bit0=1: Do not trust free cluster count in the FSINFO.
/ bit1=0: Use last allocated cluster number in the FSINFO if available.
/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
*/
#define FF_FS_LOCK 0
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
/ is 1.
/
/ 0: Disable file lock function. To avoid volume corruption, application program
/ should avoid illegal open, remove and rename to the open objects.
/ >0: Enable file lock function. The value defines how many files/sub-directories
/ can be opened simultaneously under file lock control. Note that the file
/ lock control is independent of re-entrancy. */
#define FF_FS_REENTRANT 1
#define FF_FS_TIMEOUT 1000
#if FF_FS_REENTRANT
#include "FreeRTOS.h"
#include "semphr.h"
#define FF_SYNC_t SemaphoreHandle_t
#endif
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
/ to the same volume is under control of this function.
/
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
/ function, must be added to the project. Samples are available in
/ option/syscall.c.
/
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
/*--- End of configuration options ---*/
#endif /* _FFCONF_H_ */

View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<ksdk:examples xmlns:ksdk="http://nxp.com/ksdk/2.0/ksdk_manifest_v3.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nxp.com/ksdk/2.0/ksdk_manifest_v3.0.xsd manifest.xsd">
<externalDefinitions>
<definition extID="cm33_core0_LPC55S69"/>
<definition extID="middleware.freertos-kernel.cm33_nonsecure_port.LPC55S69"/>
<definition extID="driver.wm8904.LPC55S69"/>
<definition extID="driver.codec.LPC55S69"/>
<definition extID="platform.drivers.common.LPC55S69"/>
<definition extID="component.wm8904_adapter.LPC55S69"/>
<definition extID="component.codec_i2c.LPC55S69"/>
<definition extID="component.flexcomm_i2c_adapter.LPC55S69"/>
<definition extID="platform.drivers.sysctl.LPC55S69"/>
<definition extID="middleware.sdmmc.sd.LPC55S69"/>
<definition extID="middleware.sdmmc.common.LPC55S69"/>
<definition extID="middleware.sdmmc.host.sdif.LPC55S69"/>
<definition extID="middleware.sdmmc.host.sdif.freertos.LPC55S69"/>
<definition extID="platform.drivers.lpc_iocon.LPC55S69"/>
<definition extID="platform.drivers.flexcomm_i2c.LPC55S69"/>
<definition extID="platform.drivers.flexcomm_i2s.LPC55S69"/>
<definition extID="utility.shell.LPC55S69"/>
<definition extID="platform.drivers.flexcomm_usart.LPC55S69"/>
<definition extID="platform.drivers.lpc_dma.LPC55S69"/>
<definition extID="platform.drivers.flexcomm_i2s_dma.LPC55S69"/>
<definition extID="middleware.freertos-kernel.heap_4.LPC55S69"/>
<definition extID="middleware.maestro_framework.LPC55S69"/>
<definition extID="middleware.fatfs.LPC55S69"/>
<definition extID="middleware.fatfs.sd.LPC55S69"/>
<definition extID="platform.drivers.clock.LPC55S69"/>
<definition extID="platform.drivers.power.LPC55S69"/>
<definition extID="platform.devices.LPC55S69_CMSIS.LPC55S69"/>
<definition extID="platform.devices.LPC55S69_startup.LPC55S69"/>
<definition extID="platform.drivers.flexcomm.LPC55S69"/>
<definition extID="platform.drivers.lpc_gpio.LPC55S69"/>
<definition extID="platform.utilities.assert.LPC55S69"/>
<definition extID="utility.debug_console.LPC55S69"/>
<definition extID="component.usart_adapter.LPC55S69"/>
<definition extID="component.serial_manager.LPC55S69"/>
<definition extID="component.lists.LPC55S69"/>
<definition extID="component.serial_manager_uart.LPC55S69"/>
<definition extID="middleware.freertos-kernel.LPC55S69"/>
<definition extID="middleware.freertos-kernel.extension.LPC55S69"/>
<definition extID="platform.drivers.reset.LPC55S69"/>
<definition extID="CMSIS_Include_core_cm.LPC55S69"/>
<definition extID="middleware.sdmmc.osa.freertos.LPC55S69"/>
<definition extID="component.osa_free_rtos.LPC55S69"/>
<definition extID="platform.drivers.sdif.LPC55S69"/>
<definition extID="middleware.maestro_framework.doc.LPC55S69"/>
<definition extID="platform.utilities.misc_utilities.LPC55S69"/>
<definition extID="platform.devices.LPC55S69_system.LPC55S69"/>
<definition extID="iar"/>
<definition extID="armgcc"/>
<definition extID="mcuxpresso"/>
<definition extID="com.nxp.mcuxpresso"/>
<definition extID="mdk"/>
</externalDefinitions>
<example id="lpcxpresso55s69_maestro_record" name="maestro_record" device_core="cm33_core0_LPC55S69" dependency="middleware.freertos-kernel.cm33_nonsecure_port.LPC55S69 driver.wm8904.LPC55S69 driver.codec.LPC55S69 platform.drivers.common.LPC55S69 component.wm8904_adapter.LPC55S69 component.codec_i2c.LPC55S69 component.flexcomm_i2c_adapter.LPC55S69 platform.drivers.sysctl.LPC55S69 middleware.sdmmc.sd.LPC55S69 middleware.sdmmc.common.LPC55S69 middleware.sdmmc.host.sdif.LPC55S69 middleware.sdmmc.host.sdif.freertos.LPC55S69 platform.drivers.lpc_iocon.LPC55S69 platform.drivers.flexcomm_i2c.LPC55S69 platform.drivers.flexcomm_i2s.LPC55S69 utility.shell.LPC55S69 platform.drivers.flexcomm_usart.LPC55S69 platform.drivers.lpc_dma.LPC55S69 platform.drivers.flexcomm_i2s_dma.LPC55S69 middleware.freertos-kernel.heap_4.LPC55S69 middleware.maestro_framework.LPC55S69 middleware.fatfs.LPC55S69 middleware.fatfs.sd.LPC55S69 platform.drivers.clock.LPC55S69 platform.drivers.power.LPC55S69 platform.devices.LPC55S69_CMSIS.LPC55S69 platform.devices.LPC55S69_startup.LPC55S69 platform.drivers.flexcomm.LPC55S69 platform.drivers.lpc_gpio.LPC55S69 platform.utilities.assert.LPC55S69 utility.debug_console.LPC55S69 component.usart_adapter.LPC55S69 component.serial_manager.LPC55S69 component.lists.LPC55S69 component.serial_manager_uart.LPC55S69 middleware.freertos-kernel.LPC55S69 middleware.freertos-kernel.extension.LPC55S69 platform.drivers.reset.LPC55S69 CMSIS_Include_core_cm.LPC55S69 middleware.sdmmc.osa.freertos.LPC55S69 component.osa_free_rtos.LPC55S69 platform.drivers.sdif.LPC55S69 middleware.maestro_framework.doc.LPC55S69 platform.utilities.misc_utilities.LPC55S69 platform.devices.LPC55S69_system.LPC55S69" category="audio_examples">
<projects>
<project type="com.crt.advproject.projecttype.exe" nature="org.eclipse.cdt.core.cnature"/>
</projects>
<toolchainSettings>
<toolchainSetting id_refs="com.nxp.mcuxpresso">
<option id="gnu.c.compiler.option.preprocessor.def.symbols" type="stringList">
<value>CPU_LPC55S69JBD100_cm33_core0</value>
<value>SDK_I2C_BASED_COMPONENT_USED=1</value>
<value>BOARD_USE_CODEC=1</value>
<value>CODEC_WM8904_ENABLE</value>
<value>SD_ENABLED</value>
<value>DEBUG_CONSOLE_RX_ENABLE=0</value>
<value>PRINTF_ADVANCED_ENABLE=1</value>
<value>PRINTF_FLOAT_ENABLE=1</value>
<value>SERIAL_PORT_TYPE_UART=1</value>
<value>SDK_OS_FREE_RTOS</value>
<value>MCUXPRESSO_SDK</value>
</option>
<option id="com.crt.advproject.gas.hdrlib" type="enum">
<value>com.crt.advproject.gas.hdrlib.newlib</value>
</option>
<option id="com.crt.advproject.gas.specs" type="enum">
<value>com.crt.advproject.gas.specs.newlib</value>
</option>
<option id="com.crt.advproject.gcc.hdrlib" type="enum">
<value>com.crt.advproject.gcc.hdrlib.newlib</value>
</option>
<option id="com.crt.advproject.gcc.specs" type="enum">
<value>com.crt.advproject.gcc.specs.newlib</value>
</option>
<option id="com.crt.advproject.link.gcc.hdrlib" type="enum">
<value>com.crt.advproject.gcc.link.hdrlib.newlib.nohost</value>
</option>
<option id="com.crt.advproject.link.fpu" type="enum">
<value>com.crt.advproject.link.fpu.fpv5sp.hard</value>
</option>
<option id="gnu.c.link.option.nostdlibs" type="boolean">
<value>true</value>
</option>
<option id="com.crt.advproject.link.memory.heapAndStack" type="string">
<value>&amp;Heap:Default;Default;0x2000&amp;Stack:Default;Default;0x1000</value>
</option>
<option id="com.crt.advproject.gas.fpu" type="enum">
<value>com.crt.advproject.gas.fpu.fpv5sp.hard</value>
</option>
<option id="com.crt.advproject.gcc.fpu" type="enum">
<value>com.crt.advproject.gcc.fpu.fpv5sp.hard</value>
</option>
<option id="gnu.c.compiler.option.optimization.flags" type="string">
<value>-fno-common</value>
</option>
<option id="com.crt.advproject.c.misc.dialect" type="enum">
<value>com.crt.advproject.misc.dialect.gnu99</value>
</option>
<option id="gnu.c.compiler.option.misc.other" type="string">
<value>-mcpu=cortex-m33 -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin</value>
</option>
<option id="gnu.c.compiler.option.warnings.allwarn" type="boolean">
<value>false</value>
</option>
</toolchainSetting>
</toolchainSettings>
<include_paths>
<include_path path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="source" type="c_include"/>
<include_path path="boards/lpcxpresso55s69/audio_examples/maestro_record" project_relative_path="source" type="c_include"/>
<include_path path="boards/lpcxpresso55s69/audio_examples/maestro_record" project_relative_path="board" type="c_include"/>
<include_path path="boards/lpcxpresso55s69" project_relative_path="board" type="c_include"/>
<include_path path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" type="c_include"/>
<include_path path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="board" type="c_include"/>
<include_path path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="source" type="asm_include"/>
</include_paths>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0/iar" project_relative_path="./" type="workspace" toolchain="iar">
<files mask="maestro_record.ewd"/>
<files mask="maestro_record.ewp"/>
<files mask="maestro_record.eww"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0/armgcc" project_relative_path="./" type="workspace" toolchain="armgcc">
<files mask="build_all.bat"/>
<files mask="build_all.sh"/>
<files mask="clean.bat"/>
<files mask="clean.sh"/>
<files mask="CMakeLists.txt"/>
<files mask="flags.cmake"/>
<files mask="config.cmake"/>
<files mask="build_debug.bat"/>
<files mask="build_debug.sh"/>
<files mask="build_release.bat"/>
<files mask="build_release.sh"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="source" type="src">
<files mask="streamer_pcm.c"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="source" type="c_include">
<files mask="streamer_pcm_app.h"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="source" type="src">
<files mask="app_streamer.c"/>
<files mask="cmd.c"/>
<files mask="main.c"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="source" type="c_include">
<files mask="app_streamer.h"/>
<files mask="cmd.h"/>
<files mask="main.h"/>
<files mask="FreeRTOSConfig.h"/>
<files mask="ffconf.h"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record" project_relative_path="board" type="src">
<files mask="pin_mux.c"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record" project_relative_path="board" type="c_include">
<files mask="pin_mux.h"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="board" type="src">
<files mask="sdmmc_config.c"/>
<files mask="board.c"/>
<files mask="clock_config.c"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="board" type="c_include">
<files mask="sdmmc_config.h"/>
<files mask="board.h"/>
<files mask="clock_config.h"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="source" type="c_include">
<files mask="app_definitions.h"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0" project_relative_path="doc" type="doc" toolchain="iar mdk mcuxpresso armgcc">
<files mask="readme.txt"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0/iar" project_relative_path="LPC55S69/iar" type="linker" toolchain="iar">
<files mask="LPC55S69_cm33_core0_flash.icf"/>
</source>
<source path="boards/lpcxpresso55s69/audio_examples/maestro_record/cm33_core0/armgcc" project_relative_path="LPC55S69/gcc" type="linker" toolchain="armgcc">
<files mask="LPC55S69_cm33_core0_flash.ld"/>
</source>
</example>
</ksdk:examples>

View File

@ -0,0 +1,317 @@
/*
* Copyright 2020-2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* Board includes */
#include "pin_mux.h"
#include "board.h"
#include "main.h"
#include "cmd.h"
#include "fsl_sd.h"
#include "ff.h"
#include "diskio.h"
#include "fsl_sd_disk.h"
#include "sdmmc_config.h"
#include "fsl_debug_console.h"
#include <stdbool.h>
#include "fsl_sysctl.h"
#include "fsl_codec_common.h"
#include "fsl_wm8904.h"
#include "fsl_codec_adapter.h"
#include "fsl_power.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#include "app_definitions.h"
#define SHELL_TASK_STACK_SIZE (1024)
#define SDCARD_TASK_STACK_SIZE (512)
/*******************************************************************************
* Prototypes
******************************************************************************/
int BOARD_CODEC_Init(void);
static void APP_SDCARD_DetectCallBack(bool isInserted, void *userData);
/*******************************************************************************
* Variables
******************************************************************************/
codec_handle_t codecHandle = {0};
wm8904_config_t wm8904Config = {
.i2cConfig = {.codecI2CInstance = BOARD_CODEC_I2C_INSTANCE, .codecI2CSourceClock = BOARD_CODEC_I2C_CLOCK_FREQ},
.recordSource = kWM8904_RecordSourceLineInput,
.recordChannelLeft = kWM8904_RecordChannelLeft2,
.recordChannelRight = kWM8904_RecordChannelRight2,
.playSource = kWM8904_PlaySourceDAC,
.slaveAddress = WM8904_I2C_ADDRESS,
.protocol = kWM8904_ProtocolI2S,
.format = {.sampleRate = kWM8904_SampleRate48kHz, .bitWidth = kWM8904_BitWidth16},
.mclk_HZ = DEMO_I2S_MASTER_CLOCK_FREQUENCY,
.master = false,
};
codec_config_t boardCodecConfig = {.codecDevType = kCODEC_WM8904, .codecDevConfig = &wm8904Config};
static app_handle_t app;
/*******************************************************************************
* Code
******************************************************************************/
int BOARD_CODEC_Init(void)
{
CODEC_Init(&codecHandle, &boardCodecConfig);
/* Invert the DAC data in order to output signal with correct polarity - set DACL_DATINV and DACR_DATINV = 1 */
WM8904_WriteRegister((wm8904_handle_t *)codecHandle.codecDevHandle, WM8904_AUDIO_IF_0, 0x1850);
/* Initial volume kept low for hearing safety. */
CODEC_SetVolume(&codecHandle, kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight, DEMO_VOLUME);
return 0;
}
void BOARD_InitSysctrl(void)
{
SYSCTL_Init(SYSCTL);
/* select signal source for share set */
SYSCTL_SetShareSignalSrc(SYSCTL, kSYSCTL_ShareSet0, kSYSCTL_SharedCtrlSignalSCK, kSYSCTL_Flexcomm7);
SYSCTL_SetShareSignalSrc(SYSCTL, kSYSCTL_ShareSet0, kSYSCTL_SharedCtrlSignalWS, kSYSCTL_Flexcomm7);
/* select share set for special flexcomm signal */
SYSCTL_SetShareSet(SYSCTL, kSYSCTL_Flexcomm7, kSYSCTL_FlexcommSignalSCK, kSYSCTL_ShareSet0);
SYSCTL_SetShareSet(SYSCTL, kSYSCTL_Flexcomm7, kSYSCTL_FlexcommSignalWS, kSYSCTL_ShareSet0);
SYSCTL_SetShareSet(SYSCTL, kSYSCTL_Flexcomm6, kSYSCTL_FlexcommSignalSCK, kSYSCTL_ShareSet0);
SYSCTL_SetShareSet(SYSCTL, kSYSCTL_Flexcomm6, kSYSCTL_FlexcommSignalWS, kSYSCTL_ShareSet0);
}
static void APP_SDCARD_DetectCallBack(bool isInserted, void *userData)
{
app_handle_t *app = (app_handle_t *)userData;
app->sdcardInserted = isInserted;
xSemaphoreGiveFromISR(app->sdcardSem, NULL);
}
void APP_SDCARD_Task(void *param)
{
const TCHAR driverNumberBuffer[3U] = {SDDISK + '0', ':', '/'};
FRESULT error;
app_handle_t *app = (app_handle_t *)param;
app->sdcardSem = xSemaphoreCreateBinary();
BOARD_SD_Config(&g_sd, APP_SDCARD_DetectCallBack, BOARD_SDMMC_SD_HOST_IRQ_PRIORITY, app);
PRINTF("[APP_SDCARD_Task] start\r\n");
/* SD host init function */
if (SD_HostInit(&g_sd) != kStatus_Success)
{
PRINTF("[APP_SDCARD_Task] SD host init failed.\r\n");
vTaskSuspend(NULL);
}
/* Small delay for SD card detection logic to process */
vTaskDelay(100 / portTICK_PERIOD_MS);
while (1)
{
/* Block waiting for SDcard detect interrupt */
xSemaphoreTake(app->sdcardSem, portMAX_DELAY);
if (app->sdcardInserted != app->sdcardInsertedPrev)
{
app->sdcardInsertedPrev = app->sdcardInserted;
SD_SetCardPower(&g_sd, false);
if (app->sdcardInserted)
{
/* power on the card */
SD_SetCardPower(&g_sd, true);
if (f_mount(&app->fileSystem, driverNumberBuffer, 0U))
{
PRINTF("[APP_SDCARD_Task] Mount volume failed.\r\n");
continue;
}
#if (FF_FS_RPATH >= 2U)
error = f_chdrive((char const *)&driverNumberBuffer[0U]);
if (error)
{
PRINTF("[APP_SDCARD_Task] Change drive failed.\r\n");
continue;
}
#endif
PRINTF("[APP_SDCARD_Task] SD card drive mounted\r\n");
xSemaphoreGive(app->sdcardSem);
}
}
}
}
void APP_Shell_Task(void *param)
{
PRINTF("[APP_Shell_Task] start\r\n");
/* Handle shell commands. */
shellCmd();
while (1)
;
;
}
int main(void)
{
int ret;
/* set BOD VBAT level to 1.65V */
POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);
CLOCK_EnableClock(kCLOCK_InputMux);
CLOCK_EnableClock(kCLOCK_Iocon);
CLOCK_EnableClock(kCLOCK_Gpio0);
CLOCK_EnableClock(kCLOCK_Gpio1);
/* USART0 clock */
CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);
/* I2C clock */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);
PMC->PDRUNCFGCLR0 |= PMC_PDRUNCFG0_PDEN_XTAL32M_MASK; /*!< Ensure XTAL16M is on */
PMC->PDRUNCFGCLR0 |= PMC_PDRUNCFG0_PDEN_LDOXO32M_MASK; /*!< Ensure XTAL16M is on */
SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_CLKIN_ENA_MASK; /*!< Ensure CLK_IN is on */
ANACTRL->XO32M_CTRL |= ANACTRL_XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_MASK;
/*!< Switch PLL0 clock source selector to XTAL16M */
CLOCK_AttachClk(kEXT_CLK_to_PLL0);
const pll_setup_t pll0Setup = {
.pllctrl = SYSCON_PLL0CTRL_CLKEN_MASK | SYSCON_PLL0CTRL_SELI(8U) | SYSCON_PLL0CTRL_SELP(31U),
.pllndec = SYSCON_PLL0NDEC_NDIV(125U),
.pllpdec = SYSCON_PLL0PDEC_PDIV(8U),
.pllsscg = {0x0U, (SYSCON_PLL0SSCG1_MDIV_EXT(3072U) | SYSCON_PLL0SSCG1_SEL_EXT_MASK)},
.pllRate = 24576000U,
.flags = PLL_SETUPFLAG_WAITLOCK};
/*!< Configure PLL to the desired values */
CLOCK_SetPLL0Freq(&pll0Setup);
CLOCK_SetClkDiv(kCLOCK_DivPll0Clk, 0U, true);
CLOCK_SetClkDiv(kCLOCK_DivPll0Clk, 1U, false);
/* I2S clocks */
CLOCK_AttachClk(kPLL0_DIV_to_FLEXCOMM6);
CLOCK_AttachClk(kPLL0_DIV_to_FLEXCOMM7);
/* Attach PLL clock to MCLK for I2S, no divider */
CLOCK_AttachClk(kPLL0_to_MCLK);
SYSCON->MCLKDIV = SYSCON_MCLKDIV_DIV(0U);
SYSCON->MCLKIO = 1U;
/* reset FLEXCOMM for I2C */
RESET_PeripheralReset(kFC4_RST_SHIFT_RSTn);
/* reset FLEXCOMM for DMA0 */
RESET_PeripheralReset(kDMA0_RST_SHIFT_RSTn);
/* reset FLEXCOMM for I2S */
RESET_PeripheralReset(kFC6_RST_SHIFT_RSTn);
RESET_PeripheralReset(kFC7_RST_SHIFT_RSTn);
/* reset NVIC for FLEXCOMM6 and FLEXCOMM7 */
NVIC_ClearPendingIRQ(FLEXCOMM6_IRQn);
NVIC_ClearPendingIRQ(FLEXCOMM7_IRQn);
/* Enable interrupts for I2S */
EnableIRQ(FLEXCOMM6_IRQn);
EnableIRQ(FLEXCOMM7_IRQn);
/* Initialize the rest */
BOARD_InitPins();
BOARD_BootClockPLL1_150M();
BOARD_InitDebugConsole();
BOARD_InitSysctrl();
PRINTF("\r\n");
PRINTF("*******************************\r\n");
PRINTF("Maestro audio record demo start\r\n");
PRINTF("*******************************\r\n");
PRINTF("\r\n");
ret = BOARD_CODEC_Init();
if (ret)
{
PRINTF("CODEC_Init failed\r\n");
return -1;
}
if (xTaskCreate(APP_SDCARD_Task, "SDCard Task", SDCARD_TASK_STACK_SIZE, &app, configMAX_PRIORITIES - 4, NULL) !=
pdPASS)
{
PRINTF("\r\nFailed to create application task\r\n");
while (1)
;
}
/* Set shell command task priority = 1 */
if (xTaskCreate(APP_Shell_Task, "Shell Task", SHELL_TASK_STACK_SIZE, &app, configMAX_PRIORITIES - 5,
&app.shell_task_handle) != pdPASS)
{
PRINTF("\r\nFailed to create application task\r\n");
while (1)
;
}
/* Run RTOS */
vTaskStartScheduler();
/* Should not reach this statement */
return 0;
}
/**
* @brief Loop forever if stack overflow is detected.
*
* If configCHECK_FOR_STACK_OVERFLOW is set to 1,
* this hook provides a location for applications to
* define a response to a stack overflow.
*
* Use this hook to help identify that a stack overflow
* has occurred.
*
*/
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName)
{
portDISABLE_INTERRUPTS();
/* Loop forever */
for (;;)
;
}
/**
* @brief Warn user if pvPortMalloc fails.
*
* Called if a call to pvPortMalloc() fails because there is insufficient
* free memory available in the FreeRTOS heap. pvPortMalloc() is called
* internally by FreeRTOS API functions that create tasks, queues, software
* timers, and semaphores. The size of the FreeRTOS heap is set by the
* configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
*
*/
void vApplicationMallocFailedHook()
{
PRINTF(("\r\nERROR: Malloc failed to allocate memory\r\n"));
/* Loop forever */
for (;;)
;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2020-2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __MAIN_H__
#define __MAIN_H__
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "ff.h"
#include <stdbool.h>
/*******************************************************************************
* Definitions
******************************************************************************/
typedef struct _app_handle
{
TaskHandle_t shell_task_handle;
/* SD card management */
SemaphoreHandle_t sdcardSem;
volatile bool sdcardInserted;
volatile bool sdcardInsertedPrev;
FATFS fileSystem;
FIL fileObject;
} app_handle_t;
#endif /* __MAIN_H__ */

View File

@ -0,0 +1,87 @@
Overview
========
The maestro_demo application demonstrates audio processing on the ARM cortex core
utilizing the Maestro Audio Framework library.
Depending on target platform there are different features of the demo enabled.
- loopback from microphone to speaker
- recording microphone to a file
- wake word + voice recognition
The application is controlled by commands from a shell interface using serial console.
Type "help" to see the command list. Similar description will be displayed on serial console:
>> help
"help": List all the registered commands
"exit": Exit program
"version": Display component versions
"record_mic": Record MIC audio and either:
- perform voice recognition (VIT)
- playback on WM8904 codec
- store samples to file.
USAGE: record_mic [audio|file|vit] 20 [en|cn]
The number defines length of recording in seconds.
For voice recognition say supported WakeWord and in 3s frame supported command.
Please note that this VIT demo is near-field and uses 1 on-board microphone.
NOTE: this command returns to shell after record finished.
Toolchain supported
===================
- IAR embedded Workbench 9.20.2
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements
=====================
- Mini/micro USB cable
- LPCXpresso55s69 board
- Personal Computer
- headphones with 3.5 mm stereo jack
- source of sound (line output to 3.5 mm stereo jack)
Board settings
==============
Insert the card into the card slot
Prepare the Demo
================
Note: MCUXpresso IDE project default debug console is semihost
1. Connect headphones to Audio HP / Line-Out connector.
2. Connect source of sound to Audio Line-In connector.
3. Connect a micro USB cable between the PC host and the CMSIS DAP USB port (P6) on the board
4. Open a serial terminal with the following settings :
- 115200 baud rate
- 8 data bits
- No parity
- One stop bit
- No flow control
5. Download the program to the target board.
6. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Note:
There is limited RAM on this platform, which brings following limitations:
- VIT is not enabled
Running the demo
================
When the example runs successfully, you should see similar output on the serial terminal as below:
**********************************
Maestro audio solutions demo start
**********************************
[APP_SDCARD_Task] start
[APP_Shell_Task] start
SHELL build: Nov 5 2020
Copyright 2020 NXP
>> [APP_SDCARD_Task] SD card drive mounted

View File

@ -0,0 +1,69 @@
/*
* Copyright 2020 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "sdmmc_config.h"
#include "fsl_iocon.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
/*!brief sdmmc dma buffer */
SDK_ALIGN(static uint32_t s_sdmmcHostDmaBuffer[BOARD_SDMMC_HOST_DMA_DESCRIPTOR_BUFFER_SIZE],
SDMMCHOST_DMA_DESCRIPTOR_BUFFER_ALIGN_SIZE);
#if defined(SDIO_ENABLED) || defined(SD_ENABLED)
static sd_detect_card_t s_cd;
#endif
static sdmmchost_t s_host;
/*******************************************************************************
* Code
******************************************************************************/
uint32_t BOARD_SDIF0ClockConfiguration(void)
{
/* attach main clock to SDIF */
CLOCK_AttachClk(kMAIN_CLK_to_SDIO_CLK);
/* need call this function to clear the halt bit in clock divider register */
CLOCK_SetClkDiv(kCLOCK_DivSdioClk, (uint32_t)(SystemCoreClock / FSL_FEATURE_SDIF_MAX_SOURCE_CLOCK + 1U), true);
return CLOCK_GetSdioClkFreq();
}
#if defined(SDIO_ENABLED) || defined(SD_ENABLED)
void BOARD_SDCardDetectInit(sd_cd_t cd, void *userData)
{
/* install card detect callback */
s_cd.cdDebounce_ms = BOARD_SDMMC_SD_CARD_DETECT_DEBOUNCE_DELAY_MS;
s_cd.type = BOARD_SDMMC_SD_CD_TYPE;
s_cd.callback = cd;
s_cd.userData = userData;
}
#endif
#ifdef SD_ENABLED
void BOARD_SD_Config(void *card, sd_cd_t cd, uint32_t hostIRQPriority, void *userData)
{
assert(card);
s_host.dmaDesBuffer = s_sdmmcHostDmaBuffer;
s_host.dmaDesBufferWordsNum = BOARD_SDMMC_HOST_DMA_DESCRIPTOR_BUFFER_SIZE;
((sd_card_t *)card)->host = &s_host;
((sd_card_t *)card)->host->hostController.base = BOARD_SDMMC_SD_HOST_BASEADDR;
((sd_card_t *)card)->host->hostController.sourceClock_Hz = BOARD_SDIF0ClockConfiguration();
((sd_card_t *)card)->usrParam.cd = &s_cd;
BOARD_SDCardDetectInit(cd, userData);
NVIC_SetPriority(BOARD_SDMMC_SD_HOST_IRQ, hostIRQPriority);
}
#endif

View File

@ -0,0 +1,62 @@
/*
* Copyright 2020 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _SDMMC_CONFIG_H_
#define _SDMMC_CONFIG_H_
#ifdef SD_ENABLED
#include "fsl_sd.h"
#endif
#ifdef MMC_ENABLED
#include "fsl_mmc.h"
#endif
#include "clock_config.h"
#include "fsl_gpio.h"
#include "fsl_sdmmc_host.h"
#include "fsl_sdmmc_common.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/* @brief host basic configuration */
#define BOARD_SDMMC_SD_HOST_BASEADDR SDIF
#define BOARD_SDMMC_SD_HOST_IRQ SDIO_IRQn
/* @brief card detect configuration */
#define BOARD_SDMMC_SD_CD_TYPE kSD_DetectCardByHostCD
#define BOARD_SDMMC_SD_CARD_DETECT_DEBOUNCE_DELAY_MS (100U)
#define BOARD_SDMMC_DATA_BUFFER_ALIGN_SIZE (4U)
/*!@ brief host interrupt priority*/
#define BOARD_SDMMC_SD_HOST_IRQ_PRIORITY (5U)
#define BOARD_SDMMC_MMC_HOST_IRQ_PRIORITY (5U)
/*!@brief dma descriptor buffer size */
#define BOARD_SDMMC_HOST_DMA_DESCRIPTOR_BUFFER_SIZE (0x40U)
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus */
/*******************************************************************************
* API
******************************************************************************/
/*!
* @brief BOARD SD configurations.
* @param card card descriptor
* @param cd card detect callback
* @param userData user data for callback
*/
#ifdef SD_ENABLED
void BOARD_SD_Config(void *card, sd_cd_t cd, uint32_t hostIRQPriority, void *userData);
#endif
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* _BOARD_H_ */

View File

@ -0,0 +1,285 @@
/*
* Copyright 2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "osa_common.h"
#include "app_definitions.h"
#include "board.h"
#include "streamer_pcm_app.h"
#include "fsl_debug_console.h"
#include "fsl_codec_common.h"
pcm_rtos_t pcmHandle = {0};
extern codec_handle_t codecHandle;
static void TxCallback(I2S_Type *base, i2s_dma_handle_t *handle, status_t completionStatus, void *userData)
{
pcm_rtos_t *pcm = (pcm_rtos_t *)userData;
BaseType_t reschedule;
xSemaphoreGiveFromISR(pcm->semaphoreTX, &reschedule);
portYIELD_FROM_ISR(reschedule);
}
static void RxCallback(I2S_Type *base, i2s_dma_handle_t *handle, status_t completionStatus, void *userData)
{
pcm_rtos_t *pcm = (pcm_rtos_t *)userData;
BaseType_t reschedule;
xSemaphoreGiveFromISR(pcm->semaphoreRX, &reschedule);
portYIELD_FROM_ISR(reschedule);
}
void streamer_pcm_init(void)
{
DMA_Init(DEMO_DMA);
DMA_EnableChannel(DEMO_DMA, DEMO_I2S_TX_CHANNEL);
DMA_SetChannelPriority(DEMO_DMA, DEMO_I2S_TX_CHANNEL, kDMA_ChannelPriority3);
DMA_CreateHandle(&pcmHandle.i2sTxDmaHandle, DEMO_DMA, DEMO_I2S_TX_CHANNEL);
DMA_EnableChannel(DEMO_DMA, DEMO_I2S_RX_CHANNEL);
DMA_SetChannelPriority(DEMO_DMA, DEMO_I2S_RX_CHANNEL, kDMA_ChannelPriority2);
DMA_CreateHandle(&pcmHandle.i2sRxDmaHandle, DEMO_DMA, DEMO_I2S_RX_CHANNEL);
}
pcm_rtos_t *streamer_pcm_open(uint32_t num_buffers)
{
pcmHandle.semaphoreTX = xSemaphoreCreateBinary();
return &pcmHandle;
}
pcm_rtos_t *streamer_pcm_rx_open(uint32_t num_buffers)
{
pcmHandle.semaphoreRX = xSemaphoreCreateBinary();
return &pcmHandle;
}
void streamer_pcm_start(pcm_rtos_t *pcm)
{
/* Interrupts already enabled - nothing to do.
* App/streamer can begin writing data to SAI. */
}
void streamer_pcm_close(pcm_rtos_t *pcm)
{
/* Stop playback. This will flush the SAI transmit buffers. */
if (pcm->i2sTxHandle.state != 0)
{
I2S_TransferAbortDMA(DEMO_I2S_TX, &pcm->i2sTxHandle);
}
vSemaphoreDelete(pcmHandle.semaphoreTX);
}
void streamer_pcm_rx_close(pcm_rtos_t *pcm)
{
if (pcm->i2sRxHandle.state != 0)
{
I2S_TransferAbortDMA(DEMO_I2S_RX, &pcm->i2sRxHandle);
}
vSemaphoreDelete(pcmHandle.semaphoreRX);
}
int streamer_pcm_write(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
{
/* Ensure write size is a multiple of 32, otherwise EDMA will assert
* failure. Round down for the last chunk of a file/stream. */
pcm->i2sTxTransfer.dataSize = size - (size % 32);
pcm->i2sTxTransfer.data = data;
if (pcm->isFirstTx)
{
/* need to queue two transmit buffers so when the first one
* finishes transfer, the other immediatelly starts */
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
pcm->isFirstTx = 0;
}
else
{
/* Wait for the previous transfer to finish */
if (xSemaphoreTake(pcm->semaphoreTX, portMAX_DELAY) != pdTRUE)
return -1;
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
}
return 0;
}
int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
{
/* Ensure write size is a multiple of 32, otherwise EDMA will assert
* failure. Round down for the last chunk of a file/stream. */
pcm->i2sRxTransfer.dataSize = size - (size % 32);
pcm->i2sRxTransfer.data = data;
/* Start the first transfer */
if (pcm->isFirstRx)
{
/* need to queue two receive buffers so when the first one is filled,
* the other is immediatelly starts to be filled */
I2S_RxTransferReceiveDMA(DEMO_I2S_RX, &pcm->i2sRxHandle, pcm->i2sRxTransfer);
I2S_RxTransferReceiveDMA(DEMO_I2S_RX, &pcm->i2sRxHandle, pcm->i2sRxTransfer);
pcm->isFirstRx = 0;
}
else
{
/* Wait for the previous transfer to finish */
if (xSemaphoreTake(pcm->semaphoreRX, portMAX_DELAY) != pdTRUE)
return -1;
}
/* Start the consecutive transfer */
I2S_RxTransferReceiveDMA(DEMO_I2S_RX, &pcm->i2sRxHandle, pcm->i2sRxTransfer);
/* Enable I2S Tx due to clock availability for the codec (see board schematic). */
if (pcm->dummy_tx_enable)
I2S_Enable(DEMO_I2S_TX);
return 0;
}
int streamer_pcm_setparams(
pcm_rtos_t *pcm, uint32_t sample_rate, uint32_t bit_width, uint8_t num_channels, bool tx, bool dummy_tx, int volume)
{
int ret = 0;
int divider = 0;
pcm->isFirstTx = tx ? 1U : pcm->isFirstTx;
pcm->isFirstRx = tx ? pcm->isFirstRx : 1U;
pcm->sample_rate = sample_rate;
pcm->bit_width = bit_width;
pcm->num_channels = num_channels;
pcm->dummy_tx_enable |= dummy_tx;
if (sample_rate % 8000 == 0 || sample_rate % 6000 == 0)
{
const pll_setup_t pll0Setup = {
.pllctrl = SYSCON_PLL0CTRL_CLKEN_MASK | SYSCON_PLL0CTRL_SELI(8U) | SYSCON_PLL0CTRL_SELP(31U),
.pllndec = SYSCON_PLL0NDEC_NDIV(125U),
.pllpdec = SYSCON_PLL0PDEC_PDIV(8U),
.pllsscg = {0x0U, (SYSCON_PLL0SSCG1_MDIV_EXT(3072U) | SYSCON_PLL0SSCG1_SEL_EXT_MASK)},
.pllRate = 24576000U,
.flags = PLL_SETUPFLAG_WAITLOCK};
/*!< Configure PLL to the desired values */
CLOCK_SetPLL0Freq(&pll0Setup);
}
else if (sample_rate % 11025 == 0)
{
const pll_setup_t pll0Setup = {
.pllctrl = SYSCON_PLL0CTRL_CLKEN_MASK | SYSCON_PLL0CTRL_SELI(8U) | SYSCON_PLL0CTRL_SELP(31U),
.pllndec = SYSCON_PLL0NDEC_NDIV(202U),
.pllpdec = SYSCON_PLL0PDEC_PDIV(8U),
.pllsscg = {0x0U, (SYSCON_PLL0SSCG1_MDIV_EXT(4561U) | SYSCON_PLL0SSCG1_SEL_EXT_MASK)},
.pllRate = 22579200U,
.flags = PLL_SETUPFLAG_WAITLOCK};
CLOCK_SetPLL0Freq(&pll0Setup); /*!< Configure PLL0 to the desired values */
}
divider = (CLOCK_GetPll0OutFreq() / sample_rate / bit_width / DEMO_CHANNEL_NUM);
/*
* masterSlave = kI2S_MasterSlaveNormalMaster;
* mode = kI2S_ModeI2sClassic;
* rightLow = false;
* leftJust = false;
* pdmData = false;
* sckPol = false;
* wsPol = false;
* divider = 1;
* oneChannel = false;
* dataLength = 16;
* frameLength = 32;
* position = 0;
* watermark = 4;
* txEmptyZero = true;
* pack48 = false;
*/
if (tx)
{
I2S_TxGetDefaultConfig(&pcmHandle.tx_config);
pcmHandle.tx_config.divider = divider;
pcmHandle.tx_config.masterSlave = DEMO_I2S_TX_MODE;
pcmHandle.tx_config.oneChannel = (pcm->num_channels == 1);
I2S_TxInit(DEMO_I2S_TX, &pcmHandle.tx_config);
I2S_TxTransferCreateHandleDMA(DEMO_I2S_TX, &pcmHandle.i2sTxHandle, &pcmHandle.i2sTxDmaHandle, TxCallback,
(void *)&pcmHandle);
}
else
{
I2S_RxGetDefaultConfig(&pcmHandle.rx_config);
pcmHandle.rx_config.divider = divider;
pcmHandle.rx_config.masterSlave = DEMO_I2S_RX_MODE;
pcmHandle.rx_config.oneChannel = (pcm->num_channels == 1);
I2S_RxInit(DEMO_I2S_RX, &pcmHandle.rx_config);
I2S_RxTransferCreateHandleDMA(DEMO_I2S_RX, &pcmHandle.i2sRxHandle, &pcmHandle.i2sRxDmaHandle, RxCallback,
(void *)&pcmHandle);
if (dummy_tx)
{
I2S_TxGetDefaultConfig(&pcmHandle.tx_config);
pcmHandle.tx_config.divider = divider;
pcmHandle.tx_config.masterSlave = DEMO_I2S_TX_MODE;
I2S_TxInit(DEMO_I2S_TX, &pcmHandle.tx_config);
}
}
ret = streamer_pcm_set_volume(pcm, 0);
if (ret != kStatus_Success)
{
return 1;
}
ret = CODEC_SetFormat(&codecHandle, CLOCK_GetPll0OutFreq(), sample_rate, bit_width);
if (ret != kStatus_Success)
{
return 1;
}
ret = streamer_pcm_set_volume(pcm, DEMO_VOLUME);
if (ret != kStatus_Success)
{
return 1;
}
return 0;
}
void streamer_pcm_getparams(pcm_rtos_t *pcm, uint32_t *sample_rate, uint32_t *bit_width, uint8_t *num_channels)
{
*sample_rate = pcm->sample_rate;
*bit_width = pcm->bit_width;
*num_channels = pcm->num_channels;
}
int streamer_pcm_mute(pcm_rtos_t *pcm, bool mute)
{
status_t ret;
ret = CODEC_SetMute(&codecHandle, kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight, mute);
if (ret != kStatus_Success)
{
return 1;
}
return 0;
}
int streamer_pcm_set_volume(pcm_rtos_t *pcm, int volume)
{
int channel;
channel = (pcm->num_channels == 1) ? kCODEC_PlayChannelHeadphoneLeft :
kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight;
if (volume <= 0)
CODEC_SetMute(&codecHandle, kCODEC_PlayChannelHeadphoneRight | kCODEC_PlayChannelHeadphoneLeft, true);
else
CODEC_SetVolume(&codecHandle, channel, volume > CODEC_VOLUME_MAX_VALUE ? CODEC_VOLUME_MAX_VALUE : volume);
return 0;
}

View File

@ -0,0 +1,49 @@
/*
* Copyright 2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _FSL_STREAMER_PCM_APP_H_
#define _FSL_STREAMER_PCM_APP_H_
#include "fsl_dma.h"
#include "fsl_i2c.h"
#include "fsl_i2s.h"
#include "fsl_i2s_dma.h"
#include "fsl_wm8904.h"
#include "streamer_pcm.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief PCM interface structure */
struct _pcm_rtos_t
{
dma_handle_t i2sTxDmaHandle;
i2s_dma_handle_t i2sTxHandle;
i2s_config_t tx_config;
i2s_transfer_t i2sTxTransfer;
dma_handle_t i2sRxDmaHandle;
i2s_dma_handle_t i2sRxHandle;
i2s_config_t rx_config;
i2s_transfer_t i2sRxTransfer;
uint32_t sample_rate;
uint32_t bit_width;
uint8_t num_channels;
SemaphoreHandle_t semaphoreRX;
SemaphoreHandle_t semaphoreTX;
uint8_t isFirstRx;
uint8_t isFirstTx;
bool dummy_tx_enable;
};
#endif

View File

@ -0,0 +1,504 @@
/*
* Copyright 2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/***********************************************************************************************************************
* This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
* will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
**********************************************************************************************************************/
/* clang-format off */
/*
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Pins v9.0
processor: LPC55S69
package_id: LPC55S69JBD100
mcu_data: ksdk2_0
processor_version: 9.0.0
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
*/
/* clang-format on */
#include "fsl_common.h"
#include "fsl_iocon.h"
#include "pin_mux.h"
/* FUNCTION ************************************************************************************************************
*
* Function Name : BOARD_InitBootPins
* Description : Calls initialization functions.
*
* END ****************************************************************************************************************/
void BOARD_InitBootPins(void)
{
BOARD_InitPins();
}
/* clang-format off */
/*
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
BOARD_InitPins:
- options: {callFromInitBoot: 'true', coreID: cm33_core0, enableClock: 'true'}
- pin_list:
- {pin_num: '94', peripheral: FLEXCOMM0, signal: TXD_SCL_MISO_WS, pin_signal: PIO0_30/FC0_TXD_SCL_MISO_WS/SD1_D3/CTIMER0_MAT0/SCT0_OUT9/SECURE_GPIO0_30, mode: inactive,
slew_rate: standard, invert: disabled, open_drain: disabled}
- {pin_num: '92', peripheral: FLEXCOMM0, signal: RXD_SDA_MOSI_DATA, pin_signal: PIO0_29/FC0_RXD_SDA_MOSI_DATA/SD1_D2/CTIMER2_MAT3/SCT0_OUT8/CMP0_OUT/PLU_OUT2/SECURE_GPIO0_29,
mode: inactive, slew_rate: standard, invert: disabled, open_drain: disabled}
- {pin_num: '4', peripheral: FLEXCOMM4, signal: TXD_SCL_MISO_WS, pin_signal: PIO1_20/FC7_RTS_SCL_SSEL1/CT_INP14/FC4_TXD_SCL_MISO_WS/PLU_OUT2, mode: pullUp, slew_rate: standard,
invert: disabled, open_drain: disabled}
- {pin_num: '30', peripheral: FLEXCOMM4, signal: RXD_SDA_MOSI_DATA, pin_signal: PIO1_21/FC7_CTS_SDA_SSEL0/CTIMER3_MAT2/FC4_RXD_SDA_MOSI_DATA/PLU_OUT3, mode: pullUp,
slew_rate: standard, invert: disabled, open_drain: disabled}
- {pin_num: '91', peripheral: SYSCON, signal: MCLK, pin_signal: PIO1_31/MCLK/SD1_CLK/CTIMER0_MAT2/SCT0_OUT6/PLU_IN0, mode: inactive, slew_rate: standard, invert: disabled,
open_drain: disabled}
- {pin_num: '76', peripheral: FLEXCOMM7, signal: SCK, pin_signal: PIO0_21/FC3_RTS_SCL_SSEL1/UTICK_CAP3/CTIMER3_MAT3/SCT_GPI3/FC7_SCK/PLU_CLKIN/SECURE_GPIO0_21,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '74', peripheral: FLEXCOMM7, signal: RXD_SDA_MOSI_DATA, pin_signal: PIO0_20/FC3_CTS_SDA_SSEL0/CTIMER1_MAT1/CT_INP15/SCT_GPI2/FC7_RXD_SDA_MOSI_DATA/HS_SPI_SSEL0/PLU_IN5/SECURE_GPIO0_20/FC4_TXD_SCL_MISO_WS,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '90', peripheral: FLEXCOMM7, signal: TXD_SCL_MISO_WS, pin_signal: PIO0_19/FC4_RTS_SCL_SSEL1/UTICK_CAP0/CTIMER0_MAT2/SCT0_OUT2/FC7_TXD_SCL_MISO_WS/PLU_IN4/SECURE_GPIO0_19,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '21', peripheral: FLEXCOMM6, signal: SCK, pin_signal: PIO0_10/FC6_SCK/CT_INP10/CTIMER2_MAT0/FC1_TXD_SCL_MISO_WS/SCT0_OUT2/SWO/SECURE_GPIO0_10/ADC0_1,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled, asw: enabled}
- {pin_num: '2', peripheral: FLEXCOMM6, signal: RXD_SDA_MOSI_DATA, pin_signal: PIO1_13/FC6_RXD_SDA_MOSI_DATA/CT_INP6/USB0_OVERCURRENTN/USB0_FRAME/SD0_CARD_DET_N,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '87', peripheral: FLEXCOMM6, signal: TXD_SCL_MISO_WS, pin_signal: PIO1_16/FC6_TXD_SCL_MISO_WS/CTIMER1_MAT3/SD0_CMD, mode: pullUp, slew_rate: fast, invert: disabled,
open_drain: disabled}
- {pin_num: '6', peripheral: SDIF, signal: SD0_CLK, pin_signal: PIO0_7/FC3_RTS_SCL_SSEL1/SD0_CLK/FC5_SCK/FC1_SCK/SECURE_GPIO0_7, mode: inactive, slew_rate: fast,
invert: disabled, open_drain: disabled}
- {pin_num: '26', peripheral: SDIF, signal: SD0_CMD, pin_signal: PIO0_8/FC3_SSEL3/SD0_CMD/FC5_RXD_SDA_MOSI_DATA/SWO/SECURE_GPIO0_8, mode: inactive, slew_rate: fast,
invert: disabled, open_drain: disabled}
- {pin_num: '55', peripheral: SDIF, signal: SD0_POW_EN, pin_signal: PIO0_9/FC3_SSEL2/SD0_POW_EN/FC5_TXD_SCL_MISO_WS/SECURE_GPIO0_9/ACMP0_B, mode: inactive, slew_rate: standard,
invert: disabled, open_drain: disabled, asw: enabled}
- {pin_num: '70', peripheral: SDIF, signal: 'SD0_D, 0', pin_signal: PIO0_24/FC0_RXD_SDA_MOSI_DATA/SD0_D0/CT_INP8/SCT_GPI0/SECURE_GPIO0_24, mode: inactive, slew_rate: fast,
invert: disabled, open_drain: disabled}
- {pin_num: '79', peripheral: SDIF, signal: 'SD0_D, 1', pin_signal: PIO0_25/FC0_TXD_SCL_MISO_WS/SD0_D1/CT_INP9/SCT_GPI1/SECURE_GPIO0_25, mode: inactive, slew_rate: fast,
invert: disabled, open_drain: disabled}
- {pin_num: '23', peripheral: SDIF, signal: 'SD0_D, 2', pin_signal: PIO0_31/FC0_CTS_SDA_SSEL0/SD0_D2/CTIMER0_MAT1/SCT0_OUT3/SECURE_GPIO0_31/ADC0_3, mode: inactive,
slew_rate: fast, invert: disabled, open_drain: disabled, asw: enabled}
- {pin_num: '11', peripheral: SDIF, signal: 'SD0_D, 3', pin_signal: PIO1_0/FC0_RTS_SCL_SSEL1/SD0_D3/CT_INP2/SCT_GPI4/PLU_OUT3/ADC0_11, mode: inactive, slew_rate: fast,
invert: disabled, open_drain: disabled, asw: enabled}
- {pin_num: '22', peripheral: SDIF, signal: SD0_WR_PRT, pin_signal: PIO0_15/FC6_CTS_SDA_SSEL0/UTICK_CAP2/CT_INP16/SCT0_OUT2/SD0_WR_PRT/SECURE_GPIO0_15/ADC0_2, mode: inactive,
slew_rate: standard, invert: disabled, open_drain: disabled, asw: enabled}
- {pin_num: '8', peripheral: SDIF, signal: SD0_CARD_DET, pin_signal: PIO0_17/FC4_SSEL2/SD0_CARD_DET_N/SCT_GPI7/SCT0_OUT0/SD0_CARD_INT_N/PLU_IN2/SECURE_GPIO0_17,
mode: inactive, slew_rate: standard, invert: disabled, open_drain: disabled}
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
*/
/* clang-format on */
/* FUNCTION ************************************************************************************************************
*
* Function Name : BOARD_InitPins
* Description : Configures pin routing and optionally pin electrical features.
*
* END ****************************************************************************************************************/
/* Function assigned for the Cortex-M33 (Core #0) */
void BOARD_InitPins(void)
{
/* Enables the clock for the I/O controller.: Enable Clock. */
CLOCK_EnableClock(kCLOCK_Iocon);
const uint32_t port0_pin10_config = (/* Pin is configured as FC6_SCK */
IOCON_PIO_FUNC1 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled) */
IOCON_PIO_ASW_EN);
/* PORT0 PIN10 (coords: 21) is configured as FC6_SCK */
IOCON_PinMuxSet(IOCON, 0U, 10U, port0_pin10_config);
const uint32_t port0_pin19_config = (/* Pin is configured as FC7_TXD_SCL_MISO_WS */
IOCON_PIO_FUNC7 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN19 (coords: 90) is configured as FC7_TXD_SCL_MISO_WS */
IOCON_PinMuxSet(IOCON, 0U, 19U, port0_pin19_config);
const uint32_t port0_pin20_config = (/* Pin is configured as FC7_RXD_SDA_MOSI_DATA */
IOCON_PIO_FUNC7 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN20 (coords: 74) is configured as FC7_RXD_SDA_MOSI_DATA */
IOCON_PinMuxSet(IOCON, 0U, 20U, port0_pin20_config);
const uint32_t port0_pin21_config = (/* Pin is configured as FC7_SCK */
IOCON_PIO_FUNC7 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN21 (coords: 76) is configured as FC7_SCK */
IOCON_PinMuxSet(IOCON, 0U, 21U, port0_pin21_config);
const uint32_t port0_pin29_config = (/* Pin is configured as FC0_RXD_SDA_MOSI_DATA */
IOCON_PIO_FUNC1 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN29 (coords: 92) is configured as FC0_RXD_SDA_MOSI_DATA */
IOCON_PinMuxSet(IOCON, 0U, 29U, port0_pin29_config);
const uint32_t port0_pin30_config = (/* Pin is configured as FC0_TXD_SCL_MISO_WS */
IOCON_PIO_FUNC1 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */
IOCON_PinMuxSet(IOCON, 0U, 30U, port0_pin30_config);
const uint32_t port1_pin13_config = (/* Pin is configured as FC6_RXD_SDA_MOSI_DATA */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN13 (coords: 2) is configured as FC6_RXD_SDA_MOSI_DATA */
IOCON_PinMuxSet(IOCON, 1U, 13U, port1_pin13_config);
const uint32_t port1_pin16_config = (/* Pin is configured as FC6_TXD_SCL_MISO_WS */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN16 (coords: 87) is configured as FC6_TXD_SCL_MISO_WS */
IOCON_PinMuxSet(IOCON, 1U, 16U, port1_pin16_config);
const uint32_t port1_pin20_config = (/* Pin is configured as FC4_TXD_SCL_MISO_WS */
IOCON_PIO_FUNC5 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN20 (coords: 4) is configured as FC4_TXD_SCL_MISO_WS */
IOCON_PinMuxSet(IOCON, 1U, 20U, port1_pin20_config);
const uint32_t port1_pin21_config = (/* Pin is configured as FC4_RXD_SDA_MOSI_DATA */
IOCON_PIO_FUNC5 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN21 (coords: 30) is configured as FC4_RXD_SDA_MOSI_DATA */
IOCON_PinMuxSet(IOCON, 1U, 21U, port1_pin21_config);
const uint32_t port1_pin31_config = (/* Pin is configured as MCLK */
IOCON_PIO_FUNC1 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN31 (coords: 91) is configured as MCLK */
IOCON_PinMuxSet(IOCON, 1U, 31U, port1_pin31_config);
if (Chip_GetVersion()==1)
{
const uint32_t port0_pin15_config = (/* Pin is configured as SD0_WR_PRT */
IOCON_PIO_FUNC5 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled) */
IOCON_PIO_ASW_EN);
/* PORT0 PIN15 (coords: 22) is configured as SD0_WR_PRT */
IOCON_PinMuxSet(IOCON, 0U, 15U, port0_pin15_config);
}
else
{
const uint32_t port0_pin15_config = (/* Pin is configured as SD0_WR_PRT */
IOCON_PIO_FUNC5 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled), only for A0 version */
IOCON_PIO_ASW_EN);
/* PORT0 PIN15 (coords: 22) is configured as SD0_WR_PRT */
IOCON_PinMuxSet(IOCON, 0U, 15U, port0_pin15_config);
}
const uint32_t port0_pin17_config = (/* Pin is configured as SD0_CARD_DET_N */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN17 (coords: 8) is configured as SD0_CARD_DET_N */
IOCON_PinMuxSet(IOCON, 0U, 17U, port0_pin17_config);
const uint32_t port0_pin24_config = (/* Pin is configured as SD0_D0 */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN24 (coords: 70) is configured as SD0_D0 */
IOCON_PinMuxSet(IOCON, 0U, 24U, port0_pin24_config);
const uint32_t port0_pin25_config = (/* Pin is configured as SD0_D1 */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN25 (coords: 79) is configured as SD0_D1 */
IOCON_PinMuxSet(IOCON, 0U, 25U, port0_pin25_config);
if (Chip_GetVersion()==1)
{
const uint32_t port0_pin31_config = (/* Pin is configured as SD0_D2 */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled) */
IOCON_PIO_ASW_EN);
/* PORT0 PIN31 (coords: 23) is configured as SD0_D2 */
IOCON_PinMuxSet(IOCON, 0U, 31U, port0_pin31_config);
}
else
{
const uint32_t port0_pin31_config = (/* Pin is configured as SD0_D2 */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled), only for A0 version */
IOCON_PIO_ASW_EN);
/* PORT0 PIN31 (coords: 23) is configured as SD0_D2 */
IOCON_PinMuxSet(IOCON, 0U, 31U, port0_pin31_config);
}
const uint32_t port0_pin7_config = (/* Pin is configured as SD0_CLK */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN7 (coords: 6) is configured as SD0_CLK */
IOCON_PinMuxSet(IOCON, 0U, 7U, port0_pin7_config);
const uint32_t port0_pin8_config = (/* Pin is configured as SD0_CMD */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN8 (coords: 26) is configured as SD0_CMD */
IOCON_PinMuxSet(IOCON, 0U, 8U, port0_pin8_config);
if (Chip_GetVersion()==1)
{
const uint32_t port0_pin9_config = (/* Pin is configured as SD0_POW_EN */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled) */
IOCON_PIO_ASW_EN);
/* PORT0 PIN9 (coords: 55) is configured as SD0_POW_EN */
IOCON_PinMuxSet(IOCON, 0U, 9U, port0_pin9_config);
}
else
{
const uint32_t port0_pin9_config = (/* Pin is configured as SD0_POW_EN */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled), only for A0 version */
IOCON_PIO_ASW_EN);
/* PORT0 PIN9 (coords: 55) is configured as SD0_POW_EN */
IOCON_PinMuxSet(IOCON, 0U, 9U, port0_pin9_config);
}
if (Chip_GetVersion()==1)
{
const uint32_t port1_pin0_config = (/* Pin is configured as SD0_D3 */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled) */
IOCON_PIO_ASW_EN);
/* PORT1 PIN0 (coords: 11) is configured as SD0_D3 */
IOCON_PinMuxSet(IOCON, 1U, 0U, port1_pin0_config);
}
else
{
const uint32_t port1_pin0_config = (/* Pin is configured as SD0_D3 */
IOCON_PIO_FUNC2 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI |
/* Analog switch is closed (enabled), only for A0 version */
IOCON_PIO_ASW_EN);
/* PORT1 PIN0 (coords: 11) is configured as SD0_D3 */
IOCON_PinMuxSet(IOCON, 1U, 0U, port1_pin0_config);
}
}
/***********************************************************************************************************************
* EOF
**********************************************************************************************************************/

View File

@ -0,0 +1,65 @@
/*
* Copyright 2021 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/***********************************************************************************************************************
* This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
* will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
**********************************************************************************************************************/
#ifndef _PIN_MUX_H_
#define _PIN_MUX_H_
/*!
* @addtogroup pin_mux
* @{
*/
/***********************************************************************************************************************
* API
**********************************************************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @brief Calls initialization functions.
*
*/
void BOARD_InitBootPins(void);
#define IOCON_PIO_ASW_EN 0x0400u /*!<@brief Analog switch is closed (enabled) */
#define IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
#define IOCON_PIO_FUNC1 0x01u /*!<@brief Selects pin function 1 */
#define IOCON_PIO_FUNC2 0x02u /*!<@brief Selects pin function 2 */
#define IOCON_PIO_FUNC5 0x05u /*!<@brief Selects pin function 5 */
#define IOCON_PIO_FUNC7 0x07u /*!<@brief Selects pin function 7 */
#define IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
#define IOCON_PIO_MODE_INACT 0x00u /*!<@brief No addition pin function */
#define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */
#define IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
#define IOCON_PIO_SLEW_FAST 0x40u /*!<@brief Fast mode, slew rate control is disabled */
#define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
/*!
* @brief Configures pin routing and optionally pin electrical features.
*
*/
void BOARD_InitPins(void); /* Function assigned for the Cortex-M33 (Core #0) */
#if defined(__cplusplus)
}
#endif
/*!
* @}
*/
#endif /* _PIN_MUX_H_ */
/***********************************************************************************************************************
* EOF
**********************************************************************************************************************/

View File

@ -161,8 +161,13 @@ status_t STREAMER_mic_Create(streamer_handle_t *handle)
streamer_set_property(handle->streamer, prop, true);
prop.prop = PROP_AUDIOSRC_SET_CHUNK_SIZE;
prop.val = FS_ISO_IN_ENDP_PACKET_SIZE / 2;
prop.prop = PROP_AUDIOSRC_SET_NUM_CHANNELS;
prop.val = 1;
streamer_set_property(handle->streamer, prop, true);
prop.prop = PROP_AUDIOSRC_SET_FRAME_MS;
prop.val = 1;
streamer_set_property(handle->streamer, prop, true);

View File

@ -14,8 +14,8 @@ This is just an example application. To leverage the values, the demo has to be
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -34,8 +34,6 @@ void streamer_pcm_init(void)
DMA_EnableChannel(DEMO_DMA, DEMO_I2S_RX_CHANNEL);
DMA_SetChannelPriority(DEMO_DMA, DEMO_I2S_RX_CHANNEL, kDMA_ChannelPriority2);
DMA_CreateHandle(&pcmHandle.i2sRxDmaHandle, DEMO_DMA, DEMO_I2S_RX_CHANNEL);
pcmHandle.isFirstRx = 1;
}
pcm_rtos_t *streamer_pcm_open(uint32_t num_buffers)
@ -80,47 +78,39 @@ int streamer_pcm_write(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
}
}
/* Enable I2S Tx due to clock availability for the codec (see board schematic).*/
if (pcm->dummy_tx_enable)
I2S_Enable(DEMO_I2S_TX);
return 0;
}
int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint8_t *data2, uint32_t size)
int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
{
pcm->i2sRxTransfer.dataSize = size;
pcm->i2sRxTransfer.data = data;
/* Ensure write size is a multiple of 32, otherwise EDMA will assert
* failure. Round down for the last chunk of a file/stream. */
if (size % 32)
{
pcm->i2sRxTransfer.dataSize = size - (size % 32);
}
pcm->i2sRxTransfer.dataSize = size - (size % 32);
pcm->i2sRxTransfer.data = data;
/* Start the first transfer */
if (pcm->isFirstRx)
{
/* Need to queue two receive buffers so when the first one is filled,
* the other is immediatelly starts to be filled */
* the other one immediatelly starts to be filled */
I2S_RxTransferReceiveDMA(DEMO_I2S_RX, &pcm->i2sRxHandle, pcm->i2sRxTransfer);
I2S_RxTransferReceiveDMA(DEMO_I2S_RX, &pcm->i2sRxHandle, pcm->i2sRxTransfer);
pcm->isFirstRx = 0;
}
else
{
/* Wait for transfer to finish */
/* Wait for the previous transfer to finish */
if (xSemaphoreTake(pcm->semaphoreRX, portMAX_DELAY) != pdTRUE)
{
return -1;
}
pcm->i2sRxTransfer.data = data2;
/* Start the consecutive transfer */
I2S_RxTransferReceiveDMA(DEMO_I2S_RX, &pcm->i2sRxHandle, pcm->i2sRxTransfer);
}
/* Start the consecutive transfer */
I2S_RxTransferReceiveDMA(DEMO_I2S_RX, &pcm->i2sRxHandle, pcm->i2sRxTransfer);
/* Enable I2S Tx due to clock availability for the codec (see board schematic).*/
if (pcm->dummy_tx_enable)
I2S_Enable(DEMO_I2S_TX);
return 0;
}
@ -131,9 +121,11 @@ int streamer_pcm_setparams(
/* channelNum multiplied by two, because the codec gets data from two channel (CH0 0x00 CH0 0x00...) */
uint8_t channelNum = num_channels == 1 ? 2 : num_channels;
int divider = (CLOCK_GetPll0OutFreq() / sample_rate / bit_width / num_channels);
pcm->sample_rate = sample_rate;
pcm->bit_width = bit_width;
pcm->num_channels = num_channels;
pcm->isFirstRx = tx ? pcm->isFirstRx : 1U;
pcm->sample_rate = sample_rate;
pcm->bit_width = bit_width;
pcm->num_channels = num_channels;
pcm->dummy_tx_enable |= dummy_tx;
/*

View File

@ -156,13 +156,13 @@ status_t STREAMER_speaker_Create(streamer_handle_t *handle)
streamer_set_property(handle->streamer, prop, true);
prop.prop = PROP_AUDIOSRC_SET_CHUNK_SIZE;
prop.val = AUDIO_PLAY_BUFFER_SIZE_ONE_FRAME / (2 * 2);
prop.prop = PROP_AUDIOSRC_SET_NUM_CHANNELS;
prop.val = 2;
streamer_set_property(handle->streamer, prop, true);
prop.prop = PROP_AUDIOSRC_SET_NUM_CHANNELS;
prop.val = 2;
prop.prop = PROP_AUDIOSRC_SET_FRAME_MS;
prop.val = 1;
streamer_set_property(handle->streamer, prop, true);

View File

@ -14,8 +14,8 @@ This is just an example application. To leverage the values, the demo has to be
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -36,8 +36,6 @@ void streamer_pcm_init(void)
DMA_EnableChannel(DEMO_DMA, DEMO_I2S_TX_CHANNEL);
DMA_SetChannelPriority(DEMO_DMA, DEMO_I2S_TX_CHANNEL, kDMA_ChannelPriority3);
DMA_CreateHandle(&pcmHandle.i2sTxDmaHandle, DEMO_DMA, DEMO_I2S_TX_CHANNEL);
pcmHandle.isFirstTx = 1;
}
pcm_rtos_t *streamer_pcm_open(uint32_t num_buffers)
@ -72,39 +70,33 @@ void streamer_pcm_rx_close(pcm_rtos_t *pcm)
int streamer_pcm_write(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
{
pcm->i2sTxTransfer.dataSize = size;
pcm->i2sTxTransfer.data = data;
/* Ensure write size is a multiple of 32, otherwise EDMA will assert
* failure. Round down for the last chunk of a file/stream. */
if (size % 32)
{
pcm->i2sTxTransfer.dataSize = size - (size % 32);
}
pcm->i2sTxTransfer.dataSize = size - (size % 32);
pcm->i2sTxTransfer.data = data;
/* Start transfer */
if (pcm->isFirstTx)
{
/* Need to queue two receive buffers so when the first one is filled,
* the other is immediatelly starts to be filled */
/* need to queue two transmit buffers so when the first one
* finishes transfer, the other immediatelly starts */
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
pcm->isFirstTx = 0;
}
else
{
/* Wait for transfer to finish */
/* Wait for the previous transfer to finish */
if (xSemaphoreTake(pcm->semaphoreTX, portMAX_DELAY) != pdTRUE)
{
return -1;
}
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
I2S_TxTransferSendDMA(DEMO_I2S_TX, &pcm->i2sTxHandle, pcm->i2sTxTransfer);
}
return 0;
}
int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint8_t *data2, uint32_t size)
int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint32_t size)
{
uint32_t audioSpeakerPreReadDataCount = 0U;
uint32_t preAudioSendCount = 0U;
@ -161,8 +153,10 @@ int streamer_pcm_read(pcm_rtos_t *pcm, uint8_t *data, uint8_t *data2, uint32_t s
int streamer_pcm_setparams(
pcm_rtos_t *pcm, uint32_t sample_rate, uint32_t bit_width, uint8_t num_channels, bool tx, bool dummy_tx, int volume)
{
int ret = 0;
int divider = (CLOCK_GetPll0OutFreq() / sample_rate / bit_width / num_channels);
int ret = 0;
int divider = (CLOCK_GetPll0OutFreq() / sample_rate / bit_width / num_channels);
pcm->isFirstTx = tx ? 1U : pcm->isFirstTx;
pcm->sample_rate = sample_rate;
pcm->bit_width = bit_width;
pcm->num_channels = num_channels;

View File

@ -64,8 +64,6 @@ BOARD_InitPins:
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '21', peripheral: FLEXCOMM6, signal: SCK, pin_signal: PIO0_10/FC6_SCK/CT_INP10/CTIMER2_MAT0/FC1_TXD_SCL_MISO_WS/SCT0_OUT2/SWO/SECURE_GPIO0_10/ADC0_1,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled, asw: enabled}
- {pin_num: '2', peripheral: FLEXCOMM6, signal: RXD_SDA_MOSI_DATA, pin_signal: PIO1_13/FC6_RXD_SDA_MOSI_DATA/CT_INP6/USB0_OVERCURRENTN/USB0_FRAME/SD0_CARD_DET_N,
mode: pullUp, slew_rate: fast, invert: disabled, open_drain: disabled}
- {pin_num: '87', peripheral: FLEXCOMM6, signal: TXD_SCL_MISO_WS, pin_signal: PIO1_16/FC6_TXD_SCL_MISO_WS/CTIMER1_MAT3/SD0_CMD, mode: pullUp, slew_rate: fast, invert: disabled,
open_drain: disabled}
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
@ -191,21 +189,6 @@ void BOARD_InitPins(void)
/* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */
IOCON_PinMuxSet(IOCON, 0U, 30U, port0_pin30_config);
const uint32_t port1_pin13_config = (/* Pin is configured as FC6_RXD_SDA_MOSI_DATA */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Fast mode, slew rate control is disabled */
IOCON_PIO_SLEW_FAST |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT1 PIN13 (coords: 2) is configured as FC6_RXD_SDA_MOSI_DATA */
IOCON_PinMuxSet(IOCON, 1U, 13U, port1_pin13_config);
const uint32_t port1_pin16_config = (/* Pin is configured as FC6_TXD_SCL_MISO_WS */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */

View File

@ -5,9 +5,9 @@ The simple Shadow lightbulb example to illustrate how client application and thi
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- GCC ARM Embedded 10.2.1
- Keil MDK 5.34
- IAR embedded Workbench 9.20.2
- GCC ARM Embedded 10.3.1
- Keil MDK 5.36
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -73,9 +73,9 @@
#define SAMPLE_SNTP_UPDATE_INTERVAL (NX_IP_PERIODIC_RATE / 2)
#endif /* SAMPLE_SNTP_UPDATE_INTERVAL */
/* Default time. GMT: Friday, Jan 1, 2022 12:00:00 AM. Epoch timestamp: 1640995200. */
/* Default time. GMT: Thu Mar 10 10:44:35 2022. */
#ifndef SAMPLE_SYSTEM_TIME
#define SAMPLE_SYSTEM_TIME 1621497448
#define SAMPLE_SYSTEM_TIME 1646909075
#endif /* SAMPLE_SYSTEM_TIME */
/* Seconds between Unix Epoch (1/1/1970) and NTP Epoch (1/1/1999) */

View File

@ -58,10 +58,10 @@ Note that these steps assume you use the Azure IoT Hub for the first time.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- MCUXpresso 11.5.0
- GCC ARM Embedded 10.2.1
- GCC ARM Embedded 10.3.1
Hardware requirements
=====================

View File

@ -5,9 +5,9 @@ This example can do network iperf test through a USB Ethernet adapter.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -8,9 +8,9 @@ Then, do some file operation test - create, write, read, close and so on.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -7,9 +7,9 @@ and reads a small file.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -9,9 +9,9 @@ read, close and so on.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -11,9 +11,9 @@ and the second thread deals with I2C slave operation.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -9,9 +9,9 @@ by a cable.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -9,9 +9,9 @@ of this demonstration.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -9,9 +9,9 @@ for the port, then write them back.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ This example works as a USB audio device. It will appear as USB speaker and USB
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ This example works as a USB CDC ACM device. It will appear as a USB serial devic
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ This example works as two USB CDC ACM devices. It will appear as two USB serial
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -255,7 +255,7 @@ void tx_application_define(void *first_unused_memory)
parameter1.ux_slave_class_cdc_acm_instance_deactivate = demo_cdc_instance1_deactivate;
/* Initialize the device CDC class. This class owns both interfaces starting with 0. */
status = ux_device_stack_class_register("ACM1",
status = ux_device_stack_class_register((UCHAR *)"ACM1",
ux_device_class_cdc_acm_entry, 1, 0,
&parameter1);
@ -264,7 +264,7 @@ void tx_application_define(void *first_unused_memory)
parameter2.ux_slave_class_cdc_acm_instance_deactivate = demo_cdc_instance2_deactivate;
/* Initialize the device CDC class. This class owns both interfaces starting with 2. */
status = ux_device_stack_class_register("ACM2",
status = ux_device_stack_class_register((UCHAR *)"ACM2",
ux_device_class_cdc_acm_entry, 1, 2,
&parameter2);

View File

@ -5,9 +5,9 @@ This example works as a USB HID device. It will appear as a USB keyboard device
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ This example works as a USB HID device. It will appear as a USB mouse device on
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ This example illustrates USBX Device Mass Storage.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ This example works as a USB host CDC ACM. It can communicate with a USB CDC ACM
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -7,9 +7,9 @@ which key has been pressed.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -7,9 +7,9 @@ which key has been pressed.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ This example illustrates USBX Host Mass Storage.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -8,9 +8,9 @@ toggle the LED and print to the console to indicate a button press event is dete
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ slave is correct.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ Note: The example echo every 8 characters, so input 8 characters every time.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ Note: The example echo every 8 characters, so input 8 characters every time.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -10,9 +10,9 @@ work with semihosting.
Toolchain supported
===================
- Keil MDK 5.34
- IAR embedded Workbench 9.10.2
- GCC ARM Embedded 10.2.1
- Keil MDK 5.36
- IAR embedded Workbench 9.20.2
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -10,9 +10,9 @@ work with semihosting.
Toolchain supported
===================
- Keil MDK 5.34
- IAR embedded Workbench 9.10.2
- GCC ARM Embedded 10.2.1
- Keil MDK 5.36
- IAR embedded Workbench 9.20.2
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -9,9 +9,9 @@ just define DEBUG_CONSOLE_TRANSFER_NON_BLOCKING in your project to use the advan
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ show how to use the swo, and to provide a simple project for debugging and furth
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -7,10 +7,10 @@ The purpose of this demo is to demonstrate how to use virtual com and provide a
Toolchain supported
===================
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
- IAR embedded Workbench 9.10.2
- IAR embedded Workbench 9.20.2
Hardware requirements
=====================

View File

@ -7,9 +7,9 @@ The code of this demo has been prepared and updated for use with the MCUXpresso
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -15,10 +15,10 @@ that the RTC crystal works.
Toolchain supported
===================
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
- IAR embedded Workbench 9.10.2
- IAR embedded Workbench 9.20.2
Hardware requirements
=====================

View File

@ -19,9 +19,9 @@ prepared wakeup source from external event.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -23,10 +23,10 @@ Usual use of PUF controller consists of these steps:
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- IAR embedded Workbench 9.20.2
- MCUXpresso 11.5.0
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
Hardware requirements
=====================

View File

@ -10,9 +10,9 @@ work with semihosting.
Toolchain supported
===================
- Keil MDK 5.34
- IAR embedded Workbench 9.10.2
- GCC ARM Embedded 10.2.1
- Keil MDK 5.36
- IAR embedded Workbench 9.20.2
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -6,9 +6,9 @@ The MicroTick timer wakes up the device.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -6,9 +6,9 @@ target clock according to the reference clock frequency.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -8,9 +8,9 @@ will be asserted.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,10 +5,10 @@ The CASPER Example project is a demonstration program that uses the KSDK softwar
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- MCUXpresso 11.5.0
- GCC ARM Embedded 10.2.1
- GCC ARM Embedded 10.3.1
Hardware requirements
=====================

View File

@ -6,9 +6,9 @@ can observe the selected internal clock signal.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -15,9 +15,9 @@ detecting the output's falling edge.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -14,9 +14,9 @@ output is logic one, or turned off when zero.
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

View File

@ -5,9 +5,9 @@ for an ASCII string. Several CRC protocols are implemented using the CRC driver
Toolchain supported
===================
- IAR embedded Workbench 9.10.2
- Keil MDK 5.34
- GCC ARM Embedded 10.2.1
- IAR embedded Workbench 9.20.2
- Keil MDK 5.36
- GCC ARM Embedded 10.3.1
- MCUXpresso 11.5.0
Hardware requirements

Some files were not shown because too many files have changed in this diff Show More