Hi All-
In an effort to make our application more robust and stable, I have implemented exception handling in the DM648. However, I am having trouble with the memory protection aspect.
The DM648 data sheet says very little about it, and the C64+ MegaModule documention and DSP/BIOS documentation are very general, so I am not certain what to do. Here is what I found:
Simply adding "bios.MEM.USEMPC = true;" to my .tcf, without changing any of the permissions, causes an immediate exception (122--L1D_CMPA L1D CPU memory protection fault event).
Adding
// Set code space to execute-only (user & supervisor)
perm = MPC_MPPA_UX | MPC_MPPA_SX | MPC_MPPA_LOCAL;
Status=MPC_setBufferPA((void *)0xE00000,0x8000,0,perm);
// Set data spaces to data r/w only (user & supervisor)
perm = MPC_MPPA_UR | MPC_MPPA_UW | MPC_MPPA_SR | MPC_MPPA_SW | MPC_MPPA_LOCAL;
Status=MPC_setBufferPA((Ptr)0xF00000,0x8000,0,perm);
To my code does not stop getting immediate exceptions, though the calls succeed (Status=0).
All attempts to set/read anything about L2 (e.g., Status=MPC_getPageSize((Ptr)0xA00000,0,&pageSize);) result in failures (Status=5).
Further, I cannot find any registers in the DM648 that get modified when I change the permissions for L1P and L1D. I am very confused about what is supposed to be happening--the DM648 data sheet only mentions memory protection in the context of the EDMA controller, but the DM648 "subsystem user's guide" (SPRUEU6) mentions:
"The DMC, PMC, and UMC memory controllers in the C64x+ Megamodule are equipped with a set of registers that specify the permissions for each memorypage: L1DMPPA[31:16] for L1D Region 1 , L1PMPPA[31:16] for L1P Region 1, and L2MPPA[31:0] for L2 Port 0. Registers L1DMPPA16, L1PMPPA16, and L2MPPA0 control the page at the smallest address in their respective memory map ranges; i.e. L1DMPPA16 controls the page at address 0x00F00000, L1DPMPPA16 controls the page at address 0x00E00000, and L2MPPA0 controls the page at address 0x00800000" Where are these registers? Where are they documented? The C64+ Megamodule document (SPRU871) also had discussion of MPPA, MPFAR, etc., but says to refer to specific device data sheet for what is implemented on what regions of memory. I am not trying to implement supervisor/user mode, I just want to better trap rogue code, by using the MPC functionality to, e.g., generate an exception if program fetch is done from a memory page that is strictly data. Please advise on how to accomplish this in the context of DSP/BIOS (I'm using version 5_41_02_14) on the DM648, or by brute force register setting. Also, side question, is there anything that can possibly be done w/r/t memory protection in the external SDRAM? Thanks in advance, Jim Gort