I am currently attempting to write my own driver software for the MDIO module on the C6670. I am using the MDIO module to perform external register reads/writes on a PHY device using the USERACCESS1 register. Additionally, I have enabled interrupts to trigger whenever a transaction has completed through the USER_ACCESS_REG. The problem I am seeing is my ISR() function runs twice every time I send data out of the MDIO port using the USERACCESS1 register. I have confirmed this with a global debug counter.
My ISR()
extern "C"{
void MdioTransferIsr(void)
{
InterruptCounter++;
CSL_MDIO_clearMaskedUserCmdCompleteInt(1);
CSL_MDIO_clearUnmaskedUserCmdCompleteInt(1);
}}
My routing of the interrupt is done with the following lines:
CpIntc_dispatchPlug(CSL_INTC0_MDIO_USER_INTR1, (CpIntc_FuncPtr)MdioTransferIsr, (UArg)0, TRUE);
CpIntc_mapSysIntToHostInt(0, CSL_INTC0_MDIO_USER_INTR1, 10);
// Enable the Host Interrupts. All MDIO Interrupts are on CIC0.
CpIntc_enableHostInt(0, 10);
// Enable the System Interrupt.
CpIntc_enableSysInt(0, CSL_INTC0_MDIO_USER_INTR1);
// Get the event id associated with the host interrupt and Plug the CPINTC Dispatcher.
n32EventId = CpIntc_getEventId(10);
EventCombiner_dispatchPlug(n32EventId, (EventCombiner_FuncPtr)CpIntc_dispatch, 10, TRUE);
Then, sometime later, a send is performed.
CSL_MDIO_USERACCESS oMdioUserAccess;
// Fill in oMdioUserAccess.
// ...
// Perform the read.
hMdioRegs->USER_GROUP[1].USER_ACCESS_REG = CSL_FMK (MDIO_USER_ACCESS_REG_DATA, oMdioUserAccess.data) |
CSL_FMK (MDIO_USER_ACCESS_REG_PHYADR, oMdioUserAccess.phyAddr) |
CSL_FMK (MDIO_USER_ACCESS_REG_REGADR, oMdioUserAccess.regAddr) |
CSL_FMK (MDIO_USER_ACCESS_REG_WRITE, 0) |
CSL_FMK (MDIO_USER_ACCESS_REG_GO, oMdioUserAccess.go);
As a side note, the CSL_MDIO_setUserAccessRegister() function seems to only support writing to registers, so a workaround to the CSL was required here.
↧
MDIO USERACCESS1 Interrupt on the C6670 seems to trigger twice per transaction.
↧