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

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

?? xemac.c

?? 友善mini2440嵌入式
?? C
?? 第 1 頁 / 共 2 頁
字號:
/********************************************************************************     Author: Xilinx, Inc.***     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.***     XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A*     COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS*     ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,*     XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE*     FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING*     ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.*     XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO*     THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY*     WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM*     CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND*     FITNESS FOR A PARTICULAR PURPOSE.***     Xilinx hardware products are not intended for use in life support*     appliances, devices, or systems. Use in such applications is*     expressly prohibited.***     (c) Copyright 2002-2004 Xilinx Inc.*     All rights reserved.***     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.*******************************************************************************//*****************************************************************************//**** @file xemac.c** The XEmac driver. Functions in this file are the minimum required functions* for this driver. See xemac.h for a detailed description of the driver.** <pre>* MODIFICATION HISTORY:** Ver   Who  Date     Changes* ----- ---- -------- -------------------------------------------------------* 1.00a rpm  07/31/01 First release* 1.00b rpm  02/20/02 Repartitioned files and functions* 1.00b rpm  07/23/02 Removed the PHY reset from Initialize()* 1.00b rmm  09/23/02 Removed commented code in Initialize(). Recycled as*                     XEmac_mPhyReset macro in xemac_l.h.* 1.00c rpm  12/05/02 New version includes support for simple DMA* 1.00c rpm  12/12/02 Changed location of IsStarted assignment in XEmac_Start*                     to be sure the flag is set before the device and*                     interrupts are enabled.* 1.00c rpm  02/03/03 SelfTest was not clearing polled mode. Take driver out*                     of polled mode in XEmac_Reset() to fix this problem.* 1.00c rmm  05/13/03 Fixed diab compiler warnings relating to asserts.* </pre>******************************************************************************//***************************** Include Files *********************************/#include "xbasic_types.h"#include "xemac_i.h"#include "xio.h"#include "xipif_v1_23_b.h"	/* Uses v1.23b of the IPIF *//************************** Constant Definitions *****************************//**************************** Type Definitions *******************************//***************** Macros (Inline Functions) Definitions *********************//************************** Function Prototypes ******************************/static XStatus ConfigureDma(XEmac * InstancePtr);static XStatus ConfigureFifo(XEmac * InstancePtr);static void StubFifoHandler(void *CallBackRef);static void StubErrorHandler(void *CallBackRef, XStatus ErrorCode);static void StubSgHandler(void *CallBackRef, XBufDescriptor * BdPtr,			  u32 NumBds);/************************** Variable Definitions *****************************//*****************************************************************************//**** Initialize a specific XEmac instance/driver.  The initialization entails:* - Initialize fields of the XEmac structure* - Clear the Ethernet statistics for this device* - Initialize the IPIF component with its register base address* - Configure the FIFO components with their register base addresses.* - If the device is configured with DMA, configure the DMA channel components*   with their register base addresses. At some later time, memory pools for*   the scatter-gather descriptor lists may be passed to the driver.* - Reset the Ethernet MAC** @param InstancePtr is a pointer to the XEmac instance to be worked on.* @param DeviceId is the unique id of the device controlled by this XEmac*        instance.  Passing in a device id associates the generic XEmac*        instance to a specific device, as chosen by the caller or application*        developer.** @return** - XST_SUCCESS if initialization was successful* - XST_DEVICE_IS_STARTED if the device has already been started* - XST_DEVICE_NOT_FOUND if device configuration information was not found for*   a device with the supplied device ID.** @note** None.*******************************************************************************/XStatusXEmac_Initialize(XEmac * InstancePtr, u16 DeviceId){	XStatus Result;	XEmac_Config *ConfigPtr;	/* configuration information */	XASSERT_NONVOID(InstancePtr != NULL);	/*	 * If the device is started, disallow the initialize and return a status	 * indicating it is started.  This allows the user to stop the device	 * and reinitialize, but prevents a user from inadvertently initializing	 */	if (InstancePtr->IsStarted == XCOMPONENT_IS_STARTED) {		return XST_DEVICE_IS_STARTED;	}	/*	 * Lookup the device configuration in the temporary CROM table. Use this	 * configuration info down below when initializing this component.	 */	ConfigPtr = XEmac_LookupConfig(DeviceId);	if (ConfigPtr == NULL) {		return XST_DEVICE_NOT_FOUND;	}	/*	 * Set some default values	 */	InstancePtr->IsReady = 0;	InstancePtr->IsStarted = 0;	InstancePtr->IpIfDmaConfig = ConfigPtr->IpIfDmaConfig;	InstancePtr->HasMii = ConfigPtr->HasMii;	InstancePtr->HasMulticastHash = FALSE;	/* Always default polled to false, let user configure this mode */	InstancePtr->IsPolled = FALSE;	InstancePtr->FifoRecvHandler = StubFifoHandler;	InstancePtr->FifoSendHandler = StubFifoHandler;	InstancePtr->ErrorHandler = StubErrorHandler;	InstancePtr->SgRecvHandler = StubSgHandler;	InstancePtr->SgSendHandler = StubSgHandler;	/*	 * Clear the statistics for this driver	 */	XEmac_mClearStruct((u8 *) & InstancePtr->Stats, sizeof (XEmac_Stats));	/*	 * Initialize the device register base addresses	 */	InstancePtr->BaseAddress = ConfigPtr->BaseAddress;	/*	 * Configure the send and receive FIFOs in the MAC	 */	Result = ConfigureFifo(InstancePtr);	if (Result != XST_SUCCESS) {		return Result;	}	/*	 * If the device is configured for DMA, configure the send and receive DMA	 * channels in the MAC.	 */	if (XEmac_mIsDma(InstancePtr)) {		Result = ConfigureDma(InstancePtr);		if (Result != XST_SUCCESS) {			return Result;		}	}	/*	 * Indicate the component is now ready to use. Note that this is done before	 * we reset the device and the PHY below, which may seem a bit odd. The	 * choice was made to move it here rather than remove the asserts in various	 * functions (e.g., Reset() and all functions that it calls).  Applications	 * that use multiple threads, one to initialize the XEmac driver and one	 * waiting on the IsReady condition could have a problem with this sequence.	 */	InstancePtr->IsReady = XCOMPONENT_IS_READY;	/*	 * Reset the MAC to get it into its initial state. It is expected that	 * device configuration by the user will take place after this	 * initialization is done, but before the device is started.	 */	XEmac_Reset(InstancePtr);	return XST_SUCCESS;}/*****************************************************************************//**** Start the Ethernet controller as follows:*   - If not in polled mode*       - Set the internal interrupt enable registers appropriately*       - Enable interrupts within the device itself. Note that connection of*         the driver's interrupt handler to the interrupt source (typically*         done using the interrupt controller component) is done by the higher*         layer software.*       - If the device is configured with scatter-gather DMA, start the DMA*         channels if the descriptor lists are not empty*   - Enable the transmitter*   - Enable the receiver** The PHY is enabled after driver initialization. We assume the upper layer* software has configured it and the EMAC appropriately before this function* is called.** @param InstancePtr is a pointer to the XEmac instance to be worked on.** @return** - XST_SUCCESS if the device was started successfully* - XST_NO_CALLBACK if a callback function has not yet been registered using*   the SetxxxHandler function. This is required if in interrupt mode.* - XST_DEVICE_IS_STARTED if the device is already started* - XST_DMA_SG_NO_LIST if configured for scatter-gather DMA and a descriptor*   list has not yet been created for the send or receive channel.** @note** The driver tries to match the hardware configuration. So if the hardware* is configured with scatter-gather DMA, the driver expects to start the* scatter-gather channels and expects that the user has set up the buffer* descriptor lists already. If the user expects to use the driver in a mode* different than how the hardware is configured, the user should modify the* configuration table to reflect the mode to be used. Modifying the config* table is a workaround for now until we get some experience with how users* are intending to use the hardware in its different configurations. For* example, if the hardware is built with scatter-gather DMA but the user is* intending to use only simple DMA, the user either needs to modify the config* table as a workaround or rebuild the hardware with only simple DMA.** This function makes use of internal resources that are shared between the* Start, Stop, and SetOptions functions. So if one task might be setting device* options while another is trying to start the device, the user is required to* provide protection of this shared data (typically using a semaphore).*******************************************************************************/XStatusXEmac_Start(XEmac * InstancePtr){	u32 ControlReg;	XStatus Result;	XASSERT_NONVOID(InstancePtr != NULL);	XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);	/*	 * If it is already started, return a status indicating so	 */	if (InstancePtr->IsStarted == XCOMPONENT_IS_STARTED) {		return XST_DEVICE_IS_STARTED;	}	/*	 * If not polled, enable interrupts	 */	if (!InstancePtr->IsPolled) {		/*		 * Verify that the callbacks have been registered, then enable		 * interrupts		 */		if (XEmac_mIsSgDma(InstancePtr)) {			if ((InstancePtr->SgRecvHandler == StubSgHandler) ||			    (InstancePtr->SgSendHandler == StubSgHandler)) {				return XST_NO_CALLBACK;			}			/* Enable IPIF interrupts */			XIIF_V123B_WRITE_DIER(InstancePtr->BaseAddress,					      XEM_IPIF_DMA_DFT_MASK |					      XIIF_V123B_ERROR_MASK);			XIIF_V123B_WRITE_IIER(InstancePtr->BaseAddress,					      XEM_EIR_DFT_SG_MASK);			/* Enable scatter-gather DMA interrupts */			XDmaChannel_SetIntrEnable(&InstancePtr->RecvChannel,						  XEM_DMA_SG_INTR_MASK);			XDmaChannel_SetIntrEnable(&InstancePtr->SendChannel,						  XEM_DMA_SG_INTR_MASK);		} else {			if ((InstancePtr->FifoRecvHandler == StubFifoHandler) ||			    (InstancePtr->FifoSendHandler == StubFifoHandler)) {				return XST_NO_CALLBACK;			}			/* Enable IPIF interrupts (used by simple DMA also) */			XIIF_V123B_WRITE_DIER(InstancePtr->BaseAddress,					      XEM_IPIF_FIFO_DFT_MASK |					      XIIF_V123B_ERROR_MASK);			XIIF_V123B_WRITE_IIER(InstancePtr->BaseAddress,					      XEM_EIR_DFT_FIFO_MASK);		}		/* Enable the global IPIF interrupt output */		XIIF_V123B_GINTR_ENABLE(InstancePtr->BaseAddress);	}	/*	 * Indicate that the device is started before we enable the transmitter	 * or receiver. This needs to be done before because as soon as the	 * receiver is enabled we may get an interrupt, and there are functions	 * in the interrupt handling path that rely on the IsStarted flag.	 */	InstancePtr->IsStarted = XCOMPONENT_IS_STARTED;	/*	 * Enable the transmitter, and receiver (do a read/modify/write to preserve	 * current settings). There is no critical section here since this register	 * is not modified during interrupt context.	 */	ControlReg = XIo_In32(InstancePtr->BaseAddress + XEM_ECR_OFFSET);	ControlReg &= ~(XEM_ECR_XMIT_RESET_MASK | XEM_ECR_RECV_RESET_MASK);	ControlReg |= (XEM_ECR_XMIT_ENABLE_MASK | XEM_ECR_RECV_ENABLE_MASK);	XIo_Out32(InstancePtr->BaseAddress + XEM_ECR_OFFSET, ControlReg);	/*	 * If configured with scatter-gather DMA and not polled, restart the	 * DMA channels in case there are buffers ready to be sent or received into.	 * The DMA SgStart function uses data that can be modified during interrupt	 * context, so a critical section is required here.	 */	if ((XEmac_mIsSgDma(InstancePtr)) && (!InstancePtr->IsPolled)) {		XIIF_V123B_GINTR_DISABLE(InstancePtr->BaseAddress);		/*		 * The only error we care about is if the list has not yet been		 * created, or on receive, if no buffer descriptors have been		 * added yet (the list is empty). Other errors are benign at this point.		 */		Result = XDmaChannel_SgStart(&InstancePtr->RecvChannel);		if ((Result == XST_DMA_SG_NO_LIST)		    || (Result == XST_DMA_SG_LIST_EMPTY)) {			XIIF_V123B_GINTR_ENABLE(InstancePtr->BaseAddress);			return Result;		}		Result = XDmaChannel_SgStart(&InstancePtr->SendChannel);		if (Result == XST_DMA_SG_NO_LIST) {			XIIF_V123B_GINTR_ENABLE(InstancePtr->BaseAddress);			return Result;		}		XIIF_V123B_GINTR_ENABLE(InstancePtr->BaseAddress);	}	return XST_SUCCESS;}/*****************************************************************************//**** Stop the Ethernet MAC as follows:*   - If the device is configured with scatter-gather DMA, stop the DMA*     channels (wait for acknowledgment of stop)*   - Disable the transmitter and receiver*   - Disable interrupts if not in polled mode (the higher layer software is*     responsible for disabling interrupts at the interrupt controller)** The PHY is left enabled after a Stop is called.** If the device is configured for scatter-gather DMA, the DMA engine stops at* the next buffer descriptor in its list. The remaining descriptors in the list* are not removed, so anything in the list will be transmitted or received when* the device is restarted. The side effect of doing this is that the last* buffer descriptor processed by the DMA engine before stopping may not be the* last descriptor in the Ethernet frame. So when the device is restarted, a* partial frame (i.e., a bad frame) may be transmitted/received. This is only a* concern if a frame can span multiple buffer descriptors, which is dependent* on the size of the network buffers.** @param InstancePtr is a pointer to the XEmac instance to be worked on.** @return** - XST_SUCCESS if the device was stopped successfully* - XST_DEVICE_IS_STOPPED if the device is already stopped** @note** This function makes use of internal resources that are shared between the* Start, Stop, and SetOptions functions. So if one task might be setting device* options while another is trying to start the device, the user is required to* provide protection of this shared data (typically using a semaphore).*******************************************************************************/XStatusXEmac_Stop(XEmac * InstancePtr){	u32 ControlReg;	XASSERT_NONVOID(InstancePtr != NULL);	XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);	/*	 * If the device is already stopped, do nothing but return a status	 * indicating so

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲另类在线制服丝袜| 久久综合九色综合97_久久久| 成人午夜私人影院| 在线观看国产日韩| 久久久久久久久久久久久夜| 亚洲欧美视频在线观看| 麻豆成人av在线| 色婷婷国产精品久久包臀| 欧美一卡2卡3卡4卡| 亚洲欧美国产毛片在线| 91麻豆精品在线观看| 欧美videos大乳护士334| 亚洲综合一区在线| aaa亚洲精品| 欧美国产激情一区二区三区蜜月| 日产国产欧美视频一区精品| 99久久伊人久久99| 91精品国产免费| 精品一区二区av| 日韩视频一区在线观看| 亚洲一区二区三区视频在线| 欧美日本一道本在线视频| 亚洲欧美日韩国产成人精品影院| 欧美色欧美亚洲另类二区| 国产精品国产三级国产aⅴ中文 | 麻豆成人免费电影| 久久蜜桃一区二区| 色域天天综合网| 麻豆91在线观看| 中文字幕亚洲在| 成人激情文学综合网| 精品国产精品网麻豆系列| 日本欧美一区二区| 国产欧美精品一区二区色综合朱莉| 久久精品99久久久| 26uuu亚洲综合色| 91在线观看美女| 久久精品99久久久| 一区二区三区色| 欧美日韩中字一区| 国产精品69久久久久水密桃| 精品噜噜噜噜久久久久久久久试看| 成人黄动漫网站免费app| 亚洲风情在线资源站| 91精品在线观看入口| 日韩av中文字幕一区二区 | 国产91精品在线观看| 久久亚洲精华国产精华液| 91在线porny国产在线看| 日韩国产精品久久久| 18欧美乱大交hd1984| 国产精品狼人久久影院观看方式| 日韩欧美一级特黄在线播放| 毛片av中文字幕一区二区| 亚洲视频一区二区在线| 欧美日韩亚洲综合| 成人免费视频国产在线观看| 日本中文字幕不卡| 亚洲国产精品久久久久婷婷884| 国产日韩欧美高清| 精品国产一区二区三区久久影院 | 麻豆91免费看| 亚洲综合色自拍一区| 国产精品久99| 国产欧美一区二区精品性色 | 国产一区欧美二区| 中文字幕一区二区不卡| 久久这里只有精品首页| 91精品在线麻豆| 欧美日韩国产免费一区二区| 色香蕉久久蜜桃| 一本久久综合亚洲鲁鲁五月天| 国产精品一区二区黑丝| 韩国女主播成人在线观看| 国产日韩一级二级三级| 欧美大片在线观看一区二区| 欧美日韩精品系列| 欧美老年两性高潮| 国产成人精品aa毛片| 天天综合网天天综合色| 国产视频一区二区在线观看| 91福利国产精品| 国产一区二区三区| 国内精品嫩模私拍在线| 蜜臀av国产精品久久久久| 免费看日韩精品| 亚洲综合在线五月| 亚洲综合在线视频| 日韩国产精品91| 久久97超碰色| 国产91露脸合集magnet| 91香蕉视频在线| 欧美日韩精品一区二区三区四区| 欧美人xxxx| 日韩亚洲欧美综合| 久久久精品tv| 中文字幕一区二区三| 一区二区三区中文字幕在线观看| 亚洲一区二区三区三| 日本亚洲一区二区| 国产精品伊人色| 在线看一区二区| 日韩欧美精品在线视频| 国产亚洲欧美一级| 一区二区三区四区五区视频在线观看| 天堂av在线一区| 亚洲综合色区另类av| 日韩国产欧美在线视频| 国产乱理伦片在线观看夜一区| av中文字幕不卡| 欧美色老头old∨ideo| 日韩视频在线你懂得| 欧美国产日韩一二三区| 亚洲综合激情另类小说区| 琪琪久久久久日韩精品| 懂色av一区二区三区蜜臀 | 欧美日韩在线免费视频| 日韩欧美国产系列| 综合久久久久综合| 秋霞电影一区二区| 成人av资源网站| 正在播放亚洲一区| 国产精品灌醉下药二区| 日韩二区三区四区| 99re热视频精品| 欧美tk—视频vk| 一区二区三区四区av| 国产高清精品在线| 51精品秘密在线观看| 日本一区二区不卡视频| 日韩一区精品字幕| 色综合 综合色| 国产女人18水真多18精品一级做| 亚洲成人三级小说| 日韩国产欧美一区二区三区| av电影在线不卡| 久久久久久久久一| 日韩国产欧美在线播放| 色欧美88888久久久久久影院| 久久综合资源网| 天天色天天操综合| 一本到不卡免费一区二区| 久久亚洲一区二区三区明星换脸| 亚洲国产毛片aaaaa无费看| 风间由美中文字幕在线看视频国产欧美 | 蜜臂av日日欢夜夜爽一区| 91在线观看下载| 国产拍欧美日韩视频二区| 免费看日韩精品| 91精品国产综合久久蜜臀| 亚洲精品成人在线| 99视频一区二区| 国产精品视频一区二区三区不卡| 一二三区精品福利视频| 国产丶欧美丶日本不卡视频| 欧美一区二区三区啪啪| 亚洲不卡一区二区三区| 一本大道综合伊人精品热热| 国产精品久久久久久久久免费相片 | 欧美日韩日日夜夜| 亚洲免费伊人电影| 95精品视频在线| 国产精品不卡一区二区三区| 国产大片一区二区| 国产午夜精品久久久久久免费视| 精品一区二区三区在线播放| 欧美一区二区三区免费视频| 亚洲一区二三区| 欧美在线视频你懂得| 亚洲乱码中文字幕| 91福利国产成人精品照片| 一区二区三区精品在线| 日本道在线观看一区二区| 亚洲精品视频在线看| 一本到不卡免费一区二区| 亚洲一区二区三区中文字幕 | 日韩经典一区二区| 欧美一级黄色录像| 国产在线一区二区| 国产三级精品视频| aaa亚洲精品| 亚洲国产一区二区三区青草影视 | 日韩精品中午字幕| 国产在线播放一区二区三区| 久久综合999| 波多野结衣一区二区三区| 亚洲欧美综合在线精品| 91久久一区二区| 日韩经典中文字幕一区| 精品福利一区二区三区免费视频| 国产高清视频一区| 一区二区三区在线视频播放| 欧美日韩精品欧美日韩精品一 | 精品乱人伦小说| 成人短视频下载| 天天综合网天天综合色| 欧美成人a在线| 99精品久久免费看蜜臀剧情介绍| 亚洲一区二区在线免费看| 欧美一区二区三区爱爱|