Hi,
here is a piece of code that I found in my repository. Originally it was written for MPC5604E but it's the same for MPC5744P. Used header file is attached. It's just test code to see how it works:
unsigned int lock = 0;
//just write something to DSPI_A.MCR register to see we can write the register
DSPI_A.MCR.R = 0xFFFFFFFF;
DSPI_A.MCR.R = 0x00000000;
//get the lock status of this register. It will be zero because protection is not active
GET_SOFTLOCK(DSPI_A.MCR.R, lock);
//write new value to register and lock the register for further access
DSPI_A.MCR.R = WRITE_WITH_LOCK32(DSPI_A.MCR.R,0xFFFFFFFF);
//this write will not work because register is protected
DSPI_A.MCR.R = 0x00000000;
//get the lock status - it will be 0x0F - all four bytes are locked
GET_SOFTLOCK(DSPI_A.MCR.R, lock);
//clear the lock bits
CLR_SOFTLOCK32(DSPI_A.MCR.R);
//we can write the register again
DSPI_A.MCR.R = 0x00000000;
//get the lock status - it will be zero, protection is not active
GET_SOFTLOCK(DSPI_A.MCR.R, lock);
//set lock
SET_SOFTLOCK32(DSPI_A.MCR.R);
//try to write the register - it will not work
DSPI_A.MCR.R = 0xFFFFFFFF;
//and check status...
GET_SOFTLOCK(DSPI_A.MCR.R, lock);
Regards,
Lukas