Hi,
Having satisfied myself about how to enable the SRIO peripheral I'm now trying to reset it!
I'm not sure resetting the SRIO peripheral is important but I tried to do it and now I want to understand. I wanted to reset it so that if I restart my program in the debugger I can put the SRIO peripheral into a known state i.e. reset; I'm not sure that I have any use for this in our real application.
I've tried to follow spru976b.pdf section 2.3.10.3 Software Shutdown Details. It should be noted that I'm only doing Direct I/O in my test app at the moment so I don't think there should be any problems with the RXU and TXU queue teardowns.
I'm using an EVM6455.
The first time I run after a power cycle my test apps run and my Direct I/O transfers work. (ResetSRIOPeripheral is always called.)
If I restart the transmitting app (which is on the Mezz) it doesn't seem to work, I suspect the attempt to reset the SRIO peripheral. I think ICS7 of LSU0_ICSR is set ("Packet not sent due to unavailable outbound credit at given priority").
Should I worry about this or just give up and carry on with something more relevant to my real application?
If I should worry has anyone got any guidance about how to reset the SRIO peripheral?
See below if your interested in the code.
Thanks,
Matt
Note:
* I enable the peripheral (PERCFG0) before calling ResetSRIOPeripheral and pretty much immediately after I set GBL_EN.
* The HDPs are never non-zero in my tests.
Void TearDownTxBuffers()
{
const Int numberOfHDPs = sizeof(srioRegisters->QUEUE_TXDMA_HDP) / sizeof(srioRegisters->QUEUE_TXDMA_HDP[0]);
for (Int i = 0; i < numberOfHDPs; ++i)
{
if (srioRegisters->QUEUE_TXDMA_HDP[i] != 0x00000000U)
{
const Uint32 txTeardownMask = 1U << i;
srioRegisters->TX_QUEUE_TEAR_DOWN = txTeardownMask;
CSL_SrioBuffDesc *const txBuffDesc = reinterpret_cast<CSL_SrioBuffDesc*>(srioRegisters->QUEUE_TXDMA_HDP[i]);
while (CSL_FEXT(txBuffDesc->opt2, SRIO_TXBUFFDESC_TEARDOWN) == CSL_SRIO_TXBUFFDESC_TEARDOWN_NOT_COMPLETE);
}
}
}
Void TearDownRxBuffers()
{
const Int numberOfHDPs = sizeof(srioRegisters->QUEUE_RXDMA_HDP) / sizeof(srioRegisters->QUEUE_RXDMA_HDP[0]);
for (Int i = 0; i < numberOfHDPs; ++i)
{
if (srioRegisters->QUEUE_RXDMA_HDP[i] != 0x00000000U)
{
const Uint32 rxTeardownMask = 1U << i;
srioRegisters->RX_QUEUE_TEAR_DOWN = rxTeardownMask;
CSL_SrioBuffDesc *const rxBuffDesc = reinterpret_cast<CSL_SrioBuffDesc*>(srioRegisters->QUEUE_RXDMA_HDP[i]);
while (CSL_FEXT(rxBuffDesc->opt2, SRIO_RXBUFFDESC_TEARDOWN) == CSL_SRIO_RXBUFFDESC_TEARDOWN_NOT_COMPLETE);
}
}
}
// See spru616b.pdf - Software Shutdown Details
Void ResetSRIOPeripheral()
{
while (CSL_FEXT(srioRegisters->LSU[0].LSU_REG6, SRIO_LSU_REG6_BSY) == 1);
while (CSL_FEXT(srioRegisters->LSU[1].LSU_REG6, SRIO_LSU_REG6_BSY) == 1);
while (CSL_FEXT(srioRegisters->LSU[2].LSU_REG6, SRIO_LSU_REG6_BSY) == 1);
while (CSL_FEXT(srioRegisters->LSU[3].LSU_REG6, SRIO_LSU_REG6_BSY) == 1);
TearDownTxBuffers();
TearDownRxBuffers();
srioRegisters->PCR
= CSL_FMKT(SRIO_PCR_PEREN, DISABLE)
| CSL_FMK(SRIO_PCR_SOFT, CSL_SRIO_PCR_SOFT_RESETVAL)
| CSL_FMK(SRIO_PCR_FREE, CSL_SRIO_PCR_FREE_RESETVAL);
// Manual says "wait 1 second".
// I haven't checked how long this loop takes but is should be a long time
// and I'm not expecting that there will any DMA transactions attempting to complete anyway.
delay(1000000);
srioRegisters->GBL_EN = CSL_FMKT(SRIO_GBL_EN_EN, DISABLE);
}