📄 main.c
字号:
#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "option.h"
#include "2410addr.h"
#include "2410lib.h"
#include "2410slib.h"
#include "mmu.h"
#include "lcd.h"
#include "2410iic.h"
void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
void Led_Display(int data);
//===================================================================
void Main(void)
{
int i;
Led_Display(0x0f);
Led_Display(0x00);
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(0,115200);
Uart_Select(0);
while(1)
{
i = 0;
Uart_Printf("\nOURS2410EDU Board (MCU S3C2410) VGA Test Program Ver 1.0\n");
IicSetCh7004();
Delay(2000);
Test_Lcd_Tft_16Bit_640480();
Delay(10000);
Uart_GetKey();
}
}
//===================================================================
//Active is low.(LED On)
// GPF7 GPF6 GPF5 GPF4
//nLED_1 nLED2 nLED_4 nLED_3
void Led_Display(int data)
{
// rGPFDAT = (rGPFDAT & 0xf) | !((data & 0xf)<<4);
rGPFDAT = (rGPFDAT & ~(0xf<<4)) | ((~data & 0xf)<<4);
}
//===================================================================
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
rINTMSK = BIT_ALLMSK; //All interrupt is masked.
rINTSUBMSK = BIT_SUB_ALLMSK; //All sub-interrupt is masked. <- April 01, 2002 SOP
}
//===================================================================
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);
}
//=========================
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -