summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Jochelson2019-05-24 18:30:52 -0500
committerMahesh Radhakrishnan2019-06-24 16:56:14 -0500
commit1adc3ea72d9f67a8a94ae919d085ecbfdb077834 (patch)
treec358f936bb80406bb62f9eb475c9a3d60a5c161f
parent1136a89e65a08271383a0ea8e2252b24c3339df3 (diff)
downloadmcasp-lld-1adc3ea72d9f67a8a94ae919d085ecbfdb077834.tar.gz
mcasp-lld-1adc3ea72d9f67a8a94ae919d085ecbfdb077834.tar.xz
mcasp-lld-1adc3ea72d9f67a8a94ae919d085ecbfdb077834.zip
Audio Loopback functional on MCU Cortex R5F.
Audio inputs through PCM3168A ADC to MCU Cortex R5F, and then is routed to PCM3168A DAC's. Line input -> J38 jack on motherboard. Output -> Top jack on J41. Attempted to use Board library for Board_control() setting the Audio Codec Reset Pin (via I2C3), but was not able to successfully get this to work. Instead, the application opens and closes the I2C3 handle, and needed to set i2cCfg.baseAddr to CSL_I2C3_CFG_BASE to get this functional.
-rw-r--r--example/j721e/src/audio_evmInit.c29
-rw-r--r--example/src/audioSample_io.c11
2 files changed, 31 insertions, 9 deletions
diff --git a/example/j721e/src/audio_evmInit.c b/example/j721e/src/audio_evmInit.c
index cdeec61..8bac6fe 100644
--- a/example/j721e/src/audio_evmInit.c
+++ b/example/j721e/src/audio_evmInit.c
@@ -319,6 +319,8 @@ void McASP_Enable(void)
319 MMR_lock_one(lock0, lock1); 319 MMR_lock_one(lock0, lock1);
320} 320}
321 321
322//#define USE_BOARD_LIB_FOR_I2C_HANDLE
323
322extern I2C_Handle gIoExpI2cHandle; 324extern I2C_Handle gIoExpI2cHandle;
323void IoExpanderConfig(void) 325void IoExpanderConfig(void)
324{ 326{
@@ -344,7 +346,6 @@ void IoExpanderConfig(void)
344 { 346 {
345 MCASP_log("I2C IO Exp Init failed\n"); 347 MCASP_log("I2C IO Exp Init failed\n");
346 } 348 }
347
348 /* Set MCASP/TRACE_MUX_S1 to HIGH */ 349 /* Set MCASP/TRACE_MUX_S1 to HIGH */
349 ioExpData |= 0x04U; 350 ioExpData |= 0x04U;
350 351
@@ -356,13 +357,14 @@ void IoExpanderConfig(void)
356 { 357 {
357 MCASP_log("I2C IO Exp Init failed\n"); 358 MCASP_log("I2C IO Exp Init failed\n");
358 } 359 }
359 360#if !defined(USE_BOARD_LIB_FOR_I2C_HANDLE)
360 /* Configure I2C3 needed for IOEXP_DEVICE3 */ 361 /* Configure I2C3 needed for IOEXP_DEVICE3 */
361 I2C_Params_init(&i2cParams); 362 I2C_Params_init(&i2cParams);
362 i2cParams.transferMode = I2C_MODE_BLOCKING; 363 i2cParams.transferMode = I2C_MODE_BLOCKING;
363 364
364 I2C_socGetInitCfg(3, &i2cCfg); 365 I2C_socGetInitCfg(3, &i2cCfg);
365 enableIntrTmp = i2cCfg.enableIntr; 366 enableIntrTmp = i2cCfg.enableIntr;
367 i2cCfg.baseAddr = CSL_I2C3_CFG_BASE;
366 i2cCfg.enableIntr = false; 368 i2cCfg.enableIntr = false;
367 I2C_socSetInitCfg(3, &i2cCfg); 369 I2C_socSetInitCfg(3, &i2cCfg);
368 370
@@ -394,7 +396,25 @@ void IoExpanderConfig(void)
394 { 396 {
395 MCASP_log("I2C IO Exp Init failed\n"); 397 MCASP_log("I2C IO Exp Init failed\n");
396 } 398 }
397 399#else
400 Board_IoExpCfg_t ioExpCfg;
401 ioExpCfg.slaveAddr = BOARD_I2C_IOEXP_DEVICE3_ADDR;
402 ioExpCfg.i2cInst = BOARD_I2C_IOEXP_DEVICE3_INSTANCE;
403 ioExpCfg.socDomain = BOARD_SOC_DOMAIN_MAIN;
404 ioExpCfg.enableIntr = false;
405 ioExpCfg.ioExpType = ONE_PORT_IOEXP;
406 ioExpCfg.portNum = PORTNUM_0;
407 ioExpCfg.pinNum = PIN_NUM_0;
408 ioExpCfg.signalLevel = GPIO_SIGNAL_LEVEL_HIGH;
409
410 //UART_printf("IoExpanderConfig: About to call Board_control, BOARD_I2C_IOEXP_DEVICE3_ADDR = 0x%x, " \
411 // "BOARD_I2C_IOEXP_DEVICE3_INSTANCE = %d, PORTNUM_0 = %d, PIN_NUM_0 = %d, GPIO_SIGNAL_LEVEL_HIGH = %d\n",
412 // BOARD_I2C_IOEXP_DEVICE3_ADDR,
413 // BOARD_I2C_IOEXP_DEVICE3_INSTANCE, PORTNUM_0, PIN_NUM_0,
414 // GPIO_SIGNAL_LEVEL_HIGH);
415 Board_control(BOARD_CTRL_CMD_SET_IO_EXP_PIN_OUT, (void *)&ioExpCfg);
416#endif
417#if !defined(USE_BOARD_LIB_FOR_I2C_HANDLE)
398 /* Close I2C3 */ 418 /* Close I2C3 */
399 I2C_close(handle); 419 I2C_close(handle);
400 420
@@ -404,6 +424,7 @@ void IoExpanderConfig(void)
404 424
405 /* Restore global IO Exp handle */ 425 /* Restore global IO Exp handle */
406 gIoExpI2cHandle = tmpHandle; 426 gIoExpI2cHandle = tmpHandle;
427#endif
407} 428}
408 429
409/* 430/*
diff --git a/example/src/audioSample_io.c b/example/src/audioSample_io.c
index dcd8f6e..fe92586 100644
--- a/example/src/audioSample_io.c
+++ b/example/src/audioSample_io.c
@@ -124,7 +124,8 @@ extern HeapMem_Handle myHeap;
124 * In addition, the buffer should be of a size multiple of 128 bytes for 124 * In addition, the buffer should be of a size multiple of 128 bytes for
125 * the cache work optimally on the C6x. 125 * the cache work optimally on the C6x.
126 */ 126 */
127#define BUFLEN (128) /* number of samples per serializer in the frame */ 127//#define BUFLEN (128) /* number of samples per serializer in the frame */
128#define BUFLEN (512) /* number of samples per serializer in the frame */
128#define BUFALIGN 128 /* alignment of buffer for use of L2 cache */ 129#define BUFALIGN 128 /* alignment of buffer for use of L2 cache */
129 130
130/* This is the number of buffers used by the application to be issued and reclaimed 131/* This is the number of buffers used by the application to be issued and reclaimed
@@ -740,10 +741,10 @@ Udma_DrvHandle McaspApp_udmaInit(Mcasp_HwInfo *cfg)
740 instId = UDMA_INST_ID_MAIN_0; 741 instId = UDMA_INST_ID_MAIN_0;
741 742
742 UdmaInitPrms_init(instId, &initPrms); 743 UdmaInitPrms_init(instId, &initPrms);
743 //initPrms.rmInitPrms.startRxCh = 132U; 744 initPrms.rmInitPrms.startRxCh = 132U;
744 //initPrms.rmInitPrms.numRxCh = 1; 745 initPrms.rmInitPrms.numRxCh = 1;
745 //initPrms.rmInitPrms.startTxCh = 132U; 746 initPrms.rmInitPrms.startTxCh = 132U;
746 //initPrms.rmInitPrms.numTxCh = 1; 747 initPrms.rmInitPrms.numTxCh = 1;
747 retVal = Udma_init(&gUdmaDrvObj, &initPrms); 748 retVal = Udma_init(&gUdmaDrvObj, &initPrms);
748 if(UDMA_SOK == retVal) 749 if(UDMA_SOK == retVal)
749 { 750 {