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

📄 if_cpm.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 2 页
字号:
This routine is expected to clear the interrupt for the Ethernet interfacespecified by <i>unit</i>.<p><dt>STATUS sysCpmEnetAddrGet (int unit, UINT8 * addr)<dd>The driver expects this routine to provide the 6-byte Ethernethardware address that will be used by <i>unit</i>.  This routine must copythe 6-byte address to the space provided by <i>addr</i>.  This routine isexpected to return OK on success, or ERROR.The driver calls this routine, once per unit, from the <b><i>cpmInit</i>(&nbsp;)</b> routine. </dl><p></blockquote><h4>SYSTEM RESOURCE USAGE</h4><blockquote><p>This driver requires the following system resources:<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;0&nbsp;bytes&nbsp;in&nbsp;the&nbsp;initialized&nbsp;data&nbsp;section&nbsp;(data)<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;1272&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 and may varyfor other architectures.  The code size (text) varies greatly betweenarchitectures, and is therefore not quoted here.<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 operate only 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_cpm.html#top">if_cpm</a></b>, <b><a href="./ifLib.html#top">ifLib</a></b>,  <i>Motorola MC68EN360 User's Manual </i>,  <i>Motorola MPC860 User's Manual </i>,  <i>Motorola MPC821 User's Manual </i><p><hr><a name="cpmattach"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>cpmattach</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>cpmattach</i>(&nbsp;)</strong> - publish the <b>cpm</b> network interface and initialize the driver</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS cpmattach    (    int           unit,     /* unit number */    SCC *         pScc,     /* address of SCC parameter RAM */    SCC_REG *     pSccReg,  /* address of SCC registers */    VOIDFUNCPTR * ivec,     /* interrupt vector offset */    SCC_BUF *     txBdBase, /* transmit buffer descriptor base address */    SCC_BUF *     rxBdBase, /* receive buffer descriptor base address */    int           txBdNum,  /* number of transmit buffer descriptors */    int           rxBdNum,  /* number of receive buffer descriptors */    UINT8 *       bufBase   /* address of memory pool; NONE = malloc it */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>The routine publishes the <b>cpm</b> interface by filling in a network InterfaceData Record (IDR) and adding this record to the system's interface list.<p>The SCC shares a region of memory with the driver.  The caller of thisroutine can specify the address of a shared, non-cacheable memory regionwith <i>bufBase</i>.  If this parameter is NONE, the driver obtains thismemory region by calling <b><i><a href="./cacheLib.html#cacheDmaMalloc">cacheDmaMalloc</a></i>(&nbsp;)</b>.  Non-cacheable memory spaceis important for cases where the SCC is operating with a processorthat has a data cache.<p>Once non-cacheable memory is obtained, this routine divides up thememory between the various buffer descriptors (BDs).  The numberof BDs can be specified by <i>txBdNum</i> and <i>rxBdNum</i>, or if NULL, adefault value of 32 BDs will be used.  Additional buffers arereserved as receive loaner buffers.  The number of loaner buffers is thelesser of <i>rxBdNum</i> and a default value of 16.<p>The user must specify the location of the transmit and receive BDs inthe CPU's dual-ported RAM.  <i>txBdBase</i> and <i>rxBdBase</i> give thebase address of the BD rings.  Each BD uses 8 bytes. Care must be taken sothat the specified locations for Ethernet BDs do not conflict with otherdual-ported RAM structures. <p>Up to four individual device units are supported by this driver.  Deviceunits may reside on different processor chips, or may be on different SCCswithin a single CPU.<p>Before this routine returns, it calls <b><i>cpmReset</i>(&nbsp;)</b> and <b><i>cpmInit</i>(&nbsp;)</b> to configure the Ethernet controller, and connects the interrupt vector <i>ivec</i>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_cpm.html#top">if_cpm</a></b>, <b><a href="./ifLib.html#top">ifLib</a></b>,  <i>Motorola MC68360 User's Manual </i>,  <i>Motorola MPC821 and MPC860 User's Manual </i><hr><a name="cpmStartOutput"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>cpmStartOutput</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>cpmStartOutput</i>(&nbsp;)</strong> - output packet to network interface device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>#ifdef BSD43_DRIVER LOCAL void cpmStartOutput    (    int unit /* unit number */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p><b><i><a href="./if_cpm.html#cpmStartOutput">cpmStartOutput</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 from several possible threads.  Each one will bedescribed below.<p>The first, and most common thread, is when a user task requests thetransmission of data. Under BSD 4.3, this will cause <b><i>cpmOutput</i>(&nbsp;)</b> to becalled, which calls <b><i>ether_output</i>(&nbsp;)</b>, which usually calls this routine. This routine will not be called if <b><i>ether_output</i>(&nbsp;)</b> finds that our interfaceoutput queue is full. In this very rare case, the outgoing data will be thrown out. BSD 4.4 uses a slightly different model in which the generic<b><i>ether_output</i>(&nbsp;)</b> routine is called directly, followed by a call to thisroutine.<p>The second thread is when a transmitter error occurs that causes aTXE event interrupt.  This happens for the following errors: transmitterunderrun, retry limit reached, late collision, and heartbeat error.The ISR sets the txStop flag to stop the transmitter until the errors areserviced. These events require a RESTART command of the transmitter, whichoccurs in the <b><i>cpmTxRestart</i>(&nbsp;)</b> routine.  After the transmitter is restarted,<b><i>cpmTxRestart</i>(&nbsp;)</b> does a netJobAdd of <b><i><a href="./if_cpm.html#cpmStartOutput">cpmStartOutput</a></i>(&nbsp;)</b> to send any packetsleft in the interface output queue.  Thus, the second thread executesin the context of <b><i><a href="./netLib.html#netTask">netTask</a></i>(&nbsp;)</b>.<p>The third, and most unlikely, thread occurs when this routine is executingand it runs out of free Tx BDs.  In this case, this routine turns ontransmit interrupt and exits.  When the next BD is actually sent, an interruptoccurs.  The ISR does a netJobAdd of <b><i><a href="./if_cpm.html#cpmStartOutput">cpmStartOutput</a></i>(&nbsp;)</b> to continue sendingpackets left in the interface output queue.  Once again, we find ourselvesexecuting in the context of <b><i><a href="./netLib.html#netTask">netTask</a></i>(&nbsp;)</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_cpm.html#top">if_cpm</a></b></body></html>

⌨️ 快捷键说明

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