📄 2440lib.c
字号:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* S3C2440 Library
*
* (c) Copyright 2005, king
* All Rights Reserved
*
* File : 2440lib.c
* Des : S3C2440侩 扁鸥 扼捞宏矾府
* By : KInG(kimingoo@hotmail.com)
* History : 2005.07.30 -> draft
*********************************************************************************************************
*/
#include "includes.h"
#include "2440lib.h"
#include "2440lcd.h"
#include "2440addr.h"
#include "os_cpu.h"
#include "2440uart.h"
#include "os_cfg.h"
static void StartTimeTick(void);
void InitSystem(void)
{
Uart_Init(PCLK, 115200);
TL_Init(LCD_XSIZE, LCD_YSIZE, SCR_XSIZE, SCR_YSIZE);
TL_FillFrame(BLUE);
pISR_UART0 = (unsigned int)ISR_Uart0RxD;
rINTSUBMSK &= ~BIT_SUB_RXD0;
rINTMSK &= ~BIT_UART0;
StartTimeTick();
}
void Led_Display(int data)
{
unsigned int Reg;
Reg = rGPCDAT;
Reg |= 0x000000C0;
rGPCDAT = Reg; //-- ALL OFF
}
void TFT_DrawLine(int xs, int xe, int yy, int color)
{
int i;
for(i=xs;i<=xe;i++)
TL_PutPixel(i, yy, color);
}
// 鸥烙平 惯积 窃荐 PWM狼 Timer4甫 荤侩窃(Timer4啊 PWM牢啊?)
static void StartTimeTick(void)
{
INT32U ticf; // Timer input clock Freauency
rTCFG0 &= ~(0xff<<8); // Prescaler1[15: 8]=0x00 (prescaler value=0)
rTCFG1 &= ~(0xf<<16); // MUX4[19:16]=0000b (divider value=2)
// Timer input clock Freauency = PCLK / (prescaler value+1) / divider value
ticf = PCLK / (0+1) / 2;
rTCNTB4 = ticf / OS_TICKS_PER_SEC;
rTCON |= (1<<22) | (1<<21);
rTCON &= ~(1<<21);
rTCON |= (1<<20); // Start for Timer4
// TimeTick 牢磐反飘 氦磐 汲摹 & 牢磐反飘 付胶欧 秦力
pISR_TIMER4 = (unsigned)OSTickISR;
rINTMSK &= ~(BIT_TIMER4);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -