⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib.h

📁 此程序时sc32410da源码驱动
💻 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 + -