1 /******************************************************************************
3 * Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /****************************************************************************/
36 * @addtogroup emacps_v2_0
40 * The Xilinx Embedded Processor Block Ethernet driver.
42 * For a full description of XEMACPS features, please see the hardware spec.
43 * This driver supports the following features:
44 * - Memory mapped access to host interface registers
45 * - Statistics counter registers for RMON/MIB
46 * - API for interrupt driven frame transfers for hardware configured DMA
47 * - Virtual memory support
48 * - Unicast, broadcast, and multicast receive address filtering
49 * - Full and half duplex operation
50 * - Automatic PAD & FCS insertion and stripping
52 * - Support up to four 48bit addresses
53 * - Address checking for four specific 48bit addresses
54 * - VLAN frame support
55 * - Pause frame support
56 * - Large frame support up to 1536 bytes
59 * <b>Driver Description</b>
61 * The device driver enables higher layer software (e.g., an application) to
62 * communicate to the XEmacPs. The driver handles transmission and reception
63 * of Ethernet frames, as well as configuration and control. No pre or post
64 * processing of frame data is performed. The driver does not validate the
65 * contents of an incoming frame in addition to what has already occurred in
67 * A single device driver can support multiple devices even when those devices
68 * have significantly different configurations.
70 * <b>Initialization & Configuration</b>
72 * The XEmacPs_Config structure is used by the driver to configure itself.
73 * This configuration structure is typically created by the tool-chain based
74 * on hardware build properties.
76 * The driver instance can be initialized in
78 * - XEmacPs_CfgInitialize(InstancePtr, CfgPtr, EffectiveAddress): Uses a
79 * configuration structure provided by the caller. If running in a system
80 * with address translation, the provided virtual memory base address
81 * replaces the physical address present in the configuration structure.
83 * The device supports DMA only as current development plan. No FIFO mode is
84 * supported. The driver expects to start the DMA channels and expects that
85 * the user has set up the buffer descriptor lists.
87 * <b>Interrupts and Asynchronous Callbacks</b>
89 * The driver has no dependencies on the interrupt controller. When an
90 * interrupt occurs, the handler will perform a small amount of
91 * housekeeping work, determine the source of the interrupt, and call the
92 * appropriate callback function. All callbacks are registered by the user
95 * <b>Virtual Memory</b>
97 * All virtual to physical memory mappings must occur prior to accessing the
100 * For DMA transactions, user buffers supplied to the driver must be in terms
101 * of their physical address.
105 * The DMA engine uses buffer descriptors (BDs) to describe Ethernet frames.
106 * These BDs are typically chained together into a list the hardware follows
107 * when transferring data in and out of the packet buffers. Each BD describes
108 * a memory region containing either a full or partial Ethernet packet.
110 * Interrupt coalescing is not suppoted from this built-in DMA engine.
112 * This API requires the user to understand how the DMA operates. The
113 * following paragraphs provide some explanation, but the user is encouraged
114 * to read documentation in xemacps_bdring.h as well as study example code
115 * that accompanies this driver.
117 * The API is designed to get BDs to and from the DMA engine in the most
118 * efficient means possible. The first step is to establish a memory region
119 * to contain all BDs for a specific channel. This is done with
120 * XEmacPs_BdRingCreate(). This function sets up a BD ring that hardware will
121 * follow as BDs are processed. The ring will consist of a user defined number
122 * of BDs which will all be partially initialized. For example on the transmit
123 * channel, the driver will initialize all BDs' so that they are configured
124 * for transmit. The more fields that can be permanently setup at
125 * initialization, then the fewer accesses will be needed to each BD while
126 * the DMA engine is in operation resulting in better throughput and CPU
127 * utilization. The best case initialization would require the user to set
128 * only a frame buffer address and length prior to submitting the BD to the
131 * BDs move through the engine with the help of functions
132 * XEmacPs_BdRingAlloc(), XEmacPs_BdRingToHw(), XEmacPs_BdRingFromHw(),
133 * and XEmacPs_BdRingFree().
134 * All these functions handle BDs that are in place. That is, there are no
135 * copies of BDs kept anywhere and any BD the user interacts with is an actual
136 * BD from the same ring hardware accesses.
138 * BDs in the ring go through a series of states as follows:
139 * 1. Idle. The driver controls BDs in this state.
140 * 2. The user has data to transfer. XEmacPs_BdRingAlloc() is called to
141 * reserve BD(s). Once allocated, the user may setup the BD(s) with
142 * frame buffer address, length, and other attributes. The user controls
144 * 3. The user submits BDs to the DMA engine with XEmacPs_BdRingToHw. BDs
145 * in this state are either waiting to be processed by hardware, are in
146 * process, or have been processed. The DMA engine controls BDs in this
148 * 4. Processed BDs are retrieved with XEmacEpv_BdRingFromHw() by the
149 * user. Once retrieved, the user can examine each BD for the outcome of
150 * the DMA transfer. The user controls BDs in this state. After examining
151 * the BDs the user calls XEmacPs_BdRingFree() which places the BDs back
154 * Each of the four BD accessor functions operate on a set of BDs. A set is
155 * defined as a segment of the BD ring consisting of one or more BDs. The user
156 * views the set as a pointer to the first BD along with the number of BDs for
157 * that set. The set can be navigated by using macros XEmacPs_BdNext(). The
158 * user must exercise extreme caution when changing BDs in a set as there is
159 * nothing to prevent doing a mBdNext past the end of the set and modifying a
162 * XEmacPs_BdRingAlloc() + XEmacPs_BdRingToHw(), as well as
163 * XEmacPs_BdRingFromHw() + XEmacPs_BdRingFree() are designed to be used in
164 * tandem. The same BD set retrieved with BdRingAlloc should be the same one
165 * provided to hardware with BdRingToHw. Same goes with BdRingFromHw and
168 * <b>Alignment & Data Cache Restrictions</b>
170 * Due to the design of the hardware, all RX buffers, BDs need to be 4-byte
171 * aligned. Please reference xemacps_bd.h for cache related macros.
175 * - If frame buffers exist in cached memory, then they must be flushed
176 * prior to committing them to hardware.
180 * - If frame buffers exist in cached memory, then the cache must be
181 * invalidated for the memory region containing the frame prior to data
184 * Both cache invalidate/flush are taken care of in driver code.
186 * <b>Buffer Copying</b>
188 * The driver is designed for a zero-copy buffer scheme. That is, the driver
189 * will not copy buffers. This avoids potential throughput bottlenecks within
190 * the driver. If byte copying is required, then the transfer will take longer
193 * <b>Checksum Offloading</b>
195 * The Embedded Processor Block Ethernet can be configured to perform IP, TCP
196 * and UDP checksum offloading in both receive and transmit directions.
198 * IP packets contain a 16-bit checksum field, which is the 16-bit 1s
199 * complement of the 1s complement sum of all 16-bit words in the header.
200 * TCP and UDP packets contain a 16-bit checksum field, which is the 16-bit
201 * 1s complement of the 1s complement sum of all 16-bit words in the header,
202 * the data and a conceptual pseudo header.
204 * To calculate these checksums in software requires each byte of the packet
205 * to be read. For TCP and UDP this can use a large amount of processing power.
206 * Offloading the checksum calculation to hardware can result in significant
207 * performance improvements.
209 * The transmit checksum offload is only available to use DMA in packet buffer
210 * mode. This is because the complete frame to be transmitted must be read
211 * into the packet buffer memory before the checksum can be calculated and
212 * written to the header at the beginning of the frame.
214 * For IP, TCP or UDP receive checksum offload to be useful, the operating
215 * system containing the protocol stack must be aware that this offload is
216 * available so that it can make use of the fact that the hardware has verified
219 * When receive checksum offloading is enabled in the hardware, the IP header
220 * checksum is checked, where the packet meets the following criteria:
222 * 1. If present, the VLAN header must be four octets long and the CFI bit
224 * 2. Encapsulation must be RFC 894 Ethernet Type Encoding or RFC 1042 SNAP
227 * 4. IP header is of a valid length.
228 * 5. Good IP header checksum.
229 * 6. No IP fragmentation.
230 * 7. TCP or UDP packet.
232 * When an IP, TCP or UDP frame is received, the receive buffer descriptor
233 * gives an indication if the hardware was able to verify the checksums.
234 * There is also an indication if the frame had SNAP encapsulation. These
235 * indication bits will replace the type ID match indication bits when the
236 * receive checksum offload is enabled.
238 * If any of the checksums are verified incorrect by the hardware, the packet
239 * is discarded and the appropriate statistics counter incremented.
241 * <b>PHY Interfaces</b>
243 * RGMII 1.3 is the only interface supported.
247 * Asserts are used within all Xilinx drivers to enforce constraints on
248 * parameters. Asserts can be turned off on a system-wide basis by defining,
249 * at compile time, the NDEBUG identifier. By default, asserts are turned on
250 * and it is recommended that users leave asserts on during development. For
251 * deployment use -DNDEBUG compiler switch to remove assert code.
255 * Xilinx drivers are typically composed of two parts, one is the driver
256 * and the other is the adapter. The driver is independent of OS and processor
257 * and is intended to be highly portable. The adapter is OS-specific and
258 * facilitates communication between the driver and an OS.
259 * This driver is intended to be RTOS and processor independent. Any needs for
260 * dynamic memory management, threads or thread mutual exclusion, or cache
261 * control must be satisfied bythe layer above this driver.
264 * MODIFICATION HISTORY:
266 * Ver Who Date Changes
267 * ----- ---- -------- -------------------------------------------------------
268 * 1.00a wsy 01/10/10 First release
269 * 1.00a asa 11/21/11 The function XEmacPs_BdRingFromHwTx in file
270 * xemacps_bdring.c is modified. Earlier it was checking for
271 * "BdLimit"(passed argument) number of BDs for finding out
272 * which BDs are successfully processed. Now one more check
273 * is added. It looks for BDs till the current BD pointer
274 * reaches HwTail. By doing this processing time is saved.
275 * 1.00a asa 01/24/12 The function XEmacPs_BdRingFromHwTx in file
276 * xemacps_bdring.c is modified. Now start of packet is
277 * searched for returning the number of BDs processed.
278 * 1.02a asa 11/05/12 Added a new API for deleting an entry from the HASH
279 * registers. Added a new API to set the bust length.
280 * Added some new hash-defines.
281 * 1.03a asa 01/23/12 Fix for CR #692702 which updates error handling for
282 * Rx errors. Under heavy Rx traffic, there will be a large
283 * number of errors related to receive buffer not available.
284 * Because of a HW bug (SI #692601), under such heavy errors,
285 * the Rx data path can become unresponsive. To reduce the
286 * probabilities for hitting this HW bug, the SW writes to
287 * bit 18 to flush a packet from Rx DPRAM immediately. The
288 * changes for it are done in the function
289 * XEmacPs_IntrHandler.
290 * 1.05a asa 09/23/13 Cache operations on BDs are not required and hence
291 * removed. It is expected that all BDs are allocated in
292 * from uncached area.
293 * 1.06a asa 11/02/13 Changed the value for XEMACPS_RXBUF_LEN_MASK from 0x3fff
294 * to 0x1fff. This fixes the CR#744902.
295 * Made changes in example file xemacps_example.h to fix compilation
296 * issues with iarcc compiler.
297 * 2.0 adk 10/12/13 Updated as per the New Tcl API's
300 ****************************************************************************/
302 #ifndef XEMACPS_H /* prevent circular inclusions */
303 #define XEMACPS_H /* by using protection macros */
309 /***************************** Include Files ********************************/
311 #include "xil_types.h"
312 #include "xil_assert.h"
314 #include "xemacps_hw.h"
315 #include "xemacps_bd.h"
316 #include "xemacps_bdring.h"
318 /************************** Constant Definitions ****************************/
323 #define XEMACPS_DEVICE_NAME "xemacps"
324 #define XEMACPS_DEVICE_DESC "Xilinx PS 10/100/1000 MAC"
327 /** @name Configuration options
329 * Device configuration options. See the XEmacPs_SetOptions(),
330 * XEmacPs_ClearOptions() and XEmacPs_GetOptions() for information on how to
333 * The default state of the options are noted and are what the device and
334 * driver will be set to after calling XEmacPs_Reset() or
335 * XEmacPs_Initialize().
340 #define XEMACPS_PROMISC_OPTION 0x00000001
341 /**< Accept all incoming packets.
342 * This option defaults to disabled (cleared) */
344 #define XEMACPS_FRAME1536_OPTION 0x00000002
345 /**< Frame larger than 1516 support for Tx & Rx.
346 * This option defaults to disabled (cleared) */
348 #define XEMACPS_VLAN_OPTION 0x00000004
349 /**< VLAN Rx & Tx frame support.
350 * This option defaults to disabled (cleared) */
352 #define XEMACPS_FLOW_CONTROL_OPTION 0x00000010
353 /**< Enable recognition of flow control frames on Rx
354 * This option defaults to enabled (set) */
356 #define XEMACPS_FCS_STRIP_OPTION 0x00000020
357 /**< Strip FCS and PAD from incoming frames. Note: PAD from VLAN frames is not
359 * This option defaults to enabled (set) */
361 #define XEMACPS_FCS_INSERT_OPTION 0x00000040
362 /**< Generate FCS field and add PAD automatically for outgoing frames.
363 * This option defaults to disabled (cleared) */
365 #define XEMACPS_LENTYPE_ERR_OPTION 0x00000080
366 /**< Enable Length/Type error checking for incoming frames. When this option is
367 * set, the MAC will filter frames that have a mismatched type/length field
368 * and if XEMACPS_REPORT_RXERR_OPTION is set, the user is notified when these
369 * types of frames are encountered. When this option is cleared, the MAC will
370 * allow these types of frames to be received.
372 * This option defaults to disabled (cleared) */
374 #define XEMACPS_TRANSMITTER_ENABLE_OPTION 0x00000100
375 /**< Enable the transmitter.
376 * This option defaults to enabled (set) */
378 #define XEMACPS_RECEIVER_ENABLE_OPTION 0x00000200
379 /**< Enable the receiver
380 * This option defaults to enabled (set) */
382 #define XEMACPS_BROADCAST_OPTION 0x00000400
383 /**< Allow reception of the broadcast address
384 * This option defaults to enabled (set) */
386 #define XEMACPS_MULTICAST_OPTION 0x00000800
387 /**< Allows reception of multicast addresses programmed into hash
388 * This option defaults to disabled (clear) */
390 #define XEMACPS_RX_CHKSUM_ENABLE_OPTION 0x00001000
391 /**< Enable the RX checksum offload
392 * This option defaults to enabled (set) */
394 #define XEMACPS_TX_CHKSUM_ENABLE_OPTION 0x00002000
395 /**< Enable the TX checksum offload
396 * This option defaults to enabled (set) */
399 #define XEMACPS_DEFAULT_OPTIONS \
400 (XEMACPS_FLOW_CONTROL_OPTION | \
401 XEMACPS_FCS_INSERT_OPTION | \
402 XEMACPS_FCS_STRIP_OPTION | \
403 XEMACPS_BROADCAST_OPTION | \
404 XEMACPS_LENTYPE_ERR_OPTION | \
405 XEMACPS_TRANSMITTER_ENABLE_OPTION | \
406 XEMACPS_RECEIVER_ENABLE_OPTION | \
407 XEMACPS_RX_CHKSUM_ENABLE_OPTION | \
408 XEMACPS_TX_CHKSUM_ENABLE_OPTION)
410 /**< Default options set when device is initialized or reset */
413 /** @name Callback identifiers
415 * These constants are used as parameters to XEmacPs_SetHandler()
418 #define XEMACPS_HANDLER_DMASEND 1
419 #define XEMACPS_HANDLER_DMARECV 2
420 #define XEMACPS_HANDLER_ERROR 3
423 /* Constants to determine the configuration of the hardware device. They are
424 * used to allow the driver to verify it can operate with the hardware.
426 #define XEMACPS_MDIO_DIV_DFT MDC_DIV_32 /**< Default MDIO clock divisor */
428 /* The next few constants help upper layers determine the size of memory
429 * pools used for Ethernet buffers and descriptor lists.
431 #define XEMACPS_MAC_ADDR_SIZE 6 /* size of Ethernet header */
433 #define XEMACPS_MTU 1500 /* max MTU size of Ethernet frame */
434 #define XEMACPS_HDR_SIZE 14 /* size of Ethernet header */
435 #define XEMACPS_HDR_VLAN_SIZE 18 /* size of Ethernet header with VLAN */
436 #define XEMACPS_TRL_SIZE 4 /* size of Ethernet trailer (FCS) */
437 #define XEMACPS_MAX_FRAME_SIZE (XEMACPS_MTU + XEMACPS_HDR_SIZE + \
439 #define XEMACPS_MAX_VLAN_FRAME_SIZE (XEMACPS_MTU + XEMACPS_HDR_SIZE + \
440 XEMACPS_HDR_VLAN_SIZE + XEMACPS_TRL_SIZE)
442 /* DMACR Bust length hash defines */
444 #define XEMACPS_SINGLE_BURST 1
445 #define XEMACPS_4BYTE_BURST 4
446 #define XEMACPS_8BYTE_BURST 8
447 #define XEMACPS_16BYTE_BURST 16
450 /**************************** Type Definitions ******************************/
451 /** @name Typedefs for callback functions
453 * These callbacks are invoked in interrupt context.
457 * Callback invoked when frame(s) have been sent or received in interrupt
458 * driven DMA mode. To set the send callback, invoke XEmacPs_SetHandler().
460 * @param CallBackRef is user data assigned when the callback was set.
463 * See xemacps_hw.h for bitmasks definitions and the device hardware spec for
464 * further information on their meaning.
467 typedef void (*XEmacPs_Handler) (void *CallBackRef);
470 * Callback when an asynchronous error occurs. To set this callback, invoke
471 * XEmacPs_SetHandler() with XEMACPS_HANDLER_ERROR in the HandlerType
474 * @param CallBackRef is user data assigned when the callback was set.
475 * @param Direction defines either receive or transmit error(s) has occurred.
476 * @param ErrorWord definition varies with Direction
479 typedef void (*XEmacPs_ErrHandler) (void *CallBackRef, u8 Direction,
485 * This typedef contains configuration information for a device.
488 u16 DeviceId; /**< Unique ID of device */
489 u32 BaseAddress;/**< Physical base address of IPIF registers */
494 * The XEmacPs driver instance data. The user is required to allocate a
495 * structure of this type for every XEmacPs device in the system. A pointer
496 * to a structure of this type is then passed to the driver API functions.
498 typedef struct XEmacPs {
499 XEmacPs_Config Config; /* Hardware configuration */
500 u32 IsStarted; /* Device is currently started */
501 u32 IsReady; /* Device is initialized and ready */
502 u32 Options; /* Current options word */
504 XEmacPs_BdRing TxBdRing; /* Transmit BD ring */
505 XEmacPs_BdRing RxBdRing; /* Receive BD ring */
507 XEmacPs_Handler SendHandler;
508 XEmacPs_Handler RecvHandler;
512 XEmacPs_ErrHandler ErrorHandler;
518 /***************** Macros (Inline Functions) Definitions ********************/
520 /****************************************************************************/
522 * Retrieve the Tx ring object. This object can be used in the various Ring
525 * @param InstancePtr is the DMA channel to operate on.
527 * @return TxBdRing attribute
531 * XEmacPs_BdRing XEmacPs_GetTxRing(XEmacPs *InstancePtr)
533 *****************************************************************************/
534 #define XEmacPs_GetTxRing(InstancePtr) ((InstancePtr)->TxBdRing)
536 /****************************************************************************/
538 * Retrieve the Rx ring object. This object can be used in the various Ring
541 * @param InstancePtr is the DMA channel to operate on.
543 * @return RxBdRing attribute
547 * XEmacPs_BdRing XEmacPs_GetRxRing(XEmacPs *InstancePtr)
549 *****************************************************************************/
550 #define XEmacPs_GetRxRing(InstancePtr) ((InstancePtr)->RxBdRing)
552 /****************************************************************************/
555 * Enable interrupts specified in <i>Mask</i>. The corresponding interrupt for
556 * each bit set to 1 in <i>Mask</i>, will be enabled.
558 * @param InstancePtr is a pointer to the instance to be worked on.
559 * @param Mask contains a bit mask of interrupts to enable. The mask can
560 * be formed using a set of bitwise or'd values.
563 * The state of the transmitter and receiver are not modified by this function.
565 * void XEmacPs_IntEnable(XEmacPs *InstancePtr, u32 Mask)
567 *****************************************************************************/
568 #define XEmacPs_IntEnable(InstancePtr, Mask) \
569 XEmacPs_WriteReg((InstancePtr)->Config.BaseAddress, \
570 XEMACPS_IER_OFFSET, \
571 (Mask & XEMACPS_IXR_ALL_MASK));
573 /****************************************************************************/
576 * Disable interrupts specified in <i>Mask</i>. The corresponding interrupt for
577 * each bit set to 1 in <i>Mask</i>, will be enabled.
579 * @param InstancePtr is a pointer to the instance to be worked on.
580 * @param Mask contains a bit mask of interrupts to disable. The mask can
581 * be formed using a set of bitwise or'd values.
584 * The state of the transmitter and receiver are not modified by this function.
586 * void XEmacPs_IntDisable(XEmacPs *InstancePtr, u32 Mask)
588 *****************************************************************************/
589 #define XEmacPs_IntDisable(InstancePtr, Mask) \
590 XEmacPs_WriteReg((InstancePtr)->Config.BaseAddress, \
591 XEMACPS_IDR_OFFSET, \
592 (Mask & XEMACPS_IXR_ALL_MASK));
594 /****************************************************************************/
597 * This macro triggers trasmit circuit to send data currently in TX buffer(s).
599 * @param InstancePtr is a pointer to the XEmacPs instance to be worked on.
605 * Signature: void XEmacPs_Transmit(XEmacPs *InstancePtr)
607 *****************************************************************************/
608 #define XEmacPs_Transmit(InstancePtr) \
609 XEmacPs_WriteReg(InstancePtr->Config.BaseAddress, \
610 XEMACPS_NWCTRL_OFFSET, \
611 (XEmacPs_ReadReg(InstancePtr->Config.BaseAddress, \
612 XEMACPS_NWCTRL_OFFSET) | XEMACPS_NWCTRL_STARTTX_MASK))
614 /****************************************************************************/
617 * This macro determines if the device is configured with checksum offloading
618 * on the receive channel
620 * @param InstancePtr is a pointer to the XEmacPs instance to be worked on.
624 * Boolean TRUE if the device is configured with checksum offloading, or
629 * Signature: u32 XEmacPs_IsRxCsum(XEmacPs *InstancePtr)
631 *****************************************************************************/
632 #define XEmacPs_IsRxCsum(InstancePtr) \
633 ((XEmacPs_ReadReg((InstancePtr)->Config.BaseAddress, \
634 XEMACPS_NWCFG_OFFSET) & XEMACPS_NWCFG_RXCHKSUMEN_MASK) \
637 /****************************************************************************/
640 * This macro determines if the device is configured with checksum offloading
641 * on the transmit channel
643 * @param InstancePtr is a pointer to the XEmacPs instance to be worked on.
647 * Boolean TRUE if the device is configured with checksum offloading, or
652 * Signature: u32 XEmacPs_IsTxCsum(XEmacPs *InstancePtr)
654 *****************************************************************************/
655 #define XEmacPs_IsTxCsum(InstancePtr) \
656 ((XEmacPs_ReadReg((InstancePtr)->Config.BaseAddress, \
657 XEMACPS_DMACR_OFFSET) & XEMACPS_DMACR_TCPCKSUM_MASK) \
660 /************************** Function Prototypes *****************************/
663 * Initialization functions in xemacps.c
665 int XEmacPs_CfgInitialize(XEmacPs *InstancePtr, XEmacPs_Config *CfgPtr,
666 u32 EffectiveAddress);
667 void XEmacPs_Start(XEmacPs *InstancePtr);
668 void XEmacPs_Stop(XEmacPs *InstancePtr);
669 void XEmacPs_Reset(XEmacPs *InstancePtr);
672 * Lookup configuration in xemacps_sinit.c
674 XEmacPs_Config *XEmacPs_LookupConfig(u16 DeviceId);
677 * Interrupt-related functions in xemacps_intr.c
678 * DMA only and FIFO is not supported. This DMA does not support coalescing.
680 int XEmacPs_SetHandler(XEmacPs *InstancePtr, u32 HandlerType,
681 void *FuncPtr, void *CallBackRef);
682 void XEmacPs_IntrHandler(void *InstancePtr);
685 * MAC configuration/control functions in XEmacPs_control.c
687 int XEmacPs_SetOptions(XEmacPs *InstancePtr, u32 Options);
688 int XEmacPs_ClearOptions(XEmacPs *InstancePtr, u32 Options);
689 u32 XEmacPs_GetOptions(XEmacPs *InstancePtr);
691 int XEmacPs_SetMacAddress(XEmacPs *InstancePtr, void *AddressPtr, u8 Index);
692 void XEmacPs_GetMacAddress(XEmacPs *InstancePtr, void *AddressPtr, u8 Index);
694 int XEmacPs_SetHash(XEmacPs *InstancePtr, void *AddressPtr);
695 void XEmacPs_ClearHash(XEmacPs *InstancePtr);
696 void XEmacPs_GetHash(XEmacPs *InstancePtr, void *AddressPtr);
698 void XEmacPs_SetMdioDivisor(XEmacPs *InstancePtr,
699 XEmacPs_MdcDiv Divisor);
700 void XEmacPs_SetOperatingSpeed(XEmacPs *InstancePtr, u16 Speed);
701 u16 XEmacPs_GetOperatingSpeed(XEmacPs *InstancePtr);
702 int XEmacPs_PhyRead(XEmacPs *InstancePtr, u32 PhyAddress,
703 u32 RegisterNum, u16 *PhyDataPtr);
704 int XEmacPs_PhyWrite(XEmacPs *InstancePtr, u32 PhyAddress,
705 u32 RegisterNum, u16 PhyData);
706 int XEmacPs_SetTypeIdCheck(XEmacPs *InstancePtr, u32 Id_Check, u8 Index);
708 int XEmacPs_SendPausePacket(XEmacPs *InstancePtr);
709 void XEmacPs_DMABLengthUpdate(XEmacPs *InstancePtr, int BLength);
715 #endif /* end of protection macro */