mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
516 lines
63 KiB
HTML
Executable file
516 lines
63 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.08">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>IDEATABlkSel</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF9>I64</span><span class=cF0> blk, </span><span class=cF9>I64</span><span class=cF0> count)
|
|
<a name="l3"></a>{
|
|
<a name="l4"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type != </span><span class=cF3>BDT_ATAPI</span><span class=cF0> && bd->base1)
|
|
<a name="l5"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base1 + </span><span class=cF3>ATAR1_CTRL</span><span class=cF0>, </span><span class=cFE>0x8</span><span class=cF0>);
|
|
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l7"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//48 Bit LBA?</span><span class=cF0>
|
|
<a name="l8"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_NSECT</span><span class=cF0>, count.u8[</span><span class=cFE>1</span><span class=cF0>]);
|
|
<a name="l9"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SECT</span><span class=cF0>, blk.u8[</span><span class=cFE>3</span><span class=cF0>]);
|
|
<a name="l10"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, blk.u8[</span><span class=cFE>4</span><span class=cF0>]);
|
|
<a name="l11"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, blk.u8[</span><span class=cFE>5</span><span class=cF0>]);
|
|
<a name="l12"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_NSECT</span><span class=cF0>, count);
|
|
<a name="l13"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SECT</span><span class=cF0>, blk);
|
|
<a name="l14"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, blk.u8[</span><span class=cFE>1</span><span class=cF0>]);
|
|
<a name="l15"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, blk.u8[</span><span class=cFE>2</span><span class=cF0>]);
|
|
<a name="l16"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l17"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l19"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//28 Bit LBA</span><span class=cF0>
|
|
<a name="l20"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_NSECT</span><span class=cF0>, count);
|
|
<a name="l21"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SECT</span><span class=cF0>, blk);
|
|
<a name="l22"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, blk.u8[</span><span class=cFE>1</span><span class=cF0>]);
|
|
<a name="l23"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, blk.u8[</span><span class=cFE>2</span><span class=cF0>]);
|
|
<a name="l24"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0> | blk.u8[</span><span class=cFE>3</span><span class=cF0>]);
|
|
<a name="l25"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l26"></a>}
|
|
<a name="l27"></a>
|
|
<a name="l28"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout)
|
|
<a name="l29"></a>{
|
|
<a name="l30"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l31"></a>
|
|
<a name="l32"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>3</span><span class=cF0>; i++)
|
|
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_STAT</span><span class=cF0>) & </span><span class=cF3>ATAS_BSY</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l36"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l37"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l38"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l39"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> < timeout < </span><span class=cF5>tS</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l40"></a>
|
|
<a name="l41"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l42"></a>}
|
|
<a name="l43"></a>
|
|
<a name="l44"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATAWaitDRQ</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout)
|
|
<a name="l45"></a>{
|
|
<a name="l46"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l47"></a>
|
|
<a name="l48"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>3</span><span class=cF0>; i++)
|
|
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF0>bd->base0 + </span><span class=cF3>ATAR0_STAT</span><span class=cF7>)</span><span class=cF0> & </span><span class=cF3>ATAS_DRQ</span><span class=cF0>)
|
|
<a name="l52"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l53"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l54"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l55"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> < timeout < </span><span class=cF5>tS</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l56"></a>
|
|
<a name="l57"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l58"></a>}
|
|
<a name="l59"></a>
|
|
<a name="l60"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATANop</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout)
|
|
<a name="l61"></a>{
|
|
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l63"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l64"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l65"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l66"></a>
|
|
<a name="l67"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_FEAT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l68"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_CMD</span><span class=cF0>, </span><span class=cF3>ATA_NOP</span><span class=cF0>);
|
|
<a name="l69"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, timeout);
|
|
<a name="l70"></a>}
|
|
<a name="l71"></a>
|
|
<a name="l72"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>IDEATACmd</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>U8</span><span class=cF0> cmd)
|
|
<a name="l73"></a>{
|
|
<a name="l74"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_FEAT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l75"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_CMD</span><span class=cF0>, cmd);
|
|
<a name="l76"></a> bd->last_time = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l77"></a> </span><span class=cF5>PortNop</span><span class=cF0>;
|
|
<a name="l78"></a>}
|
|
<a name="l79"></a>
|
|
<a name="l80"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATAGetRes</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout, </span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>I64</span><span class=cF0> count, </span><span class=cF9>I64</span><span class=cF0> _avail, </span><span class=cF1>Bool</span><span class=cF0> one_read)
|
|
<a name="l81"></a>{
|
|
<a name="l82"></a> </span><span class=cF9>I64</span><span class=cF0> avail, overflow;
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> bd->flags &= ~</span><span class=cF3>BDF_LAST_WAS_WRITE</span><span class=cF0>;
|
|
<a name="l85"></a> </span><span class=cF5>MemSet</span><span class=cF0>(buf, </span><span class=cFE>0</span><span class=cF0>, count);
|
|
<a name="l86"></a> </span><span class=cF1>while</span><span class=cF0> (count > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l87"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>IDEATAWaitDRQ</span><span class=cF7>(</span><span class=cF0>bd, timeout</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l89"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (_avail)
|
|
<a name="l91"></a> avail = _avail;
|
|
<a name="l92"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l93"></a> avail = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>) << </span><span class=cFE>8</span><span class=cF0> + </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>);
|
|
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (avail)
|
|
<a name="l95"></a> {
|
|
<a name="l96"></a> </span><span class=cF1>if</span><span class=cF0> (avail > count)
|
|
<a name="l97"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l98"></a> overflow = avail - count;
|
|
<a name="l99"></a> avail = count;
|
|
<a name="l100"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l101"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l102"></a> overflow = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l103"></a>
|
|
<a name="l104"></a> </span><span class=cF1>if</span><span class=cF0> (avail & </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l105"></a> </span><span class=cF5>RepInU16</span><span class=cF0>(buf, avail >> </span><span class=cFE>1</span><span class=cF0>, bd->base0 + </span><span class=cF3>ATAR0_DATA</span><span class=cF0>);
|
|
<a name="l106"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l107"></a> </span><span class=cF5>RepInU32</span><span class=cF0>(buf, avail >> </span><span class=cFE>2</span><span class=cF0>, bd->base0 + </span><span class=cF3>ATAR0_DATA</span><span class=cF0>);
|
|
<a name="l108"></a>
|
|
<a name="l109"></a> count -= avail;
|
|
<a name="l110"></a> buf += avail;
|
|
<a name="l111"></a> </span><span class=cF1>while</span><span class=cF0> (overflow > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l112"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l113"></a> </span><span class=cF5>InU16</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_DATA</span><span class=cF0>);
|
|
<a name="l114"></a> overflow -= </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> < timeout < </span><span class=cF5>tS</span><span class=cF0>)
|
|
<a name="l116"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l117"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (one_read)
|
|
<a name="l119"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l120"></a> }
|
|
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l122"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l123"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l124"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, timeout);
|
|
<a name="l125"></a>}
|
|
<a name="l126"></a>
|
|
<a name="l127"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout, ...)
|
|
<a name="l128"></a>{
|
|
<a name="l129"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l130"></a>
|
|
<a name="l131"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < argc; i++)
|
|
<a name="l132"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>IDEATAWaitDRQ</span><span class=cF7>(</span><span class=cF0>bd, timeout</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l134"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l135"></a>
|
|
<a name="l136"></a> </span><span class=cF5>OutU16</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_DATA</span><span class=cF0>, </span><span class=cF5>EndianU16</span><span class=cF7>(</span><span class=cF0>argv[i]</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l137"></a> bd->last_time = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l138"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l139"></a>
|
|
<a name="l140"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l141"></a>}
|
|
<a name="l142"></a>
|
|
<a name="l143"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATAPISetMaxSpeed</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd)
|
|
<a name="l144"></a>{
|
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l146"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l147"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l148"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l149"></a>
|
|
<a name="l150"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l151"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l152"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l153"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ATAPI_SET_CD_SPEED</span><span class=cF0>, </span><span class=cFE>0xFFFF</span><span class=cF0>, </span><span class=cFE>0xFFFF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l154"></a>
|
|
<a name="l155"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l156"></a>}
|
|
<a name="l157"></a>
|
|
<a name="l158"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATAPISeek</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF9>I64</span><span class=cF0> native_blk)
|
|
<a name="l159"></a>{
|
|
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l161"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l162"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l164"></a>
|
|
<a name="l165"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l166"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l167"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l168"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ATAPI_SEEK</span><span class=cF0>, native_blk >> </span><span class=cFE>16</span><span class=cF0>, native_blk, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l169"></a>
|
|
<a name="l170"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l171"></a>}
|
|
<a name="l172"></a>
|
|
<a name="l173"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>IDEATAPIStartStop</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout, </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>)
|
|
<a name="l174"></a>{
|
|
<a name="l175"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l176"></a>
|
|
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0>)
|
|
<a name="l178"></a> i = </span><span class=cFE>0x100</span><span class=cF0>;
|
|
<a name="l179"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l180"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l182"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l184"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l185"></a>
|
|
<a name="l186"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l187"></a></span><span class=cF2>//Start/Stop</span><span class=cF0>
|
|
<a name="l188"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF7>(</span><span class=cF0>bd, timeout, </span><span class=cF3>ATAPI_START_STOP_UNIT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, i, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l189"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, timeout);
|
|
<a name="l190"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l191"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l192"></a>}
|
|
<a name="l193"></a>
|
|
<a name="l194"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>IDEATAGetDevId</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout, </span><span class=cF1>Bool</span><span class=cF0> keep_id_record)
|
|
<a name="l195"></a>{
|
|
<a name="l196"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cF3>BDT_NULL</span><span class=cF0>;
|
|
<a name="l197"></a> </span><span class=cF9>U16</span><span class=cF0> *id_record = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l198"></a>
|
|
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type != </span><span class=cF3>BDT_ATAPI</span><span class=cF0> && bd->base1)
|
|
<a name="l200"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base1 + </span><span class=cF3>ATAR1_CTRL</span><span class=cF0>, </span><span class=cFE>0x8</span><span class=cF0>);
|
|
<a name="l201"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l202"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l203"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l204"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l205"></a>
|
|
<a name="l206"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_IDENTIFY</span><span class=cF0>);
|
|
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, timeout</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l208"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l209"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF0>bd->base0 + </span><span class=cF3>ATAR0_STAT</span><span class=cF7>)</span><span class=cF0> & </span><span class=cF3>ATAS_ERR</span><span class=cF0>)
|
|
<a name="l210"></a> res = </span><span class=cF3>BDT_ATAPI</span><span class=cF0>;
|
|
<a name="l211"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l212"></a> {
|
|
<a name="l213"></a> id_record = </span><span class=cF5>SysCAlloc</span><span class=cF0>(</span><span class=cFE>512</span><span class=cF0>);
|
|
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAGetRes</span><span class=cF7>(</span><span class=cF0>bd, timeout, id_record, </span><span class=cFE>512</span><span class=cF0>, </span><span class=cFE>512</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l215"></a> res = </span><span class=cF3>BDT_ATA</span><span class=cF0>;
|
|
<a name="l216"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l217"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l218"></a> </span><span class=cF5>Free</span><span class=cF0>(id_record);
|
|
<a name="l219"></a> id_record = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l220"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l221"></a> }
|
|
<a name="l222"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l223"></a> </span><span class=cF1>if</span><span class=cF0> (keep_id_record)
|
|
<a name="l224"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l225"></a> </span><span class=cF5>Free</span><span class=cF0>(bd->dev_id_record);
|
|
<a name="l226"></a> bd->dev_id_record = id_record;
|
|
<a name="l227"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l228"></a>
|
|
<a name="l229"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l230"></a>}
|
|
<a name="l231"></a>
|
|
<a name="l232"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>IDEATAReadNativeMax</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>F64</span><span class=cF0> timeout)
|
|
<a name="l233"></a>{</span><span class=cF2>//Returns zero on error</span><span class=cF0>
|
|
<a name="l234"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l235"></a> </span><span class=cF1>Bool</span><span class=cF0> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l236"></a>
|
|
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type == </span><span class=cF3>BDT_ATAPI</span><span class=cF0>)
|
|
<a name="l238"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l239"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l240"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l241"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l242"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l243"></a>
|
|
<a name="l244"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_DEV_RST</span><span class=cF0>);
|
|
<a name="l245"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l246"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l247"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l248"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l249"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l250"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF0>bd->base0 + </span><span class=cF3>ATAR0_STAT</span><span class=cF7>)</span><span class=cF0> & </span><span class=cF3>ATAS_BSY</span><span class=cF0>)
|
|
<a name="l251"></a> {
|
|
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_LAST_WAS_WRITE</span><span class=cF0>)
|
|
<a name="l253"></a> </span><span class=cF5>OutU16</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_DATA</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l254"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l255"></a> </span><span class=cF5>InU16</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_DATA</span><span class=cF0>);
|
|
<a name="l256"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> < timeout < </span><span class=cF5>tS</span><span class=cF0>)
|
|
<a name="l258"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l259"></a> }
|
|
<a name="l260"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAGetDevId</span><span class=cF7>(</span><span class=cF0>bd, timeout, </span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>BDT_NULL</span><span class=cF0>)
|
|
<a name="l261"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l262"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l263"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&bd->flags, </span><span class=cF3>BDf_EXT_SIZE</span><span class=cF0>, </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&bd->dev_id_record[</span><span class=cFE>86</span><span class=cF0>], </span><span class=cFE>10</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l264"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l265"></a> </span><span class=cF1>if</span><span class=cF0> (okay)
|
|
<a name="l266"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l267"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0> && bd->base1)
|
|
<a name="l268"></a> {
|
|
<a name="l269"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base1 + </span><span class=cF3>ATAR1_CTRL</span><span class=cF0>, </span><span class=cFE>0x8</span><span class=cF0>);
|
|
<a name="l270"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l271"></a>
|
|
<a name="l272"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_READ_NATIVE_MAX_EXT</span><span class=cF0>);
|
|
<a name="l273"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, timeout</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l274"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l275"></a> res.u8[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SECT</span><span class=cF0>);
|
|
<a name="l276"></a> res.u8[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>);
|
|
<a name="l277"></a> res.u8[</span><span class=cFE>2</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>);
|
|
<a name="l278"></a>
|
|
<a name="l279"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base1+</span><span class=cF3>ATAR1_CTRL</span><span class=cF0>, </span><span class=cFE>0x80</span><span class=cF0>);
|
|
<a name="l280"></a> res.u8[</span><span class=cFE>3</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SECT</span><span class=cF0>);
|
|
<a name="l281"></a> res.u8[</span><span class=cFE>4</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>);
|
|
<a name="l282"></a> res.u8[</span><span class=cFE>5</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>);
|
|
<a name="l283"></a>
|
|
<a name="l284"></a> </span><span class=cF1>if</span><span class=cF0> (res >> </span><span class=cFE>24</span><span class=cF0> == res & </span><span class=cFE>0xFFFFFF</span><span class=cF0>)
|
|
<a name="l285"></a> {</span><span class=cF2>//Kludge to make QEMU work</span><span class=cF0>
|
|
<a name="l286"></a> bd->flags &= ~</span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>;
|
|
<a name="l287"></a> res &= </span><span class=cFE>0xFFFFFF</span><span class=cF0>;
|
|
<a name="l288"></a> }
|
|
<a name="l289"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l290"></a> }
|
|
<a name="l291"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l292"></a> {
|
|
<a name="l293"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type != </span><span class=cF3>BDT_ATAPI</span><span class=cF0> && bd->base1)
|
|
<a name="l294"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base1 + </span><span class=cF3>ATAR1_CTRL</span><span class=cF0>, </span><span class=cFE>0x8</span><span class=cF0>);
|
|
<a name="l295"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l296"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_READ_NATIVE_MAX</span><span class=cF0>);
|
|
<a name="l297"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, timeout</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l298"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l299"></a> res.u8[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SECT</span><span class=cF0>);
|
|
<a name="l300"></a> res.u8[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>);
|
|
<a name="l301"></a> res.u8[</span><span class=cFE>2</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>);
|
|
<a name="l302"></a> res.u8[</span><span class=cFE>3</span><span class=cF0>] = </span><span class=cF5>InU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>) & </span><span class=cFE>0xF</span><span class=cF0>;
|
|
<a name="l303"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l304"></a> }
|
|
<a name="l305"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l306"></a> </span><span class=cF1>return</span><span class=cF0> bd->max_blk = res;
|
|
<a name="l307"></a>}
|
|
<a name="l308"></a>
|
|
<a name="l309"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>IDEATAPIReadCapacity</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF9>I64</span><span class=cF0> *_blk_size=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l310"></a>{</span><span class=cF2>//Supposedly this can return a res +/- 75 sects.</span><span class=cF0>
|
|
<a name="l311"></a></span><span class=cF2>//Error might just be for music.</span><span class=cF0>
|
|
<a name="l312"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>BlkDevLock</span><span class=cF0>(bd);
|
|
<a name="l313"></a> </span><span class=cF9>U32</span><span class=cF0> buf[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l314"></a>
|
|
<a name="l315"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l316"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l317"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l318"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l319"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l320"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l321"></a>
|
|
<a name="l322"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, </span><span class=cFE>8</span><span class=cF0>);
|
|
<a name="l323"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l324"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l325"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ATAPI_READ_CAPACITY</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l326"></a>
|
|
<a name="l327"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>IDEATAGetRes</span><span class=cF7>(</span><span class=cF0>bd, </span><span class=cFE>0</span><span class=cF0>, buf, </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l328"></a> buf[</span><span class=cFE>0</span><span class=cF0>] = buf[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l329"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l330"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l331"></a> buf[</span><span class=cFE>0</span><span class=cF0>] = buf[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l332"></a>
|
|
<a name="l333"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l334"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(bd);
|
|
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> (_blk_size)
|
|
<a name="l336"></a> *_blk_size = </span><span class=cF5>EndianU32</span><span class=cF0>(buf[</span><span class=cFE>1</span><span class=cF0>]);
|
|
<a name="l337"></a>
|
|
<a name="l338"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>EndianU32</span><span class=cF0>(buf[</span><span class=cFE>0</span><span class=cF0>]);
|
|
<a name="l339"></a>}
|
|
<a name="l340"></a>
|
|
<a name="l341"></a></span><span class=cF9>CATAPITrack</span><span class=cF0> *</span><span class=cFD>IDEATAPIReadTrackInfo</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF9>I64</span><span class=cF0> blk)
|
|
<a name="l342"></a>{
|
|
<a name="l343"></a> </span><span class=cF9>CATAPITrack</span><span class=cF0> *res = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CATAPITrack</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l344"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>BlkDevLock</span><span class=cF0>(bd);
|
|
<a name="l345"></a>
|
|
<a name="l346"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l347"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l349"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l350"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l351"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l352"></a>
|
|
<a name="l353"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CATAPITrack</span><span class=cF7>)</span><span class=cF0> & </span><span class=cFE>0xFF</span><span class=cF0>);
|
|
<a name="l354"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CATAPITrack</span><span class=cF7>)</span><span class=cF0> >> </span><span class=cFE>8</span><span class=cF0>);
|
|
<a name="l355"></a>
|
|
<a name="l356"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l357"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd,
|
|
<a name="l358"></a> </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l359"></a> </span><span class=cF3>ATAPI_READ_TRACK_INFO</span><span class=cF0>,
|
|
<a name="l360"></a> blk.u16[</span><span class=cFE>1</span><span class=cF0>],
|
|
<a name="l361"></a> blk.u16[</span><span class=cFE>0</span><span class=cF0>],
|
|
<a name="l362"></a> </span><span class=cF7>(</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CATAPITrack</span><span class=cF0>) & </span><span class=cFE>0xFF00</span><span class=cF7>)</span><span class=cF0> >> </span><span class=cFE>8</span><span class=cF0>,
|
|
<a name="l363"></a> </span><span class=cF7>(</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CATAPITrack</span><span class=cF0>) & </span><span class=cFE>0x00FF</span><span class=cF7>)</span><span class=cF0> << </span><span class=cFE>8</span><span class=cF0>,
|
|
<a name="l364"></a> </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l365"></a>
|
|
<a name="l366"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>IDEATAGetRes</span><span class=cF7>(</span><span class=cF0>bd, </span><span class=cFE>0</span><span class=cF0>, res, </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CATAPITrack</span><span class=cF0>), </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l367"></a> {
|
|
<a name="l368"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
|
|
<a name="l369"></a> res = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l370"></a> }
|
|
<a name="l371"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l372"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l373"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l374"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
|
|
<a name="l375"></a> res = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l376"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l377"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l378"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(bd);
|
|
<a name="l379"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l380"></a>}
|
|
<a name="l381"></a>
|
|
<a name="l382"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>IDEATAProbe</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> base0, </span><span class=cF9>I64</span><span class=cF0> base1, </span><span class=cF9>I64</span><span class=cF0> unit)
|
|
<a name="l383"></a>{
|
|
<a name="l384"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> bd;
|
|
<a name="l385"></a>
|
|
<a name="l386"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBlkDev</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l387"></a> bd.type = </span><span class=cF3>BDT_ATAPI</span><span class=cF0>;
|
|
<a name="l388"></a> bd.base0 = base0;
|
|
<a name="l389"></a> bd.base1 = base1;
|
|
<a name="l390"></a> bd.unit = unit;
|
|
<a name="l391"></a> bd.blk_size = </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l392"></a>
|
|
<a name="l393"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>IDEATAGetDevId</span><span class=cF0>(&bd, </span><span class=cF5>tS</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l394"></a>}
|
|
<a name="l395"></a>
|
|
<a name="l396"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>IDEATAPISync</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd)
|
|
<a name="l397"></a>{
|
|
<a name="l398"></a> </span><span class=cF1>Bool</span><span class=cF0> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l399"></a>
|
|
<a name="l400"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l401"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l402"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l403"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l404"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l405"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l406"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l407"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l408"></a>
|
|
<a name="l409"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l410"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l411"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l412"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ATAPI_SYNC_CACHE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l413"></a>
|
|
<a name="l414"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF7>(</span><span class=cF0>bd, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l415"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l416"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l417"></a>
|
|
<a name="l418"></a> </span><span class=cF1>return</span><span class=cF0> okay;
|
|
<a name="l419"></a>}
|
|
<a name="l420"></a>
|
|
<a name="l421"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>IDEATAPIClose</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF9>I64</span><span class=cF0> close_field=</span><span class=cFE>0x200</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> track=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l422"></a>{</span><span class=cF2>//0x200 CD/DVD part 1</span><span class=cF0>
|
|
<a name="l423"></a></span><span class=cF2>// 0x300</span><span class=cF0> </span><span class=cF2>DVD part 2</span><span class=cF0>
|
|
<a name="l424"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l425"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l426"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l427"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l428"></a>
|
|
<a name="l429"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l430"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l431"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l432"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ATAPI_CLOSE_TRACK_SESSION</span><span class=cF0>, close_field, track, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l433"></a>
|
|
<a name="l434"></a> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l435"></a>}
|
|
<a name="l436"></a>
|
|
<a name="l437"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>IDEATAPIWriteBlks</span><span class=cF0>(</span><span class=cF9>CBlkDev</span><span class=cF0> *bd, </span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>I64</span><span class=cF0> native_blk, </span><span class=cF9>I64</span><span class=cF0> count)
|
|
<a name="l438"></a>{
|
|
<a name="l439"></a> </span><span class=cF9>I64</span><span class=cF0> U32s_avail;
|
|
<a name="l440"></a> </span><span class=cF1>U8</span><span class=cF0> *buf2;
|
|
<a name="l441"></a>
|
|
<a name="l442"></a> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l443"></a> </span><span class=cFD>IDEATAPISeek</span><span class=cF0>(bd, native_blk);
|
|
<a name="l444"></a>
|
|
<a name="l445"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_FEAT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l446"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, bd->blk_size);
|
|
<a name="l447"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, bd->blk_size.u8[</span><span class=cFE>1</span><span class=cF0>]);
|
|
<a name="l448"></a>
|
|
<a name="l449"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l450"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l451"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l452"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l453"></a>
|
|
<a name="l454"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_CMD</span><span class=cF0>, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l455"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ATAPI_FORMAT_UNIT</span><span class=cF0>, native_blk.u16[</span><span class=cFE>1</span><span class=cF0>], native_blk, count.u16[</span><span class=cFE>1</span><span class=cF0>], count, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l456"></a>
|
|
<a name="l457"></a> bd->flags |= </span><span class=cF3>BDF_LAST_WAS_WRITE</span><span class=cF0>;
|
|
<a name="l458"></a>
|
|
<a name="l459"></a> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l460"></a> </span><span class=cFD>IDEATAPISeek</span><span class=cF0>(bd, native_blk);
|
|
<a name="l461"></a>
|
|
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (bd->flags & </span><span class=cF3>BDF_EXT_SIZE</span><span class=cF0>)
|
|
<a name="l463"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xEF</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l464"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l465"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_SEL</span><span class=cF0>, </span><span class=cFE>0xE0</span><span class=cF0> | bd->unit << </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l466"></a>
|
|
<a name="l467"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF0>, bd->blk_size);
|
|
<a name="l468"></a> </span><span class=cF5>OutU8</span><span class=cF0>(bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF0>, bd->blk_size.u8[</span><span class=cFE>1</span><span class=cF0>]);
|
|
<a name="l469"></a> </span><span class=cFD>IDEATACmd</span><span class=cF0>(bd, </span><span class=cF3>ATA_PACKET</span><span class=cF0>);
|
|
<a name="l470"></a> </span><span class=cFD>IDEATAPIWritePacketWord</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ATAPI_WRITE</span><span class=cF0>, native_blk.u16[</span><span class=cFE>1</span><span class=cF0>], native_blk, count.u16[</span><span class=cFE>1</span><span class=cF0>], count, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l471"></a>
|
|
<a name="l472"></a> buf2 = buf + bd->blk_size * count;
|
|
<a name="l473"></a> </span><span class=cF1>while</span><span class=cF0> (buf < buf2)
|
|
<a name="l474"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l475"></a> </span><span class=cFD>IDEATAWaitDRQ</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l476"></a> U32s_avail = (</span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF0>bd->base0 + </span><span class=cF3>ATAR0_HCYL</span><span class=cF7>)</span><span class=cF0> << </span><span class=cFE>8</span><span class=cF0> + </span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF0>bd->base0 + </span><span class=cF3>ATAR0_LCYL</span><span class=cF7>)</span><span class=cF0>) >> </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l477"></a> </span><span class=cF1>if</span><span class=cF0> (buf + U32s_avail << </span><span class=cFE>2</span><span class=cF0> > buf2)
|
|
<a name="l478"></a> U32s_avail = (buf2-buf) >> </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l479"></a> </span><span class=cF1>if</span><span class=cF0> (U32s_avail)
|
|
<a name="l480"></a> {
|
|
<a name="l481"></a> </span><span class=cF5>RepOutU32</span><span class=cF0>(buf, U32s_avail, bd->base0 + </span><span class=cF3>ATAR0_DATA</span><span class=cF0>);
|
|
<a name="l482"></a> buf += U32s_avail << </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l483"></a> </span><span class=cFB>blkdev</span><span class=cF0>.write_count += U32s_avail >> (</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l484"></a> }
|
|
<a name="l485"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l486"></a> </span><span class=cFD>IDEATAWaitNotBUSY</span><span class=cF0>(bd, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l487"></a>}
|
|
</span></pre></body>
|
|
</html>
|