📄 main.c
字号:
/******************************************************************************/
/* */
/* main.C: A test loader for Philips */
/* */
/******************************************************************************/
#include "lpc2294.h"
#define USRRxData (1 << 0)
#define USRTxHoldEmpty (1 << 6)
#define GET_CHAR(p) p
#define PUT_CHAR(p,c) (p= (unsigned )(c))
#define TX_READY(s) ((s) & USRTxHoldEmpty)
#define RX_DATA(s) ((s) & USRRxData)
#define COM0_USER (0)
#define COM1_DEBUG (1)
extern void loadkernel(void);
void init_serial(void) { /* Initialize Serial Interface */
U0LCR = 0x83; /*8 bit char length;enable access to Divisor Latches */
U0DLL = 65; /*FOSC=10M, notusePLL,PCLK=2.5M,bitrate = PCLK / (16*U0DLL)*/
U0LCR = 0x03; /*8 bit char length;disable access to Divisor Latches*/
U0IER = 0x00000007; /*Enable RDA,THRE,RX line status interrupts*/
U0FCR = 0x00000081; /*Enable FIFO*/
}
void serial_print(char *s)
{
while ( *s != 0 ) {
while ( TX_READY(U0LSR)==0);
PUT_CHAR(U0DLL,*s++);
}
}
int main(void)
{
init_serial();
serial_print("\r\n** Bootloader start **\r\n");
loadkernel();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -