Other Parts Discussed in Thread: HALCOGEN
Hi,
To start, I am currently testing the VIM parity error handler as follows:
- VIM_PARTCTL (0xFFFFFDF0) is set to 0xA
- My VIM table is copied to vimRAM (0xFFF82000)
- VIM_FBPARERR (0xFFFFFDF8) is set to the address of the parity error handler, the implementation was generated through HALCoGen 04.06.01
{ uint32 vec; /* Identify the corrupted address */ uint32 error_addr = VIM_ADDERR; /* Identify the channel number */ uint32 error_channel = ((error_addr & 0x1FFU) >>2U); /* Correct the corrupted location */ vimRAM->ISR[error_channel] = s_vim_init[error_channel]; /* Clear Parity Error Flag */ VIM_PARFLG = 1U; /* Disable and enable the highest priority pending channel */ if (vimREG->FIQINDEX != 0U) { vec = vimREG->FIQINDEX - 1U; } else { vec = vimREG->IRQINDEX - 1U; } if (vec == 0U) { vimREG->INTREQ0 = 1U; vec = esmREG->IOFFHR - 1U; if (vec < 32U) { esmREG->SR1[0U] = (uint32)1U << vec; esmGroup1Notification(vec); } else if (vec < 64U) { esmREG->SR1[1U] = (uint32)1U << (vec-32U); esmGroup2Notification(vec-64U); } else if (vec < 96U) { esmREG->SR4[0U] = (uint32)1U << (vec-64U); esmGroup1Notification(vec-32U); } else { esmREG->SR4[1U] = (uint32)1U << (vec-96U); esmGroup2Notification(vec-64U); } } else if (vec < 32U) { vimREG->REQMASKCLR0 = (uint32)1U << vec; vimREG->REQMASKSET0 = (uint32)1U << vec; } else if (vec < 64U) { vimREG->REQMASKCLR1 = (uint32)1U << (vec-32U); vimREG->REQMASKSET1 = (uint32)1U << (vec-32U); } else if (vec < 96U) { vimREG->REQMASKCLR2 = (uint32)1U << (vec-64U); vimREG->REQMASKSET2 = (uint32)1U << (vec-64U); } else { vimREG->REQMASKCLR3 = (uint32)1U << (vec-96U); vimREG->REQMASKSET3 = (uint32)1U << (vec-96U); } }
- The test code:
{ uint32* address; VIM_PARCTL = 0x0000010A; address = (uint32*)(0xFFF82400); *address ^= 0x1; address = (uint32*)(0xFFF82000); *address; }
The code above causes the parity error (sets VIM_PARFLG and the call-back function runs -- this is observed through a debugger). But once the software leaves the parity error handler, the software throws an undefined instruction exception. Is this normal?
Also, if I try test with a different address, the parity error is not detected (e.g. 0xFFF82404 and 0xFFF82004; or 0xFFF82436 and 0xFFF82036). Has anyone encountered these problems? Can someone let me know if I am doing something wrong or if this behavior is expected?
Thanks.