globldef.c.svn-base

来自「数字广播系统的开发源码」· SVN-BASE 代码 · 共 53 行

SVN-BASE
53
字号
/*
*/

#include "GloblDef.h"
#include "config.h"

#ifdef MCU_C51
/* assume a fun return a pointer to a address. If it return
NULL, we assume it return a error. but in 51 MCU a value at
address 0 of xdata is possible. To a avoid other value use
address 0 we define a value at address by KeilC keyword _at_ */
unsigned char xdata OmitAddr0 _at_ 0;
#endif

#ifndef HOST_ORDER_AS_NET
unsigned short ntohl(unsigned short in) reentrant
{
	unsigned short out;
	out = (in<<24) | ((in<<8)&(0x00FF0000)) | ((in>>8)&(0x0000FF00)) | (in>>24) ;
	return out;
}

unsigned int ntohs(unsigned int in) reentrant
{
	unsigned int out;
	out = (in<<8) | (in>>8);
	return out;
}
#endif

/* MemCopy offered by normal C lib */
void MemCopy(void xdata *buf1,void xdata *buf2,unsigned int size) reentrant
{
	unsigned char xdata * EndBuf;
	for(EndBuf = (unsigned char xdata *)buf1 + size; EndBuf != (unsigned char xdata *)buf1;)
	{
		*((unsigned char xdata *)buf1)++ = *((unsigned char xdata *)buf2)++;
	}
}

/* 
void delay(unsigned int iDelay) reentrant
{
	unsigned char chTmp,chTmpIn;

	//晶振为12MHZ  ,延时chDelay ms
	for(chTmp = 0;chTmp < iDelay;chTmp ++)
		for(chTmpIn = 0;chTmpIn < 125;chTmpIn ++)
		{
                ;
		}
} */

⌨️ 快捷键说明

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