<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>UbixOS V2: src/sys/isa/fdc.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.7 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="classes.html"><span>Data Structures</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label> <u>S</u>earch for </label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul></div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul></div> <div class="nav"> <a class="el" href="dir_897b6a2d7bab147dd1db58381aad3984.html">src</a> » <a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a> » <a class="el" href="dir_2f8fc94d4f17c865dd63167e45dee9cf.html">isa</a></div> <h1>fdc.c</h1><a href="fdc_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************************</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (c) 2002-2004 The UbixOS Project</span> <a name="l00003"></a>00003 <span class="comment"> All rights reserved.</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment"> Redistribution and use in source and binary forms, with or without modification, are</span> <a name="l00006"></a>00006 <span class="comment"> permitted provided that the following conditions are met:</span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment"> Redistributions of source code must retain the above copyright notice, this list of</span> <a name="l00009"></a>00009 <span class="comment"> conditions, the following disclaimer and the list of authors. Redistributions in binary</span> <a name="l00010"></a>00010 <span class="comment"> form must reproduce the above copyright notice, this list of conditions, the following</span> <a name="l00011"></a>00011 <span class="comment"> disclaimer and the list of authors in the documentation and/or other materials provided</span> <a name="l00012"></a>00012 <span class="comment"> with the distribution. Neither the name of the UbixOS Project nor the names of its</span> <a name="l00013"></a>00013 <span class="comment"> contributors may be used to endorse or promote products derived from this software</span> <a name="l00014"></a>00014 <span class="comment"> without specific prior written permission.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment"> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY</span> <a name="l00017"></a>00017 <span class="comment"> EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF</span> <a name="l00018"></a>00018 <span class="comment"> MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL</span> <a name="l00019"></a>00019 <span class="comment"> THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span> <a name="l00020"></a>00020 <span class="comment"> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT</span> <a name="l00021"></a>00021 <span class="comment"> OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> <a name="l00022"></a>00022 <span class="comment"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR</span> <a name="l00023"></a>00023 <span class="comment"> TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span> <a name="l00024"></a>00024 <span class="comment"> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment"> $Id: fdc_8c-source.html 88 2016-01-12 00:11:29Z reddawg $</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*****************************************************************************************/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include <<a class="code" href="fdc_8h.html">isa/fdc.h</a>></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <<a class="code" href="8259_8h.html">isa/8259.h</a>></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="video_8h.html">sys/video.h</a>></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="gdt_8h.html">sys/gdt.h</a>></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <<a class="code" href="idt_8h.html">sys/idt.h</a>></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="types_8h.html">ubixos/types.h</a>></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <<a class="code" href="spinlock_8h.html">ubixos/spinlock.h</a>></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <<a class="code" href="io_8h.html">sys/io.h</a>></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <<a class="code" href="dma_8h.html">sys/dma.h</a>></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <<a class="code" href="device_8h.html">sys/device.h</a>></span> <a name="l00040"></a>00040 <span class="preprocessor">#include <<a class="code" href="kprintf_8h.html">lib/kprintf.h</a>></span> <a name="l00041"></a>00041 <span class="preprocessor">#include <<a class="code" href="kmalloc_8h.html">lib/kmalloc.h</a>></span> <a name="l00042"></a>00042 <span class="preprocessor">#include <<a class="code" href="devfs_8h.html">devfs/devfs.h</a>></span> <a name="l00043"></a>00043 <a name="l00044"></a><a class="code" href="fdc_8c.html#bc402fcf53fee3aeee8c7a543727d183">00044</a> <span class="keyword">static</span> <a class="code" href="spinlock_8h.html#a240e9404b4ede1e0d714610080d1176">spinLock_t</a> <a class="code" href="fdc_8c.html#bc402fcf53fee3aeee8c7a543727d183">fdcSpinLock</a> = <a class="code" href="spinlock_8h.html#0fe85a4f3642683148b25916d6c5eafd">SPIN_LOCK_INITIALIZER</a>; <a name="l00045"></a>00045 <a name="l00046"></a><a class="code" href="fdc_8c.html#3041fe08ed5976302158f2668249f8b2">00046</a> <span class="keyword">static</span> <span class="keyword">volatile</span> <span class="keywordtype">bool</span> <a class="code" href="fdc_8c.html#3041fe08ed5976302158f2668249f8b2">done</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00047"></a><a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">00047</a> <span class="keyword">static</span> <a class="code" href="structDrvGeom.html">drvGeom</a> <a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a> = { <a class="code" href="fdc_8h.html#603e1e0a278c07c7338444e750ab35f3">dg144Heads</a>,<a class="code" href="fdc_8h.html#e502999ac4dc1f4ef9e0a9db76b11a9a">dg144Tracks</a>,<a class="code" href="fdc_8h.html#874c835339ecb6a4a5fdd7aab7bfbe02">dg144Spt</a> }; <a name="l00048"></a><a class="code" href="fdc_8c.html#ee050d94ea7b1ff201263f7f7bfbbefc">00048</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="fdc_8c.html#ee050d94ea7b1ff201263f7f7bfbbefc">diskChange</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00049"></a><a class="code" href="fdc_8c.html#7d4d19cb4b75718174baa280e7ceea9d">00049</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="fdc_8c.html#7d4d19cb4b75718174baa280e7ceea9d">motor</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00050"></a><a class="code" href="fdc_8c.html#bc6a2191073ccb560aaa9246c336fdd9">00050</a> <span class="keyword">static</span> <span class="keyword">volatile</span> <a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a> <a class="code" href="fdc_8c.html#bc6a2191073ccb560aaa9246c336fdd9">fdcTrack</a> = 0xff; <a name="l00051"></a><a class="code" href="fdc_8c.html#5772ef6ca96f12ff8ed997ce8bdbc6d7">00051</a> <span class="keyword">static</span> <a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a> <a class="code" href="fdc_8c.html#5772ef6ca96f12ff8ed997ce8bdbc6d7">sr0</a> = 0; <a name="l00052"></a><a class="code" href="fdc_8c.html#dea4d22e56b537ae3e8a8dd9b1555ce4">00052</a> <span class="keyword">static</span> <span class="keyword">volatile</span> <span class="keywordtype">int</span> <a class="code" href="fdc_8c.html#dea4d22e56b537ae3e8a8dd9b1555ce4">timeOut</a> = 0; <a name="l00053"></a><a class="code" href="fdc_8c.html#ee71be8badf158b1d3fc7ea1a47f82e7">00053</a> <span class="keyword">static</span> <a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a> <a class="code" href="fdc_8c.html#ee71be8badf158b1d3fc7ea1a47f82e7">statSize</a> = 0; <a name="l00054"></a><a class="code" href="fdc_8c.html#e2746d1bf47d4f690105d083b966fa82">00054</a> <span class="keyword">static</span> <a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a> <a class="code" href="fdc_8c.html#e2746d1bf47d4f690105d083b966fa82">status</a>[7] = { 0 }; <a name="l00055"></a>00055 <a name="l00056"></a><a class="code" href="fdc_8c.html#4235a63d122daa0852a95529c2f93498">00056</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="fdc_8c.html#4235a63d122daa0852a95529c2f93498">tbaddr</a> = 0x80000L; <a name="l00057"></a>00057 <a name="l00058"></a><a class="code" href="fdc_8c.html#62847307f237f6b4240d1eb4718b13e7">00058</a> <span class="keywordtype">int</span> <a class="code" href="fdc_8c.html#62847307f237f6b4240d1eb4718b13e7">fdcInit2</a>(<span class="keyword">struct</span> <a class="code" href="structdevice__node.html">device_node</a> *dev) { <a name="l00059"></a>00059 dev-><a class="code" href="structdevice__node.html#588d09d5dabf1c8866d359aaac799b1c">devInfo</a>-><a class="code" href="structdevice__interface.html#82fda947114f5c8d53fb7acbd7eb0e21">size</a> = (1024 * 1450); <a name="l00060"></a>00060 <span class="keywordflow">return</span>(0x0); <a name="l00061"></a>00061 } <a name="l00062"></a>00062 <a name="l00063"></a><a class="code" href="fdc_8c.html#2fad92b12d9ff56bf300b7e53875c75d">00063</a> <span class="keywordtype">int</span> <a class="code" href="fdc_8h.html#2fad92b12d9ff56bf300b7e53875c75d">fdc_init</a>() { <a name="l00064"></a>00064 <span class="keyword">struct </span><a class="code" href="structdevice__interface.html">device_interface</a> *devInfo = (<span class="keyword">struct </span><a class="code" href="structdevice__interface.html">device_interface</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structdevice__interface.html">device_interface</a>)); <a name="l00065"></a>00065 <a class="code" href="idt_8h.html#174a47ed653fc64fff6b5bb1b895c2cf">setVector</a>(<a class="code" href="fdc_8h.html#2c2196dd9229105994bb3840347e6f05">floppyIsr</a>, <a class="code" href="8259_8h.html#7d84962c1a1c225344a94545309f92fc">mVec</a>+6, (<a class="code" href="gdt_8h.html#7eb6dc7004c613df58764da5df7d85d8">dInt</a>+<a class="code" href="gdt_8h.html#be5eb76416aff1d9114e1cdb8b0797fe">dPresent</a>)); <a name="l00066"></a>00066 <a class="code" href="8259_8h.html#0ac079c4d770f02e505f4d8569a6960a">irqEnable</a>(6); <a name="l00067"></a>00067 <a class="code" href="fdc_8h.html#3aea9deb2a0bfea9ff05a898f4822e31">reset</a>(); <a name="l00068"></a>00068 devInfo-><a class="code" href="structdevice__interface.html#7eb42b0bb3e06dbc9183531a5e59ddb8">major</a> = 0x0; <a name="l00069"></a>00069 devInfo-><a class="code" href="structdevice__interface.html#92620413c2580ea3cf01e121bb54c254">init</a> = (<span class="keywordtype">void</span> *)&<a class="code" href="fdc_8c.html#62847307f237f6b4240d1eb4718b13e7">fdcInit2</a>; <a name="l00070"></a>00070 devInfo-><a class="code" href="structdevice__interface.html#6caf84418059d0121e76d873e305ddcb">read</a> = <a class="code" href="fdc_8h.html#fbac0e2409458a8fda9ff689ecd31de9">fdcRead</a>; <a name="l00071"></a>00071 devInfo-><a class="code" href="structdevice__interface.html#f46913eec9f191290c82db23380bc5df">write</a> = <a class="code" href="fdc_8h.html#53a979dbcd632f57a4b004f66332f981">fdcWrite</a>; <a name="l00072"></a>00072 devInfo-><a class="code" href="structdevice__interface.html#cbfb9de4fadc968479e1536fcef4a2d6">reset</a> = (<span class="keywordtype">void</span> *)<a class="code" href="fdc_8h.html#3aea9deb2a0bfea9ff05a898f4822e31">reset</a>; <a name="l00073"></a>00073 <a name="l00074"></a>00074 <a class="code" href="device_8h.html#256b750ab99e3be9b83a9bfd37a22388">device_add</a>(0,<span class="charliteral">'c'</span>,devInfo); <a name="l00075"></a>00075 <a class="code" href="devfs_8c.html#d568bae84bef3691539f1b1d0f6a54b4">devfs_makeNode</a>(<span class="stringliteral">"fd0"</span>,<span class="charliteral">'b'</span>,0x0,0x0); <a name="l00076"></a>00076 <span class="keywordflow">return</span>(0x0); <a name="l00077"></a>00077 } <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="keyword">asm</span>( <a name="l00080"></a>00080 <span class="stringliteral">".globl floppyIsr \n"</span> <a name="l00081"></a>00081 <span class="stringliteral">"floppyIsr: \n"</span> <a name="l00082"></a>00082 <span class="stringliteral">" pusha \n"</span> <a name="l00083"></a>00083 <span class="stringliteral">" push %ss \n"</span> <a name="l00084"></a>00084 <span class="stringliteral">" push %ds \n"</span> <a name="l00085"></a>00085 <span class="stringliteral">" push %es \n"</span> <a name="l00086"></a>00086 <span class="stringliteral">" push %fs \n"</span> <a name="l00087"></a>00087 <span class="stringliteral">" push %gs \n"</span> <a name="l00088"></a>00088 <span class="stringliteral">" call floppyIsrhndlr \n"</span> <a name="l00089"></a>00089 <span class="stringliteral">" pop %gs \n"</span> <a name="l00090"></a>00090 <span class="stringliteral">" pop %fs \n"</span> <a name="l00091"></a>00091 <span class="stringliteral">" pop %es \n"</span> <a name="l00092"></a>00092 <span class="stringliteral">" pop %ds \n"</span> <a name="l00093"></a>00093 <span class="stringliteral">" pop %ss \n"</span> <a name="l00094"></a>00094 <span class="stringliteral">" popa \n"</span> <a name="l00095"></a>00095 <span class="stringliteral">" iret \n"</span> <a name="l00096"></a>00096 ); <a name="l00097"></a>00097 <a name="l00098"></a><a class="code" href="fdc_8c.html#5042dfaf2327990b6d1e1a7d3e01751c">00098</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#5042dfaf2327990b6d1e1a7d3e01751c">floppyIsrhndlr</a>() { <a name="l00099"></a>00099 <a class="code" href="fdc_8c.html#3041fe08ed5976302158f2668249f8b2">done</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>; <a name="l00100"></a>00100 <a class="code" href="io_8h.html#8acc1a06073db2e7b92ffbd00fbd0cf1">outportByte</a>(0<a class="code" href="start_8S.html#62df326d54f8b2ece412319c4360ef3e">x20</a>,0<a class="code" href="start_8S.html#62df326d54f8b2ece412319c4360ef3e">x20</a>); <a name="l00101"></a>00101 } <a name="l00102"></a>00102 <a name="l00103"></a><a class="code" href="fdc_8c.html#e708fa84d19a72e77185b3a214e81573">00103</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<span class="keywordtype">int</span> <a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a>) { <a name="l00104"></a>00104 <span class="keyword">volatile</span> <span class="keywordtype">int</span> msr; <a name="l00105"></a>00105 <span class="keywordtype">int</span> tmo; <a name="l00106"></a>00106 <span class="keywordflow">for</span> (tmo=0;tmo<128;tmo++) { <a name="l00107"></a>00107 msr = <a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(<a class="code" href="fdc_8h.html#8ede3d2b611c5ae0d74bac02a68f998a">fdcMsr</a>); <a name="l00108"></a>00108 <span class="keywordflow">if</span> ((msr & 0xc0) == 0x80) { <a name="l00109"></a>00109 <a class="code" href="io_8h.html#8acc1a06073db2e7b92ffbd00fbd0cf1">outportByte</a>(<a class="code" href="fdc_8h.html#298d327024dc99847e9064de3aa4388a">fdcData</a>,Int8); <a name="l00110"></a>00110 <span class="keywordflow">return</span>; <a name="l00111"></a>00111 } <a name="l00112"></a>00112 <a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(0x80); <a name="l00113"></a>00113 } <a name="l00114"></a>00114 } <a name="l00115"></a>00115 <a name="l00116"></a><a class="code" href="fdc_8c.html#e266cdb34b69c65cfc108bbc72a4e3ff">00116</a> <span class="keywordtype">int</span> <a class="code" href="fdc_8h.html#e266cdb34b69c65cfc108bbc72a4e3ff">getByte</a>() { <a name="l00117"></a>00117 <span class="keyword">volatile</span> <span class="keywordtype">int</span> msr; <a name="l00118"></a>00118 <span class="keywordtype">int</span> tmo; <a name="l00119"></a>00119 <span class="keywordflow">for</span> (tmo=0;tmo<128;tmo++) { <a name="l00120"></a>00120 msr = <a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(<a class="code" href="fdc_8h.html#8ede3d2b611c5ae0d74bac02a68f998a">fdcMsr</a>); <a name="l00121"></a>00121 <span class="keywordflow">if</span> ((msr & 0xd0) == 0xd0) { <a name="l00122"></a>00122 <span class="keywordflow">return</span> <a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(<a class="code" href="fdc_8h.html#298d327024dc99847e9064de3aa4388a">fdcData</a>); <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(0x80); <a name="l00125"></a>00125 } <a name="l00126"></a>00126 <span class="keywordflow">return</span>(-1); <a name="l00127"></a>00127 } <a name="l00128"></a>00128 <a name="l00129"></a><a class="code" href="fdc_8c.html#9d92103f483df5da1a07402347739e44">00129</a> <span class="keywordtype">bool</span> <a class="code" href="fdc_8h.html#9d92103f483df5da1a07402347739e44">fdcRw</a>(<span class="keywordtype">int</span> block,<a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a> *blockBuffer,<span class="keywordtype">bool</span> <a class="code" href="gen__calls_8h.html#5eff3a25d417fafce7c4f211db219ca2">read</a>,<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> numSectors) { <a name="l00130"></a>00130 <span class="keywordtype">int</span> head = 0x0,track = 0x0,sector = 0x0,tries= 0x0, copyCount = 0x0; <a name="l00131"></a>00131 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *p_tbaddr = (<span class="keywordtype">char</span> *)0x80000; <a name="l00132"></a>00132 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *p_blockbuff = blockBuffer; <a name="l00133"></a>00133 <span class="comment">//kprintf("Block: [%i]\n",block);</span> <a name="l00134"></a>00134 <a class="code" href="fdc_8h.html#a0f8325f93de9409e403e620f914e69f">block2Hts</a>(block,&head,&track,&sector); <a name="l00135"></a>00135 <a class="code" href="fdc_8h.html#94483feb4903fca9643813faae8a76ee">motorOn</a>(); <a name="l00136"></a>00136 <span class="keywordflow">if</span> (!read && blockBuffer) { <a name="l00137"></a>00137 <span class="comment">/* copy data from data buffer into track buffer */</span> <a name="l00138"></a>00138 <span class="keywordflow">for</span> (copyCount=0; copyCount<(numSectors*512); copyCount++) { <a name="l00139"></a>00139 *p_tbaddr = *p_blockbuff; <a name="l00140"></a>00140 p_blockbuff++; <a name="l00141"></a>00141 p_tbaddr++; <a name="l00142"></a>00142 } <a name="l00143"></a>00143 } <a name="l00144"></a>00144 <span class="keywordflow">for</span> (tries = 0;tries < 3;tries++) { <a name="l00145"></a>00145 <span class="keywordflow">if</span> (<a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(<a class="code" href="fdc_8h.html#93ff9547b61a14618c87c5639a1252c5">fdcDir</a>) & 0x80) { <a name="l00146"></a>00146 <a class="code" href="fdc_8c.html#ee050d94ea7b1ff201263f7f7bfbbefc">diskChange</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>; <a name="l00147"></a>00147 <a class="code" href="fdc_8h.html#5886a896e5f0361f36b40d007db6e683">seek</a>(1); <span class="comment">/* clear "disk change" status */</span> <a name="l00148"></a>00148 <a class="code" href="fdc_8h.html#2a16ea9e09b5f3dc2a559351afdc75f3">recalibrate</a>(); <a name="l00149"></a>00149 <a class="code" href="fdc_8h.html#044fc0dea0fb35e6fab7f3c0badea2c9">motorOff</a>(); <a name="l00150"></a>00150 <a class="code" href="video_8h.html#5429378b96a24fadfd2d1f8d777eb95a">kprint</a>(<span class="stringliteral">"FDC: Disk change detected. Trying again.\n"</span>); <a name="l00151"></a>00151 <span class="keywordflow">return</span> <a class="code" href="fdc_8h.html#9d92103f483df5da1a07402347739e44">fdcRw</a>(block, blockBuffer, read, numSectors); <a name="l00152"></a>00152 } <a name="l00153"></a>00153 <span class="keywordflow">if</span> (!<a class="code" href="fdc_8h.html#5886a896e5f0361f36b40d007db6e683">seek</a>(track)) { <a name="l00154"></a>00154 <a class="code" href="fdc_8h.html#044fc0dea0fb35e6fab7f3c0badea2c9">motorOff</a>(); <a name="l00155"></a>00155 <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"FDC: Error seeking to track [%i]\n"</span>,block); <a name="l00156"></a>00156 <span class="keywordflow">return</span> <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00157"></a>00157 } <a name="l00158"></a>00158 <a class="code" href="io_8h.html#8acc1a06073db2e7b92ffbd00fbd0cf1">outportByte</a>(<a class="code" href="fdc_8h.html#bcb9230a76b72528226c49a520db19f0">fdcCcr</a>,0); <a name="l00159"></a>00159 <span class="keywordflow">if</span> (read) { <a name="l00160"></a>00160 <a class="code" href="dma_8h.html#7e2aa65e3e12777006ad192f7ff8bb5a">dmaXfer</a>(2,<a class="code" href="fdc_8c.html#4235a63d122daa0852a95529c2f93498">tbaddr</a>,numSectors*512,<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>); <a name="l00161"></a>00161 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#6f35816c0b01ac39832de24459d82e27">cmdRead</a>); <a name="l00162"></a>00162 } <a name="l00163"></a>00163 <span class="keywordflow">else</span> { <a name="l00164"></a>00164 <a class="code" href="dma_8h.html#7e2aa65e3e12777006ad192f7ff8bb5a">dmaXfer</a>(2,<a class="code" href="fdc_8c.html#4235a63d122daa0852a95529c2f93498">tbaddr</a>,numSectors*512,<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>); <a name="l00165"></a>00165 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#fcfbcbee1143a2a689afc3a656646bad">cmdWrite</a>); <a name="l00166"></a>00166 } <a name="l00167"></a>00167 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(head << 2); <a name="l00168"></a>00168 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(track); <a name="l00169"></a>00169 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(head); <a name="l00170"></a>00170 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(sector); <a name="l00171"></a>00171 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(2); <span class="comment">/* 512 Int8s/sector */</span> <a name="l00172"></a>00172 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#a8dd21b2e6459ec0fabd9fe49835646a">spt</a>); <a name="l00173"></a>00173 <span class="keywordflow">if</span> (<a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#a8dd21b2e6459ec0fabd9fe49835646a">spt</a> == <a class="code" href="fdc_8h.html#874c835339ecb6a4a5fdd7aab7bfbe02">dg144Spt</a>) { <a name="l00174"></a>00174 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#95339d9d677a8ac74a7a7459ad130739">dg144Gap3rw</a>); <span class="comment">/* gap 3 size for 1.44M read/write */</span> <a name="l00175"></a>00175 } <a name="l00176"></a>00176 <span class="keywordflow">else</span> { <a name="l00177"></a>00177 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#51916e330bac103bdf860461ae359e1e">dg168Gap3rw</a>); <span class="comment">/* gap 3 size for 1.68M read/write */</span> <a name="l00178"></a>00178 } <a name="l00179"></a>00179 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(0xff); <span class="comment">/* DTL = unused */</span> <a name="l00180"></a>00180 <span class="keywordflow">if</span> (!<a class="code" href="fdc_8h.html#f5b6e5123d27381ca120b7b4fea7b242">waitFdc</a>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>)) { <a name="l00181"></a>00181 <a class="code" href="video_8h.html#5429378b96a24fadfd2d1f8d777eb95a">kprint</a>(<span class="stringliteral">"Timed out, trying operation again after reset()\n"</span>); <a name="l00182"></a>00182 <a class="code" href="fdc_8h.html#3aea9deb2a0bfea9ff05a898f4822e31">reset</a>(); <a name="l00183"></a>00183 <span class="keywordflow">return</span> <a class="code" href="fdc_8h.html#9d92103f483df5da1a07402347739e44">fdcRw</a>(block, blockBuffer, read, numSectors); <a name="l00184"></a>00184 } <a name="l00185"></a>00185 <span class="keywordflow">if</span> ((<a class="code" href="fdc_8c.html#e2746d1bf47d4f690105d083b966fa82">status</a>[0] & 0xc0) == 0) <span class="keywordflow">break</span>; <span class="comment">/* worked! outta here! */</span> <a name="l00186"></a>00186 <a class="code" href="fdc_8h.html#2a16ea9e09b5f3dc2a559351afdc75f3">recalibrate</a>(); <span class="comment">/* oops, try again... */</span> <a name="l00187"></a>00187 } <a name="l00188"></a>00188 <a class="code" href="fdc_8h.html#044fc0dea0fb35e6fab7f3c0badea2c9">motorOff</a>(); <a name="l00189"></a>00189 <span class="keywordflow">if</span> (read && blockBuffer) { <a name="l00190"></a>00190 p_blockbuff = blockBuffer; <a name="l00191"></a>00191 p_tbaddr = (<span class="keywordtype">char</span> *) 0x80000; <a name="l00192"></a>00192 <span class="keywordflow">for</span> (copyCount=0x0; copyCount<(numSectors*512); copyCount++) { <a name="l00193"></a>00193 *p_blockbuff = *p_tbaddr; <a name="l00194"></a>00194 p_blockbuff++; <a name="l00195"></a>00195 p_tbaddr++; <a name="l00196"></a>00196 } <a name="l00197"></a>00197 } <a name="l00198"></a>00198 <span class="keywordflow">return</span> (tries != 3); <a name="l00199"></a>00199 } <a name="l00200"></a>00200 <a name="l00201"></a><a class="code" href="fdc_8c.html#a0f8325f93de9409e403e620f914e69f">00201</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#a0f8325f93de9409e403e620f914e69f">block2Hts</a>(<span class="keywordtype">int</span> block,<span class="keywordtype">int</span> *head,<span class="keywordtype">int</span> *track,<span class="keywordtype">int</span> *sector) { <a name="l00202"></a>00202 *head = (block % (<a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#a8dd21b2e6459ec0fabd9fe49835646a">spt</a> * <a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#edb24f8c9f3ae872be1cb104854dee1b">heads</a>)) / (<a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#a8dd21b2e6459ec0fabd9fe49835646a">spt</a>); <a name="l00203"></a>00203 *track = block / (<a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#a8dd21b2e6459ec0fabd9fe49835646a">spt</a> * <a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#edb24f8c9f3ae872be1cb104854dee1b">heads</a>); <a name="l00204"></a>00204 *sector = block % <a class="code" href="fdc_8c.html#af7080152f82d659c32dd37e1727c32d">geometry</a>.<a class="code" href="structDrvGeom.html#a8dd21b2e6459ec0fabd9fe49835646a">spt</a> + 1; <a name="l00205"></a>00205 } <a name="l00206"></a>00206 <a name="l00207"></a><a class="code" href="fdc_8c.html#94483feb4903fca9643813faae8a76ee">00207</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#94483feb4903fca9643813faae8a76ee">motorOn</a>(<span class="keywordtype">void</span>) { <a name="l00208"></a>00208 <span class="keywordflow">if</span> (<a class="code" href="fdc_8c.html#7d4d19cb4b75718174baa280e7ceea9d">motor</a> == <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>) { <a name="l00209"></a>00209 <a class="code" href="io_8h.html#8acc1a06073db2e7b92ffbd00fbd0cf1">outportByte</a>(<a class="code" href="fdc_8h.html#e3bc9df62f197b42804259efb8ba44ec">fdcDor</a>,0x1c); <a name="l00210"></a>00210 <a class="code" href="fdc_8c.html#7d4d19cb4b75718174baa280e7ceea9d">motor</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>; <a name="l00211"></a>00211 } <a name="l00212"></a>00212 } <a name="l00213"></a>00213 <a name="l00214"></a><a class="code" href="fdc_8c.html#044fc0dea0fb35e6fab7f3c0badea2c9">00214</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#044fc0dea0fb35e6fab7f3c0badea2c9">motorOff</a>(<span class="keywordtype">void</span>) { <a name="l00215"></a>00215 <span class="keywordflow">if</span> (<a class="code" href="fdc_8c.html#7d4d19cb4b75718174baa280e7ceea9d">motor</a> == <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>) { <a name="l00216"></a>00216 <span class="comment">//outportByte(fdcDor,0x0);</span> <a name="l00217"></a>00217 <span class="comment">//outportByte(fdcDor,0x0C);</span> <a name="l00218"></a>00218 <a class="code" href="fdc_8c.html#7d4d19cb4b75718174baa280e7ceea9d">motor</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00219"></a>00219 } <a name="l00220"></a>00220 } <a name="l00221"></a>00221 <a name="l00222"></a><a class="code" href="fdc_8c.html#5886a896e5f0361f36b40d007db6e683">00222</a> <span class="keywordtype">bool</span> <a class="code" href="fdc_8h.html#5886a896e5f0361f36b40d007db6e683">seek</a>(<span class="keywordtype">int</span> track) { <a name="l00223"></a>00223 <span class="keywordflow">if</span> (<a class="code" href="fdc_8c.html#bc6a2191073ccb560aaa9246c336fdd9">fdcTrack</a> == track) { <a name="l00224"></a>00224 <span class="keywordflow">return</span>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>); <a name="l00225"></a>00225 } <a name="l00226"></a>00226 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#e2d2411a8ccdc868ab718da2b15348a9">cmdSeek</a>); <a name="l00227"></a>00227 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(0); <a name="l00228"></a>00228 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(track); <a name="l00229"></a>00229 <span class="keywordflow">if</span> (!<a class="code" href="fdc_8h.html#f5b6e5123d27381ca120b7b4fea7b242">waitFdc</a>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>)) { <a name="l00230"></a>00230 <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"wait fdc failed\n"</span>); <a name="l00231"></a>00231 <span class="keywordflow">return</span>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>); <a name="l00232"></a>00232 } <a name="l00233"></a>00233 <span class="keywordflow">if</span> ((<a class="code" href="fdc_8c.html#5772ef6ca96f12ff8ed997ce8bdbc6d7">sr0</a> != 0<a class="code" href="start_8S.html#62df326d54f8b2ece412319c4360ef3e">x20</a>) || (<a class="code" href="fdc_8c.html#bc6a2191073ccb560aaa9246c336fdd9">fdcTrack</a> != track)) { <a name="l00234"></a>00234 <span class="keywordflow">return</span>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>); <a name="l00235"></a>00235 } <a name="l00236"></a>00236 <span class="keywordflow">else</span> { <a name="l00237"></a>00237 <span class="keywordflow">return</span>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>); <a name="l00238"></a>00238 } <a name="l00239"></a>00239 } <a name="l00240"></a>00240 <a name="l00241"></a><a class="code" href="fdc_8c.html#a03242a5e44c4f2d10e15d296aca8c6b">00241</a> <span class="keywordtype">bool</span> <a class="code" href="fdc_8h.html#a03242a5e44c4f2d10e15d296aca8c6b">readBlock</a>(<span class="keywordtype">int</span> block,<a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a> *blockBuffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> numSectors) { <a name="l00242"></a>00242 <span class="keywordtype">int</span> result = 0x0,loop = 0x0; <a name="l00243"></a>00243 <span class="keywordflow">if</span> (numSectors > 1) { <a name="l00244"></a>00244 <span class="keywordflow">for</span> (loop=0; loop<numSectors; loop++) { <a name="l00245"></a>00245 result = <a class="code" href="fdc_8h.html#9d92103f483df5da1a07402347739e44">fdcRw</a>(block+loop, blockBuffer+(loop*512), <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>, 1); <a name="l00246"></a>00246 } <a name="l00247"></a>00247 <span class="keywordflow">return</span> result; <a name="l00248"></a>00248 } <a name="l00249"></a>00249 <span class="keywordflow">return</span> <a class="code" href="fdc_8h.html#9d92103f483df5da1a07402347739e44">fdcRw</a>(block,blockBuffer,<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>,numSectors); <a name="l00250"></a>00250 } <a name="l00251"></a>00251 <a name="l00252"></a><a class="code" href="fdc_8c.html#ebbcd7bc8695e888491b97b5bf27bd9c">00252</a> <span class="keywordtype">bool</span> <a class="code" href="fdc_8h.html#ebbcd7bc8695e888491b97b5bf27bd9c">writeBlock</a>(<span class="keywordtype">int</span> block,<a class="code" href="types_8h.html#3832cc814f0e7129add9a1cf7201c7ca">Int8</a> *blockBuffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> numSectors) { <a name="l00253"></a>00253 <span class="keywordflow">return</span> <a class="code" href="fdc_8h.html#9d92103f483df5da1a07402347739e44">fdcRw</a>(block,blockBuffer,<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>, numSectors); <a name="l00254"></a>00254 } <a name="l00255"></a>00255 <a name="l00256"></a><a class="code" href="fdc_8c.html#f5b6e5123d27381ca120b7b4fea7b242">00256</a> <span class="keywordtype">bool</span> <a class="code" href="fdc_8h.html#f5b6e5123d27381ca120b7b4fea7b242">waitFdc</a>(<span class="keywordtype">bool</span> sensei) { <a name="l00257"></a>00257 <a class="code" href="fdc_8c.html#dea4d22e56b537ae3e8a8dd9b1555ce4">timeOut</a> = 50000; <a name="l00258"></a>00258 <span class="keywordflow">while</span> (!<a class="code" href="fdc_8c.html#3041fe08ed5976302158f2668249f8b2">done</a> && <a class="code" href="fdc_8c.html#dea4d22e56b537ae3e8a8dd9b1555ce4">timeOut</a>); <a name="l00259"></a>00259 <a class="code" href="fdc_8c.html#ee71be8badf158b1d3fc7ea1a47f82e7">statSize</a> = 0; <a name="l00260"></a>00260 <span class="keywordflow">while</span> ((<a class="code" href="fdc_8c.html#ee71be8badf158b1d3fc7ea1a47f82e7">statSize</a> < 7) && (<a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(<a class="code" href="fdc_8h.html#8ede3d2b611c5ae0d74bac02a68f998a">fdcMsr</a>) & (1<<4))) { <a name="l00261"></a>00261 <a class="code" href="fdc_8c.html#e2746d1bf47d4f690105d083b966fa82">status</a>[(int)<a class="code" href="fdc_8c.html#ee71be8badf158b1d3fc7ea1a47f82e7">statSize</a>++] = <a class="code" href="fdc_8h.html#e266cdb34b69c65cfc108bbc72a4e3ff">getByte</a>(); <a name="l00262"></a>00262 } <a name="l00263"></a>00263 <span class="keywordflow">if</span> (sensei) { <a name="l00264"></a>00264 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#6afd950ba65e51d77abf2158216f0284">cmdSensei</a>); <a name="l00265"></a>00265 <a class="code" href="fdc_8c.html#5772ef6ca96f12ff8ed997ce8bdbc6d7">sr0</a> = <a class="code" href="fdc_8h.html#e266cdb34b69c65cfc108bbc72a4e3ff">getByte</a>(); <a name="l00266"></a>00266 <a class="code" href="fdc_8c.html#bc6a2191073ccb560aaa9246c336fdd9">fdcTrack</a> = <a class="code" href="fdc_8h.html#e266cdb34b69c65cfc108bbc72a4e3ff">getByte</a>(); <a name="l00267"></a>00267 } <a name="l00268"></a>00268 <a class="code" href="fdc_8c.html#3041fe08ed5976302158f2668249f8b2">done</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00269"></a>00269 <span class="keywordflow">if</span> (!<a class="code" href="fdc_8c.html#dea4d22e56b537ae3e8a8dd9b1555ce4">timeOut</a>) { <a name="l00270"></a>00270 <span class="keywordflow">if</span> (<a class="code" href="io_8h.html#77b934268de1b3ecdcf3f275413b3108">inportByte</a>(<a class="code" href="fdc_8h.html#93ff9547b61a14618c87c5639a1252c5">fdcDir</a>) & 0x80) { <a name="l00271"></a>00271 <a class="code" href="fdc_8c.html#ee050d94ea7b1ff201263f7f7bfbbefc">diskChange</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>; <a name="l00272"></a>00272 } <a name="l00273"></a>00273 <span class="keywordflow">return</span>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>); <a name="l00274"></a>00274 } <a name="l00275"></a>00275 <span class="keywordflow">else</span> { <a name="l00276"></a>00276 <span class="keywordflow">return</span>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>); <a name="l00277"></a>00277 } <a name="l00278"></a>00278 } <a name="l00279"></a>00279 <a name="l00280"></a><a class="code" href="fdc_8c.html#2a16ea9e09b5f3dc2a559351afdc75f3">00280</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#2a16ea9e09b5f3dc2a559351afdc75f3">recalibrate</a>(<span class="keywordtype">void</span>) { <a name="l00281"></a>00281 <a class="code" href="fdc_8h.html#94483feb4903fca9643813faae8a76ee">motorOn</a>(); <a name="l00282"></a>00282 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#8a2fef7d1ed07757e099b8c7b29bfb09">cmdRecal</a>); <a name="l00283"></a>00283 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(0); <a name="l00284"></a>00284 <a class="code" href="fdc_8h.html#f5b6e5123d27381ca120b7b4fea7b242">waitFdc</a>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>); <a name="l00285"></a>00285 <a class="code" href="fdc_8h.html#044fc0dea0fb35e6fab7f3c0badea2c9">motorOff</a>(); <a name="l00286"></a>00286 } <a name="l00287"></a>00287 <a name="l00288"></a><a class="code" href="fdc_8c.html#3aea9deb2a0bfea9ff05a898f4822e31">00288</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#3aea9deb2a0bfea9ff05a898f4822e31">reset</a>(<span class="keywordtype">void</span>) { <a name="l00289"></a>00289 <a class="code" href="io_8h.html#8acc1a06073db2e7b92ffbd00fbd0cf1">outportByte</a>(<a class="code" href="fdc_8h.html#e3bc9df62f197b42804259efb8ba44ec">fdcDor</a>,0); <a name="l00290"></a>00290 <a class="code" href="fdc_8c.html#7d4d19cb4b75718174baa280e7ceea9d">motor</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00291"></a>00291 <a class="code" href="io_8h.html#8acc1a06073db2e7b92ffbd00fbd0cf1">outportByte</a>(<a class="code" href="fdc_8h.html#e3bc9df62f197b42804259efb8ba44ec">fdcDor</a>,0x0c); <a name="l00292"></a>00292 <a class="code" href="fdc_8c.html#3041fe08ed5976302158f2668249f8b2">done</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>; <a name="l00293"></a>00293 <a class="code" href="fdc_8h.html#f5b6e5123d27381ca120b7b4fea7b242">waitFdc</a>(<a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a82764c3079aea4e60c80e45befbb839">TRUE</a>); <a name="l00294"></a>00294 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(<a class="code" href="fdc_8h.html#6003c8e12dd1e4f765279854f016c0ae">cmdSpecify</a>); <a name="l00295"></a>00295 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(0xdf); <a name="l00296"></a>00296 <a class="code" href="fdc_8h.html#e708fa84d19a72e77185b3a214e81573">sendByte</a>(0x02); <a name="l00297"></a>00297 <a class="code" href="fdc_8h.html#5886a896e5f0361f36b40d007db6e683">seek</a>(1); <a name="l00298"></a>00298 <a class="code" href="fdc_8h.html#2a16ea9e09b5f3dc2a559351afdc75f3">recalibrate</a>(); <a name="l00299"></a>00299 <a class="code" href="fdc_8c.html#ee050d94ea7b1ff201263f7f7bfbbefc">diskChange</a> = <a class="code" href="types_8h.html#f6a258d8f3ee5206d682d799316314b1a1e095cc966dbecf6a0d8aad75348d1a">FALSE</a>; <a name="l00300"></a>00300 <span class="keywordflow">return</span>; <a name="l00301"></a>00301 } <a name="l00302"></a>00302 <a name="l00303"></a><a class="code" href="fdc_8c.html#1f2029ff3278c4b819c4420c168cc082">00303</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#fbac0e2409458a8fda9ff689ecd31de9">fdcRead</a>(<span class="keywordtype">void</span> *<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,<span class="keywordtype">void</span> *baseAddr,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> startSector,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> sectorCount) { <a name="l00304"></a>00304 <a class="code" href="spinlock_8h.html#2cd9a4502680fb8e7f0fe6b029e558b1">spinLock</a>(&<a class="code" href="fdc_8c.html#bc402fcf53fee3aeee8c7a543727d183">fdcSpinLock</a>); <a name="l00305"></a>00305 <a class="code" href="fdc_8h.html#a03242a5e44c4f2d10e15d296aca8c6b">readBlock</a>(startSector,baseAddr,sectorCount); <a name="l00306"></a>00306 <a class="code" href="spinlock_8h.html#dd996cbbb3b9826dd9c8cf02b66a4c65">spinUnlock</a>(&<a class="code" href="fdc_8c.html#bc402fcf53fee3aeee8c7a543727d183">fdcSpinLock</a>); <a name="l00307"></a>00307 <span class="keywordflow">return</span>; <a name="l00308"></a>00308 } <a name="l00309"></a><a class="code" href="fdc_8c.html#cc9e5f35deea53f5b68798269b9be7c0">00309</a> <span class="keywordtype">void</span> <a class="code" href="fdc_8h.html#53a979dbcd632f57a4b004f66332f981">fdcWrite</a>(<span class="keywordtype">void</span> *<a class="code" href="structdevice__interface.html#eacb2f431b14ddd1e9fe34db278dfc9e">info</a>,<span class="keywordtype">void</span> *baseAddr,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> startSector,<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> sectorCount){ <a name="l00310"></a>00310 <a class="code" href="fdc_8h.html#ebbcd7bc8695e888491b97b5bf27bd9c">writeBlock</a>(startSector,baseAddr,sectorCount); <a name="l00311"></a>00311 <span class="keywordflow">return</span>; <a name="l00312"></a>00312 } <a name="l00313"></a>00313 <a name="l00314"></a>00314 <span class="comment">/***</span> <a name="l00315"></a>00315 <span class="comment"></span> <a name="l00316"></a>00316 <span class="comment"> $Log: fdc_8c-source.html,v $ <a name="l00316"></a>00316 <span class="comment"> Revision 1.7 2006/12/15 17:47:05 reddawg <a name="l00316"></a>00316 <span class="comment"> Updates <a name="l00316"></a>00316 <span class="comment"></span> <a name="l00317"></a>00317 <span class="comment"> Revision 1.1.1.1 2006/06/01 12:46:12 reddawg</span> <a name="l00318"></a>00318 <span class="comment"> ubix2</span> <a name="l00319"></a>00319 <span class="comment"></span> <a name="l00320"></a>00320 <span class="comment"> Revision 1.2 2005/10/12 00:13:37 reddawg</span> <a name="l00321"></a>00321 <span class="comment"> Removed</span> <a name="l00322"></a>00322 <span class="comment"></span> <a name="l00323"></a>00323 <span class="comment"> Revision 1.1.1.1 2005/09/26 17:24:01 reddawg</span> <a name="l00324"></a>00324 <span class="comment"> no message</span> <a name="l00325"></a>00325 <span class="comment"></span> <a name="l00326"></a>00326 <span class="comment"> Revision 1.24 2004/09/07 21:54:38 reddawg</span> <a name="l00327"></a>00327 <span class="comment"> ok reverted back to old scheduling for now....</span> <a name="l00328"></a>00328 <span class="comment"></span> <a name="l00329"></a>00329 <span class="comment"> Revision 1.23 2004/09/06 15:13:25 reddawg</span> <a name="l00330"></a>00330 <span class="comment"> Last commit before FreeBSD 6.0</span> <a name="l00331"></a>00331 <span class="comment"></span> <a name="l00332"></a>00332 <span class="comment"> Revision 1.22 2004/08/21 20:06:28 reddawg</span> <a name="l00333"></a>00333 <span class="comment"> ok check out exec.c</span> <a name="l00334"></a>00334 <span class="comment"></span> <a name="l00335"></a>00335 <span class="comment"> Revision 1.21 2004/08/15 16:47:49 reddawg</span> <a name="l00336"></a>00336 <span class="comment"> Fixed</span> <a name="l00337"></a>00337 <span class="comment"></span> <a name="l00338"></a>00338 <span class="comment"> Revision 1.20 2004/08/15 00:33:02 reddawg</span> <a name="l00339"></a>00339 <span class="comment"> Wow the ide driver works again</span> <a name="l00340"></a>00340 <span class="comment"></span> <a name="l00341"></a>00341 <span class="comment"> Revision 1.19 2004/08/01 20:40:45 reddawg</span> <a name="l00342"></a>00342 <span class="comment"> Net related fixes</span> <a name="l00343"></a>00343 <span class="comment"></span> <a name="l00344"></a>00344 <span class="comment"> Revision 1.18 2004/07/29 21:32:16 reddawg</span> <a name="l00345"></a>00345 <span class="comment"> My quick lunchs breaks worth of updates....</span> <a name="l00346"></a>00346 <span class="comment"></span> <a name="l00347"></a>00347 <span class="comment"> Revision 1.17 2004/07/27 08:03:36 reddawg</span> <a name="l00348"></a>00348 <span class="comment"> chg: stopped push all these extra registers I can't find a good reason as to why I was doing it</span> <a name="l00349"></a>00349 <span class="comment"></span> <a name="l00350"></a>00350 <span class="comment"> Revision 1.16 2004/07/22 17:32:25 reddawg</span> <a name="l00351"></a>00351 <span class="comment"> I broke it hopefully</span> <a name="l00352"></a>00352 <span class="comment"></span> <a name="l00353"></a>00353 <span class="comment"> Revision 1.15 2004/07/21 10:02:09 reddawg</span> <a name="l00354"></a>00354 <span class="comment"> devfs: renamed functions</span> <a name="l00355"></a>00355 <span class="comment"> device system: renamed functions</span> <a name="l00356"></a>00356 <span class="comment"> fdc: fixed a few potential bugs and cleaned up some unused variables</span> <a name="l00357"></a>00357 <span class="comment"> strol: fixed definition</span> <a name="l00358"></a>00358 <span class="comment"> endtask: made it print out freepage debug info</span> <a name="l00359"></a>00359 <span class="comment"> kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost</span> <a name="l00360"></a>00360 <span class="comment"> ld: fixed a pointer conversion</span> <a name="l00361"></a>00361 <span class="comment"> file: cleaned up a few unused variables</span> <a name="l00362"></a>00362 <span class="comment"> sched: broke task deletion</span> <a name="l00363"></a>00363 <span class="comment"> kprintf: fixed ogPrintf definition</span> <a name="l00364"></a>00364 <span class="comment"></span> <a name="l00365"></a>00365 <span class="comment"> Revision 1.14 2004/07/17 02:38:31 reddawg</span> <a name="l00366"></a>00366 <span class="comment"> Fixed a few problems</span> <a name="l00367"></a>00367 <span class="comment"></span> <a name="l00368"></a>00368 <span class="comment"> Revision 1.13 2004/07/14 12:42:46 reddawg</span> <a name="l00369"></a>00369 <span class="comment"> fdc: fdcInit to fdc_init</span> <a name="l00370"></a>00370 <span class="comment"> Changed Startup Routines</span> <a name="l00371"></a>00371 <span class="comment"></span> <a name="l00372"></a>00372 <span class="comment"> Revision 1.12 2004/06/04 10:19:42 reddawg</span> <a name="l00373"></a>00373 <span class="comment"> notes: we compile again, thank g-d anyways i was about to cry</span> <a name="l00374"></a>00374 <span class="comment"></span> <a name="l00375"></a>00375 <span class="comment"> Revision 1.11 2004/05/20 22:51:09 reddawg</span> <a name="l00376"></a>00376 <span class="comment"> Cleaned Up Warnings</span> <a name="l00377"></a>00377 <span class="comment"></span> <a name="l00378"></a>00378 <span class="comment"> Revision 1.10 2004/05/19 23:36:52 reddawg</span> <a name="l00379"></a>00379 <span class="comment"> Bug Fixes</span> <a name="l00380"></a>00380 <span class="comment"></span> <a name="l00381"></a>00381 <span class="comment"> Revision 1.9 2004/05/19 15:31:27 reddawg</span> <a name="l00382"></a>00382 <span class="comment"> Fixed up the rest of the references</span> <a name="l00383"></a>00383 <span class="comment"></span> <a name="l00384"></a>00384 <span class="comment"> Revision 1.8 2004/05/19 15:26:33 reddawg</span> <a name="l00385"></a>00385 <span class="comment"> Fixed reference issues due to changes in driver subsystem</span> <a name="l00386"></a>00386 <span class="comment"></span> <a name="l00387"></a>00387 <span class="comment"> Revision 1.7 2004/05/10 02:23:24 reddawg</span> <a name="l00388"></a>00388 <span class="comment"> Minor Changes To Source Code To Prepare It For Open Source Release</span> <a name="l00389"></a>00389 <span class="comment"></span> <a name="l00390"></a>00390 <span class="comment"> Revision 1.6 2004/04/30 14:16:04 reddawg</span> <a name="l00391"></a>00391 <span class="comment"> Fixed all the datatypes to be consistant uInt8,uInt16,uInt32,Int8,Int16,Int32</span> <a name="l00392"></a>00392 <span class="comment"></span> <a name="l00393"></a>00393 <span class="comment"> Revision 1.5 2004/04/29 15:29:20 reddawg</span> <a name="l00394"></a>00394 <span class="comment"> Fixed All Running Issues</span> <a name="l00395"></a>00395 <span class="comment"></span> <a name="l00396"></a>00396 <span class="comment"> Revision 1.4 2004/04/28 02:22:54 reddawg</span> <a name="l00397"></a>00397 <span class="comment"> This is a fiarly large commit but we are starting to use new driver model</span> <a name="l00398"></a>00398 <span class="comment"> all around</span> <a name="l00399"></a>00399 <span class="comment"></span> <a name="l00400"></a>00400 <span class="comment"> Revision 1.3 2004/04/26 22:22:33 reddawg</span> <a name="l00401"></a>00401 <span class="comment"> DevFS now uses correct size of device</span> <a name="l00402"></a>00402 <span class="comment"></span> <a name="l00403"></a>00403 <span class="comment"> Revision 1.2 2004/04/22 21:20:05 reddawg</span> <a name="l00404"></a>00404 <span class="comment"> FDC now adds drives to the devfs</span> <a name="l00405"></a>00405 <span class="comment"></span> <a name="l00406"></a>00406 <span class="comment"> Revision 1.1.1.1 2004/04/15 12:07:09 reddawg</span> <a name="l00407"></a>00407 <span class="comment"> UbixOS v1.0</span> <a name="l00408"></a>00408 <span class="comment"></span> <a name="l00409"></a>00409 <span class="comment"> Revision 1.6 2004/04/13 16:36:33 reddawg</span> <a name="l00410"></a>00410 <span class="comment"> Changed our copyright, it is all now under a BSD-Style license</span> <a name="l00411"></a>00411 <span class="comment"></span> <a name="l00412"></a>00412 <span class="comment"> END</span> <a name="l00413"></a>00413 <span class="comment"> ***/</span> <a name="l00414"></a>00414 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Dec 15 11:18:55 2006 for UbixOS V2 by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address> </body> </html>