⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 if_mbc.html

📁 vxworks相关论文
💻 HTML
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/if_mbc.html - generated by refgen from if_mbc.c --> <title> if_mbc </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual :  Libraries</i></a></p></blockquote><h1>if_mbc</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>if_mbc</strong> - Motorola 68EN302 network-interface driver </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>  -  publish the <b>mbc</b> network interface and initialize the driver<br><b><i><a href="./if_mbc.html#mbcStartOutput">mbcStartOutput</a></i>(&nbsp;)</b>  -  output packet to network interface device<br><b><i><a href="./if_mbc.html#mbcIntr">mbcIntr</a></i>(&nbsp;)</b>  -  network interface interrupt handler<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This is a driver for the Ethernet controller on the 68EN302 chip.  The devicesupports a 16-bit interface, data rates up to 10 Mbps, a dual-ported RAM, andtransparent DMA.  The dual-ported RAM is used for a 64-entry CAM table, and a128-entry buffer descriptor table.  The CAM table is used to set the Ethernetaddress of the Ethernet device or to program multicast addresses.  The bufferdescriptor table is partitioned into fixed-size transmit and receive tables.The DMA operation is transparent and transfers data between the internal FIFOsand external buffers pointed to by the receive- and transmit-buffer descriptorsduring transmits and receives.<p>The driver currently supports one Ethernet module controller, but it can beextended to support multiple controllers when needed. An Ethernet moduleis initialized by calling <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>.<p>The driver supports buffer loaning for performance and input/output hookroutines.  It does not support multicast addresses.<p>The driver requires that the memory used for transmit and receive buffers beallocated in cache-safe RAM area.  <p>A glitch in the EN302 Rev 0.1 device causes the Ethernet transmitter tolock up from time to time. The driver uses a watchdog timer to reset theEthernet device when the device runs out of transmit buffers and cannotrecover within 20 clock ticks.<p></blockquote><h4>BOARD LAYOUT</h4><blockquote><p>This device is on-chip.  No jumpering diagram is necessary.  <p></blockquote><h4>EXTERNAL INTERFACE</h4><blockquote><p>This driver presents the standard WRS network driver API: first the deviceunit must be attached with the <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b> routine, then it must beinitialized with the <b><i>mbcInit</i>(&nbsp;)</b> routine.<p>The only user-callable routine is <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>, which publishes the <b>mbc</b>interface and initializes the driver structures.<p></blockquote><h4>TARGET-SPECIFIC PARAMETERS</h4><blockquote><p><dl><dt>Ethernet module base address<dd>This parameter is passed to the driver via <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>.<p>This parameter is the base address of the Ethernet module. The driveraddresses all other Ethernet device registers as offsets from this address.<p><dt>interrupt vector number<dd>This parameter is passed to the driver via <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>.<p>The driver configures the Ethernet device to use this parameter whilegenerating interrupt ack cycles.  The interrupt service routine <b><i><a href="./if_mbc.html#mbcIntr">mbcIntr</a></i>(&nbsp;)</b> isexpected to be attached to the corresponding interrupt vector externally,typically in <b><i><a href="../bsp/ads360/sysLib.html#sysHwInit2" >sysHwInit2</a></i>(&nbsp;)</b>.<p><dt>number of transmit and receive buffer descriptors<dd>These parameters are passed to the driver via <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>.<p>The number of transmit and receive buffer descriptors (BDs) used isconfigurable by the user while attaching the driver.  Each BD is 8 bytes insize and resides in the chip's dual-ported memory, while its associatedbuffer, 1520 bytes in size, resides in cache-safe conventional RAM. A minimumof 2 receive and 2 transmit BDs should be allocated.  If this parameter isNULL, a default of 32 BDs will be used.  The maximum number of BDs depends onhow the dual-ported BD RAM is partitioned.  The 128 BDs in the dual-ported BDRAM can partitioned into transmit and receive BD regions with 8, 16, 32, or 64transmit BDs and corresponding 120, 112, 96, or 64 receive BDs.<p><dt>Ethernet DMA parameters<dd>This parameter is passed  to the driver via <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>.<p>This parameter is used to specify the settings of burst limit, water-mark, andtransmit early, which control the Ethernet DMA, and is used to set the EDMAregister.<p><dt>base address of the buffer pool<dd>This parameter is passed to the driver via <b><i><a href="./if_mbc.html#mbcattach">mbcattach</a></i>(&nbsp;)</b>.<p>This parameter is used to notify the driver that space for the transmit andreceive buffers need not be allocated, but should be taken from acache-coherent private memory space provided by the user at the given address.The user should be aware that memory used for buffers must be 4-byte alignedand non-cacheable.  All the buffers must fit in the given memory space; nochecking will be performed.  This includes all transmit and receive buffers(see above) and an additional 16 receive loaner buffers, unless the number ofreceive BDs is less than 16, in which case that number of loaner buffers willbe used.  Each buffer is 1520 bytes.  If this parameter is "NONE", space forbuffers will be obtained by calling <b><i><a href="./cacheLib.html#cacheDmaMalloc">cacheDmaMalloc</a></i>(&nbsp;)</b> in <b><i><a href="./if_cpm.html#cpmattach">cpmattach</a></i>(&nbsp;)</b>.<p></dl><p><p></blockquote><h4>EXTERNAL SUPPORT REQUIREMENTS</h4><blockquote><p><p>The driver requires the following support functions:<p><dl><dt>STATUS sysEnetAddrGet (int unit, UINT8 * addr)<dd>The driver expects this routine to provide the six-byte Ethernet hardwareaddress that will be used by <i>unit</i>.  This routine must copy the six-byteaddress to the space provided by <i>addr</i>.  This routine is expected to returnOK on success, or ERROR.  The driver calls this routine, during deviceinitialization, from the <b><i>cpmInit</i>(&nbsp;)</b> routine. </dl><p></blockquote><h4>SYSTEM RESOURCE USAGE</h4><blockquote><p>The driver requires the following system resource:<p>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;one&nbsp;mutual&nbsp;exclusion&nbsp;semaphore<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;one&nbsp;interrupt&nbsp;vector<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;one&nbsp;watchdog&nbsp;timer<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;0&nbsp;bytes&nbsp;in&nbsp;the&nbsp;initialized&nbsp;data&nbsp;section&nbsp;(data)<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;296&nbsp;bytes&nbsp;in&nbsp;the&nbsp;uninitialized&nbsp;data&nbsp;section&nbsp;(bss)<p>The data and BSS sections are quoted for the CPU32 architecture.<p>If the driver allocates the memory shared with the Ethernet device unit,it does so by calling the <b><i><a href="./cacheLib.html#cacheDmaMalloc">cacheDmaMalloc</a></i>(&nbsp;)</b> routine.  For the default caseof 32 transmit buffers, 32 receive buffers, and 16 loaner buffers, the totalsize requested is 121,600 bytes.  If a non-cacheable memory region is providedby the user, the size of this region should be this amount, unless theuser has specified a different number of transmit or receive BDs.<p>This driver can only operate if the shared memory region is non-cacheable,or if the hardware implements bus snooping.  The driver cannot maintaincache coherency for the device because the buffers are asynchronouslymodified by both the driver and the device, and these fields may share thesame cache line.  Additionally, the chip's dual-ported RAM must bedeclared as non-cacheable memory where applicable.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_mbc.html#top">if_mbc</a></b>, <b><a href="./ifLib.html#top">ifLib</a></b>,  <i>Motorola MC68EN302 User's Manual </i>,  <i>Motorola MC68EN302 Device Errata, May 30, 1996 </i><hr><a name="mbcattach"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>mbcattach</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>mbcattach</i>(&nbsp;)</strong> - publish the <b>mbc</b> network interface and initialize the driver</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS mbcattach    (    int     unit,     /* unit number */    void *  pEmBase,  /* ethernet module base address */    int     inum,     /* interrupt vector number */    int     txBdNum,  /* number of transmit buffer descriptors */    int     rxBdNum,  /* number of receive buffer descriptors */    int     dmaParms, /* DMA parameters */    UINT8 * bufBase   /* address of memory pool; NONE = malloc it */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>The routine publishes the <b>mbc</b> interface by adding an <b>mbc</b> Interface DataRecord (IDR) to the global network interface list.<p>The Ethernet controller uses buffer descriptors from an on-chip dual-portedRAM region, while the buffers are allocated in RAM external to thecontroller. The buffer memory pool can be allocated in a non-cacheable RAMregion and passed as parameter <i>bufBase</i>.  Otherwise <i>bufBase</i> is NULL andthe buffer memory pool is allocated by the routine using <b><i><a href="./cacheLib.html#cacheDmaMalloc">cacheDmaMalloc</a></i>(&nbsp;)</b>.The driver uses this buffer pool to allocate the specified number of1518-byte buffers for transmit, receive, and loaner pools.<p>The parameters <i>txBdNum</i> and <i>rxBdNum</i> specify the number of buffersto allocate for transmit and receive. If either of these parametersis NULL, the default value of 2 is used. The number of loaner buffersallocated is the lesser of <i>rxBdNum</i> and 16.<p>The on-chip dual ported RAM can only be partitioned so that the maximumreceive and maximum transmit BDs are:<ul><li>  Transmit BDs:  8, Receive BDs: 120</li><li>  Transmit BDs: 16, Receive BDs: 112</li><li>  Transmit BDs: 32, Receive BDs:  96</li><li>   Transmit BDs: 64, Receive BDs:  64 </ul><p><p></blockquote><h4>RETURNS</h4><blockquote><p>ERROR, if <i>unit</i> is out of range> or non-cacheable memory cannot be allocated; otherwise TRUE.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_mbc.html#top">if_mbc</a></b>, <b><a href="./ifLib.html#top">ifLib</a></b>,  <i>Motorola MC68EN302 User's Manual </i><hr><a name="mbcStartOutput"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>mbcStartOutput</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>mbcStartOutput</i>(&nbsp;)</strong> - output packet to network interface device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>#ifdef BSD43_DRIVER LOCAL void mbcStartOutput    (    int unit /* unit number */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p><b><i><a href="./if_mbc.html#mbcStartOutput">mbcStartOutput</a></i>(&nbsp;)</b> takes a packet from the network interface output queue,copies the mbuf chain into an interface buffer, and sends the packet overthe interface.  etherOutputHookRtns are supported.<p>Collision stats are collected in this routine from previously sent BDs.These BDs will not be examined until after the transmitter has cycled thering, coming upon the BD after it has been sent. Thus, collision statcollection will be delayed a full cycle through the Tx ring.<p>This routine is called under several possible scenarios.  Each one will bedescribed below.<p>The first, and most common, is when a user task requests the transmission ofdata. Under BSD 4.3, this results in a call to <b><i>mbcOutput</i>(&nbsp;)</b>, which in turncalls <b><i>ether_output</i>(&nbsp;)</b>. The routine, <b><i>ether_output</i>(&nbsp;)</b>, will make a call to<b><i><a href="./if_mbc.html#mbcStartOutput">mbcStartOutput</a></i>(&nbsp;)</b> if our interface output queue is not full, otherwise, theoutgoing data is discarded. BSD 4.4 uses a slightly different model, inwhich the generic <b><i>ether_output</i>(&nbsp;)</b> routine is called directly, followed bya call to this routine.<p>The second scenario is when this routine, while executing runs out of freeTx BDs, turns on transmit interrupts and exits.  When the next BD istransmitted, an interrupt occurs and the ISR does a netJobAdd of the routinewhich executes in the context of <b><i><a href="./netLib.html#netTask">netTask</a></i>(&nbsp;)</b> and continues sending packetsfrom the interface output queue.  <p>The third scenario is when the device is reset, typically when the promiscuous mode is altered; which results in a call to <b><i>mbcInit</i>(&nbsp;)</b>.  This resets the device, does a <b><i>netJobAdd</i>(&nbsp;)</b> of this routine to enable transmitting queued packets.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_mbc.html#top">if_mbc</a></b><hr><a name="mbcIntr"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>mbcIntr</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>mbcIntr</i>(&nbsp;)</strong> - network interface interrupt handler</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void mbcIntr    (    int unit /* unit number */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is called at interrupt level. It handles work that requires minimal processing. Interrupt processing that is more extensive gets handled at task level. The network task, <b><i><a href="./netLib.html#netTask">netTask</a></i>(&nbsp;)</b>, is provided for this function. Routines get added to the <b><i><a href="./netLib.html#netTask">netTask</a></i>(&nbsp;)</b> work queue via the <b><i>netJobAdd</i>(&nbsp;)</b> command.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_mbc.html#top">if_mbc</a></b></body></html>

⌨️ 快捷键说明

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