summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 31bd284)
raw | patch | inline | side by side (parent: 31bd284)
author | Frank Livingston <frank-livingston@ti.com> | |
Wed, 6 Jun 2018 22:21:43 +0000 (17:21 -0500) | ||
committer | Frank Livingston <frank-livingston@ti.com> | |
Wed, 6 Jun 2018 22:21:43 +0000 (17:21 -0500) |
Add "proof of concept" code to asopSetCheckRateX() for setting Tx McASP
CLKXDIV using McASP LLD.
The "proof of concept" code only works for HDMI input & output sampling
rates 44.1,48,88.2,96 & 192 kHz.
Additional integration work needs to be done for asopSetCheckRateX()
full functionality. See sap_d10.c:manageOutput() for details of required
functionality.
CLKXDIV using McASP LLD.
The "proof of concept" code only works for HDMI input & output sampling
rates 44.1,48,88.2,96 & 192 kHz.
Additional integration work needs to be done for asopSetCheckRateX()
full functionality. See sap_d10.c:manageOutput() for details of required
functionality.
diff --git a/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c b/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c
index 84d525c83631c5869794344ccac9edb3121db9df..041aaf9c8510dc5f04017b7b56183136822b85c7 100644 (file)
PAF_AST_IoInp *pInp
)
{
- Aud_STATUS status;
+ Int32 status;
+ Aud_STATUS audStatus;
const PAF_SIO_Params *pInPrms;
mcaspLLDconfig *pLldCfg;
mcaspLLDconfig *pReqLldCfg;
{
d10Initialized = 0; // indicate no Input selected
- // check McASP LLD control API
- mcaspControlChan(pInp->hMcaspChan, MCASP_CHAN_RESET, NULL); // Rx reset channel
- //mcaspControlChan(pInp->hMcaspChan, MCASP_DEVICE_RESET, NULL); // Reset Tx/Rx channel
+ // Reset channel
+ status = mcaspControlChan(pInp->hMcaspChan, MCASP_CHAN_RESET, NULL); // Rx reset channel
+ //status = mcaspControlChan(pInp->hMcaspChan, MCASP_DEVICE_RESET, NULL); // Reset Tx/Rx channel
+ if (status != MCASP_COMPLETED)
+ {
+ Log_info0("asitSelectDevices(): McASP channel reset failed!\n");
+ return ASIP_ERR_MCASP_CFG;
+ }
// Delete McASP LLD channel
status = mcaspDeleteChan(pInp->hMcaspChan);
- if (status != Aud_EOK)
+ if (status != MCASP_COMPLETED)
{
Log_info0("asitSelectDevices(): McASP channel deletion failed!\n");
return ASIP_ERR_MCASP_CFG;
{
// Create McASP LLD channel
mcaspChanHandle = NULL;
- status = mcasplldChanCreate(pReqLldCfg, &mcaspChanHandle);
- if (status != Aud_EOK)
+ audStatus = mcasplldChanCreate(pReqLldCfg, &mcaspChanHandle);
+ if (audStatus != Aud_EOK)
{
Log_info0("asitSelectDevices(): McASP channel creation failed!\n");
return ASIP_ERR_MCASP_CFG;
diff --git a/pasdk/test_dsp/framework/audioStreamOutDec.c b/pasdk/test_dsp/framework/audioStreamOutDec.c
index 4eb50bf68d7096bdbf951bc22fea5d428813a68f..c3886e54c7fd108173803da59c488e2db7d341ec 100644 (file)
//
// Reset ASP chain
//
- TRACE_VERBOSE0("asopDecOutProcInfo1: calling streamChainFunction.");
+ TRACE_VERBOSE0("asopDecOutProcDec1: calling streamChainFunction.");
errno = streamChainFunction(pP, pQ, pAsotCfg, PAF_ASP_CHAINFRAMEFXNS_RESET, 1, frame); // SRC reset is called inside;
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: streamChainFunction returns errno 0x%x ", errno);
+ TRACE_TERSE1("asopDecOutProcDec1: streamChainFunction returns errno 0x%x ", errno);
status = ASOP_DOP_ERR_DEC1_ASPCHAINRESET;
return status;
}
//
// Encode Info
//
- TRACE_VERBOSE0("asopDecOutProcInfo1: calling enc->info.");
+ TRACE_VERBOSE0("asopDecOutProcDec1: calling enc->info.");
for (z=ENCODE1; z < ENCODEN; z++)
{
Int zO = pP->outputsFromEncodes[z];
&pAstCfg->xEnc[z].encodeStatus);
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: info returns errno 0x%x ", errno);
+ TRACE_TERSE1("asopDecOutProcDec1: info returns errno 0x%x ", errno);
status = ASOP_DOP_ERR_DEC1_ENCINFO;
return status;
}
errno = asopSetCheckRateX(pP, pQ, pAsotCfg, 0);
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: info returns errno 0x%x ", errno);
+ TRACE_TERSE1("asopDecOutProcDec1: info returns errno 0x%x ", errno);
status = ASOP_DOP_ERR_DEC1_SETRATEX;
return status;
}
errno = asopStartOutput(pP, pQ, pAsotCfg);
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: asopStartOutput returns errno 0x%x ", errno);
+ TRACE_TERSE1("asopDecOutProcDec1: asopStartOutput returns errno 0x%x ", errno);
status = ASOP_DOP_ERR_DEC1_STARTOUTPUT;
return status;
}
#endif
return status;
-} //asopDecOutProcInfo1
+} //asopDecOutProcDec1
// Purpose: Re-initiate Output
Int asopDecOutProcInfo2(
diff --git a/pasdk/test_dsp/framework/audioStreamOutIo.c b/pasdk/test_dsp/framework/audioStreamOutIo.c
index 7a5b129509b046950ca8e7f97ff712e15d57321c..a655af2675ac0b7681a8cceeee8678bdd57435fb 100644 (file)
{
mcaspLLDconfig *pReqLldCfg;
Ptr mcaspChanHandle;
- Aud_STATUS status;
+ Int32 status;
+ Aud_STATUS audStatus;
UInt postedEvents;
if ((pOut->hIoBuff == NULL) || (pOut->hIoPhy == NULL) || (!d10Initialized))
// Deactivate currently active Output device
if (pOut->hMcaspChan != NULL)
{
- // check McASP LLD control API
- mcaspControlChan(pOut->hMcaspChan, MCASP_CHAN_RESET, NULL);
+ // Reset channel
+ status = mcaspControlChan(pOut->hMcaspChan, MCASP_CHAN_RESET, NULL);
+ if (status != MCASP_COMPLETED)
+ {
+ Log_info0("asopSelectDevices(): McASP channel reset failed!\n");
+ return ASOP_IO_ERR_MCASP_CFG;
+ }
+
// Delete McASP LLD channel
status = mcaspDeleteChan(pOut->hMcaspChan);
- if (status != Aud_EOK)
+ if (status != MCASP_COMPLETED)
{
Log_info0("asopSelectDevices(): McASP channel deletion failed!\n");
return ASOP_IO_ERR_MCASP_CFG;
{
// Create McASP LLD channel
mcaspChanHandle = NULL;
- status = mcasplldChanCreate(pReqLldCfg, &mcaspChanHandle);
- if (status != Aud_EOK) {
+ audStatus = mcasplldChanCreate(pReqLldCfg, &mcaspChanHandle);
+ if (audStatus != Aud_EOK)
+ {
Log_info0("asopSelectDevices(): McASP channel creation failed!\n");
return ASOP_IO_ERR_MCASP_CFG;
}
Int zMI;
Int zMS;
Int zE, zX;
+ // "proof of concept" for McASP LLD API
+ Uint32 divider;
+ Mcasp_HwSetupData mcaspSetup;
+ Int32 status;
pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
pOut = pAsotCfg->pIoOut; // get pointer to ASOT IO configuration
// Update divider based on calculated rateX
divider /= rateX;
+#if 0 // debug
// Experimental code: directly write CLKXDIV
- regVal = *(volatile UInt32 *)0x23400B0;
+ regVal = *(volatile UInt32 *)0x23400B0; // read MCASP_ACLKXCTL
regVal &= ~0x1F; // mask off CLKXDIV bits
//regVal |= 7; // set CLKXDIV for 48 kHz
//regVal |= 3; // set CLKXDIV for 96 kHz
//regVal |= 1; // set CLKXDIV for 192 kHz
regVal |= (divider-1); // set CLKXDIV
- *(volatile UInt32 *)0x23400B0 = regVal;
+ *(volatile UInt32 *)0x23400B0 = regVal; // write MCASP_ACLKXCTL
+#endif
+
+#if 1
+ // get existing McASP HW setup
+ status = mcaspControlChan(pOut->hMcaspChan, Mcasp_IOCTL_CNTRL_GET_FORMAT_CHAN, &mcaspSetup);
+ if (status != MCASP_COMPLETED)
+ {
+ Log_info0("asopSetCheckRateX(): McASP get channel format failed!\n");
+ return ASOP_IO_ERR_MCASP_CFG;
+ }
+
+ // update CLKXDIV based on rateX
+ mcaspSetup.clk.clkSetupClk &= ~CSL_MCASP_ACLKXCTL_CLKXDIV_MASK;
+ mcaspSetup.clk.clkSetupClk |= (divider-1);
+
+ // update McASP HW setup
+ status = mcaspControlChan(pOut->hMcaspChan, Mcasp_IOCTL_CNTRL_SET_FORMAT_CHAN, &mcaspSetup);
+ if (status != MCASP_COMPLETED)
+ {
+ Log_info0("asopSetCheckRateX(): McASP set channel format failed!\n");
+ return ASOP_IO_ERR_MCASP_CFG;
+ }
+#endif
pOut->rateX = rateX;
}
diff --git a/pasdk/test_dsp/framework/audioStreamOutProc.h b/pasdk/test_dsp/framework/audioStreamOutProc.h
index f30c85dfb680f4df14b63e6c30d374e0eee07043..9cf06b713f76590e5eed012c6beb169132fdda84 100644 (file)
uint32_t ioBuffBuf2AllocCnt; // Output buffer2 allocation (split buffer on buffer wrap) count
uint32_t errIoBuffOvrCnt; // Output IO overflow count
uint32_t errIoBuffUndCnt; // Output IO underflow count
+
+ float rateX; // Input/Output clock ratio
// debugging counters
uint32_t num_xfers;