This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/CC1352P:如何运行 I2S?

Guru**** 2581345 points
Other Parts Discussed in Thread: TLV320AIC3204

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/882385/ccs-cc1352p-how-to-run-i2s

器件型号:CC1352P
主题中讨论的其他器件:TLV320AIC3204

工具/软件:Code Composer Studio

先生,你好!

我想播放 I2S 通信使用的音频。

 SDK:simplelink 3.2

 编解码器芯片:TLV320AIC3204

因此我进行了编程,想打击它(例如:流模式和回波播放)。

硬件是音乐数据是 TLV320AIC 芯片的线路输入引脚、但不显示来自扬声器的音频。

我想这个。

1、主设备从麦克风或音乐显示器读取音频数据、然后传输到摊铺机。

2.从主设备实时显示接收的音频数据

请告诉我如何操作


静态空 writeCallbackFxn (I2S_Handle handle、int_fast16_t status、I2S_Transaction * transactionPtr){
/*
if (status & I2S_All_transactions _Success){
//注意:此处我们不会排队新的转接或设置新的队列标题。
//驱动程序将停止自行发送数据。

writeStopped =(bool) true;
}
*
I2S_Transaction *事务已完成=(I2S_Transaction *) List_prev (&transactionPtr ->队列元素);

if (已完成转移!= NULL){
/*从写入队列中删除已完成的事务,然后
*馈送读取队列(我们不再需要此事务的数据)*/
list_remove (&i2sWriteList,(List_Elem*)已完成操作);
TransactionFined->queueElement.next = NULL;
list_put (&i2sReadList,(List_Elem*)transactionFinished);

I2S_Transaction * newTransaction =(I2S_Transaction *) List_head (&treatmentList);
if (newTransaction!= NULL){
list_remove (&treatmentList、(List_Elem*) newTransaction);
newTransaction->queueElement.next = NULL;
list_put (&i2sWriteList,(List_Elem*) newTransaction);
}

/*我们不需要在此处对事务进行队列处理:)*/
}


静态空 readCallbackFxn (I2S_Handle handle、int_fast16_t status、I2S_Transaction *transactionPtr){

//我们必须删除先前的事务(当前的事务不在上面)
Ique_Transaction *=(TransactionList=)=(FF)==*=(FFI2S=====&=)=(TransactionList==)=(FFI2S==)===(Transaction==)=(Transaction===)=(Transaction=)=(=)==*=(Transaction====)=(TransactionPh.=)==(TransactionPh.=)=*====(Transaction==



由 sklee =========================================================添加
//
test_num = transactionFined->numberOfCommitions;
Display_printf (disHandle、0、0、"Test_Num is %d"、 test_num);
/*================================================
End Adde
======================================================== //
完成的事务包含必须处理
的数据 List_remove(&i2sReadList,(List_Elem*) transactionFinished);
transactionFinished->queueElement.next = NULL;
List_Put (&treatmentList,(List_Elem*) transactionFinished);

//开始处理数据
SEM_POST (&semDataReadyForTreatment);
//我们不需要在此处排队处理:writeCallbackFxn 负责处理:)
}

静态空 errCallbackFxn (I2S_Handle handle、int_fast16_t status、I2S_Transaction * transactionPtr){
//处理 I2S 错误
Display_printf (disHandle、0、0、"I2S 错误"、NULL、 空);
}

void *i2sSysThread (void *arg0)
{
int retc = SEM_INIT (&semDataReadyForTreatment、0、0);
如果(retc =-1){
Display_printf (disHandle、0、0、"Smpaphore init error"、NULL、 null);
while (1);
}

list_clearList (&i2sReadList);
list_clearList (&treatmentList);
list_clearList (&i2sWriteList);

I2S_Params_init (&i2sParams.samplingFrequency
= sample_rate;
i2sParams.memorySlotLength = I2S_memory_length_16位;
i2sParams.fixedBufferLength = BufSize;
i2sParams.SD0Use = I2S_SD0_OUTPUT;
i2sParams.SD1Use = I2S_SD1_INPUT;
i2sParams.SD0Channels = I2S_SD0_DISABLED;
i2sParams.SD1Channels = I2S_Channels_Mono;i2sParams.Word

16位 Params.
i2sParams.invertWS = true;
i2sParams.isMSBFirst = true;
i2sParams.samplingEdge = I2S_SAMPLINE_EDGE_RISING;

i2sParams.readCallback = readCallbackFxn;
i2sParams.writeCallback = writeCallbackFxn;
i2sParams.errorCallback = errCallbackFxn;

i2sHandle = I2S_open (Board_I2S0、&i2sParams);
if (i2sHandle = NULL)
{
Display_printf (disHandle、0、0、"I2S 打开错误"、NULL、 空);
}

I2S_Transaction 初始化(&i2sRead1);
I2S_Transaction 初始化(&i2sRead2);
I2S_Transaction 初始化(&i2sRead3);
I2S_Transaction 初始化(&i2sRead4);

i2sRead1。 缓冲器 = readBuf1;
i2sRead2。 缓冲器 = readBuf2;
i2sRead3。 缓冲器 = readBuf3;
i2sRead4。 缓冲器 = readBuf4;

i2sRead1。 bufSize = sizeof (readBuF1);
i2sRead2。 bufSize = sizeof (readBuf2);
i2sRead3。 bufSize = sizeof (readBuf3);
i2sRead4。 bufSize = sizeof (readBuf4);

List_Put (&i2sReadList、(List_Elem *)&i2sRead1);
List_Put (&i2sReadList、(List_Elem*)&i2sRead2);
list_put (&i2sReadList、(List_Elem *)&i2sRead3);
List_put (&i2sReadList、(List_Elem *)&i2sRead4);

List_tail (&i2sReadList)-> next = List_head (&i2sReadList);
list_head (&i2sReadList)->prev = List_tail (&i2sReadList);
I2S_setReadQueueHead (i2sHandle、&i2sRead1);

I2S_Transaction_init (&i2sWrite1);
I2S_Transaction_Init (&i2sWrite2);
I2S_Transaction_init (&i2sWrite3);
I2S_Transaction_init (&i2sWrite4);

i2sWrite1.bufPtr = writeBuf1;
i2sWrite2.bufPtr = writeBuf2;
i2sWrite3.bufPtr = writeBuf3;
i2sWrite3.bufPtr = writeBuf4;

i2sWrite1.bufSize = sizeof (writeBuF1);
i2sWrite2.bufSize = sizeof (writeBuf2);
i2sWrite3.bufSize = sizeof (writeBuf3);
i2sWrite3.bufSize = sizeof (writeBuf4);

List_Put (&i2sWriteList、(List_Elem*)&i2sWrite1);
List_Put (&i2sWriteList、(List_Elem*)&i2sWrite2);
list_put (&i2sWriteList,(List_Elem*)&i2sWrite3);
List_put (&i2sWriteList,(List_Elem*)&i2sWrite4);
I2S_setWriteQueueHead (i2sHandle, i2sWrite1);

I2S_startClocks (i2sHandle);
I2S_startRead (i2sHandle);
I2S_startWrite (i2sHandle);
}/*=================================================================


*由 end ==========================================================================================添加
*/

int main (void)
{
Task_Params taskParams;

/*========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
*由 SKLEE 添加
=================================================================================================== *
pthread_t thread1;
pthread_attr_t atttrs1;
struct sched_param priParam1;
int retc1;
int detachState1;
/*========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
*已添加到结尾
=================================================================================================== */

#ifndef use_default_user_CFG
macUser0Cfg[0].pAssertFP = macHalAssertHandler;
#endif

/*
LED 等与电路板相关的东西进行初始化
遵循 TI-RTOS 惯例
*
//PIN_init (BoardGpioInitTable);
Board_init(); //由 collector.syscfg

#if defined (feature_OAD)定义
SPI_INIT ();
#endif

#if defined (Board_display_use_UART)
/*启用 System_printf (..) UART 输出*/
UART_INIT();
UART_PARAMS_INIT (&uartParams);
#ifndef TIMAC_AGAMA_FPGA
uartParams.baudrate = 115200;
#else
uartParams.baudrate = 460800;
#endif
UartPrintf_init (UART_OPEN (Board_UART0、&uartParams));
#endif // Board_display_use_UART */


#ifdef OSAL_PORT2TIRTOS
_macTaskId = macTaskInit (macUser0Cfg);
#endif
/*========================================================================================================1.
*由 SKLEE =========================================================================================
//
pthread_attr_init (&atttr1);
priParam1.sched_priority = 1;

detachState1 = pthread_create_detached;
retc1 = pthread_attr_setdetachstate (&attats1、detachState1);

if (retc1!= NULL){
Display_printf (disHandle、0、0、"pthread_attr 错误"、NULL、 null);
while (1);
}
pthread_attr_setschedparam (&attr1、&priParam1);

retc1 |= pthread_attr_setstacksize (&attr1、THREADSTACKSIZE);
if (retc1!= NULL){
Display_printf (disHandle、0、0、"pthread stack size error"、NULL、NULL);
while (1);
}

retc1 = pthread_create (&thread1、&attr1、i2sSysThread、NULL);
if (retc1!= NULL){
Display_printf (disHandle、0、0、"pthread creat error"、NULL、 null);
while (1);
}

/*=========================================================================
*添加了 end
=================================================================== *

/*配置任务。 *
Task_Params_init (&taskParams);
taskParams.stack = appTaskStack;
taskParams.STACKSIZE = APP_TASK_STACK_SIZE;
//taskParams.priority = app_task_priority;
taskParams.priority = 2;
Task_construction (&appTask、appTaskFxn、&taskParams、NULL);


#ifdef debug_sw_trace
IOCPortConfigureSet (IOID_8、IOC_PORT_RFC_TRC、IOC_STD_OUTPUT
| Ioc_CURRENT_4mA | Ioc_SLEW_ENABLE);
#endif // debug_sw_trace *

BIOS_start();//启用中断并启动 SYS/BIOS */

返回(0);
}
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Sung、  

    您是否查阅 过 I2S 文档

    谢谢、  
    ELIN

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Sung、

    我假设您还根据需要配置了编解码器 IC? 您是否使用逻辑分析仪等物理线路进行过任何验证?