📄 viadriver.h
字号:
#ifndef __VIADRIVER_H__#define __VIADRIVER_H__/* Big endian or little endian big = 1, little = 0 */#define BIG_ENDIAN 0#ifndef IMPORT#define IMPORT extern#endif /*IMPORT*/#ifndef STATUS#define STATUS int#endif /*STATUS*/#ifndef OK#define OK 0#endif /*OK*/#ifndef ERROR#define ERROR (-1)#endif /*ERROR*/#ifndef EOS#define EOS '\0' /* C string terminator */#endif /*EOS*/#ifndef NULL#define NULL (0)#endif /*NULL*/#ifndef TRUE#define TRUE (1)#endif /*TRUE*/#ifndef FALSE#define FALSE (0)#endif /*FALSE*//*#if BIG_ENDIAN*/#if 0/*#define ntohl(x) (x)*//*#define ntohs(x) (x)*//*#define htonl(x) (x)*//*#define htons(x) (x)*/#define NTOHL(x) (x) = ntohl((ulong)(x))#define NTOHS(x) (x) = ntohs((ushort)(x))#define HTONL(x) (x) = htonl((ulong)(x))#define HTONS(x) (x) = htons((ushort)(x))#else#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x00ff0000) >> 8) | \ (((x) & 0xff000000) >> 24))#define htonl(x) ((((x) & 0x000000ff) << 24) | \ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x00ff0000) >> 8) | \ (((x) & 0xff000000) >> 24))#define ntohs(x) ((((x) & 0x00ff) << 8) | \ (((x) & 0xff00) >> 8))#define htons(x) ((((x) & 0x00ff) << 8) | \ (((x) & 0xff00) >> 8))#define NTOHL(x) (x) = ntohl((ulong)(x))#define NTOHS(x) (x) = ntohs((ushort)(x))#define HTONL(x) (x) = htonl((ulong)(x))#define HTONS(x) (x) = htons((ushort)(x))#endif /* BIG_ENDIAN */#define bcopy(s,d,c) memmove(d,s,c)typedef struct api_Mac_device{ uchar enetAddr[6]; /* ethernet address */} API_DEVICE;/* MAC Api function predefinition *//* API Sub Fuctions */int api_MacHWReset (API_DEVICE *api_Mac_dev);int api_MacBuffInit(API_DEVICE *api_Mac_dev);int api_MacBuffFree(API_DEVICE *api_Mac_dev);int api_MacHWInit(API_DEVICE *api_Mac_dev);int api_MacHWStart( API_DEVICE *api_Mac_dev);int api_MacHWStop( API_DEVICE *api_Mac_dev);int api_MacIntEnable (API_DEVICE *api_Mac_dev);int api_MacIntDisable(API_DEVICE *api_Mac_dev);void api_MacRcv( API_DEVICE *api_Mac_dev);int api_MacSend( API_DEVICE *api_Mac_dev,ulong pData,int len);void api_init(bd_t *bd, API_DEVICE *api_Mac_dev);/* * Our MAC address definition. User can change this value as * per requirement *//* Macro to get the ethernet address from the BSP */#ifndef SYS_ENET_ADDR_GET#define SYS_ENET_ADDR_GET(pDevice, EnetAddr) \ { \ bcopy ((char *)EnetAddr, (char *)(&pDevice->enetAddr), 6); \ }#endif#endif /*__VIADRIVER_H__*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -