From 373688cd03be58eaed55a680082b3bd5a8a077e8 Mon Sep 17 00:00:00 2001 From: Sinthu Raja M Date: Tue, 24 Jul 2018 16:49:07 +0530 Subject: [PATCH] PRSDK-4301 Add UART print console support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add UART print function to print messages on to the UART console. Add unit test print phrase Äll unit test have passed --- ...CBSP_evmc6657_C66DigLpbkExampleProject.txt | 2 +- .../c6657/MCBSPDigLpbk/mcbspMasterDigLpbk.c | 94 ++++++++++--------- .../MCBSP_DigLpbkC66ExampleProject.txt | 2 +- .../c674x/MCBSPDigLpbk/mcbspMasterDigLpbk.c | 94 ++++++++++--------- example/include/MCBSP_log.h | 77 +++++++++++++++ .../MCBSP_DigLpbkevmK2Gc66ExampleProject.txt | 2 +- example/k2g/MCBSPDigLpbk/mcbspMasterDigLpbk.c | 94 ++++++++++--------- ...gLpbk_lcdkOMAPL138_c674xExampleProject.txt | 2 +- .../MCBSPDigLpbk/mcbspMasterDigLpbk.c | 94 ++++++++++--------- 9 files changed, 273 insertions(+), 188 deletions(-) create mode 100644 example/include/MCBSP_log.h diff --git a/example/c6657/MCBSPDigLpbk/MCBSP_evmc6657_C66DigLpbkExampleProject.txt b/example/c6657/MCBSPDigLpbk/MCBSP_evmc6657_C66DigLpbkExampleProject.txt index d5967ca..1c429a4 100644 --- a/example/c6657/MCBSPDigLpbk/MCBSP_evmc6657_C66DigLpbkExampleProject.txt +++ b/example/c6657/MCBSPDigLpbk/MCBSP_evmc6657_C66DigLpbkExampleProject.txt @@ -4,4 +4,4 @@ -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/c6657/MCBSPDigLpbk/mcbspMasterDigLpbk.cfg" -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/c6657/MCBSPDigLpbk/mcbspMasterDigLpbk_osal.c" --ccs.setCompilerOptions "-DSOC_C6657 -DMCBSP_DEBUG_TEMP -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/c6657/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc +-ccs.setCompilerOptions "-DSOC_C6657 -DMCBSP_DEBUG_TEMP -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/c6657/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc diff --git a/example/c6657/MCBSPDigLpbk/mcbspMasterDigLpbk.c b/example/c6657/MCBSPDigLpbk/mcbspMasterDigLpbk.c index e2f11b2..22a7fa9 100644 --- a/example/c6657/MCBSPDigLpbk/mcbspMasterDigLpbk.c +++ b/example/c6657/MCBSPDigLpbk/mcbspMasterDigLpbk.c @@ -51,6 +51,7 @@ #include #include +#include /* Include EDMA3 Driver */ #include @@ -381,7 +382,7 @@ void mcbspAppCallback(void* arg, Mcbsp_IOBuf *ioBuf) */ void mcbsp_GblErrCallback(uint32_t chanHandle,uint32_t spcr_read,uint32_t Arg3) { - System_printf ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); + MCBSP_log ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); } /* @@ -417,7 +418,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) /* Initialize the OSAL */ if (Osal_dataBufferInitMemory(BUFSIZE) < 0) { - System_printf ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); return; } @@ -446,7 +447,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (status != MCBSP_STATUS_COMPLETED) { - System_printf ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); return; } @@ -458,7 +459,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -470,7 +471,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } @@ -486,12 +487,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -504,12 +505,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -524,7 +525,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) ((uint8_t *)bufTx[count])[tempCount] = (tempCount % 0x100); } } - System_printf ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); + MCBSP_log ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); restart_mcbsp_point: txFrameIndex=0; @@ -557,13 +558,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); #endif } rxFrameIndex++; @@ -586,13 +587,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); #endif } txFrameIndex++; @@ -607,7 +608,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -615,7 +616,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -658,13 +659,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } rxFrameIndex++; @@ -686,13 +687,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } txFrameIndex++; @@ -706,7 +707,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -714,7 +715,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -739,9 +740,9 @@ restart_mcbsp_point: if (((char *)bufTx[count])[tempCount] != ((char *)bufRx[count])[tempCount]) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", + MCBSP_log("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", coreNum, count); - System_printf("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, + MCBSP_log("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, tempCount, ((char *)bufTx[count])[tempCount], ((char *)bufRx[count])[tempCount]); #endif errBuffCount++; @@ -751,7 +752,7 @@ restart_mcbsp_point: if (tempCount >= BUFSIZE) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); + MCBSP_log("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); #endif } } @@ -770,7 +771,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -778,14 +779,14 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } /* Create a RX channel for receiving */ status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -793,7 +794,7 @@ restart_mcbsp_point: status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } edmaTxDone = 0; /* Reset for next iteration */ @@ -812,13 +813,14 @@ restart_mcbsp_point: if ((errBuffCount == 0 ) & (retval ==0)) { - System_printf("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ "Num iterations %d Num buffers per iteration %d!!!\n", coreNum, num_iterations, NUM_BUFS); + MCBSP_log("\n All tests have passed \n"); } else { - System_printf("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ "Num iterations %d Num buffers per iteration %d Failed buffers %d!!!\n", coreNum, num_iterations, NUM_BUFS, errBuffCount); } @@ -827,7 +829,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -835,7 +837,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } return; @@ -870,21 +872,21 @@ Void main(Void) #ifdef SIMULATOR_SUPPORT #warn MCBSP Digital Loopback example is not supported on SIMULATOR !!! - System_printf ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); + MCBSP_log ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); return; #else - System_printf ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); + MCBSP_log ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); #endif /* Initialize the system only if the core was configured to do so. */ if (coreNum == CORE_SYS_INIT) { #if 0 - System_printf ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); + MCBSP_log ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); /* Read FPGA register */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } /* Clear field for configuration */ @@ -896,25 +898,25 @@ Void main(Void) * These clocks and syncs are tri-stated and McBSP is accessed over 80-pin header */ if (0 != (platform_fpgaWriteConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, (uchValue)))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); return; } /* DEBUG: Verify if FPGA register is configured correctly */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } if (uchValue != uchReadValue) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); return; } else { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); } #endif /* MCBSP Driver Initialization: This should always be called before @@ -925,7 +927,7 @@ Void main(Void) McbspDevice_init(); /* MCBSP Driver is operational at this time. */ - System_printf ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); /* Write to the SHARED memory location at this point in time. The other cores cannot execute * till the MCBSP Driver is up and running. */ @@ -940,7 +942,7 @@ Void main(Void) else { /* All other cores need to wait for the MCBSP to be initialized before they proceed with the test. */ - System_printf ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); + MCBSP_log ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); /* All other cores loop around forever till the MCBSP is up and running. * We need to invalidate the cache so that we always read this from the memory. */ @@ -949,7 +951,7 @@ Void main(Void) Cache_inv ((void *) &isMCBSPInitialized[0], MCBSP_CACHE_LENGTH, 0x7fff, 1); - System_printf ("Debug(Core %d): MCBSP can now be used.\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP can now be used.\n", coreNum); } /* Enabling the dmaChannel MCBSP Events to EDMA (36-40) */ temp=sampleEdma3GblCfgParams[0].dmaChannelHwEvtMap[1]; @@ -969,11 +971,11 @@ Void main(Void) if (edmaResult != EDMA3_DRV_SOK) { /* Report EDMA Error */ - System_printf("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); } else { - System_printf("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); } /* Create the Digital Loopback Application Task */ diff --git a/example/c674x/MCBSPDigLpbk/MCBSP_DigLpbkC66ExampleProject.txt b/example/c674x/MCBSPDigLpbk/MCBSP_DigLpbkC66ExampleProject.txt index 433f4cb..2565bf5 100644 --- a/example/c674x/MCBSPDigLpbk/MCBSP_DigLpbkC66ExampleProject.txt +++ b/example/c674x/MCBSPDigLpbk/MCBSP_DigLpbkC66ExampleProject.txt @@ -8,4 +8,4 @@ -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/c674x/MCBSPDigLpbk/sample_cs.c" -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/c674x/MCBSPDigLpbk/sample_init.c" --ccs.setCompilerOptions "-Domapl138 -DMCBSP_DEBUG_TEMP -mv6740 -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc +-ccs.setCompilerOptions "-Domapl138 -DMCBSP_DEBUG_TEMP -mv6740 -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc diff --git a/example/c674x/MCBSPDigLpbk/mcbspMasterDigLpbk.c b/example/c674x/MCBSPDigLpbk/mcbspMasterDigLpbk.c index 688d782..005508e 100644 --- a/example/c674x/MCBSPDigLpbk/mcbspMasterDigLpbk.c +++ b/example/c674x/MCBSPDigLpbk/mcbspMasterDigLpbk.c @@ -67,6 +67,7 @@ #include #include #include +#include /* PlatformLib Include File */ //#include @@ -378,7 +379,7 @@ void mcbspAppCallback(void* arg, Mcbsp_IOBuf *ioBuf) */ void mcbsp_GblErrCallback(uint32_t chanHandle,uint32_t spcr_read,uint32_t Arg3) { - System_printf ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); + MCBSP_log ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); } /* @@ -414,7 +415,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) /* Initialize the OSAL */ if (Osal_dataBufferInitMemory(BUFSIZE) < 0) { - System_printf ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); return; } @@ -443,7 +444,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (status != MCBSP_STATUS_COMPLETED) { - System_printf ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); return; } @@ -455,7 +456,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -467,7 +468,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } @@ -483,12 +484,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -501,12 +502,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -521,7 +522,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) ((uint8_t *)bufTx[count])[tempCount] = (tempCount % 0x100); } } - System_printf ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); + MCBSP_log ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); restart_mcbsp_point: txFrameIndex=0; @@ -554,13 +555,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); #endif } rxFrameIndex++; @@ -583,13 +584,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); #endif } txFrameIndex++; @@ -604,7 +605,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -612,7 +613,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -655,13 +656,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } rxFrameIndex++; @@ -683,13 +684,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } txFrameIndex++; @@ -703,7 +704,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -711,7 +712,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -736,9 +737,9 @@ restart_mcbsp_point: if (((char *)bufTx[count])[tempCount] != ((char *)bufRx[count])[tempCount]) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", + MCBSP_log("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", coreNum, count); - System_printf("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, + MCBSP_log("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, tempCount, ((char *)bufTx[count])[tempCount], ((char *)bufRx[count])[tempCount]); #endif errBuffCount++; @@ -748,7 +749,7 @@ restart_mcbsp_point: if (tempCount >= BUFSIZE) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); + MCBSP_log("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); #endif } } @@ -767,7 +768,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -775,14 +776,14 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } /* Create a RX channel for receiving */ status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -790,7 +791,7 @@ restart_mcbsp_point: status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } edmaTxDone = 0; /* Reset for next iteration */ @@ -809,13 +810,14 @@ restart_mcbsp_point: if ((errBuffCount == 0 ) & (retval ==0)) { - System_printf("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ "Num iterations %d Num buffers per iteration %d!!!\n", coreNum, num_iterations, NUM_BUFS); + MCBSP_log("\n All tests have passed \n"); } else { - System_printf("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ "Num iterations %d Num buffers per iteration %d Failed buffers %d!!!\n", coreNum, num_iterations, NUM_BUFS, errBuffCount); } @@ -824,7 +826,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -832,7 +834,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } return; @@ -866,21 +868,21 @@ Void main(Void) #ifdef SIMULATOR_SUPPORT #warn MCBSP Digital Loopback example is not supported on SIMULATOR !!! - System_printf ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); + MCBSP_log ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); return; #else - System_printf ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); + MCBSP_log ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); #endif /* Initialize the system only if the core was configured to do so. */ if (coreNum == CORE_SYS_INIT) { #if 0 - System_printf ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); + MCBSP_log ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); /* Read FPGA register */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } /* Clear field for configuration */ @@ -892,25 +894,25 @@ Void main(Void) * These clocks and syncs are tri-stated and McBSP is accessed over 80-pin header */ if (0 != (platform_fpgaWriteConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, (uchValue)))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); return; } /* DEBUG: Verify if FPGA register is configured correctly */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } if (uchValue != uchReadValue) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); return; } else { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); } #endif /* MCBSP Driver Initialization: This should always be called before @@ -921,7 +923,7 @@ Void main(Void) McbspDevice_init(); /* MCBSP Driver is operational at this time. */ - System_printf ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); /* Write to the SHARED memory location at this point in time. The other cores cannot execute * till the MCBSP Driver is up and running. */ @@ -936,7 +938,7 @@ Void main(Void) else { /* All other cores need to wait for the MCBSP to be initialized before they proceed with the test. */ - System_printf ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); + MCBSP_log ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); /* All other cores loop around forever till the MCBSP is up and running. * We need to invalidate the cache so that we always read this from the memory. */ @@ -945,7 +947,7 @@ Void main(Void) Cache_inv ((void *) &isMCBSPInitialized[0], MCBSP_CACHE_LENGTH, 0x7fff, 1); - System_printf ("Debug(Core %d): MCBSP can now be used.\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP can now be used.\n", coreNum); } /* Initialize EDMA3 library */ @@ -954,11 +956,11 @@ Void main(Void) if (edmaResult != EDMA3_DRV_SOK) { /* Report EDMA Error */ - System_printf("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); } else { - System_printf("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); } /* Create the Digital Loopback Application Task */ diff --git a/example/include/MCBSP_log.h b/example/include/MCBSP_log.h new file mode 100644 index 0000000..603091b --- /dev/null +++ b/example/include/MCBSP_log.h @@ -0,0 +1,77 @@ +/** + * \file MCBSP_log.h + * + * \brief This file contains the prototypes for the log print functions. By + default the prints will be directed to serial console using UART. + * + */ + +/* + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _MCBSP_LOG_H +#define _MCBSP_LOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* UART Header files */ +#include +#include + +/********************************************************************** + ************************** Global Variables ************************** + **********************************************************************/ +extern void UART_printf(const char *pcString, ...); +extern void ConsoleUtilsInit(void); + +/********************************************************************** + ************************** Macros ************************************ + **********************************************************************/ +/* Enable the below macro to have prints on the IO Console */ +//#define IO_CONSOLE + +#ifndef IO_CONSOLE +#define MCBSP_log UART_printf +#else +#define MCBSP_log System_printf +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _MCBSP_LOG_H */ diff --git a/example/k2g/MCBSPDigLpbk/MCBSP_DigLpbkevmK2Gc66ExampleProject.txt b/example/k2g/MCBSPDigLpbk/MCBSP_DigLpbkevmK2Gc66ExampleProject.txt index ae0e011..3b4f5ff 100644 --- a/example/k2g/MCBSPDigLpbk/MCBSP_DigLpbkevmK2Gc66ExampleProject.txt +++ b/example/k2g/MCBSPDigLpbk/MCBSP_DigLpbkevmK2Gc66ExampleProject.txt @@ -8,4 +8,4 @@ -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/k2g/MCBSPDigLpbk/sample_cs.c" -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/k2g/MCBSPDigLpbk/sample_init.c" --ccs.setCompilerOptions "-DDEVICE_K2G -DMCBSP_DEBUG_TEMP -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/k2g/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc +-ccs.setCompilerOptions "-DDEVICE_K2G -DMCBSP_DEBUG_TEMP -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/k2g/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc diff --git a/example/k2g/MCBSPDigLpbk/mcbspMasterDigLpbk.c b/example/k2g/MCBSPDigLpbk/mcbspMasterDigLpbk.c index 888acbe..03a52bc 100644 --- a/example/k2g/MCBSPDigLpbk/mcbspMasterDigLpbk.c +++ b/example/k2g/MCBSPDigLpbk/mcbspMasterDigLpbk.c @@ -51,6 +51,7 @@ #include #include +#include /* Include EDMA3 Driver */ #include @@ -379,7 +380,7 @@ void mcbspAppCallback(void* arg, Mcbsp_IOBuf *ioBuf) */ void mcbsp_GblErrCallback(uint32_t chanHandle,uint32_t spcr_read,uint32_t Arg3) { - System_printf ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); + MCBSP_log ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); } /* @@ -415,7 +416,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) /* Initialize the OSAL */ if (Osal_dataBufferInitMemory(BUFSIZE) < 0) { - System_printf ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); return; } @@ -444,7 +445,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (status != MCBSP_STATUS_COMPLETED) { - System_printf ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); return; } @@ -456,7 +457,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -468,7 +469,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } @@ -484,12 +485,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -502,12 +503,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -522,7 +523,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) ((uint8_t *)bufTx[count])[tempCount] = (tempCount % 0x100); } } - System_printf ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); + MCBSP_log ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); restart_mcbsp_point: txFrameIndex=0; @@ -555,13 +556,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); #endif } rxFrameIndex++; @@ -584,13 +585,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); #endif } txFrameIndex++; @@ -605,7 +606,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -613,7 +614,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -656,13 +657,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } rxFrameIndex++; @@ -684,13 +685,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } txFrameIndex++; @@ -704,7 +705,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -712,7 +713,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -737,9 +738,9 @@ restart_mcbsp_point: if (((char *)bufTx[count])[tempCount] != ((char *)bufRx[count])[tempCount]) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", + MCBSP_log("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", coreNum, count); - System_printf("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, + MCBSP_log("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, tempCount, ((char *)bufTx[count])[tempCount], ((char *)bufRx[count])[tempCount]); #endif errBuffCount++; @@ -749,7 +750,7 @@ restart_mcbsp_point: if (tempCount >= BUFSIZE) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); + MCBSP_log("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); #endif } } @@ -768,7 +769,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -776,14 +777,14 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } /* Create a RX channel for receiving */ status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -791,7 +792,7 @@ restart_mcbsp_point: status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } edmaTxDone = 0; /* Reset for next iteration */ @@ -810,13 +811,14 @@ restart_mcbsp_point: if ((errBuffCount == 0 ) & (retval ==0)) { - System_printf("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ "Num iterations %d Num buffers per iteration %d!!!\n", coreNum, num_iterations, NUM_BUFS); + MCBSP_log("\n All tests have passed \n"); } else { - System_printf("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ "Num iterations %d Num buffers per iteration %d Failed buffers %d!!!\n", coreNum, num_iterations, NUM_BUFS, errBuffCount); } @@ -825,7 +827,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -833,7 +835,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } return; @@ -867,21 +869,21 @@ Void main(Void) #ifdef SIMULATOR_SUPPORT #warn MCBSP Digital Loopback example is not supported on SIMULATOR !!! - System_printf ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); + MCBSP_log ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); return; #else - System_printf ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); + MCBSP_log ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); #endif /* Initialize the system only if the core was configured to do so. */ if (coreNum == CORE_SYS_INIT) { #if 0 - System_printf ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); + MCBSP_log ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); /* Read FPGA register */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } /* Clear field for configuration */ @@ -893,25 +895,25 @@ Void main(Void) * These clocks and syncs are tri-stated and McBSP is accessed over 80-pin header */ if (0 != (platform_fpgaWriteConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, (uchValue)))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); return; } /* DEBUG: Verify if FPGA register is configured correctly */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } if (uchValue != uchReadValue) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); return; } else { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); } #endif /* MCBSP Driver Initialization: This should always be called before @@ -922,7 +924,7 @@ Void main(Void) McbspDevice_init(); /* MCBSP Driver is operational at this time. */ - System_printf ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); /* Write to the SHARED memory location at this point in time. The other cores cannot execute * till the MCBSP Driver is up and running. */ @@ -937,7 +939,7 @@ Void main(Void) else { /* All other cores need to wait for the MCBSP to be initialized before they proceed with the test. */ - System_printf ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); + MCBSP_log ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); /* All other cores loop around forever till the MCBSP is up and running. * We need to invalidate the cache so that we always read this from the memory. */ @@ -946,7 +948,7 @@ Void main(Void) Cache_inv ((void *) &isMCBSPInitialized[0], MCBSP_CACHE_LENGTH, 0x7fff, 1); - System_printf ("Debug(Core %d): MCBSP can now be used.\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP can now be used.\n", coreNum); } /* Initialize EDMA3 library */ @@ -955,11 +957,11 @@ Void main(Void) if (edmaResult != EDMA3_DRV_SOK) { /* Report EDMA Error */ - System_printf("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); } else { - System_printf("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); } /* Create the Digital Loopback Application Task */ diff --git a/example/omapl138/MCBSPDigLpbk/MCBSP_DigLpbk_lcdkOMAPL138_c674xExampleProject.txt b/example/omapl138/MCBSPDigLpbk/MCBSP_DigLpbk_lcdkOMAPL138_c674xExampleProject.txt index a9eb08f..6ef721e 100644 --- a/example/omapl138/MCBSPDigLpbk/MCBSP_DigLpbk_lcdkOMAPL138_c674xExampleProject.txt +++ b/example/omapl138/MCBSPDigLpbk/MCBSP_DigLpbk_lcdkOMAPL138_c674xExampleProject.txt @@ -8,4 +8,4 @@ -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/omapl138/MCBSPDigLpbk/sample_cs.c" -ccs.linkFile "${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/omapl138/MCBSPDigLpbk/sample_init.c" --ccs.setCompilerOptions "-mv6740 --abi=eabi -g --define=SOC_OMAPL138 --define=LCDK_OMAPL138 -DMCBSP_DEBUG_TEMP -mv6740 -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/omapl138/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc +-ccs.setCompilerOptions "-mv6740 --abi=eabi -g --define=SOC_OMAPL138 --define=LCDK_OMAPL138 -DMCBSP_DEBUG_TEMP -mv6740 -g --diag_warning=225 -I${PDK_INSTALL_PATH} -I${BIOS_INSTALL_PATH}/packages -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/omapl138/MCBSPDigLpbk -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/example/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp/include -I${PDK_INSTALL_PATH}/ti/drv/mcbsp -I${PDK_INSTALL_PATH}/ti/board" -rtsc.enableRtsc diff --git a/example/omapl138/MCBSPDigLpbk/mcbspMasterDigLpbk.c b/example/omapl138/MCBSPDigLpbk/mcbspMasterDigLpbk.c index 3426cd1..86516a1 100644 --- a/example/omapl138/MCBSPDigLpbk/mcbspMasterDigLpbk.c +++ b/example/omapl138/MCBSPDigLpbk/mcbspMasterDigLpbk.c @@ -67,6 +67,7 @@ #include #include #include +#include /* PlatformLib Include File */ //#include @@ -378,7 +379,7 @@ void mcbspAppCallback(void* arg, Mcbsp_IOBuf *ioBuf) */ void mcbsp_GblErrCallback(uint32_t chanHandle,uint32_t spcr_read,uint32_t Arg3) { - System_printf ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); + MCBSP_log ("Debug(Core %d): ERROR callback called SPCR: %x", coreNum, spcr_read); } /* @@ -414,7 +415,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) /* Initialize the OSAL */ if (Osal_dataBufferInitMemory(BUFSIZE) < 0) { - System_printf ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Unable to initialize the OSAL. \n", coreNum); return; } @@ -443,7 +444,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (status != MCBSP_STATUS_COMPLETED) { - System_printf ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP LLD Bind Device Failed\n", coreNum); return; } @@ -455,7 +456,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -467,7 +468,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } @@ -483,12 +484,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRx[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -501,12 +502,12 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) if (bufTxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Tx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } if (bufRxPingPong[count] == NULL) { - System_printf ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: Rx Ping pong Buffer (%d) Memory Allocation Failed\n", coreNum, count); return; } } @@ -521,7 +522,7 @@ void mcbspDigLpbkApp(UArg arg0, UArg arg1) ((uint8_t *)bufTx[count])[tempCount] = (tempCount % 0x100); } } - System_printf ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); + MCBSP_log ("Debug(Core %d): If required to restart set debugCommand variable to %d\n", coreNum, DEBUG_COMMAND_RESTART_CHANNELS); restart_mcbsp_point: txFrameIndex=0; @@ -554,13 +555,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, init_count); #endif } rxFrameIndex++; @@ -583,13 +584,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, init_count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); + MCBSP_log ("Debug(Core %d): TX buffer #%d submission is submitted to MCBSP driver\n", coreNum, init_count); #endif } txFrameIndex++; @@ -604,7 +605,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -612,7 +613,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Iteration-%d frames are received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -655,13 +656,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspRxChan, (void *)&rxFrame[rxFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: RX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): RX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } rxFrameIndex++; @@ -683,13 +684,13 @@ restart_mcbsp_point: status = mcbspSubmitChan(hMcbspTxChan, (void *)&txFrame[txFrameIndex]); if (status != MCBSP_STATUS_PENDING) { - System_printf ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); + MCBSP_log ("Debug(Core %d): Error: TX buffer #%d submission FAILED\n", coreNum, count); retval = 1; } else { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); + MCBSP_log ("Debug(Core %d): TX buffer #%d is submitted to MCBSP driver\n", coreNum, count); #endif } txFrameIndex++; @@ -703,7 +704,7 @@ restart_mcbsp_point: if (edmaTxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is transmitted to TX path\n", coreNum, count); #endif edmaTxDone = 0; /* Reset for next iteration */ mcbspTxDone = 1; @@ -711,7 +712,7 @@ restart_mcbsp_point: if (edmaRxDone == 1) { #ifdef MCBSP_APP_VERBOSE - System_printf ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); + MCBSP_log ("Debug(Core %d): EDMA -> Buffer #-%d is received from RX path\n", coreNum, count); #endif edmaRxDone = 0; /* Reset for next iteration */ mcbspRxDone = 1; @@ -736,9 +737,9 @@ restart_mcbsp_point: if (((char *)bufTx[count])[tempCount] != ((char *)bufRx[count])[tempCount]) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", + MCBSP_log("Debug(Core %d): Error: TX and RX frame data DOES NOT match in Buffer #-%d\n", coreNum, count); - System_printf("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, + MCBSP_log("Debug(Core %d): Error: Buffer index = %d, Tx data = %d, Rx data = %d\n", coreNum, tempCount, ((char *)bufTx[count])[tempCount], ((char *)bufRx[count])[tempCount]); #endif errBuffCount++; @@ -748,7 +749,7 @@ restart_mcbsp_point: if (tempCount >= BUFSIZE) { #ifdef MCBSP_APP_VERBOSE - System_printf("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); + MCBSP_log("Debug(Core %d): TX and RX frames data match in iteration-%d !!!\n", coreNum, count); #endif } } @@ -767,7 +768,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -775,14 +776,14 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } /* Create a RX channel for receiving */ status = mcbspCreateChan(&hMcbspRxChan, hMcbspDev, MCBSP_MODE_INPUT, &mcbspChanparamRx, mcbspAppCallback, &rxChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (RX) failed\n", coreNum); return; } @@ -790,7 +791,7 @@ restart_mcbsp_point: status = mcbspCreateChan(&hMcbspTxChan, hMcbspDev, MCBSP_MODE_OUTPUT, &mcbspChanparamTx, mcbspAppCallback, &txChanMode); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Create Channel (TX) failed\n", coreNum); return; } edmaTxDone = 0; /* Reset for next iteration */ @@ -809,13 +810,14 @@ restart_mcbsp_point: if ((errBuffCount == 0 ) & (retval ==0)) { - System_printf("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback Application completed successfully : "\ "Num iterations %d Num buffers per iteration %d!!!\n", coreNum, num_iterations, NUM_BUFS); + MCBSP_log("\n All tests have passed \n"); } else { - System_printf("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ + MCBSP_log("Debug(Core %d): MCBSP Digital Loopback application FAILED : "\ "Num iterations %d Num buffers per iteration %d Failed buffers %d!!!\n", coreNum, num_iterations, NUM_BUFS, errBuffCount); } @@ -824,7 +826,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspRxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (RX) failed\n", coreNum); return; } @@ -832,7 +834,7 @@ restart_mcbsp_point: status = mcbspDeleteChan(hMcbspTxChan); if (MCBSP_STATUS_COMPLETED != status) { - System_printf ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); + MCBSP_log ("Debug(Core %d): Error: Delete Channel (TX) failed\n", coreNum); return; } return; @@ -866,21 +868,21 @@ Void main(Void) #ifdef SIMULATOR_SUPPORT #warn MCBSP Digital Loopback example is not supported on SIMULATOR !!! - System_printf ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); + MCBSP_log ("MCBSP Digital Loopback example is not supported on SIMULATOR. Exiting!\n"); return; #else - System_printf ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); + MCBSP_log ("Debug(Core %d): Running MCBSP Digital Loopback example on the DEVICE\n", coreNum); #endif /* Initialize the system only if the core was configured to do so. */ if (coreNum == CORE_SYS_INIT) { #if 0 - System_printf ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); + MCBSP_log ("Debug(Core %d): System Initialization for MCBSP\n", coreNum); /* Read FPGA register */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } /* Clear field for configuration */ @@ -892,25 +894,25 @@ Void main(Void) * These clocks and syncs are tri-stated and McBSP is accessed over 80-pin header */ if (0 != (platform_fpgaWriteConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, (uchValue)))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register WRITE failed \n", coreNum); return; } /* DEBUG: Verify if FPGA register is configured correctly */ if (0 != (platform_fpgaReadConfigReg(MCBSP_FPGA_MISC_REG_OFFSET, &uchReadValue))) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register READ failed \n", coreNum); return; } if (uchValue != uchReadValue) { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register setting failed \n", coreNum); return; } else { - System_printf ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); + MCBSP_log ("Debug(Core %d): FPGA McBSP_AMC_EN# register is set to %d \n", coreNum, uchValue); } #endif /* MCBSP Driver Initialization: This should always be called before @@ -921,7 +923,7 @@ Void main(Void) McbspDevice_init(); /* MCBSP Driver is operational at this time. */ - System_printf ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP Driver Initialization Done\n", coreNum); /* Write to the SHARED memory location at this point in time. The other cores cannot execute * till the MCBSP Driver is up and running. */ @@ -936,7 +938,7 @@ Void main(Void) else { /* All other cores need to wait for the MCBSP to be initialized before they proceed with the test. */ - System_printf ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); + MCBSP_log ("Debug(Core %d): Waiting for MCBSP to be initialized.\n", coreNum); /* All other cores loop around forever till the MCBSP is up and running. * We need to invalidate the cache so that we always read this from the memory. */ @@ -945,7 +947,7 @@ Void main(Void) Cache_inv ((void *) &isMCBSPInitialized[0], MCBSP_CACHE_LENGTH, 0x7fff, 1); - System_printf ("Debug(Core %d): MCBSP can now be used.\n", coreNum); + MCBSP_log ("Debug(Core %d): MCBSP can now be used.\n", coreNum); } /* Initialize EDMA3 library */ @@ -954,11 +956,11 @@ Void main(Void) if (edmaResult != EDMA3_DRV_SOK) { /* Report EDMA Error */ - System_printf("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization FAILED\n", coreNum); } else { - System_printf("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); + MCBSP_log("Debug(Core %d): EDMA Driver Initialization Done\n", coreNum); } /* Create the Digital Loopback Application Task */ -- 2.39.2