Good day!
I'm working with TI EVM6678L board. I'm working with SRIO loopback example and I've found a bug in Srio_validateDIOBindingId() function in srio_drv.c. This is the source code of the function:
static int32_t Srio_validateDIOBindingId (uint16_t idMap, uint8_t tt)
{
uint16_t portIndex;
uint16_t brrIndex;
uint8_t enableStatus;
uint8_t maintRouting;
uint8_t privateStatus;
uint16_t counter = 1;
uint8_t baseID8Bit;
uint16_t baseID16Bit;
uint8_t startBRRIndex;
/* Are we trying to validate the first idMap */
if (idMap == 0)
{
/* Get the Device Identifier CSR */
CSL_SRIO_GetDeviceIDCSR (gSRIODriverMCB.hSrio, &baseID8Bit, &baseID16Bit);
/* 8 bit or 16 bit */
if (tt == 0)
{
/* 8Bit: If we have a non-zero 8bit identifier present we are good */
if (baseID8Bit != 0)
return 0;
return -1;
}
else
{
/* 16Bit: If we have a non-zero 16bit identifier present we are good */
if (baseID16Bit != 0)
return 0;
return -1;
}
}
/* For all other idMaps we need to check the BRR Routing Table; so cycle through all the ports. */
for (portIndex = 0; portIndex < 4; portIndex++)
{
/* For Port0; BRR Entry 0 is not used; so we skip and start from Entry 1. */
if (portIndex == 0)
startBRRIndex = 1;
else
startBRRIndex = 0;
/* Cycle through all the BRR Entries for each port. */
for (brrIndex = startBRRIndex; brrIndex < 4; brrIndex++)
{
/* Is this the entry we are looking for? */
if (counter == idMap)
{
/* YES. Get the TLM Port Base Routing Information. */
CSL_SRIO_GetTLMPortBaseRoutingInfo(gSRIODriverMCB.hSrio, portIndex,
brrIndex, &enableStatus,
&maintRouting, &privateStatus);
/* If the BRR Entry has been enabled; then this entry can be used. */
if (enableStatus == 1)
return 0;
/* BRR Entry is not enabled; this entry cannot be used */
return -1;
}
/* Increment the counter */
counter++;
}
}
/* Control comes here indicates no match was found. */
return -1;
}
As you can see if idMap == 1(for example), then only TLM Port Base Routing Information from port 0 BRR 1 register is checked. Why so? Why are two cycles used for in this case?