/******************************************************************************

 C   M O D U L E   F I L E
 
 (c) Copyright Motorola Semiconductors Hong Kong Limited 2000-2003
 ALL RIGHTS RESERVED

*******************************************************************************

 Project Name	: i.MX System Test Program
 Project No		: 
 Title			: 
 File Name		: SysInit.c    
 Last Modified	: 04/27/2003
 (MM/DD/YYYY)

 Description	: Module and system initialization routines

 Comments		:

 History (MM/DD/YYYY) :
 04/27/2003 - Initial Proposal

******************************************************************************/

#define SYS_DEFINE_GLOBALS

#include <stdio.h>
#include "common.h"
#include "tht_memory_map_defines.h"
#include "prototype.h"

extern void SetIntType(uint32_t IntNum, uint8_t type);
extern void SetAsynchMode(void);


/////////////////////////////////////////////////
//											   //	
//	Call by user program for interupt enable   //
//											   //
/////////////////////////////////////////////////
void IrptInit(void)
{
	uint32_t i;
	*(p_uint32_t)AITC_INTCNTL &= 0x00;
	/* To set all interrupt source to normal interrupt source */	
	for (i=0; i<=63; i++)
	{
		SetIntType(i, 0);
	}	 

	/* Enable all int sources */
/*	for (i=0; i<=31; i++)
	{
		EnableIntSource(i);
	}
*/
}

void MemInit(void)
{
}

void LCDCInit(void)
{
}


void Enable_MMU (void)
{
__asm {
    mrc p15,0,r0,c1,c0,0
    mov r2, #0x00000001
    orr r0,r2,r0
    mcr p15,0,r0,c1,c0,0
    }
printf("MMU enabled\n");
}
 
void Disable_MMU (void)
{
__asm {
    mrc p15,0,r0,c1,c0,0
    mov r2, #0xFFFFFFFE
    and r0,r2,r0
    mcr p15,0,r0,c1,c0,0
    }
printf("MMU disabled\n");
}


void SysInit(void)
{	
ARM_MMU_Init(ARM_MMUTableSetUp()); // MMU Table Initialization
Enable_MMU();
}
