non deterministic behaviour when using jungo driver to communicate with a PCI device

115 views Asked by At

I have a PCI based Device, more specifically based on tms320c6000 DSP, I am trying to communicate (reading some registers) with this device through the Jungo WinDriver. Surprisingly it sometimes work and sometimes doesn't, when it doesn't system hang and I have to restart the system.

this is the snipped code which I used to read EMIF Registers, for example.

WD_TRANSFER tt[9];
BZERO(tt);
for (unsigned i = 0; i < 9; i++) {
    tt[i].cmdTrans = RM_DWORD;
    tt[i].dwPort = mmr + (i * 4);
}
WD_MultiTransfer(hDevice, &tt, 9);

mmr came from WD_CardRegister function which gave information about the PCI BARs and their mapped address (mmr is non prefechtable mapped memory).

I would be very grateful if someone could give me some hint about what might cause this problem.

Thanks

1

There are 1 answers

0
Arash On

I am answering my question in case the problem happened to someone else.

there are sequence of actions which should be taken before using this device.

  1. Warm reset through HDCR Register (set WARMRESET bit).
  2. then the EMIF registers should be initialised, these are the values I used.

    struct emif emif_val = {
        0x00052078, //GBLCTL;
        0x73a28e01, //CE1 Flash/FPGA;
        0xffffffd3, //CE0 SDRAM;
        0x00000000, //Reserved;
        0x22a28a22, //CE2 Daughtercard 32-bit async
        0x22a28a42, //CE3 Daughtercard 32-bit sync
        0x63115000, //SDRAM contral, 4 banks
        0x0000081b, //SDRAM timing
        0x001faf4d  //SDRAM extended control
    };
    

    and then you are able to access all address space of the device without any problem.

and for more information this linux source code could be very helpful