I had an RTFM moment and found the Fetch Register 22.7.1.4 so now I'm loading the address of my first descriptor into the Fetch Register to "get this thing started".
I think it's running now but I get an error bit set in the SISRH on crypto channel 0. I guess that is progress. But when I go and look in the MDISR to "see" what caused the error, the Register reads 0 (no error)?????
This is how I wrote check_SEC_ERR() to decode the error regosters.
I'm just thrashing in this function so it aint pritty. I'm concerned that either the CodeWarroir deffinitions are broken or my Logic is broken. Because I could "see" the error bit set in Debug for channel_err but I had to comment out the Mask that used the CodeWarrior register and Bit deffinitions because it was not working as I expected???
channel_err = MCF_SEC_SISRH;
//j if(((MCF_SEC_SISRH && MCF_SEC_SIMRH_CHA0ERR) == MCF_SEC_SIMRH_CHA0ERR))
if(channel_err == 0x20000000)
/**************************************************************************************************
<Function Name> check_SEC_ERR()
***************************************************************************************************
<DESCRIPTION> Check for, and Decode errors in the SEC
<RETURNS> the cause of the error
- check the SISRH for an error on one of the channels
- if we find an error bit set we must check SISRL to see which EU caused the error (should always be the MDEU)
- then we need to decode the error bit in the MDISR
***************************************************************************************************
Version Date Author Comments
1.0 2009/04/16 J. Edwards
**************************************************************************************************/
vuint32 check_SEC_ERR(void)
{
vuint32 SIMRHerr, channel_err, eu_err, mdeu_status;
SIMRHerr =0xDEADBEEF;
eu_err =0xDEADBEEF;
mdeu_status =0xDEADBEEF;
channel_err = MCF_SEC_SISRH;
eu_err = MCF_SEC_SISRL;
mdeu_status= MCF_SEC_MDISR;
/* check the SISRH for the error 22.6.4.4*/
if(channel_err ==0)
{
/*No error */
SIMRHerr = SEC_NO_ERROR;
}
else
{
//j if(((MCF_SEC_SISRH && MCF_SEC_SIMRH_CHA0ERR) == MCF_SEC_SIMRH_CHA0ERR))
if(channel_err == 0x20000000)
{
/* error on channel 0 */
SIMRHerr =SEC_CHANNEL_0;
}
else
{
//j if(((MCF_SEC_SISRH && MCF_SEC_SIMRH_CHA1ERR) == MCF_SEC_SIMRH_CHA1ERR))
if(channel_err == 0x80000000)
{
/* error on channel 1 */
SIMRHerr =SEC_CHANNEL_1;
}
else
{
//j if(((MCF_SEC_SISRH && MCF_SEC_SIMRH_AERR)== MCF_SEC_SIMRH_AERR))
if(channel_err == 0x08000000)
{
/* assignmet error */
SIMRHerr =SEC_CHANNEL_ASS_ERR;
}
else
{
/* unknown error */
printf("unknown error channel_err = %X\n",channel_err);
}
}
}
}
switch(SIMRHerr)
{
/* decode an error on channel 0 */
case SEC_CHANNEL_0:
{
printf("Error on channle 0\n");
/* check the SIMRL to see what EU the error is on */
if((eu_err && MCF_SEC_SIMRL_MDEUERR)== MCF_SEC_SIMRL_MDEUERR)
{
printf("MDEU error");
/* now we have to read the MDISR reg to see what the problem is 22.10.4 */
if((MCF_SEC_MDISR && MCF_SEC_MDISR_ME)==MCF_SEC_MDISR_ME)
{
printf(" Mode Error\n");
}
if((MCF_SEC_MDISR && MCF_SEC_MDISR_AE)==MCF_SEC_MDISR_AE)
{
printf("Address Error\n");
}
if((MCF_SEC_MDISR && MCF_SEC_MDISR_IFO)==MCF_SEC_MDISR_IFO)
{
printf("Input FIFO overflow\n");
}
if((MCF_SEC_MDISR_IE && MCF_SEC_MDISR_IE)==MCF_SEC_MDISR_IE)
{
printf("Internal error\n");
}
if((MCF_SEC_MDISR_IE && MCF_SEC_MDISR_ERE)==MCF_SEC_MDISR_ERE)
{
printf("Early Read Error\n");
}
if((MCF_SEC_MDISR_IE && MCF_SEC_MDISR_CE)==MCF_SEC_MDISR_CE)
{
printf("Context Error\n");
}
if((MCF_SEC_MDISR_IE && MCF_SEC_MDISR_KSE)==MCF_SEC_MDISR_KSE)
{
printf("Key Size Error\n");
}
if((MCF_SEC_MDISR_IE && MCF_SEC_MDISR_DSE)==MCF_SEC_MDISR_DSE)
{
printf("Data Size Error\n");
}
}
else
{
if((eu_err && MCF_SEC_SICRL_TEA)== MCF_SEC_SICRL_TEA)
{
printf("Transfer Error\n");
}
else
{
if((eu_err && MCF_SEC_SICRL_DEUERR)==MCF_SEC_SICRL_DEUERR)
{
printf("DEU Error\n");
}
else
{
if((eu_err && MCF_SEC_SICRL_AESUERR)==MCF_SEC_SICRL_AESUERR)
{
printf("AESU Error\n");
}
else
{
if((eu_err && MCF_SEC_SICRL_AFEUERR)==MCF_SEC_SICRL_AFEUERR)
{
printf("AFEU Error\n");
}
else
{
if((eu_err && MCF_SEC_SICRL_RNGERR)==MCF_SEC_SICRL_RNGERR)
{
printf("RNG Error");
}
else
{
printf("Unknown eu_err =%X \n",eu_err );
}
}
}
}
}
}
}
break;
I will not bore you with the rest of the function....
I'm about to give up on the forum for help. I'll just keep plugging away at this. If I do figure it out I'll reply to my own post yet again with a solution.
I can't belive I'm the only guy on the planet trying to use the SEC on the MCF5485. Someone has to know how the SEC works.
All alone in the dark.
James
Message Edited by *null on 2009-04-17 10:57 AM