?? test_lcd.c.bak
字號:
/* * test_lcd.c -- test lcd application * * Author: lumit-admin <admin@lumit.org> * Date: 2005-1-11 * Copyright: http://www.lumit.org *///#include "led.h"//#include "lcd.h"#include <stdio.h>#define SYSCFG (0x03ff0000)#define UART0_BASE (SYSCFG + 0xD000)#define UART1_BASE (SYSCFG + 0xE000)/* * Serial settings....................... */ #define ULCON 0x00 #define UCON 0x04#define USTAT 0x08#define UTXBUF 0x0C#define URXBUF 0x10#define UBRDIV 0x14/* * Line control register bits............ */ #define ULCR8bits (3)#define ULCRS1StopBit (0)#define ULCRNoParity (0)/* * UART Control Register bits............ */ #define UCRRxM (1)#define UCRRxSI (1 << 2)#define UCRTxM (1 << 3)#define UCRLPB (1 << 7)/* * UART Status Register bits */ #define USROverrun (1 << 0)#define USRParity (1 << 1)#define USRFraming (1 << 2)#define USRBreak (1 << 3)#define USRDTR (1 << 4)#define USRRxData (1 << 5) #define USRTxHoldEmpty (1 << 6)#define USRTxEmpty (1 << 7)#define GET_STATUS(p) (*(volatile unsigned *)((p) + USTAT))#define RX_DATA(s) ((s) & USRRxData)#define GET_CHAR(p) (*(volatile unsigned *)((p) + URXBUF))#define TX_READY(s) ((s) & USRTxHoldEmpty)#define PUT_CHAR(p,c) (*(unsigned *)((p) + UTXBUF) = (unsigned )(c))void delay(){ int i, j; for( i=0; i<20; i++ ) for ( j=0; j<65536; j++ ) ;}int putchar_uart0(int ch){ /* Place your implementation of fputc here */ /* e.g. write a character to a UART, or to the */ /* debugger console with SWI WriteC */ while ( TX_READY(GET_STATUS(UART0_BASE))==0); PUT_CHAR(UART0_BASE, ch); return ch;}struct __FILE { int handle; /* Add whatever you need here */};FILE __stdout;int fputc(int ch, FILE *f){ /* Place your implementation of fputc here */ /* e.g. write a character to a UART, or to the */ /* debugger console with SWI WriteC */ putchar_uart0( ch ); return ch;}int ferror(FILE *f){ /* Your implementation of ferror */ return EOF;}#define LTCOS1 (0x7 << 16) #define LTACS1 (0x6 << 19) #define LTCOH1 (0x2 << 22) #define LTACC1 (0x7 << 25) // Bus Width of External I/O Bank 0//#define DSX0 (0x01 << 20)#define DSX1 (0x01 << 22)#define ASIC_BASE 0x3ff0000/* I/O Port Interface */#define IOPMOD *(volatile unsigned int *)(ASIC_BASE+0x5000)#define IOPCON *(volatile unsigned int *)(ASIC_BASE+0x5004)#define IOPDATA *(volatile unsigned int *)(ASIC_BASE+0x5008)void C_Entry( void ){ int count = 0; IOPMOD=0x3fff; IOPDATA=0x0; printf( "lcd new begin \r\n" ); { printf( "lcd init begin \r\n" ); LCDInit(); printf( "lcd init OK! \r\n" ); LCDTest(); printf( "lcd test OK! \r\n" ); } while(1); }/**************************************************************** * End of test_lcd.c ****************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -