?? lib.h
字號(hào):
/***************************************************************************\
Copyright (c) 2004-2007 threewater@up-tech.com, All rights reserved.
by threewter 2004.4.26
\***************************************************************************/
/***************************************************************************\
#說明: C庫函數(shù)定義頭文件
---------------------------------- Bug --------------------------------------
---------------------------------- TODO list --------------------------------------
----------------------------------修正--------------------------------------
2004-5-2 1、為調(diào)試和內(nèi)核的輸出,添加TRACE和printk宏定義
2、定義mdelay宏,毫秒級(jí)延時(shí)
3、添加版本號(hào)的定義MAJOR, MINOR, BUILD VERSION
2004-4-30 1、添加CONSOLE宏定義,可以定義串口輸出的控制臺(tái)
2、定義CONSOLE_PUTC宏,作為標(biāo)準(zhǔn)控制臺(tái)輸出宏。
printf 時(shí)被fputc調(diào)用
3、添加Uart_SendChar函數(shù),如果發(fā)送'\n'則自動(dòng)發(fā)送'\r',
適合于控制臺(tái)輸出
2004-4-26 創(chuàng)建
\***************************************************************************/
#ifndef __LIB_H__
#define __LIB_H__
#include "io.h"
#include "sysdrv.h" //驅(qū)動(dòng)抽象層頭文件
#include "../inc/macro.h"
//#include "../src/fs/osfile.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)
//從控制臺(tái)所在的串口,獲得輸入的字符串
//#define GetCommand(string) Uart_GetString(CONSOLE, string);
//定義標(biāo)準(zhǔn)控制臺(tái)輸出函數(shù)
#define CONSOLE_PUTC(ch) Uart_SendChar(CONSOLE, (ch))
//定義標(biāo)準(zhǔn)控制臺(tái)輸入函數(shù)
#define CONSOLE_GETC() Uart_Getch(CONSOLE)
/***********************System define***************************************/
extern unsigned int PCLK, HCLK, FCLK;
/***********************System param define*********************************/
//struct struct_system_param{
// unsigned int magic;
// calibrate_MATRIX calibrate_matrix;
//};
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.
void Port_Init(void);
int GetCommand(char *command, int len);
int Uart_Init(int whichUart,int baud);
void Uart_RxEmpty(int whichUart);
void Uart_TxEmpty(int whichUart);
int Set_UartLoopFunc(serial_loop_func_t func);
int Clear_UartLoopFunc(int index);
char Uart_Getch(int whichUart);
int Uart_GetchTimeout(int whichUart, char* pbuffer, int n, int timeout);
int Uart_Poll(int whichUart);
int Uart_SendByte(int whichUart, int data);
void Uart_GetString(int whichUart, char *string);
int Uart_GetIntNum(int whichUart);
void Uart_Printf(int whichUart, char *fmt,...);
void Uart_SendString(int whichUart, char *pt);
int Set_UartLoopFunc(serial_loop_func_t func);
int Clear_UartLoopFunc(int index);
void loadsystemParam(void);
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -