This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Enabling SRIO Peripheral

Other Parts Discussed in Thread: TMS320C6455

Hi,

I'm using SRIO on the C6455 and obviously I need to enable the SRIO peripheral.

The example does the following:

      /* Unlock the powersaver control register */
    CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERLOCK, DEV_PERLOCK_LOCKVAL, UNLOCK);
    /* Enable the SRIO */
    CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERCFG0, DEV_PERCFG0_SRIOCTL, ENABLE);

This has always worked for me but I'm worried that I'm not explicitly waiting for the SRIO peripheral to become enabled and therefore it is not guaranteed to work. At the moment this code happens to be followed by functions that don't access the SRIO peripheral.

According to the documentation (tms320c6455.pdf) after writing PERCFG0 I need to wait for 16 SYSCLK3 cycles.

Should I add a loop, insert NOPs or not worry about it?

I added NOPs but it's not clear to me that the optimizer couldn't rearrange this code and therefore it's still not guaranteed. Also, I don't know what a SYSCLK3 is and how it relates to a NOP.

    CSL_DevRegs *const deviceStateControlRegisters
        = reinterpret_cast<CSL_DevRegs*>(CSL_DEV_REGS);

    deviceStateControlRegisters->PERLOCK = CSL_FMKT(DEV_PERLOCK_LOCKVAL, UNLOCK);
    CSL_FINST(deviceStateControlRegisters->PERCFG0, DEV_PERCFG0_SRIOCTL, ENABLE);

    asm("           NOP            8");
    asm("           NOP            8");

Any thoughts greatly appreciated,

Matt

  • Hi Matt,

    SYSCLK3 is used to clock a number of peripherals on the C6455, and per page 134 of the device datasheet this clock operates at CPU/6 (in a 1GHz device this would be ~167MHz). As such 16 SYSCLK3 cycles would equate to roughly 100 CPU cycles. Under many conditions this should not be an issue if there is additional code underneath the enable code as you have mentioned in your code.

    If you are concerned about the timing you can always create your own delay loop. If you declare the counter variable as volatile the optimizer should leave it alone. Alternately, you could place the function in a different source file and give it file-specific build options so as not to run the optimizer on it.

  • Thanks Tim.

    I'm glad I asked the question now, 100 CPU cycles is a long time and I think I should worry about it! I shall read up on SYSCLK3.

    Obviously my solution (of inserting NOPs) is no good and I guess a loop is the only way to guarantee a wait of this length.

    I could put some code after the enable but then it becomes hard to write functions that only do one thing such as "InitialiseSRIO".

    I shall have another think about it.

    Thanks,

    Matt

  • I guess when you put it that way 100 cycles isn't exactly a trivial amount! :-)

    In any case I am glad this helps, and please let us know if you have any more questions.