亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sndsend_cjw.c

?? 4510b的vxworks的BSP
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* sndsEnd.c - SNDS END network interface driver for Ethernet */

/* Copyright 1984-1997 Wind River Systems, Inc. */
#include "copyright_wrs.h"

/*
modification history
--------------------
01f,25nov99,knp, changed the name from "end" to "secEnd"
01e,12nov99,knp, Corrected handling EIOCSFLAGS, added IFF_MULTICAST flag
01d,06nov99,knp, updated multicast address support
01c,18oct99,knp added polled mode support
01b,27sep99,nb  added documentation
01a,20sep99,nts&knp  adapted from WRS template
*/

/*
DESCRIPTION

This module implements the Enhanced Ethernet driver for Samsung SNDS100 Ver 1.0
Evaluation Board for their KS32C50100 microcontroller.

KS32C50100 is an ARM based processor with several integrated peripherals.
It has an interrupt controller, two 32-bit timers, one Ethernet controller,
two HDLC controllers, one IIC controller, general purpose I/O ports, and a 
2-channel DMA controller.

The built-in Ethernet controller consists of 10/100 Ethernet MAC with MII
interface to an external PHY device and a Buffered DMA controller for
transferring data to and from the memory.  The SNDS100 board has a Level One
LXT970 Ethernet PHY device that supports both 10Base-T and 100Base-T
Ethernet.

All the internal registers of the Ethernet MAC and BDMA controller are
accessible as 32-bit integers at the internal system register addresses as
defined in the KS32C50100 Microcontroller User's Manual.  The register 
addresses are defined in sndsend.h include file.

The driver requires several target-specific values provided as an input 
string to the load routine.  These target-specific values and the external 
support routines are described below.

This network interface driver does not include support for trailer protocols
or data chaining.  However, buffer loaning has been implemented in an effort 
to boost performance.

This driver maintains cache coherency by setting the Address bit 26 (A26) of
descriptor and buffer addresses.  KS32C50100 accesses all memory locations
with A26 set in a non-cached mode.  However, A26 is not used for accessing
the memory.  See the KS32C50100 Microcontroller User's Manual for details.
Because of this feature, allocating buffer space using the cacheDmaMalloc()
routine is not required.

BOARD LAYOUT
This device is on-chip.  No jumpering diagram is necessary.

EXTERNAL INTERFACE
This driver provides the standard END external interface.  The only external
interface is the sndsEndLoad() routine.  The parameters are passed
into the sndsEndLoad() function as a single colon-delimited string.
The sndsEndLoad() function uses strtok() to parse the string, which it 
expects to be of the following format:

<unit>:<speed>:<duplex>:<autoneg>

TARGET-SPECIFIC PARAMETERS

.IP <unit>
A convenient holdover from the former model.  This parameter is used only
in the string name for the driver.  Value must be 0

.IP <speed>
Indicates the desired network speed.  Valid values are 10 and 100.  This
parameter is ignored if auto-negotiation is enabled.  See below.

.IP "<duplex>"
Indicates the desired duplex mode of operation.  A value 1 indicates full-
duplex and a value 0 indicated half duplex.  This parameter is ignored if
auto-negotiation is enabled.

.IP "<auto-neg>"
Indicates whether auto-negotiation has to be enabled or not.  A value of 1
indicates that auto-negotiation should be enabled.  A value of 0 indicates
that it should be disabled.  If auto-negotiation is enabled, the speed and
duplex values are ignored.

.LP

SYSTEM RESOURCE USAGE
When implemented, this driver requires the following system resources:

    - one mutual exclusion semaphore
    - four interrupt vectors

The driver allocates the memory to share with the Ethernet device unit.
It does so by calling the calloc() routine.  As a default, 64 transmit 
descriptors (size=16 bytes), 64 transmit buffers (size=END_BUFSIZ), and
64 receive descriptors (size=16 bytes) are allocated.  TX_FD_NUM and RX_FD_NUM
macros define the number of descriptors allocated.

As a default, 128 MBLK structures, 128 CLBLK structures and 128 clusters
(size=2048) are allocated in the net pool.  END_MBLK_NUM and END_CL_NUM 
macros define the number of structures allocated.

The macros SYS_INT_CONNECT, SYS_INT_DISCONNECT, and SYS_INT_ENABLE allow
the driver to be customized for BSPs that use special versions of these
routines.

The macro SYS_INT_CONNECT is used to connect the interrupt handler to
the appropriate vector.  By default it is the routine intConnect().

The macro SYS_INT_DISCONNECT is used to disconnect the interrupt handler prior
to unloading the module.  By default this is a dummy routine that
returns OK.

The macro SYS_INT_ENABLE is used to enable the interrupt level for the
end device.  It is called once during initialization.  By default this is
the routine intEnable().

The macro SYS_ENET_ADDR_GET is used to get the ethernet address (MAC)
for the device.  The single argument to this routine is the END_DEVICE
pointer.  By default this routine copies the ethernet address stored in
the global variable sndsEndEnetAddr defined in sndsend.h into the 
END_DEVICE structure.  The global variable has to be changed for changing
the MAC address of the Ethernet port.

SPECIAL CONSIDERATION

The MAC address of Ethernet port is hard-coded in the global array named
sndsEndEnetAddr defined in sndsEnd.h

The internal registers of MAC and BDMA controllers in the KS32C50100
microcontroller are accessible as 32-bit integers at pre-defined address
locations.  Hence separate macros are not provided for register accesses.
All through the driver code, these registers are accessed directly.

INCLUDES:
end.h endLib.h etherMultiLib.h sndsend.h

SEE ALSO: muxLib, endLib
.I "Writing and Enhanced Network Driver"
*/

/* includes */

#include "vxWorks.h"
#include "sndsEnd.h"			/* mod knp 7sep99"drv/end/sndsEnd.h"Common defines. */
#include "etherMultiLib.h"		/* multicast stuff. */
#include "end.h"			/* Common END structures. */
#include "endLib.h"
#include "lstLib.h"			/* Needed to maintain protocol list. */
#include "cacheLib.h"
#include "stdlib.h"
#include "stdio.h"
#include "intLib.h"
#include "iv.h"
#include "netLib.h"
#include "config.h"

/* defines */

/* Configuration items */
#define ENET_HDR_REAL_SIZ 	14
#define END_BUFSIZ      	(ETHERMTU + ENET_HDR_REAL_SIZ + 6)
#define END_SPEED        	10000000
#define	SNDS_CL_SIZE		2048
#define	RX_FD_NUM			64
#define	TX_FD_NUM			64

#define LS_POLLING          0x20

/*
 * Default macro definitions for BSP interface.
 * These macros can be redefined in a wrapper file, to generate
 * a new module with an optimized interface.
 */

/* Macro to connect interrupt handler to vector */

#ifndef SYS_INT_CONNECT
#   define SYS_INT_CONNECT(pDrvCtrl,rtn,arg,pResult) \
	{ \
	IMPORT STATUS sysIntConnect(); \
	*pResult = intConnect ((VOIDFUNCPTR *)INUM_TO_IVEC (pDrvCtrl->ivec), \
			     rtn, (int)arg); \
	}
#endif

/* Macro to disconnect interrupt handler from vector */

#ifndef SYS_INT_DISCONNECT
#   define SYS_INT_DISCONNECT(pDrvCtrl,rtn,arg,pResult) \
	{ \
	*pResult = OK; /* HELP: need a real routine */ \
	}
#endif

/* Macro to enable the appropriate interrupt level */

#ifndef SYS_INT_ENABLE
#define SYS_INT_ENABLE(pDrvCtrl) \
	{ \
	IMPORT void sysLanIntEnable(); \
	sysLanIntEnable (pDrvCtrl->ilevel); \
	}
#endif

/* Macro to get the ethernet address from the BSP */

#ifndef SYS_ENET_ADDR_GET
#   define SYS_ENET_ADDR_GET(pDevice) \
	{ \
	IMPORT unsigned char sndsEndEnetAddr[]; \
	bcopy ((char *)sndsEndEnetAddr, (char *)(&pDevice->enetAddr), 6); \
	}
#endif

/*
 * Macros to do a short (UINT16) access to the chip. Default
 * assumes a normal memory mapped device.
 */

#ifndef SNDS_OUT_SHORT
#   define SNDS_OUT_SHORT(pDrvCtrl,addr,value) \
	(*(USHORT *)addr = value)
#endif

#ifndef SNDS_IN_SHORT
#   define SNDS_IN_SHORT(pDrvCtrl,addr,pData) \
	(*pData = *addr)
#endif

#ifndef SNDS_OUT_LONG
#   define SNDS_OUT_LONG(pDrvCtrl,addr,value) \
	(*(UINT32 *)addr = value)
#endif

#ifndef SNDS_IN_LONG
#   define SNDS_IN_LONG(pDrvCtrl,addr,pData) \
	(*pData = *addr)
#endif

/*A shortcut for getting the hardware address from the MIB II stuff. */


#define END_HADDR(pEnd)	\
		((pEnd)->mib2Tbl.ifPhysAddress.phyAddress)

#define END_HADDR_LEN(pEnd) \
		((pEnd)->mib2Tbl.ifPhysAddress.addrLength)

/* typedefs */

typedef struct free_args
    {
    void* arg1;
    void* arg2;
    } FREE_ARGS;

/* The definition of the driver control structure */

typedef struct end_device
    {
	END_OBJ    	end;			/* The class we inherit from. */
    int			unit;			/* unit number */
 	int			ivecBdmaTx;		/* bdmaTx interrupt vector */
	int			ivecBdmaRx;		/* bdmaRx interrupt vector */
	int			ivecMacTx;		/* macTx  interrupt vector */
	int			ivecMacRx;		/* macRx  interrupt vector */
    long		flags;			/* Our local flags. */
    UCHAR		enetAddr[6];	/* ethernet address */
	UCHAR		netSpeed;		/* 10 or 100 */
	UCHAR		duplexMode;		/* HDX = 0. FDX = 1 */
	UCHAR		autoNeg;		/* 1 = autoneg enabled */
	BOOL		fdInitialized;	/* Set to TRUE after FD allocation */
	ETHER_STATISTICS	statistics;	/* Ethernet statistics counters */
	UINT32	addrList[32];	/* Array for storing addresses Max = 21, i.e. 32 long words */
	UINT32	mcastAddrCount;	/* Number of valid multicast addresses */
    } END_DEVICE;

/* globals*/

/*
 * This will only work if there is only a single unit, for multiple
 * unit device drivers these should be integrated into the END_DEVICE
 * structure.
 */

M_CL_CONFIG endMclConfig = 	/* network mbuf configuration table */
    {
    /* 
    no. mBlks		no. clBlks		memArea		memSize
    -----------		----------		-------		-------
    */
    0, 				0, 				NULL, 		0 
    };

CL_DESC endClDescTbl [] = 	/* network cluster pool configuration table */
    {
    /* 
    clusterSize		num		memArea		memSize
    -----------		----	-------		-------
    */
    {SNDS_CL_SIZE,	0,		NULL,		0}
    };

int endClDescTblNumEnt = (NELEMENTS(endClDescTbl));

/* new additions */

RECEIVE_FRAME_DESC 		*gpReceiveFrameDescStart;
TRANSMIT_FRAME_DESC 	*gpTransmitFrameDescStart;
UINT32 					 gStatusLengthPrevious;			/* For bug fix */
BOOL	gBugFixDone = FALSE;

/* Definitions for the flags field */

#define END_PROMISCUOUS_FLAG	0x1
#define END_RCV_HANDLING_FLAG	0x2
#define END_MBLK_NUM			400
#define END_CL_NUM				400
#define	SNDS_DATA_OFFSET 		2
#define	SNDS_MAX_MULTI	20

/* DEBUG MACROS */

#undef DEBUG

#ifdef DEBUG
#include "nvLogLib.h"			/* Needed to debug polled mode.  */
int endDebug = 1;
#define ENDLOGMSG(x) \
	if (endDebug) \
	    { \
	    logMsg x; \
	    }
#else
#define ENDLOGMSG(x)
#endif /* ENDDEBUG */

/* LOCALS */

#ifdef INCLUDE_SNDS_END

/* forward static functions */

LOCAL void		sndsEndReset			(END_DEVICE *pDrvCtrl);    /* added by knp/nts 14/9/99 */
LOCAL STATUS	sndsEndStart			(END_DEVICE *pDrvCtrl);    /* added by knp/nts 14/9/99 */
LOCAL void		sndsEndBdmaRxInt		(END_DEVICE *pDrvCtrl);    /* added by knp/nts 15/9/99 */
LOCAL void		sndsEndBdmaTxInt		(END_DEVICE *pDrvCtrl);
LOCAL void		sndsEndMacRxInt			(END_DEVICE *pDrvCtrl);
LOCAL void		sndsEndMacTxInt			(END_DEVICE *pDrvCtrl);
LOCAL void		sndsEndHandleRcvInt 	(END_DEVICE *pDrvCtrl, UINT32 stat);
LOCAL STATUS	sndsEndRecv				(END_DEVICE *pDrvCtrl, char* pData, UINT32 length);
LOCAL void		sndsEndConfig			(END_DEVICE *pDrvCtrl);
LOCAL UINT32	sndsEndPhyRead 			(UINT32 phyRegAddr, UINT32 phyAddr);
LOCAL void 		sndsEndPhyWrite 		(UINT32 phyRegAddr, UINT32 phyAddr, UINT32 phyData);
LOCAL void 		sndsEndMacInitialize	(END_DEVICE *pDevice);
LOCAL STATUS	sndsEndFdInitialize		(END_DEVICE *pDrvCrtl);
LOCAL void 		sndsEndFdFree			(END_DEVICE *pDrvCtrl);
LOCAL void 		sndsEndBugFix 			(UINT16 *);
LOCAL void sndsEndAddrFilterSet			(END_DEVICE *pDrvCtrl);

/* END Specific interfaces. */

/* This is the only externally visible interface. */

END_OBJ* 	sndsEndLoad (char* initString);

LOCAL STATUS	sndsEndStart		(END_DEVICE* pDrvCtrl);
LOCAL STATUS	sndsEndStop			(END_DEVICE* pDrvCtrl);
LOCAL STATUS	sndsEndUnload		();
LOCAL int		sndsEndIoctl		(END_DEVICE* pDrvCtrl, int cmd, caddr_t data);
LOCAL STATUS	sndsEndSend			(END_DEVICE* pDrvCtrl, M_BLK_ID pBuf);
			  
LOCAL STATUS	sndsEndMCastAdd 	(END_DEVICE* pDrvCtrl, char* pAddress);
LOCAL STATUS	sndsEndMCastDel 	(END_DEVICE* pDrvCtrl, char* pAddress);
LOCAL STATUS	sndsEndMCastGet 	(END_DEVICE* pDrvCtrl, MULTI_TABLE* pTable);
LOCAL STATUS	sndsEndPollSend 	(END_DEVICE* pDrvCtrl, M_BLK_ID pBuf);
LOCAL STATUS	sndsEndPollRcv 		(END_DEVICE* pDrvCtrl, M_BLK_ID pBuf);
LOCAL STATUS	sndsEndPollStart 	(END_DEVICE* pDrvCtrl);
LOCAL STATUS	sndsEndPollStop 	(END_DEVICE* pDrvCtrl);

LOCAL STATUS	sndsEndParse		();
LOCAL STATUS	sndsEndMemInit		();

/*
 * Declare our function table.  This is static across all driver
 * instances.
 */

LOCAL NET_FUNCS endFuncTable =
    {
    (STATUS (*) (END_OBJ*))sndsEndStart,				/* Function to start the device. */
    (STATUS (*) (END_OBJ*))sndsEndStop,				/* Function to stop the device. */
    (STATUS (*) (END_OBJ*))sndsEndUnload,				/* Unloading function for the driver. */
    (int (*) (END_OBJ*, int, caddr_t))sndsEndIoctl,				/* Ioctl function for the driver. */
	(STATUS (*) (END_OBJ* , M_BLK_ID))sndsEndSend,				/* Send function for the driver. */
    (STATUS (*) (END_OBJ*, char*))sndsEndMCastAdd,			/* Multicast address add function for the driver. */
    (STATUS (*) (END_OBJ*, char*))sndsEndMCastDel,			/* Multicast address delete function for the driver. */
    (STATUS (*) (END_OBJ*, MULTI_TABLE*))sndsEndMCastGet,			/* Multicast table retrieve function for the driver. */
    (STATUS (*) (END_OBJ*, M_BLK_ID))sndsEndPollSend,			/* Polling send function for the driver. */
    (STATUS (*) (END_OBJ*, M_BLK_ID))sndsEndPollRcv,				/* Polling receive function for the driver. */
    endEtherAddressForm,        /* Put address info into a packet.  */
    endEtherPacketDataGet,      /* Get a pointer to packet data. */
    endEtherPacketAddrGet       /* Get packet addresses. */
    };

/*******************************************************************************
*
* sndsEndLoad - initialize the driver and device
*
* This routine initializes the driver and the device to the operational state.
* All of the device specific parameters are passed in the initString.
*
* The string contains the target specific parameters like this:
*
* "<unit>:<Speed>:<duplex>:<autoneg>"
*
* RETURNS: An END object pointer or NULL on error.
*/

END_OBJ* sndsEndLoad
    (
    char* initString		/* String to be parsed by the driver. */
    )

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲sss视频在线视频| 欧美日韩国产综合一区二区| 国产三级精品视频| 国产尤物一区二区在线| 久久久高清一区二区三区| 国产成人aaa| 国产精品免费观看视频| 99精品黄色片免费大全| 亚洲亚洲精品在线观看| 欧美一区二区三区免费观看视频| 欧美aaa在线| 中文字幕久久午夜不卡| 色偷偷88欧美精品久久久| 亚洲二区在线观看| 欧美成人高清电影在线| 成人av小说网| 污片在线观看一区二区| 精品成人在线观看| eeuss鲁一区二区三区| 亚洲国产精品一区二区www| 日韩视频123| 成人综合在线视频| 午夜精品久久久久久不卡8050| 精品国产乱码久久| 在线观看欧美精品| 国产在线精品一区在线观看麻豆| 综合亚洲深深色噜噜狠狠网站| 欧美日韩三级一区| 国产一区二区三区精品视频| 亚洲四区在线观看| 精品少妇一区二区三区日产乱码 | 成人精品国产福利| 亚洲国产中文字幕| 中文字幕乱码久久午夜不卡| 日韩一区和二区| 成人av在线资源网| 国内精品久久久久影院色| 亚洲一区二区欧美| 欧美激情一区二区三区全黄| 欧美美女直播网站| 成人高清视频在线观看| 蜜桃精品视频在线观看| 亚洲精品免费在线观看| 国产日韩欧美精品综合| 欧美一区二区视频观看视频| 91网站最新地址| 国产精品1区2区3区| 日本免费在线视频不卡一不卡二| 中文字幕国产精品一区二区| 日韩亚洲欧美成人一区| 一本高清dvd不卡在线观看 | 蜜桃视频免费观看一区| 亚洲女厕所小便bbb| 国产性做久久久久久| 欧美电视剧在线看免费| 欧美伦理影视网| 日本黄色一区二区| 99国产精品国产精品毛片| 国产福利一区二区三区视频在线 | 亚洲.国产.中文慕字在线| 成人欧美一区二区三区1314| 久久精品亚洲精品国产欧美kt∨| 欧美日韩精品一区二区天天拍小说| 99在线视频精品| 成人一级片网址| 国产精品亚洲一区二区三区妖精 | 91影院在线观看| 国产成人av电影在线| 国产一区二区不卡| 国内精品视频一区二区三区八戒| 免费成人小视频| 蜜桃视频在线一区| 六月丁香综合在线视频| 精品一区二区在线播放| 狠狠色丁香婷婷综合| 久久国产夜色精品鲁鲁99| 久久狠狠亚洲综合| 国产一区美女在线| 国产成人综合在线| 成人高清免费观看| 91影院在线观看| 在线视频你懂得一区| 欧美日韩一区二区在线视频| 欧美美女一区二区三区| 欧美群妇大交群的观看方式| 欧美区在线观看| 欧美大片一区二区| 国产午夜一区二区三区| 国产精品人人做人人爽人人添 | 精品乱码亚洲一区二区不卡| 久久精品视频在线看| 国产三级一区二区三区| 国产精品三级av| 亚洲精品国产成人久久av盗摄 | 成人激情电影免费在线观看| 成人毛片老司机大片| 一本一本久久a久久精品综合麻豆| 欧美影视一区二区三区| 欧美一二区视频| 国产女主播一区| 亚洲已满18点击进入久久| 天天综合日日夜夜精品| 国内精品写真在线观看| 成人精品免费网站| 欧美日韩国产免费一区二区| 26uuu国产在线精品一区二区| 国产精品美女久久久久久2018| 亚洲欧洲一区二区三区| 五月天一区二区| 国产精品一二三四| 欧美日韩免费一区二区三区| 精品福利av导航| 亚洲欧美aⅴ...| 激情久久五月天| 色婷婷综合久久久久中文一区二区| 欧美女孩性生活视频| 国产亚洲一区字幕| 亚洲一区中文在线| 国产乱码精品一区二区三| 欧美午夜影院一区| 国产清纯白嫩初高生在线观看91| 亚洲在线一区二区三区| 国产+成+人+亚洲欧洲自线| 欧美日韩高清一区二区不卡 | 欧美一级视频精品观看| 国产精品久久久久久久久快鸭| 丝袜美腿亚洲色图| 91在线观看视频| 欧美精品一区二区三| 亚洲第一久久影院| a亚洲天堂av| 久久这里只精品最新地址| 亚洲国产视频网站| 成人av网站在线| 精品久久久久久久久久久院品网| 一区二区高清视频在线观看| 国产黄色成人av| 日韩一级精品视频在线观看| 一区二区三区高清| 成人美女在线视频| 久久精品视频网| 伦理电影国产精品| 欧美一区在线视频| 亚洲一区在线电影| 91免费观看视频| 国产精品欧美极品| 国产91综合一区在线观看| 日韩一区二区视频在线观看| 亚洲va国产天堂va久久en| 色吧成人激情小说| 18成人在线观看| 波多野结衣一区二区三区| 欧美精品一区二区三区蜜桃 | 国内精品伊人久久久久av影院| 在线电影院国产精品| 亚洲综合精品久久| 欧美综合色免费| 亚洲理论在线观看| 99精品视频在线播放观看| 国产欧美视频一区二区| 国产成人一区在线| 国产精品三级视频| 丁香婷婷综合网| 日本一区二区三区久久久久久久久不 | 亚洲欧美日韩国产一区二区三区| 国产精品一区二区91| 26uuu色噜噜精品一区二区| 久久超级碰视频| 久久久久久久综合色一本| 国产一区二区h| 日本一区二区成人在线| 成人免费视频一区| 中文字幕在线一区二区三区| 成人精品一区二区三区中文字幕| 欧美国产97人人爽人人喊| 丁香一区二区三区| 1区2区3区精品视频| 欧美在线观看一区二区| 亚洲国产一区二区视频| 欧美一区二区高清| 经典一区二区三区| 中文字幕欧美区| 一本久久a久久精品亚洲| 日韩专区在线视频| 精品成人在线观看| 99久久久无码国产精品| 亚洲午夜免费福利视频| 欧美一级高清大全免费观看| 国产一区二三区好的| 欧美国产一区二区| 色婷婷综合激情| 久久精品久久99精品久久| 中文一区一区三区高中清不卡| 91网站视频在线观看| 日本不卡视频在线| 国产欧美日韩视频一区二区| 欧美性猛交一区二区三区精品| 精品中文字幕一区二区| 国产精品嫩草99a| 欧美日产在线观看|