?? lib.h
字號:
/***************************************************************************\
Copyright (c) 2004-2007 threewater@up-tech.com, All rights reserved.
by threewter 2004.4.26
\***************************************************************************/
/***************************************************************************\
#說明: C庫函數定義頭文件
---------------------------------- Bug --------------------------------------
---------------------------------- TODO list --------------------------------------
----------------------------------修正--------------------------------------
2004-5-2 1、為調試和內核的輸出,添加TRACE和printk宏定義
2、定義mdelay宏,毫秒級延時
3、添加版本號的定義MAJOR, MINOR, BUILD VERSION
2004-4-30 1、添加CONSOLE宏定義,可以定義串口輸出的控制臺
2、定義CONSOLE_PUTC宏,作為標準控制臺輸出宏。
printf 時被fputc調用
3、添加Uart_SendChar函數,如果發送'\n'則自動發送'\r',
適合于控制臺輸出
2004-4-26 創建
\***************************************************************************/
#ifndef __LIB_H__
#define __LIB_H__
//#include "io.h"
//#include "sysdrv.h" //驅動抽象層頭文件
//#include "../inc/macro.h"
//#include "../src/fs/osfile.h"
#include <stdio.h>
/***********************Version define***************************************/
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define BUILD_VERSION 1
#define VERSION ((MAJOR_VERSION)|(MINOR_VERSION<<8)|(BUILD_VERSION<<16))
#define VERSION_STR "Build Version %d.%d.%4.4d\n", MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION
/***********************console define***************************************/
#define CONSOLE 0
//for debug
#define TRACE printf
//for kernel information output
#define printk printf
void printfNULL(char *fmt, ...);
#define getchartimeout(buffer, n, timeout) Uart_GetchTimeout(CONSOLE, (char*)buffer, n, timeout)
#define Uart_SendChar(nUart, ch) do{if((ch)=='\n') Uart_SendByte((nUart), '\r'); \
Uart_SendByte((nUart), (ch)); }while(0)
//從控制臺所在的串口,獲得輸入的字符串
//#define GetCommand(string) Uart_GetString(CONSOLE, string);
//定義標準控制臺輸出函數
#define CONSOLE_PUTC(ch) Uart_SendChar(CONSOLE, (ch))
//定義標準控制臺輸入函數
#define CONSOLE_GETC() Uart_Getch(CONSOLE)
/***********************System define***************************************/
extern unsigned int PCLK, HCLK, FCLK;
extern struct struct_system_param system_param;
/***********************macro define***************************************/
#define mdelay(n) hudelay(n*10)
/***********************function define***************************************/
typedef void (*serial_loop_func_t)(void);
/***********************arm define***************************************/
#define FlushCache() __asm{mcr p15, 0, r0, c7, c7, 0}
/*lib.c*/
void hudelay(int time); //Watchdog Timer is used.
int Uart_Init(int whichUart,int baud);
int Uart_SendByte(int whichUart, int data);
void Uart_Printf(int whichUart, char *fmt,...);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -