Hi @ZY2,
Protection and Security are two different things.
https://community.nxp.com/t5/MPC5xxx/program-flash-write-protection/m-p/1073282
FLASH_DRV_GetPFlashProtection reads the FTFC_FPROT registers
FLASH_DRV_SetPFlashProtection sets the FTFC_FPROT registers.
These APIs work with the FTFC registers that are configured during the boot sequence from the FPROT bytes in the flash (Flash configuration field). That means we can set the protection in the application image.

If you use S32DS IDE, modify Startup_S32k148.S file:

FLASH_DRV_GetSecurityState reads the FSEC register, that is again configurable in the flash configuration field (FSEC byte).
Regards,
Daniel