/*1. Write a 1 to the KEYR field of the MPLKCMD register. This resets some internal
status for the MPLK0 through MPLK3 registers.*/
gpCGEM_regs->MPLKCMD = (1<<CSL_CGEM_MPLKCMD_KEYR_SHIFT);
/*2. Write the key to MPLK0 through MPLK3. All four registers must be written
exactly once. They may be written in any order.*/
for(i=0; i<4; i++)
{
gpCGEM_regs->MPLK[i] = mem_prot_key[i];
}
/*3. Write a 1 to the LOCK field of the MPLKCMD register. This engages the lock.*/
gpCGEM_regs->MPLKCMD = (1<<CSL_CGEM_MPLKCMD_LOCK_SHIFT);
/*wait to make sure it is locked*/
while(0==(gpCGEM_regs->MPLKSTAT&CSL_CGEM_MPLKSTAT_LK_MASK));
}