📄 if_cs.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/if_cs.html - generated by refgen from if_cs.c --> <title> if_cs </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_cs</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>if_cs</strong> - Crystal Semiconductor CS8900 network interface driver </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> - publish the <b>cs</b> network interface and initialize the driver.<br><b><i><a href="./if_cs.html#csShow">csShow</a></i>( )</b> - shows statistics for the <b>cs</b> network interface<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p><p>This module implements a driver for a Crystal Semiconductor CS8900 Ethernetcontroller chip.<p>The CS8900 is a single chip Ethernet controller with a direct ISA businterface which can operate in either memory space or I/O space. It alsosupports a direct interface to a host DMA controller to transfer receiveframes to host memory. The device has a 4K RAM which is used for transmit,and receive buffers; a serial EEPROM interface; and both 10BASE-T/AUI portsupport.<p>This driver is capable of supporting both memory mode and I/O mode operationsof the chip. When configured for memory mode, the intenal RAM of the chip ismapped to a contiguous 4K address block, providing the CPU direct access tothe internal registers and frame buffers. When configured for I/O mode, theinternal registers are accessible through eight contiguous, 16-bit I/O ports.The driver also supports an interface to an EEPROM containing deviceconfiguration.<p>While the DMA slave mode is supported by the device for receive frametransfers, this driver does not enable DMA.<p>This network interface driver does not support output hook routines,because to do so requires that an image of the transmit packet be built inmemory before the image is copied to the CS8900 chip. It is much moreefficient to copy the image directly from the mbuf chain to the CS8900 chip.However, this network interface driver does support input hook routines.<p></blockquote><h4>CONFIGURATION</h4><blockquote><p>The defined I/O address and IRQ in <b>config.h</b> must match the one storedin EEPROM by the vendor's DOS utility program.<p>The I/O Address parameter is the only required <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> parameter. If theCS8900 chip has a EEPROM attached, then the I/O Address parameter, passed tothe <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> routine, must match the I/O address programmed into the EEPROM.If the CS8900 chip does not have a EEPROM attached, then the I/O Addressparameter must be 0x300.<p>The Interrupt Level parameter must have one of the following values:<br> 0 - Get interrupt level from EEPROM<br> 5 - IRQ 5<br> 10 - IRQ 10<br> 11 - IRQ 11<br> 12 - IRQ 12<p>If the Interrupt Vector parameter is zero, then the network interface driverderives the interrupt vector from the interrupt level if possible. It ispossible to derive the interrupt vector in an IBM PC compatible system. Thisparameter is present for systems which are not IBM PC compatible.<p>The Memory Address parameter specifies the base address of the CS8900 chip'smemory buffer (PacketPage). If the Memory Address parameter is not zero, thenthe CS8900 chip operates in memory mode at the specified address. If theMemory Address parameter is zero, then the CS8900 chip operates in the modespecified by the EEPROM or the Configuration Flags parameter.<p>The Media Type parameter must have one of the following values:<pre> 0 - Get media type from EEPROM 1 - AUI (Thick Cable) 2 - BNC 10Base2 (Thin Cable) 3 - RJ45 10BaseT (Twisted Pair)</pre>The Configuration Flags parameter is usually passed to the <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> routineas zero and the Configuration Flags information is retrieved from the EEPROM.The bits in the Configuration Flags parameter are usually specified by ahardware engineer and not by the end user. However, if the CS8900 chip doesnot have a EEPROM attached, then this information must be passed as a parameterto the <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> routine. The Configuration Flags are:<pre> 0x8000 - CS_CFGFLG_NOT_EEPROM Don't get Config. Flags from the EEPROM 0x0001 - CS_CFGFLG_MEM_MODE Use memory mode to access the chip 0x0002 - CS_CFGFLG_USE_SA Use system addr to qualify MEMCS16 signal 0x0004 - CS_CFGFLG_IOCHRDY Use IO Channel Ready signal to slow access 0x0008 - CS_CFGFLG_DCDC_POL The DC/DC conv. enable pin is active high 0x0010 - CS_CFGFLG_FDX 10BaseT is full duplex</pre>If configuration flag information is passed to the <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> routine, then the<b>CS_CFGFLG_NOT_EEPROM</b> flag should be set. This ensures that the ConfigurationFlags parameter is not zero, even if all specified flags are zero.<p>If the Memory Address parameter is not zero and the Configuration Flagsparameter is zero, then the CS8900 network interface driver implicitly setsthe <b>CS_CFGFLG_MEM_MODE</b> flag and the CS8900 chip operates in memory mode.However, if the Configuration Flags parameter is not zero, then the CS8900chip operates in memory mode only if the <b>CS_CFGFLG_MEM_MODE</b> flag is explicitlyset. If the Configuration Flags parameter in not zero and the<b>CS_CFGFLG_MEM_MODE</b> flag is not set, then the CS8900 chip operates in I/O mode.<p>The Ethernet Address parameter is usually passed to the <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> routine aszero and the Ethernet address is retrieved from the EEPROM. The Ethernetaddress (also called hardware address and individual address) is usuallysupplied by the adapter manufacturer and is stored in the EEPROM. However, ifthe CS8900 chip does not have a EEPROM attached, then the Ethernet address mustbe passed as a parameter to the <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> routine.The Ethernet Address parameter, passed to the <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b> routine, contains theaddress of a NULL terminated string. The string consists of 6 hexadecimalnumbers separated by colon characters. Each hexadecimal number is in the range00 - FF. An example of this string is:<pre> "00:24:20:10:FF:2A"</pre></blockquote><h4>BOARD LAYOUT</h4><blockquote><p>This device is soft-configured. No jumpering diagram is required.<p></blockquote><h4>EXTERNAL INTERFACE</h4><blockquote><p>The only user-callable routines are <b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b>:<dl><dt><b><i><a href="./if_cs.html#csAttach">csAttach</a></i>( )</b><dd>publishes the <b>cs</b> interface and initializes the driver and device. </dl><p>The network interface driver includes a show routine, called <b><i><a href="./if_cs.html#csShow">csShow</a></i>( )</b>, whichdisplays driver configuration and statistics information. To invoke the showroutine, type at the shell prompt:<pre> -> csShow</pre>To reset the statistics to zero, type at the shell prompt:<pre> -> csShow 0, 1</pre>Another routine that you may find useful is:<pre> -> ifShow "cs0"</pre></blockquote><h4>EXTERNAL ROUTINES</h4><blockquote><p><p>For debugging purposes, this driver calls <b><i><a href="./logLib.html#logMsg">logMsg</a></i>( )</b> to print error and debugginginformation. This will cause the <b><a href="./logLib.html#top">logLib</a></b> library to be linked with any imagecontaining this driver.<p>This driver needs the following macros defined for proper execution. Eachhas a default definition that assumes a PC386/PC486 system and BSP.<p>The macro <b>CS_IN_BYTE</b>(reg,pAddr) reads one byte from the I/O address <b>reg</b>,placing the result at address <b>pAddr</b>. There is no status result from thisoperation, we assume the operation completes normally, or a bus exceptionwill occur. By default, this macro assumes there is a BSP routine <b><i><a href="../bsp/evb403/sysLib.html#sysInByte" >sysInByte</a></i>( )</b>to perform the I/O operation.<p>The macro <b>CS_IN_WORD</b>(reg,pAddr) read a short word (2 bytes) from the I/Oaddress <b>reg</b>, storing the result at address <b>pAddr</b>. We assume thiscompletes normally, or causes a bus exception. The default declarationassumes a BSP routine <b><i>sysInWord</i>( )</b> to perform the operation.<p>The macro <b>CS_OUT_WORD</b>(reg,data) writes a short word value <b>data</b> at theI/O address <b>reg</b>. The default declaration assumes a BSP routine <b><i>sysOutWord</i>( )</b>.<p>The macro <b>CS_INT_ENABLE</b>(level, pResult) is used to enable the interruptlevel passed as an argument to csAttach. The default definition call theBSP routine sysIntEnablePIC(level). The STATUS return value from the actual routine is stored at <b>pResult</b> for the driver to examine.<p>The macro <b>CS_INT_CONNECT</b>(ivec,rtn,arg,pResult) macro is used to connectthe driver interrupt routine to the vector provided as an argument to csAttach (after translaction by <b>INUM_TO_IVEC</b>). The default definitioncalls the cpu architecture routine <b><i><a href="./intArchLib.html#intConnect">intConnect</a></i>( )</b>.<p>The macro <b>CS_IRQ0_VECTOR</b>(pAddr) is used to fetch the base vector for theinterrupt level mechanism. If the int vector argument to csAttach is zero,then the driver will compute a vector number by adding the interrupt levelto the value returned by this macro. If the user supplies a non-zerointerrupt vector number, then this macro is not used. The default definitionof this macro fetches the base vector number from a global valuecalled <b>sysVectorIRQ0</b>.<p>The macro <b>CS_MSEC_DELAY</b>(msec) is used to delay execution for a specifiednumber of milliseconds. The default definition uses taskDelay to suspendtask for some number of clock ticks. The resolution of the system clockis usually around 16 milliseconds (msecs), which is fairly coarse.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_cs.html#top">if_cs</a></b><hr><a name="csAttach"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>csAttach</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>csAttach</i>( )</strong> - publish the <b>cs</b> network interface and initialize the driver.</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS csAttach ( int unit, /* unit number */ int ioAddr, /* base IO address */ int intVector, /* interrupt vector, or zero */ int intLevel, /* interrupt level */ int memAddr, /* base memory address */ int mediaType, /* 0: Autodetect 1: AUI 2: BNC 3: RJ45 */ int configFlags, /* configuration flag */ char * pEnetAddr /* ethernet address */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is a major entry point to this network interface driver and iscalled only once per operating system reboot by the operating system startupcode. This routine is called before the <b><i>csInit</i>( )</b> routine.<p>This routine takes passed-in configuration parameters and parameters fromthe EEPROM and fills in the instance global variables in the cs_softcstructure. These variables are later used by the <b><i>csChipInit</i>( )</b> routine.<p>This routine connects the interrupt handler, <b><i>csIntr</i>( )</b>, to the specifiedinterrupt vector, initializes the 8259 PIC and resets the CS8900 chip.<p>Finally, this routine calls the <b><i>ether_attach</i>( )</b> routine, to fill in the ifnetstructure and attach this network interface driver to the system. Thedriver's main entry points (<b><i>csInit</i>( )</b>, <b><i>csIoctl</i>( )</b>, <b><i>csOutput</i>( )</b>, <b><i>csReset</i>( )</b>) aremade visable to the protocol stack.<p>Refer to "man if_cs" for detailed description of the configuration flags.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_cs.html#top">if_cs</a></b><hr><a name="csShow"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>csShow</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>csShow</i>( )</strong> - shows statistics for the <b>cs</b> network interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void csShow ( int unit, /* interface unit */ BOOL zap /* zero totals */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine displays statistics about the <b>cs</b> Ethernet network interface.It has two parameters:<dl><dt><i>unit</i><dd>interface unit; should be 0.<p><dt><i>zap</i><dd> if 1, all collected statistics are cleared to zero. </dl><p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_cs.html#top">if_cs</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -