1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter 3. Using the Z85230 driver</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Z8530 Programming Guide"><link rel="up" href="index.html" title="Z8530 Programming Guide"><link rel="prev" href="Driver_Modes.html" title="Chapter 2. Driver Modes"><link rel="next" href="Attaching_Network_Interfaces.html" title="Chapter 4. Attaching Network Interfaces"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Using the Z85230 driver</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="Driver_Modes.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="Attaching_Network_Interfaces.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="Using_the_Z85230_driver"></a>Chapter 3. Using the Z85230 driver</h1></div></div></div><p> 2 The Z85230 driver provides the back end interface to your board. To 3 configure a Z8530 interface you need to detect the board and to 4 identify its ports and interrupt resources. It is also your problem 5 to verify the resources are available. 6 </p><p> 7 Having identified the chip you need to fill in a struct z8530_dev, 8 which describes each chip. This object must exist until you finally 9 shutdown the board. Firstly zero the active field. This ensures 10 nothing goes off without you intending it. The irq field should 11 be set to the interrupt number of the chip. (Each chip has a single 12 interrupt source rather than each channel). You are responsible 13 for allocating the interrupt line. The interrupt handler should be 14 set to <code class="function">z8530_interrupt</code>. The device id should 15 be set to the z8530_dev structure pointer. Whether the interrupt can 16 be shared or not is board dependent, and up to you to initialise. 17 </p><p> 18 The structure holds two channel structures. 19 Initialise chanA.ctrlio and chanA.dataio with the address of the 20 control and data ports. You can or this with Z8530_PORT_SLEEP to 21 indicate your interface needs the 5uS delay for chip settling done 22 in software. The PORT_SLEEP option is architecture specific. Other 23 flags may become available on future platforms, eg for MMIO. 24 Initialise the chanA.irqs to &z8530_nop to start the chip up 25 as disabled and discarding interrupt events. This ensures that 26 stray interrupts will be mopped up and not hang the bus. Set 27 chanA.dev to point to the device structure itself. The 28 private and name field you may use as you wish. The private field 29 is unused by the Z85230 layer. The name is used for error reporting 30 and it may thus make sense to make it match the network name. 31 </p><p> 32 Repeat the same operation with the B channel if your chip has 33 both channels wired to something useful. This isn't always the 34 case. If it is not wired then the I/O values do not matter, but 35 you must initialise chanB.dev. 36 </p><p> 37 If your board has DMA facilities then initialise the txdma and 38 rxdma fields for the relevant channels. You must also allocate the 39 ISA DMA channels and do any necessary board level initialisation 40 to configure them. The low level driver will do the Z8530 and 41 DMA controller programming but not board specific magic. 42 </p><p> 43 Having initialised the device you can then call 44 <code class="function">z8530_init</code>. This will probe the chip and 45 reset it into a known state. An identification sequence is then 46 run to identify the chip type. If the checks fail to pass the 47 function returns a non zero error code. Typically this indicates 48 that the port given is not valid. After this call the 49 type field of the z8530_dev structure is initialised to either 50 Z8530, Z85C30 or Z85230 according to the chip found. 51 </p><p> 52 Once you have called z8530_init you can also make use of the utility 53 function <code class="function">z8530_describe</code>. This provides a 54 consistent reporting format for the Z8530 devices, and allows all 55 the drivers to provide consistent reporting. 56 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="Driver_Modes.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="Attaching_Network_Interfaces.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Driver Modes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Attaching Network Interfaces</td></tr></table></div></body></html> 57