home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / technical documentation / develop / develop issue 24 / develop issue 24 code / new device drivers / PCI Driver Sample / NCR_DriverProject / Src / DMATransfer.c next >
MacBinary  |  1995-07-24  |  31.1 KB  |  [TEXT/MPCC]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Mon Jul 24 17:34:37 1995, modified Mon Jul 24 17:34:37 1995, creator 'MPCC', type ASCII, 31206 bytes "DMATransfer.c" , at 0x7a66 410 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPCC]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0d 44 4d 41 54 72 61 | 6e 73 66 65 72 2e 63 00 |..DMATra|nsfer.c.|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 43 | 43 01 00 00 00 00 00 00 |.TEXTMPC|C.......|
|00000050| 00 00 00 00 00 79 e6 00 | 00 01 9a ac 39 c2 6d ac |.....y..|....9.m.|
|00000060| 39 c2 6d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |9.m.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 6a 1a 00 00 |........|....j...|
|00000080| 2f 2a 09 09 09 09 09 09 | 09 09 09 44 4d 41 54 72 |/*......|...DMATr|
|00000090| 61 6e 73 66 65 72 2e 63 | 09 09 09 09 09 09 09 09 |ansfer.c|........|
|000000a0| 09 2a 2f 0d 2f 2a 0d 20 | 2a 20 44 4d 41 54 72 61 |.*/./*. |* DMATra|
|000000b0| 6e 73 66 65 72 2e 63 0d | 20 2a 20 43 6f 70 79 72 |nsfer.c.| * Copyr|
|000000c0| 69 67 68 74 20 a9 20 31 | 39 39 35 20 41 70 70 6c |ight . 1|995 Appl|
|000000d0| 65 20 43 6f 6d 70 75 74 | 65 72 20 49 6e 63 2e 20 |e Comput|er Inc. |
|000000e0| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|000000f0| 76 65 64 2e 0d 20 2a 2f | 0d 2f 2a 09 2e 5f 5f 5f |ved.. */|./*..___|
|00000100| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000110| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000120| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000130| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000140| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000150| 2e 0d 20 20 09 7c 20 54 | 68 69 73 20 6c 69 62 72 |.. .| T|his libr|
|00000160| 61 72 79 20 73 69 6d 70 | 6c 69 66 69 65 73 20 75 |ary simp|lifies u|
|00000170| 73 69 6e 67 20 50 72 65 | 70 61 72 65 4d 65 6d 6f |sing Pre|pareMemo|
|00000180| 72 79 46 6f 72 49 4f 20 | 77 69 74 68 20 44 4d 41 |ryForIO |with DMA|
|00000190| 20 61 6e 64 20 6e 6f 6e | 2d 44 4d 41 20 68 61 72 | and non|-DMA har|
|000001a0| 64 77 61 72 65 09 7c 0d | 09 7c 20 64 65 76 69 63 |dware.|.|.| devic|
|000001b0| 65 73 2e 20 54 68 65 73 | 65 20 66 75 6e 63 74 69 |es. Thes|e functi|
|000001c0| 6f 6e 73 20 63 61 6e 20 | 62 65 20 63 61 6c 6c 65 |ons can |be calle|
|000001d0| 64 20 66 72 6f 6d 20 61 | 6e 79 20 69 6e 74 65 72 |d from a|ny inter|
|000001e0| 72 75 70 74 20 6c 65 76 | 65 6c 2e 09 09 09 09 09 |rupt lev|el......|
|000001f0| 7c 0d 09 7c 09 09 09 09 | 09 09 09 09 09 09 09 09 ||..|....|........|
|00000200| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 7c 20 50 72 |........|.|..| Pr|
|00000210| 65 70 61 72 65 44 4d 41 | 54 72 61 6e 73 66 65 72 |epareDMA|Transfer|
|00000220| 20 70 72 65 70 61 72 65 | 73 20 74 68 65 20 6e 65 | prepare|s the ne|
|00000230| 78 74 20 73 65 67 6d 65 | 6e 74 20 28 6c 6f 67 69 |xt segme|nt (logi|
|00000240| 63 61 6c 20 6f 72 20 70 | 68 79 73 69 63 61 6c 29 |cal or p|hysical)|
|00000250| 20 74 68 61 74 20 63 61 | 6e 09 09 7c 0d 09 7c 20 | that ca|n..|..| |
|00000260| 62 65 20 63 6f 6d 70 75 | 74 65 64 20 66 72 6f 6d |be compu|ted from|
|00000270| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 73 74 61 | the cur|rent sta|
|00000280| 74 65 20 6f 66 20 74 68 | 65 20 49 2f 4f 20 74 61 |te of th|e I/O ta|
|00000290| 62 6c 65 2e 20 54 68 65 | 20 63 61 6c 6c 65 72 20 |ble. The| caller |
|000002a0| 6d 75 73 74 20 61 64 61 | 70 74 20 74 68 65 09 7c |must ada|pt the.||
|000002b0| 0d 09 7c 20 72 65 73 75 | 6c 74 20 69 66 20 72 65 |..| resu|lt if re|
|000002c0| 71 75 69 72 65 64 20 6d | 61 78 69 6d 75 6d 20 74 |quired m|aximum t|
|000002d0| 72 61 6e 73 66 65 72 20 | 6c 65 6e 67 74 68 20 6c |ransfer |length l|
|000002e0| 69 6d 69 74 61 74 69 6f | 6e 73 2e 09 09 09 09 09 |imitatio|ns......|
|000002f0| 09 09 7c 0d 09 7c 09 09 | 09 09 09 09 09 09 09 09 |..|..|..|........|
|00000300| 09 09 09 09 09 09 09 09 | 09 09 09 7c 0d 09 7c 20 |........|...|..| |
|00000310| 55 73 61 67 65 3a 09 09 | 09 09 09 09 09 09 09 09 |Usage:..|........|
|00000320| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 7c 09 09 73 |........|.|..|..s|
|00000330| 74 61 74 75 73 20 3d 20 | 50 72 65 70 61 72 65 4d |tatus = |PrepareM|
|00000340| 65 6d 6f 72 79 46 6f 72 | 49 4f 28 26 6d 79 49 4f |emoryFor|IO(&myIO|
|00000350| 54 61 62 6c 65 29 3b 09 | 09 2f 2f 20 44 6f 20 66 |Table);.|.// Do f|
|00000360| 69 72 73 74 20 70 72 65 | 70 61 72 65 09 09 09 7c |irst pre|pare...||
|00000370| 0d 09 7c 09 09 69 66 20 | 28 73 74 61 74 75 73 20 |..|..if |(status |
|00000380| 3d 3d 20 6e 6f 45 72 72 | 29 20 7b 09 09 09 09 09 |== noErr|) {.....|
|00000390| 09 09 2f 2f 20 53 74 61 | 72 74 20 64 6d 61 20 70 |..// Sta|rt dma p|
|000003a0| 72 65 70 61 72 61 74 69 | 6f 6e 09 7c 0d 09 7c 09 |reparati|on.|..|.|
|000003b0| 09 09 73 74 61 74 75 73 | 20 3d 20 49 6e 69 74 69 |..status| = Initi|
|000003c0| 61 6c 69 7a 65 44 4d 41 | 54 72 61 6e 73 66 65 72 |alizeDMA|Transfer|
|000003d0| 28 09 09 09 09 09 09 09 | 09 09 09 09 7c 0d 09 7c |(.......|....|..||
|000003e0| 09 09 09 09 09 09 26 6d | 79 49 4f 54 61 62 6c 65 |......&m|yIOTable|
|000003f0| 2c 09 09 09 09 09 09 09 | 09 09 09 09 09 09 7c 0d |,.......|......|.|
|00000400| 09 7c 09 09 09 09 09 09 | 6d 79 4c 6f 67 69 63 61 |.|......|myLogica|
|00000410| 6c 41 6c 69 67 6e 6d 65 | 6e 74 2c 09 09 09 09 09 |lAlignme|nt,.....|
|00000420| 09 09 09 09 09 09 7c 0d | 09 7c 09 09 09 09 09 09 |......|.|.|......|
|00000430| 26 6d 79 44 4d 41 54 61 | 62 6c 65 09 09 09 09 09 |&myDMATa|ble.....|
|00000440| 09 09 09 09 09 09 09 09 | 7c 0d 09 7c 09 09 09 09 |........||..|....|
|00000450| 09 29 3b 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |.);.....|........|
|00000460| 09 09 09 7c 0d 09 7c 09 | 09 09 77 68 69 6c 65 20 |...|..|.|..while |
|00000470| 28 73 74 61 74 75 73 20 | 3d 3d 20 6e 6f 45 72 72 |(status |== noErr|
|00000480| 29 20 7b 09 09 09 09 09 | 2f 2f 20 53 74 61 72 74 |) {.....|// Start|
|00000490| 20 64 6d 61 20 6f 70 65 | 72 61 74 69 6f 6e 09 09 | dma ope|ration..|
|000004a0| 7c 0d 09 7c 09 09 09 09 | 73 74 61 74 75 73 20 3d ||..|....|status =|
|000004b0| 20 50 72 65 70 61 72 65 | 44 4d 41 54 72 61 6e 73 | Prepare|DMATrans|
|000004c0| 66 65 72 28 09 09 09 09 | 09 09 09 09 09 09 7c 0d |fer(....|......|.|
|000004d0| 09 7c 09 09 09 09 09 09 | 09 26 6d 79 44 4d 41 54 |.|......|.&myDMAT|
|000004e0| 61 62 6c 65 2c 09 09 09 | 09 09 09 09 09 09 09 09 |able,...|........|
|000004f0| 7c 0d 09 7c 09 09 09 09 | 09 09 09 26 6d 79 4e 65 ||..|....|...&myNe|
|00000500| 78 74 54 72 61 6e 73 66 | 65 72 2c 09 09 09 09 09 |xtTransf|er,.....|
|00000510| 09 09 09 09 09 7c 0d 09 | 7c 09 09 09 09 09 09 09 |.....|..||.......|
|00000520| 26 6e 65 78 74 49 73 4c | 6f 67 69 63 61 6c 09 09 |&nextIsL|ogical..|
|00000530| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 7c 09 09 09 |........|.|..|...|
|00000540| 09 09 09 29 3b 09 09 09 | 09 09 09 09 09 09 09 09 |...);...|........|
|00000550| 09 09 09 09 7c 0d 09 7c | 09 09 09 09 69 66 20 28 |....|..||....if (|
|00000560| 73 74 61 74 75 73 20 3d | 3d 20 6e 6f 45 72 72 29 |status =|= noErr)|
|00000570| 20 7b 09 09 09 09 09 09 | 09 09 09 09 09 09 7c 0d | {......|......|.|
|00000580| 09 7c 09 09 09 09 09 69 | 66 20 28 6e 65 78 74 49 |.|.....i|f (nextI|
|00000590| 73 4c 6f 67 69 63 61 6c | 29 09 09 09 09 09 09 09 |sLogical|).......|
|000005a0| 09 09 09 09 09 7c 0d 09 | 7c 09 09 09 09 09 09 44 |.....|..||......D|
|000005b0| 6f 4c 6f 67 69 63 61 6c | 54 72 61 6e 73 66 65 72 |oLogical|Transfer|
|000005c0| 28 26 6d 79 4e 65 78 74 | 54 72 61 6e 73 66 65 72 |(&myNext|Transfer|
|000005d0| 29 3b 09 09 09 09 09 09 | 09 7c 0d 09 7c 09 09 09 |);......|.|..|...|
|000005e0| 09 09 65 6c 73 65 20 7b | 09 09 09 09 09 09 09 09 |..else {|........|
|000005f0| 09 09 09 09 09 09 09 7c | 0d 09 7c 09 09 09 09 09 |.......||..|.....|
|00000600| 09 44 6f 50 68 79 73 69 | 63 61 6c 54 72 61 6e 73 |.DoPhysi|calTrans|
|00000610| 66 65 72 28 26 6d 79 4e | 65 78 74 54 72 61 6e 73 |fer(&myN|extTrans|
|00000620| 66 65 72 29 3b 09 09 09 | 09 09 09 7c 0d 09 7c 09 |fer);...|...|..|.|
|00000630| 09 09 09 09 7d 09 09 09 | 09 09 09 09 09 09 09 09 |....}...|........|
|00000640| 09 09 09 09 09 7c 0d 09 | 7c 09 09 09 09 7d 20 2f |.....|..||....} /|
|00000650| 2f 20 46 6f 72 20 61 6c | 6c 20 44 4d 41 20 73 65 |/ For al|l DMA se|
|00000660| 67 6d 65 6e 74 73 20 66 | 6f 72 20 74 68 69 73 20 |gments f|or this |
|00000670| 70 72 65 70 61 72 61 74 | 69 6f 6e 2e 09 09 09 09 |preparat|ion.....|
|00000680| 09 09 7c 0d 09 7c 09 09 | 09 7d 20 2f 2f 20 77 68 |..|..|..|.} // wh|
|00000690| 69 6c 65 20 74 68 65 72 | 65 20 69 73 20 64 61 74 |ile ther|e is dat|
|000006a0| 61 20 74 6f 20 74 72 61 | 6e 73 6d 69 74 09 09 09 |a to tra|nsmit...|
|000006b0| 09 09 09 09 09 09 7c 0d | 09 7c 09 09 7d 20 2f 2f |......|.|.|..} //|
|000006c0| 20 69 66 20 50 72 65 70 | 61 72 65 4d 65 6d 6f 72 | if Prep|areMemor|
|000006d0| 79 46 6f 72 49 4f 20 73 | 75 63 63 65 65 64 65 64 |yForIO s|ucceeded|
|000006e0| 09 09 09 09 09 09 09 09 | 09 09 7c 0d 09 2e 5f 5f |........|..|...__|
|000006f0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000700| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000710| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000720| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000730| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000740| 5f 2e 0d 20 2a 2f 0d 0d | 23 69 6e 63 6c 75 64 65 |_.. */..|#include|
|00000750| 20 22 44 4d 41 54 72 61 | 6e 73 66 65 72 2e 68 22 | "DMATra|nsfer.h"|
|00000760| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 44 72 69 76 65 |.#includ|e <Drive|
|00000770| 72 53 65 72 76 69 63 65 | 73 2e 68 3e 0d 0d 23 69 |rService|s.h>..#i|
|00000780| 66 6e 64 65 66 20 46 41 | 4c 53 45 0d 23 64 65 66 |fndef FA|LSE.#def|
|00000790| 69 6e 65 20 46 41 4c 53 | 45 09 30 0d 23 64 65 66 |ine FALS|E.0.#def|
|000007a0| 69 6e 65 20 54 52 55 45 | 09 31 0d 23 65 6e 64 69 |ine TRUE|.1.#endi|
|000007b0| 66 0d 23 64 65 66 69 6e | 65 20 44 4d 41 09 09 28 |f.#defin|e DMA..(|
|000007c0| 2a 64 6d 61 54 61 62 6c | 65 50 74 72 29 0d 23 64 |*dmaTabl|ePtr).#d|
|000007d0| 65 66 69 6e 65 20 49 4f | 09 09 28 2a 69 6f 54 61 |efine IO|..(*ioTa|
|000007e0| 62 6c 65 50 74 72 29 0d | 73 74 61 74 69 63 20 55 |blePtr).|static U|
|000007f0| 49 6e 74 33 32 09 09 67 | 50 61 67 65 53 69 7a 65 |Int32..g|PageSize|
|00000800| 3b 09 09 09 09 09 2f 2a | 20 47 65 74 4c 6f 67 69 |;...../*| GetLogi|
|00000810| 63 61 6c 50 61 67 65 53 | 69 7a 65 28 29 09 09 09 |calPageS|ize()...|
|00000820| 09 2a 2f 0d 73 74 61 74 | 69 63 20 55 49 6e 74 33 |.*/.stat|ic UInt3|
|00000830| 32 09 09 67 50 61 67 65 | 4d 61 73 6b 3b 09 09 09 |2..gPage|Mask;...|
|00000840| 09 09 2f 2a 20 70 61 67 | 65 53 69 7a 65 20 2d 20 |../* pag|eSize - |
|00000850| 31 09 09 09 09 09 09 2a | 2f 0d 0d 73 74 61 74 69 |1......*|/..stati|
|00000860| 63 20 76 6f 69 64 09 09 | 09 09 09 43 6f 6d 70 75 |c void..|...Compu|
|00000870| 74 65 54 68 69 73 41 72 | 65 61 28 0d 09 09 44 4d |teThisAr|ea(...DM|
|00000880| 41 54 72 61 6e 73 66 65 | 72 49 6e 66 6f 50 74 72 |ATransfe|rInfoPtr|
|00000890| 09 09 64 6d 61 54 61 62 | 6c 65 50 74 72 0d 09 29 |..dmaTab|lePtr..)|
|000008a0| 3b 0d 73 74 61 74 69 63 | 20 4f 53 53 74 61 74 75 |;.static| OSStatu|
|000008b0| 73 09 09 09 09 47 65 74 | 4e 65 78 74 53 65 67 6d |s....Get|NextSegm|
|000008c0| 65 6e 74 28 0d 09 09 44 | 4d 41 54 72 61 6e 73 66 |ent(...D|MATransf|
|000008d0| 65 72 49 6e 66 6f 50 74 | 72 09 09 64 6d 61 54 61 |erInfoPt|r..dmaTa|
|000008e0| 62 6c 65 50 74 72 0d 09 | 29 3b 0d 73 74 61 74 69 |blePtr..|);.stati|
|000008f0| 63 20 42 6f 6f 6c 65 61 | 6e 09 09 09 09 47 65 74 |c Boolea|n....Get|
|00000900| 4e 65 78 74 50 68 79 73 | 69 63 61 6c 54 72 61 6e |NextPhys|icalTran|
|00000910| 73 66 65 72 28 0d 09 09 | 44 4d 41 54 72 61 6e 73 |sfer(...|DMATrans|
|00000920| 66 65 72 49 6e 66 6f 50 | 74 72 09 09 64 6d 61 54 |ferInfoP|tr..dmaT|
|00000930| 61 62 6c 65 50 74 72 0d | 09 29 3b 0d 0d 23 69 66 |ablePtr.|.);..#if|
|00000940| 6e 64 65 66 20 54 45 53 | 54 49 4e 47 0d 23 64 65 |ndef TES|TING.#de|
|00000950| 66 69 6e 65 20 54 45 53 | 54 49 4e 47 09 30 0d 23 |fine TES|TING.0.#|
|00000960| 65 6e 64 69 66 0d 23 69 | 66 20 54 45 53 54 49 4e |endif.#i|f TESTIN|
|00000970| 47 0d 23 69 6e 63 6c 75 | 64 65 20 3c 73 74 64 69 |G.#inclu|de <stdi|
|00000980| 6f 2e 68 3e 0d 23 64 65 | 66 69 6e 65 20 4c 4f 47 |o.h>.#de|fine LOG|
|00000990| 28 77 68 61 74 29 09 70 | 72 69 6e 74 66 20 77 68 |(what).p|rintf wh|
|000009a0| 61 74 0d 23 65 6c 73 65 | 0d 23 64 65 66 69 6e 65 |at.#else|.#define|
|000009b0| 20 4c 4f 47 28 77 68 61 | 74 29 09 2f 2a 20 4e 6f | LOG(wha|t)./* No|
|000009c0| 74 68 69 6e 67 20 2a 2f | 0d 23 65 6e 64 69 66 0d |thing */|.#endif.|
|000009d0| 0d 2f 2a 09 2e 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |./*..___|________|
|000009e0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000009f0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000a00| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000a10| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00000a20| 5f 5f 5f 5f 5f 5f 5f 5f | 2e 0d 20 20 09 7c 20 49 |________|.. .| I|
|00000a30| 6e 69 74 69 61 6c 69 7a | 65 44 4d 41 54 72 61 6e |nitializ|eDMATran|
|00000a40| 73 66 65 72 09 09 09 09 | 09 09 09 09 09 09 09 09 |sfer....|........|
|00000a50| 09 09 09 09 7c 0d 09 7c | 09 09 09 09 09 09 09 09 |....|..||........|
|00000a60| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 7c 0d 09 |........|.....|..|
|00000a70| 7c 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 74 68 65 || Initia|lize the|
|00000a80| 20 44 4d 41 54 72 61 6e | 73 66 65 72 49 6e 66 6f | DMATran|sferInfo|
|00000a90| 20 72 65 63 6f 72 64 2e | 09 09 09 09 09 09 09 09 | record.|........|
|00000aa0| 09 09 09 7c 0d 09 7c 20 | 49 6e 70 75 74 3a 09 09 |...|..| |Input:..|
|00000ab0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00000ac0| 09 7c 0d 09 7c 09 69 6f | 54 61 62 6c 65 09 09 09 |.|..|.io|Table...|
|00000ad0| 09 54 68 65 20 70 72 65 | 70 61 72 65 64 20 49 2f |.The pre|pared I/|
|00000ae0| 4f 20 50 72 65 70 61 72 | 61 74 69 6f 6e 20 74 61 |O Prepar|ation ta|
|00000af0| 62 6c 65 2e 20 49 74 20 | 69 73 20 22 72 65 61 64 |ble. It |is "read|
|00000b00| 79 20 74 6f 20 72 75 6e | 22 09 7c 0d 09 7c 09 6c |y to run|".|..|.l|
|00000b10| 6f 67 69 63 61 6c 47 72 | 61 6e 75 6c 61 72 69 74 |ogicalGr|anularit|
|00000b20| 79 09 54 68 69 73 20 69 | 73 20 61 20 70 6f 77 65 |y.This i|s a powe|
|00000b30| 72 20 6f 66 20 74 77 6f | 20 74 68 61 74 20 69 73 |r of two| that is|
|00000b40| 20 75 73 65 64 20 74 6f | 20 67 72 6f 75 70 20 74 | used to| group t|
|00000b50| 68 65 20 74 72 61 6e 73 | 66 65 72 09 7c 0d 09 7c |he trans|fer.|..||
|00000b60| 09 09 09 09 09 09 69 6e | 74 6f 20 6c 6f 67 69 63 |......in|to logic|
|00000b70| 61 6c 20 61 6e 64 20 70 | 68 79 73 69 63 61 6c 20 |al and p|hysical |
|00000b80| 73 65 67 6d 65 6e 74 73 | 2e 20 49 66 20 7a 65 72 |segments|. If zer|
|00000b90| 6f 2c 20 6f 6e 6c 79 20 | 70 68 79 73 69 63 61 6c |o, only |physical|
|00000ba0| 09 7c 0d 09 7c 09 09 09 | 09 09 09 74 72 61 6e 73 |.|..|...|...trans|
|00000bb0| 66 65 72 73 20 77 69 6c | 6c 20 62 65 20 72 65 70 |fers wil|l be rep|
|00000bc0| 6f 72 74 65 64 2e 20 49 | 66 20 6f 6e 65 20 61 6e |orted. I|f one an|
|00000bd0| 64 20 61 20 6c 6f 67 69 | 63 61 6c 20 73 65 67 6d |d a logi|cal segm|
|00000be0| 65 6e 74 09 7c 0d 09 7c | 09 09 09 09 09 09 62 65 |ent.|..||......be|
|00000bf0| 67 69 6e 73 20 6f 6e 20 | 61 6e 20 6f 64 64 2d 62 |gins on |an odd-b|
|00000c00| 79 74 65 20 62 6f 75 6e | 64 61 72 79 2c 20 50 72 |yte boun|dary, Pr|
|00000c10| 65 70 61 72 65 44 4d 41 | 54 72 61 6e 73 66 65 72 |epareDMA|Transfer|
|00000c20| 20 77 69 6c 6c 09 09 7c | 0d 09 7c 09 09 09 09 09 | will..||..|.....|
|00000c30| 09 72 65 74 75 72 6e 20 | 61 20 6f 6e 65 2d 62 79 |.return |a one-by|
|00000c40| 74 65 20 6c 6f 67 69 63 | 61 6c 20 74 72 61 6e 73 |te logic|al trans|
|00000c50| 66 65 72 2c 20 74 68 65 | 6e 20 6f 6e 65 20 6f 72 |fer, the|n one or|
|00000c60| 20 6d 6f 72 65 09 09 7c | 0d 09 7c 09 09 09 09 09 | more..||..|.....|
|00000c70| 09 70 68 79 73 69 63 61 | 6c 20 74 72 61 6e 73 66 |.physica|l transf|
|00000c80| 65 72 73 20 74 68 65 6e | 2c 20 69 66 20 6e 65 63 |ers then|, if nec|
|00000c90| 65 73 73 61 72 79 2c 20 | 61 20 6f 6e 65 2d 62 79 |essary, |a one-by|
|00000ca0| 74 65 20 6c 6f 67 69 63 | 61 6c 09 7c 0d 09 7c 09 |te logic|al.|..|.|
|00000cb0| 09 09 09 09 09 74 72 61 | 6e 73 66 65 72 2e 09 09 |.....tra|nsfer...|
|00000cc0| 09 09 09 09 09 09 09 09 | 09 09 09 7c 0d 09 7c 09 |........|...|..|.|
|00000cd0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00000ce0| 09 09 09 09 7c 0d 09 7c | 20 4f 75 74 70 75 74 3a |....|..|| Output:|
|00000cf0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00000d00| 09 09 09 7c 0d 09 7c 09 | 64 6d 61 54 61 62 6c 65 |...|..|.|dmaTable|
|00000d10| 50 74 72 09 09 09 54 68 | 65 20 44 4d 41 54 72 61 |Ptr...Th|e DMATra|
|00000d20| 6e 73 66 65 72 49 6e 66 | 6f 20 72 65 63 6f 72 64 |nsferInf|o record|
|00000d30| 20 74 68 61 74 20 77 69 | 6c 6c 20 6d 61 6e 61 67 | that wi|ll manag|
|00000d40| 65 20 74 68 69 73 20 74 | 72 61 6e 73 66 65 72 2e |e this t|ransfer.|
|00000d50| 09 7c 0d 09 7c 09 09 09 | 09 09 09 09 09 09 09 09 |.|..|...|........|
|00000d60| 09 09 09 09 09 09 09 09 | 09 09 7c 0d 09 7c 20 52 |........|..|..| R|
|00000d70| 65 73 75 6c 74 3a 09 09 | 09 09 09 09 09 09 09 09 |esult:..|........|
|00000d80| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 7c 09 6e 6f |........|.|..|.no|
|00000d90| 45 72 72 09 09 09 09 4e | 6f 72 6d 61 6c 2e 09 09 |Err....N|ormal...|
|00000da0| 09 09 09 09 09 09 09 09 | 09 09 09 09 7c 0d 09 7c |........|....|..||
|00000db0| 09 70 61 72 61 6d 45 72 | 72 09 09 09 42 61 64 20 |.paramEr|r...Bad |
|00000dc0| 70 61 72 61 6d 65 74 65 | 72 73 20 28 69 6f 54 61 |paramete|rs (ioTa|
|00000dd0| 62 6c 65 20 6f 72 20 64 | 6d 61 54 61 62 6c 65 50 |ble or d|maTableP|
|00000de0| 74 72 20 61 72 65 20 4e | 55 4c 4c 20 6f 72 20 61 |tr are N|ULL or a|
|00000df0| 6e 20 65 72 72 6f 72 09 | 7c 0d 09 7c 09 09 09 09 |n error.||..|....|
|00000e00| 09 09 69 6e 20 74 68 65 | 20 49 4f 54 61 62 6c 65 |..in the| IOTable|
|00000e10| 20 70 61 72 61 6d 65 74 | 65 72 73 29 2e 09 09 09 | paramet|ers)....|
|00000e20| 09 09 09 09 09 09 7c 0d | 09 7c 09 09 09 09 09 09 |......|.|.|......|
|00000e30| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 7c |........|.......||
|00000e40| 0d 09 7c 20 53 65 74 20 | 74 68 65 20 49 4f 54 61 |..| Set |the IOTa|
|00000e50| 62 6c 65 20 70 61 72 61 | 6d 65 74 65 72 20 62 6c |ble para|meter bl|
|00000e60| 6f 63 6b 20 61 73 20 66 | 6f 6c 6c 6f 77 73 3a 09 |ock as f|ollows:.|
|00000e70| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 7c 09 6c 6f |........|.|..|.lo|
|00000e80| 67 69 63 61 6c 4d 61 70 | 70 69 6e 67 09 09 52 65 |gicalMap|ping..Re|
|00000e90| 71 75 69 72 65 64 09 09 | 09 09 09 09 09 09 09 09 |quired..|........|
|00000ea0| 09 09 09 7c 0d 09 7c 09 | 70 68 79 73 69 63 61 6c |...|..|.|physical|
|00000eb0| 4d 61 70 70 69 6e 67 09 | 09 52 65 71 75 69 72 65 |Mapping.|.Require|
|00000ec0| 64 2e 09 09 09 09 09 09 | 09 09 09 09 09 09 09 7c |d.......|.......||
|00000ed0| 0d 09 7c 09 6d 61 70 70 | 69 6e 67 45 6e 74 72 79 |..|.mapp|ingEntry|
|00000ee0| 43 6f 75 6e 74 09 3e 20 | 30 09 09 09 09 09 09 09 |Count.> |0.......|
|00000ef0| 09 09 09 09 09 09 09 09 | 7c 0d 09 7c 09 6f 70 74 |........||..|.opt|
|00000f00| 69 6f 6e 73 3a 09 09 09 | 09 09 09 09 09 09 09 09 |ions:...|........|
|00000f10| 09 09 09 09 09 09 09 7c | 0d 09 7c 09 09 6b 49 4f |.......||..|..kIO|
|00000f20| 4c 6f 67 69 63 61 6c 52 | 61 6e 67 65 73 09 09 09 |LogicalR|anges...|
|00000f30| 52 65 71 75 69 72 65 64 | 20 69 66 20 6e 6f 6e 2d |Required| if non-|
|00000f40| 7a 65 72 6f 20 6c 6f 67 | 69 63 61 6c 20 67 72 61 |zero log|ical gra|
|00000f50| 6e 75 6c 61 72 69 74 79 | 2e 09 09 7c 0d 09 7c 09 |nularity|...|..|.|
|00000f60| 09 6b 49 4f 4d 69 6e 69 | 6d 61 6c 4c 6f 67 69 63 |.kIOMini|malLogic|
|00000f70| 61 6c 4d 61 70 70 69 6e | 67 09 52 65 71 75 69 72 |alMappin|g.Requir|
|00000f80| 65 64 20 69 66 20 6e 6f | 6e 2d 7a 65 72 6f 20 6c |ed if no|n-zero l|
|00000f90| 6f 67 69 63 61 6c 20 67 | 72 61 6e 75 6c 61 72 69 |ogical g|ranulari|
|00000fa0| 74 79 2e 09 09 7c 0d 09 | 7c 09 09 6b 49 4f 49 73 |ty...|..||..kIOIs|
|00000fb0| 49 6e 70 75 74 20 6f 72 | 20 6b 49 4f 49 73 4f 75 |Input or| kIOIsOu|
|00000fc0| 74 70 75 74 09 4f 6e 65 | 20 69 73 20 72 65 71 75 |tput.One| is requ|
|00000fd0| 69 72 65 64 09 09 09 09 | 09 09 09 09 09 7c 0d 09 |ired....|.....|..|
|00000fe0| 2e 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |._______|________|
|00000ff0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001000| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001010| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001020| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001030| 5f 5f 5f 5f 2e 0d 20 2a | 2f 0d 4f 53 53 74 61 74 |____.. *|/.OSStat|
|00001040| 75 73 0d 49 6e 69 74 69 | 61 6c 69 7a 65 44 4d 41 |us.Initi|alizeDMA|
|00001050| 54 72 61 6e 73 66 65 72 | 28 0d 09 09 63 6f 6e 73 |Transfer|(...cons|
|00001060| 74 20 49 4f 50 72 65 70 | 61 72 61 74 69 6f 6e 54 |t IOPrep|arationT|
|00001070| 61 62 6c 65 20 2a 69 6f | 54 61 62 6c 65 50 74 72 |able *io|TablePtr|
|00001080| 2c 0d 09 09 55 49 6e 74 | 33 32 09 09 09 09 09 6c |,...UInt|32.....l|
|00001090| 6f 67 69 63 61 6c 41 6c | 69 67 6e 6d 65 6e 74 2c |ogicalAl|ignment,|
|000010a0| 0d 09 09 44 4d 41 54 72 | 61 6e 73 66 65 72 49 6e |...DMATr|ansferIn|
|000010b0| 66 6f 50 74 72 09 09 64 | 6d 61 54 61 62 6c 65 50 |foPtr..d|maTableP|
|000010c0| 74 72 0d 09 29 0d 7b 0d | 09 09 4f 53 53 74 61 74 |tr..).{.|..OSStat|
|000010d0| 75 73 09 09 09 09 6f 73 | 53 74 61 74 75 73 3b 0d |us....os|Status;.|
|000010e0| 09 09 55 49 6e 74 33 32 | 09 09 09 09 09 61 6c 69 |..UInt32|.....ali|
|000010f0| 67 6e 6d 65 6e 74 4d 61 | 73 6b 3b 0d 0d 09 09 69 |gnmentMa|sk;....i|
|00001100| 66 20 28 67 50 61 67 65 | 53 69 7a 65 20 3d 3d 20 |f (gPage|Size == |
|00001110| 30 29 20 7b 0d 09 09 09 | 67 50 61 67 65 53 69 7a |0) {....|gPageSiz|
|00001120| 65 20 3d 20 47 65 74 4c | 6f 67 69 63 61 6c 50 61 |e = GetL|ogicalPa|
|00001130| 67 65 53 69 7a 65 28 29 | 3b 0d 09 09 09 67 50 61 |geSize()|;....gPa|
|00001140| 67 65 4d 61 73 6b 20 3d | 20 67 50 61 67 65 53 69 |geMask =| gPageSi|
|00001150| 7a 65 20 2d 20 31 3b 0d | 09 09 7d 0d 09 09 6f 73 |ze - 1;.|..}...os|
|00001160| 53 74 61 74 75 73 20 3d | 20 6e 6f 45 72 72 3b 0d |Status =| noErr;.|
|00001170| 09 09 61 6c 69 67 6e 6d | 65 6e 74 4d 61 73 6b 20 |..alignm|entMask |
|00001180| 3d 20 6c 6f 67 69 63 61 | 6c 41 6c 69 67 6e 6d 65 |= logica|lAlignme|
|00001190| 6e 74 20 2d 20 31 3b 0d | 09 09 69 66 20 28 69 6f |nt - 1;.|..if (io|
|000011a0| 54 61 62 6c 65 50 74 72 | 20 3d 3d 20 4e 55 4c 4c |TablePtr| == NULL|
|000011b0| 0d 09 09 20 7c 7c 20 64 | 6d 61 54 61 62 6c 65 50 |... || d|maTableP|
|000011c0| 74 72 20 3d 3d 20 4e 55 | 4c 4c 0d 09 09 20 7c 7c |tr == NU|LL... |||
|000011d0| 20 69 6f 54 61 62 6c 65 | 50 74 72 2d 3e 70 68 79 | ioTable|Ptr->phy|
|000011e0| 73 69 63 61 6c 4d 61 70 | 70 69 6e 67 20 3d 3d 20 |sicalMap|ping == |
|000011f0| 4e 55 4c 4c 0d 09 09 20 | 7c 7c 20 69 6f 54 61 62 |NULL... ||| ioTab|
|00001200| 6c 65 50 74 72 2d 3e 6d | 61 70 70 69 6e 67 45 6e |lePtr->m|appingEn|
|00001210| 74 72 79 43 6f 75 6e 74 | 20 3d 3d 20 30 0d 09 09 |tryCount| == 0...|
|00001220| 20 7c 7c 20 69 6f 54 61 | 62 6c 65 50 74 72 2d 3e | || ioTa|blePtr->|
|00001230| 6c 65 6e 67 74 68 50 72 | 65 70 61 72 65 64 20 3d |lengthPr|epared =|
|00001240| 3d 20 30 29 20 7b 0d 09 | 09 09 4c 4f 47 28 28 22 |= 0) {..|..LOG(("|
|00001250| 49 6e 69 74 69 61 6c 44 | 4d 41 54 72 61 6e 73 66 |InitialD|MATransf|
|00001260| 65 72 3a 20 6d 69 73 73 | 69 6e 67 20 70 61 72 61 |er: miss|ing para|
|00001270| 6d 65 74 65 72 20 6f 72 | 20 49 4f 50 72 65 70 61 |meter or| IOPrepa|
|00001280| 72 61 74 69 6f 6e 54 61 | 62 6c 65 20 65 72 72 6f |rationTa|ble erro|
|00001290| 72 5c 6e 22 29 29 3b 0d | 09 09 09 6f 73 53 74 61 |r\n"));.|...osSta|
|000012a0| 74 75 73 20 3d 20 70 61 | 72 61 6d 45 72 72 3b 0d |tus = pa|ramErr;.|
|000012b0| 09 09 7d 0d 09 09 65 6c | 73 65 20 69 66 20 28 28 |..}...el|se if ((|
|000012c0| 6c 6f 67 69 63 61 6c 41 | 6c 69 67 6e 6d 65 6e 74 |logicalA|lignment|
|000012d0| 20 26 20 7e 28 2d 6c 6f | 67 69 63 61 6c 41 6c 69 | & ~(-lo|gicalAli|
|000012e0| 67 6e 6d 65 6e 74 29 29 | 20 21 3d 20 30 29 20 7b |gnment))| != 0) {|
|000012f0| 0d 09 09 09 4c 4f 47 28 | 28 22 49 6e 69 74 69 61 |....LOG(|("Initia|
|00001300| 6c 69 7a 65 44 4d 41 54 | 72 61 6e 73 66 65 72 3a |lizeDMAT|ransfer:|
|00001310| 20 6c 6f 67 69 63 61 6c | 41 6c 69 67 6d 65 6e 74 | logical|Aligment|
|00001320| 20 25 6c 75 20 6d 75 73 | 74 20 62 65 20 70 6f 77 | %lu mus|t be pow|
|00001330| 65 72 20 6f 66 20 32 5c | 6e 22 2c 0d 09 09 09 09 |er of 2\|n",.....|
|00001340| 09 6c 6f 67 69 63 61 6c | 41 6c 69 67 6e 6d 65 6e |.logical|Alignmen|
|00001350| 74 29 29 3b 0d 09 09 09 | 6f 73 53 74 61 74 75 73 |t));....|osStatus|
|00001360| 20 3d 20 70 61 72 61 6d | 45 72 72 3b 0d 09 09 7d | = param|Err;...}|
|00001370| 0d 09 09 65 6c 73 65 20 | 69 66 20 28 6c 6f 67 69 |...else |if (logi|
|00001380| 63 61 6c 41 6c 69 67 6e | 6d 65 6e 74 20 3e 3d 20 |calAlign|ment >= |
|00001390| 67 50 61 67 65 53 69 7a | 65 29 20 7b 0d 09 09 09 |gPageSiz|e) {....|
|000013a0| 4c 4f 47 28 28 22 49 6e | 69 74 69 61 6c 69 7a 65 |LOG(("In|itialize|
|000013b0| 44 4d 41 54 72 61 6e 73 | 66 65 72 3a 20 6c 6f 67 |DMATrans|fer: log|
|000013c0| 69 63 61 6c 41 6c 69 67 | 6d 65 6e 74 20 25 6c 75 |icalAlig|ment %lu|
|000013d0| 20 6d 75 73 74 20 62 65 | 20 3c 20 70 61 67 65 20 | must be| < page |
|000013e0| 73 69 7a 65 20 25 6c 75 | 5c 6e 22 2c 0d 09 09 09 |size %lu|\n",....|
|000013f0| 09 09 6c 6f 67 69 63 61 | 6c 41 6c 69 67 6e 6d 65 |..logica|lAlignme|
|00001400| 6e 74 2c 20 67 50 61 67 | 65 53 69 7a 65 29 29 3b |nt, gPag|eSize));|
|00001410| 0d 09 09 09 6f 73 53 74 | 61 74 75 73 20 3d 20 70 |....osSt|atus = p|
|00001420| 61 72 61 6d 45 72 72 3b | 0d 09 09 7d 0d 09 09 65 |aramErr;|...}...e|
|00001430| 6c 73 65 20 69 66 20 28 | 28 69 6f 54 61 62 6c 65 |lse if (|(ioTable|
|00001440| 50 74 72 2d 3e 6f 70 74 | 69 6f 6e 73 20 26 20 6b |Ptr->opt|ions & k|
|00001450| 49 4f 4c 6f 67 69 63 61 | 6c 52 61 6e 67 65 73 29 |IOLogica|lRanges)|
|00001460| 20 21 3d 20 30 0d 09 09 | 09 20 20 26 26 20 28 69 | != 0...|. && (i|
|00001470| 6f 54 61 62 6c 65 50 74 | 72 2d 3e 6c 6f 67 69 63 |oTablePt|r->logic|
|00001480| 61 6c 4d 61 70 70 69 6e | 67 20 3d 3d 20 4e 55 4c |alMappin|g == NUL|
|00001490| 4c 0d 09 09 09 20 20 20 | 7c 7c 20 28 69 6f 54 61 |L.... ||| (ioTa|
|000014a0| 62 6c 65 50 74 72 2d 3e | 6f 70 74 69 6f 6e 73 20 |blePtr->|options |
|000014b0| 26 20 6b 49 4f 4d 69 6e | 69 6d 61 6c 4c 6f 67 69 |& kIOMin|imalLogi|
|000014c0| 63 61 6c 4d 61 70 70 69 | 6e 67 29 20 3d 3d 20 30 |calMappi|ng) == 0|
|000014d0| 29 29 20 7b 0d 09 09 09 | 4c 4f 47 28 28 22 49 6e |)) {....|LOG(("In|
|000014e0| 69 74 69 61 6c 69 7a 65 | 44 4d 41 54 72 61 6e 73 |itialize|DMATrans|
|000014f0| 66 65 72 3a 20 6c 6f 67 | 69 63 61 6c 20 74 72 61 |fer: log|ical tra|
|00001500| 6e 73 66 65 72 20 72 65 | 71 75 69 72 65 73 20 6c |nsfer re|quires l|
|00001510| 6f 67 69 63 61 6c 20 6d | 61 70 70 69 6e 67 5c 6e |ogical m|apping\n|
|00001520| 22 29 29 3b 0d 09 09 09 | 6f 73 53 74 61 74 75 73 |"));....|osStatus|
|00001530| 20 3d 20 70 61 72 61 6d | 45 72 72 3b 0d 09 09 7d | = param|Err;...}|
|00001540| 0d 09 09 65 6c 73 65 20 | 69 66 20 28 28 69 6f 54 |...else |if ((ioT|
|00001550| 61 62 6c 65 50 74 72 2d | 3e 6f 70 74 69 6f 6e 73 |ablePtr-|>options|
|00001560| 20 26 20 6b 49 4f 4c 6f | 67 69 63 61 6c 52 61 6e | & kIOLo|gicalRan|
|00001570| 67 65 73 29 20 3d 3d 20 | 30 0d 09 09 09 20 20 26 |ges) == |0.... &|
|00001580| 26 20 6c 6f 67 69 63 61 | 6c 41 6c 69 67 6e 6d 65 |& logica|lAlignme|
|00001590| 6e 74 20 21 3d 20 30 0d | 09 09 09 20 20 26 26 20 |nt != 0.|... && |
|000015a0| 28 28 28 28 55 49 6e 74 | 33 32 29 20 69 6f 54 61 |((((UInt|32) ioTa|
|000015b0| 62 6c 65 50 74 72 2d 3e | 70 68 79 73 69 63 61 6c |blePtr->|physical|
|000015c0| 4d 61 70 70 69 6e 67 5b | 30 5d 29 20 26 20 61 6c |Mapping[|0]) & al|
|000015d0| 69 67 6e 6d 65 6e 74 4d | 61 73 6b 29 20 21 3d 20 |ignmentM|ask) != |
|000015e0| 30 0d 09 09 09 09 7c 7c | 20 28 69 6f 54 61 62 6c |0.....||| (ioTabl|
|000015f0| 65 50 74 72 2d 3e 6c 65 | 6e 67 74 68 50 72 65 70 |ePtr->le|ngthPrep|
|00001600| 61 72 65 64 20 26 20 61 | 6c 69 67 6e 6d 65 6e 74 |ared & a|lignment|
|00001610| 4d 61 73 6b 29 20 21 3d | 20 30 29 29 20 7b 0d 09 |Mask) !=| 0)) {..|
|00001620| 09 09 4c 4f 47 28 28 22 | 49 6e 69 74 69 61 6c 69 |..LOG(("|Initiali|
|00001630| 7a 65 44 4d 41 54 72 61 | 6e 73 66 65 72 3a 20 75 |zeDMATra|nsfer: u|
|00001640| 6e 61 6c 69 67 6e 65 64 | 20 70 68 79 73 69 63 61 |naligned| physica|
|00001650| 6c 20 74 72 61 6e 73 66 | 65 72 5c 6e 22 29 29 3b |l transf|er\n"));|
|00001660| 0d 09 09 09 6f 73 53 74 | 61 74 75 73 20 3d 20 70 |....osSt|atus = p|
|00001670| 61 72 61 6d 45 72 72 3b | 0d 09 09 7d 0d 09 09 65 |aramErr;|...}...e|
|00001680| 6c 73 65 20 7b 0d 09 09 | 09 2f 2a 0d 09 09 09 20 |lse {...|./*.... |
|00001690| 2a 20 53 65 74 75 70 20 | 6f 75 72 20 70 72 69 76 |* Setup |our priv|
|000016a0| 61 74 65 20 67 6c 6f 62 | 61 6c 73 20 61 6e 64 20 |ate glob|als and |
|000016b0| 63 61 6c 6c 20 47 65 74 | 4e 65 78 74 53 65 67 6d |call Get|NextSegm|
|000016c0| 65 6e 74 20 74 6f 20 63 | 6f 6d 70 75 74 65 20 74 |ent to c|ompute t|
|000016d0| 68 65 20 66 69 72 73 74 | 0d 09 09 09 20 2a 20 28 |he first|.... * (|
|000016e0| 6f 72 20 6f 6e 6c 79 29 | 20 74 72 61 6e 73 66 65 |or only)| transfe|
|000016f0| 72 20 73 65 67 6d 65 6e | 74 2e 20 57 65 20 63 61 |r segmen|t. We ca|
|00001700| 6c 6c 20 69 74 20 68 65 | 72 65 20 61 73 20 74 68 |ll it he|re as th|
|00001710| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 69 73 20 70 |is funct|ion is p|
|00001720| 72 6f 62 61 62 6c 79 0d | 09 09 09 20 2a 20 62 65 |robably.|... * be|
|00001730| 69 6e 67 20 63 61 6c 6c | 65 64 20 61 74 20 22 74 |ing call|ed at "t|
|00001740| 61 73 6b 22 20 63 6f 6e | 74 65 78 74 20 61 6e 64 |ask" con|text and|
|00001750| 2c 20 66 6f 72 20 73 69 | 6d 70 6c 65 20 74 72 61 |, for si|mple tra|
|00001760| 6e 73 66 65 72 73 2c 20 | 77 65 20 77 6f 6e 27 74 |nsfers, |we won't|
|00001770| 20 68 61 76 65 0d 09 09 | 09 20 2a 20 74 6f 20 73 | have...|. * to s|
|00001780| 63 61 6e 20 74 68 65 20 | 70 68 79 73 69 63 61 6c |can the |physical|
|00001790| 20 74 61 62 6c 65 20 69 | 6e 20 61 20 70 72 69 6d | table i|n a prim|
|000017a0| 61 72 79 20 69 6e 74 65 | 72 72 75 70 74 20 73 65 |ary inte|rrupt se|
|000017b0| 72 76 69 63 65 20 72 6f | 75 74 69 6e 65 2e 0d 09 |rvice ro|utine...|
|000017c0| 09 09 20 2a 0d 09 09 09 | 20 2a 20 54 68 69 73 20 |.. *....| * This |
|000017d0| 6c 69 62 72 61 72 79 20 | 70 72 65 73 75 6d 65 73 |library |presumes|
|000017e0| 20 74 68 61 74 20 69 74 | 20 69 73 20 74 68 65 20 | that it| is the |
|000017f0| 6f 6e 6c 79 20 70 72 65 | 70 61 72 61 74 69 6f 6e |only pre|paration|
|00001800| 2e 20 53 6f 6d 65 20 61 | 64 6a 75 73 74 6d 65 6e |. Some a|djustmen|
|00001810| 74 73 0d 09 09 09 20 2a | 20 77 69 6c 6c 20 62 65 |ts.... *| will be|
|00001820| 20 6e 65 65 64 65 64 20 | 74 6f 20 73 75 70 70 6f | needed |to suppo|
|00001830| 72 74 20 70 61 72 74 69 | 61 6c 20 70 72 65 70 61 |rt parti|al prepa|
|00001840| 72 61 74 69 6f 6e 2e 0d | 09 09 09 20 2a 2f 0d 09 |ration..|... */..|
|00001850| 09 09 44 4d 41 2e 69 6f | 54 61 62 6c 65 50 74 72 |..DMA.io|TablePtr|
|00001860| 20 3d 20 69 6f 54 61 62 | 6c 65 50 74 72 3b 0d 09 | = ioTab|lePtr;..|
|00001870| 09 09 44 4d 41 2e 6c 6f | 67 69 63 61 6c 41 6c 69 |..DMA.lo|gicalAli|
|00001880| 67 6e 6d 65 6e 74 20 3d | 20 6c 6f 67 69 63 61 6c |gnment =| logical|
|00001890| 41 6c 69 67 6e 6d 65 6e | 74 3b 0d 09 09 09 69 66 |Alignmen|t;....if|
|000018a0| 20 28 49 4f 2e 66 69 72 | 73 74 50 72 65 70 61 72 | (IO.fir|stPrepar|
|000018b0| 65 64 20 3d 3d 20 30 29 | 20 7b 0d 09 09 09 09 2f |ed == 0)| {...../|
|000018c0| 2a 0d 09 09 09 09 20 2a | 20 54 68 69 73 20 69 73 |*..... *| This is|
|000018d0| 20 74 68 65 20 66 69 72 | 73 74 20 70 72 65 70 61 | the fir|st prepa|
|000018e0| 72 61 74 69 6f 6e 3a 20 | 69 6e 69 74 69 61 6c 69 |ration: |initiali|
|000018f0| 7a 65 20 74 68 65 20 73 | 63 61 74 74 65 72 2d 67 |ze the s|catter-g|
|00001900| 61 74 68 65 72 20 69 6e | 64 65 78 2e 0d 09 09 09 |ather in|dex.....|
|00001910| 09 20 2a 2f 0d 09 09 09 | 09 44 4d 41 2e 73 63 61 |. */....|.DMA.sca|
|00001920| 74 74 65 72 47 61 74 68 | 65 72 49 6e 64 65 78 20 |tterGath|erIndex |
|00001930| 3d 20 30 3b 0d 09 09 09 | 09 44 4d 41 2e 70 72 65 |= 0;....|.DMA.pre|
|00001940| 70 61 72 65 43 6f 75 6e | 74 20 3d 20 30 3b 0d 09 |pareCoun|t = 0;..|
|00001950| 09 09 09 44 4d 41 2e 72 | 61 6e 67 65 43 6f 75 6e |...DMA.r|angeCoun|
|00001960| 74 20 3d 20 30 3b 0d 09 | 09 09 09 44 4d 41 2e 72 |t = 0;..|...DMA.r|
|00001970| 61 6e 67 65 4c 65 6e 67 | 74 68 20 3d 20 30 3b 0d |angeLeng|th = 0;.|
|00001980| 09 09 09 7d 0d 09 09 09 | 2f 2a 0d 09 09 09 20 2a |...}....|/*.... *|
|00001990| 20 54 68 65 20 70 72 65 | 70 61 72 61 74 69 6f 6e | The pre|paration|
|000019a0| 20 77 72 69 74 65 73 20 | 74 68 65 20 70 68 79 73 | writes |the phys|
|000019b0| 69 63 61 6c 20 6d 61 70 | 20 66 72 6f 6d 20 69 6e |ical map| from in|
|000019c0| 64 65 78 20 7a 65 72 6f | 2e 0d 09 09 09 20 2a 2f |dex zero|..... */|
|000019d0| 0d 09 09 09 44 4d 41 2e | 70 68 79 73 69 63 61 6c |....DMA.|physical|
|000019e0| 4d 61 70 49 6e 64 65 78 | 20 3d 20 30 3b 0d 09 09 |MapIndex| = 0;...|
|000019f0| 09 44 4d 41 2e 70 72 65 | 70 61 72 65 43 6f 75 6e |.DMA.pre|pareCoun|
|00001a00| 74 20 3d 20 30 3b 0d 09 | 09 09 6f 73 53 74 61 74 |t = 0;..|..osStat|
|00001a10| 75 73 20 3d 20 47 65 74 | 4e 65 78 74 53 65 67 6d |us = Get|NextSegm|
|00001a20| 65 6e 74 28 64 6d 61 54 | 61 62 6c 65 50 74 72 29 |ent(dmaT|ablePtr)|
|00001a30| 3b 0d 09 09 7d 0d 09 09 | 72 65 74 75 72 6e 20 28 |;...}...|return (|
|00001a40| 6f 73 53 74 61 74 75 73 | 29 3b 0d 7d 0d 0d 2f 2a |osStatus|);.}../*|
|00001a50| 09 2e 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |..______|________|
|00001a60| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001a70| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001a80| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001a90| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001aa0| 5f 5f 5f 5f 5f 2e 0d 20 | 20 09 7c 20 50 72 65 70 |_____.. | .| Prep|
|00001ab0| 61 72 65 44 4d 41 54 72 | 61 6e 73 66 65 72 09 09 |areDMATr|ansfer..|
|00001ac0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 7c 0d |........|......|.|
|00001ad0| 09 7c 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |.|......|........|
|00001ae0| 09 09 09 09 09 09 09 7c | 0d 09 7c 20 50 72 65 70 |.......||..| Prep|
|00001af0| 61 72 65 20 74 68 65 20 | 6e 65 78 74 20 44 4d 41 |are the |next DMA|
|00001b00| 20 73 65 67 6d 65 6e 74 | 2e 09 09 09 09 09 09 09 | segment|........|
|00001b10| 09 09 09 09 09 09 09 7c | 0d 09 7c 20 49 6e 70 75 |.......||..| Inpu|
|00001b20| 74 3a 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |t:......|........|
|00001b30| 09 09 09 09 09 7c 0d 09 | 7c 09 64 6d 61 54 61 62 |.....|..||.dmaTab|
|00001b40| 6c 65 50 74 72 09 09 09 | 54 68 65 20 44 4d 41 54 |lePtr...|The DMAT|
|00001b50| 72 61 6e 73 66 65 72 49 | 6e 66 6f 20 72 65 63 6f |ransferI|nfo reco|
|00001b60| 72 64 20 74 68 61 74 20 | 77 69 6c 6c 20 6d 61 6e |rd that |will man|
|00001b70| 61 67 65 20 74 68 69 73 | 20 74 72 61 6e 73 66 65 |age this| transfe|
|00001b80| 72 2e 09 7c 0d 09 7c 09 | 09 09 09 09 09 09 09 09 |r..|..|.|........|
|00001b90| 09 09 09 09 09 09 09 09 | 09 09 09 09 7c 0d 09 7c |........|....|..||
|00001ba0| 20 4f 75 74 70 75 74 3a | 09 09 09 09 09 09 09 09 | Output:|........|
|00001bb0| 09 09 09 09 09 09 09 09 | 09 09 09 7c 0d 09 7c 09 |........|...|..|.|
|00001bc0| 6e 65 78 74 54 72 61 6e | 73 66 65 72 41 64 64 72 |nextTran|sferAddr|
|00001bd0| 65 73 73 09 47 65 74 73 | 20 74 68 65 20 73 65 67 |ess.Gets| the seg|
|00001be0| 6d 65 6e 74 20 73 74 61 | 72 74 20 61 64 64 72 65 |ment sta|rt addre|
|00001bf0| 73 73 20 28 72 65 71 75 | 69 72 65 64 29 2e 09 09 |ss (requ|ired)...|
|00001c00| 09 09 09 7c 0d 09 7c 09 | 6e 65 78 74 54 72 61 6e |...|..|.|nextTran|
|00001c10| 73 66 65 72 43 6f 75 6e | 74 09 47 65 74 73 20 74 |sferCoun|t.Gets t|
|00001c20| 68 65 20 73 65 67 6d 65 | 6e 74 20 74 72 61 6e 73 |he segme|nt trans|
|00001c30| 66 65 72 20 63 6f 75 6e | 74 20 28 72 65 71 75 69 |fer coun|t (requi|
|00001c40| 72 65 64 29 2e 09 09 09 | 09 09 7c 0d 09 7c 09 6e |red)....|..|..|.n|
|00001c50| 65 78 74 49 73 4c 6f 67 | 69 63 61 6c 09 09 54 52 |extIsLog|ical..TR|
|00001c60| 55 45 20 69 66 20 74 68 | 69 73 20 69 73 20 61 20 |UE if th|is is a |
|00001c70| 6c 6f 67 69 63 61 6c 20 | 61 64 64 72 65 73 73 2e |logical |address.|
|00001c80| 09 09 09 09 09 09 09 7c | 0d 09 7c 09 09 09 09 09 |.......||..|.....|
|00001c90| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00001ca0| 7c 0d 09 7c 20 52 65 73 | 75 6c 74 3a 09 09 09 09 ||..| Res|ult:....|
|00001cb0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 7c |........|.......||
|00001cc0| 0d 09 7c 09 6e 6f 45 72 | 72 09 09 09 09 4e 6f 72 |..|.noEr|r....Nor|
|00001cd0| 6d 61 6c 20 09 09 09 09 | 09 09 09 09 09 09 09 09 |mal ....|........|
|00001ce0| 09 09 7c 0d 09 7c 09 70 | 61 72 61 6d 45 72 72 09 |..|..|.p|aramErr.|
|00001cf0| 09 09 50 72 6f 67 72 61 | 6d 6d 69 6e 67 20 62 75 |..Progra|mming bu|
|00001d00| 67 2e 09 09 09 09 09 09 | 09 09 09 09 09 7c 0d 09 |g.......|.....|..|
|00001d10| 7c 09 65 6f 66 45 72 72 | 09 09 09 09 4e 6f 74 68 ||.eofErr|....Noth|
|00001d20| 69 6e 67 20 6d 6f 72 65 | 20 74 6f 20 74 72 61 6e |ing more| to tran|
|00001d30| 73 66 65 72 2e 09 09 09 | 09 09 09 09 09 09 7c 0d |sfer....|......|.|
|00001d40| 09 7c 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |.|......|........|
|00001d50| 09 09 09 09 09 09 09 7c | 0d 09 7c 20 4e 6f 74 65 |.......||..| Note|
|00001d60| 73 3a 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |s:......|........|
|00001d70| 09 09 09 09 09 7c 0d 09 | 7c 09 09 09 09 09 09 09 |.....|..||.......|
|00001d80| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 7c 0d |........|......|.|
|00001d90| 09 7c 09 65 6f 66 45 72 | 72 20 69 73 20 61 20 6e |.|.eofEr|r is a n|
|00001da0| 6f 72 6d 61 6c 20 73 74 | 61 74 75 73 20 72 65 73 |ormal st|atus res|
|00001db0| 75 6c 74 73 2e 20 54 68 | 65 79 20 73 68 6f 75 6c |ults. Th|ey shoul|
|00001dc0| 64 20 62 65 20 72 65 70 | 6c 61 63 65 64 20 62 79 |d be rep|laced by|
|00001dd0| 09 09 09 09 09 7c 0d 09 | 7c 09 62 79 20 70 72 69 |.....|..||.by pri|
|00001de0| 76 61 74 65 20 65 72 72 | 6f 72 20 63 6f 64 65 73 |vate err|or codes|
|00001df0| 2e 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00001e00| 7c 0d 09 7c 09 09 09 09 | 09 09 09 09 09 09 09 09 ||..|....|........|
|00001e10| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 7c 09 49 66 |........|.|..|.If|
|00001e20| 20 6c 6f 67 69 63 61 6c | 20 61 64 64 72 65 73 73 | logical| address|
|00001e30| 65 73 20 61 72 65 20 6e | 65 65 64 65 64 2c 20 74 |es are n|eeded, t|
|00001e40| 68 65 20 50 72 65 70 61 | 72 65 4d 65 6d 6f 72 79 |he Prepa|reMemory|
|00001e50| 46 6f 72 49 4f 20 6d 75 | 73 74 20 70 72 6f 76 69 |ForIO mu|st provi|
|00001e60| 64 65 20 61 20 22 6d 69 | 6e 69 6d 61 6c 09 7c 0d |de a "mi|nimal.|.|
|00001e70| 09 7c 09 6c 6f 67 69 63 | 61 6c 20 6d 61 70 70 69 |.|.logic|al mappi|
|00001e80| 6e 67 22 20 74 61 62 6c | 65 2e 09 09 09 09 09 09 |ng" tabl|e.......|
|00001e90| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 2e 5f 5f 5f |........|.|...___|
|00001ea0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001eb0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001ec0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001ed0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001ee0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001ef0| 2e 0d 20 2a 2f 0d 4f 53 | 53 74 61 74 75 73 0d 50 |.. */.OS|Status.P|
|00001f00| 72 65 70 61 72 65 44 4d | 41 54 72 61 6e 73 66 65 |repareDM|ATransfe|
|00001f10| 72 28 0d 09 09 44 4d 41 | 54 72 61 6e 73 66 65 72 |r(...DMA|Transfer|
|00001f20| 49 6e 66 6f 50 74 72 09 | 09 64 6d 61 54 61 62 6c |InfoPtr.|.dmaTabl|
|00001f30| 65 50 74 72 2c 0d 09 09 | 41 64 64 72 65 73 73 52 |ePtr,...|AddressR|
|00001f40| 61 6e 67 65 09 09 09 2a | 6e 65 78 74 54 72 61 6e |ange...*|nextTran|
|00001f50| 73 66 65 72 52 61 6e 67 | 65 2c 0d 09 09 42 6f 6f |sferRang|e,...Boo|
|00001f60| 6c 65 61 6e 09 09 09 09 | 09 2a 6e 65 78 74 49 73 |lean....|.*nextIs|
|00001f70| 4c 6f 67 69 63 61 6c 0d | 09 29 0d 7b 0d 09 09 4f |Logical.|.).{...O|
|00001f80| 53 53 74 61 74 75 73 09 | 09 09 09 6f 73 53 74 61 |SStatus.|...osSta|
|00001f90| 74 75 73 3b 0d 09 09 63 | 6f 6e 73 74 20 49 4f 50 |tus;...c|onst IOP|
|00001fa0| 72 65 70 61 72 61 74 69 | 6f 6e 54 61 62 6c 65 20 |reparati|onTable |
|00001fb0| 2a 69 6f 54 61 62 6c 65 | 50 74 72 3b 0d 0d 09 09 |*ioTable|Ptr;....|
|00001fc0| 69 6f 54 61 62 6c 65 50 | 74 72 20 3d 20 44 4d 41 |ioTableP|tr = DMA|
|00001fd0| 2e 69 6f 54 61 62 6c 65 | 50 74 72 3b 0d 09 09 69 |.ioTable|Ptr;...i|
|00001fe0| 66 20 28 64 6d 61 54 61 | 62 6c 65 50 74 72 20 3d |f (dmaTa|blePtr =|
|00001ff0| 3d 20 4e 55 4c 4c 20 7c | 7c 20 6e 65 78 74 54 72 |= NULL ||| nextTr|
|00002000| 61 6e 73 66 65 72 52 61 | 6e 67 65 20 3d 3d 20 4e |ansferRa|nge == N|
|00002010| 55 4c 4c 20 7c 7c 20 6e | 65 78 74 49 73 4c 6f 67 |ULL || n|extIsLog|
|00002020| 69 63 61 6c 20 3d 3d 20 | 4e 55 4c 4c 29 20 7b 0d |ical == |NULL) {.|
|00002030| 09 09 09 4c 4f 47 28 28 | 22 42 6f 67 75 73 20 50 |...LOG((|"Bogus P|
|00002040| 72 65 70 61 72 65 44 4d | 41 54 72 61 6e 73 66 65 |repareDM|ATransfe|
|00002050| 72 20 70 61 72 61 6d 65 | 74 65 72 73 5c 6e 22 29 |r parame|ters\n")|
|00002060| 29 3b 0d 09 09 09 6f 73 | 53 74 61 74 75 73 20 3d |);....os|Status =|
|00002070| 20 70 61 72 61 6d 45 72 | 72 3b 0d 09 09 7d 0d 09 | paramEr|r;...}..|
|00002080| 09 65 6c 73 65 20 7b 0d | 09 09 09 6f 73 53 74 61 |.else {.|...osSta|
|00002090| 74 75 73 20 3d 20 6e 6f | 45 72 72 3b 0d 63 6f 6d |tus = no|Err;.com|
|000020a0| 70 75 74 65 4e 65 78 74 | 54 72 61 6e 73 66 65 72 |puteNext|Transfer|
|000020b0| 3a 0d 09 09 09 69 66 20 | 28 44 4d 41 2e 6c 6f 67 |:....if |(DMA.log|
|000020c0| 69 63 61 6c 53 74 61 72 | 74 2e 6c 65 6e 67 74 68 |icalStar|t.length|
|000020d0| 20 21 3d 20 30 29 20 7b | 0d 09 09 09 09 2a 6e 65 | != 0) {|.....*ne|
|000020e0| 78 74 54 72 61 6e 73 66 | 65 72 52 61 6e 67 65 20 |xtTransf|erRange |
|000020f0| 3d 20 44 4d 41 2e 6c 6f | 67 69 63 61 6c 53 74 61 |= DMA.lo|gicalSta|
|00002100| 72 74 3b 0d 09 09 09 09 | 44 4d 41 2e 6c 6f 67 69 |rt;.....|DMA.logi|
|00002110| 63 61 6c 53 74 61 72 74 | 2e 6c 65 6e 67 74 68 20 |calStart|.length |
|00002120| 3d 20 30 3b 0d 09 09 09 | 09 2a 6e 65 78 74 49 73 |= 0;....|.*nextIs|
|00002130| 4c 6f 67 69 63 61 6c 20 | 3d 20 54 52 55 45 3b 0d |Logical |= TRUE;.|
|00002140| 09 09 09 7d 0d 09 09 09 | 65 6c 73 65 20 69 66 20 |...}....|else if |
|00002150| 28 47 65 74 4e 65 78 74 | 50 68 79 73 69 63 61 6c |(GetNext|Physical|
|00002160| 54 72 61 6e 73 66 65 72 | 28 64 6d 61 54 61 62 6c |Transfer|(dmaTabl|
|00002170| 65 50 74 72 29 29 20 7b | 0d 09 09 09 09 2a 6e 65 |ePtr)) {|.....*ne|
|00002180| 78 74 54 72 61 6e 73 66 | 65 72 52 61 6e 67 65 20 |xtTransf|erRange |
|00002190| 3d 20 44 4d 41 2e 70 68 | 79 73 69 63 61 6c 52 61 |= DMA.ph|ysicalRa|
|000021a0| 6e 67 65 3b 0d 09 09 09 | 09 2a 6e 65 78 74 49 73 |nge;....|.*nextIs|
|000021b0| 4c 6f 67 69 63 61 6c 20 | 3d 20 46 41 4c 53 45 3b |Logical |= FALSE;|
|000021c0| 0d 09 09 09 7d 0d 09 09 | 09 65 6c 73 65 20 69 66 |....}...|.else if|
|000021d0| 20 28 44 4d 41 2e 6c 6f | 67 69 63 61 6c 45 6e 64 | (DMA.lo|gicalEnd|
|000021e0| 2e 6c 65 6e 67 74 68 20 | 21 3d 20 30 29 20 7b 09 |.length |!= 0) {.|
|000021f0| 09 09 0d 09 09 09 09 2a | 6e 65 78 74 54 72 61 6e |.......*|nextTran|
|00002200| 73 66 65 72 52 61 6e 67 | 65 20 3d 20 44 4d 41 2e |sferRang|e = DMA.|
|00002210| 6c 6f 67 69 63 61 6c 45 | 6e 64 3b 0d 09 09 09 09 |logicalE|nd;.....|
|00002220| 44 4d 41 2e 6c 6f 67 69 | 63 61 6c 45 6e 64 2e 6c |DMA.logi|calEnd.l|
|00002230| 65 6e 67 74 68 20 3d 20 | 30 3b 0d 09 09 09 09 2a |ength = |0;.....*|
|00002240| 6e 65 78 74 49 73 4c 6f | 67 69 63 61 6c 20 3d 20 |nextIsLo|gical = |
|00002250| 54 52 55 45 3b 0d 09 09 | 09 7d 0d 09 09 09 65 6c |TRUE;...|.}....el|
|00002260| 73 65 20 7b 0d 09 09 09 | 09 2f 2a 0d 09 09 09 09 |se {....|./*.....|
|00002270| 20 2a 20 47 65 74 20 68 | 65 72 65 20 74 6f 20 63 | * Get h|ere to c|
|00002280| 6f 6d 70 75 74 65 20 74 | 68 65 20 6e 65 78 74 20 |ompute t|he next |
|00002290| 73 63 61 74 74 65 72 2d | 67 61 74 68 65 72 20 73 |scatter-|gather s|
|000022a0| 65 67 6d 65 6e 74 2e 20 | 47 65 74 4e 65 78 74 53 |egment. |GetNextS|
|000022b0| 65 67 6d 65 6e 74 0d 09 | 09 09 09 20 2a 20 77 69 |egment..|... * wi|
|000022c0| 6c 6c 20 72 65 74 75 72 | 6e 20 65 6f 66 45 72 72 |ll retur|n eofErr|
|000022d0| 20 77 68 65 6e 20 77 65 | 20 72 75 6e 20 6f 66 66 | when we| run off|
|000022e0| 20 74 68 65 20 65 6e 64 | 20 6f 66 20 74 68 65 20 | the end| of the |
|000022f0| 65 6e 74 69 72 65 20 22 | 70 72 65 70 61 72 65 64 |entire "|prepared|
|00002300| 22 0d 09 09 09 09 20 2a | 20 74 72 61 6e 73 66 65 |"..... *| transfe|
|00002310| 72 2e 0d 09 09 09 09 20 | 2a 2f 0d 09 09 09 09 2b |r...... |*/.....+|
|00002320| 2b 44 4d 41 2e 73 63 61 | 74 74 65 72 47 61 74 68 |+DMA.sca|tterGath|
|00002330| 65 72 49 6e 64 65 78 3b | 0d 09 09 09 09 6f 73 53 |erIndex;|.....osS|
|00002340| 74 61 74 75 73 20 3d 20 | 47 65 74 4e 65 78 74 53 |tatus = |GetNextS|
|00002350| 65 67 6d 65 6e 74 28 64 | 6d 61 54 61 62 6c 65 50 |egment(d|maTableP|
|00002360| 74 72 29 3b 0d 09 09 09 | 09 69 66 20 28 6f 73 53 |tr);....|.if (osS|
|00002370| 74 61 74 75 73 20 3d 3d | 20 6e 6f 45 72 72 29 0d |tatus ==| noErr).|
|00002380| 09 09 09 09 09 67 6f 74 | 6f 20 63 6f 6d 70 75 74 |.....got|o comput|
|00002390| 65 4e 65 78 74 54 72 61 | 6e 73 66 65 72 3b 0d 09 |eNextTra|nsfer;..|
|000023a0| 09 09 7d 0d 09 09 7d 0d | 09 09 69 66 20 28 6f 73 |..}...}.|..if (os|
|000023b0| 53 74 61 74 75 73 20 3d | 3d 20 6e 6f 45 72 72 29 |Status =|= noErr)|
|000023c0| 20 7b 0d 09 09 09 2f 2a | 0d 09 09 09 20 2a 20 57 | {..../*|.... * W|
|000023d0| 65 20 68 61 76 65 20 73 | 6f 6d 65 20 64 61 74 61 |e have s|ome data|
|000023e0| 20 74 6f 20 74 72 61 6e | 73 66 65 72 3a 20 61 64 | to tran|sfer: ad|
|000023f0| 76 61 6e 63 65 20 6f 75 | 72 20 69 6e 64 65 78 65 |vance ou|r indexe|
|00002400| 73 2e 0d 09 09 09 20 2a | 2f 0d 09 09 09 44 4d 41 |s..... *|/....DMA|
|00002410| 2e 72 61 6e 67 65 43 6f | 75 6e 74 20 2b 3d 20 6e |.rangeCo|unt += n|
|00002420| 65 78 74 54 72 61 6e 73 | 66 65 72 52 61 6e 67 65 |extTrans|ferRange|
|00002430| 2d 3e 6c 65 6e 67 74 68 | 3b 0d 09 09 09 44 4d 41 |->length|;....DMA|
|00002440| 2e 70 72 65 70 61 72 65 | 43 6f 75 6e 74 20 2b 3d |.prepare|Count +=|
|00002450| 20 6e 65 78 74 54 72 61 | 6e 73 66 65 72 52 61 6e | nextTra|nsferRan|
|00002460| 67 65 2d 3e 6c 65 6e 67 | 74 68 3b 0d 09 09 7d 0d |ge->leng|th;...}.|
|00002470| 09 09 72 65 74 75 72 6e | 20 28 6f 73 53 74 61 74 |..return| (osStat|
|00002480| 75 73 29 3b 0d 7d 0d 0d | 2f 2a 09 2e 5f 5f 5f 5f |us);.}..|/*..____|
|00002490| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000024a0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000024b0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000024c0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000024d0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 2e |________|_______.|
|000024e0| 0d 20 20 09 7c 20 47 65 | 74 4e 65 78 74 53 65 67 |. .| Ge|tNextSeg|
|000024f0| 6d 65 6e 74 09 09 09 09 | 09 09 09 09 09 09 09 09 |ment....|........|
|00002500| 09 09 09 09 09 7c 0d 09 | 7c 09 09 09 09 09 09 09 |.....|..||.......|
|00002510| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 7c 0d |........|......|.|
|00002520| 09 7c 20 43 6f 6d 70 75 | 74 65 20 61 20 6c 6f 67 |.| Compu|te a log|
|00002530| 69 63 61 6c 20 73 65 67 | 6d 65 6e 74 20 28 65 69 |ical seg|ment (ei|
|00002540| 74 68 65 72 20 74 68 65 | 20 6f 6e 6c 79 20 73 65 |ther the| only se|
|00002550| 67 6d 65 6e 74 20 6f 72 | 20 74 68 65 20 63 75 72 |gment or| the cur|
|00002560| 72 65 6e 74 20 73 63 61 | 74 74 65 72 2d 67 61 74 |rent sca|tter-gat|
|00002570| 68 65 72 09 7c 0d 09 7c | 20 73 65 67 6d 65 6e 74 |her.|..|| segment|
|00002580| 29 2e 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |).......|........|
|00002590| 09 09 09 09 09 7c 0d 09 | 7c 09 09 09 09 09 09 09 |.....|..||.......|
|000025a0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 7c 0d |........|......|.|
|000025b0| 09 7c 20 49 6e 70 75 74 | 3a 09 09 09 09 09 09 09 |.| Input|:.......|
|000025c0| 09 09 09 09 09 09 09 09 | 09 09 09 09 7c 0d 09 7c |........|....|..||
|000025d0| 09 64 6d 61 54 61 62 6c | 65 50 74 72 09 09 09 54 |.dmaTabl|ePtr...T|
|000025e0| 68 65 20 44 4d 41 54 72 | 61 6e 73 66 65 72 49 6e |he DMATr|ansferIn|
|000025f0| 66 6f 20 72 65 63 6f 72 | 64 20 74 68 61 74 20 77 |fo recor|d that w|
|00002600| 69 6c 6c 20 6d 61 6e 61 | 67 65 20 74 68 69 73 20 |ill mana|ge this |
|00002610| 74 72 61 6e 73 66 65 72 | 2e 09 7c 0d 09 7c 09 09 |transfer|..|..|..|
|00002620| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00002630| 09 09 09 7c 0d 09 7c 20 | 4f 75 74 70 75 74 3a 09 |...|..| |Output:.|
|00002640| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00002650| 09 09 7c 0d 09 7c 09 54 | 68 65 20 44 4d 41 20 67 |..|..|.T|he DMA g|
|00002660| 6c 6f 62 61 6c 20 63 6f | 6e 74 65 78 74 20 69 73 |lobal co|ntext is|
|00002670| 20 75 70 64 61 74 65 64 | 2e 09 09 09 09 09 09 09 | updated|........|
|00002680| 09 09 09 09 09 7c 0d 09 | 7c 09 09 09 09 09 09 09 |.....|..||.......|
|00002690| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 7c 0d |........|......|.|
|000026a0| 09 7c 20 52 65 73 75 6c | 74 3a 09 09 09 09 09 09 |.| Resul|t:......|
|000026b0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 7c 0d 09 |........|.....|..|
|000026c0| 7c 09 6e 6f 45 72 72 09 | 09 09 09 4e 6f 72 6d 61 ||.noErr.|...Norma|
|000026d0| 6c 20 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |l ......|........|
|000026e0| 7c 0d 09 7c 09 70 61 72 | 61 6d 45 72 72 09 09 09 ||..|.par|amErr...|
|000026f0| 50 72 6f 67 72 61 6d 6d | 69 6e 67 20 62 75 67 2e |Programm|ing bug.|
|00002700| 09 09 09 09 09 09 09 09 | 09 09 09 7c 0d 09 7c 09 |........|...|..|.|
|00002710| 65 6f 66 45 72 72 09 09 | 09 09 4e 6f 74 68 69 6e |eofErr..|..Nothin|
|00002720| 67 20 6d 6f 72 65 20 74 | 6f 20 74 72 61 6e 73 66 |g more t|o transf|
|00002730| 65 72 2e 09 09 09 09 09 | 09 09 09 09 7c 0d 09 7c |er......|....|..||
|00002740| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00002750| 09 09 09 09 09 7c 0d 09 | 7c 20 4e 6f 74 65 73 3a |.....|..|| Notes:|
|00002760| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00002770| 09 09 09 7c 0d 09 7c 09 | 65 6f 66 45 72 72 20 69 |...|..|.|eofErr i|
|00002780| 73 20 61 6e 20 65 78 70 | 65 63 74 65 64 20 73 74 |s an exp|ected st|
|00002790| 61 74 75 73 20 72 65 73 | 75 6c 74 2e 20 49 74 20 |atus res|ult. It |
|000027a0| 63 6f 75 6c 64 20 62 65 | 20 72 65 70 6c 61 63 65 |could be| replace|
|000027b0| 64 20 62 79 20 61 20 70 | 72 69 76 61 74 65 20 63 |d by a p|rivate c|
|000027c0| 6f 64 65 2e 09 7c 0d 09 | 2e 5f 5f 5f 5f 5f 5f 5f |ode..|..|._______|
|000027d0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000027e0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000027f0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00002800| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00002810| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 2e 0d 20 2a |________|____.. *|
|00002820| 2f 0d 73 74 61 74 69 63 | 20 4f 53 53 74 61 74 75 |/.static| OSStatu|
|00002830| 73 0d 47 65 74 4e 65 78 | 74 53 65 67 6d 65 6e 74 |s.GetNex|tSegment|
|00002840| 28 0d 09 09 44 4d 41 54 | 72 61 6e 73 66 65 72 49 |(...DMAT|ransferI|
|00002850| 6e 66 6f 50 74 72 09 09 | 64 6d 61 54 61 62 6c 65 |nfoPtr..|dmaTable|
|00002860| 50 74 72 0d 09 29 0d 7b | 0d 09 09 4f 53 53 74 61 |Ptr..).{|...OSSta|
|00002870| 74 75 73 09 09 09 09 6f | 73 53 74 61 74 75 73 3b |tus....o|sStatus;|
|00002880| 0d 09 09 63 6f 6e 73 74 | 20 49 4f 50 72 65 70 61 |...const| IOPrepa|
|00002890| 72 61 74 69 6f 6e 54 61 | 62 6c 65 20 2a 69 6f 54 |rationTa|ble *ioT|
|000028a0| 61 62 6c 65 50 74 72 3b | 0d 23 64 65 66 69 6e 65 |ablePtr;|.#define|
|000028b0| 20 52 41 4e 47 45 09 09 | 28 49 4f 2e 72 61 6e 67 | RANGE..|(IO.rang|
|000028c0| 65 49 6e 66 6f 29 0d 23 | 64 65 66 69 6e 65 20 52 |eInfo).#|define R|
|000028d0| 41 4e 47 45 54 41 42 4c | 45 09 28 49 4f 2e 72 61 |ANGETABL|E.(IO.ra|
|000028e0| 6e 67 65 49 6e 66 6f 2e | 6d 75 6c 74 69 70 6c 65 |ngeInfo.|multiple|
|000028f0| 52 61 6e 67 65 73 2e 72 | 61 6e 67 65 54 61 62 6c |Ranges.r|angeTabl|
|00002900| 65 29 0d 0d 09 09 69 6f | 54 61 62 6c 65 50 74 72 |e)....io|TablePtr|
|00002910| 20 3d 20 44 4d 41 2e 69 | 6f 54 61 62 6c 65 50 74 | = DMA.i|oTablePt|
|00002920| 72 3b 0d 09 09 6f 73 53 | 74 61 74 75 73 20 3d 20 |r;...osS|tatus = |
|00002930| 6e 6f 45 72 72 3b 0d 09 | 09 69 66 20 28 44 4d 41 |noErr;..|.if (DMA|
|00002940| 2e 70 72 65 70 61 72 65 | 43 6f 75 6e 74 20 3e 3d |.prepare|Count >=|
|00002950| 20 49 4f 2e 6c 65 6e 67 | 74 68 50 72 65 70 61 72 | IO.leng|thPrepar|
|00002960| 65 64 29 0d 09 09 09 6f | 73 53 74 61 74 75 73 20 |ed)....o|sStatus |
|00002970| 3d 20 65 6f 66 45 72 72 | 3b 0d 09 09 65 6c 73 65 |= eofErr|;...else|
|00002980| 20 69 66 20 28 44 4d 41 | 2e 72 61 6e 67 65 43 6f | if (DMA|.rangeCo|
|00002990| 75 6e 74 20 3c 20 44 4d | 41 2e 72 61 6e 67 65 4c |unt < DM|A.rangeL|
|000029a0| 65 6e 67 74 68 29 20 7b | 0d 09 09 09 2f 2a 0d 09 |ength) {|..../*..|
|000029b0| 09 09 20 2a 20 57 65 20 | 63 61 6e 20 67 65 74 20 |.. * We |can get |
|000029c0| 68 65 72 65 20 69 66 20 | 77 65 20 6e 65 65 64 20 |here if |we need |
|000029d0| 73 65 76 65 72 61 6c 20 | 63 61 6c 6c 73 20 74 6f |several |calls to|
|000029e0| 20 50 72 65 70 61 72 65 | 4d 65 6d 6f 72 79 46 6f | Prepare|MemoryFo|
|000029f0| 72 49 4f 20 74 6f 0d 09 | 09 09 20 2a 20 63 6f 6e |rIO to..|.. * con|
|00002a00| 73 75 6d 65 20 61 20 73 | 69 6e 67 6c 65 20 73 63 |sume a s|ingle sc|
|00002a10| 61 74 74 65 72 2d 67 61 | 74 68 65 72 20 61 72 65 |atter-ga|ther are|
|00002a20| 61 2e 0d 09 09 09 20 2a | 2f 0d 09 09 09 43 6f 6d |a..... *|/....Com|
|00002a30| 70 75 74 65 54 68 69 73 | 41 72 65 61 28 64 6d 61 |puteThis|Area(dma|
|00002a40| 54 61 62 6c 65 50 74 72 | 29 3b 0d 09 09 7d 0d 09 |TablePtr|);...}..|
|00002a50| 09 65 6c 73 65 20 69 66 | 20 28 28 49 4f 2e 6f 70 |.else if| ((IO.op|
|00002a60| 74 69 6f 6e 73 20 26 20 | 6b 49 4f 4d 75 6c 74 69 |tions & |kIOMulti|
|00002a70| 70 6c 65 52 61 6e 67 65 | 73 29 20 3d 3d 20 30 29 |pleRange|s) == 0)|
|00002a80| 20 7b 0d 09 09 09 2f 2a | 0d 09 09 09 20 2a 20 54 | {..../*|.... * T|
|00002a90| 68 65 72 65 20 69 73 20 | 61 20 73 69 6e 67 6c 65 |here is |a single|
|00002aa0| 20 6c 6f 67 69 63 61 6c | 20 61 72 65 61 20 28 74 | logical| area (t|
|00002ab0| 68 69 73 20 69 73 20 6e | 6f 72 6d 61 6c 29 2e 20 |his is n|ormal). |
|00002ac0| 49 66 20 74 68 69 73 20 | 66 75 6e 63 74 69 6f 6e |If this |function|
|00002ad0| 20 69 73 0d 09 09 09 20 | 2a 20 72 65 2d 63 61 6c | is.... |* re-cal|
|00002ae0| 6c 65 64 2c 20 44 4d 41 | 2e 73 63 61 74 74 65 72 |led, DMA|.scatter|
|00002af0| 47 61 74 68 65 72 49 6e | 64 65 78 20 77 69 6c 6c |GatherIn|dex will|
|00002b00| 20 62 65 20 6e 6f 6e 2d | 7a 65 72 6f 20 28 69 74 | be non-|zero (it|
|00002b10| 20 77 61 73 20 69 6e 63 | 72 65 6d 65 6e 74 65 64 | was inc|remented|
|00002b20| 0d 09 09 09 20 2a 20 77 | 68 65 6e 20 77 65 20 77 |.... * w|hen we w|
|00002b30| 65 72 65 20 70 72 65 76 | 69 6f 75 73 6c 79 20 63 |ere prev|iously c|
|00002b40| 61 6c 6c 65 64 29 2e 20 | 52 65 74 75 72 6e 20 65 |alled). |Return e|
|00002b50| 6f 66 45 72 72 20 74 6f | 20 69 6e 64 69 63 61 74 |ofErr to| indicat|
|00002b60| 65 20 61 20 6e 6f 72 6d | 61 6c 2c 0d 09 09 09 20 |e a norm|al,.... |
|00002b70| 2a 20 73 75 63 63 65 73 | 73 66 75 6c 2c 20 63 6f |* succes|sful, co|
|00002b80| 6d 70 6c 65 74 69 6f 6e | 2e 0d 09 09 09 20 2a 2f |mpletion|..... */|
|00002b90| 0d 09 09 09 69 66 20 28 | 44 4d 41 2e 73 63 61 74 |....if (|DMA.scat|
|00002ba0| 74 65 72 47 61 74 68 65 | 72 49 6e 64 65 78 20 3e |terGathe|rIndex >|
|00002bb0| 20 30 29 0d 09 09 09 09 | 6f 73 53 74 61 74 75 73 | 0).....|osStatus|
|00002bc0| 20 3d 20 65 6f 66 45 72 | 72 3b 0d 09 09 09 65 6c | = eofEr|r;....el|
|00002bd0| 73 65 20 7b 0d 09 09 09 | 09 2f 2a 0d 09 09 09 09 |se {....|./*.....|
|00002be0| 20 2a 20 54 68 69 73 20 | 69 73 20 74 68 65 20 69 | * This |is the i|
|00002bf0| 6e 69 74 69 61 6c 20 63 | 61 6c 6c 20 66 6f 72 20 |nitial c|all for |
|00002c00| 61 20 73 69 6e 67 6c 65 | 20 6c 6f 67 69 63 61 6c |a single| logical|
|00002c10| 20 61 72 65 61 2e 20 43 | 6f 6d 70 75 74 65 20 74 | area. C|ompute t|
|00002c20| 68 65 0d 09 09 09 09 20 | 2a 20 6c 6f 67 69 63 61 |he..... |* logica|
|00002c30| 6c 20 61 6e 64 20 70 68 | 79 73 69 63 61 6c 20 61 |l and ph|ysical a|
|00002c40| 72 65 61 73 2e 0d 09 09 | 09 09 20 2a 2f 0d 09 09 |reas....|.. */...|
|00002c50| 09 09 44 4d 41 2e 72 61 | 6e 67 65 4c 65 6e 67 74 |..DMA.ra|ngeLengt|
|00002c60| 68 20 3d 20 52 41 4e 47 | 45 2e 72 61 6e 67 65 2e |h = RANG|E.range.|
|00002c70| 6c 65 6e 67 74 68 3b 0d | 09 09 09 09 43 6f 6d 70 |length;.|....Comp|
|00002c80| 75 74 65 54 68 69 73 41 | 72 65 61 28 64 6d 61 54 |uteThisA|rea(dmaT|
|00002c90| 61 62 6c 65 50 74 72 29 | 3b 0d 09 09 09 7d 0d 09 |ablePtr)|;....}..|
|00002ca0| 09 7d 0d 09 09 65 6c 73 | 65 20 69 66 20 28 44 4d |.}...els|e if (DM|
|00002cb0| 41 2e 73 63 61 74 74 65 | 72 47 61 74 68 65 72 49 |A.scatte|rGatherI|
|00002cc0| 6e 64 65 78 20 3e 3d 20 | 52 41 4e 47 45 2e 6d 75 |ndex >= |RANGE.mu|
|00002cd0| 6c 74 69 70 6c 65 52 61 | 6e 67 65 73 2e 65 6e 74 |ltipleRa|nges.ent|
|00002ce0| 72 79 43 6f 75 6e 74 29 | 0d 09 09 09 09 6f 73 53 |ryCount)|.....osS|
|00002cf0| 74 61 74 75 73 20 3d 20 | 65 6f 66 45 72 72 3b 0d |tatus = |eofErr;.|
|00002d00| 09 09 65 6c 73 65 20 7b | 0d 09 09 09 2f 2a 0d 09 |..else {|..../*..|
|00002d10| 09 09 20 2a 20 57 65 20 | 61 72 65 20 70 72 6f 63 |.. * We |are proc|
|00002d20| 65 73 73 69 6e 67 20 61 | 20 73 63 61 74 74 65 72 |essing a| scatter|
|00002d30| 2d 67 61 74 68 65 72 20 | 49 2f 4f 20 74 61 62 6c |-gather |I/O tabl|
|00002d40| 65 2e 20 43 6f 6d 70 75 | 74 65 20 74 68 69 73 20 |e. Compu|te this |
|00002d50| 73 65 67 6d 65 6e 74 2e | 0d 09 09 09 20 2a 2f 0d |segment.|.... */.|
|00002d60| 09 09 09 44 4d 41 2e 72 | 61 6e 67 65 4c 65 6e 67 |...DMA.r|angeLeng|
|00002d70| 74 68 20 3d 20 52 41 4e | 47 45 54 41 42 4c 45 5b |th = RAN|GETABLE[|
|00002d80| 44 4d 41 2e 73 63 61 74 | 74 65 72 47 61 74 68 65 |DMA.scat|terGathe|
|00002d90| 72 49 6e 64 65 78 5d 2e | 6c 65 6e 67 74 68 3b 0d |rIndex].|length;.|
|00002da0| 09 09 09 43 6f 6d 70 75 | 74 65 54 68 69 73 41 72 |...Compu|teThisAr|
|00002db0| 65 61 28 64 6d 61 54 61 | 62 6c 65 50 74 72 29 3b |ea(dmaTa|blePtr);|
|00002dc0| 0d 09 09 7d 0d 09 09 72 | 65 74 75 72 6e 20 28 6f |...}...r|eturn (o|
|00002dd0| 73 53 74 61 74 75 73 29 | 3b 0d 23 75 6e 64 65 66 |sStatus)|;.#undef|
|00002de0| 20 52 41 4e 47 45 54 41 | 42 4c 45 0d 23 75 6e 64 | RANGETA|BLE.#und|
|00002df0| 65 66 20 52 41 4e 47 45 | 0d 7d 0d 0d 2f 2a 09 2e |ef RANGE|.}../*..|
|00002e00| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00002e10| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00002e20| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00002e30| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00002e40| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00002e50| 5f 5f 5f 2e 0d 20 20 09 | 7c 20 43 6f 6d 70 75 74 |___.. .|| Comput|
|00002e60| 65 54 68 69 73 41 72 65 | 61 09 09 09 09 09 09 09 |eThisAre|a.......|
|00002e70| 09 09 09 09 09 09 09 09 | 09 09 7c 0d 09 7c 09 09 |........|..|..|..|
|00002e80| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00002e90| 09 09 09 7c 0d 09 7c 20 | 43 6f 6d 70 75 74 65 20 |...|..| |Compute |
|00002ea0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 6c 6f 67 69 |the curr|ent logi|
|00002eb0| 63 61 6c 20 73 65 67 6d | 65 6e 74 2e 20 54 68 65 |cal segm|ent. The|
|00002ec0| 20 63 61 6c 6c 65 72 20 | 68 61 73 20 73 65 6c 65 | caller |has sele|
|00002ed0| 63 74 65 64 20 74 68 65 | 20 73 65 67 6d 65 6e 74 |cted the| segment|
|00002ee0| 2e 09 09 09 7c 0d 09 7c | 20 54 68 69 73 20 66 75 |....|..|| This fu|
|00002ef0| 6e 63 74 69 6f 6e 20 63 | 72 65 61 74 65 73 20 74 |nction c|reates t|
|00002f00| 68 65 20 69 6e 69 74 69 | 61 6c 20 61 6e 64 20 66 |he initi|al and f|
|00002f10| 69 6e 61 6c 20 6c 6f 67 | 69 63 61 6c 20 73 65 67 |inal log|ical seg|
|00002f20| 6d 65 6e 74 73 20 61 6e | 64 20 61 64 6a 75 73 74 |ments an|d adjust|
|00002f30| 73 20 74 68 65 09 09 7c | 0d 09 7c 20 70 68 79 73 |s the..||..| phys|
|00002f40| 69 63 61 6c 20 74 72 61 | 6e 73 66 65 72 20 70 61 |ical tra|nsfer pa|
|00002f50| 72 61 6d 65 74 65 72 73 | 20 69 66 20 6e 65 63 65 |rameters| if nece|
|00002f60| 73 73 61 72 79 2e 09 09 | 09 09 09 09 09 09 09 09 |ssary...|........|
|00002f70| 7c 0d 09 7c 09 09 09 09 | 09 09 09 09 09 09 09 09 ||..|....|........|
|00002f80| 09 09 09 09 09 09 09 09 | 09 7c 0d 09 7c 20 49 6e |........|.|..| In|
|00002f90| 70 75 74 3a 09 09 09 09 | 09 09 09 09 09 09 09 09 |put:....|........|
|00002fa0| 09 09 09 09 09 09 09 7c | 0d 09 7c 09 64 6d 61 54 |.......||..|.dmaT|
|00002fb0| 61 62 6c 65 50 74 72 09 | 09 09 54 68 65 20 44 4d |ablePtr.|..The DM|
|00002fc0| 41 54 72 61 6e 73 66 65 | 72 49 6e 66 6f 20 72 65 |ATransfe|rInfo re|
|00002fd0| 63 6f 72 64 20 74 68 61 | 74 20 77 69 6c 6c 20 6d |cord tha|t will m|
|00002fe0| 61 6e 61 67 65 20 74 68 | 69 73 20 74 72 61 6e 73 |anage th|is trans|
|00002ff0| 66 65 72 2e 09 7c 0d 09 | 7c 09 64 6d 61 54 61 62 |fer..|..||.dmaTab|
|00003000| 6c 65 50 74 72 2d 3e 73 | 63 61 74 74 65 72 47 61 |lePtr->s|catterGa|
|00003010| 74 68 65 72 49 6e 64 65 | 78 20 69 73 20 74 68 65 |therInde|x is the|
|00003020| 20 69 6e 64 65 78 20 69 | 6e 74 6f 20 74 68 65 20 | index i|nto the |
|00003030| 6c 6f 67 69 63 61 6c 20 | 6d 61 70 70 69 6e 67 20 |logical |mapping |
|00003040| 74 61 62 6c 65 2e 09 7c | 0d 09 7c 09 09 09 09 09 |table..||..|.....|
|00003050| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00003060| 7c 0d 09 7c 20 4f 75 74 | 70 75 74 3a 09 09 09 09 ||..| Out|put:....|
|00003070| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 7c |........|.......||
|00003080| 0d 09 7c 09 54 68 65 20 | 44 4d 41 20 67 6c 6f 62 |..|.The |DMA glob|
|00003090| 61 6c 20 63 6f 6e 74 65 | 78 74 20 69 73 20 75 70 |al conte|xt is up|
|000030a0| 64 61 74 65 64 2e 09 09 | 09 09 09 09 09 09 09 09 |dated...|........|
|000030b0| 09 09 7c 0d 09 7c 09 09 | 09 09 09 09 09 09 09 09 |..|..|..|........|
|000030c0| 09 09 09 09 09 09 09 09 | 09 09 09 7c 0d 09 7c 20 |........|...|..| |
|000030d0| 52 65 73 75 6c 74 3a 09 | 09 09 09 09 09 09 09 09 |Result:.|........|
|000030e0| 09 09 09 09 09 09 09 09 | 09 09 7c 0d 09 7c 09 6e |........|..|..|.n|
|000030f0| 6f 6e 65 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |one.....|........|
|00003100| 09 09 09 09 09 09 7c 0d | 09 2e 5f 5f 5f 5f 5f 5f |......|.|..______|
|00003110| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003120| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003130| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003140| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00003150| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 2e 0d 20 |________|_____.. |
|00003160| 2a 2f 0d 73 74 61 74 69 | 63 20 76 6f 69 64 0d 43 |*/.stati|c void.C|
|00003170| 6f 6d 70 75 74 65 54 68 | 69 73 41 72 65 61 28 0d |omputeTh|isArea(.|
|00003180| 09 09 44 4d 41 54 72 61 | 6e 73 66 65 72 49 6e 66 |..DMATra|nsferInf|
|00003190| 6f 50 74 72 09 09 64 6d | 61 54 61 62 6c 65 50 74 |oPtr..dm|aTablePt|
|000031a0| 72 0d 09 29 0d 7b 0d 09 | 09 63 6f 6e 73 74 20 49 |r..).{..|.const I|
|000031b0| 4f 50 72 65 70 61 72 61 | 74 69 6f 6e 54 61 62 6c |OPrepara|tionTabl|
|000031c0| 65 20 2a 69 6f 54 61 62 | 6c 65 50 74 72 3b 0d 09 |e *ioTab|lePtr;..|
|000031d0| 09 73 74 61 74 69 63 20 | 63 6f 6e 73 74 20 41 64 |.static |const Ad|
|000031e0| 64 72 65 73 73 52 61 6e | 67 65 20 67 4e 75 6c 6c |dressRan|ge gNull|
|000031f0| 41 64 64 72 65 73 73 52 | 61 6e 67 65 3b 0d 09 09 |AddressR|ange;...|
|00003200| 42 79 74 65 43 6f 75 6e | 74 09 09 09 09 6c 61 73 |ByteCoun|t....las|
|00003210| 74 50 61 67 65 4c 65 6e | 67 74 68 3b 0d 09 09 42 |tPageLen|gth;...B|
|00003220| 79 74 65 43 6f 75 6e 74 | 09 09 09 09 73 65 67 6d |yteCount|....segm|
|00003230| 65 6e 74 4c 65 6e 67 74 | 68 3b 0d 09 09 55 49 6e |entLengt|h;...UIn|
|00003240| 74 33 32 09 09 09 09 09 | 61 6c 69 67 6e 6d 65 6e |t32.....|alignmen|
|00003250| 74 4d 61 73 6b 3b 0d 09 | 09 42 79 74 65 43 6f 75 |tMask;..|.ByteCou|
|00003260| 6e 74 09 09 09 09 66 69 | 72 73 74 50 61 67 65 4c |nt....fi|rstPageL|
|00003270| 65 6e 67 74 68 3b 09 09 | 2f 2a 20 46 69 72 73 74 |ength;..|/* First|
|00003280| 20 70 68 79 73 69 63 61 | 6c 20 63 68 75 6e 6b 09 | physica|l chunk.|
|00003290| 09 2a 2f 0d 09 09 4c 6f | 67 69 63 61 6c 41 64 64 |.*/...Lo|gicalAdd|
|000032a0| 72 65 73 73 09 09 09 2a | 6c 6f 67 69 63 61 6c 4d |ress...*|logicalM|
|000032b0| 61 70 50 74 72 3b 0d 09 | 09 2f 2a 0d 09 09 20 2a |apPtr;..|./*... *|
|000032c0| 20 54 6f 20 6b 65 65 70 | 20 74 68 65 20 6c 69 6e | To keep| the lin|
|000032d0| 65 20 6c 65 6e 67 74 68 | 73 20 72 65 61 73 6f 6e |e length|s reason|
|000032e0| 61 62 6c 65 2c 20 6c 6f | 67 69 63 61 6c 42 61 73 |able, lo|gicalBas|
|000032f0| 65 20 77 69 6c 6c 20 72 | 65 66 65 72 20 74 6f 20 |e will r|efer to |
|00003300| 74 68 65 20 62 61 73 65 | 0d 09 09 20 2a 20 6f 66 |the base|... * of|
|00003310| 20 74 68 65 20 69 6e 69 | 74 69 61 6c 20 6c 6f 67 | the ini|tial log|
|00003320| 69 63 61 6c 20 61 72 65 | 61 20 72 65 70 72 65 73 |ical are|a repres|
|00003330| 65 6e 74 65 64 20 61 73 | 20 61 6e 20 69 6e 74 65 |ented as| an inte|
|00003340| 67 65 72 2e 20 44 6f 6e | 27 74 20 6d 61 6b 65 20 |ger. Don|'t make |
|00003350| 74 68 69 73 20 61 0d 09 | 09 20 2a 20 76 61 72 69 |this a..|. * vari|
|00003360| 61 62 6c 65 20 61 73 20 | 74 68 65 20 61 63 74 75 |able as |the actu|
|00003370| 61 6c 20 44 4d 41 2e 6c | 6f 67 69 63 61 6c 53 74 |al DMA.l|ogicalSt|
|00003380| 61 72 74 2e 62 61 73 65 | 20 6d 75 73 74 20 61 6c |art.base| must al|
|00003390| 77 61 79 73 20 62 65 20 | 63 6f 72 72 65 63 74 2e |ways be |correct.|
|000033a0| 0d 09 09 20 2a 2f 0d 23 | 64 65 66 69 6e 65 20 6c |... */.#|define l|
|000033b0| 6f 67 69 63 61 6c 42 61 | 73 65 20 28 28 55 49 6e |ogicalBa|se ((UIn|
|000033c0| 74 33 32 29 20 44 4d 41 | 2e 6c 6f 67 69 63 61 6c |t32) DMA|.logical|
|000033d0| 53 74 61 72 74 2e 62 61 | 73 65 29 0d 0d 09 09 69 |Start.ba|se)....i|
|000033e0| 6f 54 61 62 6c 65 50 74 | 72 20 3d 20 44 4d 41 2e |oTablePt|r = DMA.|
|000033f0| 69 6f 54 61 62 6c 65 50 | 74 72 3b 0d 09 09 44 4d |ioTableP|tr;...DM|
|00003400| 41 2e 6c 6f 67 69 63 61 | 6c 53 74 61 72 74 20 3d |A.logica|lStart =|
|00003410| 20 67 4e 75 6c 6c 41 64 | 64 72 65 73 73 52 61 6e | gNullAd|dressRan|
|00003420| 67 65 3b 0d 09 09 44 4d | 41 2e 6c 6f 67 69 63 61 |ge;...DM|A.logica|
|00003430| 6c 45 6e 64 20 3d 20 67 | 4e 75 6c 6c 41 64 64 72 |lEnd = g|NullAddr|
|00003440| 65 73 73 52 61 6e 67 65 | 3b 0d 09 09 44 4d 41 2e |essRange|;...DMA.|
|00003450| 66 69 72 73 74 50 61 67 | 65 4f 66 66 73 65 74 20 |firstPag|eOffset |
|00003460| 3d 20 66 69 72 73 74 50 | 61 67 65 4c 65 6e 67 74 |= firstP|ageLengt|
|00003470| 68 20 3d 20 44 4d 41 2e | 70 68 79 73 69 63 61 6c |h = DMA.|physical|
|00003480| 53 74 61 72 74 20 3d 20 | 30 3b 0d 09 09 6c 6f 67 |Start = |0;...log|
|00003490| 69 63 61 6c 4d 61 70 50 | 74 72 20 3d 20 26 49 4f |icalMapP|tr = &IO|
|000034a0| 2e 6c 6f 67 69 63 61 6c | 4d 61 70 70 69 6e 67 5b |.logical|Mapping[|
|000034b0| 44 4d 41 2e 73 63 61 74 | 74 65 72 47 61 74 68 65 |DMA.scat|terGathe|
|000034c0| 72 49 6e 64 65 78 20 2a | 20 32 5d 3b 0d 09 09 2f |rIndex *| 2];.../|
|000034d0| 2a 0d 09 09 20 2a 20 47 | 65 74 20 74 68 65 20 61 |*... * G|et the a|
|000034e0| 63 74 75 61 6c 20 74 72 | 61 6e 73 66 65 72 20 6c |ctual tr|ansfer l|
|000034f0| 65 6e 67 74 68 3b 20 62 | 72 65 61 6b 69 6e 67 20 |ength; b|reaking |
|00003500| 69 74 20 69 6e 74 6f 20 | 69 6e 69 74 69 61 6c 2c |it into |initial,|
|00003510| 20 70 68 79 73 69 63 61 | 6c 2c 20 61 6e 64 0d 09 | physica|l, and..|
|00003520| 09 20 2a 20 66 69 6e 61 | 6c 20 73 65 67 6d 65 6e |. * fina|l segmen|
|00003530| 74 73 2e 0d 09 09 20 2a | 2f 0d 09 09 73 65 67 6d |ts.... *|/...segm|
|00003540| 65 6e 74 4c 65 6e 67 74 | 68 20 3d 20 44 4d 41 2e |entLengt|h = DMA.|
|00003550| 72 61 6e 67 65 4c 65 6e | 67 74 68 3b 0d 09 09 69 |rangeLen|gth;...i|
|00003560| 66 20 28 28 73 65 67 6d | 65 6e 74 4c 65 6e 67 74 |f ((segm|entLengt|
|00003570| 68 20 2b 20 44 4d 41 2e | 70 72 65 70 61 72 65 43 |h + DMA.|prepareC|
|00003580| 6f 75 6e 74 29 20 3e 20 | 49 4f 2e 6c 65 6e 67 74 |ount) > |IO.lengt|
|00003590| 68 50 72 65 70 61 72 65 | 64 29 0d 09 09 09 73 65 |hPrepare|d)....se|
|000035a0| 67 6d 65 6e 74 4c 65 6e | 67 74 68 20 3d 20 28 49 |gmentLen|gth = (I|
|000035b0| 4f 2e 6c 65 6e 67 74 68 | 50 72 65 70 61 72 65 64 |O.length|Prepared|
|000035c0| 20 2d 20 44 4d 41 2e 70 | 72 65 70 61 72 65 43 6f | - DMA.p|repareCo|
|000035d0| 75 6e 74 29 3b 0d 09 09 | 44 4d 41 2e 70 68 79 73 |unt);...|DMA.phys|
|000035e0| 69 63 61 6c 45 6e 64 20 | 3d 20 73 65 67 6d 65 6e |icalEnd |= segmen|
|000035f0| 74 4c 65 6e 67 74 68 3b | 0d 09 09 69 66 20 28 28 |tLength;|...if ((|
|00003600| 49 4f 2e 6f 70 74 69 6f | 6e 73 20 26 20 6b 49 4f |IO.optio|ns & kIO|
|00003610| 4c 6f 67 69 63 61 6c 52 | 61 6e 67 65 73 29 20 21 |LogicalR|anges) !|
|00003620| 3d 20 30 09 2f 2a 20 49 | 73 20 6c 6f 67 69 63 61 |= 0./* I|s logica|
|00003630| 6c 20 61 6c 69 67 6e 6d | 65 6e 74 20 70 6f 73 73 |l alignm|ent poss|
|00003640| 69 62 6c 65 09 2a 2f 0d | 09 09 20 26 26 20 44 4d |ible.*/.|.. && DM|
|00003650| 41 2e 6c 6f 67 69 63 61 | 6c 41 6c 69 67 6e 6d 65 |A.logica|lAlignme|
|00003660| 6e 74 20 21 3d 20 30 29 | 20 7b 09 09 09 2f 2a 20 |nt != 0)| {.../* |
|00003670| 41 6e 64 20 6c 6f 67 69 | 63 61 6c 20 61 6c 69 67 |And logi|cal alig|
|00003680| 6e 6d 65 6e 74 20 69 73 | 20 6e 65 65 64 65 64 09 |nment is| needed.|
|00003690| 2a 2f 0d 09 09 09 2f 2a | 0d 09 09 09 20 2a 20 43 |*/..../*|.... * C|
|000036a0| 6f 6d 70 75 74 65 20 74 | 68 65 20 6c 6f 67 69 63 |ompute t|he logic|
|000036b0| 61 6c 20 74 72 61 6e 73 | 66 65 72 20 70 61 72 61 |al trans|fer para|
|000036c0| 6d 65 74 65 72 73 2e 0d | 09 09 09 20 2a 2f 0d 09 |meters..|... */..|
|000036d0| 09 09 61 6c 69 67 6e 6d | 65 6e 74 4d 61 73 6b 20 |..alignm|entMask |
|000036e0| 3d 20 44 4d 41 2e 6c 6f | 67 69 63 61 6c 41 6c 69 |= DMA.lo|gicalAli|
|000036f0| 67 6e 6d 65 6e 74 20 2d | 20 31 3b 0d 09 09 09 44 |gnment -| 1;....D|
|00003700| 4d 41 2e 6c 6f 67 69 63 | 61 6c 53 74 61 72 74 2e |MA.logic|alStart.|
|00003710| 62 61 73 65 20 3d 20 6c | 6f 67 69 63 61 6c 4d 61 |base = l|ogicalMa|
|00003720| 70 50 74 72 5b 30 5d 3b | 0d 09 09 09 69 66 20 28 |pPtr[0];|....if (|
|00003730| 28 6c 6f 67 69 63 61 6c | 42 61 73 65 20 26 20 61 |(logical|Base & a|
|00003740| 6c 69 67 6e 6d 65 6e 74 | 4d 61 73 6b 29 20 21 3d |lignment|Mask) !=|
|00003750| 20 30 29 20 7b 0d 09 09 | 09 09 44 4d 41 2e 6c 6f | 0) {...|..DMA.lo|
|00003760| 67 69 63 61 6c 53 74 61 | 72 74 2e 6c 65 6e 67 74 |gicalSta|rt.lengt|
|00003770| 68 20 3d 0d 09 09 09 09 | 09 44 4d 41 2e 6c 6f 67 |h =.....|.DMA.log|
|00003780| 69 63 61 6c 41 6c 69 67 | 6e 6d 65 6e 74 20 2d 20 |icalAlig|nment - |
|00003790| 28 6c 6f 67 69 63 61 6c | 42 61 73 65 20 26 20 61 |(logical|Base & a|
|000037a0| 6c 69 67 6e 6d 65 6e 74 | 4d 61 73 6b 29 3b 0d 09 |lignment|Mask);..|
|000037b0| 09 09 7d 0d 09 09 09 69 | 66 20 28 44 4d 41 2e 6c |..}....i|f (DMA.l|
|000037c0| 6f 67 69 63 61 6c 53 74 | 61 72 74 2e 6c 65 6e 67 |ogicalSt|art.leng|
|000037d0| 74 68 20 3e 20 73 65 67 | 6d 65 6e 74 4c 65 6e 67 |th > seg|mentLeng|
|000037e0| 74 68 29 0d 09 09 09 09 | 44 4d 41 2e 6c 6f 67 69 |th).....|DMA.logi|
|000037f0| 63 61 6c 53 74 61 72 74 | 2e 6c 65 6e 67 74 68 20 |calStart|.length |
|00003800| 3d 20 73 65 67 6d 65 6e | 74 4c 65 6e 67 74 68 3b |= segmen|tLength;|
|00003810| 0d 09 09 09 44 4d 41 2e | 70 68 79 73 69 63 61 6c |....DMA.|physical|
|00003820| 53 74 61 72 74 20 2b 3d | 20 44 4d 41 2e 6c 6f 67 |Start +=| DMA.log|
|00003830| 69 63 61 6c 53 74 61 72 | 74 2e 6c 65 6e 67 74 68 |icalStar|t.length|
|00003840| 3b 0d 09 09 09 44 4d 41 | 2e 6c 6f 67 69 63 61 6c |;....DMA|.logical|
|00003850| 45 6e 64 2e 6c 65 6e 67 | 74 68 20 3d 0d 09 09 09 |End.leng|th =....|
|00003860| 09 28 73 65 67 6d 65 6e | 74 4c 65 6e 67 74 68 20 |.(segmen|tLength |
|00003870| 2d 20 44 4d 41 2e 6c 6f | 67 69 63 61 6c 53 74 61 |- DMA.lo|gicalSta|
|00003880| 72 74 2e 6c 65 6e 67 74 | 68 29 20 26 20 61 6c 69 |rt.lengt|h) & ali|
|00003890| 67 6e 6d 65 6e 74 4d 61 | 73 6b 3b 0d 09 09 09 44 |gnmentMa|sk;....D|
|000038a0| 4d 41 2e 70 68 79 73 69 | 63 61 6c 45 6e 64 20 2d |MA.physi|calEnd -|
|000038b0| 3d 20 44 4d 41 2e 6c 6f | 67 69 63 61 6c 45 6e 64 |= DMA.lo|gicalEnd|
|000038c0| 2e 6c 65 6e 67 74 68 3b | 0d 09 09 7d 0d 09 09 2f |.length;|...}.../|
|000038d0| 2a 0d 09 09 20 2a 20 49 | 66 20 74 68 65 72 65 20 |*... * I|f there |
|000038e0| 69 73 20 61 6e 20 69 6e | 69 74 69 61 6c 20 6c 6f |is an in|itial lo|
|000038f0| 67 69 63 61 6c 20 61 72 | 65 61 20 6c 65 6e 67 74 |gical ar|ea lengt|
|00003900| 68 2c 20 63 6f 6d 70 75 | 74 65 20 74 68 65 20 62 |h, compu|te the b|
|00003910| 61 73 65 20 6f 66 20 74 | 68 65 20 69 6e 69 74 69 |ase of t|he initi|
|00003920| 61 6c 0d 09 09 20 2a 20 | 6c 6f 67 69 63 61 6c 20 |al... * |logical |
|00003930| 61 72 65 61 2e 20 54 68 | 65 20 66 69 72 73 74 20 |area. Th|e first |
|00003940| 70 68 79 73 69 63 61 6c | 20 74 72 61 6e 73 66 65 |physical| transfe|
|00003950| 72 20 77 69 6c 6c 20 62 | 65 20 6f 66 66 73 65 74 |r will b|e offset|
|00003960| 20 62 79 20 74 68 65 20 | 69 6e 69 74 69 61 6c 0d | by the |initial.|
|00003970| 09 09 20 2a 20 6c 6f 67 | 69 63 61 6c 20 6c 65 6e |.. * log|ical len|
|00003980| 67 74 68 2e 0d 09 09 20 | 2a 2f 0d 09 09 69 66 20 |gth.... |*/...if |
|00003990| 28 44 4d 41 2e 6c 6f 67 | 69 63 61 6c 53 74 61 72 |(DMA.log|icalStar|
|000039a0| 74 2e 6c 65 6e 67 74 68 | 20 21 3d 20 30 29 20 7b |t.length| != 0) {|
|000039b0| 0d 09 09 09 44 4d 41 2e | 66 69 72 73 74 50 61 67 |....DMA.|firstPag|
|000039c0| 65 4f 66 66 73 65 74 20 | 3d 20 44 4d 41 2e 6c 6f |eOffset |= DMA.lo|
|000039d0| 67 69 63 61 6c 53 74 61 | 72 74 2e 6c 65 6e 67 74 |gicalSta|rt.lengt|
|000039e0| 68 3b 0d 09 09 09 69 66 | 20 28 50 61 67 65 4f 66 |h;....if| (PageOf|
|000039f0| 66 73 65 74 28 6c 6f 67 | 69 63 61 6c 42 61 73 65 |fset(log|icalBase|
|00003a00| 20 2b 20 44 4d 41 2e 6c | 6f 67 69 63 61 6c 53 74 | + DMA.l|ogicalSt|
|00003a10| 61 72 74 2e 6c 65 6e 67 | 74 68 29 20 3d 3d 20 30 |art.leng|th) == 0|
|00003a20| 29 20 7b 0d 09 09 09 09 | 2f 2a 0d 09 09 09 09 20 |) {.....|/*..... |
|00003a30| 2a 20 53 69 6e 63 65 20 | 74 68 65 20 69 6e 69 74 |* Since |the init|
|00003a40| 69 61 6c 20 6c 6f 67 69 | 63 61 6c 20 61 72 65 61 |ial logi|cal area|
|00003a50| 20 63 6f 6e 73 75 6d 65 | 64 20 74 68 65 20 72 65 | consume|d the re|
|00003a60| 6d 61 69 6e 64 65 72 20 | 6f 66 20 61 20 70 68 79 |mainder |of a phy|
|00003a70| 73 69 63 61 6c 0d 09 09 | 09 09 20 2a 20 70 61 67 |sical...|.. * pag|
|00003a80| 65 2c 20 77 65 27 6c 6c | 20 6d 6f 76 65 20 74 6f |e, we'll| move to|
|00003a90| 20 74 68 65 20 73 74 61 | 72 74 20 6f 66 20 74 68 | the sta|rt of th|
|00003aa0| 65 20 6e 65 78 74 20 70 | 61 67 65 2e 0d 09 09 09 |e next p|age.....|
|00003ab0| 20 09 20 2a 2f 0d 09 09 | 09 09 2b 2b 44 4d 41 2e | . */...|..++DMA.|
|00003ac0| 70 68 79 73 69 63 61 6c | 4d 61 70 49 6e 64 65 78 |physical|MapIndex|
|00003ad0| 3b 0d 09 09 09 09 44 4d | 41 2e 66 69 72 73 74 50 |;.....DM|A.firstP|
|00003ae0| 61 67 65 4f 66 66 73 65 | 74 20 3d 20 30 3b 0d 09 |ageOffse|t = 0;..|
|00003af0| 09 09 7d 0d 09 09 7d 0d | 09 09 2f 2a 0d 09 09 20 |..}...}.|../*... |
|00003b00| 2a 20 49 66 20 74 68 65 | 72 65 20 69 73 20 61 20 |* If the|re is a |
|00003b10| 66 69 6e 61 6c 20 6c 6f | 67 69 63 61 6c 20 61 72 |final lo|gical ar|
|00003b20| 65 61 2c 20 63 6f 6d 70 | 75 74 65 20 69 74 73 20 |ea, comp|ute its |
|00003b30| 73 74 61 72 74 69 6e 67 | 20 61 64 64 72 65 73 73 |starting| address|
|00003b40| 2e 20 54 68 69 73 20 69 | 73 0d 09 09 20 2a 20 61 |. This i|s... * a|
|00003b50| 6c 73 6f 20 61 20 67 6f | 6f 64 20 70 6c 61 63 65 |lso a go|od place|
|00003b60| 20 74 6f 20 63 6f 6d 70 | 75 74 65 20 74 68 65 20 | to comp|ute the |
|00003b70| 6c 65 6e 67 74 68 20 6f | 66 20 74 68 65 20 66 69 |length o|f the fi|
|00003b80| 72 73 74 20 70 68 79 73 | 69 63 61 6c 20 70 61 67 |rst phys|ical pag|
|00003b90| 65 2e 20 28 4e 6f 74 65 | 0d 09 09 20 2a 20 74 68 |e. (Note|... * th|
|00003ba0| 61 74 20 74 68 65 20 69 | 6e 69 74 69 61 6c 20 6c |at the i|nitial l|
|00003bb0| 6f 67 69 63 61 6c 20 73 | 65 67 6d 65 6e 74 20 69 |ogical s|egment i|
|00003bc0| 73 20 69 6e 63 6c 75 64 | 65 64 20 69 6e 20 66 69 |s includ|ed in fi|
|00003bd0| 72 73 74 50 61 67 65 4c | 65 6e 67 74 68 29 2e 0d |rstPageL|ength)..|
|00003be0| 09 09 20 2a 2f 0d 09 09 | 66 69 72 73 74 50 61 67 |.. */...|firstPag|
|00003bf0| 65 4c 65 6e 67 74 68 20 | 3d 20 67 50 61 67 65 53 |eLength |= gPageS|
|00003c00| 69 7a 65 20 2d 20 50 61 | 67 65 4f 66 66 73 65 74 |ize - Pa|geOffset|
|00003c10| 28 6c 6f 67 69 63 61 6c | 42 61 73 65 29 3b 0d 09 |(logical|Base);..|
|00003c20| 09 69 66 20 28 66 69 72 | 73 74 50 61 67 65 4c 65 |.if (fir|stPageLe|
|00003c30| 6e 67 74 68 20 3e 20 73 | 65 67 6d 65 6e 74 4c 65 |ngth > s|egmentLe|
|00003c40| 6e 67 74 68 29 0d 09 09 | 09 66 69 72 73 74 50 61 |ngth)...|.firstPa|
|00003c50| 67 65 4c 65 6e 67 74 68 | 20 3d 20 73 65 67 6d 65 |geLength| = segme|
|00003c60| 6e 74 4c 65 6e 67 74 68 | 3b 0d 09 09 69 66 20 28 |ntLength|;...if (|
|00003c70| 44 4d 41 2e 6c 6f 67 69 | 63 61 6c 45 6e 64 2e 6c |DMA.logi|calEnd.l|
|00003c80| 65 6e 67 74 68 20 21 3d | 20 30 29 20 7b 0d 09 09 |ength !=| 0) {...|
|00003c90| 09 69 66 20 28 50 61 67 | 65 4f 66 66 73 65 74 28 |.if (Pag|eOffset(|
|00003ca0| 6c 6f 67 69 63 61 6c 42 | 61 73 65 29 20 2b 20 73 |logicalB|ase) + s|
|00003cb0| 65 67 6d 65 6e 74 4c 65 | 6e 67 74 68 20 3c 3d 20 |egmentLe|ngth <= |
|00003cc0| 67 50 61 67 65 53 69 7a | 65 29 20 7b 0d 09 09 09 |gPageSiz|e) {....|
|00003cd0| 09 2f 2a 0d 09 09 09 09 | 20 2a 20 53 69 6e 63 65 |./*.....| * Since|
|00003ce0| 20 74 68 65 20 65 6e 74 | 69 72 65 20 74 72 61 6e | the ent|ire tran|
|00003cf0| 73 66 65 72 20 69 73 20 | 63 6f 6e 74 61 69 6e 65 |sfer is |containe|
|00003d00| 64 20 77 69 74 68 69 6e | 20 61 20 73 69 6e 67 6c |d within| a singl|
|00003d10| 65 20 70 61 67 65 2c 0d | 09 09 09 09 20 2a 20 50 |e page,.|.... * P|
|00003d20| 72 65 70 61 72 65 4d 65 | 6d 6f 72 79 46 6f 72 49 |repareMe|moryForI|
|00003d30| 4f 20 77 69 6c 6c 20 6f | 6e 6c 79 20 63 6f 6d 70 |O will o|nly comp|
|00003d40| 75 74 65 20 61 20 73 69 | 6e 67 6c 65 20 72 65 73 |ute a si|ngle res|
|00003d50| 75 6c 74 20 6c 6f 67 69 | 63 61 6c 20 70 61 67 65 |ult logi|cal page|
|00003d60| 2e 0d 09 09 09 09 20 2a | 20 49 66 20 74 68 65 72 |...... *| If ther|
|00003d70| 65 20 69 73 20 6e 6f 20 | 70 68 79 73 69 63 61 6c |e is no |physical|
|00003d80| 20 74 72 61 6e 73 66 65 | 72 2c 20 63 6f 6d 62 69 | transfe|r, combi|
|00003d90| 6e 65 20 74 68 65 20 69 | 6e 69 74 69 61 6c 20 61 |ne the i|nitial a|
|00003da0| 6e 64 20 66 69 6e 61 6c | 0d 09 09 09 09 20 2a 20 |nd final|..... * |
|00003db0| 6c 6f 67 69 63 61 6c 20 | 74 72 61 6e 73 66 65 72 |logical |transfer|
|00003dc0| 73 2e 20 28 48 6d 6d 2e | 20 63 61 6e 20 74 68 69 |s. (Hmm.| can thi|
|00003dd0| 73 20 63 61 75 73 65 20 | 74 68 65 20 66 69 66 6f |s cause |the fifo|
|00003de0| 20 74 6f 20 63 68 6f 6b | 65 3f 29 0d 09 09 09 09 | to chok|e?).....|
|00003df0| 20 2a 2f 0d 09 09 09 09 | 69 66 20 28 44 4d 41 2e | */.....|if (DMA.|
|00003e00| 70 68 79 73 69 63 61 6c | 53 74 61 72 74 20 3e 3d |physical|Start >=|
|00003e10| 20 44 4d 41 2e 70 68 79 | 73 69 63 61 6c 45 6e 64 | DMA.phy|sicalEnd|
|00003e20| 29 20 7b 0d 09 09 09 09 | 09 44 4d 41 2e 6c 6f 67 |) {.....|.DMA.log|
|00003e30| 69 63 61 6c 53 74 61 72 | 74 2e 6c 65 6e 67 74 68 |icalStar|t.length|
|00003e40| 20 2b 3d 20 44 4d 41 2e | 6c 6f 67 69 63 61 6c 45 | += DMA.|logicalE|
|00003e50| 6e 64 2e 6c 65 6e 67 74 | 68 3b 0d 09 09 09 09 09 |nd.lengt|h;......|
|00003e60| 44 4d 41 2e 6c 6f 67 69 | 63 61 6c 45 6e 64 2e 6c |DMA.logi|calEnd.l|
|00003e70| 65 6e 67 74 68 20 3d 20 | 30 3b 0d 09 09 09 09 7d |ength = |0;.....}|
|00003e80| 0d 09 09 09 09 65 6c 73 | 65 20 7b 0d 09 09 09 09 |.....els|e {.....|
|00003e90| 09 2f 2a 0d 09 09 09 09 | 09 20 2a 20 54 68 65 20 |./*.....|. * The |
|00003ea0| 66 69 6e 61 6c 20 73 65 | 67 6d 65 6e 74 20 73 74 |final se|gment st|
|00003eb0| 61 72 74 73 20 61 74 20 | 74 68 65 20 65 6e 64 20 |arts at |the end |
|00003ec0| 6f 66 20 74 68 65 20 28 | 6f 6e 6c 79 29 20 6c 6f |of the (|only) lo|
|00003ed0| 67 69 63 61 6c 20 70 61 | 67 65 2e 0d 09 09 09 09 |gical pa|ge......|
|00003ee0| 09 20 2a 2f 0d 09 09 09 | 09 09 44 4d 41 2e 6c 6f |. */....|..DMA.lo|
|00003ef0| 67 69 63 61 6c 45 6e 64 | 2e 62 61 73 65 20 3d 20 |gicalEnd|.base = |
|00003f00| 28 76 6f 69 64 20 2a 29 | 0d 09 09 09 09 09 09 28 |(void *)|.......(|
|00003f10| 6c 6f 67 69 63 61 6c 42 | 61 73 65 20 2b 20 73 65 |logicalB|ase + se|
|00003f20| 67 6d 65 6e 74 4c 65 6e | 67 74 68 20 2d 20 44 4d |gmentLen|gth - DM|
|00003f30| 41 2e 6c 6f 67 69 63 61 | 6c 45 6e 64 2e 6c 65 6e |A.logica|lEnd.len|
|00003f40| 67 74 68 29 3b 0d 09 09 | 09 09 7d 0d 09 09 09 7d |gth);...|..}....}|
|00003f50| 0d 09 09 09 65 6c 73 65 | 20 7b 0d 09 09 09 09 2f |....else| {...../|
|00003f60| 2a 0d 09 09 09 09 20 2a | 20 54 68 65 72 65 20 61 |*..... *| There a|
|00003f70| 72 65 20 6d 75 6c 74 69 | 70 6c 65 20 70 61 67 65 |re multi|ple page|
|00003f80| 73 2e 20 54 68 65 20 66 | 69 6e 61 6c 20 6c 6f 67 |s. The f|inal log|
|00003f90| 69 63 61 6c 20 74 72 61 | 6e 73 66 65 72 20 73 74 |ical tra|nsfer st|
|00003fa0| 61 72 74 73 20 61 74 0d | 09 09 09 09 20 2a 20 74 |arts at.|.... * t|
|00003fb0| 68 65 20 62 61 73 65 20 | 6f 66 20 74 68 65 20 6c |he base |of the l|
|00003fc0| 61 73 74 20 70 61 67 65 | 2c 20 74 61 6b 65 6e 20 |ast page|, taken |
|00003fd0| 66 72 6f 6d 20 74 68 65 | 20 49 4f 54 61 62 6c 65 |from the| IOTable|
|00003fe0| 20 70 6c 75 73 20 74 68 | 65 0d 09 09 09 09 20 2a | plus th|e..... *|
|00003ff0| 20 61 6d 6f 75 6e 74 20 | 6f 66 20 70 68 79 73 69 | amount |of physi|
|00004000| 63 61 6c 20 74 72 61 6e | 73 66 65 72 20 74 68 61 |cal tran|sfer tha|
|00004010| 74 20 6c 69 76 65 73 20 | 69 6e 20 74 68 65 20 6c |t lives |in the l|
|00004020| 61 73 74 20 70 68 79 73 | 69 63 61 6c 20 70 61 67 |ast phys|ical pag|
|00004030| 65 2e 0d 09 09 09 09 20 | 2a 20 46 69 72 73 74 2c |e...... |* First,|
|00004040| 20 63 6f 6d 70 75 74 65 | 20 74 68 65 20 6e 75 6d | compute| the num|
|00004050| 62 65 72 20 6f 66 20 62 | 79 74 65 73 20 74 68 61 |ber of b|ytes tha|
|00004060| 74 20 77 69 6c 6c 20 62 | 65 20 74 72 61 6e 73 66 |t will b|e transf|
|00004070| 65 72 72 65 64 20 66 72 | 6f 6d 0d 09 09 09 09 20 |erred fr|om..... |
|00004080| 2a 20 74 68 65 20 6c 61 | 73 74 20 70 68 79 73 69 |* the la|st physi|
|00004090| 63 61 6c 20 28 69 2e 65 | 2e 2c 20 6c 6f 67 69 63 |cal (i.e|., logic|
|000040a0| 61 6c 29 20 70 61 67 65 | 2e 20 54 68 69 73 20 77 |al) page|. This w|
|000040b0| 69 6c 6c 20 62 65 20 61 | 20 63 6f 6d 62 69 6e 61 |ill be a| combina|
|000040c0| 74 69 6f 6e 0d 09 09 09 | 09 20 2a 20 6f 66 20 70 |tion....|. * of p|
|000040d0| 68 79 73 69 63 61 6c 20 | 61 6e 64 20 6c 6f 67 69 |hysical |and logi|
|000040e0| 63 61 6c 20 74 72 61 6e | 73 66 65 72 73 2c 20 61 |cal tran|sfers, a|
|000040f0| 6e 64 20 69 6e 63 6c 75 | 64 65 73 20 74 68 65 20 |nd inclu|des the |
|00004100| 66 69 6e 61 6c 20 6c 6f | 67 69 63 61 6c 0d 09 09 |final lo|gical...|
|00004110| 09 09 20 2a 20 74 72 61 | 6e 73 66 65 72 2e 20 50 |.. * tra|nsfer. P|
|00004120| 61 67 65 4f 66 66 73 65 | 74 20 72 65 6d 6f 76 65 |ageOffse|t remove|
|00004130| 73 20 61 6e 79 20 69 6e | 74 65 72 76 65 6e 69 6e |s any in|tervenin|
|00004140| 67 20 66 75 6c 6c 20 70 | 61 67 65 73 2e 0d 09 09 |g full p|ages....|
|00004150| 09 09 20 2a 2f 0d 09 09 | 09 09 6c 61 73 74 50 61 |.. */...|..lastPa|
|00004160| 67 65 4c 65 6e 67 74 68 | 20 3d 20 50 61 67 65 4f |geLength| = PageO|
|00004170| 66 66 73 65 74 28 73 65 | 67 6d 65 6e 74 4c 65 6e |ffset(se|gmentLen|
|00004180| 67 74 68 20 2d 20 66 69 | 72 73 74 50 61 67 65 4c |gth - fi|rstPageL|
|00004190| 65 6e 67 74 68 29 3b 0d | 09 09 09 09 44 4d 41 2e |ength);.|....DMA.|
|000041a0| 6c 6f 67 69 63 61 6c 45 | 6e 64 2e 62 61 73 65 20 |logicalE|nd.base |
|000041b0| 3d 20 28 76 6f 69 64 20 | 2a 29 20 28 0d 09 09 09 |= (void |*) (....|
|000041c0| 09 09 09 28 28 55 49 6e | 74 33 32 29 20 6c 6f 67 |...((UIn|t32) log|
|000041d0| 69 63 61 6c 4d 61 70 50 | 74 72 5b 31 5d 29 0d 09 |icalMapP|tr[1])..|
|000041e0| 09 09 09 09 09 2b 20 6c | 61 73 74 50 61 67 65 4c |.....+ l|astPageL|
|000041f0| 65 6e 67 74 68 0d 09 09 | 09 09 09 09 2d 20 44 4d |ength...|....- DM|
|00004200| 41 2e 6c 6f 67 69 63 61 | 6c 45 6e 64 2e 6c 65 6e |A.logica|lEnd.len|
|00004210| 67 74 68 0d 09 09 09 09 | 09 29 3b 0d 09 09 09 7d |gth.....|.);....}|
|00004220| 0d 09 09 7d 0d 23 75 6e | 64 65 66 20 6c 6f 67 69 |...}.#un|def logi|
|00004230| 63 61 6c 42 61 73 65 0d | 7d 0d 0d 2f 2a 09 2e 5f |calBase.|}../*.._|
|00004240| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004250| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004260| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004270| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004280| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004290| 5f 5f 2e 0d 20 20 09 7c | 20 47 65 74 4e 65 78 74 |__.. .|| GetNext|
|000042a0| 50 68 79 73 69 63 61 6c | 54 72 61 6e 73 66 65 72 |Physical|Transfer|
|000042b0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 7c |........|.......||
|000042c0| 0d 09 7c 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |..|.....|........|
|000042d0| 09 09 09 09 09 09 09 09 | 7c 0d 09 7c 20 43 6f 6d |........||..| Com|
|000042e0| 70 75 74 65 20 74 68 65 | 20 6e 65 78 74 20 70 68 |pute the| next ph|
|000042f0| 79 73 69 63 61 6c 20 73 | 65 67 6d 65 6e 74 2e 20 |ysical s|egment. |
|00004300| 49 74 20 62 65 67 69 6e | 73 20 66 72 6f 6d 20 74 |It begin|s from t|
|00004310| 68 65 20 63 75 72 72 65 | 6e 74 20 70 68 79 73 69 |he curre|nt physi|
|00004320| 63 61 6c 20 6c 6f 63 61 | 74 69 6f 6e 09 7c 0d 09 |cal loca|tion.|..|
|00004330| 7c 20 28 44 4d 41 2e 70 | 68 79 73 69 63 61 6c 46 || (DMA.p|hysicalF|
|00004340| 69 72 73 74 50 72 65 70 | 61 72 65 64 29 20 61 6e |irstPrep|ared) an|
|00004350| 64 20 65 78 74 65 6e 64 | 73 20 66 6f 72 20 61 73 |d extend|s for as|
|00004360| 20 6d 61 6e 79 20 70 61 | 67 65 73 20 61 73 20 61 | many pa|ges as a|
|00004370| 72 65 20 70 68 79 73 69 | 63 61 6c 6c 79 09 09 7c |re physi|cally..||
|00004380| 0d 09 7c 20 63 6f 6e 74 | 69 67 75 6f 75 73 2e 09 |..| cont|iguous..|
|00004390| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|000043a0| 09 7c 0d 09 7c 09 09 09 | 09 09 09 09 09 09 09 09 |.|..|...|........|
|000043b0| 09 09 09 09 09 09 09 09 | 09 09 7c 0d 09 7c 20 49 |........|..|..| I|
|000043c0| 6e 70 75 74 3a 09 09 09 | 09 09 09 09 09 09 09 09 |nput:...|........|
|000043d0| 09 09 09 09 09 09 09 09 | 7c 0d 09 7c 09 64 6d 61 |........||..|.dma|
|000043e0| 54 61 62 6c 65 50 74 72 | 09 09 09 54 68 65 20 44 |TablePtr|...The D|
|000043f0| 4d 41 54 72 61 6e 73 66 | 65 72 49 6e 66 6f 20 72 |MATransf|erInfo r|
|00004400| 65 63 6f 72 64 20 74 68 | 61 74 20 77 69 6c 6c 20 |ecord th|at will |
|00004410| 6d 61 6e 61 67 65 20 74 | 68 69 73 20 74 72 61 6e |manage t|his tran|
|00004420| 73 66 65 72 2e 09 7c 0d | 09 7c 09 70 61 67 65 4f |sfer..|.|.|.pageO|
|00004430| 66 66 73 65 74 09 09 09 | 4f 66 66 73 65 74 20 69 |ffset...|Offset i|
|00004440| 6e 74 6f 20 74 68 65 20 | 70 68 79 73 69 63 61 6c |nto the |physical|
|00004450| 20 70 61 67 65 20 2d 2d | 20 74 68 69 73 20 77 69 | page --| this wi|
|00004460| 6c 6c 20 62 65 20 6e 6f | 6e 2d 7a 65 72 6f 20 69 |ll be no|n-zero i|
|00004470| 66 09 7c 0d 09 7c 09 09 | 09 09 09 09 74 68 69 73 |f.|..|..|....this|
|00004480| 20 69 73 20 74 68 65 20 | 66 69 72 73 74 20 70 68 | is the |first ph|
|00004490| 79 73 69 63 61 6c 20 70 | 61 67 65 20 61 6e 64 20 |ysical p|age and |
|000044a0| 77 65 20 68 61 64 20 72 | 65 71 75 69 72 65 64 20 |we had r|equired |
|000044b0| 61 6e 09 09 7c 0d 09 7c | 09 09 09 09 09 09 69 6e |an..|..||......in|
|000044c0| 69 74 69 61 6c 20 6c 6f | 67 69 63 61 6c 20 74 72 |itial lo|gical tr|
|000044d0| 61 6e 73 66 65 72 20 74 | 6f 20 68 61 6e 64 6c 65 |ansfer t|o handle|
|000044e0| 20 75 6e 61 6c 69 67 6e | 65 64 20 6d 65 6d 6f 72 | unalign|ed memor|
|000044f0| 79 2e 09 09 7c 0d 09 7c | 09 09 09 09 09 09 09 09 |y...|..||........|
|00004500| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 7c 0d 09 |........|.....|..|
|00004510| 7c 20 4f 75 74 70 75 74 | 3a 09 09 09 09 09 09 09 || Output|:.......|
|00004520| 09 09 09 09 09 09 09 09 | 09 09 09 09 7c 0d 09 7c |........|....|..||
|00004530| 09 54 68 65 20 44 4d 41 | 20 67 6c 6f 62 61 6c 20 |.The DMA| global |
|00004540| 63 6f 6e 74 65 78 74 20 | 69 73 20 75 70 64 61 74 |context |is updat|
|00004550| 65 64 2e 09 09 09 09 09 | 09 09 09 09 09 09 09 7c |ed......|.......||
|00004560| 0d 09 7c 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |..|.....|........|
|00004570| 09 09 09 09 09 09 09 09 | 7c 0d 09 7c 20 52 65 73 |........||..| Res|
|00004580| 75 6c 74 3a 09 09 09 09 | 09 09 09 09 09 09 09 09 |ult:....|........|
|00004590| 09 09 09 09 09 09 09 7c | 0d 09 7c 09 54 52 55 45 |.......||..|.TRUE|
|000045a0| 20 69 66 20 74 68 65 72 | 65 20 69 73 20 61 20 70 | if ther|e is a p|
|000045b0| 68 79 73 69 63 61 6c 20 | 74 72 61 6e 73 66 65 72 |hysical |transfer|
|000045c0| 20 72 65 6d 61 69 6e 69 | 6e 67 2e 09 09 09 09 09 | remaini|ng......|
|000045d0| 09 09 09 09 7c 0d 09 2e | 5f 5f 5f 5f 5f 5f 5f 5f |....|...|________|
|000045e0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|000045f0| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004600| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004610| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00004620| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 2e 0d 20 2a 2f |________|___.. */|
|00004630| 0d 73 74 61 74 69 63 20 | 42 6f 6f 6c 65 61 6e 0d |.static |Boolean.|
|00004640| 47 65 74 4e 65 78 74 50 | 68 79 73 69 63 61 6c 54 |GetNextP|hysicalT|
|00004650| 72 61 6e 73 66 65 72 28 | 0d 09 09 44 4d 41 54 72 |ransfer(|...DMATr|
|00004660| 61 6e 73 66 65 72 49 6e | 66 6f 50 74 72 09 09 64 |ansferIn|foPtr..d|
|00004670| 6d 61 54 61 62 6c 65 50 | 74 72 0d 09 29 0d 7b 0d |maTableP|tr..).{.|
|00004680| 09 09 63 6f 6e 73 74 20 | 49 4f 50 72 65 70 61 72 |..const |IOPrepar|
|00004690| 61 74 69 6f 6e 54 61 62 | 6c 65 20 2a 69 6f 54 61 |ationTab|le *ioTa|
|000046a0| 62 6c 65 50 74 72 3b 0d | 09 09 42 79 74 65 43 6f |blePtr;.|..ByteCo|
|000046b0| 75 6e 74 09 09 09 09 6e | 65 77 50 6f 73 69 74 69 |unt....n|ewPositi|
|000046c0| 6f 6e 3b 0d 09 09 42 6f | 6f 6c 65 61 6e 09 09 09 |on;...Bo|olean...|
|000046d0| 09 09 72 65 73 75 6c 74 | 3b 0d 0d 09 09 69 6f 54 |..result|;....ioT|
|000046e0| 61 62 6c 65 50 74 72 20 | 3d 20 44 4d 41 2e 69 6f |ablePtr |= DMA.io|
|000046f0| 54 61 62 6c 65 50 74 72 | 3b 0d 09 09 69 66 20 28 |TablePtr|;...if (|
|00004700| 44 4d 41 2e 70 68 79 73 | 69 63 61 6c 53 74 61 72 |DMA.phys|icalStar|
|00004710| 74 20 3e 3d 20 44 4d 41 | 2e 70 68 79 73 69 63 61 |t >= DMA|.physica|
|00004720| 6c 45 6e 64 29 20 7b 0d | 09 09 09 44 4d 41 2e 70 |lEnd) {.|...DMA.p|
|00004730| 68 79 73 69 63 61 6c 52 | 61 6e 67 65 2e 6c 65 6e |hysicalR|ange.len|
|00004740| 67 74 68 20 3d 20 30 3b | 0d 09 09 09 72 65 73 75 |gth = 0;|....resu|
|00004750| 6c 74 20 3d 20 46 41 4c | 53 45 3b 0d 09 09 7d 0d |lt = FAL|SE;...}.|
|00004760| 09 09 65 6c 73 65 20 7b | 0d 09 09 09 44 4d 41 2e |..else {|....DMA.|
|00004770| 70 68 79 73 69 63 61 6c | 52 61 6e 67 65 2e 62 61 |physical|Range.ba|
|00004780| 73 65 20 3d 20 28 76 6f | 69 64 20 2a 29 0d 09 09 |se = (vo|id *)...|
|00004790| 09 09 09 09 28 28 28 55 | 49 6e 74 33 32 29 20 49 |....(((U|Int32) I|
|000047a0| 4f 2e 70 68 79 73 69 63 | 61 6c 4d 61 70 70 69 6e |O.physic|alMappin|
|000047b0| 67 5b 44 4d 41 2e 70 68 | 79 73 69 63 61 6c 4d 61 |g[DMA.ph|ysicalMa|
|000047c0| 70 49 6e 64 65 78 5d 29 | 0d 09 09 09 09 09 09 2b |pIndex])|.......+|
|000047d0| 20 44 4d 41 2e 66 69 72 | 73 74 50 61 67 65 4f 66 | DMA.fir|stPageOf|
|000047e0| 66 73 65 74 0d 09 09 09 | 09 09 29 3b 0d 09 09 09 |fset....|..);....|
|000047f0| 44 4d 41 2e 66 69 72 73 | 74 50 61 67 65 4f 66 66 |DMA.firs|tPageOff|
|00004800| 73 65 74 20 3d 20 30 3b | 0d 09 09 09 2f 2a 0d 09 |set = 0;|..../*..|
|00004810| 09 09 20 2a 20 54 68 65 | 20 72 61 6e 67 65 20 6c |.. * The| range l|
|00004820| 65 6e 67 74 68 20 65 78 | 74 65 6e 64 73 20 66 72 |ength ex|tends fr|
|00004830| 6f 6d 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 70 |om the c|urrent p|
|00004840| 61 67 65 20 6f 66 66 73 | 65 74 20 74 6f 20 74 68 |age offs|et to th|
|00004850| 65 20 65 6e 64 20 6f 66 | 0d 09 09 09 20 2a 20 74 |e end of|.... * t|
|00004860| 68 65 20 70 61 67 65 2e | 20 49 66 20 77 65 20 73 |he page.| If we s|
|00004870| 74 61 72 74 20 61 74 20 | 74 68 65 20 62 65 67 69 |tart at |the begi|
|00004880| 6e 6e 69 6e 67 20 6f 66 | 20 74 68 65 20 70 61 67 |nning of| the pag|
|00004890| 65 2c 20 50 61 67 65 4f | 66 66 73 65 74 20 77 69 |e, PageO|ffset wi|
|000048a0| 6c 6c 0d 09 09 09 20 2a | 20 62 65 20 7a 65 72 6f |ll.... *| be zero|
|000048b0| 2e 0d 09 09 09 20 2a 2f | 0d 09 09 09 44 4d 41 2e |..... */|....DMA.|
|000048c0| 70 68 79 73 69 63 61 6c | 52 61 6e 67 65 2e 6c 65 |physical|Range.le|
|000048d0| 6e 67 74 68 20 3d 0d 09 | 09 09 09 09 09 67 50 61 |ngth =..|.....gPa|
|000048e0| 67 65 53 69 7a 65 20 2d | 20 50 61 67 65 4f 66 66 |geSize -| PageOff|
|000048f0| 73 65 74 28 28 55 49 6e | 74 33 32 29 20 44 4d 41 |set((UIn|t32) DMA|
|00004900| 2e 70 68 79 73 69 63 61 | 6c 52 61 6e 67 65 2e 62 |.physica|lRange.b|
|00004910| 61 73 65 29 3b 0d 09 09 | 09 6e 65 77 50 6f 73 69 |ase);...|.newPosi|
|00004920| 74 69 6f 6e 20 3d 20 44 | 4d 41 2e 70 68 79 73 69 |tion = D|MA.physi|
|00004930| 63 61 6c 53 74 61 72 74 | 20 2b 20 44 4d 41 2e 70 |calStart| + DMA.p|
|00004940| 68 79 73 69 63 61 6c 52 | 61 6e 67 65 2e 6c 65 6e |hysicalR|ange.len|
|00004950| 67 74 68 3b 0d 09 09 09 | 77 68 69 6c 65 20 28 6e |gth;....|while (n|
|00004960| 65 77 50 6f 73 69 74 69 | 6f 6e 20 3c 20 44 4d 41 |ewPositi|on < DMA|
|00004970| 2e 70 68 79 73 69 63 61 | 6c 45 6e 64 0d 09 09 09 |.physica|lEnd....|
|00004980| 09 26 26 20 4e 65 78 74 | 50 61 67 65 49 73 43 6f |.&& Next|PageIsCo|
|00004990| 6e 74 69 67 75 6f 75 73 | 28 49 4f 2e 70 68 79 73 |ntiguous|(IO.phys|
|000049a0| 69 63 61 6c 4d 61 70 70 | 69 6e 67 2c 20 44 4d 41 |icalMapp|ing, DMA|
|000049b0| 2e 70 68 79 73 69 63 61 | 6c 4d 61 70 49 6e 64 65 |.physica|lMapInde|
|000049c0| 78 29 29 20 7b 0d 09 09 | 09 09 2b 2b 44 4d 41 2e |x)) {...|..++DMA.|
|000049d0| 70 68 79 73 69 63 61 6c | 4d 61 70 49 6e 64 65 78 |physical|MapIndex|
|000049e0| 3b 0d 09 09 09 09 44 4d | 41 2e 70 68 79 73 69 63 |;.....DM|A.physic|
|000049f0| 61 6c 52 61 6e 67 65 2e | 6c 65 6e 67 74 68 20 2b |alRange.|length +|
|00004a00| 3d 20 67 50 61 67 65 53 | 69 7a 65 3b 0d 09 09 09 |= gPageS|ize;....|
|00004a10| 09 6e 65 77 50 6f 73 69 | 74 69 6f 6e 20 2b 3d 20 |.newPosi|tion += |
|00004a20| 67 50 61 67 65 53 69 7a | 65 3b 0d 09 09 09 7d 0d |gPageSiz|e;....}.|
|00004a30| 09 09 09 2f 2a 0d 09 09 | 09 20 2a 20 57 65 27 76 |.../*...|. * We'v|
|00004a40| 65 20 72 65 61 63 68 65 | 64 20 74 68 65 20 65 6e |e reache|d the en|
|00004a50| 64 20 6f 66 20 74 68 65 | 20 70 68 79 73 69 63 61 |d of the| physica|
|00004a60| 6c 20 73 65 71 75 65 6e | 63 65 20 2d 2d 20 6f 72 |l sequen|ce -- or|
|00004a70| 20 61 73 20 66 61 72 20 | 61 73 20 77 65 20 63 61 | as far |as we ca|
|00004a80| 6e 0d 09 09 09 20 2a 20 | 67 6f 20 74 68 69 73 20 |n.... * |go this |
|00004a90| 74 69 6d 65 2e 20 57 65 | 27 6c 6c 20 61 6c 77 61 |time. We|'ll alwa|
|00004aa0| 79 73 20 72 65 73 74 61 | 72 74 20 61 74 20 74 68 |ys resta|rt at th|
|00004ab0| 65 20 6e 65 78 74 20 73 | 65 71 75 65 6e 63 65 2e |e next s|equence.|
|00004ac0| 20 46 69 6e 61 6c 6c 79 | 2c 0d 09 09 09 20 2a 20 | Finally|,.... * |
|00004ad0| 65 6e 73 75 72 65 20 74 | 68 61 74 20 77 65 20 64 |ensure t|hat we d|
|00004ae0| 69 64 6e 27 74 20 66 61 | 6c 6c 20 6f 66 66 20 74 |idn't fa|ll off t|
|00004af0| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 70 72 |he end o|f the pr|
|00004b00| 65 70 61 72 61 74 69 6f | 6e 2e 0d 09 09 09 20 2a |eparatio|n..... *|
|00004b10| 2f 0d 09 09 09 2b 2b 44 | 4d 41 2e 70 68 79 73 69 |/....++D|MA.physi|
|00004b20| 63 61 6c 4d 61 70 49 6e | 64 65 78 3b 0d 09 09 09 |calMapIn|dex;....|
|00004b30| 69 66 20 28 6e 65 77 50 | 6f 73 69 74 69 6f 6e 20 |if (newP|osition |
|00004b40| 3e 20 44 4d 41 2e 70 68 | 79 73 69 63 61 6c 45 6e |> DMA.ph|ysicalEn|
|00004b50| 64 29 20 7b 0d 09 09 09 | 09 6e 65 77 50 6f 73 69 |d) {....|.newPosi|
|00004b60| 74 69 6f 6e 20 3d 20 44 | 4d 41 2e 70 68 79 73 69 |tion = D|MA.physi|
|00004b70| 63 61 6c 45 6e 64 3b 0d | 09 09 09 09 44 4d 41 2e |calEnd;.|....DMA.|
|00004b80| 70 68 79 73 69 63 61 6c | 52 61 6e 67 65 2e 6c 65 |physical|Range.le|
|00004b90| 6e 67 74 68 20 3d 20 6e | 65 77 50 6f 73 69 74 69 |ngth = n|ewPositi|
|00004ba0| 6f 6e 20 2d 20 44 4d 41 | 2e 70 68 79 73 69 63 61 |on - DMA|.physica|
|00004bb0| 6c 53 74 61 72 74 3b 0d | 09 09 09 7d 0d 09 09 09 |lStart;.|...}....|
|00004bc0| 44 4d 41 2e 70 68 79 73 | 69 63 61 6c 53 74 61 72 |DMA.phys|icalStar|
|00004bd0| 74 20 3d 20 6e 65 77 50 | 6f 73 69 74 69 6f 6e 3b |t = newP|osition;|
|00004be0| 0d 09 09 09 72 65 73 75 | 6c 74 20 3d 20 54 52 55 |....resu|lt = TRU|
|00004bf0| 45 3b 0d 09 09 7d 0d 09 | 09 72 65 74 75 72 6e 20 |E;...}..|.return |
|00004c00| 28 72 65 73 75 6c 74 29 | 3b 0d 7d 0d 0d 23 69 66 |(result)|;.}..#if|
|00004c10| 20 54 45 53 54 49 4e 47 | 0d 23 69 6e 63 6c 75 64 | TESTING|.#includ|
|00004c20| 65 20 3c 73 74 64 6c 69 | 62 2e 68 3e 0d 23 69 6e |e <stdli|b.h>.#in|
|00004c30| 63 6c 75 64 65 20 3c 63 | 6f 6e 73 6f 6c 65 2e 68 |clude <c|onsole.h|
|00004c40| 3e 0d 0d 23 75 6e 64 65 | 66 20 44 4d 41 0d 23 75 |>..#unde|f DMA.#u|
|00004c50| 6e 64 65 66 20 49 4f 0d | 0d 23 64 65 66 69 6e 65 |ndef IO.|.#define|
|00004c60| 20 6b 57 6f 72 6b 53 69 | 7a 65 09 09 09 33 32 37 | kWorkSi|ze...327|
|00004c70| 36 38 0d 23 64 65 66 69 | 6e 65 20 6b 50 61 67 65 |68.#defi|ne kPage|
|00004c80| 53 69 7a 65 09 09 09 34 | 30 39 36 0d 23 64 65 66 |Size...4|096.#def|
|00004c90| 69 6e 65 20 6b 4d 61 78 | 53 63 61 74 74 65 72 47 |ine kMax|ScatterG|
|00004ca0| 61 74 68 65 72 09 31 36 | 0d 55 49 6e 74 38 09 09 |ather.16|.UInt8..|
|00004cb0| 09 09 09 09 67 57 6f 72 | 6b 41 72 65 61 5b 6b 57 |....gWor|kArea[kW|
|00004cc0| 6f 72 6b 53 69 7a 65 20 | 2b 20 6b 50 61 67 65 53 |orkSize |+ kPageS|
|00004cd0| 69 7a 65 5d 3b 0d 55 49 | 6e 74 38 09 09 09 09 09 |ize];.UI|nt8.....|
|00004ce0| 09 2a 67 57 6f 72 6b 41 | 72 65 61 53 74 61 72 74 |.*gWorkA|reaStart|
|00004cf0| 3b 0d 55 49 6e 74 33 32 | 09 09 09 09 09 09 67 50 |;.UInt32|......gP|
|00004d00| 61 67 65 41 6c 69 67 6e | 3b 0d 49 4f 50 72 65 70 |ageAlign|;.IOPrep|
|00004d10| 61 72 61 74 69 6f 6e 54 | 61 62 6c 65 09 09 09 67 |arationT|able...g|
|00004d20| 49 4f 54 61 62 6c 65 3b | 0d 41 64 64 72 65 73 73 |IOTable;|.Address|
|00004d30| 52 61 6e 67 65 09 09 09 | 09 67 53 63 61 74 74 65 |Range...|.gScatte|
|00004d40| 72 47 61 74 68 65 72 54 | 61 62 6c 65 5b 6b 4d 61 |rGatherT|able[kMa|
|00004d50| 78 53 63 61 74 74 65 72 | 47 61 74 68 65 72 5d 3b |xScatter|Gather];|
|00004d60| 0d 4c 6f 67 69 63 61 6c | 41 64 64 72 65 73 73 09 |.Logical|Address.|
|00004d70| 09 09 09 67 4c 6f 67 69 | 63 61 6c 4d 61 70 70 69 |...gLogi|calMappi|
|00004d80| 6e 67 5b 6b 4d 61 78 53 | 63 61 74 74 65 72 47 61 |ng[kMaxS|catterGa|
|00004d90| 74 68 65 72 20 2a 20 32 | 5d 3b 0d 50 68 79 73 69 |ther * 2|];.Physi|
|00004da0| 63 61 6c 41 64 64 72 65 | 73 73 09 09 09 09 67 50 |calAddre|ss....gP|
|00004db0| 68 79 73 69 63 61 6c 4d | 61 70 70 69 6e 67 5b 28 |hysicalM|apping[(|
|00004dc0| 6b 57 6f 72 6b 53 69 7a | 65 20 2f 20 6b 50 61 67 |kWorkSiz|e / kPag|
|00004dd0| 65 53 69 7a 65 29 20 2b | 20 32 5d 3b 0d 44 4d 41 |eSize) +| 2];.DMA|
|00004de0| 54 72 61 6e 73 66 65 72 | 49 6e 66 6f 09 09 09 09 |Transfer|Info....|
|00004df0| 67 44 4d 41 54 61 62 6c | 65 3b 0d 0d 74 79 70 65 |gDMATabl|e;..type|
|00004e00| 64 65 66 20 73 74 72 75 | 63 74 20 53 69 6d 70 6c |def stru|ct Simpl|
|00004e10| 65 41 72 65 61 20 7b 0d | 09 55 49 6e 74 33 32 09 |eArea {.|.UInt32.|
|00004e20| 09 09 09 6f 66 66 73 65 | 74 3b 0d 09 55 49 6e 74 |...offse|t;..UInt|
|00004e30| 33 32 09 09 09 09 62 79 | 74 65 43 6f 75 6e 74 3b |32....by|teCount;|
|00004e40| 0d 7d 20 53 69 6d 70 6c | 65 41 72 65 61 2c 20 2a |.} Simpl|eArea, *|
|00004e50| 53 69 6d 70 6c 65 41 72 | 65 61 50 74 72 3b 0d 0d |SimpleAr|eaPtr;..|
|00004e60| 53 69 6d 70 6c 65 41 72 | 65 61 09 09 09 67 53 69 |SimpleAr|ea...gSi|
|00004e70| 6d 70 6c 65 54 65 73 74 | 5b 5d 20 3d 20 7b 0d 09 |mpleTest|[] = {..|
|00004e80| 7b 09 09 30 2c 09 09 09 | 09 31 36 33 38 34 09 09 |{..0,...|.16384..|
|00004e90| 7d 2c 0d 23 69 66 20 30 | 0d 09 7b 09 09 31 2c 09 |},.#if 0|..{..1,.|
|00004ea0| 09 09 09 34 30 39 36 09 | 09 7d 2c 0d 09 7b 09 09 |...4096.|.},..{..|
|00004eb0| 31 2c 09 09 09 09 31 36 | 33 38 34 09 09 7d 2c 0d |1,....16|384..},.|
|00004ec0| 09 7b 09 09 32 2c 09 09 | 09 09 34 30 39 36 09 09 |.{..2,..|..4096..|
|00004ed0| 7d 2c 0d 09 7b 09 09 33 | 2c 09 09 09 09 34 30 39 |},..{..3|,....409|
|00004ee0| 36 09 09 7d 2c 0d 09 7b | 09 09 35 2c 09 09 09 09 |6..},..{|..5,....|
|00004ef0| 34 30 39 36 09 09 7d 2c | 0d 09 7b 09 09 38 2c 09 |4096..},|..{..8,.|
|00004f00| 09 09 09 34 30 39 36 09 | 09 7d 2c 0d 09 7b 09 09 |...4096.|.},..{..|
|00004f10| 31 33 2c 09 09 09 09 34 | 30 39 36 09 09 7d 2c 0d |13,....4|096..},.|
|00004f20| 09 7b 09 09 32 31 2c 09 | 09 09 09 34 30 39 36 09 |.{..21,.|...4096.|
|00004f30| 09 7d 2c 0d 09 7b 09 09 | 30 2c 09 09 09 09 31 09 |.},..{..|0,....1.|
|00004f40| 09 09 7d 2c 0d 09 7b 09 | 09 30 2c 09 09 09 09 32 |..},..{.|.0,....2|
|00004f50| 09 09 09 7d 2c 0d 09 7b | 09 09 30 2c 09 09 09 09 |...},..{|..0,....|
|00004f60| 31 34 09 09 09 7d 2c 0d | 09 7b 09 09 30 2c 09 09 |14...},.|.{..0,..|
|00004f70| 09 09 31 35 09 09 09 7d | 2c 0d 09 7b 09 09 30 2c |..15...}|,..{..0,|
|00004f80| 09 09 09 09 31 36 09 09 | 09 7d 2c 0d 09 7b 09 09 |....16..|.},..{..|
|00004f90| 30 2c 09 09 09 09 31 37 | 09 09 09 7d 2c 0d 09 7b |0,....17|...},..{|
|00004fa0| 09 09 30 2c 09 09 09 09 | 31 38 09 09 09 7d 2c 0d |..0,....|18...},.|
|00004fb0| 09 7b 09 09 34 30 39 35 | 2c 09 09 09 31 09 09 09 |.{..4095|,...1...|
|00004fc0| 7d 2c 0d 09 7b 09 09 34 | 30 39 35 2c 09 09 09 32 |},..{..4|095,...2|
|00004fd0| 09 09 09 7d 2c 0d 09 7b | 09 09 34 30 39 35 2c 09 |...},..{|..4095,.|
|00004fe0| 09 09 33 09 09 09 7d 2c | 0d 09 7b 09 09 34 30 39 |..3...},|..{..409|
|00004ff0| 35 2c 09 09 09 34 09 09 | 09 7d 2c 0d 09 7b 09 09 |5,...4..|.},..{..|
|00005000| 34 30 39 35 2c 09 09 09 | 34 30 39 35 09 09 7d 2c |4095,...|4095..},|
|00005010| 0d 09 7b 09 09 34 30 39 | 35 2c 09 09 09 34 30 39 |..{..409|5,...409|
|00005020| 36 09 09 7d 2c 0d 09 7b | 09 09 34 30 39 35 2c 09 |6..},..{|..4095,.|
|00005030| 09 09 34 30 39 37 09 09 | 7d 2c 0d 09 7b 09 09 34 |..4097..|},..{..4|
|00005040| 30 39 35 2c 09 09 09 38 | 31 39 35 09 09 7d 2c 0d |095,...8|195..},.|
|00005050| 09 7b 09 09 38 31 39 33 | 2c 09 09 09 35 31 37 09 |.{..8193|,...517.|
|00005060| 09 09 7d 2c 0d 23 65 6e | 64 69 66 0d 09 7b 09 09 |..},.#en|dif..{..|
|00005070| 30 2c 09 09 09 09 30 09 | 09 09 7d 0d 7d 3b 0d 53 |0,....0.|..}.};.S|
|00005080| 69 6d 70 6c 65 41 72 65 | 61 09 09 09 67 53 47 54 |impleAre|a...gSGT|
|00005090| 65 73 74 31 5b 5d 20 3d | 20 7b 09 09 09 2f 2a 20 |est1[] =| {.../* |
|000050a0| 53 69 6d 70 6c 65 20 53 | 47 20 61 72 65 61 09 09 |Simple S|G area..|
|000050b0| 09 09 09 2a 2f 0d 09 09 | 7b 09 30 2c 09 09 09 09 |...*/...|{.0,....|
|000050c0| 34 30 39 36 09 7d 2c 0d | 09 09 7b 09 30 2c 09 09 |4096.},.|..{.0,..|
|000050d0| 09 09 30 09 09 7d 0d 7d | 3b 0d 53 69 6d 70 6c 65 |..0..}.}|;.Simple|
|000050e0| 41 72 65 61 09 09 09 67 | 53 47 54 65 73 74 32 5b |Area...g|SGTest2[|
|000050f0| 5d 20 3d 20 7b 09 09 09 | 2f 2a 20 54 77 6f 20 73 |] = {...|/* Two s|
|00005100| 69 6d 70 6c 65 20 61 72 | 65 61 73 09 09 09 09 09 |imple ar|eas.....|
|00005110| 2a 2f 0d 09 09 7b 09 30 | 2c 09 09 09 09 34 30 39 |*/...{.0|,....409|
|00005120| 36 09 7d 2c 0d 09 09 7b | 09 38 31 39 32 2c 09 09 |6.},...{|.8192,..|
|00005130| 09 34 30 39 36 09 7d 2c | 0d 09 09 7b 09 30 2c 09 |.4096.},|...{.0,.|
|00005140| 09 09 09 30 09 09 7d 0d | 7d 3b 0d 53 69 6d 70 6c |...0..}.|};.Simpl|
|00005150| 65 41 72 65 61 09 09 09 | 67 53 47 54 65 73 74 33 |eArea...|gSGTest3|
|00005160| 5b 5d 20 3d 20 7b 09 09 | 09 2f 2a 20 54 68 72 65 |[] = {..|./* Thre|
|00005170| 65 20 72 65 70 65 61 74 | 65 64 20 6c 6f 67 69 63 |e repeat|ed logic|
|00005180| 61 6c 20 74 72 61 6e 73 | 66 65 72 73 09 2a 2f 0d |al trans|fers.*/.|
|00005190| 09 09 7b 09 30 2c 09 09 | 09 09 31 09 09 7d 2c 0d |..{.0,..|..1..},.|
|000051a0| 09 09 7b 09 30 2c 09 09 | 09 09 31 09 09 7d 2c 0d |..{.0,..|..1..},.|
|000051b0| 09 09 7b 09 30 2c 09 09 | 09 09 31 09 09 7d 2c 0d |..{.0,..|..1..},.|
|000051c0| 09 09 7b 09 30 2c 09 09 | 09 09 30 09 09 7d 0d 7d |..{.0,..|..0..}.}|
|000051d0| 3b 0d 53 69 6d 70 6c 65 | 41 72 65 61 09 09 09 67 |;.Simple|Area...g|
|000051e0| 53 47 54 65 73 74 34 5b | 5d 20 3d 20 7b 09 09 09 |SGTest4[|] = {...|
|000051f0| 2f 2a 20 54 77 6f 20 61 | 64 6a 61 63 65 6e 74 20 |/* Two a|djacent |
|00005200| 61 72 65 61 73 20 69 6e | 20 6f 6e 65 20 70 61 67 |areas in| one pag|
|00005210| 65 09 2a 2f 0d 09 09 7b | 09 30 2c 09 09 09 09 35 |e.*/...{|.0,....5|
|00005220| 31 32 09 09 7d 2c 0d 09 | 09 7b 09 35 31 32 2c 09 |12..},..|.{.512,.|
|00005230| 09 09 35 31 32 09 09 7d | 2c 0d 09 09 7b 09 30 2c |..512..}|,...{.0,|
|00005240| 09 09 09 09 30 09 09 7d | 0d 09 7d 3b 0d 53 69 6d |....0..}|..};.Sim|
|00005250| 70 6c 65 41 72 65 61 09 | 09 09 67 53 47 54 65 73 |pleArea.|..gSGTes|
|00005260| 74 35 5b 5d 20 3d 20 7b | 09 09 09 2f 2a 20 54 77 |t5[] = {|.../* Tw|
|00005270| 6f 20 69 64 65 6e 74 69 | 63 61 6c 20 61 72 65 61 |o identi|cal area|
|00005280| 73 09 09 09 09 2a 2f 0d | 09 09 7b 09 30 2c 09 09 |s....*/.|..{.0,..|
|00005290| 09 09 35 31 32 09 09 7d | 2c 0d 09 09 7b 09 30 2c |..512..}|,...{.0,|
|000052a0| 09 09 09 09 35 31 32 09 | 09 7d 2c 0d 09 09 7b 09 |....512.|.},...{.|
|000052b0| 30 2c 09 09 09 09 30 09 | 09 7d 0d 7d 3b 0d 53 69 |0,....0.|.}.};.Si|
|000052c0| 6d 70 6c 65 41 72 65 61 | 09 09 09 67 53 47 54 65 |mpleArea|...gSGTe|
|000052d0| 73 74 36 5b 5d 20 3d 20 | 7b 09 09 09 2f 2a 20 46 |st6[] = |{.../* F|
|000052e0| 6f 75 72 20 72 61 6e 64 | 6f 6d 6c 79 20 63 6f 6d |our rand|omly com|
|000052f0| 70 6c 65 78 20 61 72 65 | 61 73 09 09 2a 2f 0d 09 |plex are|as..*/..|
|00005300| 09 7b 09 30 2c 09 09 09 | 09 31 09 09 7d 2c 0d 09 |.{.0,...|.1..},..|
|00005310| 09 7b 09 38 31 39 33 2c | 09 09 09 35 31 37 09 09 |.{.8193,|...517..|
|00005320| 7d 2c 0d 09 09 7b 09 38 | 31 39 33 2c 09 09 09 35 |},...{.8|193,...5|
|00005330| 31 36 09 09 7d 2c 0d 09 | 09 7b 09 30 2c 09 09 09 |16..},..|.{.0,...|
|00005340| 09 31 09 09 7d 2c 0d 09 | 09 7b 09 30 2c 09 09 09 |.1..},..|.{.0,...|
|00005350| 09 30 09 09 7d 0d 7d 3b | 0d 53 69 6d 70 6c 65 41 |.0..}.};|.SimpleA|
|00005360| 72 65 61 09 09 09 67 53 | 47 54 65 73 74 37 5b 5d |rea...gS|GTest7[]|
|00005370| 20 3d 20 7b 0d 09 09 7b | 09 30 2c 09 09 09 09 31 | = {...{|.0,....1|
|00005380| 36 33 38 34 09 7d 2c 0d | 09 09 7b 09 38 31 39 32 |6384.},.|..{.8192|
|00005390| 2c 09 09 09 31 36 33 38 | 34 09 7d 2c 0d 09 09 7b |,...1638|4.},...{|
|000053a0| 09 30 2c 09 09 09 09 30 | 09 09 7d 0d 7d 3b 0d 53 |.0,....0|..}.};.S|
|000053b0| 69 6d 70 6c 65 41 72 65 | 61 09 09 09 67 53 47 54 |impleAre|a...gSGT|
|000053c0| 65 73 74 38 5b 5d 20 3d | 20 7b 0d 09 09 7b 09 31 |est8[] =| {...{.1|
|000053d0| 2c 09 09 09 09 31 09 09 | 7d 2c 0d 09 09 7b 09 32 |,....1..|},...{.2|
|000053e0| 2c 09 09 09 09 31 09 09 | 7d 2c 0d 09 09 7b 09 38 |,....1..|},...{.8|
|000053f0| 31 39 33 2c 09 09 09 31 | 09 09 7d 2c 0d 09 09 7b |193,...1|..},...{|
|00005400| 09 30 2c 09 09 09 09 30 | 09 09 7d 0d 7d 3b 0d 0d |.0,....0|..}.};..|
|00005410| 53 69 6d 70 6c 65 41 72 | 65 61 09 09 09 2a 67 53 |SimpleAr|ea...*gS|
|00005420| 47 54 65 73 74 56 65 63 | 74 6f 72 5b 5d 20 3d 20 |GTestVec|tor[] = |
|00005430| 7b 0d 2f 2f 09 67 53 47 | 54 65 73 74 31 2c 20 67 |{.//.gSG|Test1, g|
|00005440| 53 47 54 65 73 74 32 2c | 20 67 53 47 54 65 73 74 |SGTest2,| gSGTest|
|00005450| 33 2c 20 67 53 47 54 65 | 73 74 34 2c 20 67 53 47 |3, gSGTe|st4, gSG|
|00005460| 54 65 73 74 35 2c 20 67 | 53 47 54 65 73 74 36 2c |Test5, g|SGTest6,|
|00005470| 0d 09 67 53 47 54 65 73 | 74 37 2c 20 67 53 47 54 |..gSGTes|t7, gSGT|
|00005480| 65 73 74 38 2c 0d 09 4e | 55 4c 4c 0d 7d 3b 0d 0d |est8,..N|ULL.};..|
|00005490| 23 64 65 66 69 6e 65 20 | 43 4c 45 41 52 28 77 68 |#define |CLEAR(wh|
|000054a0| 61 74 29 09 42 6c 6f 63 | 6b 5a 65 72 6f 28 26 77 |at).Bloc|kZero(&w|
|000054b0| 68 61 74 2c 20 73 69 7a | 65 6f 66 20 77 68 61 74 |hat, siz|eof what|
|000054c0| 29 0d 0d 76 6f 69 64 09 | 09 09 09 09 09 54 65 73 |)..void.|.....Tes|
|000054d0| 74 53 69 6d 70 6c 65 41 | 72 65 61 28 0d 09 09 63 |tSimpleA|rea(...c|
|000054e0| 6f 6e 73 74 20 53 69 6d | 70 6c 65 41 72 65 61 50 |onst Sim|pleAreaP|
|000054f0| 74 72 09 09 73 69 6d 70 | 6c 65 41 72 65 61 50 74 |tr..simp|leAreaPt|
|00005500| 72 2c 0d 09 09 42 79 74 | 65 43 6f 75 6e 74 09 09 |r,...Byt|eCount..|
|00005510| 09 09 67 72 61 6e 75 6c | 61 72 69 74 79 0d 09 29 |..granul|arity..)|
|00005520| 3b 0d 76 6f 69 64 09 09 | 09 09 09 09 54 65 73 74 |;.void..|....Test|
|00005530| 53 63 61 74 74 65 72 47 | 61 74 68 65 72 41 72 65 |ScatterG|atherAre|
|00005540| 61 28 0d 09 09 63 6f 6e | 73 74 20 53 69 6d 70 6c |a(...con|st Simpl|
|00005550| 65 41 72 65 61 50 74 72 | 09 09 73 67 41 72 65 61 |eAreaPtr|..sgArea|
|00005560| 50 74 72 2c 09 09 2f 2a | 20 56 65 63 74 6f 72 09 |Ptr,../*| Vector.|
|00005570| 09 09 2a 2f 0d 09 09 42 | 79 74 65 43 6f 75 6e 74 |..*/...B|yteCount|
|00005580| 09 09 09 09 67 72 61 6e | 75 6c 61 72 69 74 79 0d |....gran|ularity.|
|00005590| 09 29 3b 0d 0d 23 64 65 | 66 69 6e 65 20 43 6c 65 |.);..#de|fine Cle|
|000055a0| 61 72 57 6f 72 6b 41 72 | 65 61 28 29 09 09 43 4c |arWorkAr|ea()..CL|
|000055b0| 45 41 52 28 67 57 6f 72 | 6b 41 72 65 61 29 0d 42 |EAR(gWor|kArea).B|
|000055c0| 6f 6f 6c 65 61 6e 09 09 | 09 09 09 09 55 70 64 61 |oolean..|....Upda|
|000055d0| 74 65 57 6f 72 6b 41 72 | 65 61 28 0d 09 09 55 49 |teWorkAr|ea(...UI|
|000055e0| 6e 74 33 32 09 09 09 09 | 09 6f 66 66 73 65 74 2c |nt32....|.offset,|
|000055f0| 0d 09 09 42 79 74 65 43 | 6f 75 6e 74 09 09 09 09 |...ByteC|ount....|
|00005600| 62 79 74 65 43 6f 75 6e | 74 2c 0d 09 09 41 64 64 |byteCoun|t,...Add|
|00005610| 72 65 73 73 52 61 6e 67 | 65 09 09 09 2a 74 68 69 |ressRang|e...*thi|
|00005620| 73 54 72 61 6e 73 66 65 | 72 50 74 72 0d 09 29 3b |sTransfe|rPtr..);|
|00005630| 0d 76 6f 69 64 09 09 09 | 09 09 09 43 68 65 63 6b |.void...|...Check|
|00005640| 57 6f 72 6b 41 72 65 61 | 28 0d 09 09 55 49 6e 74 |WorkArea|(...UInt|
|00005650| 33 32 09 09 09 09 09 6f | 66 66 73 65 74 2c 0d 09 |32.....o|ffset,..|
|00005660| 09 42 79 74 65 43 6f 75 | 6e 74 09 09 09 09 62 79 |.ByteCou|nt....by|
|00005670| 74 65 43 6f 75 6e 74 0d | 09 29 3b 0d 76 6f 69 64 |teCount.|.);.void|
|00005680| 09 09 09 09 09 09 44 6f | 50 72 65 70 61 72 61 74 |......Do|Preparat|
|00005690| 69 6f 6e 41 6e 64 54 65 | 73 74 28 76 6f 69 64 29 |ionAndTe|st(void)|
|000056a0| 3b 0d 76 6f 69 64 09 09 | 09 09 09 09 54 65 73 74 |;.void..|....Test|
|000056b0| 54 68 69 73 50 72 65 70 | 61 72 61 74 69 6f 6e 28 |ThisPrep|aration(|
|000056c0| 76 6f 69 64 29 3b 0d 76 | 6f 69 64 09 09 09 09 09 |void);.v|oid.....|
|000056d0| 09 44 75 6d 70 50 72 65 | 70 61 72 65 49 4f 54 61 |.DumpPre|pareIOTa|
|000056e0| 62 6c 65 28 0d 09 09 49 | 4f 50 72 65 70 61 72 61 |ble(...I|OPrepara|
|000056f0| 74 69 6f 6e 54 61 62 6c | 65 09 09 2a 69 6f 54 61 |tionTabl|e..*ioTa|
|00005700| 62 6c 65 0d 09 29 3b 0d | 76 6f 69 64 09 09 09 09 |ble..);.|void....|
|00005710| 09 09 44 75 6d 70 44 4d | 41 54 61 62 6c 65 28 0d |..DumpDM|ATable(.|
|00005720| 09 09 44 4d 41 54 72 61 | 6e 73 66 65 72 49 6e 66 |..DMATra|nsferInf|
|00005730| 6f 09 09 09 2a 64 6d 61 | 54 61 62 6c 65 0d 09 29 |o...*dma|Table..)|
|00005740| 3b 0d 49 74 65 6d 43 6f | 75 6e 74 09 09 09 09 09 |;.ItemCo|unt.....|
|00005750| 47 65 74 4d 61 70 45 6e | 74 72 79 43 6f 75 6e 74 |GetMapEn|tryCount|
|00005760| 28 0d 09 09 76 6f 69 64 | 09 09 09 09 09 2a 61 72 |(...void|.....*ar|
|00005770| 65 61 42 61 73 65 41 64 | 64 72 65 73 73 2c 0d 09 |eaBaseAd|dress,..|
|00005780| 09 42 79 74 65 43 6f 75 | 6e 74 09 09 09 09 61 72 |.ByteCou|nt....ar|
|00005790| 65 61 4c 65 6e 67 74 68 | 0d 09 29 3b 0d 0d 76 6f |eaLength|..);..vo|
|000057a0| 69 64 0d 6d 61 69 6e 28 | 0d 09 09 69 6e 74 09 09 |id.main(|...int..|
|000057b0| 09 09 09 09 61 72 67 63 | 2c 0d 09 09 63 68 61 72 |....argc|,...char|
|000057c0| 09 09 09 09 09 2a 2a 61 | 72 67 76 0d 09 29 0d 7b |.....**a|rgv..).{|
|000057d0| 0d 09 09 49 74 65 6d 43 | 6f 75 6e 74 09 09 09 09 |...ItemC|ount....|
|000057e0| 69 3b 0d 09 09 42 79 74 | 65 43 6f 75 6e 74 09 09 |i;...Byt|eCount..|
|000057f0| 09 09 67 72 61 6e 75 6c | 61 72 69 74 79 3b 0d 0d |..granul|arity;..|
|00005800| 09 09 69 66 20 28 67 50 | 61 67 65 53 69 7a 65 20 |..if (gP|ageSize |
|00005810| 3d 3d 20 30 29 20 7b 0d | 09 09 09 67 50 61 67 65 |== 0) {.|...gPage|
|00005820| 53 69 7a 65 20 3d 20 47 | 65 74 4c 6f 67 69 63 61 |Size = G|etLogica|
|00005830| 6c 50 61 67 65 53 69 7a | 65 28 29 3b 0d 09 09 09 |lPageSiz|e();....|
|00005840| 67 50 61 67 65 4d 61 73 | 6b 20 3d 20 67 50 61 67 |gPageMas|k = gPag|
|00005850| 65 53 69 7a 65 20 2d 20 | 31 3b 0d 09 09 7d 0d 09 |eSize - |1;...}..|
|00005860| 09 64 6f 20 7b 20 61 72 | 67 63 20 3d 20 61 72 67 |.do { ar|gc = arg|
|00005870| 63 3b 20 61 72 67 76 20 | 3d 20 61 72 67 76 3b 20 |c; argv |= argv; |
|00005880| 7d 20 77 68 69 6c 65 20 | 28 30 29 3b 0d 09 09 70 |} while |(0);...p|
|00005890| 72 69 6e 74 66 28 22 48 | 65 6c 6c 6f 20 77 6f 72 |rintf("H|ello wor|
|000058a0| 6c 64 21 5c 6e 22 29 3b | 0d 09 09 2f 2a 0d 09 09 |ld!\n");|.../*...|
|000058b0| 20 2a 20 43 6f 6d 70 75 | 74 65 20 61 20 70 61 67 | * Compu|te a pag|
|000058c0| 65 2d 61 6c 69 67 6e 65 | 64 20 62 61 73 65 20 61 |e-aligne|d base a|
|000058d0| 64 64 72 65 73 73 20 66 | 6f 72 20 6f 75 72 20 77 |ddress f|or our w|
|000058e0| 6f 72 6b 20 61 72 65 61 | 2e 0d 09 09 20 2a 2f 0d |ork area|.... */.|
|000058f0| 09 09 66 6f 72 20 28 67 | 50 61 67 65 41 6c 69 67 |..for (g|PageAlig|
|00005900| 6e 20 3d 20 30 3b 20 67 | 50 61 67 65 41 6c 69 67 |n = 0; g|PageAlig|
|00005910| 6e 20 3c 20 6b 50 61 67 | 65 53 69 7a 65 3b 20 67 |n < kPag|eSize; g|
|00005920| 50 61 67 65 41 6c 69 67 | 6e 2b 2b 29 20 7b 0d 09 |PageAlig|n++) {..|
|00005930| 09 09 69 66 20 28 28 28 | 28 55 49 6e 74 33 32 29 |..if (((|(UInt32)|
|00005940| 20 26 67 57 6f 72 6b 41 | 72 65 61 5b 67 50 61 67 | &gWorkA|rea[gPag|
|00005950| 65 41 6c 69 67 6e 5d 29 | 20 26 20 28 6b 50 61 67 |eAlign])| & (kPag|
|00005960| 65 53 69 7a 65 20 2d 20 | 31 29 29 20 3d 3d 20 30 |eSize - |1)) == 0|
|00005970| 29 0d 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 7d |).....br|eak;...}|
|00005980| 0d 09 09 67 57 6f 72 6b | 41 72 65 61 53 74 61 72 |...gWork|AreaStar|
|00005990| 74 20 3d 20 26 67 57 6f | 72 6b 41 72 65 61 5b 67 |t = &gWo|rkArea[g|
|000059a0| 50 61 67 65 41 6c 69 67 | 6e 5d 3b 0d 09 09 66 6f |PageAlig|n];...fo|
|000059b0| 72 20 28 67 72 61 6e 75 | 6c 61 72 69 74 79 20 3d |r (granu|larity =|
|000059c0| 20 30 3b 20 67 72 61 6e | 75 6c 61 72 69 74 79 20 | 0; gran|ularity |
|000059d0| 3c 3d 20 38 31 39 32 3b | 20 67 72 61 6e 75 6c 61 |<= 8192;| granula|
|000059e0| 72 69 74 79 20 2b 3d 20 | 34 30 39 36 29 20 7b 0d |rity += |4096) {.|
|000059f0| 09 09 09 66 6f 72 20 28 | 69 20 3d 20 30 3b 20 67 |...for (|i = 0; g|
|00005a00| 53 69 6d 70 6c 65 54 65 | 73 74 5b 69 5d 2e 62 79 |SimpleTe|st[i].by|
|00005a10| 74 65 43 6f 75 6e 74 20 | 21 3d 20 30 3b 20 69 2b |teCount |!= 0; i+|
|00005a20| 2b 29 20 7b 0d 09 09 09 | 09 70 72 69 6e 74 66 28 |+) {....|.printf(|
|00005a30| 22 2a 5c 6e 2a 2a 2a 20 | 53 69 6d 70 6c 65 20 41 |"*\n*** |Simple A|
|00005a40| 72 65 61 20 54 65 73 74 | 20 25 6c 64 5c 6e 2a 5c |rea Test| %ld\n*\|
|00005a50| 6e 22 2c 20 69 29 3b 0d | 09 09 09 09 54 65 73 74 |n", i);.|....Test|
|00005a60| 53 69 6d 70 6c 65 41 72 | 65 61 28 26 67 53 69 6d |SimpleAr|ea(&gSim|
|00005a70| 70 6c 65 54 65 73 74 5b | 69 5d 2c 20 67 72 61 6e |pleTest[|i], gran|
|00005a80| 75 6c 61 72 69 74 79 29 | 3b 0d 09 09 09 7d 0d 09 |ularity)|;....}..|
|00005a90| 09 09 66 6f 72 20 28 69 | 20 3d 20 30 3b 20 67 53 |..for (i| = 0; gS|
|00005aa0| 47 54 65 73 74 56 65 63 | 74 6f 72 5b 69 5d 20 21 |GTestVec|tor[i] !|
|00005ab0| 3d 20 4e 55 4c 4c 3b 20 | 69 2b 2b 29 20 7b 0d 09 |= NULL; |i++) {..|
|00005ac0| 09 09 09 70 72 69 6e 74 | 66 28 22 2a 5c 6e 2a 2a |...print|f("*\n**|
|00005ad0| 2a 20 53 63 61 74 74 65 | 72 20 47 61 74 68 65 72 |* Scatte|r Gather|
|00005ae0| 20 54 65 73 74 20 25 6c | 64 5c 6e 2a 5c 6e 22 2c | Test %l|d\n*\n",|
|00005af0| 20 69 29 3b 0d 09 09 09 | 09 54 65 73 74 53 63 61 | i);....|.TestSca|
|00005b00| 74 74 65 72 47 61 74 68 | 65 72 41 72 65 61 28 67 |tterGath|erArea(g|
|00005b10| 53 47 54 65 73 74 56 65 | 63 74 6f 72 5b 69 5d 2c |SGTestVe|ctor[i],|
|00005b20| 20 67 72 61 6e 75 6c 61 | 72 69 74 79 29 3b 0d 09 | granula|rity);..|
|00005b30| 09 09 7d 0d 09 09 7d 0d | 09 09 65 78 69 74 28 45 |..}...}.|..exit(E|
|00005b40| 58 49 54 5f 53 55 43 43 | 45 53 53 29 3b 0d 7d 0d |XIT_SUCC|ESS);.}.|
|00005b50| 0d 76 6f 69 64 0d 54 65 | 73 74 53 69 6d 70 6c 65 |.void.Te|stSimple|
|00005b60| 41 72 65 61 28 0d 09 09 | 63 6f 6e 73 74 20 53 69 |Area(...|const Si|
|00005b70| 6d 70 6c 65 41 72 65 61 | 50 74 72 09 09 73 69 6d |mpleArea|Ptr..sim|
|00005b80| 70 6c 65 41 72 65 61 50 | 74 72 2c 0d 09 09 42 79 |pleAreaP|tr,...By|
|00005b90| 74 65 43 6f 75 6e 74 09 | 09 09 09 67 72 61 6e 75 |teCount.|...granu|
|00005ba0| 6c 61 72 69 74 79 0d 09 | 29 0d 7b 0d 09 09 4c 6f |larity..|).{...Lo|
|00005bb0| 67 69 63 61 6c 41 64 64 | 72 65 73 73 09 09 09 61 |gicalAdd|ress...a|
|00005bc0| 72 65 61 41 64 64 72 65 | 73 73 3b 0d 0d 09 09 2f |reaAddre|ss;..../|
|00005bd0| 2a 0d 09 09 20 2a 20 49 | 6e 69 74 69 61 6c 69 7a |*... * I|nitializ|
|00005be0| 65 20 74 68 65 20 69 6f | 54 61 62 6c 65 2e 0d 09 |e the io|Table...|
|00005bf0| 09 20 2a 2f 0d 09 09 61 | 72 65 61 41 64 64 72 65 |. */...a|reaAddre|
|00005c00| 73 73 20 3d 20 26 67 57 | 6f 72 6b 41 72 65 61 53 |ss = &gW|orkAreaS|
|00005c10| 74 61 72 74 5b 73 69 6d | 70 6c 65 41 72 65 61 50 |tart[sim|pleAreaP|
|00005c20| 74 72 2d 3e 6f 66 66 73 | 65 74 5d 3b 0d 09 09 70 |tr->offs|et];...p|
|00005c30| 72 69 6e 74 66 28 22 25 | 30 38 6c 78 2c 20 25 6c |rintf("%|08lx, %l|
|00005c40| 75 20 6f 66 66 73 65 74 | 2c 20 25 6c 75 20 62 79 |u offset|, %lu by|
|00005c50| 74 65 43 6f 75 6e 74 5c | 6e 22 2c 0d 09 09 09 61 |teCount\|n",....a|
|00005c60| 72 65 61 41 64 64 72 65 | 73 73 2c 0d 09 09 09 73 |reaAddre|ss,....s|
|00005c70| 69 6d 70 6c 65 41 72 65 | 61 50 74 72 2d 3e 6f 66 |impleAre|aPtr->of|
|00005c80| 66 73 65 74 2c 0d 09 09 | 09 73 69 6d 70 6c 65 41 |fset,...|.simpleA|
|00005c90| 72 65 61 50 74 72 2d 3e | 62 79 74 65 43 6f 75 6e |reaPtr->|byteCoun|
|00005ca0| 74 0d 09 09 29 3b 0d 09 | 09 43 4c 45 41 52 28 67 |t...);..|.CLEAR(g|
|00005cb0| 49 4f 54 61 62 6c 65 29 | 3b 0d 09 09 43 4c 45 41 |IOTable)|;...CLEA|
|00005cc0| 52 28 67 4c 6f 67 69 63 | 61 6c 4d 61 70 70 69 6e |R(gLogic|alMappin|
|00005cd0| 67 29 3b 0d 09 09 43 4c | 45 41 52 28 67 50 68 79 |g);...CL|EAR(gPhy|
|00005ce0| 73 69 63 61 6c 4d 61 70 | 70 69 6e 67 29 3b 0d 09 |sicalMap|ping);..|
|00005cf0| 09 67 49 4f 54 61 62 6c | 65 2e 6f 70 74 69 6f 6e |.gIOTabl|e.option|
|00005d00| 73 20 3d 20 6b 49 4f 4d | 69 6e 69 6d 61 6c 4c 6f |s = kIOM|inimalLo|
|00005d10| 67 69 63 61 6c 4d 61 70 | 70 69 6e 67 20 7c 20 6b |gicalMap|ping | k|
|00005d20| 49 4f 4c 6f 67 69 63 61 | 6c 52 61 6e 67 65 73 20 |IOLogica|lRanges |
|00005d30| 7c 20 6b 49 4f 49 73 49 | 6e 70 75 74 3b 0d 09 09 || kIOIsI|nput;...|
|00005d40| 67 49 4f 54 61 62 6c 65 | 2e 73 74 61 74 65 20 3d |gIOTable|.state =|
|00005d50| 20 30 3b 0d 09 09 67 49 | 4f 54 61 62 6c 65 2e 61 | 0;...gI|OTable.a|
|00005d60| 64 64 72 65 73 73 53 70 | 61 63 65 20 3d 20 6b 43 |ddressSp|ace = kC|
|00005d70| 75 72 72 65 6e 74 41 64 | 64 72 65 73 73 53 70 61 |urrentAd|dressSpa|
|00005d80| 63 65 49 44 3b 0d 09 09 | 67 49 4f 54 61 62 6c 65 |ceID;...|gIOTable|
|00005d90| 2e 67 72 61 6e 75 6c 61 | 72 69 74 79 20 3d 20 67 |.granula|rity = g|
|00005da0| 72 61 6e 75 6c 61 72 69 | 74 79 3b 0d 09 09 67 49 |ranulari|ty;...gI|
|00005db0| 4f 54 61 62 6c 65 2e 66 | 69 72 73 74 50 72 65 70 |OTable.f|irstPrep|
|00005dc0| 61 72 65 64 20 3d 20 30 | 3b 0d 09 09 67 49 4f 54 |ared = 0|;...gIOT|
|00005dd0| 61 62 6c 65 2e 6c 65 6e | 67 74 68 50 72 65 70 61 |able.len|gthPrepa|
|00005de0| 72 65 64 20 3d 20 30 3b | 0d 09 09 69 66 20 28 67 |red = 0;|...if (g|
|00005df0| 49 4f 54 61 62 6c 65 2e | 67 72 61 6e 75 6c 61 72 |IOTable.|granular|
|00005e00| 69 74 79 20 3d 3d 20 30 | 29 0d 09 09 09 67 49 4f |ity == 0|)....gIO|
|00005e10| 54 61 62 6c 65 2e 6d 61 | 70 70 69 6e 67 45 6e 74 |Table.ma|ppingEnt|
|00005e20| 72 79 43 6f 75 6e 74 20 | 3d 20 47 65 74 4d 61 70 |ryCount |= GetMap|
|00005e30| 45 6e 74 72 79 43 6f 75 | 6e 74 28 61 72 65 61 41 |EntryCou|nt(areaA|
|00005e40| 64 64 72 65 73 73 2c 20 | 73 69 6d 70 6c 65 41 72 |ddress, |simpleAr|
|00005e50| 65 61 50 74 72 2d 3e 62 | 79 74 65 43 6f 75 6e 74 |eaPtr->b|yteCount|
|00005e60| 29 3b 0d 09 09 65 6c 73 | 65 20 7b 0d 09 09 09 67 |);...els|e {....g|
|00005e70| 49 4f 54 61 62 6c 65 2e | 6d 61 70 70 69 6e 67 45 |IOTable.|mappingE|
|00005e80| 6e 74 72 79 43 6f 75 6e | 74 20 3d 20 47 65 74 4d |ntryCoun|t = GetM|
|00005e90| 61 70 45 6e 74 72 79 43 | 6f 75 6e 74 28 30 2c 20 |apEntryC|ount(0, |
|00005ea0| 67 49 4f 54 61 62 6c 65 | 2e 67 72 61 6e 75 6c 61 |gIOTable|.granula|
|00005eb0| 72 69 74 79 29 3b 0d 09 | 09 7d 0d 09 09 67 49 4f |rity);..|.}...gIO|
|00005ec0| 54 61 62 6c 65 2e 6c 6f | 67 69 63 61 6c 4d 61 70 |Table.lo|gicalMap|
|00005ed0| 70 69 6e 67 20 3d 20 67 | 4c 6f 67 69 63 61 6c 4d |ping = g|LogicalM|
|00005ee0| 61 70 70 69 6e 67 3b 0d | 09 09 67 49 4f 54 61 62 |apping;.|..gIOTab|
|00005ef0| 6c 65 2e 70 68 79 73 69 | 63 61 6c 4d 61 70 70 69 |le.physi|calMappi|
|00005f00| 6e 67 20 3d 20 67 50 68 | 79 73 69 63 61 6c 4d 61 |ng = gPh|ysicalMa|
|00005f10| 70 70 69 6e 67 3b 0d 09 | 09 67 49 4f 54 61 62 6c |pping;..|.gIOTabl|
|00005f20| 65 2e 72 61 6e 67 65 49 | 6e 66 6f 2e 72 61 6e 67 |e.rangeI|nfo.rang|
|00005f30| 65 2e 62 61 73 65 20 3d | 20 61 72 65 61 41 64 64 |e.base =| areaAdd|
|00005f40| 72 65 73 73 3b 0d 09 09 | 67 49 4f 54 61 62 6c 65 |ress;...|gIOTable|
|00005f50| 2e 72 61 6e 67 65 49 6e | 66 6f 2e 72 61 6e 67 65 |.rangeIn|fo.range|
|00005f60| 2e 6c 65 6e 67 74 68 20 | 3d 20 73 69 6d 70 6c 65 |.length |= simple|
|00005f70| 41 72 65 61 50 74 72 2d | 3e 62 79 74 65 43 6f 75 |AreaPtr-|>byteCou|
|00005f80| 6e 74 3b 0d 09 09 44 6f | 50 72 65 70 61 72 61 74 |nt;...Do|Preparat|
|00005f90| 69 6f 6e 41 6e 64 54 65 | 73 74 28 29 3b 0d 7d 0d |ionAndTe|st();.}.|
|00005fa0| 0d 76 6f 69 64 0d 54 65 | 73 74 53 63 61 74 74 65 |.void.Te|stScatte|
|00005fb0| 72 47 61 74 68 65 72 41 | 72 65 61 28 0d 09 09 63 |rGatherA|rea(...c|
|00005fc0| 6f 6e 73 74 20 53 69 6d | 70 6c 65 41 72 65 61 50 |onst Sim|pleAreaP|
|00005fd0| 74 72 09 09 73 67 41 72 | 65 61 50 74 72 2c 09 09 |tr..sgAr|eaPtr,..|
|00005fe0| 2f 2a 20 56 65 63 74 6f | 72 09 09 09 2a 2f 0d 09 |/* Vecto|r...*/..|
|00005ff0| 09 42 79 74 65 43 6f 75 | 6e 74 09 09 09 09 67 72 |.ByteCou|nt....gr|
|00006000| 61 6e 75 6c 61 72 69 74 | 79 0d 09 29 0d 7b 0d 09 |anularit|y..).{..|
|00006010| 09 4c 6f 67 69 63 61 6c | 41 64 64 72 65 73 73 09 |.Logical|Address.|
|00006020| 09 09 61 72 65 61 41 64 | 64 72 65 73 73 3b 0d 09 |..areaAd|dress;..|
|00006030| 09 49 74 65 6d 43 6f 75 | 6e 74 09 09 09 09 74 6f |.ItemCou|nt....to|
|00006040| 74 61 6c 4d 61 70 41 72 | 65 61 43 6f 75 6e 74 3b |talMapAr|eaCount;|
|00006050| 0d 09 09 49 74 65 6d 43 | 6f 75 6e 74 09 09 09 09 |...ItemC|ount....|
|00006060| 74 68 69 73 4d 61 70 41 | 72 65 61 43 6f 75 6e 74 |thisMapA|reaCount|
|00006070| 3b 0d 09 09 55 49 6e 74 | 33 32 09 09 09 09 09 69 |;...UInt|32.....i|
|00006080| 3b 0d 0d 09 09 2f 2a 0d | 09 09 20 2a 20 49 6e 69 |;..../*.|.. * Ini|
|00006090| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 69 6f 54 61 |tialize |the ioTa|
|000060a0| 62 6c 65 2e 0d 09 09 20 | 2a 2f 0d 09 09 74 6f 74 |ble.... |*/...tot|
|000060b0| 61 6c 4d 61 70 41 72 65 | 61 43 6f 75 6e 74 20 3d |alMapAre|aCount =|
|000060c0| 20 30 3b 0d 09 09 66 6f | 72 20 28 69 20 3d 20 30 | 0;...fo|r (i = 0|
|000060d0| 3b 20 73 67 41 72 65 61 | 50 74 72 5b 69 5d 2e 62 |; sgArea|Ptr[i].b|
|000060e0| 79 74 65 43 6f 75 6e 74 | 20 21 3d 20 30 3b 20 69 |yteCount| != 0; i|
|000060f0| 2b 2b 29 20 7b 0d 09 09 | 09 61 72 65 61 41 64 64 |++) {...|.areaAdd|
|00006100| 72 65 73 73 20 3d 20 26 | 67 57 6f 72 6b 41 72 65 |ress = &|gWorkAre|
|00006110| 61 53 74 61 72 74 5b 73 | 67 41 72 65 61 50 74 72 |aStart[s|gAreaPtr|
|00006120| 5b 69 5d 2e 6f 66 66 73 | 65 74 5d 3b 0d 09 09 09 |[i].offs|et];....|
|00006130| 74 68 69 73 4d 61 70 41 | 72 65 61 43 6f 75 6e 74 |thisMapA|reaCount|
|00006140| 20 3d 20 47 65 74 4d 61 | 70 45 6e 74 72 79 43 6f | = GetMa|pEntryCo|
|00006150| 75 6e 74 28 61 72 65 61 | 41 64 64 72 65 73 73 2c |unt(area|Address,|
|00006160| 20 73 67 41 72 65 61 50 | 74 72 5b 69 5d 2e 62 79 | sgAreaP|tr[i].by|
|00006170| 74 65 43 6f 75 6e 74 29 | 3b 0d 09 09 09 74 6f 74 |teCount)|;....tot|
|00006180| 61 6c 4d 61 70 41 72 65 | 61 43 6f 75 6e 74 20 2b |alMapAre|aCount +|
|00006190| 3d 20 74 68 69 73 4d 61 | 70 41 72 65 61 43 6f 75 |= thisMa|pAreaCou|
|000061a0| 6e 74 3b 0d 09 09 09 70 | 72 69 6e 74 66 28 22 25 |nt;....p|rintf("%|
|000061b0| 32 6c 75 3a 20 25 30 38 | 6c 78 2c 20 25 36 6c 75 |2lu: %08|lx, %6lu|
|000061c0| 20 6f 66 66 73 65 74 2c | 20 25 36 6c 75 20 62 79 | offset,| %6lu by|
|000061d0| 74 65 43 6f 75 6e 74 2c | 20 25 32 6c 75 20 6d 61 |teCount,| %2lu ma|
|000061e0| 70 20 63 6f 75 6e 74 5c | 6e 22 2c 0d 09 09 09 09 |p count\|n",.....|
|000061f0| 69 2c 0d 09 09 09 09 61 | 72 65 61 41 64 64 72 65 |i,.....a|reaAddre|
|00006200| 73 73 2c 0d 09 09 09 09 | 73 67 41 72 65 61 50 74 |ss,.....|sgAreaPt|
|00006210| 72 5b 69 5d 2e 6f 66 66 | 73 65 74 2c 0d 09 09 09 |r[i].off|set,....|
|00006220| 09 73 67 41 72 65 61 50 | 74 72 5b 69 5d 2e 62 79 |.sgAreaP|tr[i].by|
|00006230| 74 65 43 6f 75 6e 74 2c | 0d 09 09 09 09 74 68 69 |teCount,|.....thi|
|00006240| 73 4d 61 70 41 72 65 61 | 43 6f 75 6e 74 0d 09 09 |sMapArea|Count...|
|00006250| 09 29 3b 0d 09 09 09 67 | 53 63 61 74 74 65 72 47 |.);....g|ScatterG|
|00006260| 61 74 68 65 72 54 61 62 | 6c 65 5b 69 5d 2e 62 61 |atherTab|le[i].ba|
|00006270| 73 65 20 3d 20 61 72 65 | 61 41 64 64 72 65 73 73 |se = are|aAddress|
|00006280| 3b 0d 09 09 09 67 53 63 | 61 74 74 65 72 47 61 74 |;....gSc|atterGat|
|00006290| 68 65 72 54 61 62 6c 65 | 5b 69 5d 2e 6c 65 6e 67 |herTable|[i].leng|
|000062a0| 74 68 20 3d 20 73 67 41 | 72 65 61 50 74 72 5b 69 |th = sgA|reaPtr[i|
|000062b0| 5d 2e 62 79 74 65 43 6f | 75 6e 74 3b 0d 09 09 7d |].byteCo|unt;...}|
|000062c0| 0d 09 09 70 72 69 6e 74 | 66 28 22 25 6c 75 20 74 |...print|f("%lu t|
|000062d0| 6f 74 61 6c 20 6d 61 70 | 70 69 6e 67 20 65 6e 74 |otal map|ping ent|
|000062e0| 72 69 65 73 5c 6e 22 2c | 20 74 6f 74 61 6c 4d 61 |ries\n",| totalMa|
|000062f0| 70 41 72 65 61 43 6f 75 | 6e 74 29 3b 0d 09 09 43 |pAreaCou|nt);...C|
|00006300| 4c 45 41 52 28 67 49 4f | 54 61 62 6c 65 29 3b 0d |LEAR(gIO|Table);.|
|00006310| 09 09 43 4c 45 41 52 28 | 67 4c 6f 67 69 63 61 6c |..CLEAR(|gLogical|
|00006320| 4d 61 70 70 69 6e 67 29 | 3b 0d 09 09 43 4c 45 41 |Mapping)|;...CLEA|
|00006330| 52 28 67 50 68 79 73 69 | 63 61 6c 4d 61 70 70 69 |R(gPhysi|calMappi|
|00006340| 6e 67 29 3b 0d 09 09 67 | 49 4f 54 61 62 6c 65 2e |ng);...g|IOTable.|
|00006350| 6f 70 74 69 6f 6e 73 20 | 3d 20 6b 49 4f 4d 69 6e |options |= kIOMin|
|00006360| 69 6d 61 6c 4c 6f 67 69 | 63 61 6c 4d 61 70 70 69 |imalLogi|calMappi|
|00006370| 6e 67 20 7c 20 6b 49 4f | 4c 6f 67 69 63 61 6c 52 |ng | kIO|LogicalR|
|00006380| 61 6e 67 65 73 20 7c 20 | 6b 49 4f 49 73 49 6e 70 |anges | |kIOIsInp|
|00006390| 75 74 3b 0d 09 09 67 49 | 4f 54 61 62 6c 65 2e 6f |ut;...gI|OTable.o|
|000063a0| 70 74 69 6f 6e 73 20 7c | 3d 20 6b 49 4f 4d 75 6c |ptions ||= kIOMul|
|000063b0| 74 69 70 6c 65 52 61 6e | 67 65 73 3b 0d 09 09 67 |tipleRan|ges;...g|
|000063c0| 49 4f 54 61 62 6c 65 2e | 73 74 61 74 65 20 3d 20 |IOTable.|state = |
|000063d0| 30 3b 0d 09 09 67 49 4f | 54 61 62 6c 65 2e 61 64 |0;...gIO|Table.ad|
|000063e0| 64 72 65 73 73 53 70 61 | 63 65 20 3d 20 6b 43 75 |dressSpa|ce = kCu|
|000063f0| 72 72 65 6e 74 41 64 64 | 72 65 73 73 53 70 61 63 |rrentAdd|ressSpac|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.