www.pudn.com > ARM9_PROGRAM.rar > main.c


//==================================================================== 
// File Name : 2410test.c 
// Function  : S3C2410 Test Main Menu 
// Program   : Shin, On Pil (SOP) 
// Date      : June 13, 2003 
// Version   : 0.0 
// History 
//   0.0 : Programming start (February 20,2002) -> SOP 
//   1.0 (20020530) : First release for customer 
//   1.1 (20020801) : Strata NOR Flash Added and etc. -> SOP 
//   1.2 (20020930) : Added IIS Slave mode Test Menu. -> SOP 
//       (20021208) : IIS Record & Play Test 
//       (20030324) : Added K9S1208 Erase -> SOP 
//       (20030331) : Added Test_Cache -> SOP 
//       (20030613) : SOP 
//==================================================================== 
 
#include  
#include  
 
//Shin, On Pil 
#include "def.h" 
#include "option.h" 
#include "addr.h" 
#include "lib.h" 
#include "slib.h" 
 
#include "etc.h" 
 
#include "int.h" 
 
//#include "swi.h" 
 
 
 
 
//#include "eint.h" 
//#include "extdma.h" 
#include "k9s1208.h" 
#include "mmu.h" 
 
 
#include "usbfifo.h" 
 
//Shin, Jeong Seuk 
 
#include "lcd.h" 
#include "lcdlib.h" 
#include "glib.h" 
#include "palette.h" 
 
 
 
#include "etc.h" 
#include "flash.h" 
//#include "idle.h" 
//#include "pd6710.h" 
#include "pll.h" 
//#include "power.h" 
//#include "pwr_c.h" 
#include "PowerOff.h" 
 
//Jeon, Chan Sik 
//#include "cache.h" 
 
void Isr_Init(void); 
void HaltUndef(void); 
void HaltSwi(void); 
void HaltPabort(void); 
void HaltDabort(void); 
 
void * function[][2]= 
{ 
 
 
 
        
//Interrupt      
    (void *)Test_Fiq,                       "FIQ Interrupt       ", 
    (void *)Change_IntPriorities,           "Change INT Priority ", 
 
//LCD    
    (void *)Test_PaletteMemory,             "LCD Palette RAM     ", 
     
//MPLL 
    (void *)Test_PLL,                       "MPLL Change         ", 
    (void *)ChangePLL,                      "MPLL MPS Change     ", 
    (void *)Test_PllOnOff,                  "MPLL On/Off         ",   
 
 
 
//USB 
    (void *)Test_USBFIFO,                   "USB FIFO Test       ", 
 
//NAND, NOR Flash 
    (void *)K9S1208_PrintBadBlockNum,       "NAND View Bad Block ", 
    (void *)K9S1208_PrintBlock,             "NAND View Page      ", 
    (void *)K9S1208_Program,                "NAND Write          ",  
    (void *)K9S1208_Erase,                  "NAND Erase          ",   
    (void *)TestECC,                        "NAND ECC            ",  
    (void *)ProgramFlash,                   "NOR Flash Program   ",     
    0,0 
}; 
 
//=================================================================== 
void Main(void) 
{ 
  
     
    Led_Display(15); 
    Led_Display(1); 
      Led_Display(2); 
      Led_Display(4); 
      Led_Display(8); 
     
    MMU_Init(); 
    
 
     
//    ChangeClockDivider(0,0);          // 1:1:1     
//    ChangeClockDivider(0,1);          // 1:1:2     
//    rCLKDIVN |= (1<<2);                     // 1:4:4 
   // ChangeClockDivider(1,0);          // 1:2:2  
    ChangeClockDivider(1,1);          // 1:2:4     
 
//    ChangeMPllValue(0xa1,0x3,0x3);    // FCLK=50.7MHz     
//    ChangeMPllValue(0x7f,0x2,0x2);    // FCLK=101.25MHz 
//    ChangeMPllValue(0x96,0x5,0x1);    // FCLK=135428571Hz  
//    ChangeMPllValue(0x2a,0x1,0x0);    // FCLK=200MHz    
//    ChangeMPllValue(0x5c,0x1,0x1);    // FCLK=200MHz 
//    ChangeMPllValue(0x5c,0x4,0x0);    // FCLK=200MHz 
//    ChangeMPllValue(0x8e,0x7,0x0);    // FCLK=200MHz         
    ChangeMPllValue(0xa1,0x3,0x1);    // FCLK=202.8MHz   
//    ChangeMPllValue(0x66,0x1,0x1);    // FCLK=220MHz    
//    ChangeMPllValue(0x69,0x1,0x1);    // FCLK=226MHz        
//    ChangeMPllValue(0x96,0x2,0x1);    // FCLK=237MHz 
//    ChangeMPllValue(0x7d,0x4,0x0);    // FCLK=266MHz       
     
    Port_Init(); 
    Isr_Init(); 
 
    Lcd_Port_Init(); 
    Lcd_Init(MODE_TFT_16BIT_800480); 
    Glib_Init(MODE_TFT_16BIT_800480); 
    Lcd_PowerEnable(0, 1); 
    Lcd_EnvidOnOff(1); 
rr:    Test_USBFIFO(); 
    //Test_SDI(); 
 
    Test_Lcd_Tft_16Bit_800480(); 
       Glib_ClearScr(0, MODE_TFT_16BIT_800480); 
       Glib_ClearScr(0xf800, MODE_TFT_16BIT_800480); 
       Glib_ClearScr(0x07e0, MODE_TFT_16BIT_800480); 
       Glib_ClearScr(0x001f, MODE_TFT_16BIT_800480); 
       Glib_ClearScr(0xffff, MODE_TFT_16BIT_800480); 
      
     
     
goto rr; 
   
} 
 
//=================================================================== 
void Isr_Init(void) 
{ 
    pISR_UNDEF  = (unsigned)HaltUndef; 
    pISR_SWI    = (unsigned)HaltSwi; 
    pISR_PABORT = (unsigned)HaltPabort; 
    pISR_DABORT = (unsigned)HaltDabort; 
     
    rINTMOD     = 0x0;                     //All=IRQ mode 
//    rINTCON=0x5;                           //Non-vectored,IRQ enable,FIQ disable     
    rINTMSK     = BIT_ALLMSK;              //All interrupt is masked. 
    rINTSUBMSK  = BIT_SUB_ALLMSK;          //All sub-interrupt is masked. <- April 01, 2002 SOP 
 
//    rINTSUBMSK  = ~(BIT_SUB_RXD0);         //Enable Rx0 Default value=0x7ff 
//    rINTMSK     = ~(BIT_UART0);            //Enable UART0 Default value=0xffffffff     
     
//    pISR_UART0=(unsigned)RxInt;            //pISR_FIQ,pISR_IRQ must be initialized 
} 
 
//=================================================================== 
void HaltUndef(void) 
{ 
    Uart_Printf("Undefined instruction exception.\n"); 
    while(1); 
} 
 
//=================================================================== 
void HaltSwi(void) 
{ 
    Uart_Printf("SWI exception.\n"); 
    while(1); 
} 
 
//=================================================================== 
void HaltPabort(void) 
{ 
    Uart_Printf("Pabort exception.\n"); 
    while(1); 
} 
 
//=================================================================== 
void HaltDabort(void) 
{ 
    Uart_Printf("Dabort exception.\n"); 
    while(1); 
} 
 
 
 
 
 
/* 
//========================= 
    while(1) 
    { 
       Led_Display(3); 
    } 
//=========================     
*/ 
/* 
//========================= 
    while(1) 
    { 
       Led_Display(1); 
       Delay(1500);    
       Led_Display(2); 
       Delay(1500);              
       Led_Display(4); 
       Delay(1500);    
       Led_Display(8); 
       Delay(1500);                 
    } 
//=========================    
*/