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.

How to configure the C66x&C674x Memory Protection Lock Registers (MPLKn)

From the TRM of C66x DSP corepac & C674x DSP Megamodule, The memory protection lock registers are described in the figure. I can't find out the bits of MPLK meaning  from the handbook. I want to know how to configure MPLK, thanks.


 

  • Hi Ray,

    I've forwarded this to the design team. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • From the same document it says:"Devices that implement hardware locks on their protection entries implement the six  egisters shown in  Figure 10-6  through Figure 10-11"

    So I look at the device  (in that case, the C6678 User guide   http://www.ti.com/lit/ds/symlink/tms320c6678.pdf

    section 5.2 table 5.1 gives explanation how to set the bits to protect the memory

    Does it answer your question?

    Ran

  • Thanks for your help。the table5.1 gives explanation for how to set the bits of MPPA (Memory Protection Page Attribute) registers ,not for the MPLK Memory Protection Lock Registers.

    I think that set the bits of  MPLK  just like a key, it can be any value. If the key written in the MPLK is not the same when unlock the MPLK, there will unlock failed and generate a exception.

    Am I right?

  • Try it and report back to us

    Ran

  • Hi,Ran

    I have tried like this:

    1、lock L1P memory protection reg, MPLK0-MPLK3 value is 0xFFFFFFFF.

    2、unlock L1P memory protection reg,MPLK0 value is 0xFFFFFFFE,MPLK1-MPLK3 value is 0xFFFFFFFF. This trigger an excption like this:

     External exception happened. MEXPFLAG[3]=0x01000000
     Event 120: PMC_CMPA CPU memory protection fault for L1P
      memory protection exception caused by local access at 0x0184a510
      Supervisor Write violation

    3、unlock L1P memory protection reg,MPLK0-MPLK3 value is 0xFFFFFFFF,there is no exception。but when I unlock once again,trigger an exception like step2.

    From step2 and step3, I make sure that MPLKs is just like key. when you want to unlock it ,the value of MPLK must be matched the lock value.

    But I'm not sure that step3, unlock the reg twice generate an exception.Is this Normal?

    Thanks,

    Ray.

    void step1lockL1PMemProtRegs(void)
    {
    
        HWREG(DSP_L1PMPLKCMD) = 1<<CSL_CGEM_MPLKCMD_KEYR_SHIFT;  
        HWREG(DSP_L1PMPLK0) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK1) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK2) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK3) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPFCR) = 0x1;
        HWREG(DSP_L1PMPLKCMD) = 1<<CSL_CGEM_MPLKCMD_LOCK_SHIFT; 
    }
    
    void step2unlockL1PMemProtRegs(void)
    {
        HWREG(DSP_L1PMPLKCMD) = 1<<CSL_CGEM_MPLKCMD_KEYR_SHIFT;
        HWREG(DSP_L1PMPLK0) = 0xFFFFFFFE;
        HWREG(DSP_L1PMPLK1) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK2) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK3) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPFCR) = 0x1;
        HWREG(DSP_L1PMPLKCMD) = 1<<CSL_CGEM_MPLKCMD_UNLOCK_SHIFT;     
    }
    
    void step3unlockL1PMemProtRegs(void)
    {
        HWREG(DSP_L1PMPLKCMD) = 1<<CSL_CGEM_MPLKCMD_KEYR_SHIFT;
        HWREG(DSP_L1PMPLK0) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK1) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK2) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPLK3) = 0xFFFFFFFF;
        HWREG(DSP_L1PMPFCR) = 0x1;
        HWREG(DSP_L1PMPLKCMD) = 1<<CSL_CGEM_MPLKCMD_UNLOCK_SHIFT;     
    }