Hi,
I try to get the PCIe example code from the pdk_am57xx_1_0_4 to run on DSP1 of an am5728 on a beagleboard X15.
Beside the hint from here to use EDMA instance #1 instead of #0 (PCIeEDMAselector.c:69), I have problems to configure the BAR registers.
In pcie_example.c:1666ff. the funtion Pcie_cfgBar() is called for both use cases RC and EP. In both cases it returns with pcie_RET_RO_CHANGED.
I dug a bit deeper...
To configure a BAR register a configuration struct of type pcieBarReg_t is filled with the raw actual register value and several other members each representing a bitfield of the target register. The function pciev1_write_type1Bar_reg (pciev1_rc.c:130) that actually writes to the register takes the raw value from pcieBarReg_t, masks out the writable bitfields and then ORs the content of the bitfield members of pcieBarReg_t to the appropriate positions. To ensure to never change read-only bits it finally compares the read-only part of the result with the read-only part of the register content just before writing it to the register. Unfortunately in the example code the raw value member of the struct is never set to the actual register value and since there are some readonly bits set the final comparison always fails and the function returns with pcie_RET_RO_CHANGED.
Two solutions come to my mind:
- initializing the raw value member of the struct by reading the register prior to writing it. The function Pciev1_writeRegs wich is used here has a complement Pciev1_readRegs that does exactly what is necessary - but this seems a bit of an overhead (not that it seems anybody would care...)
- never even using the raw value member since the register is already read once in the process and can be used not only for validating the result but also for computing the RO-part of it.
I have found nothing about this problem in the forum - am I the only one trying this, or have I done something completely unusual and the example is failing only for me?
Best,
Tim