📄 main_2410.c
字号:
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* source\2410TEST.C 1.1 */
/* */
/* DESCRIPTION */
/* */
/* S3C2410 2410TEST - MBA2410(S3C2410X) */
/* */
/* DATA STRUCTURES */
/* */
/* FUNCTIONS : S3C2410 MAIN TEST ROUTINE */
/* 1. Connected the board to the PC through RS232 (UART) */
/* 2. Run DNW.exe or Hyper terminal and select menu. */
/* */
/* DEPENDENCIES */
/* */
/* History */
/* 2003. 10 30: Modified by Nicolas Park */
/* 2004. 2. 10: Modified by Yeo for EWARM */
/* REMARKS: */
/* */
/* */
/* Copyright (C) 2005 AIJISYSTEM CO.,LTD */
/*************************************************************************/
#include <stdlib.h>
#include <string.h>
//Shin, On Pil
#include "..\common\def.h"
#include "..\common\option.h"
#include "..\common\2410addr.h"
#include "..\common\2410lib.h"
#include "..\common\2410slib.h"
#include "..\common\mmu.h"
#include "lcd.h"
#include "lcdlib.h"
#include "glib.h"
#include "palette.h"
void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
void * function[][2]=
{
//LCD
(void *)Test_Lcd_Tft_8Bit_240320, "TFT240320 8Bit ",
(void *)Test_Lcd_Tft_8Bit_240320_On, "TFT240320 8Bit On ",
(void *)Test_Lcd_Tft_16Bit_240320, "TFT240320 16Bit ",
0,0
};
//===================================================================
void main(void)
{
int i;
Led_Display(15);
MMU_Init();
//#if ADS10
// __rt_lib_init(); //for ADS 1.0
//#endif
ChangeClockDivider(1,1); // 1:2:4
ChangeMPllValue(0xa1,0x3,0x1); // FCLK=202.8MHz
Port_Init();
Isr_Init();
Uart_Init(115200);
// Uart_Select(0);
//Check whether or not the POWER_OFF wake-up.
Delay(0); //calibrate Delay()
//SJS July 15, 2002
//Turn on LCD. All test will be done while the LCD is turned on.
//PWR_Lcd_Tft_16Bit_240320_On();
//Save the wasted power consumption on GPIO.
rIISPSR=(2<<5)|(2<<0); //IIS_LRCK=44.1Khz @384fs,PCLK=50Mhz.
rGPHCON = rGPHCON & ~(0xf<<18)|(0x5<<18); //CLKOUT 0,1=OUTPUT to reduce the power consumption.
//SJS July 15, 2002
//Turn on LCD. All test will be done while the LCD is turned on.
Test_Lcd_Tft_8Bit_240320_On();
while(1)
{
i = 0;
//GPG4 Output Port [9:8] 00 -> LCD power off
//rGPGCON = (rGPGCON & 0xfffffcff) | (1<<8);
//rGPGDAT &= 0xffef;
Uart_Printf("\n\nMBA2410 Board (MCU S3C2410) Test Program Ver 1.1(20020801) FCLK = %d Hz\n\n", FCLK);
while(1)
{ //display menu
Uart_Printf("%2d:%s",i,function[i][1]);
i++;
if((int)(function[i][0])==0)
{
Uart_Printf("\n");
break;
}
if((i%4)==0)
Uart_Printf("\n");
}
Uart_Printf("\nSelect the function to test : ");
i = Uart_GetIntNum();
Uart_Printf("\n");
//GPG4 Output Port [9:8] 01 -> LCD power On
rGPGCON = (rGPGCON & 0xfffffcff) | (1<<8);
rGPGDAT = (rGPGDAT & 0xffef) | (1<<4);
if(i>=0 && (i<(sizeof(function)/8)) )
( (void (*)(void)) (function[i][0]) )();
}
}
//===================================================================
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);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -