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

📄 defs.h

📁 这是一个自己开发的键盘驱动代码
💻 H
字号:
/****************************************************************************//* *	defs.h -- Global definitions * *	Author  :   St閜hane TAVENARD * *	(C) Copyright 1997-1997 St閜hane TAVENARD *	    All Rights Reserved * *	This program is free software; you can redistribute it and/or modify *	it under the terms of the GNU General Public License as published by *	the Free Software Foundation; either version 2 of the License, or *	(at your option) any later version. *	 *	This program is distributed in the hope that it will be useful, *	but WITHOUT ANY WARRANTY; without even the implied warranty of *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *	GNU General Public License for more details. *	 *	You should have received a copy of the GNU General Public License *	along with this program; if not, write to the Free Software *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//****************************************************************************/#ifndef DEFS_H#define DEFS_H/****************************************************************************/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include "myhead.h"#ifndef FALSE#define FALSE 0#endif#ifndef TRUE#define TRUE 1#endif/* *	Fixed size data types. */typedef char		INT8;typedef short		INT16;typedef long		INT32;typedef unsigned char	UINT8;typedef unsigned short	UINT16;typedef unsigned long	UINT32;typedef float		REAL;typedef short		BOOL;/* *	SRAM Buffer macros */#ifdef SRAM_OPT_BUF#define SRAM_BUF(s, size)	\	static char *s;	\{	\	static int alloced=0;	\	if(alloced==0){	\		s=sram_alloc_buf(size);	\		alloced=1;	\	}	\}	#define SRAM_BUF_SUB(s, size)	\	static SUB_DCT_TYPE *s;	\{	\	static int alloced=0;	\	if(alloced==0){	\		s=(SUB_DCT_TYPE*)sram_alloc_buf(size*sizeof(SUB_DCT_TYPE));	\		memset(s, 0, size*sizeof(SUB_DCT_TYPE));	\		alloced=1;	\	}	\}	#define DECLARE_BUF_IMDCT(s, size) 	static IMDCT_TYPE *s#define SRAM_BUF_IMDCT(s, size)	\{	\	static int alloced=0;	\	if(alloced==0){	\		s=(IMDCT_TYPE*)sram_alloc_buf(size*sizeof(IMDCT_TYPE));	\		memset(s, 0, size*sizeof(IMDCT_TYPE));	\		alloced=1;	\	}	\}#else#define SRAM_BUF(s, size)	char s[size]#define SRAM_BUF_SUB(s, size) SUB_DCT_TYPE s[size]#define SRAM_BUF_IMDCT(s, size)	#define DECLARE_BUF_IMDCT(s, size) 	IMDCT_TYPE s[size]#endif/* *	Profile macros */#ifndef PROFILE#define DECLARE_TIME #define DEFINE_TIME #define START_TIME(n,s)  #define ELAP_TIME(n)  #define PRINT_TIME	#else#define MAXTM 100#define MAINTM 10#define DECLARE_TIME \    extern struct timeval tm0[MAXTM], tm[MAXTM]; \    extern long elap[MAXTM]; \	extern char item[MAXTM][MAXTM];#define DEFINE_TIME \    struct timeval tm0[MAXTM], tm[MAXTM]; \    long elap[MAXTM]; \	char item[MAXTM][MAXTM];#define START_TIME(n,s)  \    gettimeofday(&tm0[n], NULL); \	strcpy(item[n],s);	#define ELAP_TIME(n)  \	gettimeofday(&tm[n], NULL);    \	elap[n]+=1000*1000*(tm[n].tv_sec-tm0[n].tv_sec)+(tm[n].tv_usec-tm0[n].tv_usec); \	tm0[n]=tm[n]; \	/*if(elap>0)	printf(x" has used :%ld us\n", elap);*/ #define PRINT_TIME	{	\	int i;	\	int total=0;	\	/*while(item[i++]!=0){	*/\	for(i=0;i<=MAINTM;i++){	\		if(item[i][0]==0) break;	\		total+=elap[i];	\		printf("%2d:\t%25s:\t%8.2f s\n", i,item[i], (float)elap[i]/1000000);	\		PRINT_CH_TIME(i); \	} \	printf("-------------------\n");	\	printf("\t%25s:\t%8.2f s.\n", "Total added:", (float)total/1000000);	\}//0-9 main timer use 10-99//0 use 10-19//1 use 20-29#define PRINT_CH_TIME(i)	{\		int j;	\		for(j=(i+1)*10;j<(i+1)*10+10;j++){/*10 child timers*/	\			if(item[j][0]==0) break;	\			printf("(%2d:\t%25s:\t\t%8.2f s)\n", j,item[j], (float)elap[j]/1000000);	\		}	\	}	DECLARE_TIME;#endif/****************************************************************************/#endif /* DEFS_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -