Moved source_fa into trunk

This commit is contained in:
David Gálvez
2011-01-03 08:10:50 +00:00
parent af014dc0d6
commit 756ab9cd6e
657 changed files with 288732 additions and 7 deletions

View File

@@ -0,0 +1,362 @@
S0030000FC
S321E000000060064EF9E000000846FC2700203CFF0000004E7B0C0F23C0FF10084483
S321E000001C203CFF0400014E7B0008428023C0FF040000203CFF1000074E7B0C04BE
S321E0000038203CFF1010014E7B0C054FF9FF100FFC203C000C81004E7B00024E719B
S321E000005460FF00000D0E4E7541F9FF00090020BCFFFFFFFF41F9FF00090410BC41
S321E0000070000541F9FF00860C20BC534C542041F9FF00860C20BC4F4B212041F913
S321E000008CFF00860C20BC00000A0D4E7541F9FF000A4310BC00FF41F9FF000A4453
S321E00000A830BCF3CF41F9FF000A4830BC023F41F9FF000A4A30BC023F41F9FF00FD
S321E00000C40A4C10BC000C41F9FF000A4E10BC00FC41F9FF000A4F10BC00FC41F91F
S321E00000E0FF000A5030BC1FFF41F9FF000A5210BC002D41F9FF000A1710BC001EE9
S321E00000FC4E7551FC41F9FF008640421041F9FF00860410BC00DD41F9FF0086185E
S321E0000118421041F9FF00861C10BC002441F9FF00860810BC002041F9FF0086084E
S321E000013410BC003041F9FF00860810BC004041F9FF00860810BC005041F9FF00DE
S321E0000150860810BC001041F9FF00861430BC870041F9FF00861010BC000341F925
S321E000016CFF00860010BC00B341F9FF00860010BC000741F9FF00866820BC0000F8
S321E0000188000F41F9FF00868820BC0000000F41F9FF00866E30BC00F041F9FF00F2
S321E00001A4868E30BC00F041F9FF00863810BC000141F9FF00860810BC000541F9D3
S321E00001C0FF008940421041F9FF00890410BC00DD41F9FF008918421041F9FF004F
S321E00001DC891C10BC002441F9FF00890810BC002041F9FF00890810BC003041F9D6
S321E00001F8FF00890810BC004041F9FF00890810BC005041F9FF00890810BC0010DD
S321E000021441F9FF00891430BC020041F9FF00891010BC000341F9FF00890010BCF5
S321E000023000B341F9FF00890010BC000741F9FF00896820BC0000000F41F9FF0036
S321E000024C898820BC0000000F41F9FF00896E30BC00F041F9FF00898E30BC00F07C
S321E000026841F9FF00893810BC000141F9FF00890810BC000541F9FF00076010BCC6
S321E0000284003F41F9FF00860C20BC00000A0D41F9FF00860C20BC5345524941F967
S321E00002A0FF00860C20BC414C204F41F9FF00860C20BC4B21202041F9FF00860CD5
S321E00002BC20BC00000A0D4E7541F9FF00860C20BC444452412039FF000104080063
S321E00002D8001C660000B641F9FF00000420BC000002AA41F9FF00002020BC0000F2
S321E00002F4001A41F9FF00002420BC0800001A41F9FF00002820BC1000001A41F9F2
S321E0000310FF00002C20BC1800001A41F9FF00010820BC7362283041F9FF00010C21
S321E000032C20BC4677000041F9FF00010420BCE10D000241F9FF00010020BC4001D5
S321E0000348000041F9FF00010020BC048D000041F9FF00010420BCE10D000241F9C8
S321E0000364FF00010420BCE10D000441F9FF00010420BCE10D000441F9FF0001007F
S321E000038020BC008D000041F9FF00010420BC710D0F0041F9FF00860C20BC4D2057
S321E000039C4F4B41F9FF00860C20BC2120202041F9FF00860C20BC00000A0D4E751C
S321E00003B841F9FF00860C20BC4642435341F9FF00050020BCE000000041F9FF004B
S321E00003D4050820BC0004118041F9FF00050420BC007F000141F9FF00050C20BCE5
S321E00003F0FFF0000041F9FF00051420BC0004218041F9FF00051020BC000F00010F
S321E000040C41F9FF00051820BCF000000041F9FF00052020BC0004210041F9FF0034
S321E0000428051C20BC07FF000141F9FF00052420BCF800000041F9FF00052C20BC52
S321E00004440004018041F9FF00052820BC03FF000141F9FF00053020BC4000000062
S321E000046041F9FF00053820BC0000001841F9FF00053420BC3FFF000141F9FF006A
S321E000047C860C20BC204F4B2141F9FF00860C20BC00000A0D4E7551FC41F9FF002E
S321E0000498860C20BC4650474143F9FF000A0745F9FF000A270891000108910002E7
S321E00004B40812000066FA0812000566F461FF000009AA08D1000261FF000009A05C
S321E00004D00812000067FA61FF0000099441F9E0700000B1FCE08000006E5610182F
S321E00004EC7208E288650608910003600408D1000308D1000108910001538166E64F
S321E00005080812000567D4223C00000FA008D100014E7108910001538166F26028A3
S321E000052447F9FF00090820132C3C000186A04A516A0822139280D2866AF44E75F6
S321E000054041F9FF00860C20BC204E4F5441F9FF00860C20BC204F4B2141F9FF0046
S321E000055C860C20BC00000A0D41F9FF00860C20BC504C4C2041F9F000060043F9FD
S321E0000578F000080061A6317C001B0048619E317C000100086196317C000C00000D
S321E0000594618E317C000C00406186317C000101146100FF7E317C000101186100CD
S321E00005B0FF74317C0001011C6100FF6A317C000100106100FF60317C00010050C5
S321E00005CC6100FF56317C000101446100FF4C317C000100446100FF42317C00A5F2
S321E00005E800046100FF38421141F9FF00860C20BC5345542141F9FF00860C20BCC7
S321E000060400000A0D4E7551FC700B33C0F00004004E7141F9600000004E7120BC77
S321E0000620000504004E7120BC000720004E7120BC000701224E7120BC00050400A4
S321E000063C4E7120BC000600004E7120BC000600004E7120BC000070124E71203C42
S321E00006580107000223C0F00004004E7541F9FF00860C20BC50434920203C003FBE
S321E0000674003F23C0FF000C00203C0000200423C0FF000B0C203C1010000023C07F
S321E0000690FF000B3C203C0700002023C0FF000B84203C0000100081B9FF000B601E
S321E00006AC203C803FFFFF424023C0FF000B70203CD00FFFFF424023C0FF000B7438
S321E00006C842B9FF000B78203C0309000023C0FF000B80203CFFFFFFFEC1B9FF000E
S321E00006E40B6041F9FF00860C20BC4F4B212041F9FF00860C20BC00000A0D4E75A6
S321E000070041F9FF00860C20BC4E454320203C8000880023C0FF000BF841F9D00007
S321E000071C00002210203C33103500B280670E41F9FF00860C20BC4E4F5420601006
S321E0000738203C800088E423C0FF000BF810BC0020203C000088E423C0FF000BF8F9
S321E000075441F9FF00860C20BC4F4B212041F9FF00860C20BC00000A0D4E7551FC53
S321E00007702F0741F9FF00860C20BC4456492041F9FF008F0410BC003442872007EB
S321E000078C2E0052870C800000000A6E00035241F9FF008F20421041F9FF008F0801
S321E00007A8421041F9FF008F0810BC000A1239FF008F1041F9FF008F0C421041F90E
S321E00007C4FF008F08421041F9FF008F2010BC000141F9FF008F0810BC00B041F910
S321E00007E0FF008F1010BC007A61FF0000064A70A241F9FF008F0CB010669070B0C7
S321E00007FC41F9FF008F08B010668441F9FF008F0C10100280000000FD108041F944
S321E0000818FF008F10421041F9FF008F0C0810000167F441F9FF008F0C1010028030
S321E0000834000000FD1080A54001F9FF008F0841F9FF008F1010BC007B61FF000041
S321E000085005E670A641F9FF008F0CB0106600FF2C70B041F9FF008F08B01066006A
S321E000086CFF1E41F9FF008F0C10100280000000FD108041F9FF008F0810100280F8
S321E0000888000000EF10801039FF008F1041F9FF008F0C0810000167F441F9FF0087
S321E00008A48F0C10100280000000FD1080A74001F9FF008F0861FF0000057A1239E7
S321E00008C0FF008F1041F9FF008F0C0810000167F441F9FF008F0C101002800000DA
S321E00008DC00FD108041F9FF008F0842101039FF008F100C01004C6600FE9641F9F7
S321E00008F8FF008F08421041F9FF008F0C421041F9FF008F0C0810000566F441F96B
S321E0000914FF008F0810BC00B041F9FF008F1010BC007A61FF0000052870A241F9D8
S321E0000930FF008F0CB0106600FE5270B041F9FF008F08B0106600FE4441F9FF0024
S321E000094C8F0C10100280000000FD108041F9FF008F1010BC000841F9FF008F0C5F
S321E00009680810000167F441F9FF008F0C10100280000000FD108041F9FF008F103E
S321E000098410BC00BF41F9FF008F0C0810000167F441F9FF008F0C10100280000028
S321E00009A000FD108041F9FF008F08421041F9FF008F0C421041F9FF008F0C081094
S321E00009BC000566F441F9FF008F0810BC00B041F9FF008F1010BC007A61FF000010
S321E00009D8047A70A241F9FF008F0CB0106600FDA470B041F9FF008F08B0106600DC
S321E00009F4FD9641F9FF008F0C10100280000000FD108041F9FF008F1010BC0008BF
S321E0000A1041F9FF008F0C0810000167F441F9FF008F0C10100280000000FD108099
S321E0000A2CA54001F9FF008F0841F9FF008F1010BC007B61FF0000041070A641F970
S321E0000A48FF008F0CB0106600FD3A70B041F9FF008F08B0106600FD2C41F9FF003D
S321E0000A648F0C10100280000000FD108041F9FF008F0810100280000000EF1080D5
S321E0000A801039FF008F1041F9FF008F0C0810000167F441F9FF008F0C10100280CF
S321E0000A9C000000FD1080A74001F9FF008F0861FF000003A41239FF008F1041F92A
S321E0000AB8FF008F0C0810000167F441F9FF008F0C10100280000000FD108041F9F1
S321E0000AD4FF008F0842101039FF008F100C0100BF6600FCA4601441F9FF008F083B
S321E0000AF0421041F9FF00860C20BC4E4F542041F9FF00860C20BC4F4B212041F93E
S321E0000B0CFF00860C20BC00000A0D2E1F4E7551FC2F0741F9FF00860C20BC4143A5
S321E0000B28393741F9FF000A4D10BC00BC41F9FF008800421041F9FF00880042101D
S321E0000B4441F9FF00881430BC030041F9FF00884010BC000341F9FF00886820BC16
S321E0000B600F00000041F9FF00888820BC0F00000041F9FF00886E30BC00F041F90B
S321E0000B7CFF00888E30BC00F04287600000C841F9FF00880810BC002041F9FF00A7
S321E0000B98880810BC003041F9FF00880810BC004041F9FF00880810BC000541F926
S321E0000BB4FF00880C20BCE000000041F9FF00880C20BC02000000A540600A41F9BC
S321E0000BD0FF00880C429052800C800000000D6DEE41F9FF00880C20BCC00000008F
S321E0000BEC41F9FF00880C20BC82000000A540600A41F9FF00880C429052800C8090
S321E0000C080000000D6DEE61FF000002402239FF00880C2001028080000FFF0C8035
S321E0000C248000080066242039FF00880C4AB9FF00880C66160281E0000FFF0C81C0
S321E0000C40E000080066080C8002000000671852870C87000186A06D00FF3241F9E4
S321E0000C5CFF00860C20BC204E4F5441F9FF00880C20BCE000000041F9FF00880CC2
S321E0000C7820BC1600000041F9FF00880C20BC06060000A740600A41F9FF00880CB5
S321E0000C94429052800C800000000D6DEE41F9FF00880C20BCE000000041F9FF0004
S321E0000CB0880C20BC10000000A540600A41F9FF00880C429052800C800000000D69
S321E0000CCC6DEE41F9FF00880C20BCE000000041F9FF00880C20BC12000000A540A2
S321E0000CE8600A41F9FF00880C429052800C800000000D6DEE41F9FF00880C20BC92
S321E0000D04E000000041F9FF00880C20BC0600000041F9FF00880C4290A740600A6E
S321E0000D2041F9FF00880C429052800C800000000D6DEE41F9FF008888201008C02B
S321E0000D3C001D208041F9FF00880C429041F9FF00860C20BC204F4B2141F9FF009E
S321E0000D58860C20BC00000A0D2E1F4E75203C000C812023C0FF1008104E7B000226
S321E0000D744E7161FFFFFFF32061FFFFFFF38261FFFFFFF2D861FFFFFFF62E61FF70
S321E0000D90FFFFF5341039FF000A2C08000006670661FFFFFFF8C261FFFFFFF6ECE9
S321E0000DAC61FFFFFFF85E61FFFFFFF9BC1039FF000A2C08000006670661FFFFFF27
S321E0000DC8F93A61FFFFFFFD5041FA002843F9E0000E8893C8247C1FE00000264ACC
S321E0000DE4D7C949F9E000274824D824D824D824D8B1CC6DF44ED34E752F002039A2
S321E0000E00FF000908048000142440B0B9FF00090865F8201F4E7551FC2F00203937
S321E0000E1CFF0009080480000203A0B0B9FF00090865F8201F4E7551FC2F002039EE
S321E0000E38FF000908048000003390B0B9FF00090865F8201F4E7551FC2F002039B4
S321E0000E54FF0009080480000019C8B0B9FF00090865F8201F4E7551FC2F0020397A
S321E0000E70FF000908048000000528B0B9FF00090865F8201F4E7551FC61FF00003A
S321E0000E8C02C24A806F0661FF000002581039FF000A2C08000006675E4DF9FF0011
S321E0000EA8860C47F9FF00890C49F9FF00890C4BF9FF00895826BC4143504661FF8C
S321E0000EC4FFFFFF382CBC5049432010141C8012141C8114141C822CBC00000A0DCB
S321E0000EE016BC000141F900E0000043F9E060000045F9E07000001039FF000A2C9B
S321E0000EFC08000006661241F900E0000043F9E040000045F9E050000020D9B3CA14
S321E0000F186DFA1039FF000A2C08000006670000C641F889614281744010140C00ED
S321E0000F340081661C10141081114000025281B40166F210BC003F102800025280B9
S321E0000F501140000261FF0000069661FF0000084061FF000017E242B9F00100045F
S321E0000F6C41F9FF000F0030BCAAA8203C0001010123C0FF000800703F13C0FF0033
S321E0000F88077E103C00FE13C0F00100044E7141F9FF000F0510BC00FE4E7141F901
S321E0000FA4FF000F0C10BC00FF4E7141F9FF00070C20BCFFFFFF0041F9FF0007083A
S321E0000FC020BCBFFFFFFE203C0000000123C0FF0400004E714E7141F88802117C87
S321E0000FDC000EFFFE10BC008061FFFFFFFE32421041F9F000041020FC032002BAA3
S321E0000FF820FC020C020A20FC0190015D20FC020C020A41E8FFE020BC0107000292
S321E000101441F8040043F808004298429842984298B3C86EF4704811C08007203CA9
S321E000103000E0000021C0042E203C752019F321C00420203C237698AA21C0043A73
S321E000104C203C5555AAAA21C0051A203C1FE0000021C005A4203C1357BD1321C0EC
S321E000106805A81039FF000A2C08000007670446FC07004EF900E000304E7551FC31
S321E00010842F002039FF000908048000142440B0B9FF00090865F8201F4E7551FCB1
S321E00010A02144003408280007002C67F82A280038A168002C4E7551FC183C00FFD1
S321E00010BC61FFFFFFFFE20C0500FF67F04E7551FC7612183C00FF61FFFFFFFFE460
S321E00010D80C0500FE66F461FFFFFFFFC014C5538366F44E75283C082000FF41F9FF
S321E00010F4FF008A00203C385588972140000C183C00FF61FFFFFFFF98183C004020
S321E000111061FFFFFFFF8E183C000061FFFFFFFF84183C000061FFFFFFFF7A183C3E
S321E000112C000061FFFFFFFF70183C000061FFFFFFFF66183C009561FFFFFFFF5C3B
S321E00011484E7551FC598F43F9FF00860C22BC53442D4322BC617264202A7A045AC4
S321E0001164203C1FFFFFFF23C0FF000A5041F9FF008A0020BC802D3C00203C385564
S321E000118088972140000C283C082000FF21C40034A168002C20BCC00D3C0061FFC3
S321E000119CFFFFFEE820BC802D3C0061FFFFFFFEF861FFFFFFFEF261FFFFFFFEECBE
S321E00011B861FFFFFFFEE661FFFFFFFEE061FFFFFFFEDA61FFFFFFFED461FFFFFFF3
S321E00011D4FECE61FFFFFFFEC861FFFFFFFEC220BC800D3C0061FFFFFFFEB661FFF4
S321E00011F0FFFFFEB020BC802D3C0061FFFFFFFEA461FFFFFFFE9E61FFFFFFFE7CBA
S321E000120C2C3C00000064263C0000000A61FFFFFFFED22E3C0000000A183C00FFB3
S321E000122861FFFFFFFE760C050001670C538766F053866700037260D8183C00FFFD
S321E000124461FFFFFFFE5A183C004861FFFFFFFE50183C000061FFFFFFFE46183C60
S321E0001260000061FFFFFFFE3C183C000161FFFFFFFE32183C00AA61FFFFFFFE288F
S321E000127C183C008761FFFFFFFE1E61FFFFFFFE300C05000567300C05000166A8C2
S321E000129861FFFFFFFE0661FFFFFFFE0061FFFFFFFDFA61FFFFFFFDF40C0500AA37
S321E00012B46600013622BC5344484312BC0020183C00FF61FFFFFFFDD8183C007A59
S321E00012D061FFFFFFFDCE183C000061FFFFFFFDC4183C000061FFFFFFFDBA183CC3
S321E00012EC000061FFFFFFFDB0183C000061FFFFFFFDA6183C000161FFFFFFFD9C54
S321E000130861FFFFFFFDAE2C3C566572310C05000567A80C05000166A261FFFFFF77
S321E0001324FD7E61FFFFFFFD7861FFFFFFFD7261FFFFFFFD6C2C3C00004E20183CBB
S321E000134000FF61FFFFFFFD5C183C007761FFFFFFFD52183C000061FFFFFFFD4886
S321E000135C183C000061FFFFFFFD3E183C000061FFFFFFFD34183C000061FFFFFF0D
S321E0001378FD2A183C009561FFFFFFFD2061FFFFFFFD320C05000567AE183C00FFDD
S321E000139461FFFFFFFD0A183C006961FFFFFFFD00183C004061FFFFFFFCF6183CA2
S321E00013B0000061FFFFFFFCEC183C000061FFFFFFFCE2183C000061FFFFFFFCD8DF
S321E00013CC183C009561FFFFFFFCCE61FFFFFFFCE04A0567160C05000567AA538608
S321E00013E86600FF5453836600FE28600001A6203C385511202140000C183C00FF07
S321E000140461FFFFFFFC9A183C004A61FFFFFFFC90183C000061FFFFFFFC86183CE2
S321E0001420000061FFFFFFFC7C183C000061FFFFFFFC72183C000061FFFFFFFC68BE
S321E000143C183C009561FFFFFFFC5E244D61FFFFFFFC8245ED00017E07129A538782
S321E000145866FA12BC0020183C00FF61FFFFFFFC3C183C004961FFFFFFFC32183CDE
S321E0001474000061FFFFFFFC28183C000061FFFFFFFC1E183C000061FFFFFFFC1466
S321E0001490183C000061FFFFFFFC0A183C000161FFFFFFFC00244D61FFFFFFFC2404
S321E00014AC7195EC886624222D0006700EE0A9028100000FFF528171ED0009EE889D
S321E00014C802800000000774089480E4A9600673ED0008528148412601EC8B2E8303
S321E00014E4E389640A22BC333247426000009CE389640A22BC313647426000008ECE
S321E0001500E389640A22BC2038474260000080E389640822BC203447426072E3899F
S321E000151C640822BC203247426066E389640822BC20314742605AE389640C12BCEE
S321E0001538003522BC31324D42604AE389640C12BC003222BC35364D42603AE38948
S321E0001554640C12BC003122BC32384D42602AE389640822BC36344D42601EE3892C
S321E0001570640822BC33324D426012E389640822BC31364D42600622BC3C394D42D5
S321E000158C22BC204F4B2122BC00000A0D604222BC4572726F22BC0000722122BC48
S321E00015A800000A0D603622BC6E6F6E2122BC00000A0D60240000000000000000D1
S321E00015C40000000000000000000000000000000000000000000000002017600688
S321E00015E070FE6002A140588F4E7551FC42804E7B000323C0FF1008144E7B0002FA
S321E00015FC23C0FF1008104E71203CC03FC0404E7B000423C0FF100818203C601F0F
S321E0001618C0004E7B000523C0FF10081C203CE007C4004E7B000623C0FF1008203C
S321E000163442804E7B000723C0FF100824203CFF0400014E7B000823C0FF100828B1
S321E00016504E71203C0000008023C0FF0400044E717003725E7403761323C0FF042B
S321E000166C001423C1FF04001823C2FF04000423C3FF040004203C00D0001B223CEB
S321E000168860D0001E23C0FF04001423C1FF04001823C2FF040004203C00D00003FE
S321E00016A423C3FF040004203C0000200023C0FF10083842B9FF10083C203C00E01F
S321E00016C00003223C00E0005E23C0FF04001423C1FF04001823C2FF04000423C3BE
S321E00016DCFF040004203C00F00003223CFFF0009E23C0FF04001423C1FF040018D2
S321E00016F823C2FF04000423C3FF040004203C1FE00003223C1FE0005E23C0FF0418
S321E0001714001423C1FF04001823C2FF04000423C3FF040004203C1FF00003223C1B
S321E00017301FF0005E23C0FF04001423C1FF04001823C2FF04000423C3FF04000478
S321E000174C203CA10CA12023C0FF1008104E7B00024E714E7561000F900280FFF009
S321E0001768000000800000000323C0FF0400140280FFF0000000800000005C23C0D2
S321E0001784FF040018700323C0FF040004701323C0FF040004201F4E73A179FF1055
S321E00017A0080042B9FF10080442B9FF10080842B9FF10080C203CFF1000004E7BBD
S321E00017BC080120402448203C0000010043FA00EE24C9538066FA20BCFF100FFCB8
S321E00017D843FA01922149000443FA01A4214900081039FF000A2C08000007670089
S321E00017F4007A43FA0F4C2149000C43FA0F442149001043FA01E22149001443FA86
S321E000181009602149002043FA02242149002843FA02262149002C43FA0228214922
S321E000182C003843FA022A214900C043FA0222214900C443FA021A214900C843FA98
S321E00018480212214900CC43FA020A214900D043FA0202214900D443FA01FA2149B0
S321E000186400D843FA01F2214900DC43FA01F42149010443FA02782149010843FA2C
S321E000188002FC2149010C43FA03802149011043FA04042149011443FA04882149BF
S321E000189C011843FA07102149011C43FA073E2149018043FA079C214901F84E75E3
S321E00018B846FC2700518F48D720011039FF000A2C080000076600002C302F00081F
S321E00018D40280000003FCD0B9FF10080C2A4020152A6F00042F400004302F000ACD
S321E00018F008C0000D46C0201F4E754E6D4A39FF1008006600003CA179FF100800F1
S321E000190C23CDFF1008082A79FF1008042B2F000C202F00082B0048404E65028067
S321E0001928000003FCD0B9FF10080C2A402F55000C4CD72001508F4E732B2F000CCE
S321E0001944202F000808C0000D2B0048404E650280000003FCD0B9FF10080C2A4078
S321E00019602F55000C4CD72001508F4E7346FC2700203C31415926B0B900000426C8
S321E000197C6700FF3A4EF9E000000046FC27002F00302F0004028000000C030C808A
S321E000199800000401670000240C80000004026700001A0C8000000802670000109D
S321E00019B40C8000000C0267000006600000242039FF0400080800000166000016BD
S321E00019D02039FF0400100C801FE000006C0000066000FD7E201F6000FED046FC22
S321E00019EC27002F082F00206F000C301808000007670000045488C0B90000003F7B
S321E0001A080C4000086F00002454880C400039660000085488600000140C40003C4E
S321E0001A246600000C080000076700000454882F48000C201F205F4E7346FC27008D
S321E0001A404AC84E714E7146FC27004AC84E714E7146FC27004AC84E714E7146FCE0
S321E0001A5C27004AC84E714E7146FC2700518F48D720014BF9FF000F0C1ABC000212
S321E0001A781039FF000A2C08000007660000144CD72001508F2F390000006446FC34
S321E0001A9421004E754E6D4A39FF10080066000020A179FF10080023CDFF10080851
S321E0001AB02A79FF1008042B2F000C2B2F0008600000102B2F000C2B2F000808ED81
S321E0001ACC000500024E654BF900000064DBF9FF10080C2F55000C1F7C0001000A89
S321E0001AE84CD72001508F4E7346FC2700518F48D720014BF9FF000F0C1ABC000457
S321E0001B041039FF000A2C08000007660000144CD72001508F2F390000006846FCA3
S321E0001B2022004E754E6D4A39FF10080066000020A179FF10080023CDFF100808C3
S321E0001B3C2A79FF1008042B2F000C2B2F0008600000102B2F000C2B2F000808EDF4
S321E0001B58000500024E654BF900000068DBF9FF10080C2F55000C1F7C0002000AF7
S321E0001B744CD72001508F4E7346FC2700518F48D720014BF9FF000F0C1ABC0008C6
S321E0001B901039FF000A2C08000007660000144CD72001508F2F390000006C46FC13
S321E0001BAC23004E754E6D4A39FF10080066000020A179FF10080023CDFF10080836
S321E0001BC82A79FF1008042B2F000C2B2F0008600000102B2F000C2B2F000808ED68
S321E0001BE4000500024E654BF90000006CDBF9FF10080C2F55000C1F7C0003000A66
S321E0001C004CD72001508F4E7346FC2700518F48D720014BF9FF000F0C1ABC001031
S321E0001C1C1039FF000A2C08000007660000144CD72001508F2F390000007046FC82
S321E0001C3824004E754E6D4A39FF10080066000020A179FF10080023CDFF100808A8
S321E0001C542A79FF1008042B2F000C2B2F0008600000102B2F000C2B2F000808EDDB
S321E0001C70000500024E654BF900000070DBF9FF10080C2F55000C1F7C0004000AD4
S321E0001C8C4CD72001508F4E7346FC2700518F48D720014BF9FF000F0C1ABC002095
S321E0001CA81039FF000A2C08000007660000144CD72001508F2F390000007446FCF2
S321E0001CC425004E754E6D4A39FF10080066000020A179FF10080023CDFF1008081B
S321E0001CE02A79FF1008042B2F000C2B2F0008600000102B2F000C2B2F000808ED4F
S321E0001CFC000500024E654BF900000074DBF9FF10080C2F55000C1F7C0005000A43
S321E0001D184CD72001508F4E7346FC2700518F48D720014BF9FF000F0C1ABC0040E8
S321E0001D342039FF10083C670000E00480700000004BF9FF000908B0956F0000CEF0
S321E0001D504FEFFFE448D7031F428361000996200323C0FF040010283C00000106E6
S321E0001D6C23C4FF0400044E712839FF0400044244484423C4FF04001079FC010ED0
S321E0001D8823C4FF0400044E712839FF040014E48C0C44000666000054068000002E
S321E0001DA4000322036700000C06810000005C6000000806810000001E75FC010B35
S321E0001DC023C0FF04001423C1FF04001823C2FF0400044E712043D1FC60000000ED
S321E0001DDC2243283C0001000022D822D822D822D8538466F44E71068300100000CA
S321E0001DF80C8300D000006D00FF5E203C0000200023C0FF10083842B9FF10083CC4
S321E0001E144CD7031F4FEF001C4BF9FFFFFA0B08ED0007FFFC08150007670000065E
S321E0001E30610000DA4A15660000124A2D00026600000A4CD72001508F4E734BF98D
S321E0001E4CFF000A07089500044BFA00B2529520150280000000806600000C4BF918
S321E0001E68FF000A0708D500041039FF000A2C08000007660000202A79F0020000DF
S321E0001E84DBF9FF10080C20152A6F00042F400004201F46FC26004E754E6D4A3978
S321E0001EA0FF1008006600003CA179FF10080023CDFF1008082A79FF1008042B2F2F
S321E0001EBC000C2B2F00084E652A79F0020000DBF9FF10080C2F55000C4CD72001A3
S321E0001ED8508F1F7C000600024E732B2F000C2B2F000808ED000500024E652A79AB
S321E0001EF4F0020000DBF9FF10080C2F55000C4CD720014E75000000002F092F0104
S321E0001F1043F9FF00860C22BC444D412022BC494E54214BF9F0020110226DFFF47F
S321E0001F2C202DFFF86F000058082D0000FFF0660000264A2DFFFC6A00003E22D5E7
S321E0001F4822D522D522D5722E13C1FF00860C0480000000106AE0600000224A2DD6
S321E0001F64FFFC6A00001A2A992A992A992A99722E13C1FF00860C04800000001057
S321E0001F806AE02B49FFF42B40FFF84A2DFFFC6B984BF9FFFFFA0B08AD00070004D0
S321E0001F9C08950007323C0D0A33C1FF00860C221F225F4E754FEFFFF448D70101BE
S321E0001FB82079FF1000082F480008302F000C02800000F0000080000000083F4014
S321E0001FD4000C41F9FF000F0C10BC0080201F205F4E7546FC27004FEFFFEC48D72D
S321E0001FF0090747F9FF00890C12130C0100026600004241F9FF00860C20BC5049EF
S321E000200C432020BC494E542020BC5254432120BC00000D0A41F9FFFF896147F94D
S321E0002028FF00890C4281744016BC008210811028000216805281B40166F24CD7F3
S321E000204409074FEF00144E7346FC27004FEFFFE448D7031F71B9FFFF82010C40B5
S321E000206000026D0000EE0C4000D06D00001041F9FF000908281023C4FF10083CCC
S321E000207CE1881039FFFF8203E1881039FFFF820D260078142400E8AA2839FF1016
S321E0002098083805C46600007E23C4FF1008386100064A23C4FF100838028000F0CA
S321E00020B4000020402248D3FC60000000283C0001000022D822D822D822D853840D
S321E00020D066F423C0FF040010283C0000010623C4FF0400044E712839FF0400043E
S321E00020EC4244484423C4FF040010220006800000001B06816000001E75FC010BA1
S321E000210823C0FF04001423C1FF04001823C2FF0400044E71200379F9FFFF82100C
S321E000212475F9FFFF82AA73F9FFFF82A89481C8C2D0840C8000E000006C000014AE
S321E000214078142400E8AA2839FF10083805C46700FF5A41F9FF00080008A8000031
S321E000215C00034E7108E8000000034CD7031F4FEF001C4E7346FC27004FEFFFF4D2
S321E000217848D7210141F9FF1008004A1066000034A1504E6D214D00082A68000427
S321E00021942B2F00102B2F000C08ED000500024E652A68000C4BED00182F55001048
S321E00021B04CD721014FEF000C4E732A6F001010150C00004E670000280C000046D4
S321E00021CC670002F20C000040670003900C0000F46700041E0C0000F36700049AE3
S321E00021E84E714AC84E71102D00010C0000736700011A0C0000726700013C0C00F8
S321E0002204007B670001C008000003660000400C0000606700007E0C00006167005F
S321E0002220007E0C0000626700007C0C0000636700007A0C000064670000780C0042
S321E000223C0065670000760C000066670000764AC8600000762A6800080C00006819
S321E0002258670000800C000069670000800C00006A6700007E0C00006B6700007C8C
S321E00022740C00006C6700007A0C00006D670000780C00006E67000078214D0004EC
S321E00022904E65600000702A6F00046000002C2A49600000262A4A600000202A4B3E
S321E00022AC6000001A2A4C600000142A6F00086000000C2A4E600000062A6800044B
S321E00022C8214D000854AF00104CD721014FEF000C4E732F4D000460000024224DC8
S321E00022E46000001E244D60000018264D60000012284D6000000C2F4D00086000E7
S321E000230000042C4D54AF00104CD721014FEF000C4E734E6D2F5D000C2F5D00100C
S321E000231C08AF0005000E6600000C4290214D00042A6800084E654CD721014FEF6F
S321E0002338000C4E73102D00020280000007000C4007006700006A0C400600670031
S321E0002354005A0C4005006700004A0C4004006700003A0C4003006700002A0C400E
S321E000237002006700001A0C4001006700000A4E722000600000364E722100600073
S321E000238C002E4E722200600000264E7223006000001E4E722400600000164E723E
S321E00023A825006000000E4E722600600000064E72270058AF00104CD721014FEFD3
S321E00023C4000C4E73302D000202800000F0000800000F660000684A40660000089C
S321E00023E02F17600000C60C401000660000082F01600000B80C40200066000008A3
S321E00023FC2F02600000AA0C403000660000082F036000009C0C4040006600000892
S321E00024182F046000008E0C405000660000082F05600000800C4060006600000869
S321E00024342F06600000722F076000006C0C4080006600000A2F2F00046000005C43
S321E00024500C409000660000082F096000004E0C40A000660000082F0A6000004027
S321E000246C0C40B000660000082F0B600000320C40C000660000082F0C60000024FF
S321E00024880C40D0006600000A2F2F0008600000140C40E000660000082F0E6000B5
S321E00024A400062F2F0004302D000202800000000F219F0C084EB9E00026F24E734A
S321E00024C0102D00010C0000FC670000700C0000C06600000A302F000260000058A8
S321E00024DC0C0000C16600000830016000004A0C0000C26600000830026000003CDE
S321E00024F80C0000C36600000830036000002E0C0000C466000008300460000020F2
S321E00025140C0000C5660000083005600000120C0000C66600000830066000000405
S321E0002530300754AF00106000000A58AF0010302D00020880000D660000104290A2
S321E000254C4E6D214D00042A6800084E653F40000E4CD721014FEF000C4E73102DF9
S321E000256800010C0000E7670000862A6F000C4A10670000064BED20000C0000C000
S321E00025846600000A3F4D00026000005A0C0000C166000008320D6000004C0C006B
S321E00025A000C266000008340D6000003E0C0000C366000008360D600000300C000E
S321E00025BC00C466000008380D600000220C0000C5660000083A0D600000140C001E
S321E00025D800C6660000083C0D600000063E0D4AC854AF00104CD721014FEF000C1F
S321E00025F44E734E714AC84E7154AF0010102D000161000026102D00010C00003042
S321E00026106500000EF4E84CD721014FEF000C4E73F4284CD721014FEF000C4E73BD
S321E000262C02800000000753806B00002A53806B00002A53806B00002853806B00AF
S321E0002648002653806B00002453806B00002253806B000022204F4E75206F00087F
S321E00026644E7520494E75204A4E75204B4E75204C4E75206F000C4E75204E4E756C
S321E000268054AF0010102D00010C0000406E00002C4EB9E000262C102D00010C009E
S321E000269C00206D00000E54AF0010428030280002D1C0F3104CD721014FEF000C4F
S321E00026B84E730C00007A6700002C4EB9E000262C102D00010C0000606D00000EE8
S321E00026D454AF0010428030280002D1C0F3504CD721014FEF000C4E73206F001012
S321E00026F060E24FEFFFF048D7010740C24E7146FC2700428042812040F4E841E83E
S321E000270C001052810C41020066F24281528020400C40000466E64E712039FF1089
S321E000272808104E7B000246C24CD701074FEF00104E7500004E714AC84E714E7139
S30DE00027444E7500004E714E7562
S705E00000001A

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
# MPLAB IDE generated this makefile for use with GNU make.
# Project: firebee1.mcp
# Date: Sun Oct 04 21:22:09 2009
AS = mpasmwin.exe
CC = mcc18.exe
LD = mplink.exe
AR = mplib.exe
RM = rm
firebee1.cof : firebee1.o
$(LD) "..\MPASM Suite\LKR\18f4520i.lkr" "firebee1.o" /z__MPLAB_BUILD=1 /o"firebee1.cof" /M"firebee1.map" /W
firebee1.o : firebee1.asm ../../../Programme/Microchip/MPASM\ Suite/P18f4520.inc
"C:\Programme\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F4520 "firebee1.asm" /l"firebee1.lst" /e"firebee1.err" /o"firebee1.o"
clean :
$(RM) "firebee1.o" "firebee1.ERR" "firebee1.lst" "firebee1.cof" "firebee1.hex"

View File

@@ -0,0 +1,19 @@
# MPLAB IDE generated this makefile for use with Microsoft `nmake'.
# Project: firebee1.mcp
# Date: Sun Oct 04 21:22:09 2009
AS = mpasmwin.exe
CC = mcc18.exe
LD = mplink.exe
AR = mplib.exe
RM = del
"firebee1.cof" : "firebee1.o"
$(LD) "..\MPASM Suite\LKR\18f4520i.lkr" "firebee1.o" /z__MPLAB_BUILD=1 /o"firebee1.cof" /M"firebee1.map" /W
"firebee1.o" : "firebee1.asm" "..\..\..\Programme\Microchip\MPASM Suite\P18f4520.inc"
"C:\Programme\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F4520 "firebee1.asm" /l"firebee1.lst" /e"firebee1.err" /o"firebee1.o"
"clean" :
$(RM) "firebee1.o" "firebee1.ERR" "firebee1.lst" "firebee1.cof" "firebee1.hex"

View File

@@ -0,0 +1,619 @@
;*****************************************************************************
; PS2Atari_v1_4.asm *
; PS2 PC mouse to Atari / Amiga mouse converter by Tom Kirk March 2010 *
; Version 1.3 *
;*****************************************************************************
; *
; Enables a PS2 PC mouse to be used with Atari / Amiga computers using *
; the circuit in circuit.bmp with a PIC16F84(A)/C84 micrcontroller. *
; *
; Assembled using Microchip MPLAB and MPASM. *
; Disable case sensitivity under build options. *
; *
;*****************************************************************************
; Version 1.4 July 2010 *
; Unused Pin RA4 now correctly set as an imput. *
; (Pin is tied to +5V on PCB for easier PCB routing.) *
; My oversight when transfering from prototype to PCB. *
; Thanks to Luciano for informing me. *
; *
; Version 1.3 March 2010 *
; Corrected a bug in button routine preventing both buttons being active *
; together under certain conditions. *
; Thanks to Oliver Fleischmann for informing me. *
; (Can't believe it taken 6 Years for this bug to show itself!!) *
; *
; Version 1.2 June 07 *
; Changed left/right button outputs to fake open collector. *
; Needed to stop conflits when using a joystick pluged into other port. *
; *
; Version 1.1 August 04 *
; Added support for Amiga. *
; *
;*****************************************************************************
; list directive to define processor
list p=16F84A
; processor specific variable definitions
#include <p16F84A.inc>
; define config bits
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
;4 MHz Clock
;************************ Input output usage ********************
; RA0 Atari / Amiga select i/p
; RA1 PS2 mouse data
; RA2 PS2 mouse clock
; RA3 Not used
; RA4 Not used
; RB0 Atari XA / Amiga XA o/p
; RB1 Atari XB / Amiga YB o/p
; RB2 Atari YA / Amiga YA o/p
; RB3 Atari YB / Amiga XB o/p
; RB4 Left button o/p
; RB5 Right button o/p
; RB6 Not used
; RB7 Not used
;*******************************************************************
;********** I/O port equates **************
ps2data equ 1 ;ps2 mouse data signal
ps2clk equ 2 ;ps2 mouse clock signal
;********** User register equates *********
temp equ 0ch ;Temporary storage
byte1 equ 0dh ;Byte 1 store
byte2 equ 0eh ;Byte 2 store
byte3 equ 0fh ;Byte 3 store
xinc equ 010h ;last x increment read
yinc equ 011h ;last y increment read
xlow equ 012h ;low byte of 16 bit x counter
xhigh equ 013h ;high byte of 16 bit x counter
ylow equ 014h ;low byte of 16 bit y counter
yhigh equ 015h ;high byte of 16 bit y counter
xpat equ 016h ;x pattern position
ypat equ 017h ;y pattern position
bcnt equ 018h ;bit counter
brec equ 019h ;byte received
timer equ 01ah ;timer counter
parity equ 01bh ;parity store
flag equ 01ch ;flag bits (bit 0 = ack error flag)
; (bit 1 = parity error flag)
; (bit 2 = middle button pressed flag)
; (bit 3 = middle state flag)
; (bit 4 = left button flag)
;*****************************************************************************************
;***** initialise program *******
reset clrwdt
bcf status,rp0 ;set page0
clrf intcon ;disable interupts
bsf status,rp0
movlw 084h ;set tmr0 to int clk,prescale/32
movwf option_reg
bcf status,rp0
clrf porta ;all porta outputs will be low when enabled
movlw 0h ;set mouse buttons and x y start levels
movwf portb
bsf status,rp0
movlw 017h ;set porta bit 3 as an unused output
movwf trisa
movlw 030h ;set portb bit 4 and 5 as inputs (left/right button o/ps open collector)
movwf trisb
bcf status,rp0
clrf byte1 ;set start up values
clrf byte2
clrf byte3
clrf xinc
clrf yinc
clrf xlow
clrf xhigh
clrf ylow
clrf yhigh
clrf xpat
clrf ypat
clrf flag
;***************** set up ps2 mouse *********************
start call ps2read ;read power up self test report
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0aah ;correct ?
subwf brec,w
btfss status,z
goto restart ;no so jump
call ps2read ;read power up pc mouse id
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0h ;correct ?
subwf brec,w
btfss status,z
goto restart ;no so jump
restart movlw 0ffh ;send reset pc mouse command
call ps2wri
btfsc flag,0 ;ack bit?
goto restart ;no so jump
call ps2read ;ack returned
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0fah ;correct ?
subwf brec,w
btfss status,z
goto restart ;no so jump
call ps2read ;read self test report
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0aah ;correct ?
subwf brec,w
btfss status,z
goto restart ;no so jump
call ps2read ;read pc mouse id
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0h ;correct ?
subwf brec,w
btfss status,z
goto restart ;no so jump
movlw 0f4h ;send enable reporting command
call ps2wri
btfsc flag,0 ;ack bit?
goto restart ;no so jump
call ps2read ;ack returned
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0fah ;correct ?
subwf brec,w
btfss status,z
goto restart
movlw 0f3h ;send set sample rate command
call ps2wri
btfsc flag,0 ;ack bit?
goto restart ;no so jump
call ps2read ;ack returned
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0fah ;correct ?
subwf brec,w
btfss status,z
goto restart
movlw 028h ;send sample rate (40)
call ps2wri
btfsc flag,0 ;ack bit?
goto restart ;no so jump
call ps2read ;ack returned
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movlw 0fah ;correct ?
subwf brec,w
btfss status,z
goto restart
;******************* Main program loop ****************************
main call ps2read ;read 3 byte pc mouse packet
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movf brec,w
movwf byte1
call ps2read
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movf brec,w
movwf byte2
call ps2read
btfsc flag,1 ;parity error?
goto restart ;yes so jump
movf brec,w
movwf byte3
;adjust the 16 bit x counter
clrf temp ;use temp as high byte
btfsc byte1,4 ;extend sign bit into high byte
decf temp,f
movf byte2,w ;add low bytes
addwf xlow,f
btfsc status,c ;add carry to high
incf xhigh,f
movf temp,w ;add high bytes
addwf xhigh,f
;adjust the 16 bit y counter
clrf temp ;use temp as high byte
btfsc byte1,5 ;extend sign bit into high byte
decf temp,f
movf byte3,w ;add low bytes
addwf ylow,f
btfsc status,c ;add carry to high
incf yhigh,f
movf temp,w ;add high bytes
addwf yhigh,f
;left button
btfss byte1,0 ;is the left pc mouse button pressed
goto lbutt ;no so jump
bsf flag,4 ;set left button flag
goto nbutt
lbutt bcf flag,4 ;reset left button flag
;right button
nbutt btfss byte1,1 ;is the right pc mouse button pressed
goto rbutt ;no so jump
bcf portb,5 ;set right button as pressed
bsf status,rp0 ;by setting pin as a low output
bcf trisb,5
bcf status,rp0
goto mbut
rbutt bsf status,rp0 ;set right button as not pressed
bsf trisb,5 ;by setting pin as an input
bcf status,rp0
;middle button
mbut btfss byte1,2 ;check if middle button pressed
goto mbutt ;jump if not
btfsc flag,2 ;check middle button pressed flag
goto mbex ;set so jump
movlw 08h ;toggle middle state flag
xorwf flag,f
bsf flag,2 ;set middle button pressed flag
goto mbex
mbutt btfss flag,2
goto mbex
bcf flag,2 ;reset middle button pressed flag
mbex
btfsc flag,3 ;check middle state flag
goto setlb ;jump if set
btfsc flag,4 ;check left button flag
goto setlb ;jump if set
bsf status,rp0 ;no flags set so set left buuton not pressed
bsf trisb,4 ;by setting pin as an input
bcf status,rp0
goto main
setlb bcf portb,4 ;set left button pressed
bsf status,rp0 ;by setting pin as a low output
bcf trisb,4
bcf status,rp0
goto main
;***************************** Subs *****************************************
;***** Read a byte from the ps2 mouse ******
ps2read btfss porta,ps2data ;data low ?
goto ps2r1 ;yes so start reading data
call trans ;no so do emulated mouse move
clrf tmr0 ;clear rtcc before delay
oned btfss porta,ps2data ;data low ?
goto ps2r1 ;yes so start reading data
movlw 0dh ;delay between emulated mouse moves
subwf tmr0,w
btfss status,z
goto oned ;not done so jump
goto ps2read ;check again
ps2r1 call wlow ;wait until clock goes low for start bit
call whigh ;wait until clock is high
movlw 08h ;read 8 data bits
movwf bcnt
clrf parity ;clear parity counter
ps2r2 call wlow ;wait until clock is low
bcf status,c ;clear carry flag
btfss porta,ps2data ;data bit set ?
goto ps2r3 ;no so jump
incf parity,f ;yes so inc the parity counter
bsf status,c ;set carry bit
ps2r3 rrf brec,f ;shift carry into destination
call whigh ;wait until clock is high
decfsz bcnt,f ;finished the 8 bits?
goto ps2r2 ;no so do again
call wlow ;for the parity bit
btfsc porta,ps2data ;parity bit set?
incf parity,f ;yes so inc the parity counter
bcf flag,1 ;clear flag (no error)
btfss parity,0 ;check calculated parity
bsf flag,1 ;set flag (parity error!)
call whigh
call wlow ;for the stop bit
call whigh
return ;and exit
;***** Write a byte to the ps2 mouse ******
ps2wri movwf brec ;speed not important at this point so
movwf temp ;calculate parity seperate for sake of
movlw 08h ;clarity
movwf bcnt
clrf parity
ps2w1 rrf temp,f ;shift bit into carry
movlw 01h ;preset for bit set
btfss status,c ;test carry
clrw ;bit zero so no addition
addwf parity,f ;update parity
decfsz bcnt,f ;any more bits to do?
goto ps2w1 ;yes so jump
comf parity,f ;only intrested in bit 0.
;parity bit is complement of bit 0
movlw 08h ;bit count to 8
movwf bcnt
call clkl ;set clock low
movlw 021h ;wait 100 uS
movwf temp
ps2ww decfsz temp,f
goto ps2ww
call datl ;set data low
nop ;wait 5 uS
nop
nop
nop
nop
call clkh ;set clock high
ps2w2 call wlow ;wait for clock to go low
rrf brec,f ;rotate bit into carry for testing
btfss status,c
goto ps2w3 ;jump if bit is low
call dath ;set data high
goto ps2w4
ps2w3 call datl ;set data low
ps2w4 call whigh ;wait for clock to go high
decfsz bcnt,f ;any more bits to send?
goto ps2w2 ;yes so jump
call wlow ;wait for clock to go low
btfss parity,0 ;send parity bit
goto ps2w5
call dath
goto ps2w6
ps2w5 call datl
ps2w6 call whigh
call wlow ;send stop bit
call dath
call whigh
call wlow ;read ack from mouse
bcf flag,0
btfsc porta,ps2data
bsf flag,0
call whigh
return
;******* wait for ps2 clock to go low **********
wlow btfsc porta,ps2clk
goto wlow
return
;******* wait for ps2 clock to go high **********
whigh btfss porta,ps2clk
goto whigh
return
;******* set ps2 clock low *********************
clkl bsf status,rp0
bcf trisa,ps2clk
bcf status,rp0
return
;******* set ps2 clock high ********************
clkh bsf status,rp0
bsf trisa,ps2clk
bcf status,rp0
return
;******* set ps2 data low *********************
datl bsf status,rp0
bcf trisa,ps2data
bcf status,rp0
return
;******* set ps2 data high *********************
dath bsf status,rp0
bsf trisa,ps2data
bcf status,rp0
return
;********* emulate mouse move ***************************
;move the emulated mouse by one step in the x direction if needed
trans movf xlow,w ;is the x counter zero?
iorwf xhigh,w
btfsc status,z
goto ymove ;no so jump to y direction
btfsc xhigh,7 ;is the x counter positive or negative?
goto xneg ;jump if negative
incf xpat,f ;increment the pattern list position
movlw 04h ;test if end of pattern list
subwf xpat,w
btfsc status,z
clrf xpat ;end of pattern list so reset
movlw 0ffh ;subtract 1 from the 16 bit counter by adding ffffh
addwf xlow,f
btfsc status,c ;add carry to high byte
incf xhigh,f
addwf xhigh,f
goto ymove ;exit to y direction
xneg decf xpat,f ;decrement the pattern list position
movlw 0ffh ;test if end of pattern list
subwf xpat,w
btfss status,z
goto xno
movlw 03h ;end of pattern list so reset
movwf xpat
xno movlw 01h ;add 1 to the 16 bit counter
addwf xlow,f
btfsc status,c ;add carry to high byte
incf xhigh,f
;move the emulated mouse by one step in the y direction if needed
ymove movf ylow,w ;is the y counter zero?
iorwf yhigh,w
btfsc status,z
goto out ;no so jump to output pattern
btfsc yhigh,7 ;is the y counter positive or negative?
goto yneg ;jump if negative
incf ypat,f ;increment the pattern list position
movlw 04h ;test if end of pattern list
subwf ypat,w
btfsc status,z
clrf ypat ;end of pattern list so reset
movlw 0ffh ;subtract 1 from the 16 bit counter by adding ffffh
addwf ylow,f
btfsc status,c ;add carry to high byte
incf yhigh,f
addwf yhigh,f
goto out ;exit to output pattern
yneg decf ypat,f ;decrement the pattern list position
movlw 0ffh ;test if end of pattern list
subwf ypat,w
btfss status,z
goto yno
movlw 03h ;end of pattern list so reset
movwf ypat
yno movlw 01h ;add 1 to the 16 bit counter
addwf ylow,f
btfsc status,c ;add carry to high byte
incf yhigh,f
;output new x and y patterns
out btfsc porta,0 ;test if set for atari
goto amiga
movf xpat,w ;get the x pattern bits
bsf pclath,1 ;set page 2
call pattx
movwf temp ;store the pattern in temp
movf ypat,w ;get the y pattern bits
call patty
clrf pclath ;set page 0
iorwf temp,f ;store the pattern in temp
goto outpat
amiga movf xpat,w ;get the x pattern bits
bsf pclath,1 ;set page 2
call apatx
movwf temp ;store the pattern in temp
movf ypat,w ;get the y pattern bits
call apaty
clrf pclath ;set page 0
iorwf temp,f ;store the pattern in temp
outpat movf temp,w ;get patterns
andlw 0fh ;ensure high nibble stays zero
movwf portb ;ouput patterns
return
;*************** pattern lists **************
org 0200h
;atari patterns
pattx addwf pcl,f
retlw 0
retlw 1
retlw 3
retlw 2
patty addwf pcl,f
retlw 0
retlw 4
retlw 0ch
retlw 8
;amiga patterns
apatx addwf pcl,f
retlw 0
retlw 1
retlw 9
retlw 8
apaty addwf pcl,f
retlw 0
retlw 4
retlw 6
retlw 2
;*******************************************************************************
END

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -0,0 +1,845 @@
;**********************************************************
;* firebee1 PIC18F4321 MAIN FILE
;**********************************************************
;* CREATED BY FREDI ASCHWANDEN
;* DATE 22.9.2009
;**********************************************************
list PE=18f4520 ;EXTENDED INSTRUCTION SET
include "P18f4520.inc"
;------------------------ Equates --------------------------;
;Register addresses
;BANK 0
SECS equ 0x00
SECS_ALARM EQU 0x01
MINS equ 0x02
MINS_ALRAM EQU 0x03
HOURS equ 0x04
HOURS_ALARM EQU 0x05
DAY_OF_WEEK EQU 0x06
DAYS EQU 0x07
MONTHS EQU 0x08
YEARS EQU 0x09 ;offset vom 1968
REGA EQU 0x0A
REGB EQU 0x0B
REGC EQU 0x0C
REGD EQU 0x0D
RTC_RAM EQU 0x0E ; bis 0x3F
free equ 0x40
TICKS equ 0x41 ;125MS
TASTE_ON_TIME EQU 0x42
TASTE_OFF_TIME EQU 0x43
POWER_ON_TIME EQU 0x44
AD_KANAL EQU 0x45
U_ERR EQU 0x46 ;SPANNUNGSFEHLER WENN BIT 0=1, BIT1=1 WARTEN AUF GELADEN
U_ERR_TIME EQU 0x47 ;ZEIT SEIT SPANNUNGSFEHLER
U_POWER_IN EQU 0x48 ;SPANNUNG POWER IN 1V CA. 6E
RX_B EQU 0x49 ;RECEIVED BYT
RX_STATUS EQU 0x4A ;STATUS: 0x00=WAIT AUF MCF COMMANDO, 0x82=EMPFANGE 64BYT FROM RTC
TX_STATUS EQU 0x4B ;STATUS: 0x00=WAIT 0x81=SENDE 64BYT FROM RTC
GO_SUB EQU 0x4C ;WENN GLEICH 0xFB DANN SUBROUTINE AUSF<53>HREN
GO_INT EQU 0x4D ;WENN GLEICH 0xFB DANN SUBROUTINE AUSF<53>HREN
EAPIR1 EQU 0x4E ;INTERRUPT ACTIV UND ENABLE
EAPIR2 EQU 0x4F ;INTERRUPT ACTIV UND ENABLE
;BANK 1 AB 0x100
RX_BUFFER EQU 0x100 ;0x80 BYT BUFFER BIS 0x17F BANK
TX_BUFFER EQU 0x180 ;0X80 BYT BUFFER BIS 0x1FF BANK
;--------------------------------------------------------------
SEND_RTC_TIME EQU .2 ;0.25 SEC (EINHEIT IST EIN TICK = 128MS
RESET_ON_TIME EQU .2 ;0.25 SEC (EINHEIT IST EIN TICK = 128MS
RESET_OFF_TIME EQU .4 ;0.5 SEC (EINHEIT IST EIN TICK = 128MS
OFF_TIME EQU .20 ;2.5 SEC (EINHEIT IST EIN TICK = 128MS
ON_TIME EQU .2 ;0.25 SEC (EINHEIT IST EIN TICK = 128MS
TIMER_HB EQU .240 ;256- (32768Hz PRO 1/8SEC = 4096TICKS/256) => 256-16=240 (resp 256-16/4 (wenn osco) = 252)
TIME_MAX EQU .160 ;MAXIMALTIME
U_ERR_PW_AUS EQU .5 ;5 SEC
;SERIEL
SYNC1 EQU 0FFh
SYNC1_DATA EQU 'A';
SYNC2 EQU 0FEh
SYNC2_DATA EQU 'C';
SYNC3 EQU 0FDh
SYNC3_DATA EQU 'P';
SYNC4 EQU 0FCh
SYNC4_DATA EQU 'F';
REQ_RTCD_FROM_PIC EQU 01h ;RTC AND NVRAM DATEN VOM PIC ANFORDERN
RTCD_FROM_PIC EQU 81h ;RTC AND NVRAM DATEN HEADER UND STATUS
REQ_RTCD_FROM_MCF EQU 02h ;RTC AND NVRAM DATEN VOM MCF ANFORDERN
RTCD_FROM_MCF EQU 82h ;RTC AND NVRAM DATEN HEADER UND STATUS
U_MIN_TO_MCF EQU 03h ;UNTERSPANNUNGSMITTEILUNG AN PROCESSOR
EXT_SUB_GO EQU 04h ;SERIELL CODE UM SUBROUTINEN/INTERRUPTS ZU AKTIVIEREN
EXT_SUB_STOP EQU 05h ;SERIELL CODE UM SUBROUTINEN/INTERRUPTS ZU STOPPEN
CLK_SLEEP EQU B'00010010' ;125kHz intern, SLEEP MODE
CLK_ACTIV EQU B'01110010' ;inTernal CLK=8MHz, SLEEP MODE, SLEEP MODE
EXT_CODE EQU 0xFB ;CODE F<>R EXTERNE SUBROUTINEN/INTERRUPTS AUSF<53>HREN (FireBee!)
EXTERN_INT_ADR EQU 0x2000 ;HIER MUSS 0xFB STEHEN WENN EXTERNE INTERRUPTS AUSF<53>HRBAR
EXTERN_INTERRUPTS EQU 0x2002 ;STARTPUNKT EXTERNE SUBROUTINES
EXTERN_SUB_ADR EQU 0x2010 ;HIER MUSS 0xFB STEHEN WENN EXTERNE SUBROUTINES AUSF<53>HRBAR
EXTERN_SUBROUTINES EQU 0x2012 ;STARTPUNKT EXTERNE SUBROUTINES
REQ_BLOCK EQU 0xA0 ;BLOCK DATEN LESEN -> CODE UND 3 BYTS ADRESSE = TOTAL 4 BYTES
READ_BLOCK EQU 0xA1 ;PROGRAMM BLOCK PIC->MCF -> CODE, 3 BYTS ADRESSE UND 64 BYTS DATEN = TOTAL 68 BYTES
WRITE_BLOCK EQU 0xA2 ;PROGRAMM BLOCK MCF->PIC -> CODE, 3 BYTS ADRESSE UND 64 BYTS DATEN = TOTAL 68 BYTES
PRG_OK_PIC EQU 0x22 ;PROGRAMMIERUNG BLOCK FERTIG
;**********************************************************************************************"""""""""""""
; Start at the reset vector
Reset_Vector code 0x000
BRA KALT_START
;--------------------------------------------------------------
HIGH_INT_VEC code 0x0008
GOTO 0x18
LOW_INT_VEC code 0x0018
INT_HANDLER
CLRF BSR ;IMMER ACCESS BANK
;SETZEN GRUPPE 1
MOVFF PIE1,EAPIR1 ;INTERRUPTS HOLEN
MOVF PIR1,0 ;MASKE
ANDWF EAPIR1 ;ACTIVE SETZEN
BTFSC EAPIR1,TMR1IF ;uhr interrupt?
BRA RTC_ISR ;ja->
BTFSC EAPIR1,ADIF ;AD INTERRUTP?
BRA AD_ISR ;JA->
BTFSC EAPIR1,TXIF ;seriell TX?
BRA TX_ISR ;JA->
BTFSC EAPIR1,RCIF ;seriell RX?
BRA RX_ISR ;JA->
;SETZEN GRUPPE 2
MOVFF PIE2,EAPIR2 ;INTERRUPTS HOLEN
MOVF PIR2,0 ;MASKE
ANDWF EAPIR2 ;ACTIVE SETZEN
BTFSC EAPIR2,HLVDIF ;UNDER/OVERVOLTAGE DETECT
BRA HLVD_ISR ;JA->
RETFIE
;TESTEN UND SETZEN GRUPPE 1
MOVFF PIE1,EAPIR1 ;INTERRUPTS HOLEN
MOVF PIR1,0 ;MASKE
ANDWF EAPIR1 ;ACTIVE SETZEN
TSTFSZ EAPIR1
BRA INT_HANDLER
;TESTEN UND SETZEN GRUPPE 2
MOVFF PIE2,EAPIR2 ;INTERRUPTS HOLEN
MOVF PIR2,0 ;MASKE
ANDWF EAPIR2 ;ACTIVE SETZEN
TSTFSZ EAPIR2
BRA INT_HANDLER
MOVLW EXT_CODE ;GO EXTERNE SUBROUTINEN AKTIV?
CPFSEQ GO_INT ;SKIP WENN JA
RETFIE
GOTO EXTERN_INTERRUPTS ;REGISTER SICHERN UND STARTEN
;**********************************************************************************************"""""""""""""
; Start application beyond vector area
CODE 0x0100
KALT_START
;RESET MODE
CLRF BSR ;BANK 0
;ALLE INT AUS UND R<>CKSETZEN
CLRF INTCON ;alle INTERRUPT AUS
CLRF RCON ;INT PRIORITY AUS
CLRF PIE1 ;MASK DISABLE
CLRF PIE2
CLRF PIR1 ;INT ACT AUS
CLRF PIR2
CLRF IPR1 ;LOW PRIORITY
CLRF IPR2
; clock
; MOVLW B'01000000' ;32MHZ
; MOVWF OSCTUNE
CLRF OSCTUNE
;CLOCK
MOVLW CLK_ACTIV
MOVWF OSCCON
; div init
;SET PORT A: **7:#master/0.409*5V0 **6:PIC_AMKB_RX **5:PIC_SWTICH **4:HIGH_CHARGE_CURRENT **3:2V5 *2:3V3/2 **1:1V25 **0:POWER_IN/11
CLRF PORTA ;#master(7)=0, REST=0
MOVLW B'11111111' ;DIRECTION: alles auf Input
MOVWF TRISA
;SET PORT B: **7:PGD **6:PGC **5:PGM **4:PIN_INT,1V5 **3:GAME PORT PIN10 **2:GAME PORT PIN11 **1:GAME PORT PIN6 **0: GAME PORT PIN5
CLRF PORTB ;ALLES AUF 0
MOVWF TRISB
;SET PORT C: **7: PIC_RX **6:PIC_TX **5:AMKB_TX **4:GAME PORT PIN4 **3:GAME PORT PIN12 **2:GAME PORT PIN13 **1+0: OCS 32K768Hz
CLRF PORTC
MOVWF TRISC
;SET PORT D: **7:#RSTI **6:GAME PORT PIN3 **5:PS2 KB CLK **4:PS2 MS CLK **3:PS2 KB DATA **2:MS DATA **1:TASTER **0:POWER ON/OFF (0=ON)
; SET TASTE UND POWER
CLRF PORTD ;ALLES AUF 0
MOVWF TRISD ;ALLES AUF INPUT
;SET PORT E: **3:#MCLR **2:#PCI_RESET **1:PCI 3V3 **0:PIC LED (0=ON)
MOVLW B'00000001' ;LED OFF
CLRF PORTE ;ALLES AUF 0
MOVWF TRISE ;ALLES AUF INPUT
;--------------------------
; set OVERvoltage detekt
MOVLW B'10011011' ;INT WENN <20>BER 3.9V
MOVWF HLVDCON
MOVLW B'00000011' ;ERRORS ON, WAIT AUF LADEN
MOVWF U_ERR
MOVLW .20 ;SEIT 20SEC ERROR
MOVWF U_ERR_TIME ;SETZEN
BSF PIE2,HLVDIE ;Enable interrupt
;INTIALISIERUNGSPROGAMME
CALL LADESTROM ;LADESTROM EINSTELLEN
;UHR initialisieren
MOVLW TIMER_HB ;Preload TMR1 register
MOVWF TMR1H ;
CLRF TMR1L ;=0
MOVLW B'00001111' ; 8 BIT, osc1 enable, TIMER MODE, TIMMER ENABLE
MOVWF T1CON ; SET
CLRF TICKS ; 1/8 sec register
CLRF SECS ; Initialize timekeeping registers
CLRF MINS ;
MOVLW .12
MOVWF HOURS
MOVLW .1
MOVWF DAY_OF_WEEK
MOVLW .1
MOVWF DAYS
MOVLW .8
MOVWF MONTHS
MOVLW .42
MOVWF YEARS ;MONTAG 19.7.2010 12:00:00 (JAHR-1968)
CLRF TASTE_ON_TIME
CLRF TASTE_OFF_TIME
CLRF POWER_ON_TIME
BSF PIE1,TMR1IE ;Enable Timer1 interrupt
;AD WANDLER INITIALISIEREN
CLRF AD_KANAL ;BEI 0 BEGINNEN
CLRF ADCON0 ;AD MOUDUL AUS
MOVLW B'00001001' ;VREF=VDD,ANALOG INPUT AN0-AN5
MOVWF ADCON1
MOVLW B'00000000' ;LINKSSB<53>NDIG,0 TAD,CLOCK=Fosc/2
MOVWF ADCON2
; BSF PIE1,ADIE ;INTERRUPT ENABLE
CLRF U_POWER_IN ;WERT AUF 0 VOLT
; seriell initialisieren
CLRF SPBRGH
MOVLW .16
MOVWF SPBRG ;BAUDE RATE = 115K
MOVLW B'00000100' ;TX AUS, ASYNC HIGH SPEED
MOVWF TXSTA
MOVLW B'10010000' ;SERIEL EIN,RX EIN,
MOVWF RCSTA
MOVLW B'00001000' ;16BIT BRG, RISING EDGE INTERRUPT
MOVWF BAUDCON ;SETZEN
;EXTERNER SUBROUTINES
CLRF GO_SUB
; interrupts
CLRF INTCON3 ;EXTER INTERRUPT AUS, low priority
MOVLW B'11110000' ;PORT B PULLUPS AUS, EXT INT ON RISING EDGE, TMR0 AND BPIP Low priority
MOVWF INTCON2
MOVLW B'11000000' ;global on, PERIPHERAL INT on
MOVWF INTCON
;CLOCK
MOVLW CLK_SLEEP ;GEHT JETZT IN SLEEP MODE
MOVWF OSCCON
;-------------------------------------------------------------------------
;---------------------------- MAIN LOOP -------------------------------------------------
;-------------------------------------------------------------------------
MAIN
MOVLW EXT_CODE ;GO EXTERNE SUBROUTINEN AKTIV?
CPFSEQ GO_SUB ;SKIP WENN JA
BRA WARTEN ;SONST WARTEN
CALL MAIN2,1 ;REGISTER SICHERN UND STARTEN
WARTEN
BTFSC TRISD,RD0 ;SKIP IF POWER ON
SLEEP ;SLEPP BIS ZUM N<>CHSTEN INTERRUPT
BRA MAIN
MAIN2
CALL EXTERN_SUBROUTINES ;EXTERNE SUBROUTINEN AUSF<53>HREN AN STELLE 0 MUSS 0xFA STEHEN SONST UNG<4E>LTIG
RETURN 1 ;RETURN MIT REGISTER ZUR<55>CK
;**********************************************************************************************"""""""""""""
;--------------------------- subroutines -------------------------------------------------
;**********************************************************************************************"""""""""""""
;POWER ON/OFF
POWER_EIN
;CLOCK
MOVLW CLK_ACTIV
MOVWF OSCCON
BCF TRISA,RA7 ;CLOCK EINSCHALTEN
BCF TRISD,RD7 ;#RSTI AKTIVIEREN = LOW
BCF TRISB,RB4 ;PIC_INT AKTIVIEREN
BCF TRISD,RD0 ;POWER ON
BRA LS_ON_POWER ;LADESTROM EINSTELLEN
POWER_AUS
;CLOCK
MOVLW CLK_SLEEP
MOVWF OSCCON
BSF TRISD,RD0 ;POWER OFF
BSF TRISD,RD7 ;#RSTI DEAKTIVIEREN
BSF TRISB,RB4 ;PIC INT DEAKTIVIEREN
BSF TRISA,RA7 ;CLOCK DEAKTIVIEREN
CLRF POWER_ON_TIME ;R<>CKSETZEN
BRA LS_OFF_POWER ;LADESTROM EINSTELLEN
;LADESTROM EINSTELLEN ----------------------------
LADESTROM
BTFSC TRISD,RD0 ; ONPOWER?
BRA LS_OFF_POWER ; NEIN->
LS_ON_POWER ;GROSSER LADESTROM 5A
BCF TRISA,RA4 ;10K ON
RETURN
LS_OFF_POWER ;KLEINER LADESTROM_MIN 1.85A
BSF TRISA,RA4 ;10K OFF
RETURN
;---------------------------------------------------
;SERIELL AUS/EIN
SERIAL_OFF
BCF TXSTA,TXEN ;TX AUS
BCF PIE1,RCIE ;DISABLE RX interrupt
BCF PIR1,RCIF ;CLEAR RX interrupt
BCF PIE1,TXIE ;DISABLE TX interrupt
BCF PIR1,TXIF ;CLEAR TX interrupt
RETURN
SERIAL_ON
BTFSC TXSTA,TXEN ;SCHON EIN?
RETURN ;JA->
BSF TXSTA,TXEN ;TX EIN
MOVLW SYNC1
MOVWF RX_STATUS ;AUF SYNC WARTEN
CLRF TX_STATUS
MOVFF RCREG,RX_B ;RCREG LEEREN
MOVFF RCREG,RX_B ;RCREG LEEREN
BCF PIR1,TXIF ;CLEAR TX interrupt
BCF PIR1,RCIF ;INTERRUPT RX FLAG L<>SCHEN
BSF PIE1,RCIE ;ENABLE RX interrupt
NOP
RETURN
;---------------------------------------------------------------------
; TASTENDRUCK
TASTE
BTFSS PORTD,RD1 ;TASTE GEDR<44>CKT?
BRA TG_JA ;->JA
;TASTE NICHT GEDR<44>CKT ODER LOSGELASSEN
CLRF TASTE_ON_TIME ;R<>CKSETZEN
MOVLW TIME_MAX ;MAX
CPFSGT TASTE_OFF_TIME ;L<>NGER?
INCF TASTE_OFF_TIME ;NEIN ERH<52>HEN
MOVLW RESET_OFF_TIME ;2SEC
CPFSGT POWER_ON_TIME ;L<>NGER?
RETURN ;NEIN->
;RESET AUFHEBEN
BSF TRISD,RD7 ;JA -> #RSTI DEAKTIVIEREN =HIGH
CALL SERIAL_ON ;SERIELL EINSCHALTEN
RETURN
;TASTE GEDR<44>CKT
TG_JA
MOVLW OFF_TIME+1
CPFSLT TASTE_ON_TIME ;K<>RZER ALS ONTIME+1
RETURN ;NEIN->FERTIG
BTFSC TRISD,RD0 ;ONPOWER?
BRA TG_OFF_POWER ;NEIN->
TG_ON_POWER
MOVLW SEND_RTC_TIME ;ZEIT F<>R RTC REQ FROM MCF HOLEN?
CPFSEQ TASTE_ON_TIME ;TEST
BRA TG_ON_POWER2 ;NEIN->
SEND_RTC_REG
MOVLW REQ_RTCD_FROM_MCF
MOVWF TXREG ;SENDEN
BRA TG_END;
TG_ON_POWER2
MOVLW RESET_ON_TIME ;
CPFSLT TASTE_ON_TIME ;K<>RZER?
BRA RESETEN
TG_ON_POWER3
MOVLW OFF_TIME
CPFSLT TASTE_ON_TIME ;K<>RZER ON/OFF TIME?
CALL POWER_AUS ;NEIN->POWER OFF
BRA TG_END
TG_OFF_POWER
MOVLW ON_TIME
CPFSLT TASTE_ON_TIME ;K<>RZER ALS ON/OFF TIME?
CALL POWER_EIN ;NEIN->POWER ON
TG_END
CLRF TASTE_OFF_TIME ;R<>CKSETZEN
INCF TASTE_ON_TIME ;ERH<52>HEN
RETURN
RESETEN
BCF TRISD,RD7 ;NEIN-> #RSTI AKTIVIEREN =LOW -->>>RESET
CALL SERIAL_OFF ;SERIELL DEAKTIVIEREN
BRA TG_ON_POWER3
;**********************************************************************************************"""""""""""""
;----------------------------------------- INTERRUPTS
;**********************************************************************************************"""""""""""""
; SERIELL INTERRUPTS
;**********************************************************************************************"""""""""""""
;TX
TX_ISR ;TRANSMIT
MOVLW RTCD_FROM_PIC ;RTC DATEN SENDEN?
CPFSEQ TX_STATUS ;SKIP JA
BRA TX_ISR1 ;NEIN->
MOVFF POSTINC0,TXREG ;BYT SENDEN
MOVLW 0x3F ;SCHON LETZTES BYTS?
CPFSGT FSR0L ;SKIP WENN FERTIG
RETFIE ;NEIN WEITERE SENDEN
TX_ISR_FERTIG
CLRF TX_STATUS
BCF PIE1,TXIE ;SONST DISABLE interrupt
BCF PIR1,TXIF ;INTERRUPT FLAG L<>SCHEN
RETFIE
TX_ISR1
MOVLW READ_BLOCK ;READ BLOCK?
CPFSEQ TX_STATUS ;SKIP JA
BRA TX_ISR2 ;NEIN->
MOVFF POSTINC0,TXREG ;BYT SENDEN
MOVLW 0xC3 ;SCHON LETZTES BYTS?
CPFSGT FSR0L ;SKIP WENN FERTIG
RETFIE ;NEIN WEITERE SENDEN
TX_ISR2
BRA TX_ISR_FERTIG
;**********************************************************************************************"""""""""""""
;RX
RX_ISR ; BYT RECEIVED
MOVFF RCREG,RX_B ; BYT HOLEN
; MOVFF RX_B,TXREG ; ECHO
MOVLW SYNC4 ;IM SYNC STATUS?
CPFSLT RX_STATUS ;SKIP WENN NEIN
BRA RX_SYNC_START ;JA -> ZUERST SYNC EMPFANGEN
;---------------
MOVLW RTCD_FROM_MCF ; DATEN VOM MCF CODE 0x82?
CPFSEQ RX_STATUS ; WENN JA-> SKIP
BRA RX_ISR1 ; NEIN->
;64 BYT EMPFANGEN -------------------------------------
MOVFF RX_B,POSTINC1 ;HOLEN -> (CNT+)
MOVLW 0x3F ;64 BYT <20>BERTRAGEN?
CPFSLT FSR1L ;NEIN ->SKIP
CLRF RX_STATUS ;JA FERTIG
RETFIE
;-------------------------------------------------------------------------------------
RX_ISR1
CPFSEQ RX_B ;BLOCK HEADER 0X82?
BRA RX_ISR2 ;NEIN->
MOVWF RX_STATUS ;STATUS SETZEN = EMPFANGENES BYT
LFSR 1,.0 ;BYT COUNTER AUF O
RETFIE
RX_ISR2
MOVLW REQ_RTCD_FROM_PIC ;DATEN SENDEN?
CPFSEQ RX_B ;SKIP WENN JA
BRA RX_ISR3 ;SONST NEXT
;BLOCK HEADER UND 64 BYT SENDEN -----------------------------------------
LFSR 0,.0
BCF PIR1,TXIF ;INTERRUPT FLAG L<>SCHEN
BSF PIE1,TXIE ;Enable interrupt
MOVLW RTCD_FROM_PIC
MOVWF TX_STATUS ;STATUS SETZEN
MOVWF TXREG ;BLOCK HEADER = 0X81
CLRF RX_STATUS ;STATUS R<>CKSETZEN
RETFIE ;UND WEG
;-------------------------------------------------------------------------------------
RX_ISR3
MOVLW EXT_SUB_GO ;EXT SUB FREIGEBEN?
CPFSEQ RX_B
BRA RX_ISR4 ;NEIN->
;EXT SUBS FREIGEBEN --------------------------------------------------------------
MOVLW (EXTERN_INT_ADR & 0xFF0000)>>16
MOVWF TBLPTRU
MOVLW (EXTERN_INT_ADR & 0x00FF00)>>8
MOVWF TBLPTRH
MOVLW (EXTERN_INT_ADR & 0x0000FF)
MOVWF TBLPTRL ;ADRESSE SETZEN
TBLRD* ;WERT HOLEN (MUSS 0xFB SEIN SONST UNG<4E>LTIG)
MOVFF TABLAT,GO_INT ;EXTERNE SUBROUTINES AKTIVIEREN WENN OK
MOVLW (EXTERN_SUB_ADR & 0xFF0000)>>16
MOVWF TBLPTRU
MOVLW (EXTERN_SUB_ADR & 0x00FF00)>>8
MOVWF TBLPTRH
MOVLW (EXTERN_SUB_ADR & 0x0000FF)
MOVWF TBLPTRL ;ADRESSE SETZEN
TBLRD* ;WERT HOLEN (MUSS 0xFB SEIN SONST UNG<4E>LTIG)
MOVFF TABLAT,GO_SUB ;EXTERNE SUBROUTINES AKTIVIEREN WENN OK
CLRF RX_STATUS ;STATUS R<>CKSETZEN
RETFIE ;UND WEG
;-------------------------------------------------------------------------------------
RX_ISR4
MOVLW EXT_SUB_STOP ;EXT SUB STOPPEN?
CPFSEQ RX_B
BRA RX_ISR5 ;NEIN->
;EXT SUBS STOPPEN --------------------------------------------------------------
CLRF GO_INT ;STOPPEN
CLRF GO_SUB ;STOPPEN
CLRF RX_STATUS ;STATUS R<>CKSETZEN
RETFIE ;UND WEG
;-------------------------------------------------------------------------------------
RX_ISR5
MOVLW REQ_BLOCK ;REQ BLOCK?
CPFSEQ RX_B
BRA RX_ISR6 ;NEIN->
;REQ BLOCK ----------------------------------------------------------------
MOVWF RX_STATUS ;STATUS SETZEN = EMPFANGENES BYT
LFSR 1,TX_BUFFER ;BYT COUNTER AUF TX_BUFFER -> GLEICH EINTRAGEN
RETFIE
RX_ISR6
CPFSEQ RX_STATUS ;REQ BLOCK ADRESSE EMPFANGFEN?
BRA RX_ISR7 ;NEIN->
;3 BYT EMPFANGEN -------------------------------------
MOVFF RX_B,POSTINC1 ;HOLEN -> (CNT+)
MOVLW 0x82 ;3 BYT <20>BERTRAGEN? (BUFFER BEGINNT BEI 0x180
CPFSLT FSR1L ;NEIN ->SKIP
BRA RX_RB3BOK
RETFIE
RX_RB3BOK
LFSR 1,TX_BUFFER ;BYT RX COUNTER AUF TX_BUFFER
MOVFF POSTINC1,TBLPTRU ;ADRESSE EINTRAGEN
MOVFF POSTINC1,TBLPTRH
MOVFF POSTINC1,TBLPTRL
MOVLW 0xC2 ;67 BYT <20>BERTRAGEN? (BUFFER BEGINNT BEI 0x180
RX_RB3B2
TBLRD *+ ;LESEN UND NEXT
MOVFF TABLAT,POSTINC1 ;UND EINTRAGEN
CPFSEQ FSR1L ;WENN FERTIG ->SKIP
BRA RX_RB3B2 ;SONST LOOP
;BLOCK HEADER 3 BYTS ADRESSE UND 64 BYT SENDEN STARTEN -----------------------------------------
LFSR 0,TX_BUFFER ;TX COUNTER AUF TX_BUFFER
BCF PIR1,TXIF ;INTERRUPT FLAG L<>SCHEN
BSF PIE1,TXIE ;Enable interrupt
MOVLW READ_BLOCK ;CODE HEADER 0xA1
MOVWF TX_STATUS ;STATUS SETZEN
MOVWF TXREG ;BLOCK HEADER = 0XA1
CLRF RX_STATUS ;STATUS R<>CKSETZEN
RETFIE ;UND WEG
;-------------------------------------------------------------------------------------
RX_ISR7
MOVLW WRITE_BLOCK ;WRITE BLOCK 0xA2 BYT EMPFANGEN?
CPFSEQ RX_STATUS ;WENN JA-> SKIP
BRA RX_ISR8 ;NEIN->
;WRITE BLOCK ----------------------------------------------------------------------------
;67 BYT EMPFANGEN -------------------------------------
MOVFF RX_B,POSTINC1 ;HOLEN -> (CNT+)
MOVLW 0x42 ;67 BYT <20>BERTRAGEN?
CPFSLT FSR1L ;WENN FERTIG ->SKIP
RETFIE
; ADRESSE UND DATEN SIND DA -> PROGRAMMING FLASH
LFSR 1,RX_BUFFER ;BYT COUNTER AUF RX BUFFER
MOVFF POSTINC1,TBLPTRU ;TABLE POINTER SETZEN
MOVLW (EXTERN_INT_ADR & 0xFF0000)>>16
CPFSLT TBLPTRU ;TEST OB WENIGER ALS ERLAUBT
BRA NO_PROG ;JA->
MOVFF POSTINC1,TBLPTRH ;TABLE POINTER SETZEN
MOVLW (EXTERN_INT_ADR & 0x00FF00)>>8
CPFSLT TBLPTRU ;TEST OB WENIGER ALS ERLAUBT
BRA NO_PROG ;JA->
MOVFF POSTINC1,TBLPTRL ;TABLE POINTER SETZEN
;EREASE BLOCK
BSF EECON1,EEPGD ; point to Flash program memory
BCF EECON1,CFGS ; access Flash program memory
BSF EECON1,WREN ; enable write to memory
BSF EECON1,FREE ; enable Row Erase operation
MOVLW 55h
MOVWF EECON2 ; write 55h
MOVLW 0AAh ; write 0AAh
MOVWF EECON2
BSF EECON1,WR ; start erase (CPU stall)
MOVLW 0x42 ;67 BYT
WRITE_WORD_TO_HREGS
MOVFF POSTINC1,TABLAT ; get byte of buffer data
TBLWT+* ; write data, perform a short write to internal TBLWT holding register.
CPFSLT FSR1L ;SCHON BEI 67 BYTES?
BRA WRITE_WORD_TO_HREGS ;NEIN->LOOP
PROGRAM_MEMORY
BSF EECON1,EEPGD ; point to Flash program memory
BCF EECON1,CFGS ; access Flash program memory
BSF EECON1,WREN ; enable write to memory
MOVLW 55h
MOVWF EECON2 ; write 55h
MOVLW 0AAh
MOVWF EECON2 ; write 0AAh
BSF EECON1,WR ; start program (CPU stall)
BCF EECON1,WREN ; disable write to memory
NO_PROG
CLRF RX_STATUS ;AUF NORMLA SCHALTEN
RETFIE ;UND FERTIG
;WRITE BLOCK SETZEN?
RX_ISR8
CPFSEQ RX_B ;BLOCK HEADER COMMANDOE 0XA2?
BRA RX_ISR9 ;NEIN->
MOVWF RX_STATUS ;STATUS SETZEN = EMPFANGENES BYT
LFSR 1,RX_BUFFER ;BYT COUNTER AUF RX BUFFER
RETFIE
;-------------------------------------------------------------------------------------
RX_ISR9
CLRF RX_STATUS
RETFIE
;-------------------------------------------------------------------------------------
;SYNC ABWARTEN UND WENN DA "OK!" SENDEN ----------------------------------------------------
;-------------------------------------------------------------------------------------
RX_SYNC_START
MOVLW SYNC1
CPFSEQ RX_STATUS
BRA RX_SYNC2
MOVLW SYNC1_DATA
CPFSEQ RX_B
BRA NON_SYNC
MOVLW SYNC2
MOVWF RX_STATUS
RETFIE
NON_SYNC
MOVLW SYNC1
MOVWF RX_STATUS
RETFIE
RX_SYNC2 ;TEST AUF SYNC UND DATA 2
MOVLW SYNC2
CPFSEQ RX_STATUS
BRA RX_SYNC3 ;NICHT SYNC 2
MOVLW SYNC2_DATA
CPFSEQ RX_B
BRA NON_SYNC
MOVLW SYNC3
MOVWF RX_STATUS
RETFIE
RX_SYNC3 ;TEST AUF SYNC UND DATA 3
MOVLW SYNC3
CPFSEQ RX_STATUS
BRA RX_SYNC4 ;NICHT SYNC 3
MOVLW SYNC3_DATA
CPFSEQ RX_B
BRA NON_SYNC
MOVLW SYNC4
MOVWF RX_STATUS
RETFIE
RX_SYNC4 ;TEST AUF SYNC UND DATA 4
MOVLW SYNC4
CPFSEQ RX_STATUS
BRA NON_SYNC ;WIEDER VON VORN
MOVLW SYNC4_DATA
CPFSEQ RX_B ;SKIP OK
BRA NON_SYNC ;NICHT SYNC4 DATA
RX_WAIT1
BTFSS TXSTA,TRMT
BRA RX_WAIT1
MOVLW 'O' ;SENDE OK!
MOVWF TXREG;
RX_WAIT2
BTFSS TXSTA,TRMT
BRA RX_WAIT2
MOVLW 'K' ;SENDE OK!
MOVWF TXREG;
RX_WAIT3
BTFSS TXSTA,TRMT
BRA RX_WAIT3
MOVLW '!'
MOVWF TXREG;
CLRF RX_STATUS ;OK START NORMAL
RETFIE
;**********************************************************************************************"""""""""""""
;SPANNUNGS<47>BERWACHUNGS INTERRUPT
HLVD_ISR
BTFSS U_ERR,1 ;WARTEN AUF GELADEN?
BRA HLVD_LE ;NEIN UNTERSPANNUNG DETEKT->
BCF U_ERR,0 ;SPANNUNGSFEHLER AUS
BCF U_ERR,1 ;WARTEN AUF GELADEN=AUS
MOVLW U_ERR_PW_AUS+2 ;POWER AUS <20>BERSPRINGEN
MOVWF U_ERR_TIME ;ZEIT SETZEN
MOVLW B'00010111' ;INT WENN UNTER 3.12V
MOVWF HLVDCON
WAIT_LVDOK:
BTFSS HLVDCON,IVRST ;ABWARTEN BIS AENDERUNG AKTIV
BRA WAIT_LVDOK
BCF PIR2,HLVDIF ;INTERRUPT FLAG L<>SCHEN
RETFIE
HLVD_LE ;UNTERSPANNUNG
BSF U_ERR,0 ;ERROR SETZEN
BSF U_ERR,1 ;WARTEN AUF GELADEN SETZEN
CLRF U_ERR_TIME ;R<>CKSETZEN
;MESSAGE AN PROCESSOR
MOVLW U_MIN_TO_MCF
MOVWF TXREG ;SENDEN
MOVLW B'10011010' ;INT WENN <20>BER 3.7V
MOVWF HLVDCON
BRA WAIT_LVDOK
;**********************************************************************************************"""""""""""""
;A/D INTERRUPT
AD_ISR
BCF PIR1,ADIF ;CLEAR INTERRUPT PENDIG
RETFIE ;RETURN
;*************************************************************************************************************
; uhr interrupt ALLE 1/8 SEC
RTC_ISR
;UHR WIEDER R<>CKSETZEN UND AKTIVIEREN
MOVLW TIMER_HB ;WIEDER AUF STARTWERT
MOVWF TMR1H ;SETZEN
BCF PIR1,TMR1IF ;INTERRUPT FLAG L<>SCHEN
BSF PORTB,RB4 ;PIC INT HIGH --------
BSF TRISE,RE0 ;LED=OFF
BCF PORTB,RB4 ;PIC INT = LOW
BTFSC TRISD,RD0 ;POWER OFF?
BRA POWER_OFF_I ;JA->
; POWER IS ON:
; BLINKEN 4X/SEC WENN RESET
BTFSC TRISD,RD7 ;RESET AKTIV?
BRA PINGS ;NEIN->
BTFSC TICKS,0 ;UNGERADE TICKS?
BCF TRISE,RE0 ;NEIN->LED=ON
BRA PINGS
POWER_OFF_I
MOVLW .3
ANDWF SECS,0 ;4 SEKUNDEN AUSMASKIEREN
BNZ PINGS ;NICHT MODULO4 ->
MOVLW .7
CPFSEQ TICKS ;7. TICK?
BRA POWER_OFF_I2 ;NEIN->
BCF TRISE,RE0 ;JA->LED=ON
POWER_OFF_I2
MOVLW .30 ; WENIGER ALS 30 SEC SEIT LETZTEM SPANNUNGSFEHLER?
CPFSLT U_ERR_TIME
BRA PINGS ;NEIN->
MOVLW .5
CPFSEQ TICKS ;5. TICK?
BRA PINGS ;NEIN->
BCF TRISE,RE0 ;JA->LED=ON
PINGS
CALL TASTE ;UP TASTE
; TASTE LOSGELASSEN?
MOVLW RESET_OFF_TIME
CPFSGT TASTE_OFF_TIME ;TASTE L<>NGER ALS 2 SEC LOSGELASSEN?
BRA PINGW ;NEIN->
BSF TRISD,RD7 ;JA-> #RSTI INAKTIV =HIGH
BTFSS TRISD,RD0 ;POWER ON?
CALL SERIAL_ON ;ja->SERIELL EINSCHALTEN
;--TICKS=125MS
PINGW
INCF TICKS ;inc ticks
BTFSS TRISD,RD0 ;POWER ON?
BRA PINGS2 ;JA->
MOVLW 20
CPFSLT U_POWER_IN ;LADEGER<45>T ANGESCHLOSSEN?
BRA PINGS2 ;->JA LED HELLER
MOVLW TIME_MAX ;>=MAXIMALZEIT?
CPFSLT U_ERR_TIME ;SEIT SPANNUNGSFEHLER
BSF TRISE,RE0 ;JA -> LED OFF
PINGS2
MOVLW .7 ; 7?
CPFSGT TICKS
RETFIE ; NEIN ->RETURN
SEKUNDEN
;led blinken POWER ON-----------------------------------------
BTFSS TRISD,RD0 ;POWER ON?
BCF TRISE,RE0 ;JA -> LED_ON
;TIMER U_ERR ERH<52>HEN
MOVLW TIME_MAX ;>=MAXIMALZEIT?
CPFSGT U_ERR_TIME ;SEIT SPANNUNGSFEHLER
INCF U_ERR_TIME ;NEIN ERH<52>HEN
;SPANNUNGSFEHLER BEARBEITEN ----------------------------------------
MOVLW U_ERR_PW_AUS ;POWER AUS ZEIT?
CPFSEQ U_ERR_TIME ;
BRA SEK_NPA ;NEIN
CALL POWER_AUS ;JA AUSSCHALTEN
;--------------------------------------------------------
SEK_NPA
;SPANNUNG POWER IN MESSEN
MOVLW B'00000001' ;KANAL 0, AD ON
MOVWF ADCON0 ;
BSF ADCON0,1 ;GO
SEK_2
BTFSC ADCON0,1 ;FERTIG?
BRA SEK_2 ;NEIN
MOVFF ADRESH,U_POWER_IN ;OK WERT EINTRAGEN
;SPANNUNG 2V5 MESSEN -> U_ERR TIMER NICHT ERH<52>HEN WENN <20>BER 3.2V RESP. WIEDER -1
BTFSC TRISD,RD0 ;POWER ON?
BRA SEK_4 ;NEIN NICHT MESSEN
MOVLW B'00001101' ;KANAL 3, AD ON
MOVWF ADCON0 ;
BSF ADCON0,1 ;GO
SEK_3
BTFSC ADCON0,1 ;FERTIG?
BRA SEK_3 ;NEIN
MOVLW .200 ;UNTER 3.2V -> WENN WERT <20>BER 78%
CPFSLT ADRESH ;JA ->
BRA SEK_4 ;SONST WEITER
;TIMER U_ERR ERH<52>HEN
BTFSS U_ERR,0 ;SPANNUNGSERROR?
BRA SEK_4 ;NEIN
MOVLW TIME_MAX ;>=MAXIMALZEIT?
CPFSGT U_ERR_TIME ;SEIT SPANNUNGSFEHLER
DECF U_ERR_TIME ;NEIN -> -1
;-------------------------------------------------------------
SEK_4
CLRF TICKS
INCF SECS ; Increment seconds
MOVLW .59 ; 60 seconds elapsed?
CPFSGT SECS
RETFIE ;RETURN
MINUTEN
CLRF SECS ; Clear seconds
INCF MINS ; Increment minutes
MOVLW .59 ; 60 minutes elapsed?
CPFSGT MINS
RETFIE ;RETURN
STUNDEN
CLRF MINS ; clear minutes
INCF HOURS ; Increment hours
MOVLW .23 ; 24 hours elapsed?
CPFSGT HOURS
RETFIE ;RETURN
TAGE_UND_TAG_DER_WOCHE
CLRF HOURS ; Reset hours
MOVLW .7
CPFSLT DAY_OF_WEEK
CLRF DAY_OF_WEEK
INCF DAY_OF_WEEK
INCF DAYS
MOVLW .28
CPFSGT DAYS
RETFIE ;RETURN
MEHR_ALS_28_TAGE
MOVLW .2
CPFSEQ MONTHS ;FEB?
BRA NOT_FEB ;NEIN->
FEB
MOVLW .3
ANDWF YEARS,0 ;SCHALTJAHR
BNZ NEXT_MONTH ;NEIN->
SCHALTJAHR
MOVLW .29
CPFSGT DAYS
RETFIE ;RETURN
NEXT_MONTH
MOVLW .1
MOVWF DAYS
INCF MONTHS
MOVLW 12
CPFSGT MONTHS
RETFIE ;RETURN
YEAR
MOVLW .1
MOVWF MONTHS
INCF YEARS
RETFIE ;RETURN
NOT_FEB
MOVLW .30
CPFSGT DAYS
RETFIE
MEHR_ALS_30_TAGE
MOVLW .4 ;APRIL?
CPFSEQ MONTHS ;SKIP
BRA NOT_APRIL
BRA NEXT_MONTH ;APRIL->
NOT_APRIL
MOVLW .6 ;JUNI?
CPFSEQ MONTHS
BRA NOT_JUNI
BRA NEXT_MONTH ;JUNI->
NOT_JUNI
MOVLW .9 ;SEPTEMBER?
CPFSEQ MONTHS
BRA NOT_SEP
BRA NEXT_MONTH ;SEPTEMBER->
NOT_SEP
MOVLW .11 ;NOVEMBER?
CPFSEQ MONTHS ;SKIP
RETFIE ;SIND MONATE MIT 31 TAGEN->
BRA NEXT_MONTH ;SONST NOVEMBER->
;**********************************************************************************************"""""""""""""
; ENDE MAIN
;**********************************************************************************************"""""""""""""
;**********************************************************************************************"""""""""""""
; EXTERN_SUBOUTINES FOGEN AB 0x1000 DIE SP<53>TER EINPROGRAMMIERT WERDEN
;**********************************************************************************************"""""""""""""
end

Binary file not shown.

View File

@@ -0,0 +1,82 @@
:020000040000FA
:020000007FD0AF
:020002000000FC
:040008000CEF00F009
:08001800E06A9DCF4EF09E50FE
:100020004E174EB115D24EBD11D24EB918D14EBB9E
:100030002BD1A0CF4FF0A1504F174FB5F3D11000E7
:100040009DCF4EF09E504E174E67E6D7A0CF4FF093
:10005000A1504F174F67E0D7FB0E4D63100001EF23
:0200600010F09E
:10010000E06AF26AD06A9D6AA06A9E6AA16A9F6AE2
:10011000A26A9B6A720ED36E806AFF0E926E816A2B
:10012000936E826A946E836A956E010E846A966EEF
:100130009B0ED26E030E466F140E476FA084E9EC3F
:1001400000F0F00ECF6ECE6A0F0ECD6E416B006BDD
:10015000026B0C0E046F010E066F010E076F080E86
:10016000086F2A0E096F426B436B446B9D80456B91
:10017000C26A090EC16E000EC06E486BB06A100EE6
:10018000AF6E040EAC6E900EAB6E080EB86E4C6B7C
:10019000F06AF00EF16EC00EF26E120ED36EFB0E10
:1001A0004C6302D0D7ED00F095B00300F8D709EC0E
:1001B00010F01300720ED36E929E959E93989590B8
:1001C0000AD0120ED36E9580958E9388928E446BD2
:1001D00004D095B002D09298120092881200AC9A86
:1001E0009D9A9E9A9D989E981200ACBA1200AC8A75
:1001F000FF0E4A6F4B6BAECF49F0AECF49F09E98E1
:100200009E9A9D8A0000120083A20BD0426BA00E22
:100210004365432B040E44651200958EF5EC00F007
:100220001200150E4261120095B00ED0020E42630C
:1002300003D0020EAD6E0CD0020E42610CD0140E33
:100240004261E1EC00F004D0020E4261DAEC00F011
:10025000436B422B1200959EEFEC00F0F0D7810E1D
:100260004B6309D0EECFADFF3F0EE96410004B6B3E
:100270009D989E981000A10E4B6305D0EECFADFF68
:10028000C30EE9641000F3D7AECF49F0FC0E4A610B
:1002900097D0820E4A6306D049C0E6FF3F0EE16068
:1002A0004A6B1000496304D04A6F10EE00F0100052
:1002B000010E496309D000EE00F09E989D88810EE2
:1002C0004B6FAD6E4A6B1000040E496314D0000EE4
:1002D000F86E200EF76E000EF66E0800F5CF4DF0AA
:1002E000000EF86E200EF76E100EF66E0800F5CFB9
:1002F0004CF04A6B1000050E496304D04D6B4C6BFB
:100300004A6B1000A00E496304D04A6F11EE80F0D2
:1003100010004A631DD049C0E6FF820EE16001D0A3
:10032000100011EE80F0E6CFF8FFE6CFF7FFE6CF42
:10033000F6FFC20E0900F5CFE6FFE162FBD701EE42
:1003400080F09E989D88A10E4B6FAD6E4A6B100099
:10035000A20E4A632DD049C0E6FF420EE1601000B4
:1003600011EE00F0E6CFF8FF000EF8601FD0E6CFE8
:10037000F7FF200EF8601AD0E6CFF6FFA68EA69CF7
:10038000A684A688550EA76EAA0EA76EA682420E58
:10039000E6CFF5FF0F00E160FBD7A68EA69CA684F2
:1003A000550EA76EAA0EA76EA682A6944A6B1000E1
:1003B000496304D04A6F11EE00F010004A6B100040
:1003C000FF0E4A6309D0410E496303D0FE0E4A6F07
:1003D0001000FF0E4A6F1000FE0E4A6306D0430E57
:1003E0004963F7D7FD0E4A6F1000FD0E4A6306D031
:1003F000500E4963EED7FC0E4A6F1000FC0E4A63A4
:10040000E8D7460E4963E5D7ACA2FED74F0EAD6ED6
:10041000ACA2FED74B0EAD6EACA2FED7210EAD6ED8
:100420004A6B100046A30AD046914693070E476FC9
:10043000170ED26ED2AAFED7A19410004681468331
:10044000476B030EAD6E9A0ED26EF4D79E9C1000D1
:10045000F00ECF6E9E9081889680819895B005D0E1
:1004600095BE11D041B196900ED0030E00150BE150
:10047000070E416301D096901E0E476104D0050E11
:10048000416301D0969004EC01F0040E436504D062
:10049000958E95A0F5EC00F0412B95A006D0200E8E
:1004A000486103D0A00E47619680070E4165100099
:1004B00095A09690A00E4765472B050E476302D086
:1004C000E1EC00F0010EC26EC282C2B2FED7C4CF10
:1004D00048F095B00DD00D0EC26EC282C2B2FED7EA
:1004E000C80EC46005D046A103D0A00E47654707DB
:1004F000416B002B3B0E00651000006B022B3B0E86
:1005000002651000026B042B170E04651000046BCB
:10051000070E0661066B062B072B1C0E07651000E5
:10052000020E086310D0030E091503E11D0E0765C6
:100530001000010E076F082B120E08651000010E47
:10054000086F092B10001E0E07651000040E0863CB
:1005500001D0EFD7060E086301D0EBD7090E086370
:0C05600001D0E7D70B0E08631000E3D7B2
:00000001FF

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,188 @@
MPLINK 4.35, Linker
Linker Map File - Created Fri Oct 01 13:06:43 2010
Section Info
Section Type Address Location Size(Bytes)
--------- --------- --------- --------- ---------
Reset_Vector code 0x000000 program 0x000002
.cinit romdata 0x000002 program 0x000002
HIGH_INT_VEC code 0x000008 program 0x000004
LOW_INT_VEC code 0x000018 program 0x00004a
.code code 0x000100 program 0x00046c
Program Memory Usage
Start End
--------- ---------
0x000000 0x000003
0x000008 0x00000b
0x000018 0x000061
0x000100 0x00056b
1214 out of 33048 program addresses used, program memory utilization is 3%
Symbols - Sorted by Name
Name Address Location Storage File
--------- --------- --------- --------- ---------
AD_ISR 0x00044c program static C:\FireBee\MLAB\firebee1\firebee1.asm
FEB 0x000526 program static C:\FireBee\MLAB\firebee1\firebee1.asm
HLVD_ISR 0x000424 program static C:\FireBee\MLAB\firebee1\firebee1.asm
HLVD_LE 0x00043c program static C:\FireBee\MLAB\firebee1\firebee1.asm
INT_HANDLER 0x000018 program static C:\FireBee\MLAB\firebee1\firebee1.asm
KALT_START 0x000100 program static C:\FireBee\MLAB\firebee1\firebee1.asm
LADESTROM 0x0001d2 program static C:\FireBee\MLAB\firebee1\firebee1.asm
LS_OFF_POWER 0x0001da program static C:\FireBee\MLAB\firebee1\firebee1.asm
LS_ON_POWER 0x0001d6 program static C:\FireBee\MLAB\firebee1\firebee1.asm
MAIN 0x00019e program static C:\FireBee\MLAB\firebee1\firebee1.asm
MAIN2 0x0001ae program static C:\FireBee\MLAB\firebee1\firebee1.asm
MEHR_ALS_28_TAGE 0x000520 program static C:\FireBee\MLAB\firebee1\firebee1.asm
MEHR_ALS_30_TAGE 0x00054c program static C:\FireBee\MLAB\firebee1\firebee1.asm
MINUTEN 0x0004fa program static C:\FireBee\MLAB\firebee1\firebee1.asm
NEXT_MONTH 0x000532 program static C:\FireBee\MLAB\firebee1\firebee1.asm
NON_SYNC 0x0003d2 program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_APRIL 0x000554 program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_FEB 0x000546 program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_JUNI 0x00055c program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_SEP 0x000564 program static C:\FireBee\MLAB\firebee1\firebee1.asm
NO_PROG 0x0003ac program static C:\FireBee\MLAB\firebee1\firebee1.asm
PINGS 0x000486 program static C:\FireBee\MLAB\firebee1\firebee1.asm
PINGS2 0x0004aa program static C:\FireBee\MLAB\firebee1\firebee1.asm
PINGW 0x000498 program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_AUS 0x0001c2 program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_EIN 0x0001b4 program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_OFF_I 0x00046a program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_OFF_I2 0x000478 program static C:\FireBee\MLAB\firebee1\firebee1.asm
PROGRAM_MEMORY 0x00039a program static C:\FireBee\MLAB\firebee1\firebee1.asm
RESETEN 0x000256 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RTC_ISR 0x000450 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR 0x000288 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR1 0x0002a4 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR2 0x0002b0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR3 0x0002c8 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR4 0x0002f6 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR5 0x000304 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR6 0x000312 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR7 0x000350 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR8 0x0003b0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR9 0x0003bc program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_RB3B2 0x000334 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_RB3BOK 0x000322 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC2 0x0003d8 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC3 0x0003ea program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC4 0x0003fc program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC_START 0x0003c0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_WAIT1 0x000408 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_WAIT2 0x000410 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_WAIT3 0x000418 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SCHALTJAHR 0x00052c program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEKUNDEN 0x0004b0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_2 0x0004ca program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_3 0x0004dc program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_4 0x0004f0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_NPA 0x0004c4 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEND_RTC_REG 0x000232 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SERIAL_OFF 0x0001de program static C:\FireBee\MLAB\firebee1\firebee1.asm
SERIAL_ON 0x0001ea program static C:\FireBee\MLAB\firebee1\firebee1.asm
STUNDEN 0x000504 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TAGE_UND_TAG_DER_WOCHE 0x00050e program static C:\FireBee\MLAB\firebee1\firebee1.asm
TASTE 0x000208 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_END 0x000250 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_JA 0x000222 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_OFF_POWER 0x000248 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_ON_POWER 0x00022c program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_ON_POWER2 0x000238 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_ON_POWER3 0x00023e program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR 0x00025e program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR1 0x000276 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR2 0x000286 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR_FERTIG 0x00026e program static C:\FireBee\MLAB\firebee1\firebee1.asm
WAIT_LVDOK 0x000434 program static C:\FireBee\MLAB\firebee1\firebee1.asm
WARTEN 0x0001a8 program static C:\FireBee\MLAB\firebee1\firebee1.asm
WRITE_WORD_TO_HREGS 0x000390 program static C:\FireBee\MLAB\firebee1\firebee1.asm
YEAR 0x00053e program static C:\FireBee\MLAB\firebee1\firebee1.asm
Symbols - Sorted by Address
Name Address Location Storage File
--------- --------- --------- --------- ---------
INT_HANDLER 0x000018 program static C:\FireBee\MLAB\firebee1\firebee1.asm
KALT_START 0x000100 program static C:\FireBee\MLAB\firebee1\firebee1.asm
MAIN 0x00019e program static C:\FireBee\MLAB\firebee1\firebee1.asm
WARTEN 0x0001a8 program static C:\FireBee\MLAB\firebee1\firebee1.asm
MAIN2 0x0001ae program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_EIN 0x0001b4 program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_AUS 0x0001c2 program static C:\FireBee\MLAB\firebee1\firebee1.asm
LADESTROM 0x0001d2 program static C:\FireBee\MLAB\firebee1\firebee1.asm
LS_ON_POWER 0x0001d6 program static C:\FireBee\MLAB\firebee1\firebee1.asm
LS_OFF_POWER 0x0001da program static C:\FireBee\MLAB\firebee1\firebee1.asm
SERIAL_OFF 0x0001de program static C:\FireBee\MLAB\firebee1\firebee1.asm
SERIAL_ON 0x0001ea program static C:\FireBee\MLAB\firebee1\firebee1.asm
TASTE 0x000208 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_JA 0x000222 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_ON_POWER 0x00022c program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEND_RTC_REG 0x000232 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_ON_POWER2 0x000238 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_ON_POWER3 0x00023e program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_OFF_POWER 0x000248 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TG_END 0x000250 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RESETEN 0x000256 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR 0x00025e program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR_FERTIG 0x00026e program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR1 0x000276 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TX_ISR2 0x000286 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR 0x000288 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR1 0x0002a4 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR2 0x0002b0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR3 0x0002c8 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR4 0x0002f6 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR5 0x000304 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR6 0x000312 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_RB3BOK 0x000322 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_RB3B2 0x000334 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR7 0x000350 program static C:\FireBee\MLAB\firebee1\firebee1.asm
WRITE_WORD_TO_HREGS 0x000390 program static C:\FireBee\MLAB\firebee1\firebee1.asm
PROGRAM_MEMORY 0x00039a program static C:\FireBee\MLAB\firebee1\firebee1.asm
NO_PROG 0x0003ac program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR8 0x0003b0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_ISR9 0x0003bc program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC_START 0x0003c0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
NON_SYNC 0x0003d2 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC2 0x0003d8 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC3 0x0003ea program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_SYNC4 0x0003fc program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_WAIT1 0x000408 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_WAIT2 0x000410 program static C:\FireBee\MLAB\firebee1\firebee1.asm
RX_WAIT3 0x000418 program static C:\FireBee\MLAB\firebee1\firebee1.asm
HLVD_ISR 0x000424 program static C:\FireBee\MLAB\firebee1\firebee1.asm
WAIT_LVDOK 0x000434 program static C:\FireBee\MLAB\firebee1\firebee1.asm
HLVD_LE 0x00043c program static C:\FireBee\MLAB\firebee1\firebee1.asm
AD_ISR 0x00044c program static C:\FireBee\MLAB\firebee1\firebee1.asm
RTC_ISR 0x000450 program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_OFF_I 0x00046a program static C:\FireBee\MLAB\firebee1\firebee1.asm
POWER_OFF_I2 0x000478 program static C:\FireBee\MLAB\firebee1\firebee1.asm
PINGS 0x000486 program static C:\FireBee\MLAB\firebee1\firebee1.asm
PINGW 0x000498 program static C:\FireBee\MLAB\firebee1\firebee1.asm
PINGS2 0x0004aa program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEKUNDEN 0x0004b0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_NPA 0x0004c4 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_2 0x0004ca program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_3 0x0004dc program static C:\FireBee\MLAB\firebee1\firebee1.asm
SEK_4 0x0004f0 program static C:\FireBee\MLAB\firebee1\firebee1.asm
MINUTEN 0x0004fa program static C:\FireBee\MLAB\firebee1\firebee1.asm
STUNDEN 0x000504 program static C:\FireBee\MLAB\firebee1\firebee1.asm
TAGE_UND_TAG_DER_WOCHE 0x00050e program static C:\FireBee\MLAB\firebee1\firebee1.asm
MEHR_ALS_28_TAGE 0x000520 program static C:\FireBee\MLAB\firebee1\firebee1.asm
FEB 0x000526 program static C:\FireBee\MLAB\firebee1\firebee1.asm
SCHALTJAHR 0x00052c program static C:\FireBee\MLAB\firebee1\firebee1.asm
NEXT_MONTH 0x000532 program static C:\FireBee\MLAB\firebee1\firebee1.asm
YEAR 0x00053e program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_FEB 0x000546 program static C:\FireBee\MLAB\firebee1\firebee1.asm
MEHR_ALS_30_TAGE 0x00054c program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_APRIL 0x000554 program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_JUNI 0x00055c program static C:\FireBee\MLAB\firebee1\firebee1.asm
NOT_SEP 0x000564 program static C:\FireBee\MLAB\firebee1\firebee1.asm

View File

@@ -0,0 +1,53 @@
[HEADER]
magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13}
file_version=1.0
device=PIC18F4520
[PATH_INFO]
BuildDirPolicy=BuildDirIsProjectDir
dir_src=
dir_bin=
dir_tmp=
dir_sin=
dir_inc=
dir_lib=
dir_lkr=
[CAT_FILTERS]
filter_src=*.asm
filter_inc=*.h;*.inc
filter_obj=*.o
filter_lib=*.lib
filter_lkr=*.lkr
[CAT_SUBFOLDERS]
subfolder_src=
subfolder_inc=
subfolder_obj=
subfolder_lib=
subfolder_lkr=
[FILE_SUBFOLDERS]
file_000=.
file_001=.
[GENERATED_FILES]
file_000=no
file_001=no
[OTHER_FILES]
file_000=no
file_001=no
[FILE_INFO]
file_000=firebee1.asm
file_001=C:\Program Files (x86)\Microchip\MPASM Suite\LKR\18f4520_g.lkr
[SUITE_INFO]
suite_guid={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484}
suite_state=
[TOOL_SETTINGS]
TS{DD2213A8-6310-47B1-8376-9430CDFC013F}=
TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/o"$(BINDIR_)$(TARGETBASE).cof" /M"$(BINDIR_)$(TARGETBASE).map" /W
TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}=
[INSTRUMENTED_TRACE]
enable=0
transport=0
format=0
[CUSTOM_BUILD]
Pre-Build=
Pre-BuildEnabled=1
Post-Build=
Post-BuildEnabled=1

View File

@@ -0,0 +1,71 @@
[Header]
MagicCookie={0b13fe8c-dfe0-40eb-8900-6712719559a7}
Version=1.0
[File000]
Location=C:\FireBee\MLAB\firebee1\firebee1.o
Folder=Intermediary
DeviceName=PIC18F4520
LanguageToolSuiteID={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484}
LanguageToolID={49D3CA3F-D9A3-4518-9943-226A347E8CC7}
LanguageToolLocation=C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe
PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)||$(INCDIR)||$(LIBDIR)||$(LKRDIR)||
SOLK=<src>|firebee1.asm||<obj>||<lib>||<lkr>|C:\Program Files (x86)\Microchip\MPASM Suite\LKR\18f4520_g.lkr||
SuiteArgsString=
ToolArgsString=
TraceCmdString=
DebugOptions=
[File001]
Location=C:\FireBee\MLAB\firebee1\firebee1.err
Folder=Intermediary
DeviceName=PIC18F4520
LanguageToolSuiteID={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484}
LanguageToolID={49D3CA3F-D9A3-4518-9943-226A347E8CC7}
LanguageToolLocation=C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe
PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)||$(INCDIR)||$(LIBDIR)||$(LKRDIR)||
SOLK=<src>|firebee1.asm||<obj>||<lib>||<lkr>|C:\Program Files (x86)\Microchip\MPASM Suite\LKR\18f4520_g.lkr||
SuiteArgsString=
ToolArgsString=
TraceCmdString=
DebugOptions=
[File002]
Location=C:\FireBee\MLAB\firebee1\firebee1.lst
Folder=Output
DeviceName=PIC18F4520
LanguageToolSuiteID={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484}
LanguageToolID={49D3CA3F-D9A3-4518-9943-226A347E8CC7}
LanguageToolLocation=C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe
PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)||$(INCDIR)||$(LIBDIR)||$(LKRDIR)||
SOLK=<src>|firebee1.asm||<obj>||<lib>||<lkr>|C:\Program Files (x86)\Microchip\MPASM Suite\LKR\18f4520_g.lkr||
SuiteArgsString=
ToolArgsString=
TraceCmdString=
DebugOptions=
[File003]
Location=C:\FireBee\MLAB\firebee1\firebee1.cof
Folder=Output
DeviceName=PIC18F4520
LanguageToolSuiteID={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484}
LanguageToolID={96C98149-AA1B-4CF9-B967-FAE79CAB663C}
LanguageToolLocation=C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe
PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)||$(INCDIR)||$(LIBDIR)||$(LKRDIR)||
SOLK=<src>|firebee1.asm||<obj>||<lib>||<lkr>|C:\Program Files (x86)\Microchip\MPASM Suite\LKR\18f4520_g.lkr||
SuiteArgsString=
ToolArgsString=/o"$(BINDIR_)$(TARGETBASE).cof" /M"$(BINDIR_)$(TARGETBASE).map" /W
TraceCmdString=
DebugOptions=
[File004]
Location=C:\FireBee\MLAB\firebee1\firebee1.hex
Folder=Output
DeviceName=PIC18F4520
LanguageToolSuiteID={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484}
LanguageToolID={96C98149-AA1B-4CF9-B967-FAE79CAB663C}
LanguageToolLocation=C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe
PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)||$(INCDIR)||$(LIBDIR)||$(LKRDIR)||
SOLK=<src>|firebee1.asm||<obj>||<lib>||<lkr>|C:\Program Files (x86)\Microchip\MPASM Suite\LKR\18f4520_g.lkr||
SuiteArgsString=
ToolArgsString=/o"$(BINDIR_)$(TARGETBASE).cof" /M"$(BINDIR_)$(TARGETBASE).map" /W
TraceCmdString=
DebugOptions=
[TOOL_LOC_STAMPS]
tool_loc{49D3CA3F-D9A3-4518-9943-226A347E8CC7}=C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe
tool_loc{96C98149-AA1B-4CF9-B967-FAE79CAB663C}=C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe

Binary file not shown.

View File

@@ -0,0 +1,156 @@
MPLINK 4.33, Linker
Linker Map File - Created Mon Jan 11 14:35:58 2010
Section Info
Section Type Address Location Size(Bytes)
--------- --------- --------- --------- ---------
Reset_Vector code 0x000000 program 0x000004
.cinit romdata 0x000004 program 0x000002
LOW_INT_VEC code 0x000018 program 0x00004a
.code code 0x000100 program 0x00033c
Program Memory Usage
Start End
--------- ---------
0x000000 0x000005
0x000018 0x000061
0x000100 0x00043b
908 out of 33048 program addresses used, program memory utilization is 2%
Symbols - Sorted by Name
Name Address Location Storage File
--------- --------- --------- --------- ---------
AD_ISR 0x000326 program static C:\firebee\MLAB\firebee1\firebee1.asm
FEB 0x0003ee program static C:\firebee\MLAB\firebee1\firebee1.asm
HLVD_ISR 0x000300 program static C:\firebee\MLAB\firebee1\firebee1.asm
HLVD_LE 0x00031a program static C:\firebee\MLAB\firebee1\firebee1.asm
INT_HANDLER 0x00001e program static C:\firebee\MLAB\firebee1\firebee1.asm
INT_HANDLER2 0x00002e program static C:\firebee\MLAB\firebee1\firebee1.asm
KALT_START 0x000100 program static C:\firebee\MLAB\firebee1\firebee1.asm
LADESTROM 0x0001d2 program static C:\firebee\MLAB\firebee1\firebee1.asm
LS_OFF_POWER 0x0001de program static C:\firebee\MLAB\firebee1\firebee1.asm
LS_ON_POWER 0x0001d8 program static C:\firebee\MLAB\firebee1\firebee1.asm
MAIN 0x00019e program static C:\firebee\MLAB\firebee1\firebee1.asm
MEHR_ALS_28_TAGE 0x0003e6 program static C:\firebee\MLAB\firebee1\firebee1.asm
MEHR_ALS_30_TAGE 0x000414 program static C:\firebee\MLAB\firebee1\firebee1.asm
MINUTEN 0x0003c0 program static C:\firebee\MLAB\firebee1\firebee1.asm
NEXT_MONTH 0x0003fa program static C:\firebee\MLAB\firebee1\firebee1.asm
NON_SYNC 0x0002ae program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_APRIL 0x00041e program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_FEB 0x00040e program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_JUNI 0x000428 program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_SEP 0x000432 program static C:\firebee\MLAB\firebee1\firebee1.asm
PINGS 0x000368 program static C:\firebee\MLAB\firebee1\firebee1.asm
PINGS2 0x000380 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_AUS 0x0001c0 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_EIN 0x0001a6 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_OFF_I 0x000346 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_OFF_I2 0x000356 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_ISR 0x000256 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_ISR1 0x000268 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_ISR2 0x000274 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_RFM 0x000290 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_RRFP 0x000280 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC2 0x0002b4 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC3 0x0002c6 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC4 0x0002d8 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC_START 0x00029c program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_UNBEK 0x00027c program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_WAIT1 0x0002e4 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_WAIT2 0x0002ec program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_WAIT3 0x0002f4 program static C:\firebee\MLAB\firebee1\firebee1.asm
RESETEN 0x000232 program static C:\firebee\MLAB\firebee1\firebee1.asm
RTC_ISR 0x000326 program static C:\firebee\MLAB\firebee1\firebee1.asm
SCHALTJAHR 0x0003f4 program static C:\firebee\MLAB\firebee1\firebee1.asm
SEKUNDEN 0x000386 program static C:\firebee\MLAB\firebee1\firebee1.asm
SEK_2 0x0003ac program static C:\firebee\MLAB\firebee1\firebee1.asm
SEK_NPA 0x00039c program static C:\firebee\MLAB\firebee1\firebee1.asm
SEND_RTC_REG 0x00020c program static C:\firebee\MLAB\firebee1\firebee1.asm
STUNDEN 0x0003ca program static C:\firebee\MLAB\firebee1\firebee1.asm
TAGE_UND_TAG_DER_WOCHE 0x0003d4 program static C:\firebee\MLAB\firebee1\firebee1.asm
TASTE 0x0001e4 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_END 0x00022c program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_JA 0x0001fa program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_OFF_POWER 0x000224 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_ON_POWER 0x000206 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_ON_POWER2 0x000212 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_ON_POWER3 0x000218 program static C:\firebee\MLAB\firebee1\firebee1.asm
TX_ISR 0x00023c program static C:\firebee\MLAB\firebee1\firebee1.asm
TX_ISR1 0x000254 program static C:\firebee\MLAB\firebee1\firebee1.asm
TX_ISR_FERTIG 0x00024c program static C:\firebee\MLAB\firebee1\firebee1.asm
WAIT_LVDOK 0x000312 program static C:\firebee\MLAB\firebee1\firebee1.asm
WARTEN 0x0001a0 program static C:\firebee\MLAB\firebee1\firebee1.asm
YEAR 0x000406 program static C:\firebee\MLAB\firebee1\firebee1.asm
Symbols - Sorted by Address
Name Address Location Storage File
--------- --------- --------- --------- ---------
INT_HANDLER 0x00001e program static C:\firebee\MLAB\firebee1\firebee1.asm
INT_HANDLER2 0x00002e program static C:\firebee\MLAB\firebee1\firebee1.asm
KALT_START 0x000100 program static C:\firebee\MLAB\firebee1\firebee1.asm
MAIN 0x00019e program static C:\firebee\MLAB\firebee1\firebee1.asm
WARTEN 0x0001a0 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_EIN 0x0001a6 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_AUS 0x0001c0 program static C:\firebee\MLAB\firebee1\firebee1.asm
LADESTROM 0x0001d2 program static C:\firebee\MLAB\firebee1\firebee1.asm
LS_ON_POWER 0x0001d8 program static C:\firebee\MLAB\firebee1\firebee1.asm
LS_OFF_POWER 0x0001de program static C:\firebee\MLAB\firebee1\firebee1.asm
TASTE 0x0001e4 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_JA 0x0001fa program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_ON_POWER 0x000206 program static C:\firebee\MLAB\firebee1\firebee1.asm
SEND_RTC_REG 0x00020c program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_ON_POWER2 0x000212 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_ON_POWER3 0x000218 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_OFF_POWER 0x000224 program static C:\firebee\MLAB\firebee1\firebee1.asm
TG_END 0x00022c program static C:\firebee\MLAB\firebee1\firebee1.asm
RESETEN 0x000232 program static C:\firebee\MLAB\firebee1\firebee1.asm
TX_ISR 0x00023c program static C:\firebee\MLAB\firebee1\firebee1.asm
TX_ISR_FERTIG 0x00024c program static C:\firebee\MLAB\firebee1\firebee1.asm
TX_ISR1 0x000254 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_ISR 0x000256 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_ISR1 0x000268 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_ISR2 0x000274 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_UNBEK 0x00027c program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_RRFP 0x000280 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_RFM 0x000290 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC_START 0x00029c program static C:\firebee\MLAB\firebee1\firebee1.asm
NON_SYNC 0x0002ae program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC2 0x0002b4 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC3 0x0002c6 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_SYNC4 0x0002d8 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_WAIT1 0x0002e4 program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_WAIT2 0x0002ec program static C:\firebee\MLAB\firebee1\firebee1.asm
RC_WAIT3 0x0002f4 program static C:\firebee\MLAB\firebee1\firebee1.asm
HLVD_ISR 0x000300 program static C:\firebee\MLAB\firebee1\firebee1.asm
WAIT_LVDOK 0x000312 program static C:\firebee\MLAB\firebee1\firebee1.asm
HLVD_LE 0x00031a program static C:\firebee\MLAB\firebee1\firebee1.asm
RTC_ISR 0x000326 program static C:\firebee\MLAB\firebee1\firebee1.asm
AD_ISR 0x000326 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_OFF_I 0x000346 program static C:\firebee\MLAB\firebee1\firebee1.asm
POWER_OFF_I2 0x000356 program static C:\firebee\MLAB\firebee1\firebee1.asm
PINGS 0x000368 program static C:\firebee\MLAB\firebee1\firebee1.asm
PINGS2 0x000380 program static C:\firebee\MLAB\firebee1\firebee1.asm
SEKUNDEN 0x000386 program static C:\firebee\MLAB\firebee1\firebee1.asm
SEK_NPA 0x00039c program static C:\firebee\MLAB\firebee1\firebee1.asm
SEK_2 0x0003ac program static C:\firebee\MLAB\firebee1\firebee1.asm
MINUTEN 0x0003c0 program static C:\firebee\MLAB\firebee1\firebee1.asm
STUNDEN 0x0003ca program static C:\firebee\MLAB\firebee1\firebee1.asm
TAGE_UND_TAG_DER_WOCHE 0x0003d4 program static C:\firebee\MLAB\firebee1\firebee1.asm
MEHR_ALS_28_TAGE 0x0003e6 program static C:\firebee\MLAB\firebee1\firebee1.asm
FEB 0x0003ee program static C:\firebee\MLAB\firebee1\firebee1.asm
SCHALTJAHR 0x0003f4 program static C:\firebee\MLAB\firebee1\firebee1.asm
NEXT_MONTH 0x0003fa program static C:\firebee\MLAB\firebee1\firebee1.asm
YEAR 0x000406 program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_FEB 0x00040e program static C:\firebee\MLAB\firebee1\firebee1.asm
MEHR_ALS_30_TAGE 0x000414 program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_APRIL 0x00041e program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_JUNI 0x000428 program static C:\firebee\MLAB\firebee1\firebee1.asm
NOT_SEP 0x000432 program static C:\firebee\MLAB\firebee1\firebee1.asm

View File

@@ -0,0 +1,125 @@
PS2 -> Atari /Amiga Mouse Adapter
~~~~~~~~~~~~~~~~~~~~~~~
Version 1.4 July 2010
Due to the short supply of mice for the Atari computers I decided to build an adapter that would allow me to use a serial mouse on my Atari, but even these are getting a bit old now, so I got the soldering iron out again and here's the result. A PS2 Mouse adapter for the Atari. It supports a standard PS2 mouse with 2 or 3 buttons and can also be used with the Microsoft optical IntelliMouse that comes with a USB to PS2 adapter. The middle button on the PS2 mouse is used as a left click and hold function for easy selection. Click the middle button again to release. Now for the bad news, for some reason Microsoft mice don't support the middle button in standard PS2 mode. :-(
Please don't shout at me all you Atari users but as an added feature if you change a link then the adapter can be used with an Amiga as well.
All files, programs etc contained in this archive are copright 2010 by Tom Kirk. Personal use is allowed but any commercial use is not allowed. Please feel free to use my work but don't rip me off.
Files in this archive.
~~~~~~~~~~~~~~~~~~~~~~
readme.txt This text file
circuit.bmp Picture of circuit in bitmap format
PS2Atari_v1_4.hex Object code of the PIC16F84 program in Intel hex
PS2Atari_v1_4.asm Source code of the PIC16F84 program
pcbtop.bmp Top layer of the PCB in bitmap format
pcbbot.bmp Bottom layer of the PCB in bitmap format
Technical Details.
~~~~~~~~~~~~~~~~~~
When the PS2 mouse is moved or a button changes state a packet of data is sent, my circuit decodes this data and then simulates the Atari mouse.
The circuit consists of a single microcontroller that contains a program to do the conversion. The circuit is shown in the file circuit.bmp
The microcontroller (PIC) can be either a PIC16C84 or PIC16F84 or PIC16F84A.
The PIC (IC1) needs to be programmed with the program.
The program is supplied in two forms PS2Atari_v1_4.hex is an object code file in Intel hex and can be read by most programmers capable of programming the PIC
PS2Atari_v1_4.asm is the source code of the program and can be assembled with the free MPLAB / MPASM software from Microchip if you wish to create your own object file. Note needs "Disable case sensitivity" under build options setting in MPLAB to assemble without errors.
The PIC should be programmed with oscillator as XT, watchdog disabled, powerup timer enabled and code protection off. (No point code protecting a freely available program.)
The source code and object code is compatible with all the PIC microcontrollers listed above.
I've built mine using a printed circuit board but it's small enough to be built using a small piece of stripboard.
On my PCB I have a 6 pin mini din socket at one end and a 9 pin D type socket at the other. I can then use a standard port extender lead to connect to the Atari. I've found that a 9 pin PC serial extension lead can also be used for this as well if you remove the fastening screws.
If you decide to build one on a piece of stripboard it will be easier to use cable mounted sockets as PCB types don't fit onto a stripboard.
Once built the board can be mounted into a small plastic box.
No special software is required on the Atari and it will work with all software.
Your favourite mouse accelerator program may be used if required.
Parts list.
~~~~~~~~~~~
IC1 PIC16F84A or PIC16F84 or PIC16C84
Fi1 4 MHz Ceramic resonator
R1 10K
R2 10K
C1 4.7 uF
C2 0.1 uF
All capacitors should be rated at 16V or more.
CN1 6 pin mini din PCB mounting socket
CN2 9 Pin D type PCB mounting socket
JP1 3 pin header and 2 way link
If building on a piece of stripboard I suggest using cable mounting types of connectors and use a small piece of multicore cable between the sockets and the stripboard. You will find the PCB sockets do not fit on a piece of stripboard.
If you don't need the switchable Atari/Amiga support forget the 3 pin header and just use a wire link instead.
History.
~~~~~~~~
Version 1.4 July 2010
Unused Pin RA4 now correctly set as an imput.
(Pin is tied to +5V on PCB for easier PCB routing.)
My oversight when transfering from prototype to PCB.
Thanks to Luciano for informing me.
Version 1.3 Released March 2010
Corrected a bug in button routine preventing both buttons being active together under certain conditions.
Thanks to Oliver Fleischmann for informing me.
(Can't believe it taken 6 Years for this bug to show itself!!)
Version 1.2 Released March 2009
Changed left/right button outputs to fake open collector.
Needed to stop conflits when using a joystick pluged into other port.
Version 1.1 Released September 2004.
Added support for the Amiga and added the middle button support.
Version 1.0 Never released.
My original version for the Atari only.
Help.
~~~~~
If you need further information or help then contact me at tgkirk@aol.com
Please allow a few days for a reply as I have other commitments as well.
Tom Kirk July 2010
P.S. I also have on my web site a Playstation controller to Atari adapter and a PC viewer for Atari format picture files.
http://www.tgkirk.110mb.com

View File

@@ -0,0 +1,107 @@
/*
* Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
* TsiChung Liew (Tsi-Chung.Liew@freescale.com)
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _M68K_BYTEORDER_H
#define _M68K_BYTEORDER_H
#include "types.h"
#ifdef __GNUC__
#define __sw16(x) \
((__u16)( \
(((__u16)(x) & (__u16)0x00ffU) << 8) | \
(((__u16)(x) & (__u16)0xff00U) >> 8) ))
#define __sw32(x) \
((__u32)( \
(((__u32)(x)) << 24) | \
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
(((__u32)(x)) >> 24) ))
extern __inline__ unsigned ld_le16(const volatile unsigned short *addr)
{
unsigned result = *addr;
return __sw16(result);
}
extern __inline__ void st_le16(volatile unsigned short *addr,
const unsigned val)
{
*addr = __sw16(val);
}
extern __inline__ unsigned ld_le32(const volatile unsigned *addr)
{
unsigned result = *addr;
return __sw32(result);
}
extern __inline__ void st_le32(volatile unsigned *addr, const unsigned val)
{
*addr = __sw32(val);
}
#if 0
/* alas, egcs sounds like it has a bug in this code that doesn't use the
inline asm correctly, and can cause file corruption. Until I hear that
it's fixed, I can live without the extra speed. I hope. */
#if !(__GNUC__ >= 2 && __GNUC_MINOR__ >= 90)
#if 0
# define __arch_swab16(x) ld_le16(&x)
# define __arch_swab32(x) ld_le32(&x)
#else
static __inline__ __attribute__ ((const))
__u16 ___arch__swab16(__u16 value)
{
return __sw16(value);
}
static __inline__ __attribute__ ((const))
__u32 ___arch__swab32(__u32 value)
{
return __sw32(value);
}
#define __arch__swab32(x) ___arch__swab32(x)
#define __arch__swab16(x) ___arch__swab16(x)
#endif /* 0 */
#endif
/* The same, but returns converted value from the location pointer by addr. */
#define __arch__swab16p(addr) ld_le16(addr)
#define __arch__swab32p(addr) ld_le32(addr)
/* The same, but do the conversion in situ, ie. put the value back to addr. */
#define __arch__swab16s(addr) st_le16(addr,*addr)
#define __arch__swab32s(addr) st_le32(addr,*addr)
#endif
#endif /* __GNUC__ */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define __BYTEORDER_HAS_U64__
#endif
#include "byteorder/big_endian.h"
#endif /* _M68K_BYTEORDER_H */

View File

@@ -0,0 +1,69 @@
#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
#define _LINUX_BYTEORDER_BIG_ENDIAN_H
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN 4321
#endif
#ifndef __BIG_ENDIAN_BITFIELD
#define __BIG_ENDIAN_BITFIELD
#endif
#define __BYTE_ORDER __BIG_ENDIAN
#include "swab.h"
#define __constant_htonl(x) ((__u32)(x))
#define __constant_ntohl(x) ((__u32)(x))
#define __constant_htons(x) ((__u16)(x))
#define __constant_ntohs(x) ((__u16)(x))
#define __constant_cpu_to_le64(x) ___swab64((x))
#define __constant_le64_to_cpu(x) ___swab64((x))
#define __constant_cpu_to_le32(x) ___swab32((x))
#define __constant_le32_to_cpu(x) ___swab32((x))
#define __constant_cpu_to_le16(x) ___swab16((x))
#define __constant_le16_to_cpu(x) ___swab16((x))
#define __constant_cpu_to_be64(x) ((__u64)(x))
#define __constant_be64_to_cpu(x) ((__u64)(x))
#define __constant_cpu_to_be32(x) ((__u32)(x))
#define __constant_be32_to_cpu(x) ((__u32)(x))
#define __constant_cpu_to_be16(x) ((__u16)(x))
#define __constant_be16_to_cpu(x) ((__u16)(x))
#define __cpu_to_le64(x) __swab64((x))
#define __le64_to_cpu(x) __swab64((x))
#define __cpu_to_le32(x) __swab32((x))
#define __le32_to_cpu(x) __swab32((x))
#define __cpu_to_le16(x) __swab16((x))
#define __le16_to_cpu(x) __swab16((x))
#define __cpu_to_be64(x) ((__u64)(x))
#define __be64_to_cpu(x) ((__u64)(x))
#define __cpu_to_be32(x) ((__u32)(x))
#define __be32_to_cpu(x) ((__u32)(x))
#define __cpu_to_be16(x) ((__u16)(x))
#define __be16_to_cpu(x) ((__u16)(x))
#define __cpu_to_le64p(x) __swab64p((x))
#define __le64_to_cpup(x) __swab64p((x))
#define __cpu_to_le32p(x) __swab32p((x))
#define __le32_to_cpup(x) __swab32p((x))
#define __cpu_to_le16p(x) __swab16p((x))
#define __le16_to_cpup(x) __swab16p((x))
#define __cpu_to_be64p(x) (*(__u64*)(x))
#define __be64_to_cpup(x) (*(__u64*)(x))
#define __cpu_to_be32p(x) (*(__u32*)(x))
#define __be32_to_cpup(x) (*(__u32*)(x))
#define __cpu_to_be16p(x) (*(__u16*)(x))
#define __be16_to_cpup(x) (*(__u16*)(x))
#define __cpu_to_le64s(x) __swab64s((x))
#define __le64_to_cpus(x) __swab64s((x))
#define __cpu_to_le32s(x) __swab32s((x))
#define __le32_to_cpus(x) __swab32s((x))
#define __cpu_to_le16s(x) __swab16s((x))
#define __le16_to_cpus(x) __swab16s((x))
#define __cpu_to_be64s(x) do {} while (0)
#define __be64_to_cpus(x) do {} while (0)
#define __cpu_to_be32s(x) do {} while (0)
#define __be32_to_cpus(x) do {} while (0)
#define __cpu_to_be16s(x) do {} while (0)
#define __be16_to_cpus(x) do {} while (0)
#include "generic.h"
#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */

View File

@@ -0,0 +1,180 @@
#ifndef _LINUX_BYTEORDER_GENERIC_H
#define _LINUX_BYTEORDER_GENERIC_H
/*
* linux/byteorder_generic.h
* Generic Byte-reordering support
*
* Francois-Rene Rideau <fare@tunes.org> 19970707
* gathered all the good ideas from all asm-foo/byteorder.h into one file,
* cleaned them up.
* I hope it is compliant with non-GCC compilers.
* I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
* because I wasn't sure it would be ok to put it in types.h
* Upgraded it to 2.1.43
* Francois-Rene Rideau <fare@tunes.org> 19971012
* Upgraded it to 2.1.57
* to please Linus T., replaced huge #ifdef's between little/big endian
* by nestedly #include'd files.
* Francois-Rene Rideau <fare@tunes.org> 19971205
* Made it to 2.1.71; now a facelift:
* Put files under include/linux/byteorder/
* Split swab from generic support.
*
* TODO:
* = Regular kernel maintainers could also replace all these manual
* byteswap macros that remain, disseminated among drivers,
* after some grep or the sources...
* = Linus might want to rename all these macros and files to fit his taste,
* to fit his personal naming scheme.
* = it seems that a few drivers would also appreciate
* nybble swapping support...
* = every architecture could add their byteswap macro in asm/byteorder.h
* see how some architectures already do (i386, alpha, ppc, etc)
* = cpu_to_beXX and beXX_to_cpu might some day need to be well
* distinguished throughout the kernel. This is not the case currently,
* since little endian, big endian, and pdp endian machines needn't it.
* But this might be the case for, say, a port of Linux to 20/21 bit
* architectures (and F21 Linux addict around?).
*/
/*
* The following macros are to be defined by <asm/byteorder.h>:
*
* Conversion of long and short int between network and host format
* ntohl(__u32 x)
* ntohs(__u16 x)
* htonl(__u32 x)
* htons(__u16 x)
* It seems that some programs (which? where? or perhaps a standard? POSIX?)
* might like the above to be functions, not macros (why?).
* if that's true, then detect them, and take measures.
* Anyway, the measure is: define only ___ntohl as a macro instead,
* and in a separate file, have
* unsigned long inline ntohl(x){return ___ntohl(x);}
*
* The same for constant arguments
* __constant_ntohl(__u32 x)
* __constant_ntohs(__u16 x)
* __constant_htonl(__u32 x)
* __constant_htons(__u16 x)
*
* Conversion of XX-bit integers (16- 32- or 64-)
* between native CPU format and little/big endian format
* 64-bit stuff only defined for proper architectures
* cpu_to_[bl]eXX(__uXX x)
* [bl]eXX_to_cpu(__uXX x)
*
* The same, but takes a pointer to the value to convert
* cpu_to_[bl]eXXp(__uXX x)
* [bl]eXX_to_cpup(__uXX x)
*
* The same, but change in situ
* cpu_to_[bl]eXXs(__uXX x)
* [bl]eXX_to_cpus(__uXX x)
*
* See asm-foo/byteorder.h for examples of how to provide
* architecture-optimized versions
*
*/
//#if defined(__KERNEL__)
/*
* inside the kernel, we can use nicknames;
* outside of it, we must avoid POSIX namespace pollution...
*/
#define cpu_to_le64 __cpu_to_le64
#define le64_to_cpu __le64_to_cpu
#define cpu_to_le32 __cpu_to_le32
#define le32_to_cpu __le32_to_cpu
#define cpu_to_le16 __cpu_to_le16
#define le16_to_cpu __le16_to_cpu
#define cpu_to_be64 __cpu_to_be64
#define be64_to_cpu __be64_to_cpu
#define cpu_to_be32 __cpu_to_be32
#define be32_to_cpu __be32_to_cpu
#define cpu_to_be16 __cpu_to_be16
#define be16_to_cpu __be16_to_cpu
#define cpu_to_le64p __cpu_to_le64p
#define le64_to_cpup __le64_to_cpup
#define cpu_to_le32p __cpu_to_le32p
#define le32_to_cpup __le32_to_cpup
#define cpu_to_le16p __cpu_to_le16p
#define le16_to_cpup __le16_to_cpup
#define cpu_to_be64p __cpu_to_be64p
#define be64_to_cpup __be64_to_cpup
#define cpu_to_be32p __cpu_to_be32p
#define be32_to_cpup __be32_to_cpup
#define cpu_to_be16p __cpu_to_be16p
#define be16_to_cpup __be16_to_cpup
#define cpu_to_le64s __cpu_to_le64s
#define le64_to_cpus __le64_to_cpus
#define cpu_to_le32s __cpu_to_le32s
#define le32_to_cpus __le32_to_cpus
#define cpu_to_le16s __cpu_to_le16s
#define le16_to_cpus __le16_to_cpus
#define cpu_to_be64s __cpu_to_be64s
#define be64_to_cpus __be64_to_cpus
#define cpu_to_be32s __cpu_to_be32s
#define be32_to_cpus __be32_to_cpus
#define cpu_to_be16s __cpu_to_be16s
#define be16_to_cpus __be16_to_cpus
//#endif
/*
* Handle ntohl and suches. These have various compatibility
* issues - like we want to give the prototype even though we
* also have a macro for them in case some strange program
* wants to take the address of the thing or something..
*
* Note that these used to return a "long" in libc5, even though
* long is often 64-bit these days.. Thus the casts.
*
* They have to be macros in order to do the constant folding
* correctly - if the argument passed into a inline function
* it is no longer constant according to gcc..
*/
#undef ntohl
#undef ntohs
#undef htonl
#undef htons
/*
* Do the prototypes. Somebody might want to take the
* address or some such sick thing..
*/
#if defined(__KERNEL__) || (defined (__GLIBC__) && __GLIBC__ >= 2)
extern __u32 ntohl(__u32);
extern __u32 htonl(__u32);
#else
extern unsigned long int ntohl(unsigned long int);
extern unsigned long int htonl(unsigned long int);
#endif
extern unsigned short int ntohs(unsigned short int);
extern unsigned short int htons(unsigned short int);
#if defined(__GNUC__) && (__GNUC__ >= 2)
#define ___htonl(x) __cpu_to_be32(x)
#define ___htons(x) __cpu_to_be16(x)
#define ___ntohl(x) __be32_to_cpu(x)
#define ___ntohs(x) __be16_to_cpu(x)
#if defined(__KERNEL__) || (defined (__GLIBC__) && __GLIBC__ >= 2)
#define htonl(x) ___htonl(x)
#define ntohl(x) ___ntohl(x)
#else
#define htonl(x) ((unsigned long)___htonl(x))
#define ntohl(x) ((unsigned long)___ntohl(x))
#endif
#define htons(x) ___htons(x)
#define ntohs(x) ___ntohs(x)
#endif /* OPTIMIZE */
#endif /* _LINUX_BYTEORDER_GENERIC_H */

View File

@@ -0,0 +1,69 @@
#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN 1234
#endif
#ifndef __LITTLE_ENDIAN_BITFIELD
#define __LITTLE_ENDIAN_BITFIELD
#endif
#define __BYTE_ORDER __LITTLE_ENDIAN
#include "swab.h"
#define __constant_htonl(x) ___constant_swab32((x))
#define __constant_ntohl(x) ___constant_swab32((x))
#define __constant_htons(x) ___constant_swab16((x))
#define __constant_ntohs(x) ___constant_swab16((x))
#define __constant_cpu_to_le64(x) ((__u64)(x))
#define __constant_le64_to_cpu(x) ((__u64)(x))
#define __constant_cpu_to_le32(x) ((__u32)(x))
#define __constant_le32_to_cpu(x) ((__u32)(x))
#define __constant_cpu_to_le16(x) ((__u16)(x))
#define __constant_le16_to_cpu(x) ((__u16)(x))
#define __constant_cpu_to_be64(x) ___constant_swab64((x))
#define __constant_be64_to_cpu(x) ___constant_swab64((x))
#define __constant_cpu_to_be32(x) ___constant_swab32((x))
#define __constant_be32_to_cpu(x) ___constant_swab32((x))
#define __constant_cpu_to_be16(x) ___constant_swab16((x))
#define __constant_be16_to_cpu(x) ___constant_swab16((x))
#define __cpu_to_le64(x) ((__u64)(x))
#define __le64_to_cpu(x) ((__u64)(x))
#define __cpu_to_le32(x) ((__u32)(x))
#define __le32_to_cpu(x) ((__u32)(x))
#define __cpu_to_le16(x) ((__u16)(x))
#define __le16_to_cpu(x) ((__u16)(x))
#define __cpu_to_be64(x) __swab64((x))
#define __be64_to_cpu(x) __swab64((x))
#define __cpu_to_be32(x) __swab32((x))
#define __be32_to_cpu(x) __swab32((x))
#define __cpu_to_be16(x) __swab16((x))
#define __be16_to_cpu(x) __swab16((x))
#define __cpu_to_le64p(x) (*(__u64*)(x))
#define __le64_to_cpup(x) (*(__u64*)(x))
#define __cpu_to_le32p(x) (*(__u32*)(x))
#define __le32_to_cpup(x) (*(__u32*)(x))
#define __cpu_to_le16p(x) (*(__u16*)(x))
#define __le16_to_cpup(x) (*(__u16*)(x))
#define __cpu_to_be64p(x) __swab64p((x))
#define __be64_to_cpup(x) __swab64p((x))
#define __cpu_to_be32p(x) __swab32p((x))
#define __be32_to_cpup(x) __swab32p((x))
#define __cpu_to_be16p(x) __swab16p((x))
#define __be16_to_cpup(x) __swab16p((x))
#define __cpu_to_le64s(x) do {} while (0)
#define __le64_to_cpus(x) do {} while (0)
#define __cpu_to_le32s(x) do {} while (0)
#define __le32_to_cpus(x) do {} while (0)
#define __cpu_to_le16s(x) do {} while (0)
#define __le16_to_cpus(x) do {} while (0)
#define __cpu_to_be64s(x) __swab64s((x))
#define __be64_to_cpus(x) __swab64s((x))
#define __cpu_to_be32s(x) __swab32s((x))
#define __be32_to_cpus(x) __swab32s((x))
#define __cpu_to_be16s(x) __swab16s((x))
#define __be16_to_cpus(x) __swab16s((x))
#include "generic.h"
#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */

View File

@@ -0,0 +1,158 @@
#ifndef _LINUX_BYTEORDER_SWAB_H
#define _LINUX_BYTEORDER_SWAB_H
/*
* linux/byteorder/swab.h
* Byte-swapping, independently from CPU endianness
* swabXX[ps]?(foo)
*
* Francois-Rene Rideau <fare@tunes.org> 19971205
* separated swab functions from cpu_to_XX,
* to clean up support for bizarre-endian architectures.
*
* See asm-i386/byteorder.h and suches for examples of how to provide
* architecture-dependent optimized versions
*
*/
/* casts are necessary for constants, because we never know how for sure
* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
*/
#define ___swab16(x) \
((__u16)( \
(((__u16)(x) & (__u16)0x00ffU) << 8) | \
(((__u16)(x) & (__u16)0xff00U) >> 8) ))
#define ___swab32(x) \
((__u32)( \
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
(((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
#define ___swab64(x) \
((__u64)( \
(__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
(__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
(__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
(__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
(__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
(__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
(__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
(__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
/*
* provide defaults when no architecture-specific optimization is detected
*/
#ifndef __arch__swab16
# define __arch__swab16(x) ___swab16(x)
#endif
#ifndef __arch__swab32
# define __arch__swab32(x) ___swab32(x)
#endif
#ifndef __arch__swab64
# define __arch__swab64(x) ___swab64(x)
#endif
#ifndef __arch__swab16p
# define __arch__swab16p(x) __swab16(*(x))
#endif
#ifndef __arch__swab32p
# define __arch__swab32p(x) __swab32(*(x))
#endif
#ifndef __arch__swab64p
# define __arch__swab64p(x) __swab64(*(x))
#endif
#ifndef __arch__swab16s
# define __arch__swab16s(x) do { *(x) = __swab16p((x)); } while (0)
#endif
#ifndef __arch__swab32s
# define __arch__swab32s(x) do { *(x) = __swab32p((x)); } while (0)
#endif
#ifndef __arch__swab64s
# define __arch__swab64s(x) do { *(x) = __swab64p((x)); } while (0)
#endif
/*
* Allow constant folding
*/
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
# define __swab16(x) \
(__builtin_constant_p((__u16)(x)) ? \
___swab16((x)) : \
__fswab16((x)))
# define __swab32(x) \
(__builtin_constant_p((__u32)(x)) ? \
___swab32((x)) : \
__fswab32((x)))
# define __swab64(x) \
(__builtin_constant_p((__u64)(x)) ? \
___swab64((x)) : \
__fswab64((x)))
#else
# define __swab16(x) __fswab16(x)
# define __swab32(x) __fswab32(x)
# define __swab64(x) __fswab64(x)
#endif /* OPTIMIZE */
static __inline__ __attribute__((const)) __u16 __fswab16(__u16 x)
{
return __arch__swab16(x);
}
static __inline__ __u16 __swab16p(__u16 *x)
{
return __arch__swab16p(x);
}
static __inline__ void __swab16s(__u16 *addr)
{
__arch__swab16s(addr);
}
static __inline__ __attribute__((const)) __u32 __fswab32(__u32 x)
{
return __arch__swab32(x);
}
static __inline__ __u32 __swab32p(__u32 *x)
{
return __arch__swab32p(x);
}
static __inline__ void __swab32s(__u32 *addr)
{
__arch__swab32s(addr);
}
#ifdef __BYTEORDER_HAS_U64__
static __inline__ __attribute__((const)) __u64 __fswab64(__u64 x)
{
# ifdef __SWAB_64_THRU_32__
__u32 h = x >> 32;
__u32 l = x & ((1ULL<<32)-1);
return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
# else
return __arch__swab64(x);
# endif
}
static __inline__ __u64 __swab64p(__u64 *x)
{
return __arch__swab64p(x);
}
static __inline__ void __swab64s(__u64 *addr)
{
__arch__swab64s(addr);
}
#endif /* __BYTEORDER_HAS_U64__ */
//#if defined(__KERNEL__)
#define swab16 __swab16
#define swab32 __swab32
#define swab64 __swab64
#define swab16p __swab16p
#define swab32p __swab32p
#define swab64p __swab64p
#define swab16s __swab16s
#define swab32s __swab32s
#define swab64s __swab64s
//#endif
#endif /* _LINUX_BYTEORDER_SWAB_H */

View File

@@ -0,0 +1,263 @@
/*
* IO header file
*
* Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
* TsiChung Liew (Tsi-Chung.Liew@freescale.com)
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __ASM_M68K_IO_H__
#define __ASM_M68K_IO_H__
#include "byteorder.h"
#define __raw_readb(addr) (*(volatile u8 *)(addr))
#define __raw_readw(addr) (*(volatile u16 *)(addr))
#define __raw_readl(addr) (*(volatile u32 *)(addr))
#define __raw_writeb(b,addr) ((*(volatile u8 *) (addr)) = (b))
#define __raw_writew(w,addr) ((*(volatile u16 *) (addr)) = (w))
#define __raw_writel(l,addr) ((*(volatile u32 *) (addr)) = (l))
#define readb(addr) in_8((volatile u8 *)(addr))
#define writeb(b,addr) out_8((volatile u8 *)(addr), (b))
#if !defined(__BIG_ENDIAN)
//#if defined(__BIG_ENDIAN)
#define readw(addr) (*(volatile u16 *) (addr))
#define readl(addr) (*(volatile u32 *) (addr))
#define writew(b,addr) ((*(volatile u16 *) (addr)) = (b))
#define writel(b,addr) ((*(volatile u32 *) (addr)) = (b))
#else /* Galvez: in_le16() does the swap reading
* twice from fifo (register), when reading
* from fifo once the value is changed by the new one */
#define readw(addr) ld_le16((volatile u16 *)(addr)) /* instead of in_le16((volatile u16 *)(addr))*/
#define readl(addr) in_le32((volatile u32 *)(addr))
#define writew(b,addr) out_le16((volatile u16 *)(addr),(b))
#define writel(b,addr) out_le32((volatile u32 *)(addr),(b))
#endif
/*
* The insw/outsw/insl/outsl macros don't do byte-swapping.
* They are only used in practice for transferring buffers which
* are arrays of bytes, and byte-swapping is not appropriate in
* that case. - paulus
*/
#define insb(port, buf, ns) _insb((u8 *)((port)+_IO_BASE), (buf), (ns))
#define outsb(port, buf, ns) _outsb((u8 *)((port)+_IO_BASE), (buf), (ns))
#define insw(port, buf, ns) _insw_ns((u16 *)((port)+_IO_BASE), (buf), (ns))
#define outsw(port, buf, ns) _outsw_ns((u16 *)((port)+_IO_BASE), (buf), (ns))
#define insl(port, buf, nl) _insl_ns((u32 *)((port)+_IO_BASE), (buf), (nl))
#define outsl(port, buf, nl) _outsl_ns((u32 *)((port)+_IO_BASE), (buf), (nl))
#define inb(port) in_8((u8 *)((port)+_IO_BASE))
#define outb(val, port) out_8((u8 *)((port)+_IO_BASE), (val))
#if !defined(__BIG_ENDIAN)
//#if defined(__BIG_ENDIAN)
#define inw(port) in_be16((u16 *)((port)+_IO_BASE))
#define outw(val, port) out_be16((u16 *)((port)+_IO_BASE), (val))
#define inl(port) in_be32((u32 *)((port)+_IO_BASE))
#define outl(val, port) out_be32((u32 *)((port)+_IO_BASE), (val))
#else
#define inw(port) in_le16((u16 *)((port)+_IO_BASE))
#define outw(val, port) out_le16((u16 *)((port)+_IO_BASE), (val))
#define inl(port) in_le32((u32 *)((port)+_IO_BASE))
#define outl(val, port) out_le32((u32 *)((port)+_IO_BASE), (val))
#endif
extern inline void _insb(volatile u8 * port, void *buf, int ns)
{
u8 *data = (u8 *) buf;
while (ns--)
*data++ = *port;
}
extern inline void _outsb(volatile u8 * port, const void *buf, int ns)
{
u8 *data = (u8 *) buf;
while (ns--)
*port = *data++;
}
extern inline void _insw(volatile u16 * port, void *buf, int ns)
{
u16 *data = (u16 *) buf;
while (ns--)
*data++ = __sw16(*port);
}
extern inline void _outsw(volatile u16 * port, const void *buf, int ns)
{
u16 *data = (u16 *) buf;
while (ns--) {
*port = __sw16(*data);
data++;
}
}
extern inline void _insl(volatile u32 * port, void *buf, int nl)
{
u32 *data = (u32 *) buf;
while (nl--)
*data++ = __sw32(*port);
}
extern inline void _outsl(volatile u32 * port, const void *buf, int nl)
{
u32 *data = (u32 *) buf;
while (nl--) {
*port = __sw32(*data);
data++;
}
}
extern inline void _insw_ns(volatile u16 * port, void *buf, int ns)
{
u16 *data = (u16 *) buf;
while (ns--)
*data++ = *port;
}
extern inline void _outsw_ns(volatile u16 * port, const void *buf, int ns)
{
u16 *data = (u16 *) buf;
while (ns--) {
*port = *data++;
}
}
extern inline void _insl_ns(volatile u32 * port, void *buf, int nl)
{
u32 *data = (u32 *) buf;
while (nl--)
*data++ = *port;
}
extern inline void _outsl_ns(volatile u32 * port, const void *buf, int nl)
{
u32 *data = (u32 *) buf;
while (nl--) {
*port = *data;
data++;
}
}
/*
* The *_ns versions below don't do byte-swapping.
* Neither do the standard versions now, these are just here
* for older code.
*/
#define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+_IO_BASE), (buf), (ns))
#define outsw_ns(port, buf, ns) _outsw_ns((u16 *)((port)+_IO_BASE), (buf), (ns))
#define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+_IO_BASE), (buf), (nl))
#define outsl_ns(port, buf, nl) _outsl_ns((u32 *)((port)+_IO_BASE), (buf), (nl))
#define IO_SPACE_LIMIT ~0
/*
* 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
*/
extern inline int in_8(volatile u8 * addr)
{
return (int)*addr;
}
extern inline void out_8(volatile u8 * addr, int val)
{
*addr = (u8) val;
}
extern inline int in_le16(volatile u16 * addr)
{
return __sw16(*addr);
}
extern inline int in_be16(volatile u16 * addr)
{
return (*addr & 0xFFFF);
}
extern inline void out_le16(volatile u16 * addr, int val)
{
*addr = __sw16(val);
}
extern inline void out_be16(volatile u16 * addr, int val)
{
*addr = (u16) val;
}
extern inline unsigned in_le32(volatile u32 * addr)
{
return __sw32(*addr);
}
extern inline unsigned in_be32(volatile u32 * addr)
{
return (*addr);
}
extern inline void out_le32(volatile unsigned *addr, int val)
{
*addr = __sw32(val);
}
extern inline void out_be32(volatile unsigned *addr, int val)
{
*addr = val;
}
static inline void sync(void)
{
/* This sync function is for PowerPC or other architecture instruction
* ColdFire does not have this instruction. Dummy function, added for
* compatibility (CFI driver)
*/
}
/*
* Given a physical address and a length, return a virtual address
* that can be used to access the memory range with the caching
* properties specified by "flags".
*/
#define MAP_NOCACHE (0)
#define MAP_WRCOMBINE (0)
#define MAP_WRBACK (0)
#define MAP_WRTHROUGH (0)
static inline void *map_physmem(phys_addr_t paddr, unsigned long len,
unsigned long flags)
{
return (void *)paddr;
}
/*
* Take down a mapping set up by map_physmem().
*/
static inline void unmap_physmem(void *vaddr, unsigned long flags)
{
}
static inline phys_addr_t virt_to_phys(void * vaddr)
{
return (phys_addr_t)(vaddr);
}
#endif /* __ASM_M68K_IO_H__ */

View File

@@ -0,0 +1,53 @@
#ifndef _M68K_TYPES_H
#define _M68K_TYPES_H
#ifndef __ASSEMBLY__
typedef unsigned short umode_t;
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
#if defined(__GNUC__)
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#endif
typedef struct {
__u32 u[4];
} __attribute__((aligned(16))) vector128;
//#ifdef __KERNEL__
/*
* These aren't exported outside the kernel to avoid name space clashes
*/
typedef signed char s8;
typedef unsigned char u8;
typedef signed short s16;
typedef unsigned short u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long s64;
typedef unsigned long long u64;
#define BITS_PER_LONG 32
/* DMA addresses are 32-bits wide */
typedef u32 dma_addr_t;
typedef unsigned long phys_addr_t;
typedef unsigned long phys_size_t;
//#endif /* __KERNEL__ */
#endif /* __ASSEMBLY__ */
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,731 @@
/*
* Modified for Atari by David Gálvez 2010
* Modified for Atari by Didier Mequignon 2009
*
* (C) Copyright 2001
* Denis Peter, MPL AG Switzerland
*
* Most of this source has been derived from the Linux USB
* project.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*/
#include "config.h"
#include "asm-m68k/byteorder.h"
#include "usb.h"
//#undef RESET_START_STOP_CMDS
//#define RESET_START_STOP_CMDS
#ifdef CONFIG_USB_STORAGE
static int usb_stor_curr_dev = -1; /* current device */
#endif
#ifdef PCI_XBIOS
extern short pci_init(void);
#endif
/* some display routines (info command) */
char *usb_get_class_desc(unsigned char dclass)
{
switch (dclass) {
case USB_CLASS_PER_INTERFACE:
return "See Interface";
case USB_CLASS_AUDIO:
return "Audio";
case USB_CLASS_COMM:
return "Communication";
case USB_CLASS_HID:
return "Human Interface";
case USB_CLASS_PRINTER:
return "Printer";
case USB_CLASS_MASS_STORAGE:
return "Mass Storage";
case USB_CLASS_HUB:
return "Hub";
case USB_CLASS_DATA:
return "CDC Data";
case USB_CLASS_VENDOR_SPEC:
return "Vendor specific";
default:
return "";
}
}
void usb_display_class_sub(unsigned char dclass, unsigned char subclass,
unsigned char proto)
{
switch (dclass) {
case USB_CLASS_PER_INTERFACE:
printf("See Interface");
break;
case USB_CLASS_HID:
printf("Human Interface, Subclass: ");
switch (subclass) {
case USB_SUB_HID_NONE:
printf("None");
break;
case USB_SUB_HID_BOOT:
printf("Boot ");
switch (proto) {
case USB_PROT_HID_NONE:
printf("None");
break;
case USB_PROT_HID_KEYBOARD:
printf("Keyboard");
break;
case USB_PROT_HID_MOUSE:
printf("Mouse");
break;
default:
printf("reserved");
break;
}
break;
default:
printf("reserved");
break;
}
break;
case USB_CLASS_MASS_STORAGE:
printf("Mass Storage, ");
switch (subclass) {
case US_SC_RBC:
printf("RBC ");
break;
case US_SC_8020:
printf("SFF-8020i (ATAPI)");
break;
case US_SC_QIC:
printf("QIC-157 (Tape)");
break;
case US_SC_UFI:
printf("UFI");
break;
case US_SC_8070:
printf("SFF-8070");
break;
case US_SC_SCSI:
printf("Transp. SCSI");
break;
default:
printf("reserved");
break;
}
printf(", ");
switch (proto) {
case US_PR_CB:
printf("Command/Bulk");
break;
case US_PR_CBI:
printf("Command/Bulk/Int");
break;
case US_PR_BULK:
printf("Bulk only");
break;
default:
printf("reserved");
break;
}
break;
default:
printf("%s", usb_get_class_desc(dclass));
break;
}
}
void usb_display_string(struct usb_device *dev, int idx)
{
char buffer[256];
if (idx != 0) {
if (usb_string(dev, idx, &buffer[0], 256) > 0)
printf("String: \"%s\"", buffer);
}
}
void usb_display_desc(struct usb_device *dev)
{
if (dev->descriptor.bDescriptorType == USB_DT_DEVICE) {
printf("%d: %s, USB Revision %x.%x\n", dev->devnum,
usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass),
(dev->descriptor.bcdUSB>>8) & 0xff,
dev->descriptor.bcdUSB & 0xff);
if (strlen(dev->mf) || strlen(dev->prod) ||
strlen(dev->serial))
printf(" - %s %s %s\n", dev->mf, dev->prod,
dev->serial);
if (dev->descriptor.bDeviceClass) {
printf(" - Class: ");
usb_display_class_sub(dev->descriptor.bDeviceClass,
dev->descriptor.bDeviceSubClass,
dev->descriptor.bDeviceProtocol);
printf("\n");
} else {
printf(" - Class: (from Interface) %s\n",
usb_get_class_desc(
dev->config.if_desc[0].bInterfaceClass));
}
printf(" - PacketSize: %d Configurations: %d\n",
dev->descriptor.bMaxPacketSize0,
dev->descriptor.bNumConfigurations);
printf(" - Vendor: 0x%04x Product 0x%04x Version %d.%d\n",
dev->descriptor.idVendor, dev->descriptor.idProduct,
(dev->descriptor.bcdDevice>>8) & 0xff,
dev->descriptor.bcdDevice & 0xff);
}
}
void usb_display_conf_desc(struct usb_config_descriptor *config,
struct usb_device *dev)
{
printf(" Configuration: %d\n", config->bConfigurationValue);
printf(" - Interfaces: %d %s%s%dmA\n", config->bNumInterfaces,
(config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ",
(config->bmAttributes & 0x20) ? "Remote Wakeup " : "",
config->MaxPower*2);
if (config->iConfiguration) {
printf(" - ");
usb_display_string(dev, config->iConfiguration);
printf("\n");
}
}
void usb_display_if_desc(struct usb_interface_descriptor *ifdesc,
struct usb_device *dev)
{
printf(" Interface: %d\n", ifdesc->bInterfaceNumber);
printf(" - Alternate Setting %d, Endpoints: %d\n",
ifdesc->bAlternateSetting, ifdesc->bNumEndpoints);
printf(" - Class ");
usb_display_class_sub(ifdesc->bInterfaceClass,
ifdesc->bInterfaceSubClass, ifdesc->bInterfaceProtocol);
printf("\n");
if (ifdesc->iInterface) {
printf(" - ");
usb_display_string(dev, ifdesc->iInterface);
printf("\n");
}
}
void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc)
{
printf(" - Endpoint %d %s ", epdesc->bEndpointAddress & 0xf,
(epdesc->bEndpointAddress & 0x80) ? "In" : "Out");
switch ((epdesc->bmAttributes & 0x03)) {
case 0:
printf("Control");
break;
case 1:
printf("Isochronous");
break;
case 2:
printf("Bulk");
break;
case 3:
printf("Interrupt");
break;
}
printf(" MaxPacket %d", epdesc->wMaxPacketSize);
if ((epdesc->bmAttributes & 0x03) == 0x3)
printf(" Interval %dms", epdesc->bInterval);
printf("\n");
}
/* main routine to diasplay the configs, interfaces and endpoints */
void usb_display_config(struct usb_device *dev)
{
struct usb_config_descriptor *config;
struct usb_interface_descriptor *ifdesc;
struct usb_endpoint_descriptor *epdesc;
int i, ii;
config = &dev->config;
usb_display_conf_desc(config, dev);
for (i = 0; i < config->no_of_if; i++) {
ifdesc = &config->if_desc[i];
usb_display_if_desc(ifdesc, dev);
for (ii = 0; ii < ifdesc->no_of_ep; ii++) {
epdesc = &ifdesc->ep_desc[ii];
usb_display_ep_desc(epdesc);
}
}
printf("\n");
}
static inline char *portspeed(int speed)
{
if (speed == USB_SPEED_HIGH)
return "480 Mb/s";
else if (speed == USB_SPEED_LOW)
return "1.5 Mb/s";
else
return "12 Mb/s";
}
/* shows the device tree recursively */
void usb_show_tree_graph(struct usb_device *dev, char *pre)
{
int i, idx;
int has_child, last_child, port;
idx = strlen(pre);
printf(" %s", pre);
/* check if the device has connected children */
has_child = 0;
for (i = 0; i < dev->maxchild; i++) {
if (dev->children[i] != NULL)
has_child = 1;
}
/* check if we are the last one */
last_child = 1;
if (dev->parent != NULL) {
for (i = 0; i < dev->parent->maxchild; i++) {
/* search for children */
if (dev->parent->children[i] == dev) {
/* found our pointer, see if we have a
* little sister
*/
port = i;
while (i++ < dev->parent->maxchild) {
if (dev->parent->children[i] != NULL) {
/* found a sister */
last_child = 0;
break;
} /* if */
} /* while */
} /* device found */
} /* for all children of the parent */
printf("\b+-");
/* correct last child */
if (last_child)
pre[idx-1] = ' ';
} /* if not root hub */
else
printf(" ");
printf("%d ", dev->devnum);
pre[idx++] = ' ';
pre[idx++] = has_child ? '|' : ' ';
pre[idx] = 0;
printf(" %s (%s, %dmA)\n", usb_get_class_desc(
dev->config.if_desc[0].bInterfaceClass),
portspeed(dev->speed),
dev->config.MaxPower * 2);
if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
printf(" %s\n", pre);
if (dev->maxchild > 0) {
for (i = 0; i < dev->maxchild; i++) {
if (dev->children[i] != NULL) {
usb_show_tree_graph(dev->children[i], pre);
pre[idx] = 0;
}
}
}
}
/* main routine for the tree command */
void usb_show_tree(struct usb_device *dev)
{
char preamble[32];
memset(preamble, 0, 32);
usb_show_tree_graph(dev, &preamble[0]);
}
/******************************************************************************
* usb boot command intepreter. Derived from diskboot
*/
#if 0
#ifdef CONFIG_USB_STORAGE
int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
char *boot_device = NULL;
char *ep;
int dev, part = 1, rcode;
ulong addr, cnt;
disk_partition_t info;
image_header_t *hdr;
block_dev_desc_t *stor_dev;
#if defined(CONFIG_FIT)
const void *fit_hdr = NULL;
#endif
switch (argc) {
case 1:
addr = CONFIG_SYS_LOAD_ADDR;
boot_device = getenv("bootdevice");
break;
case 2:
addr = strtoul(argv[1], NULL, 16);
boot_device = getenv("bootdevice");
break;
case 3:
addr = strtoul(argv[1], NULL, 16);
boot_device = argv[2];
break;
default:
// cmd_usage(cmdtp);
return 1;
}
if (!boot_device) {
puts("\n** No boot device **\n");
return 1;
}
dev = strtoul(boot_device, &ep, 16);
stor_dev = usb_stor_get_dev(dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN) {
printf("\n** Device %d not available\n", dev);
return 1;
}
if (stor_dev->block_read == NULL) {
printf("storage device not initialized. Use usb scan\n");
return 1;
}
if (*ep) {
if (*ep != ':') {
puts("\n** Invalid boot device, use `dev[:part]' **\n");
return 1;
}
part = strtoul(++ep, NULL, 16);
}
if (get_partition_info(stor_dev, part, &info)) {
/* try to boot raw .... */
strncpy((char *)&info.type[0], BOOT_PART_TYPE,
sizeof(BOOT_PART_TYPE));
strncpy((char *)&info.name[0], "Raw", 4);
info.start = 0;
info.blksz = 0x200;
info.size = 2880;
printf("error reading partinfo...try to boot raw\n");
}
if ((strncmp((char *)info.type, BOOT_PART_TYPE,
sizeof(info.type)) != 0) &&
(strncmp((char *)info.type, BOOT_PART_COMP,
sizeof(info.type)) != 0)) {
printf("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
return 1;
}
printf("\nLoading from USB device %d, partition %d: "
"Name: %.32s Type: %.32s\n",
dev, part, info.name, info.type);
debug("First Block: %ld, # of blocks: %ld, Block Size: %ld\n",
info.start, info.size, info.blksz);
if (stor_dev->block_read(dev, info.start, 1, (ulong *)addr) != 1) {
printf("** Read error on %d:%d\n", dev, part);
return 1;
}
switch (genimg_get_format((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
// hdr = (image_header_t *)addr;
// if (!image_check_hcrc(hdr)) {
// puts("\n** Bad Header Checksum **\n");
return 1;
}
// image_print_contents(hdr);
// cnt = image_get_image_size(hdr);
break;
#if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT:
fit_hdr = (const void *)addr;
puts("Fit image detected...\n");
cnt = fit_get_size(fit_hdr);
break;
#endif
default:
puts("** Unknown image type\n");
return 1;
}
cnt += info.blksz - 1;
cnt /= info.blksz;
cnt -= 1;
if (stor_dev->block_read(dev, info.start+1, cnt,
(ulong *)(addr+info.blksz)) != cnt) {
printf("\n** Read error on %d:%d\n", dev, part);
return 1;
}
#if defined(CONFIG_FIT)
/* This cannot be done earlier, we need complete FIT image in RAM
* first
*/
if (genimg_get_format((void *)addr) == IMAGE_FORMAT_FIT) {
if (!fit_check_format(fit_hdr)) {
puts("** Bad FIT image format\n");
return 1;
}
fit_print_contents(fit_hdr);
}
#endif
/* Loading ok, update default load address */
load_addr = addr;
flush_cache(addr, (cnt+1)*info.blksz);
/* Check if we should attempt an auto-start */
if (((ep = getenv("autostart")) != NULL) && (strcmp(ep, "yes") == 0)) {
char *local_args[2];
extern int do_bootm(cmd_tbl_t *, int, int, char *[]);
local_args[0] = argv[0];
local_args[1] = NULL;
printf("Automatic boot of image at addr 0x%08lX ...\n", addr);
rcode = do_bootm(cmdtp, 0, 1, local_args);
return rcode;
}
return 0;
}
#endif
#endif /* CONFIG_USB_STORAGE */
/******************************************************************************
* usb command intepreter
*/
int do_usb(int argc, char **argv)
{
int i;
struct usb_device *dev = NULL;
#ifdef CONFIG_USB_STORAGE
block_dev_desc_t *stor_dev;
#endif
extern char usb_started;
if ((strncmp(argv[1], "reset", 5) == 0) ||
(strncmp(argv[1], "start", 5) == 0)) {
usb_stop();
printf("(Re)start USB...\n");
#ifdef PCI_XBIOS
i = pci_init();
#else
if (usb_init() >= 0)
i = 1;
#endif
#ifdef CONFIG_USB_STORAGE
/* try to recognize storage devices immediately */
if (i == 1)
usb_stor_curr_dev = usb_stor_scan( );
#endif
return 0;
}
if (strncmp(argv[1], "stop", 4) == 0) {
#ifdef CONFIG_USB_KEYBOARD
if (argc == 2) {
if (usb_kbd_deregister() != 0) {
printf("USB not stopped: usbkbd still"
" using USB\n");
return 1;
}
} else {
/* forced stop, switch console in to serial */
usb_kbd_deregister();
}
#endif
printf("stopping USB..\n");
usb_stop();
return 0;
}
if (!usb_started) {
printf("USB is stopped. Please issue 'usb start' first.\n");
return 1;
}
if (strncmp(argv[1], "tree", 4) == 0) {
printf("\nDevice Tree:\n");
usb_show_tree(usb_get_dev_index(0));
return 0;
}
if (strncmp(argv[1], "inf", 3) == 0)
{
int d1;
if (argc == 2)
{
for (d1 = 0; d1 < USB_MAX_DEVICE; d1++) {
dev = usb_get_dev_index(d1);
if (dev == NULL)
break;
usb_display_desc(dev);
usb_display_config(dev);
}
return 0;
} else
{
int d2;
i = strtoul(argv[2], NULL, 16);
printf("config for device %d\n", i);
for (d2 = 0; d2 < USB_MAX_DEVICE; d2++) {
dev = usb_get_dev_index(d2);
if (dev == NULL)
break;
if (dev->devnum == i)
break;
}
if (dev == NULL) {
printf("*** NO Device avaiable ***\n");
return 0;
} else {
usb_display_desc(dev);
usb_display_config(dev);
}
}
return 0;
}
#ifdef CONFIG_USB_STORAGE
if (strncmp(argv[1], "stor", 4) == 0)
return usb_stor_info();
#if 0
if (strncmp(argv[1], "part", 4) == 0) {
int devno, ok = 0;
if (argc == 2) {
for (devno = 0; devno < USB_MAX_STOR_DEV; ++devno) {
stor_dev = usb_stor_get_dev(devno);
if (stor_dev->type != DEV_TYPE_UNKNOWN) {
ok++;
if (devno)
printf("\n");
printf("print_part of %x\n", devno);
print_part(stor_dev);
}
}
} else {
devno = strtoul(argv[2], NULL, 16);
stor_dev = usb_stor_get_dev(devno);
if (stor_dev->type != DEV_TYPE_UNKNOWN) {
ok++;
printf("print_part of %x\n", devno);
print_part(stor_dev);
}
}
if (!ok) {
printf("\nno USB devices available\n");
return 1;
}
return 0;
}
#endif
if (strcmp(argv[1], "read") == 0) {
if (usb_stor_curr_dev < 0) {
printf("no current device selected\n");
return 1;
}
if (argc == 5) {
unsigned long addr = strtoul(argv[2], NULL, 16);
unsigned long blk = strtoul(argv[3], NULL, 16);
unsigned long cnt = strtoul(argv[4], NULL, 16);
unsigned long n;
printf("\nUSB read: device %d block # %ld, count %ld"
" ... ", usb_stor_curr_dev, blk, cnt);
stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt,
(unsigned long *)addr);
printf("%ld blocks read: %s\n", n,
(n == cnt) ? "OK" : "ERROR");
if (n == cnt)
return 0;
return 1;
}
}
if (strncmp(argv[1], "dev", 3) == 0) {
if (argc == 3) {
int device = (int)strtoul(argv[2], NULL, 10);
printf("\nUSB device %d: ", device);
if (device >= USB_MAX_STOR_DEV) {
printf("unknown device\n");
return 1;
}
printf("\n Device %d: ", device);
stor_dev = usb_stor_get_dev(device);
dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN)
return 1;
usb_stor_curr_dev = device;
printf("... is now current device\n");
return 0;
} else {
printf("\nUSB device %d: ", usb_stor_curr_dev);
stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN)
return 1;
return 0;
}
return 0;
}
#endif /* CONFIG_USB_STORAGE */
// cmd_usage(cmdtp);
return 1;
}
#if 0
#ifdef CONFIG_USB_STORAGE
U_BOOT_CMD(
usb, 5, 1, do_usb,
"USB sub-system",
"reset - reset (rescan) USB controller\n"
"usb stop [f] - stop USB [f]=force stop\n"
"usb tree - show USB device tree\n"
"usb info [dev] - show available USB devices\n"
"usb storage - show details of USB storage devices\n"
"usb dev [dev] - show or set current USB storage device\n"
"usb part [dev] - print partition table of one or all USB storage"
" devices\n"
"usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
" to memory address `addr'"
);
U_BOOT_CMD(
usbboot, 3, 1, do_usbboot,
"boot from USB device",
"loadAddr dev:part"
);
#else
U_BOOT_CMD(
usb, 5, 1, do_usb,
"USB sub-system",
"reset - reset (rescan) USB controller\n"
"usb tree - show USB device tree\n"
"usb info [dev] - show available USB devices"
);
#endif
#endif

View File

@@ -0,0 +1,6 @@
I have used gcc 4.4.3 native version and gcc 4.4.3 cross-compiler version to
compile these sources.
There are 4 targets "make ethernat", "make netusbee", "make aranym", "make ohci-pci".
If you use cross-compiler add "CROSS=yes" to the commands above.
Before compiling "ohci-pci" target you must "make clean" if you have been compiling the other targets before.
"make all" compiles the 4 targets.

View File

@@ -0,0 +1,54 @@
#ifndef _CONFIG_H
#define _CONFIG_H
//#define ARCH m68k
//#define COLDFIRE /* Besides change one(first) .chip in detxbios.S 68060 or 5200 */
//#define CONFIG_USB_ISP116X_HCD
//#define SUPERVISOR
/* Change .chip in detxbios.S 68060 or 5200 */
/*----- USB -----*/
//#define CONFIG_LEGACY_USB_INIT_SEQ
#define CONFIG_USB_STORAGE
//#define CONFIG_USB_KEYBOARD
//#define CONFIG_USB_MOUSE
//#define CONFIG_USB_INTERRUPT_POLLING
#define CONFIG_USB_ARANYM_HCD
/*----- ISP116x-HCD ------*/
#define ISP116X_HCD_USE_UDELAY
#define ISP116X_HCD_USE_EXTRA_DELAY
//#define ISP116X_HCD_SEL15kRES
//#define ISP116X_HCD_OC_ENABLE
//#define ISP116X_HCD_REMOTE_WAKEUP_ENABLE
/*----- OHCI-HCI -----*/
#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1
#define CONFIG_USB_OHCI
//#define PCI_XBIOS /* Defined in the makefile */
/*----- DEBUG -----*/
/* You should activate global debug,
* #define DEBUG_GLOBAL 1 to turn on
* #define DEBUG_GLOBAL 0 to turn off
* After global debug is enable
* you can activate the debug independently
* in each layer where debug is possible
*/
#define DEBUG_GLOBAL 1
#if DEBUG_GLOBAL
/* Define only one of the three debug posibilities below */
#define DEBUG_TO_FILE 1
#define DEBUG_TO_ARANYM 0 /* NOTE: No arguments are passed to the printf function */
#define DEBUG_TO_CONSOLE 0
/* Define which local layer you want on */
#define DEBUG_HOST_LAYER 0
#define DEBUG_USB_LAYER 0
#define DEBUG_HUB_LAYER 0
#define DEBUG_STORAGE_LAYER 0
#define DEBUG_XHDI_LAYER 0
#define DEBUG_BIOS_LAYER 0 /* NOTE: Always to console */
#endif
#endif /* _CONFIG_H */

View File

@@ -0,0 +1,64 @@
/*
* debug.c
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#if DEBUG_TO_FILE
static FILE *debug_handle = NULL;
void
debug_init(char *file)
{
char filename[20] = "";
strcpy(filename, file);
debug_handle = fopen(filename, "a");
if (debug_handle != NULL)
setvbuf (debug_handle, NULL, _IONBF, 0);
}
void debug_exit(void)
{
if (debug_handle != NULL && debug_handle != stdout)
fclose(debug_handle);
debug_handle = NULL;
}
void debug(char *FormatString, ...)
{
va_list arg_ptr;
va_start(arg_ptr, FormatString);
vfprintf(debug_handle, FormatString, arg_ptr);
va_end(arg_ptr);
fflush(debug_handle);
}
#endif

View File

@@ -0,0 +1,97 @@
/*
* debug.h
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _DEBUG_H
#define _DEBUG_H
#include "config.h"
#include "host/aranym/nf_ops.h"
void debug_init ( char *file);
void debug_exit ( void );
void debug (char *FormatString, ...);
/* You should activate global debug in config.h, uncommenting the #define DEBUG line */
/* After global debug is enable you can activate them independly in each file */
#if DEBUG_GLOBAL
#if DEBUG_TO_FILE
#define DEBUG(fmt, args...) debug_init("usb.log"); \
debug( "%s: "fmt"\n\r" , __FUNCTION__, ##args); \
debug_exit( )
#endif /* DEBUG_TO_FILE */
#if DEBUG_TO_ARANYM
#define DEBUG(fmt, args...) nf_debug(fmt )
#endif /* DEBUG_TO_ARANYM */
#if DEBUG_TO_CONSOLE
#define DEBUG(fmt, args...) printf("%s: "fmt"\n\r" , __FUNCTION__, ##args)
#endif /* DEBUG_TO_CONSOLE */
/* This allows control debug messages independenly for different layers */
#if DEBUG_HOST_LAYER
#define DEBUG_HOST(fmt, args...) DEBUG(fmt, ##args)
#else
#define DEBUG_HOST(fmt, args...) {}
#endif
#if DEBUG_USB_LAYER
#define DEBUG_USB(fmt, args...) DEBUG(fmt, ##args)
#else
#define DEBUG_USB(fmt, args...) {}
#endif
#if DEBUG_HUB_LAYER
#define DEBUG_HUB(fmt, args...) DEBUG(fmt, ##args)
#else
#define DEBUG_HUB(fmt, args...) {}
#endif
#if DEBUG_STORAGE_LAYER
#define DEBUG_STORAGE(fmt, args...) DEBUG(fmt, ##args)
#else
#define DEBUG_STORAGE(fmt, args...) {}
#endif
#if DEBUG_XHDI_LAYER
#define DEBUG_XHDI(fmt, args...) DEBUG(fmt, ##args)
#else
#define DEBUG_XHDI(fmt, args...) {}
#endif
#else
#define DEBUG(fmt, args...) {}
#if DEBUG_HOST_LAYER
#define DEBUG_HOST(fmt, args...) DEBUG(fmt, ##args)
#endif
#define DEBUG(fmt, args...) {}
#if DEBUG_USB_LAYER
#define DEBUG_USB(fmt, args...) DEBUG(fmt, ##args)
#endif
#if DEBUG_HUB_LAYER
#define DEBUG_HUB(fmt, args...) DEBUG(fmt, ##args)
#endif
#if DEBUG_STORAGE_LAYER
#define DEBUG_STORAGE(fmt, args...) DEBUG(fmt, ##args)
#endif
#if DEBUG_XHDI_LAYER
#define DEBUG_XHDI(fmt, args...) DEBUG(fmt, ##args)
#endif
#endif /* DEBUG_GLOBAL */
#endif /* _DEBUG_H */

View File

@@ -0,0 +1,840 @@
/* Debug the CT60
*
* Didier Mequignon, 2003-2006, e-mail: aniplay@wanadoo.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
.chip 68040
.globl exception
#ifdef COLDFIRE
.globl null
#include "fire.h"
#endif
#include "vars.h"
#define DEBUG
#ifdef DEBUG
.global display_string,hex_long,hex_word,hex_byte,display_char,wait_key,_debug
#endif
.text
#ifdef COLDFIRE
null:
clr.l 0x380 // not valid
move.l SP,0x3C0
move.l A6,0x3BC
lea 0x384,A6
movem.l D0-D7/A0-A5,(A6)
clr.l 0x3C8 // USP
moveq #-1,D1
#endif
exception:
clr.l memvalid
lea.l mess1(PC),A0
bsr display_string
#ifdef COLDFIRE
ext.l D1
addq.l #1,D1
move.l D1,D7 // vector number
#else
addq.w #1,D1
move.w D1,D7 // vector number
#endif
moveq #0,D0
move.w D7,D0
#ifdef COLDFIRE
.chip 68060
divu #10,D0
.chip 5200
move.l D0,D1
and.l #7,D0
beq.s .ex1
or.l #0x30,D0
bsr display_char
.ex1:
swap D1
move.w D1,D0
or.l #0x30,D0
#else
divu #10,D0
and.w #7,D0
beq.s .ex1
or.w #0x30,D0
bsr display_char
.ex1:
swap d0
or.w #0x30,D0
#endif
bsr display_char
moveq #0x3A,D0
bsr display_char
moveq #0x20,D0
bsr display_char
lea.l tab_mess_exc(PC),A0
move.w D7,D0
bsr display_tab
moveq #13,D0
bsr display_char
moveq #10,D0
bsr display_char
#ifdef COLDFIRE
tst.w D7
beq .ex0
#endif
lea.l mess2(PC),A0 // SR
bsr display_string
#ifdef COLDFIRE
move.w save_sr,D0 // SR
#else
move.l 0x3C0,A0 //SSP
move.w (A0),D0
#endif
bsr hex_word // SR
lea.l mess3(PC),A0
bsr display_string
#ifdef COLDFIRE
move.w save_sr,D2 // SR
and.l #0xB71F,D2
#else
move.l 0x3C0,A0 //SSP
move.w (A0),D2 // SR
and.w #0xB71F,D2
#endif
lea.l tab_status(PC),A1
moveq #15,D1
.ex5:
btst.l D1,D2
beq.s .ex6
moveq #0,D0
move.b (A1,D1),D0
move.w D0,D3
#ifdef COLDFIRE
and.l #0xF8,D3
cmp.l #0x30,D3
#else
and.w #0xF8,D3
cmp.w #0x30,D3
#endif
bne.s .ex4
move.w D0,-(SP)
moveq #0x49,D0 // I
bsr display_char
move.w (SP)+,D0
.ex4:
bsr display_char
moveq #0x20,D0
bsr display_char
.ex6:
#ifdef COLDFIRE
subq.l #1,D1
bpl.s .ex5
.ex0:
#else
dbf D1,.ex5
#endif
lea.l mess4(PC),A0 // PC
bsr display_string
#ifdef COLDFIRE
move.l save_pc,D0 // PC
#else
move.l 0x3C0,A0 // SSP
move.l 2(A0),D0 // PC
#endif
bsr hex_long
lea.l mess10(PC),A0 // Basepage
bsr display_string
move.l 0x6EE4,D0
bsr hex_long
#ifdef COLDFIRE
tst.w D7
beq .ex2
#endif
lea.l mess5(PC),A0 // CACR
bsr display_string
#ifdef COLDFIRE
.chip 68060
movec.l CACR,D0 // from value stored in the CF68KLIB
.chip 5200
bsr hex_long
cmp.l #2,D7
bne.s .ex2
lea.l mess6(PC),A0 // address fault
bsr display_string
move.l address_fault,D0 // from value stored in the CF68KLIB
bsr hex_long
#else /* ATARI - CT60 */
movec.l CACR,D0
bsr hex_long
cmp.w #2,D7
beq.s .ex3 // Acces Fault
cmp.w #3,D7
beq.s .ex3 // Adress Error
cmp.w #5,D7
beq.s .ex3 // Zero Divide
cmp.w #9,D7
bne .ex2 // <> Trace
.ex3:
lea.l mess6(PC),A0 // address fault
bsr display_string
move.l 0x3C0,A0 // SSP
move.l 8(A0),D0 // address fault
bsr hex_long
cmp.w #2,D7
bne .ex2 // <> Acces Fault
lea.l mess7(PC),A0 // FSLW
bsr display_string
move.l 0x3C0,A0 // SSP
move.l 12(A0),D0 // FSLW
bsr hex_long
lea.l mess3(PC),A0
bsr display_string
moveq #13,D0
bsr display_char
moveq #10,D0
bsr display_char
move.l 0x3C0,A0 // SSP
move.l 12(A0),D2 // FSLW
and.l #0x0BFFFFFD,D2
lea.l tab_fslw1(PC),A1
lea.l tab_fslw2(PC),A2
lea.l tab_fslw3(PC),A3
moveq #31,D1
moveq #0,D3
.ex13:
btst.l D1,D2
beq.s .ex14
moveq #0,D0
move.b (A1,D3),D0
bsr display_char
moveq #0,D0
move.b (A2,D3),D0
cmp.b #0x20,D0
beq.s .ex12
bsr display_char
moveq #0,D0
move.b (A3,D3),D0
cmp.b #0x20,D0
beq.s .ex12
bsr display_char
.ex12:
moveq #0x20,D0
bsr display_char
.ex14:
addq.w #1,D3
dbf D1,.ex13
#endif /* COLDFIRE */
.ex2:
lea.l mess8(PC),A0 // SSP
bsr display_string
move.l 0x3C0,D0 // SSP
bsr hex_long
lea.l mess9(PC),A0 // USP
bsr display_string
move.l 0x3C8,D0 // USP
bsr hex_long
lea.l 0x384,A1 // registers
lea.l 32(A1),A2
moveq #7,D1
.ex8:
moveq #13,D0
bsr display_char
moveq #10,D0
bsr display_char
moveq #0x44,D0
bsr display_char
moveq #7,D0
#ifdef COLDFIRE
sub.l D1,D0
or.l #0x30,D0
#else
sub.w D1,D0
or.w #0x30,D0
#endif
move.w D0,-(SP)
bsr display_nb
move.l (A1),D0
bsr hex_long // data registers
moveq #0x20,D0
bsr display_char
tst.w D1
beq.s .ex9
moveq #0x41,D0
bsr display_char
move.w (SP),D0
bsr display_nb
move.l (A2),D0
bsr hex_long // address registers
moveq #0x20,D0
bsr display_char
.ex9:
addq.l #2,SP
addq.l #4,A1
addq.l #4,A2
#ifdef COLDFIRE
subq.l #1,D1
bpl.s .ex8
#else
dbf D1,.ex8
#endif
moveq #13,D0
bsr display_char
.loop_wait_key:
#ifdef COLDFIRE
#ifdef DEBUG
move.w #1,-(SP) // AUX
#else
move.w #2,-(SP) // CON
#endif
#else
move.w #2,-(SP) // CON
#endif
move.w #2,-(SP) // Bconin
trap #13
addq.l #4,SP
ext.l D0
move.l D0,-(SP)
move.l #0x5F504349,D0
lea 0xED0000,A0 // 128 KB
cmp.l (A0),D0 // _PCI
beq.s .pci_drivers
lea 0xEC0000,A0 // 192 KB
cmp.l (A0),D0 // _PCI
beq.s .pci_drivers
lea 0xEB0000,A0 // 256 KB
cmp.l (A0),D0 // _PCI
beq.s .pci_drivers
lea 0xEA0000,A0 // 320 KB
cmp.l (A0),D0 // _PCI
bne.s .no_pci_drivers
.pci_drivers:
jsr 40(A0) // drivers PCI in flash, add dbug (68k disassembler)
move.l D0,(SP)
bne .no_pci_drivers
addq.l #4,SP
bra.s .loop_wait_key
.no_pci_drivers:
move.l (SP)+,D0
#ifdef COLDFIRE
and.l #0xFF,D0
cmp.l #0x6D,D0 // m
#else
cmp.b #0x6D,D0 // m
#endif
beq.s .memory_dump
#ifdef COLDFIRE
cmp.l #0x70,D0 // p
#else
cmp.b #0x70,D0 // p
#endif
beq.s .patch_memory
#ifdef DEBUG
#ifdef COLDFIRE
cmp.l #0x20,D0
#else
cmp.b #0x20,D0
#endif
bne .loop_wait_key
lea mess14(PC),A0
bsr display_string
#endif
rts
.memory_dump:
lea mess11(PC),A0 // memory dump
bsr display_string
bsr get_hex_value
move.l D0,A0
bsr dump
bra .loop_wait_key
.patch_memory:
lea mess12(PC),A0 // patch memory
bsr display_string
bsr get_hex_value
move.l D0,A1
lea mess13(PC),A0 // value
bsr display_string
bsr get_hex_value
cmp.l #0x100,D0
bcc.s .word_value
move.b D0,(A1)
lea crlf(PC),A0
bsr display_string
move.l A1,D0
bsr hex_long
moveq #0x20,D0
bsr display_char
move.b (A1),D0
bsr hex_byte
bra .loop_wait_key
.word_value:
cmp.l #0x10000,D0
bcc.s .long_value
move.w D0,(A1)
lea crlf(PC),A0
bsr display_string
move.l A1,D0
bsr hex_long
moveq #0x20,D0
bsr display_char
move.w (A1),D0
bsr hex_word
bra .loop_wait_key
.long_value:
move.l D0,(A1)
lea crlf(PC),A0
bsr display_string
move.l A1,D0
bsr hex_long
moveq #0x20,D0
bsr display_char
move.l (A1),D0
bsr hex_long
bra .loop_wait_key
display_nb:
bsr display_char
moveq #0x3A,D0
bsr display_char
moveq #0x24,D0
bsr display_char
rts
display_tab:
#ifdef COLDFIRE
move.l D1,-(SP)
#endif
move.w D0,-(SP)
moveq #0,D0
.dt1:
#ifdef COLDFIRE
move.b (A0),D1
extb.l D1
cmp.l #-1,D1
beq.s .dt3
moveq #0,D1
move.w (SP),D1
cmp.l D1,D0
#else
cmp.b #-1,(A0)
beq.s .dt3
cmp.w (SP),D0
#endif
beq.s .dt4
.dt2:
tst.b (A0)+
bne.s .dt2
#ifdef COLDFIRE
addq.l #1,D0
#else
addq.w #1,D0
#endif
bra.s .dt1
.dt4:
bsr display_string
.dt3:
addq.l #2,SP
#ifdef COLDFIRE
move.l (SP)+,D1
#endif
rts
hex_long:
move.l D0,-(SP)
swap D0
bsr.s hex_word
move.l (SP)+,D0
hex_word:
move.w D0,-(SP)
#ifdef COLDFIRE
lsr.l #8,D0
bsr.s hex_byte
move.w (SP)+,D0
hex_byte:
move.w D0,-(SP)
lsr.l #4,D0
bsr.s hex_char
move.w (SP)+,D0
hex_char:
and.l #0xF,D0
or.l #0x30,D0
cmp.l #0x3A,D0
bcs.s display_char
addq.l #7,D0
display_char:
and.l #0xFF,D0
#ifdef DEBUG /* warning !!! If serial mouse */
move.l D1,-(SP)
.wait_uart:
move.b MCF_UART_USR0,D1
and.l #MCF_UART_USR_TXRDY,D1
beq.s .wait_uart
move.b D0,MCF_UART_UTB0 // send the character
move.l (SP)+,D1
#else
lea -24(SP),SP
movem.l D0-D2/A0-A2,(SP)
move.w D0,-(sp)
move.w #2,-(SP)
move.w #3,-(SP) // Bconout
trap #13
addq.l #6,SP
movem.l (SP),D0-D2/A0-A2
lea 24(SP),SP
#endif /* DEBUG */
rts
#else /* ATARI */
lsr.w #8,D0
bsr.s hex_byte
move.w (SP)+,D0
hex_byte:
move.w D0,-(SP)
lsr.b #4,D0
bsr.s hex_char
move.w (SP)+,D0
hex_char:
and.b #0xF,D0
or.b #0x30,D0
cmp.b #0x3A,D0
bcs.s display_char
addq.b #7,D0
display_char:
and.w #0xFF,D0
movem.l D0-D2/A0-A2,-(SP)
move.w D0,-(sp)
move.w #2,-(SP)
move.w #3,-(SP) // Bconout
trap #13
addq.l #6,SP
movem.l (SP)+,D0-D2/A0-A2
rts
#endif /* COLDFIRE */
display_string:
#ifdef COLDFIRE
move.l D0,-(SP)
move.l A0,-(SP)
#else
movem.l D0/A0,-(SP)
#endif
.os2:
move.b (A0)+,D0
beq.s .os1
bsr display_char
bra.s .os2
.os1:
#ifdef COLDFIRE
move.l (SP)+,A0
move.l (SP)+,D0
#else
movem.l (SP)+,D0/A0
#endif
rts
get_hex_value:
#ifdef COLDFIRE
lea -56(SP),SP
movem.l D1-A5,(SP)
link A6,#-8
moveq #0,D7
.loop_get_value:
#ifdef DEBUG
move.w #1,-(SP) // AUX
#else
move.w #2,-(SP) // CON
#endif
move.w #2,-(SP) // Bconin
trap #13
addq.l #4,SP
and.l #0xFF,D0
cmp.l #13,D0
beq.s .conv_get_value
cmp.l #8,D0
bne.s .not_backspace
tst.w D7
ble.s .loop_get_value
bsr display_char
subq.l #1,D7
bra.s .loop_get_value
.not_backspace:
cmp.l #0x30,D0
bcs.s .loop_get_value
cmp.l #0x39,D0
bls.s .number_value
cmp.l #0x41,D0
bcs.s .loop_get_value
cmp.l #0x46,D0
bls.s .letter_value
cmp.l #0x61,D0
bcs.s .loop_get_value
cmp.l #0x66,D0
bhi.s .loop_get_value
.letter_value:
bsr display_char
and.l #0x0F,D0
add.l #9,D0
bra.s .store_value
.number_value:
bsr display_char
and.l #0x0F,D0
.store_value:
move.b D0,-8(A6,D7)
addq.l #1,D7
cmp.l #8,D7
bcs .loop_get_value
.conv_get_value:
moveq #0,D0
subq.l #1,D7
bmi.s .end_get_value
moveq #0,D6
.loop_value:
asl.l #4,D0
moveq #0,D1
move.b -8(A6,D6),D1
or.l D1,D0
addq.l #1,D6
subq.l #1,D7
bpl.s .loop_value
.end_get_value:
tst.l D0
unlk A6
movem.l (SP),D1-A5
lea 56(SP),SP
#else /* ATARI */
movem.l D1-A5,-(SP)
link A6,#-8
moveq #0,D7
.loop_get_value:
move.w #2,-(SP) // CON
move.w #2,-(SP) // Bconin
trap #13
addq.l #4,SP
cmp.b #13,D0
beq.s .conv_get_value
cmp.b #8,D0
bne.s .not_backspace
tst.w D7
ble.s .loop_get_value
bsr display_char
subq.w #1,D7
bra.s .loop_get_value
.not_backspace:
cmp.b #0x30,D0
bcs.s .loop_get_value
cmp.b #0x39,D0
bls.s .number_value
cmp.b #0x41,D0
bcs.s .loop_get_value
cmp.b #0x46,D0
bls.s .letter_value
cmp.b #0x61,D0
bcs.s .loop_get_value
cmp.b #0x66,D0
bhi.s .loop_get_value
.letter_value:
bsr display_char
and.b #0x0F,D0
add.b #9,D0
bra.s .store_value
.number_value:
bsr display_char
and.b #0x0F,D0
.store_value:
move.b D0,-8(A6,D7)
addq.w #1,D7
cmp.w #8,D7
bcs.s .loop_get_value
.conv_get_value:
moveq #0,D0
subq.w #1,D7
bmi.s .end_get_value
moveq #0,D6
.loop_value:
asl.l #4,D0
or.b -8(A6,D6),D0
addq.w #1,D6
dbf D7,.loop_value
.end_get_value:
tst.l D0
unlk A6
movem.l (SP)+,D1-A5
#endif /* COLDFIRE */
rts
dump:
#ifdef COLDFIRE
lea -20(SP),SP
movem.l D0-D2/A0-A1,(SP)
#else
movem.l D0-D2/A0-A1,-(SP)
#endif
move.l A0,A1
moveq #3,D1
.loop_dump1:
lea crlf(PC),A0
bsr display_string
move.l A1,D0
bsr hex_long
moveq #0x20,D0
bsr display_char
moveq #15,D2
.loop_dump2:
move.b (A1)+,D0
bsr hex_byte
moveq #0x20,D0
bsr display_char
#ifdef COLDFIRE
subq.l #1,D2
bpl.s .loop_dump2
#else
dbf D2,.loop_dump2
#endif
lea -16(A1),A1
moveq #15,D2
.loop_dump3:
move.b (A1)+,D0
#ifdef COLDFIRE
and.l #0xFF,D0
cmp.l #0x20,D0
bcs.s .dump_bad_char
cmp.l #0x7F,D0
#else
cmp.b #0x20,D0
bcs.s .dump_bad_char
cmp.b #0x7F,D0
#endif
bcs.s .dump_ok
.dump_bad_char:
moveq #0x2E,D0
.dump_ok:
bsr display_char
#ifdef COLDFIRE
subq.l #1,D2
bpl.s .loop_dump3
subq.l #1,D1
bpl.s .loop_dump1
movem.l (SP),D0-D2/A0-A1
lea 20(SP),SP
#else
dbf D2,.loop_dump3
dbf D1,.loop_dump1
movem.l (SP)+,D0-D2/A0-A1
#endif
rts
crlf: .byte 13,10,0
mess1: .byte 13,10
.asciz "EXCEPTION PROCESSING "
mess2: .byte 13,10
.asciz "Status Register (SR): $"
mess3: .asciz ", bits to 1: "
mess4: .byte 13,10
.asciz "Program Counter (PC): $"
mess5: .byte 13,10
.asciz "Cache Register (CACR): $"
mess6: .byte 13,10
.asciz "Address Fault: $"
mess7: .byte 13,10
.asciz "Fault Status Word (FSLW): "
mess8: .byte 13,10
.asciz "Supervisor Stack (SSP): $"
mess9: .byte 13,10
.asciz "User Stack (USP): $"
mess10: .byte 13,10
.asciz "Basepage: $"
mess11: .byte 13,10
.asciz "Memory dump (hex) ? "
mess12: .byte 13,10
.asciz "Patch memory (hex) ? "
mess13: .byte 13,10
.asciz "Value (hex) ? "
mess14: .byte 13,10
.ascii "Pterm"
.byte 13,10,0
tab_mess_exc:
#ifdef COLDFIRE
.asciz "Null (jump or call)"
#else
.byte 0
#endif
.byte 0
.asciz "Access Fault"
.asciz "Address Error"
.asciz "Illegal Instruction"
.asciz "Integer Zero Divide"
.byte 0
.byte 0
.asciz "Privilege Violation"
.asciz "Trace"
.asciz "Line A"
.asciz "Line F"
.asciz "Emulator Interrupt"
.byte 0
.asciz "Format Error"
.asciz "Uninitialised Interrupt"
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.asciz "Spurious Interrupt"
.asciz "Interrupt level 1"
.asciz "Interrupt level 2"
.asciz "Interrupt level 3"
.asciz "Interrupt level 4"
.asciz "Interrupt level 5"
.asciz "Interrupt level 6"
.asciz "Interrupt level 7"
.asciz "Trap #0"
.asciz "Trap #1"
.asciz "Trap #2"
.asciz "Trap #3"
.asciz "Trap #4"
.asciz "Trap #5"
.asciz "Trap #6"
.asciz "Trap #7"
.asciz "Trap #8"
.asciz "Trap #9"
.asciz "Trap #10"
.asciz "Trap #11"
.asciz "Trap #12"
.asciz "Trap #13"
.asciz "Trap #14"
.asciz "Trap #15"
.byte -1
tab_status: .ascii "CVZNX 012 MS T"
tab_fslw1: .ascii " M LRWSSTTTTTIPSPPIPSWTRWTB S"
tab_fslw2: .ascii " A K ZZTTMMMOBBTTLFPPWEETP S"
tab_fslw3: .ascii " 1010210 EEAB E RE E"

View File

@@ -0,0 +1,150 @@
/*
NatFeat USB host chip emulator
ARAnyM (C) 2010 David Gálvez
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*--- Include ---*/
#include <stdlib.h>
#include <string.h>
#include <mint/cookie.h>
#include <mint/osbind.h>
#include "nf_ops.h"
#include "usbhost_nfapi.h"
#include "../../config.h"
#include "../../asm-m68k/io.h"
#include "../../usb.h"
#include "../../debug.h"
/*--- Defines ---*/
#ifndef EINVFN
#define EINVFN -32
#endif
#ifndef DEV_CONSOLE
#define DEV_CONSOLE 2
#endif
#define DRIVER_NAME "ARAnyM USB host chip emulator"
#define VERSION "v0.1"
/*--- Functions prototypes ---*/
static void press_any_key(void);
/*--- Local variables ---*/
static struct nf_ops *nfOps;
static unsigned long nfUsbHostId;
/*--- Functions ---*/
static void press_any_key(void)
{
(void) Cconws("- Press any key to continue -\r\n");
while (Bconstat(DEV_CONSOLE) == 0) { };
}
/* --- Transfer functions -------------------------------------------------- */
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int len, int interval)
{
int r;
r = nfOps->call(USBHOST(USBHOST_SUBMIT_INT_MSG), dev, pipe, buffer, len, interval);
return 0;
}
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int len, struct devrequest *setup)
{
int r;
r = nfOps->call(USBHOST(USBHOST_SUBMIT_CONTROL_MSG), dev, pipe, buffer, len, setup);
return r;
}
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int len)
{
int r;
r = nfOps->call(USBHOST(USBHOST_SUBMIT_BULK_MSG), dev, pipe, buffer, len);
return 0;
}
/* --- Init functions ------------------------------------------------------ */
int usb_lowlevel_init(void)
{
int r;
(void) Cconws(
"\033p " DRIVER_NAME " " VERSION " \033q\r\n"
"Copyright (c) ARAnyM Development Team, " __DATE__ "\r\n"
);
nfOps = nf_init();
if (!nfOps) {
(void) Cconws("__NF cookie not present on this system\r\n");
press_any_key();
return 0;
}
nfUsbHostId=nfOps->get_id("USBHOST");
if (nfUsbHostId == 0) {
(void) Cconws("NF USBHOST functions not present on this system\r\n");
press_any_key();
}
/* List present devices */
r = nfOps->call(USBHOST(USBHOST_LOWLEVEL_INIT));
if (!r)
(void) Cconws(" USB Init \r\n");
else
(void) Cconws(" Couldn't init aranym host chip emulator \r\n");
return 0;
}
int usb_lowlevel_stop(void)
{
int r;
r = nfOps->call(USBHOST(USBHOST_LOWLEVEL_STOP));
return 0;
}

View File

@@ -0,0 +1,118 @@
/*
* ARAnyM native features interface.
* (c) 2005-2008 ARAnyM development team
*
* In 2006 updated with FreeMiNT headers and code.
* In 2008 converted from "__NF" cookie to direct usage of NF instructions
*
**/
/*
* Copied from FreeMiNT source tree where Native Features were added recently
*
* Copyright 2003 Frank Naumann <fnaumann@freemint.de>
* All rights reserved.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* Author: Frank Naumann <fnaumann@freemint.de>
* Started: 2003-12-13
*
*/
# include <compiler.h>
# include <mint/osbind.h>
# include "nf_ops.h"
#define ARANYM 1
# ifdef ARANYM
static unsigned long nf_get_id_instr = 0x73004e75UL;
static unsigned long nf_call_instr = 0x73014e75UL;
static struct nf_ops _nf_ops = { (void*)&nf_get_id_instr, (void*)&nf_call_instr };
static struct nf_ops *nf_ops = 0UL;
extern int detect_native_features(void);
struct nf_ops *
nf_init(void)
{
if (Supexec(detect_native_features))
{
nf_ops = &_nf_ops;
return nf_ops;
}
return 0UL;
}
const char *
nf_name(void)
{
static char buf[64] = "Unknown emulator";
if (nf_ops)
{
static int done = 0;
if (!done)
{
long nfid_name = nf_ops->get_id("NF_NAME");
if (nfid_name)
nf_ops->call(nfid_name, buf, sizeof(buf));
done = 1;
}
}
return buf;
}
int
nf_debug(const char *msg)
{
if (nf_ops)
{
long nfid_stderr = nf_ops->get_id("NF_STDERR");
if (nfid_stderr)
{
nf_ops->call(nfid_stderr, msg);
return 1;
}
}
return 0;
}
void
nf_shutdown(void)
{
if (nf_ops)
{
long shutdown_id = nf_ops->get_id("NF_SHUTDOWN");
if (shutdown_id)
nf_ops->call(shutdown_id);
}
}
# endif

View File

@@ -0,0 +1,76 @@
/*
* ARAnyM native features interface.
* (c) 2005-2008 ARAnyM development team
*
* In 2006 updated with FreeMiNT headers and code.
* In 2008 converted from "__NF" cookie to direct usage of NF instructions
*
**/
/*
* Copied from FreeMiNT source tree where Native Features were added recently
*
* Copyright 2003 Frank Naumann <fnaumann@freemint.de>
* All rights reserved.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* Author: Frank Naumann <fnaumann@freemint.de>
* Started: 2003-12-13
*
* please send suggestions, patches or bug reports to me or
* the MiNT mailing list
*
*/
#define ARANYM 1
# ifdef ARANYM
.text
.globl _detect_native_features
/*
* NatFeats test (routine retuns TRUE/FALSE (1/0) in D0)
*/
_detect_native_features:
clr.l d0 // assume no NatFeats available
move.l sp,a1 // save the ssp
move.l (0x0010).w,a0 // illegal instruction vector
move.l #fail_natfeat,(0x0010).w
nop // flush pipelines (for 68040+)
pea (nf_version_name).w(pc)
subq.l #4,sp
dc.w 0x7300 // Jump to NATFEAT_ID
tst.l d0
beq.s fail_natfeat
moveq #1,d0 // NatFeats detected
fail_natfeat:
move.l a1,sp
move.l a0,(0x0010).w
nop // flush pipelines (for 68040+)
rts
nf_version_name:
.ascii "NF_VERSION\0"
# endif

View File

@@ -0,0 +1,63 @@
/*
* $Id: nf_ops.h,v 1.2 2006-01-31 16:21:22 standa Exp $
*
* ARAnyM Native Features suite.
*
* This file was taken from FreeMiNT.
*
* Copyright 2003 Frank Naumann <fnaumann@freemint.de>
* All rights reserved.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* Author: Frank Naumann <fnaumann@freemint.de>
* Started: 2003-12-14
*
* Please send suggestions, patches or bug reports to me or
* the MiNT mailing list.
*
*/
# ifndef _m68k_nf_ops_h
# define _m68k_nf_ops_h
#include <compiler.h> /* for __CDECL */
struct nf_ops
{
long __CDECL (*get_id)(const char *);
long __CDECL (*call)(long id, ...);
long res[3];
};
/**
* Use this function to intialize Native Features.
*
* @return the pointer to 'struct nf_ops' or NULL when
* not available.
**/
struct nf_ops *nf_init(void);
/* basic set native feature functions */
const char *nf_name(void);
int nf_debug(const char *msg);
void nf_shutdown(void);
# endif /* _m68k_nf_ops_h */

View File

@@ -0,0 +1,40 @@
/*
NatFeat USB Host chip emulator
ARAnyM (C) 2010 David Gálvez
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _USBHOST_NFAPI_H
#define _USBHOST_NFAPI_H
/* if you change anything in the enum {} below you have to increase
this ARAUSBHOST_NFAPI_VERSION!
*/
#define ARAUSBHOST_NFAPI_VERSION 0x00000000
enum {
GET_VERSION = 0, /* no parameters, return NFAPI_VERSION in d0 */
USBHOST_LOWLEVEL_INIT,
USBHOST_LOWLEVEL_STOP,
USBHOST_SUBMIT_CONTROL_MSG,
USBHOST_SUBMIT_INT_MSG,
USBHOST_SUBMIT_BULK_MSG
};
#define USBHOST(a) (nfUsbHostId + a)
#endif /* _USBHOST_NFAPI_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,542 @@
/*
* Modified for Atari-EtherNat by David Gálvez 2010
*
* ISP116x register declarations and HCD data structures
*
* Copyright (C) 2007 Rodolfo Giometti <giometti@linux.it>
* Copyright (C) 2007 Eurotech S.p.A. <info@eurotech.it>
* Copyright (C) 2005 Olav Kongas <ok@artecdesign.ee>
* Portions:
* Copyright (C) 2004 Lothar Wassmann
* Copyright (C) 2004 Psion Teklogix
* Copyright (C) 2004 David Brownell
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _ETHERNAT_ISP116X_H
#define _ETHERNAT_ISP116X_H
#define ERR(fmt, args...) printf("isp116x: %s: " fmt "\n\r" , __FUNCTION__ , ## args)
#define WARN(fmt, args...) printf("isp116x: %s: " fmt "\n\r" , __FUNCTION__ , ## args)
#define INFO(fmt, args...) printf("isp116x: " fmt "\n\r" , ## args)
/* ------------------------------------------------------------------------- */
/* us of 1ms frame */
#define MAX_LOAD_LIMIT 850
/* Full speed: max # of bytes to transfer for a single urb
at a time must be < 1024 && must be multiple of 64.
832 allows transfering 4kiB within 5 frames. */
#define MAX_TRANSFER_SIZE_FULLSPEED 832
/* Low speed: there is no reason to schedule in very big
chunks; often the requested long transfers are for
string descriptors containing short strings. */
#define MAX_TRANSFER_SIZE_LOWSPEED 64
/* Bytetime (us), a rough indication of how much time it
would take to transfer a byte of useful data over USB */
#define BYTE_TIME_FULLSPEED 1
#define BYTE_TIME_LOWSPEED 20
/* Buffer sizes */
#define ISP116x_BUF_SIZE 4096
#define ISP116x_ITL_BUFSIZE 0
#define ISP116x_ATL_BUFSIZE ((ISP116x_BUF_SIZE) - 2*(ISP116x_ITL_BUFSIZE))
#define ISP116x_WRITE_OFFSET 0x80
/* --- ISP116x address registers in EtherNAT --------------------------------*/
#define ISP116X_HCD_ADDR 0x80000016
#define ISP116X_HCD_DATA 0x80000012
#define ETHERNAT_CPLD_CR 0x80000023 /* 0x80000023 - 1 */
/* --- ISP116x registers/bits ---------------------------------------------- */
#define HCREVISION 0x00
#define HCCONTROL 0x01
#define HCCONTROL_HCFS (3 << 6) /* host controller
functional state */
#define HCCONTROL_USB_RESET (0 << 6)
#define HCCONTROL_USB_RESUME (1 << 6)
#define HCCONTROL_USB_OPER (2 << 6)
#define HCCONTROL_USB_SUSPEND (3 << 6)
#define HCCONTROL_RWC (1 << 9) /* remote wakeup connected */
#define HCCONTROL_RWE (1 << 10) /* remote wakeup enable */
#define HCCMDSTAT 0x02
#define HCCMDSTAT_HCR (1 << 0) /* host controller reset */
#define HCCMDSTAT_SOC (3 << 16) /* scheduling overrun count */
#define HCINTSTAT 0x03
#define HCINT_SO (1 << 0) /* scheduling overrun */
#define HCINT_WDH (1 << 1) /* writeback of done_head */
#define HCINT_SF (1 << 2) /* start frame */
#define HCINT_RD (1 << 3) /* resume detect */
#define HCINT_UE (1 << 4) /* unrecoverable error */
#define HCINT_FNO (1 << 5) /* frame number overflow */
#define HCINT_RHSC (1 << 6) /* root hub status change */
#define HCINT_OC (1 << 30) /* ownership change */
#define HCINT_MIE (1 << 31) /* master interrupt enable */
#define HCINTENB 0x04
#define HCINTDIS 0x05
#define HCFMINTVL 0x0d
#define HCFMREM 0x0e
#define HCFMNUM 0x0f
#define HCLSTHRESH 0x11
#define HCRHDESCA 0x12
#define RH_A_NDP (0x3 << 0) /* # downstream ports */
#define RH_A_PSM (1 << 8) /* power switching mode */
#define RH_A_NPS (1 << 9) /* no power switching */
#define RH_A_DT (1 << 10) /* device type (mbz) */
#define RH_A_OCPM (1 << 11) /* overcurrent protection
mode */
#define RH_A_NOCP (1 << 12) /* no overcurrent protection */
#define RH_A_POTPGT (0xff << 24) /* power on -> power good
time */
#define HCRHDESCB 0x13
#define RH_B_DR (0xffff << 0) /* device removable flags */
#define RH_B_PPCM (0xffff << 16) /* port power control mask */
#define HCRHSTATUS 0x14
#define RH_HS_LPS (1 << 0) /* local power status */
#define RH_HS_OCI (1 << 1) /* over current indicator */
#define RH_HS_DRWE (1 << 15) /* device remote wakeup
enable */
#define RH_HS_LPSC (1 << 16) /* local power status change */
#define RH_HS_OCIC (1 << 17) /* over current indicator
change */
#define RH_HS_CRWE (1 << 31) /* clear remote wakeup
enable */
#define HCRHPORT1 0x15
#define RH_PS_CCS (1 << 0) /* current connect status */
#define RH_PS_PES (1 << 1) /* port enable status */
#define RH_PS_PSS (1 << 2) /* port suspend status */
#define RH_PS_POCI (1 << 3) /* port over current
indicator */
#define RH_PS_PRS (1 << 4) /* port reset status */
#define RH_PS_PPS (1 << 8) /* port power status */
#define RH_PS_LSDA (1 << 9) /* low speed device attached */
#define RH_PS_CSC (1 << 16) /* connect status change */
#define RH_PS_PESC (1 << 17) /* port enable status change */
#define RH_PS_PSSC (1 << 18) /* port suspend status
change */
#define RH_PS_OCIC (1 << 19) /* over current indicator
change */
#define RH_PS_PRSC (1 << 20) /* port reset status change */
#define HCRHPORT_CLRMASK (0x1f << 16)
#define HCRHPORT2 0x16
#define HCHWCFG 0x20
#define HCHWCFG_15KRSEL (1 << 12)
#define HCHWCFG_CLKNOTSTOP (1 << 11)
#define HCHWCFG_ANALOG_OC (1 << 10)
#define HCHWCFG_DACK_MODE (1 << 8)
#define HCHWCFG_EOT_POL (1 << 7)
#define HCHWCFG_DACK_POL (1 << 6)
#define HCHWCFG_DREQ_POL (1 << 5)
#define HCHWCFG_DBWIDTH_MASK (0x03 << 3)
#define HCHWCFG_DBWIDTH(n) (((n) << 3) & HCHWCFG_DBWIDTH_MASK)
#define HCHWCFG_INT_POL (1 << 2)
#define HCHWCFG_INT_TRIGGER (1 << 1)
#define HCHWCFG_INT_ENABLE (1 << 0)
#define HCDMACFG 0x21
#define HCDMACFG_BURST_LEN_MASK (0x03 << 5)
#define HCDMACFG_BURST_LEN(n) (((n) << 5) & HCDMACFG_BURST_LEN_MASK)
#define HCDMACFG_BURST_LEN_1 HCDMACFG_BURST_LEN(0)
#define HCDMACFG_BURST_LEN_4 HCDMACFG_BURST_LEN(1)
#define HCDMACFG_BURST_LEN_8 HCDMACFG_BURST_LEN(2)
#define HCDMACFG_DMA_ENABLE (1 << 4)
#define HCDMACFG_BUF_TYPE_MASK (0x07 << 1)
#define HCDMACFG_CTR_SEL (1 << 2)
#define HCDMACFG_ITLATL_SEL (1 << 1)
#define HCDMACFG_DMA_RW_SELECT (1 << 0)
#define HCXFERCTR 0x22
#define HCuPINT 0x24
#define HCuPINT_SOF (1 << 0)
#define HCuPINT_ATL (1 << 1)
#define HCuPINT_AIIEOT (1 << 2)
#define HCuPINT_OPR (1 << 4)
#define HCuPINT_SUSP (1 << 5)
#define HCuPINT_CLKRDY (1 << 6)
#define HCuPINTENB 0x25
#define HCCHIPID 0x27
#define HCCHIPID_MASK 0xff00
#define HCCHIPID_MAGIC 0x6100
#define HCSCRATCH 0x28
#define HCSWRES 0x29
#define HCSWRES_MAGIC 0x00f6
#define HCITLBUFLEN 0x2a
#define HCATLBUFLEN 0x2b
#define HCBUFSTAT 0x2c
#define HCBUFSTAT_ITL0_FULL (1 << 0)
#define HCBUFSTAT_ITL1_FULL (1 << 1)
#define HCBUFSTAT_ATL_FULL (1 << 2)
#define HCBUFSTAT_ITL0_DONE (1 << 3)
#define HCBUFSTAT_ITL1_DONE (1 << 4)
#define HCBUFSTAT_ATL_DONE (1 << 5)
#define HCRDITL0LEN 0x2d
#define HCRDITL1LEN 0x2e
#define HCITLPORT 0x40
#define HCATLPORT 0x41
/* PTD accessor macros. */
#define PTD_GET_COUNT(p) (((p)->count & PTD_COUNT_MSK) >> 0)
#define PTD_COUNT(v) (((v) << 0) & PTD_COUNT_MSK)
#define PTD_GET_TOGGLE(p) (((p)->count & PTD_TOGGLE_MSK) >> 10)
#define PTD_TOGGLE(v) (((v) << 10) & PTD_TOGGLE_MSK)
#define PTD_GET_ACTIVE(p) (((p)->count & PTD_ACTIVE_MSK) >> 11)
#define PTD_ACTIVE(v) (((v) << 11) & PTD_ACTIVE_MSK)
#define PTD_GET_CC(p) (((p)->count & PTD_CC_MSK) >> 12)
#define PTD_CC(v) (((v) << 12) & PTD_CC_MSK)
#define PTD_GET_MPS(p) (((p)->mps & PTD_MPS_MSK) >> 0)
#define PTD_MPS(v) (((v) << 0) & PTD_MPS_MSK)
#define PTD_GET_SPD(p) (((p)->mps & PTD_SPD_MSK) >> 10)
#define PTD_SPD(v) (((v) << 10) & PTD_SPD_MSK)
#define PTD_GET_LAST(p) (((p)->mps & PTD_LAST_MSK) >> 11)
#define PTD_LAST(v) (((v) << 11) & PTD_LAST_MSK)
#define PTD_GET_EP(p) (((p)->mps & PTD_EP_MSK) >> 12)
#define PTD_EP(v) (((v) << 12) & PTD_EP_MSK)
#define PTD_GET_LEN(p) (((p)->len & PTD_LEN_MSK) >> 0)
#define PTD_LEN(v) (((v) << 0) & PTD_LEN_MSK)
#define PTD_GET_DIR(p) (((p)->len & PTD_DIR_MSK) >> 10)
#define PTD_DIR(v) (((v) << 10) & PTD_DIR_MSK)
#define PTD_GET_B5_5(p) (((p)->len & PTD_B5_5_MSK) >> 13)
#define PTD_B5_5(v) (((v) << 13) & PTD_B5_5_MSK)
#define PTD_GET_FA(p) (((p)->faddr & PTD_FA_MSK) >> 0)
#define PTD_FA(v) (((v) << 0) & PTD_FA_MSK)
#define PTD_GET_FMT(p) (((p)->faddr & PTD_FMT_MSK) >> 7)
#define PTD_FMT(v) (((v) << 7) & PTD_FMT_MSK)
/* Hardware transfer status codes -- CC from ptd->count */
#define TD_CC_NOERROR 0x00
#define TD_CC_CRC 0x01
#define TD_CC_BITSTUFFING 0x02
#define TD_CC_DATATOGGLEM 0x03
#define TD_CC_STALL 0x04
#define TD_DEVNOTRESP 0x05
#define TD_PIDCHECKFAIL 0x06
#define TD_UNEXPECTEDPID 0x07
#define TD_DATAOVERRUN 0x08
#define TD_DATAUNDERRUN 0x09
/* 0x0A, 0x0B reserved for hardware */
#define TD_BUFFEROVERRUN 0x0C
#define TD_BUFFERUNDERRUN 0x0D
/* 0x0E, 0x0F reserved for HCD */
#define TD_NOTACCESSED 0x0F
/* ------------------------------------------------------------------------- */
#define LOG2_PERIODIC_SIZE 5 /* arbitrary; this matches OHCI */
#define PERIODIC_SIZE (1 << LOG2_PERIODIC_SIZE)
/* Philips transfer descriptor */
struct ptd {
u16 count;
#define PTD_COUNT_MSK (0x3ff << 0)
#define PTD_TOGGLE_MSK (1 << 10)
#define PTD_ACTIVE_MSK (1 << 11)
#define PTD_CC_MSK (0xf << 12)
u16 mps;
#define PTD_MPS_MSK (0x3ff << 0)
#define PTD_SPD_MSK (1 << 10)
#define PTD_LAST_MSK (1 << 11)
#define PTD_EP_MSK (0xf << 12)
u16 len;
#define PTD_LEN_MSK (0x3ff << 0)
#define PTD_DIR_MSK (3 << 10)
#define PTD_DIR_SETUP (0)
#define PTD_DIR_OUT (1)
#define PTD_DIR_IN (2)
#define PTD_B5_5_MSK (1 << 13)
u16 faddr;
#define PTD_FA_MSK (0x7f << 0)
#define PTD_FMT_MSK (1 << 7)
} __attribute__ ((packed, aligned(2)));
struct isp116x_ep {
struct usb_device *udev;
struct ptd ptd;
u8 maxpacket;
u8 epnum;
u8 nextpid;
u16 length; /* of current packet */
unsigned char *data; /* to databuf */
u16 error_count;
};
/* URB struct */
#define N_URB_TD 48
#define URB_DEL 1
typedef struct {
struct isp116x_ep *ed;
void *transfer_buffer; /* (in) associated data buffer */
int actual_length; /* (return) actual transfer length */
unsigned long pipe; /* (in) pipe information */
#if 0
int state;
#endif
} urb_priv_t;
struct isp116x_platform_data {
/* Enable internal resistors on downstream ports */
unsigned sel15Kres:1;
/* On-chip overcurrent detection */
unsigned oc_enable:1;
/* Enable wakeup by devices on usb bus (e.g. wakeup
by attachment/detachment or by device activity
such as moving a mouse). When chosen, this option
prevents stopping internal clock, increasing
thereby power consumption in suspended state. */
unsigned remote_wakeup_enable:1;
};
struct isp116x {
u16 *addr_reg;
u16 *data_reg;
struct isp116x_platform_data *board;
struct dentry *dentry;
unsigned long stat1, stat2, stat4, stat8, stat16;
/* Status flags */
unsigned disabled:1;
unsigned sleeping:1;
/* Root hub registers */
u32 rhdesca;
u32 rhdescb;
u32 rhstatus;
u32 rhport[2];
/* Schedule for the current frame */
struct isp116x_ep *atl_active;
int atl_buflen;
int atl_bufshrt;
int atl_last_dir;
int atl_finishing;
};
/* ------------------------------------------------- */
/* Inter-io delay (ns). The chip is picky about access timings; it
* expects at least:
* 150ns delay between consecutive accesses to DATA_REG,
* 300ns delay between access to ADDR_REG and DATA_REG
* OE, WE MUST NOT be changed during these intervals
*/
#if defined(UDELAY)
#define isp116x_delay(h,d) udelay(d)
#else
#define isp116x_delay(h,d) do {} while (0)
#endif
#include "../../super.h" /*
* Functions to call supervisor mode
* Super() in TOS is buggy
*/
u32 p;
static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg)
{
// p = SuperFromUser( );
__raw_writew(reg & 0xff, isp116x->addr_reg );
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
}
static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val)
{
// p = SuperFromUser( );
writew(val, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
}
static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val)
{
// p = SuperFromUser( );
__raw_writew(val, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
}
static inline u16 isp116x_read_data16(struct isp116x *isp116x)
{
u16 val;
// p = SuperFromUser( );
val = readw(isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
return val;
}
static inline u16 isp116x_raw_read_data16(struct isp116x *isp116x)
{
u16 val;
// p = SuperFromUser( );
val = __raw_readw(isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
return val;
}
static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val)
{
// p = SuperFromUser( );
writew(val & 0xffff, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
writew(val >> 16, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
}
/*
* Added for EtherNat, to write HC registers without swaping them
* EtherNat already swap them by hardware (i suppose.....)
*/
static inline void isp116x_raw_write_data32(struct isp116x *isp116x, u32 val)
{
// p = SuperFromUser( );
__raw_writew(val & 0xffff, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
__raw_writew(val >> 16, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
}
/***********************************************/
static inline u32 isp116x_read_data32(struct isp116x *isp116x)
{
u32 val;
// p = SuperFromUser( );
val = (u32) readw(isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
val |= ((u32) readw(isp116x->data_reg)) << 16;
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
return val;
}
/*
* Added for EtherNat, to read HC registers without swaping them
* EtherNat already swap them by hardware (i suppose.....)
*/
static inline u32 isp116x_raw_read_data32(struct isp116x *isp116x)
{
u32 val;
// p = SuperFromUser( );
val = (u32) __raw_readw(isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
val |= ((u32) __raw_readw(isp116x->data_reg)) << 16;
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
return val;
}
/*******************************************************************/
/* Let's keep register access functions out of line. Hint:
we wait at least 150 ns at every access.
*/
/* with EtherNat use raw_read to avoid swaping bytes*/
static u16 isp116x_read_reg16(struct isp116x *isp116x, unsigned reg)
{
isp116x_write_addr(isp116x, reg);
return isp116x_raw_read_data16(isp116x);
}
static u32 isp116x_read_reg32(struct isp116x *isp116x, unsigned reg)
{
isp116x_write_addr(isp116x, reg);
return isp116x_raw_read_data32(isp116x);
}
static void isp116x_write_reg16(struct isp116x *isp116x, unsigned reg,
unsigned val)
{
isp116x_write_addr(isp116x, reg | ISP116x_WRITE_OFFSET);
isp116x_raw_write_data16(isp116x, (u16) (val & 0xffff));
}
/* with Etehrnat used raw_write to avoid swaping bytes by software */
static void isp116x_write_reg32(struct isp116x *isp116x, unsigned reg,
unsigned val)
{
isp116x_write_addr(isp116x, reg | ISP116x_WRITE_OFFSET);
isp116x_raw_write_data32(isp116x, (u32) val);
}
/* --- USB HUB constants (not OHCI-specific; see hub.h) -------------------- */
/* destination of request */
#define RH_INTERFACE 0x01
#define RH_ENDPOINT 0x02
#define RH_OTHER 0x03
#define RH_CLASS 0x20
#define RH_VENDOR 0x40
/* Requests: bRequest << 8 | bmRequestType */
#define RH_GET_STATUS 0x0080
#define RH_CLEAR_FEATURE 0x0100
#define RH_SET_FEATURE 0x0300
#define RH_SET_ADDRESS 0x0500
#define RH_GET_DESCRIPTOR 0x0680
#define RH_SET_DESCRIPTOR 0x0700
#define RH_GET_CONFIGURATION 0x0880
#define RH_SET_CONFIGURATION 0x0900
#define RH_GET_STATE 0x0280
#define RH_GET_INTERFACE 0x0A80
#define RH_SET_INTERFACE 0x0B00
#define RH_SYNC_FRAME 0x0C80
/* Our Vendor Specific Request */
#define RH_SET_EP 0x2000
/* Hub port features */
#define RH_PORT_CONNECTION 0x00
#define RH_PORT_ENABLE 0x01
#define RH_PORT_SUSPEND 0x02
#define RH_PORT_OVER_CURRENT 0x03
#define RH_PORT_RESET 0x04
#define RH_PORT_POWER 0x08
#define RH_PORT_LOW_SPEED 0x09
#define RH_C_PORT_CONNECTION 0x10
#define RH_C_PORT_ENABLE 0x11
#define RH_C_PORT_SUSPEND 0x12
#define RH_C_PORT_OVER_CURRENT 0x13
#define RH_C_PORT_RESET 0x14
/* Hub features */
#define RH_C_HUB_LOCAL_POWER 0x00
#define RH_C_HUB_OVER_CURRENT 0x01
#define RH_DEVICE_REMOTE_WAKEUP 0x00
#define RH_ENDPOINT_STALL 0x01
#define RH_ACK 0x01
#define RH_REQ_ERR -1
#define RH_NACK 0x00
#endif /* _ETHERNAT_ISP116X_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,596 @@
/*
* Modified for Atari-NetUSBee by David Gálvez 2010
*
* ISP116x register declarations and HCD data structures
*
* Copyright (C) 2007 Rodolfo Giometti <giometti@linux.it>
* Copyright (C) 2007 Eurotech S.p.A. <info@eurotech.it>
* Copyright (C) 2005 Olav Kongas <ok@artecdesign.ee>
* Portions:
* Copyright (C) 2004 Lothar Wassmann
* Copyright (C) 2004 Psion Teklogix
* Copyright (C) 2004 David Brownell
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _NETUSBEE_ISP116X_H
#define _NETUSBEE_ISP116X_H
#define ERR(fmt, args...) printf("isp116x: %s: " fmt "\n\r" , __FUNCTION__ , ## args)
#define WARN(fmt, args...) printf("isp116x: %s: " fmt "\n\r" , __FUNCTION__ , ## args)
#define INFO(fmt, args...) printf("isp116x: " fmt "\n\r" , ## args)
/* ------------------------------------------------------------------------- */
/* us of 1ms frame */
#define MAX_LOAD_LIMIT 850
/* Full speed: max # of bytes to transfer for a single urb
at a time must be < 1024 && must be multiple of 64.
832 allows transfering 4kiB within 5 frames. */
#define MAX_TRANSFER_SIZE_FULLSPEED 832
/* Low speed: there is no reason to schedule in very big
chunks; often the requested long transfers are for
string descriptors containing short strings. */
#define MAX_TRANSFER_SIZE_LOWSPEED 64
/* Bytetime (us), a rough indication of how much time it
would take to transfer a byte of useful data over USB */
#define BYTE_TIME_FULLSPEED 1
#define BYTE_TIME_LOWSPEED 20
/* Buffer sizes */
#define ISP116x_BUF_SIZE 4096
#define ISP116x_ITL_BUFSIZE 0
#define ISP116x_ATL_BUFSIZE ((ISP116x_BUF_SIZE) - 2*(ISP116x_ITL_BUFSIZE))
#define ISP116x_WRITE_OFFSET 0x80
/* --- ISP116x address registers in Netusbee --------------------------------*/
#define ISP116X_HCD_ADDR_BEE 0x00FBC000
#define ISP116X_HCD_DATA_BEE 0x00FA0000
/* --- ISP116x registers/bits ---------------------------------------------- */
#define HCREVISION 0x00
#define HCCONTROL 0x01
#define HCCONTROL_HCFS (3 << 6) /* host controller
functional state */
#define HCCONTROL_USB_RESET (0 << 6)
#define HCCONTROL_USB_RESUME (1 << 6)
#define HCCONTROL_USB_OPER (2 << 6)
#define HCCONTROL_USB_SUSPEND (3 << 6)
#define HCCONTROL_RWC (1 << 9) /* remote wakeup connected */
#define HCCONTROL_RWE (1 << 10) /* remote wakeup enable */
#define HCCMDSTAT 0x02
#define HCCMDSTAT_HCR (1 << 0) /* host controller reset */
#define HCCMDSTAT_SOC (3 << 16) /* scheduling overrun count */
#define HCINTSTAT 0x03
#define HCINT_SO (1 << 0) /* scheduling overrun */
#define HCINT_WDH (1 << 1) /* writeback of done_head */
#define HCINT_SF (1 << 2) /* start frame */
#define HCINT_RD (1 << 3) /* resume detect */
#define HCINT_UE (1 << 4) /* unrecoverable error */
#define HCINT_FNO (1 << 5) /* frame number overflow */
#define HCINT_RHSC (1 << 6) /* root hub status change */
#define HCINT_OC (1 << 30) /* ownership change */
#define HCINT_MIE (1 << 31) /* master interrupt enable */
#define HCINTENB 0x04
#define HCINTDIS 0x05
#define HCFMINTVL 0x0d
#define HCFMREM 0x0e
#define HCFMNUM 0x0f
#define HCLSTHRESH 0x11
#define HCRHDESCA 0x12
#define RH_A_NDP (0x3 << 0) /* # downstream ports */
#define RH_A_PSM (1 << 8) /* power switching mode */
#define RH_A_NPS (1 << 9) /* no power switching */
#define RH_A_DT (1 << 10) /* device type (mbz) */
#define RH_A_OCPM (1 << 11) /* overcurrent protection
mode */
#define RH_A_NOCP (1 << 12) /* no overcurrent protection */
#define RH_A_POTPGT (0xff << 24) /* power on -> power good
time */
#define HCRHDESCB 0x13
#define RH_B_DR (0xffff << 0) /* device removable flags */
#define RH_B_PPCM (0xffff << 16) /* port power control mask */
#define HCRHSTATUS 0x14
#define RH_HS_LPS (1 << 0) /* local power status */
#define RH_HS_OCI (1 << 1) /* over current indicator */
#define RH_HS_DRWE (1 << 15) /* device remote wakeup
enable */
#define RH_HS_LPSC (1 << 16) /* local power status change */
#define RH_HS_OCIC (1 << 17) /* over current indicator
change */
#define RH_HS_CRWE (1 << 31) /* clear remote wakeup
enable */
#define HCRHPORT1 0x15
#define RH_PS_CCS (1 << 0) /* current connect status */
#define RH_PS_PES (1 << 1) /* port enable status */
#define RH_PS_PSS (1 << 2) /* port suspend status */
#define RH_PS_POCI (1 << 3) /* port over current
indicator */
#define RH_PS_PRS (1 << 4) /* port reset status */
#define RH_PS_PPS (1 << 8) /* port power status */
#define RH_PS_LSDA (1 << 9) /* low speed device attached */
#define RH_PS_CSC (1 << 16) /* connect status change */
#define RH_PS_PESC (1 << 17) /* port enable status change */
#define RH_PS_PSSC (1 << 18) /* port suspend status
change */
#define RH_PS_OCIC (1 << 19) /* over current indicator
change */
#define RH_PS_PRSC (1 << 20) /* port reset status change */
#define HCRHPORT_CLRMASK (0x1f << 16)
#define HCRHPORT2 0x16
#define HCHWCFG 0x20
#define HCHWCFG_15KRSEL (1 << 12)
#define HCHWCFG_CLKNOTSTOP (1 << 11)
#define HCHWCFG_ANALOG_OC (1 << 10)
#define HCHWCFG_DACK_MODE (1 << 8)
#define HCHWCFG_EOT_POL (1 << 7)
#define HCHWCFG_DACK_POL (1 << 6)
#define HCHWCFG_DREQ_POL (1 << 5)
#define HCHWCFG_DBWIDTH_MASK (0x03 << 3)
#define HCHWCFG_DBWIDTH(n) (((n) << 3) & HCHWCFG_DBWIDTH_MASK)
#define HCHWCFG_INT_POL (1 << 2)
#define HCHWCFG_INT_TRIGGER (1 << 1)
#define HCHWCFG_INT_ENABLE (1 << 0)
#define HCDMACFG 0x21
#define HCDMACFG_BURST_LEN_MASK (0x03 << 5)
#define HCDMACFG_BURST_LEN(n) (((n) << 5) & HCDMACFG_BURST_LEN_MASK)
#define HCDMACFG_BURST_LEN_1 HCDMACFG_BURST_LEN(0)
#define HCDMACFG_BURST_LEN_4 HCDMACFG_BURST_LEN(1)
#define HCDMACFG_BURST_LEN_8 HCDMACFG_BURST_LEN(2)
#define HCDMACFG_DMA_ENABLE (1 << 4)
#define HCDMACFG_BUF_TYPE_MASK (0x07 << 1)
#define HCDMACFG_CTR_SEL (1 << 2)
#define HCDMACFG_ITLATL_SEL (1 << 1)
#define HCDMACFG_DMA_RW_SELECT (1 << 0)
#define HCXFERCTR 0x22
#define HCuPINT 0x24
#define HCuPINT_SOF (1 << 0)
#define HCuPINT_ATL (1 << 1)
#define HCuPINT_AIIEOT (1 << 2)
#define HCuPINT_OPR (1 << 4)
#define HCuPINT_SUSP (1 << 5)
#define HCuPINT_CLKRDY (1 << 6)
#define HCuPINTENB 0x25
#define HCCHIPID 0x27
#define HCCHIPID_MASK 0xff00
#define HCCHIPID_MAGIC 0x6100
#define HCSCRATCH 0x28
#define HCSWRES 0x29
#define HCSWRES_MAGIC 0x00f6
#define HCITLBUFLEN 0x2a
#define HCATLBUFLEN 0x2b
#define HCBUFSTAT 0x2c
#define HCBUFSTAT_ITL0_FULL (1 << 0)
#define HCBUFSTAT_ITL1_FULL (1 << 1)
#define HCBUFSTAT_ATL_FULL (1 << 2)
#define HCBUFSTAT_ITL0_DONE (1 << 3)
#define HCBUFSTAT_ITL1_DONE (1 << 4)
#define HCBUFSTAT_ATL_DONE (1 << 5)
#define HCRDITL0LEN 0x2d
#define HCRDITL1LEN 0x2e
#define HCITLPORT 0x40
#define HCATLPORT 0x41
/* PTD accessor macros. */
#define PTD_GET_COUNT(p) (((p)->count & PTD_COUNT_MSK) >> 0)
#define PTD_COUNT(v) (((v) << 0) & PTD_COUNT_MSK)
#define PTD_GET_TOGGLE(p) (((p)->count & PTD_TOGGLE_MSK) >> 10)
#define PTD_TOGGLE(v) (((v) << 10) & PTD_TOGGLE_MSK)
#define PTD_GET_ACTIVE(p) (((p)->count & PTD_ACTIVE_MSK) >> 11)
#define PTD_ACTIVE(v) (((v) << 11) & PTD_ACTIVE_MSK)
#define PTD_GET_CC(p) (((p)->count & PTD_CC_MSK) >> 12)
#define PTD_CC(v) (((v) << 12) & PTD_CC_MSK)
#define PTD_GET_MPS(p) (((p)->mps & PTD_MPS_MSK) >> 0)
#define PTD_MPS(v) (((v) << 0) & PTD_MPS_MSK)
#define PTD_GET_SPD(p) (((p)->mps & PTD_SPD_MSK) >> 10)
#define PTD_SPD(v) (((v) << 10) & PTD_SPD_MSK)
#define PTD_GET_LAST(p) (((p)->mps & PTD_LAST_MSK) >> 11)
#define PTD_LAST(v) (((v) << 11) & PTD_LAST_MSK)
#define PTD_GET_EP(p) (((p)->mps & PTD_EP_MSK) >> 12)
#define PTD_EP(v) (((v) << 12) & PTD_EP_MSK)
#define PTD_GET_LEN(p) (((p)->len & PTD_LEN_MSK) >> 0)
#define PTD_LEN(v) (((v) << 0) & PTD_LEN_MSK)
#define PTD_GET_DIR(p) (((p)->len & PTD_DIR_MSK) >> 10)
#define PTD_DIR(v) (((v) << 10) & PTD_DIR_MSK)
#define PTD_GET_B5_5(p) (((p)->len & PTD_B5_5_MSK) >> 13)
#define PTD_B5_5(v) (((v) << 13) & PTD_B5_5_MSK)
#define PTD_GET_FA(p) (((p)->faddr & PTD_FA_MSK) >> 0)
#define PTD_FA(v) (((v) << 0) & PTD_FA_MSK)
#define PTD_GET_FMT(p) (((p)->faddr & PTD_FMT_MSK) >> 7)
#define PTD_FMT(v) (((v) << 7) & PTD_FMT_MSK)
/* Hardware transfer status codes -- CC from ptd->count */
#define TD_CC_NOERROR 0x00
#define TD_CC_CRC 0x01
#define TD_CC_BITSTUFFING 0x02
#define TD_CC_DATATOGGLEM 0x03
#define TD_CC_STALL 0x04
#define TD_DEVNOTRESP 0x05
#define TD_PIDCHECKFAIL 0x06
#define TD_UNEXPECTEDPID 0x07
#define TD_DATAOVERRUN 0x08
#define TD_DATAUNDERRUN 0x09
/* 0x0A, 0x0B reserved for hardware */
#define TD_BUFFEROVERRUN 0x0C
#define TD_BUFFERUNDERRUN 0x0D
/* 0x0E, 0x0F reserved for HCD */
#define TD_NOTACCESSED 0x0F
/* ------------------------------------------------------------------------- */
#define LOG2_PERIODIC_SIZE 5 /* arbitrary; this matches OHCI */
#define PERIODIC_SIZE (1 << LOG2_PERIODIC_SIZE)
/* Philips transfer descriptor */
struct ptd {
u16 count;
#define PTD_COUNT_MSK (0x3ff << 0)
#define PTD_TOGGLE_MSK (1 << 10)
#define PTD_ACTIVE_MSK (1 << 11)
#define PTD_CC_MSK (0xf << 12)
u16 mps;
#define PTD_MPS_MSK (0x3ff << 0)
#define PTD_SPD_MSK (1 << 10)
#define PTD_LAST_MSK (1 << 11)
#define PTD_EP_MSK (0xf << 12)
u16 len;
#define PTD_LEN_MSK (0x3ff << 0)
#define PTD_DIR_MSK (3 << 10)
#define PTD_DIR_SETUP (0)
#define PTD_DIR_OUT (1)
#define PTD_DIR_IN (2)
#define PTD_B5_5_MSK (1 << 13)
u16 faddr;
#define PTD_FA_MSK (0x7f << 0)
#define PTD_FMT_MSK (1 << 7)
} __attribute__ ((packed, aligned(2)));
struct isp116x_ep {
struct usb_device *udev;
struct ptd ptd;
u8 maxpacket;
u8 epnum;
u8 nextpid;
u16 length; /* of current packet */
unsigned char *data; /* to databuf */
u16 error_count;
};
/* URB struct */
#define N_URB_TD 48
#define URB_DEL 1
typedef struct {
struct isp116x_ep *ed;
void *transfer_buffer; /* (in) associated data buffer */
int actual_length; /* (return) actual transfer length */
unsigned long pipe; /* (in) pipe information */
#if 0
int state;
#endif
} urb_priv_t;
struct isp116x_platform_data {
/* Enable internal resistors on downstream ports */
unsigned sel15Kres:1;
/* On-chip overcurrent detection */
unsigned oc_enable:1;
/* Enable wakeup by devices on usb bus (e.g. wakeup
by attachment/detachment or by device activity
such as moving a mouse). When chosen, this option
prevents stopping internal clock, increasing
thereby power consumption in suspended state. */
unsigned remote_wakeup_enable:1;
};
struct isp116x {
u16 *addr_reg;
u16 *data_reg;
struct isp116x_platform_data *board;
struct dentry *dentry;
unsigned long stat1, stat2, stat4, stat8, stat16;
/* Status flags */
unsigned disabled:1;
unsigned sleeping:1;
/* Root hub registers */
u32 rhdesca;
u32 rhdescb;
u32 rhstatus;
u32 rhport[2];
/* Schedule for the current frame */
struct isp116x_ep *atl_active;
int atl_buflen;
int atl_bufshrt;
int atl_last_dir;
int atl_finishing;
};
/* ------------------------------------------------- */
/* Inter-io delay (ns). The chip is picky about access timings; it
* expects at least:
* 150ns delay between consecutive accesses to DATA_REG,
* 300ns delay between access to ADDR_REG and DATA_REG
* OE, WE MUST NOT be changed during these intervals
*/
#if defined(UDELAY)
#define isp116x_delay(h,d) udelay(d)
#else
#define isp116x_delay(h,d) do {} while (0)
#endif
#include "../../super.h" /*
* Functions to call supervisor mode
* Super() in in TOS is buggy
*/
static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg)
{
u16 dumm;
u32 p = 0;
if ( !(Super (SUP_INQUIRE)))
p = SuperFromUser( );
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + ((reg & 0x00ff)<<1));
dumm = __raw_readw( isp116x->data_reg );
isp116x->addr_reg = (u16*)ISP116X_HCD_ADDR_BEE;
dumm = __raw_readw( isp116x->addr_reg );
isp116x_delay(isp116x, UDELAY);
if ((Super (SUP_INQUIRE)) && (p))
SuperToUser( p );
// ERR ( "data_reg: %x \n\r", isp116x->data_reg);
// ERR ( "addr_reg: %x \n\r", isp116x->addr_reg);
}
static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val)
{
u16 dumm;
u32 p = 0;
if ( !(Super (SUP_INQUIRE)))
p = SuperFromUser( );
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + ((val & 0xff00)>>7) );
dumm = __raw_readw(isp116x->data_reg);
isp116x->addr_reg = (u16*)((ISP116X_HCD_ADDR_BEE - 0x4000) + ((val & 0x00ff)<<1));
dumm = __raw_readw(isp116x->addr_reg);
isp116x_delay(isp116x, UDELAY);
if ((Super (SUP_INQUIRE)) && (p))
SuperToUser( p );
// ERR ( "data_reg: %x \n\r", isp116x->data_reg);
// ERR ( "addr_reg: %x \n\r", isp116x->addr_reg);
}
static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val)
{
u16 dumm;
u32 p = 0;
if ( !(Super (SUP_INQUIRE)))
p = SuperFromUser( );
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + ((val & 0x00ff)<<1));
dumm = __raw_readw(isp116x->data_reg);
isp116x->addr_reg = (u16*)((ISP116X_HCD_ADDR_BEE - 0x4000) + ((val & 0xff00)>>7));
dumm = __raw_readw(isp116x->addr_reg);
isp116x_delay(isp116x, UDELAY);
if ((Super (SUP_INQUIRE)) && (p))
SuperToUser( p );
// ERR ( "data_reg: %x \n\r", isp116x->data_reg);
// ERR ( "addr_reg: %x \n\r", isp116x->addr_reg);
}
static inline u16 isp116x_read_data16(struct isp116x *isp116x)
{
u16 val;
u32 p = 0;
if ( !(Super (SUP_INQUIRE)))
p = SuperFromUser( );
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + 0x8000);
val = readw(isp116x->data_reg );
isp116x_delay(isp116x, UDELAY);
if ((Super (SUP_INQUIRE)) && (p))
SuperToUser( p );
return val;
}
static inline u16 isp116x_raw_read_data16(struct isp116x *isp116x)
{
u16 val;
u32 p = 0;
if ( !(Super (SUP_INQUIRE)))
p = SuperFromUser( );
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + 0x8000);
val = __raw_readw(isp116x->data_reg );
isp116x_delay(isp116x, UDELAY);
if ((Super (SUP_INQUIRE)) && (p))
SuperToUser( p );
// ERR ( "data_reg: %x value: %x\n\r", isp116x->data_reg, val );
return val;
}
#if 0 /* We don't use it anymore */
static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val)
{
// p = SuperFromUser( );
writew(val & 0xffff, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
writew(val >> 16, isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
// SuperToUser( p );
}
#endif
/*
* Added for NetUSBee, to write HC registers without swaping them
* NetUSBee already swap them by hardware (i suppose.....)
*/
static inline void isp116x_raw_write_data32(struct isp116x *isp116x, u32 val)
{
u16 dumm;
u32 p = 0;
if ( !(Super (SUP_INQUIRE)))
p = SuperFromUser( );
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + ((val & 0x000000ff)<<1) );
dumm = __raw_readw(isp116x->data_reg);
isp116x->addr_reg = (u16*)((ISP116X_HCD_ADDR_BEE - 0x4000) + ((val & 0x0000ff00)>>7));
dumm = __raw_readw(isp116x->addr_reg);
isp116x_delay(isp116x, UDELAY);
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + ((val & 0x00ff0000)>>15));
dumm = __raw_readw(isp116x->data_reg);
isp116x->addr_reg = (u16*)((ISP116X_HCD_ADDR_BEE - 0x4000) + ((val & 0xff000000)>>23) );
dumm = __raw_readw(isp116x->addr_reg);
isp116x_delay(isp116x, UDELAY);
if ((Super (SUP_INQUIRE)) && (p))
SuperToUser( p );
}
/***********************************************/
#if 0 /* We don't use it */
static inline u32 isp116x_read_data32(struct isp116x *isp116x)
{
u32 val;
p = SuperFromUser( );
val = (u32) readw(isp116x->data_reg);
isp116x_delay(isp116x, UDELAY);
val |= ((u32) readw(isp116x->data_reg)) << 16;
isp116x_delay(isp116x, UDELAY);
SuperToUser( p );
return val;
}
#endif
/*
* Added for NetUSBee, to read HC registers without swaping them
* NetUSBee already swap them by hardware (i suppose.....)
*/
static inline u32 isp116x_raw_read_data32(struct isp116x *isp116x)
{
u32 val;
u32 p = 0;
if ( !(Super (SUP_INQUIRE)))
p = SuperFromUser( );
isp116x->data_reg = (u16*)(ISP116X_HCD_DATA_BEE + 0x8000);
val = (u32) __raw_readw(isp116x->data_reg );
isp116x_delay(isp116x, UDELAY);
val |= ((u32) __raw_readw(isp116x->data_reg )) << 16;
isp116x_delay(isp116x, UDELAY);
if ((Super (SUP_INQUIRE)) && (p))
SuperToUser( p );
return val;
}
/*******************************************************************/
/* Let's keep register access functions out of line. Hint:
we wait at least 150 ns at every access.
*/
/* with NetUSBee use raw_read to avoid swaping bytes*/
static u16 isp116x_read_reg16(struct isp116x *isp116x, unsigned reg)
{
isp116x_write_addr(isp116x, reg);
return isp116x_raw_read_data16(isp116x);
}
static u32 isp116x_read_reg32(struct isp116x *isp116x, unsigned reg)
{
isp116x_write_addr(isp116x, reg);
return isp116x_raw_read_data32(isp116x);
}
static void isp116x_write_reg16(struct isp116x *isp116x, unsigned reg,
unsigned val)
{
isp116x_write_addr(isp116x, reg | ISP116x_WRITE_OFFSET);
isp116x_raw_write_data16(isp116x, (u16) (val & 0xffff));
}
/* with NetUSBee used raw_write to avoid swaping bytes by software */
static void isp116x_write_reg32(struct isp116x *isp116x, unsigned reg,
unsigned val)
{
isp116x_write_addr(isp116x, reg | ISP116x_WRITE_OFFSET);
isp116x_raw_write_data32(isp116x, (u32) val);
}
/* --- USB HUB constants (not OHCI-specific; see hub.h) -------------------- */
/* destination of request */
#define RH_INTERFACE 0x01
#define RH_ENDPOINT 0x02
#define RH_OTHER 0x03
#define RH_CLASS 0x20
#define RH_VENDOR 0x40
/* Requests: bRequest << 8 | bmRequestType */
#define RH_GET_STATUS 0x0080
#define RH_CLEAR_FEATURE 0x0100
#define RH_SET_FEATURE 0x0300
#define RH_SET_ADDRESS 0x0500
#define RH_GET_DESCRIPTOR 0x0680
#define RH_SET_DESCRIPTOR 0x0700
#define RH_GET_CONFIGURATION 0x0880
#define RH_SET_CONFIGURATION 0x0900
#define RH_GET_STATE 0x0280
#define RH_GET_INTERFACE 0x0A80
#define RH_SET_INTERFACE 0x0B00
#define RH_SYNC_FRAME 0x0C80
/* Our Vendor Specific Request */
#define RH_SET_EP 0x2000
/* Hub port features */
#define RH_PORT_CONNECTION 0x00
#define RH_PORT_ENABLE 0x01
#define RH_PORT_SUSPEND 0x02
#define RH_PORT_OVER_CURRENT 0x03
#define RH_PORT_RESET 0x04
#define RH_PORT_POWER 0x08
#define RH_PORT_LOW_SPEED 0x09
#define RH_C_PORT_CONNECTION 0x10
#define RH_C_PORT_ENABLE 0x11
#define RH_C_PORT_SUSPEND 0x12
#define RH_C_PORT_OVER_CURRENT 0x13
#define RH_C_PORT_RESET 0x14
/* Hub features */
#define RH_C_HUB_LOCAL_POWER 0x00
#define RH_C_HUB_OVER_CURRENT 0x01
#define RH_DEVICE_REMOTE_WAKEUP 0x00
#define RH_ENDPOINT_STALL 0x01
#define RH_ACK 0x01
#define RH_REQ_ERR -1
#define RH_NACK 0x00
#endif /* _NETUSBEE_ISP116X_H */

View File

@@ -0,0 +1,38 @@
/*
* File: ltoa.c
* Purpose: Function normally found in a standard C lib.
*
* Notes: This supports ASCII only!!!
*/
void ltoa(char *buf, long n, unsigned long base)
{
unsigned long un;
char *tmp, ch;
un = n;
if((base == 10) && (n < 0))
{
*buf++ = '-';
un = -n;
}
tmp = buf;
do
{
ch = un % base;
un = un / base;
if(ch <= 9)
ch += '0';
else
ch += 'a' - 10;
*tmp++ = ch;
}
while(un);
*tmp = '\0';
while(tmp > buf)
{
ch = *buf;
*buf++ = *--tmp;
*tmp = ch;
}
}

View File

@@ -0,0 +1,165 @@
#ifndef MOD_DEVICETABLE_H
#define MOD_DEVICETABLE_H
#define PCI_ANY_ID (~0)
struct pci_device_id {
unsigned long vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
unsigned long subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
unsigned long class, class_mask; /* (class,subclass,prog-if) triplet */
unsigned long driver_data; /* Data private to the driver */
};
#define IEEE1394_MATCH_VENDOR_ID 0x0001
#define IEEE1394_MATCH_MODEL_ID 0x0002
#define IEEE1394_MATCH_SPECIFIER_ID 0x0004
#define IEEE1394_MATCH_VERSION 0x0008
struct ieee1394_device_id {
unsigned long match_flags;
unsigned long vendor_id;
unsigned long model_id;
unsigned long specifier_id;
unsigned long version;
unsigned long driver_data;
};
/*
* Device table entry for "new style" table-driven USB drivers.
* User mode code can read these tables to choose which modules to load.
* Declare the table as a MODULE_DEVICE_TABLE.
*
* A probe() parameter will point to a matching entry from this table.
* Use the driver_info field for each match to hold information tied
* to that match: device quirks, etc.
*
* Terminate the driver's table with an all-zeroes entry.
* Use the flag values to control which fields are compared.
*/
/**
* struct usb_device_id - identifies USB devices for probing and hotplugging
* @match_flags: Bit mask controlling of the other fields are used to match
* against new devices. Any field except for driver_info may be used,
* although some only make sense in conjunction with other fields.
* This is usually set by a USB_DEVICE_*() macro, which sets all
* other fields in this structure except for driver_info.
* @idVendor: USB vendor ID for a device; numbers are assigned
* by the USB forum to its members.
* @idProduct: Vendor-assigned product ID.
* @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
* This is also used to identify individual product versions, for
* a range consisting of a single device.
* @bcdDevice_hi: High end of version number range. The range of product
* versions is inclusive.
* @bDeviceClass: Class of device; numbers are assigned
* by the USB forum. Products may choose to implement classes,
* or be vendor-specific. Device classes specify behavior of all
* the interfaces on a devices.
* @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
* @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
* @bInterfaceClass: Class of interface; numbers are assigned
* by the USB forum. Products may choose to implement classes,
* or be vendor-specific. Interface classes specify behavior only
* of a given interface; other interfaces may support other classes.
* @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
* @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
* @driver_info: Holds information used by the driver. Usually it holds
* a pointer to a descriptor understood by the driver, or perhaps
* device flags.
*
* In most cases, drivers will create a table of device IDs by using
* USB_DEVICE(), or similar macros designed for that purpose.
* They will then export it to userspace using MODULE_DEVICE_TABLE(),
* and provide it to the USB core through their usb_driver structure.
*
* See the usb_match_id() function for information about how matches are
* performed. Briefly, you will normally use one of several macros to help
* construct these entries. Each entry you provide will either identify
* one or more specific products, or will identify a class of products
* which have agreed to behave the same. You should put the more specific
* matches towards the beginning of your table, so that driver_info can
* record quirks of specific products.
*/
struct usb_device_id {
/* which fields to match against? */
unsigned short match_flags;
/* Used for product specific matches; range is inclusive */
unsigned short idVendor;
unsigned short idProduct;
unsigned short bcdDevice_lo;
unsigned short bcdDevice_hi;
/* Used for device class matches */
unsigned char bDeviceClass;
unsigned char bDeviceSubClass;
unsigned char bDeviceProtocol;
/* Used for interface class matches */
unsigned char bInterfaceClass;
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
/* not matched against */
unsigned long driver_info;
};
/* Some useful macros to use to create struct usb_device_id */
#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
/* s390 CCW devices */
struct ccw_device_id {
unsigned short match_flags; /* which fields to match against */
unsigned short cu_type; /* control unit type */
unsigned short dev_type; /* device type */
unsigned char cu_model; /* control unit model */
unsigned char dev_model; /* device model */
unsigned long driver_info;
};
#define CCW_DEVICE_ID_MATCH_CU_TYPE 0x01
#define CCW_DEVICE_ID_MATCH_CU_MODEL 0x02
#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
#define PNP_ID_LEN 8
#define PNP_MAX_DEVICES 8
struct pnp_device_id {
unsigned char id[PNP_ID_LEN];
unsigned long driver_data;
};
struct pnp_card_device_id {
unsigned char id[PNP_ID_LEN];
unsigned long driver_data;
struct {
unsigned char id[PNP_ID_LEN];
} devs[PNP_MAX_DEVICES];
};
#define SERIO_ANY 0xff
struct serio_device_id {
unsigned char type;
unsigned char extra;
unsigned char id;
unsigned char proto;
};
#endif /* MOD_DEVICETABLE_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,457 @@
/*
* URB OHCI HCD (Host Controller Driver) for USB.
*
* (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
* (C) Copyright 2000-2001 David Brownell <dbrownell@users.sourceforge.net>
*
* usb-ohci.h
*/
static int cc_to_error[16] = {
/* mapping of the OHCI CC status to error codes */
/* No Error */ 0,
/* CRC Error */ USB_ST_CRC_ERR,
/* Bit Stuff */ USB_ST_BIT_ERR,
/* Data Togg */ USB_ST_CRC_ERR,
/* Stall */ USB_ST_STALLED,
/* DevNotResp */ -1,
/* PIDCheck */ USB_ST_BIT_ERR,
/* UnExpPID */ USB_ST_BIT_ERR,
/* DataOver */ USB_ST_BUF_ERR,
/* DataUnder */ USB_ST_BUF_ERR,
/* reservd */ -1,
/* reservd */ -1,
/* BufferOver */ USB_ST_BUF_ERR,
/* BuffUnder */ USB_ST_BUF_ERR,
/* Not Access */ -1,
/* Not Access */ -1
};
static const char *cc_to_string[16] = {
"No Error",
"CRC: Last data packet from endpoint contained a CRC error.",
"BITSTUFFING: Last data packet from endpoint contained a bit stuffing violation",
"DATATOGGLEMISMATCH: Last packet from endpoint had data toggle PID that did not match the expected value.",
"STALL: TD was moved to the Done Queue because the endpoint returned a STALL PID",
"DEVICENOTRESPONDING: Device did not respond to token (IN) or did not provide a handshake (OUT)",
"PIDCHECKFAILURE: Check bits on PID from endpoint failed on data PID (IN) or handshake (OUT)",
"UNEXPECTEDPID: Receive PID was not valid when encountered or PID value is not defined.",
"DATAOVERRUN: The amount of data returned by the endpoint exceeded either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size.",
"DATAUNDERRUN: The endpoint returned less than MaximumPacketSize and that amount was not sufficient to fill the specified buffer",
"reserved1",
"reserved2",
"BUFFEROVERRUN: During an IN, HC received data from endpoint faster than it could be written to system memory",
"BUFFERUNDERRUN: During an OUT, HC could not retrieve data from system memory fast enough to keep up with data USB data rate.",
"NOT ACCESSED: This code is set by software before the TD is placed on a list to be processed by the HC.(1)",
"NOT ACCESSED: This code is set by software before the TD is placed on a list to be processed by the HC.(2)",
};
/* ED States */
#define ED_NEW 0x00
#define ED_UNLINK 0x01
#define ED_OPER 0x02
#define ED_DEL 0x04
#define ED_URB_DEL 0x08
/* usb_ohci_ed */
struct ed {
__u32 hwINFO;
__u32 hwTailP;
__u32 hwHeadP;
__u32 hwNextED;
struct ed *ed_prev;
__u8 int_period;
__u8 int_branch;
__u8 int_load;
__u8 int_interval;
__u8 state;
__u8 type;
__u16 last_iso;
struct ed *ed_rm_list;
struct usb_device *usb_dev;
void *purb;
__u32 unused[2];
} __attribute__((aligned(16)));
typedef struct ed ed_t;
/* TD info field */
#define TD_CC 0xf0000000
#define TD_CC_GET(td_p) ((td_p >>28) & 0x0f)
#define TD_CC_SET(td_p, cc) (td_p) = ((td_p) & 0x0fffffff) | (((cc) & 0x0f) << 28)
#define TD_EC 0x0C000000
#define TD_T 0x03000000
#define TD_T_DATA0 0x02000000
#define TD_T_DATA1 0x03000000
#define TD_T_TOGGLE 0x00000000
#define TD_R 0x00040000
#define TD_DI 0x00E00000
#define TD_DI_SET(X) (((X) & 0x07)<< 21)
#define TD_DP 0x00180000
#define TD_DP_SETUP 0x00000000
#define TD_DP_IN 0x00100000
#define TD_DP_OUT 0x00080000
#define TD_ISO 0x00010000
#define TD_DEL 0x00020000
/* CC Codes */
#define TD_CC_NOERROR 0x00
#define TD_CC_CRC 0x01
#define TD_CC_BITSTUFFING 0x02
#define TD_CC_DATATOGGLEM 0x03
#define TD_CC_STALL 0x04
#define TD_DEVNOTRESP 0x05
#define TD_PIDCHECKFAIL 0x06
#define TD_UNEXPECTEDPID 0x07
#define TD_DATAOVERRUN 0x08
#define TD_DATAUNDERRUN 0x09
#define TD_BUFFEROVERRUN 0x0C
#define TD_BUFFERUNDERRUN 0x0D
#define TD_NOTACCESSED 0x0F
#define MAXPSW 1
struct td {
__u32 hwINFO;
__u32 hwCBP; /* Current Buffer Pointer */
__u32 hwNextTD; /* Next TD Pointer */
__u32 hwBE; /* Memory Buffer End Pointer */
__u16 hwPSW[MAXPSW];
__u8 unused;
__u8 index;
struct ed *ed;
struct td *next_dl_td;
struct usb_device *usb_dev;
int transfer_len;
__u32 data;
__u32 unused2[2];
} __attribute__((aligned(32)));
typedef struct td td_t;
#define OHCI_ED_SKIP (1 << 14)
/*
* The HCCA (Host Controller Communications Area) is a 256 byte
* structure defined in the OHCI spec. that the host controller is
* told the base address of. It must be 256-byte aligned.
*/
#define NUM_INTS 32 /* part of the OHCI standard */
struct ohci_hcca {
__u32 int_table[NUM_INTS]; /* Interrupt ED table */
#if defined(CONFIG_MPC5200)
__u16 pad1; /* set to 0 on each frame_no change */
__u16 frame_no; /* current frame number */
#else
__u16 frame_no; /* current frame number */
__u16 pad1; /* set to 0 on each frame_no change */
#endif
__u32 done_head; /* info returned for an interrupt */
u8 reserved_for_hc[116];
} __attribute__((aligned(256)));
/*
* Maximum number of root hub ports.
*/
#ifndef CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS
# error "CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS undefined!"
#endif
/*
* This is the structure of the OHCI controller's memory mapped I/O
* region. This is Memory Mapped I/O. You must use the readl() and
* writel() macros defined in asm/io.h to access these!!
*/
struct ohci_regs {
/* control and status registers */
__u32 revision;
__u32 control;
__u32 cmdstatus;
__u32 intrstatus;
__u32 intrenable;
__u32 intrdisable;
/* memory pointers */
__u32 hcca;
__u32 ed_periodcurrent;
__u32 ed_controlhead;
__u32 ed_controlcurrent;
__u32 ed_bulkhead;
__u32 ed_bulkcurrent;
__u32 donehead;
/* frame counters */
__u32 fminterval;
__u32 fmremaining;
__u32 fmnumber;
__u32 periodicstart;
__u32 lsthresh;
/* Root hub ports */
struct ohci_roothub_regs {
__u32 a;
__u32 b;
__u32 status;
__u32 portstatus[CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS];
} roothub;
} __attribute__((aligned(32)));
/* Some EHCI controls */
#define EHCI_USBCMD_OFF 0x20
#define EHCI_USBCMD_HCRESET (1 << 1)
/* OHCI CONTROL AND STATUS REGISTER MASKS */
/*
* HcControl (control) register masks
*/
#define OHCI_CTRL_CBSR (3 << 0) /* control/bulk service ratio */
#define OHCI_CTRL_PLE (1 << 2) /* periodic list enable */
#define OHCI_CTRL_IE (1 << 3) /* isochronous enable */
#define OHCI_CTRL_CLE (1 << 4) /* control list enable */
#define OHCI_CTRL_BLE (1 << 5) /* bulk list enable */
#define OHCI_CTRL_HCFS (3 << 6) /* host controller functional state */
#define OHCI_CTRL_IR (1 << 8) /* interrupt routing */
#define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */
#define OHCI_CTRL_RWE (1 << 10) /* remote wakeup enable */
/* pre-shifted values for HCFS */
# define OHCI_USB_RESET (0 << 6)
# define OHCI_USB_RESUME (1 << 6)
# define OHCI_USB_OPER (2 << 6)
# define OHCI_USB_SUSPEND (3 << 6)
/*
* HcCommandStatus (cmdstatus) register masks
*/
#define OHCI_HCR (1 << 0) /* host controller reset */
#define OHCI_CLF (1 << 1) /* control list filled */
#define OHCI_BLF (1 << 2) /* bulk list filled */
#define OHCI_OCR (1 << 3) /* ownership change request */
#define OHCI_SOC (3 << 16) /* scheduling overrun count */
/*
* masks used with interrupt registers:
* HcInterruptStatus (intrstatus)
* HcInterruptEnable (intrenable)
* HcInterruptDisable (intrdisable)
*/
#define OHCI_INTR_SO (1 << 0) /* scheduling overrun */
#define OHCI_INTR_WDH (1 << 1) /* writeback of done_head */
#define OHCI_INTR_SF (1 << 2) /* start frame */
#define OHCI_INTR_RD (1 << 3) /* resume detect */
#define OHCI_INTR_UE (1 << 4) /* unrecoverable error */
#define OHCI_INTR_FNO (1 << 5) /* frame number overflow */
#define OHCI_INTR_RHSC (1 << 6) /* root hub status change */
#define OHCI_INTR_OC (1 << 30) /* ownership change */
#define OHCI_INTR_MIE (1 << 31) /* master interrupt enable */
/* Virtual Root HUB */
struct virt_root_hub {
int devnum; /* Address of Root Hub endpoint */
void *dev; /* was urb */
void *int_addr;
int send;
int interval;
};
/* USB HUB CONSTANTS (not OHCI-specific; see hub.h) */
/* destination of request */
#define RH_INTERFACE 0x01
#define RH_ENDPOINT 0x02
#define RH_OTHER 0x03
#define RH_CLASS 0x20
#define RH_VENDOR 0x40
/* Requests: bRequest << 8 | bmRequestType */
#define RH_GET_STATUS 0x0080
#define RH_CLEAR_FEATURE 0x0100
#define RH_SET_FEATURE 0x0300
#define RH_SET_ADDRESS 0x0500
#define RH_GET_DESCRIPTOR 0x0680
#define RH_SET_DESCRIPTOR 0x0700
#define RH_GET_CONFIGURATION 0x0880
#define RH_SET_CONFIGURATION 0x0900
#define RH_GET_STATE 0x0280
#define RH_GET_INTERFACE 0x0A80
#define RH_SET_INTERFACE 0x0B00
#define RH_SYNC_FRAME 0x0C80
/* Our Vendor Specific Request */
#define RH_SET_EP 0x2000
/* Hub port features */
#define RH_PORT_CONNECTION 0x00
#define RH_PORT_ENABLE 0x01
#define RH_PORT_SUSPEND 0x02
#define RH_PORT_OVER_CURRENT 0x03
#define RH_PORT_RESET 0x04
#define RH_PORT_POWER 0x08
#define RH_PORT_LOW_SPEED 0x09
#define RH_C_PORT_CONNECTION 0x10
#define RH_C_PORT_ENABLE 0x11
#define RH_C_PORT_SUSPEND 0x12
#define RH_C_PORT_OVER_CURRENT 0x13
#define RH_C_PORT_RESET 0x14
/* Hub features */
#define RH_C_HUB_LOCAL_POWER 0x00
#define RH_C_HUB_OVER_CURRENT 0x01
#define RH_DEVICE_REMOTE_WAKEUP 0x00
#define RH_ENDPOINT_STALL 0x01
#define RH_ACK 0x01
#define RH_REQ_ERR -1
#define RH_NACK 0x00
/* OHCI ROOT HUB REGISTER MASKS */
/* roothub.portstatus [i] bits */
#define RH_PS_CCS 0x00000001 /* current connect status */
#define RH_PS_PES 0x00000002 /* port enable status*/
#define RH_PS_PSS 0x00000004 /* port suspend status */
#define RH_PS_POCI 0x00000008 /* port over current indicator */
#define RH_PS_PRS 0x00000010 /* port reset status */
#define RH_PS_PPS 0x00000100 /* port power status */
#define RH_PS_LSDA 0x00000200 /* low speed device attached */
#define RH_PS_CSC 0x00010000 /* connect status change */
#define RH_PS_PESC 0x00020000 /* port enable status change */
#define RH_PS_PSSC 0x00040000 /* port suspend status change */
#define RH_PS_OCIC 0x00080000 /* over current indicator change */
#define RH_PS_PRSC 0x00100000 /* port reset status change */
/* roothub.status bits */
#define RH_HS_LPS 0x00000001 /* local power status */
#define RH_HS_OCI 0x00000002 /* over current indicator */
#define RH_HS_DRWE 0x00008000 /* device remote wakeup enable */
#define RH_HS_LPSC 0x00010000 /* local power status change */
#define RH_HS_OCIC 0x00020000 /* over current indicator change */
#define RH_HS_CRWE 0x80000000 /* clear remote wakeup enable */
/* roothub.b masks */
#define RH_B_DR 0x0000ffff /* device removable flags */
#define RH_B_PPCM 0xffff0000 /* port power control mask */
/* roothub.a masks */
#define RH_A_NDP (0xff << 0) /* number of downstream ports */
#define RH_A_PSM (1 << 8) /* power switching mode */
#define RH_A_NPS (1 << 9) /* no power switching */
#define RH_A_DT (1 << 10) /* device type (mbz) */
#define RH_A_OCPM (1 << 11) /* over current protection mode */
#define RH_A_NOCP (1 << 12) /* no over current protection */
#define RH_A_POTPGT (0xff << 24) /* power on to power good time */
/* urb */
#define N_URB_TD 48
typedef struct
{
ed_t *ed;
__u16 length; /* number of tds associated with this request */
__u16 td_cnt; /* number of tds already serviced */
struct usb_device *dev;
int state;
unsigned long pipe;
void *transfer_buffer;
int transfer_buffer_length;
int interval;
int actual_length;
int finished;
td_t *td[N_URB_TD]; /* list pointer to all corresponding TDs associated with this request */
} urb_priv_t;
#define URB_DEL 1
#define NUM_EDS 8 /* num of preallocated endpoint descriptors */
struct ohci_device {
ed_t ed[NUM_EDS];
int ed_cnt;
};
/*
* This is the full ohci controller description
*
* Note how the "proper" USB information is just
* a subset of what the full implementation needs. (Linus)
*/
typedef struct ohci {
long handle; /* PCI BIOS */
int big_endian; /* PCI BIOS */
struct ohci_hcca *hcca_unaligned;
struct ohci_hcca *hcca; /* hcca */
td_t *td_unaligned;
struct ohci_device *ohci_dev_unaligned;
/* this allocates EDs for all possible endpoints */
struct ohci_device *ohci_dev;
/*dma_addr_t hcca_dma;*/
int irq;
int disabled; /* e.g. got a UE, we're hung */
int sleeping;
unsigned long flags; /* for HC bugs */
unsigned long dma_offset;
struct ohci_regs *regs; /* OHCI controller's memory */
int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load balancing)*/
ed_t *ed_rm_list[2]; /* lists of all endpoints to be removed */
ed_t *ed_bulktail; /* last endpoint of bulk list */
ed_t *ed_controltail; /* last endpoint of control list */
int intrstatus;
__u32 hc_control; /* copy of the hc control reg */
struct usb_device *dev[32];
struct virt_root_hub rh;
const char *slot_name;
} ohci_t;
/* hcd */
/* endpoint */
static int ep_link(ohci_t * ohci, ed_t * ed);
static int ep_unlink(ohci_t * ohci, ed_t * ed);
static ed_t * ep_add_ed(struct usb_device * usb_dev, unsigned long pipe,
int interval, int load);
/*-------------------------------------------------------------------------*/
/* we need more TDs than EDs */
#define NUM_TD 64
/* pointers to aligned storage */
td_t *ptd;
/* TDs ... */
static inline struct td *td_alloc(struct usb_device *usb_dev)
{
int i;
struct td *td;
td = NULL;
for(i = 0; i < NUM_TD; i++)
{
if(ptd[i].usb_dev == NULL)
{
td = &ptd[i];
td->usb_dev = usb_dev;
break;
}
}
return td;
}
static inline void ed_free(struct ed *ed)
{
ed->usb_dev = NULL;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,342 @@
/* TOS 4.04 Xbios PCI for the CT60 board
* Didier Mequignon 2005, e-mail: aniplay@wanadoo.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _OHCI_PCI_PCIXBIOS_H
#define _OHCI_PCI_PCIXBIOS_H
#define PCIIDR 0x00 /* PCI Configuration ID Register */
#define PCICSR 0x04 /* PCI Command/Status Register */
#define PCICR 0x04 /* PCI Command Register */
#define PCISR 0x06 /* PCI Status Register */
#define PCIREV 0x08 /* PCI Revision ID Register */
#define PCICCR 0x09 /* PCI Class Code Register */
#define PCICLSR 0x0C /* PCI Cache Line Size Register */
#define PCILTR 0x0D /* PCI Latency Timer Register */
#define PCIHTR 0x0E /* PCI Header Type Register */
#define PCIBISTR 0x0F /* PCI Build-In Self Test Register */
#define PCIBAR0 0x10 /* PCI Base Address Register for Memory
Accesses to Local, Runtime, and DMA */
#define PCIBAR1 0x14 /* PCI Base Address Register for I/O
Accesses to Local, Runtime, and DMA */
#define PCIBAR2 0x18 /* PCI Base Address Register for Memory
Accesses to Local Address Space 0 */
#define PCIBAR3 0x1C /* PCI Base Address Register for Memory
Accesses to Local Address Space 1 */
#define PCIBAR4 0x20 /* PCI Base Address Register, reserved */
#define PCIBAR5 0x24 /* PCI Base Address Register, reserved */
#define PCICIS 0x28 /* PCI Cardbus CIS Pointer, not support*/
#define PCISVID 0x2C /* PCI Subsystem Vendor ID */
#define PCISID 0x2E /* PCI Subsystem ID */
#define PCIERBAR 0x30 /* PCI Expansion ROM Base Register */
#define CAP_PTR 0x34 /* New Capability Pointer */
#define PCIILR 0x3C /* PCI Interrupt Line Register */
#define PCIIPR 0x3D /* PCI Interrupt Pin Register */
#define PCIMGR 0x3E /* PCI Min_Gnt Register */
#define PCIMLR 0x3F /* PCI Max_Lat Register */
#define PMCAPID 0x40 /* Power Management Capability ID */
#define PMNEXT 0x41 /* Power Management Next Capability
Pointer */
#define PMC 0x42 /* Power Management Capabilities */
#define PMCSR 0x44 /* Power Management Control/Status */
#define PMCSR_BSE 0x46 /* PMCSR Bridge Support Extensions */
#define PMDATA 0x47 /* Power Management Data */
#define HS_CNTL 0x48 /* Hot Swap Control */
#define HS_NEXT 0x49 /* Hot Swap Next Capability Pointer */
#define HS_CSR 0x4A /* Hot Swap Control/Status */
#define PVPDCNTL 0x4C /* PCI Vital Product Data Control */
#define PVPD_NEXT 0x4D /* PCI Vital Product Data Next
Capability Pointer */
#define PVPDAD 0x4E /* PCI Vital Product Data Address */
#define PVPDATA 0x50 /* PCI VPD Data */
typedef struct
{
unsigned long *subcookie;
unsigned long version;
long routine[45];
} PCI_COOKIE;
typedef struct /* structure of resource descriptor */
{
unsigned short next; /* length of the following structure */
unsigned short flags; /* type of resource and misc. flags */
unsigned long start; /* start-address of resource */
unsigned long length; /* length of resource */
unsigned long offset; /* offset PCI to phys. CPU Address */
unsigned long dmaoffset; /* offset for DMA-transfers */
} PCI_RSC_DESC;
typedef struct /* structure of address conversion */
{
unsigned long adr; /* calculated address (CPU<->PCI) */
unsigned long len; /* length of memory range */
} PCI_CONV_ADR;
/******************************************************************************/
/* PCI-BIOS Error Codes */
/******************************************************************************/
#define PCI_SUCCESSFUL 0 /* everything's fine */
#define PCI_FUNC_NOT_SUPPORTED -2 /* function not supported */
#define PCI_BAD_VENDOR_ID -3 /* wrong Vendor ID */
#define PCI_DEVICE_NOT_FOUND -4 /* PCI-Device not found */
#define PCI_BAD_REGISTER_NUMBER -5 /* wrong register number */
#define PCI_SET_FAILED -6 /* reserved for later use */
#define PCI_BUFFER_TOO_SMALL -7 /* reserved for later use */
#define PCI_GENERAL_ERROR -8 /* general BIOS error code */
#define PCI_BAD_HANDLE -9 /* wrong/unknown PCI-handle */
/******************************************************************************/
/* Flags used in Resource-Descriptor */
/******************************************************************************/
#define FLG_IO 0x4000 /* Ressource in IO range */
#define FLG_LAST 0x8000 /* last ressource */
#define FLG_8BIT 0x0100 /* 8 bit accesses allowed */
#define FLG_16BIT 0x0200 /* 16 bit accesses allowed */
#define FLG_32BIT 0x0400 /* 32 bit accesses allowed */
#define FLG_ENDMASK 0x000F /* mask for byte ordering */
/******************************************************************************/
/* Values used in FLG_ENDMASK for Byte Ordering */
/******************************************************************************/
#define ORD_MOTOROLA 0 /* Motorola (big endian) */
#define ORD_INTEL_AS 1 /* Intel (little endian), addr.swapped */
#define ORD_INTEL_LS 2 /* Intel (little endian), lane swapped */
#define ORD_UNKNOWN 15 /* unknown (BIOS-calls allowed only) */
/******************************************************************************/
/* Status Info used in Device-Descriptor */
/******************************************************************************/
#define DEVICE_FREE 0 /* Device is not used */
#define DEVICE_USED 1 /* Device is used by another driver */
#define DEVICE_CALLBACK 2 /* used, but driver can be cancelled */
#define DEVICE_AVAILABLE 3 /* used, not available */
#define NO_DEVICE -1 /* no device detected */
/******************************************************************************/
/* Callback-Routine */
/******************************************************************************/
#define GET_DRIVER_ID 0 /* CB-Routine 0: Get Driver ID */
#define REMOVE_DRIVER 1 /* CB-Routine 1: Remove Driver */
/******************************************************************************/
/* Functions */
/******************************************************************************/
//#ifndef OSBIND_CLOBBER_LIST
//#define OSBIND_CLOBBER_LIST
//#endif
#ifndef trap_14_wlw
#define trap_14_wlw(n, a, b) \
__extension__ \
({ \
register long retvalue __asm__("d0"); \
long _a = (long) (a); \
short _b = (short) (b); \
\
__asm__ volatile ( \
"movw %3,sp@-\n\t" \
"movl %2,sp@-\n\t" \
"movw %1,sp@-\n\t" \
"trap #14\n\t" \
"lea sp@(8),sp" \
: "=r"(retvalue) \
: "g"(n), "r"(_a), "r"(_b) \
); \
retvalue; \
})
#endif
#ifndef trap_14_wll
#define trap_14_wll(n, a, b) \
__extension__ \
({ \
register long retvalue __asm__("d0"); \
long _a = (long) (a); \
long _b = (long) (b); \
\
__asm__ volatile ( \
"movl %3,sp@-\n\t" \
"movl %2,sp@-\n\t" \
"movw %1,sp@-\n\t" \
"trap #14\n\t" \
"lea sp@(10),sp" \
: "=r"(retvalue) \
: "g"(n), "r"(_a), "r"(_b) \
); \
retvalue; \
})
#endif
#ifndef trap_14_wlww
#define trap_14_wlww(n, a, b, c) \
__extension__ \
({ \
register long retvalue __asm__("d0"); \
long _a = (long) (a); \
short _b = (short) (b); \
short _c = (short) (c); \
\
__asm__ volatile ( \
"movl %4,sp@-\n\t" \
"movw %3,sp@-\n\t" \
"movw %2,sp@-\n\t" \
"movw %1,sp@-\n\t" \
"trap #14\n\t" \
"lea sp@(10),sp" \
: "=r"(retvalue) \
: "g"(n), "r"(_a), "r"(_b), "r"(_c) \
); \
retvalue; \
})
#endif
#ifndef trap_14_wlwl
#define trap_14_wlwl(n, a, b, c) \
__extension__ \
({ \
register long retvalue __asm__("d0"); \
long _a = (long) (a); \
short _b = (short) (b); \
long _c = (long) (c); \
\
__asm__ volatile ( \
"movl %4,sp@-\n\t" \
"movw %3,sp@-\n\t" \
"movl %2,sp@-\n\t" \
"movw %1,sp@-\n\t" \
"trap #14\n\t" \
"lea sp@(12),sp" \
: "=r"(retvalue) \
: "g"(n), "r"(_a), "r"(_b), "r"(_c) \
); \
retvalue; \
})
#endif
#ifndef trap_14_wlll
#define trap_14_wlll(n, a, b, c) \
__extension__ \
({ \
register long retvalue __asm__("d0"); \
long _a = (long) (a); \
long _b = (long) (b); \
long _c = (long) (c); \
\
__asm__ volatile ( \
"movl %4,sp@-\n\t" \
"movl %3,sp@-\n\t" \
"movl %2,sp@-\n\t" \
"movw %1,sp@-\n\t" \
"trap #14\n\t" \
"lea sp@(14),sp" \
: "=r"(retvalue) \
: "g"(n), "r"(_a), "r"(_b), "r"(_c) \
); \
retvalue; \
})
#endif
#define find_pci_device(id,index) (long)trap_14_wlw((short)(300),(unsigned long)(id),(unsigned short)(index))
#define find_pci_classcode(classcode,index) (long)trap_14_wlw((short)(301),(unsigned long)(classcode),(unsigned short)(index))
#define read_config_byte(handle,reg,address) (long)trap_14_wlwl((short)(302),(long)(handle),(unsigned short)(reg),(unsigned char *)(address))
#define read_config_word(handle,reg,address) (long)trap_14_wlwl((short)(303),(long)(handle),(unsigned short)(reg),(unsigned short *)(address))
#define read_config_longword(handle,reg,address) (long)trap_14_wlwl((short)(304),(long)(handle),(unsigned short)(reg),(unsigned long *)(address))
#define fast_read_config_byte(handle,reg) (unsigned char)trap_14_wlw((short)(305),(long)(handle),(unsigned short)(reg))
#define fast_read_config_word(handle,reg) (unsigned short)trap_14_wlw((short)(306),(long)(handle),(unsigned short)(reg))
#define fast_read_config_longword(handle,reg) (unsigned long)trap_14_wlw((short)(307),(long)(handle),(unsigned short)(reg))
#define write_config_byte(handle,reg,data) (long)trap_14_wlww((short)(308),(long)(handle),(unsigned short)(reg),(unsigned short)(data))
#define write_config_word(handle,reg,data) (long)trap_14_wlww((short)(309),(long)(handle),(unsigned short)(reg),(unsigned short)(data))
#define write_config_longword(handle,reg,data) (long)trap_14_wlwl((short)(310),(long)(handle),(unsigned short)(reg),(unsigned long)(data))
#define hook_interrupt(handle,routine,parameter) (long)trap_14_wlll((short)(311),(long)(handle),(unsigned long *)(routine),(unsigned long *)(parameter))
#define unhook_interrupt(handle) (long)trap_14_wl((short)(312),(long)(handle))
#define special_cycle(bus_number,special_cycle) (long)trap_14_wwl((short)(313),(unsigned short)(bus_number),(unsigned long)(special_cycle))
#define get_routing(handle) (long)trap_14_wl((short)(314),(long)(handle))
#define set_interrupt(handle,mode) (long)trap_14_wlw((short)(315),(long)(handle),(short)(mode))
#define get_resource(handle) (long)trap_14_wl((short)(316),(long)(handle))
#define get_card_used(handle,callback) (long)trap_14_wll((short)(317),(long)(handle),(long *)(address))
#define set_card_used(handle,callback) (long)trap_14_wll((short)(318),(long)(handle),(long *)(callback))
#define read_mem_byte(handle,offset,address) (long)trap_14_wlll((short)(319),(long)(handle),(unsigned long)(offset),(unsigned char *)(address))
#define read_mem_word(handle,offset,address) (long)trap_14_wlll((short)(320),(unsigned long)(offset),(unsigned short *)(address))
#define read_mem_longword(handle,offset,address) (long)trap_14_wlll((short)(321),(unsigned long)(offset),(unsigned long *)(address))
#define fast_read_mem_byte(handle,offset) (unsigned char)trap_14_wll((short)(322),(long)(handle),(unsigned long)(offset))
#define fast_read_mem_word(handle,offset) (unsigned short)trap_14_wll((short)(323),(long)(handle),(unsigned long)(offset))
#define fast_read_mem_longword(handle,offset) (unsigned long)trap_14_wll((short)(324),(long)(handle),(unsigned long)(offset))
#define write_mem_byte(handle,offset,data) (long)trap_14_wllw((short)(325),(long)(handle),(unsigned long)(offset),(unsigned short)(data))
#define write_mem_word(handle,offset,data) (long)trap_14_wllw((short)(326),(long)(handle),(unsigned long)(offset),(unsigned short)(data))
#define write_mem_longword(handle,offset,data) (long)trap_14_wlll((short)(327),(long)(handle),(unsigned long)(offset),(unsigned long)(data))
#define read_io_byte(handle,offset,address) (long)trap_14_wlll((short)(328),(long)(handle),(unsigned long)(offset),(unsigned char *)(address))
#define read_io_word(handle,offset,address) (long)trap_14_wlll((short)(329),(long)(handle),(unsigned long)(offset),(unsigned short *)(address))
#define read_io_longword(handle,offset,address) (long)trap_14_wlll((short)(330),(long)(handle),(unsigned long)(offset),(unsigned long *)(address))
#define fast_read_io_byte(handle,offset) (unsigned char)trap_14_wll((short)(331),(long)(handle),(unsigned long)(offset))
#define fast_read_io_word(handle,offset) (unsigned short)trap_14_wll((short)(332),(long)(handle),(unsigned long)(offset))
#define fast_read_io_longword(handle,offset) (unsigned long)trap_14_wll((short)(333),(long)(handle),(unsigned long)(offset))
#define write_io_byte(handle,offset,data) (long)trap_14_wllw((short)(334),(long)(handle),(unsigned long)(offset),(unsigned short)(data))
#define write_io_word(handle,offset,data) (long)trap_14_wllw((short)(335),(long)(handle),(unsigned long)(offset),(unsigned short)(data))
#define write_io_longword(handle,offset,data) (long)trap_14_wlll((short)(336),(long)(handle),(unsigned long)(offset),(unsigned long)(data))
#define get_machine_id() (long)trap_14_w((short)(337))
#define get_pagesize() (long)trap_14_w((short)(338))
#define virt_to_bus(handle,address,pointer) (long)trap_14_wlll((short)(339),(long)(handle),(unsigned long)(address),(unsigned long *)(pointer))
#define bus_to_virt(handle,address,pointer) (long)trap_14_wlll((short)(340),(long)(handle),(unsigned long)(address),(unsigned long *)(pointer))
#define virt_to_phys(address,pointer) (long)trap_14_wll((short)(341),(unsigned long)(address),(unsigned long *)(pointer))
#define phys_to_virt(address,pointer) (long)trap_14_wll((short)(342),(unsigned long)(address),(unsigned long *)(pointer))
#define dma_setbuffer(pci_address,local_address,size) (long)trap_14_wlll((short)(350),(unsigned long)(pci_address),(unsigned long)(local_address),(unsigned long)(size))
#define dma_buffoper(mode) (long)trap_14_ww((short)(351),(short)(mode))
#define read_mailbox(mailbox,pointer) (long)trap_14_wwl((short)(352),(short)(mailbox),(unsigned long *)(pointer))
#define write_mailbox(mailbox,data) (long)trap_14_wwl((short)(353),(short)(mailbox),(unsigned long)(data))
extern long Find_pci_device(unsigned long id, unsigned short index);
extern long Find_pci_classcode(unsigned long class, unsigned short index);
extern long Read_config_byte(long handle, unsigned short reg, unsigned char *address);
extern long Read_config_word(long handle, unsigned short reg, unsigned short *address);
extern long Read_config_longword(long handle, unsigned short reg, unsigned long *address);
extern unsigned char Fast_read_config_byte(long handle, unsigned short reg);
extern unsigned short Fast_read_config_word(long handle, unsigned short reg);
extern unsigned long Fast_read_config_longword(long handle, unsigned short reg);
extern long Write_config_byte(long handle, unsigned short reg, unsigned short val);
extern long Write_config_word(long handle, unsigned short reg, unsigned short val);
extern long Write_config_longword(long handle, unsigned short reg, unsigned long val);
extern long Hook_interrupt(long handle, unsigned long *routine, unsigned long *parameter);
extern long Unhook_interrupt(long handle);
extern long Special_cycle(unsigned short bus, unsigned long data);
extern long Get_routing(long handle);
extern long Set_interrupt(long handle);
extern long Get_resource(long handle);
extern long Get_card_used(long handle, unsigned long *address);
extern long Set_card_used(long handle, unsigned long *callback);
extern long Read_mem_byte(long handle, unsigned long offset, unsigned char *address);
extern long Read_mem_word(long handle, unsigned long offset, unsigned short *address);
extern long Read_mem_longword(long handle, unsigned long offset, unsigned long *address);
extern unsigned char Fast_read_mem_byte(long handle, unsigned long offset);
extern unsigned short Fast_read_mem_word(long handle, unsigned long offset);
extern unsigned long Fast_read_mem_longword(long handle, unsigned long offset);
extern long Write_mem_byte(long handle, unsigned long offset, unsigned short val);
extern long Write_mem_word(long handle, unsigned long offset, unsigned short val);
extern long Write_mem_longword(long handle, unsigned long offset, unsigned long val);
extern long Read_io_byte(long handle, unsigned long offset, unsigned char *address);
extern long Read_io_word(long handle, unsigned long offset, unsigned short *address);
extern long Read_io_longword(long handle, unsigned long offset, unsigned long *address);
extern unsigned char Fast_read_io_byte(long handle, unsigned long offset);
extern unsigned short Fast_read_io_word(long handle, unsigned long offset);
extern unsigned long Fast_read_io_longword(long handle, unsigned long offset);
extern long Write_io_byte(long handle, unsigned long offset, unsigned short val);
extern long Write_io_word(long handle, unsigned long offset, unsigned short val);
extern long Write_io_longword(long handle, unsigned long offset, unsigned long val);
extern long Get_machine_id(void);
extern long Get_pagesize(void);
extern long Virt_to_bus(long handle, unsigned long address, PCI_CONV_ADR *pointer);
extern long Bus_to_virt(long handle, unsigned long address, PCI_CONV_ADR *pointer);
extern long Virt_to_phys(unsigned long address, PCI_CONV_ADR *pointer);
extern long Phys_to_virt(unsigned long address, PCI_CONV_ADR *pointer);
#endif

View File

@@ -0,0 +1,206 @@
/*
* David Galvez. 2010, e-mail: dgalvez75@gmail.com
* PCI code taken from FireTos by Didier Mequignon
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "usb.h"
#include "super.h"
#include "debug.h"
#ifdef PCI_XBIOS
#include "host/ohci-pci/pci_ids.h"
#include "host/ohci-pci/pcixbios.h"
#endif
#include <mint/basepage.h>
#include <mint/cookie.h>
extern long install_usb_stor(int dev_num, unsigned long part_type,
unsigned long part_offset, unsigned long part_size,
char *vendor, char *revision, char *product);
extern int do_usb(int argc, char **argv);
extern unsigned long _PgmSize;
extern long __mint;
#ifdef PCI_XBIOS
extern struct pci_device_id usb_pci_table[]; /* ohci-hcd.c */
#endif
int usb_stor_curr_dev;
unsigned long usb_1st_disk_drive;
short max_logical_drive;
#ifdef PCI_XBIOS
short pci_init(void)
{
/* PCI devices detection */
struct pci_device_id *board;
long handle;
short usb_found;
short idx;
long err;
unsigned long class;
usb_found = 0;
idx = 0;
do {
handle = find_pci_device(0x0000FFFFL, idx++);
printf("idx %d PCI handle: %lx\n", idx -1, handle); /* Galvez: Debug */
if(handle >= 0) {
unsigned long id = 0;
err = read_config_longword(handle, PCIIDR, &id);
if((err >= 0) && !usb_found) {
if(read_config_longword(handle, PCIREV, &class) >= 0
&& ((class >> 16) == PCI_CLASS_SERIAL_USB)) {
if((class >> 8) == PCI_CLASS_SERIAL_USB_UHCI)
(void) Cconws("UHCI USB controller found\r\n");
else if((class >> 8) == PCI_CLASS_SERIAL_USB_OHCI) {
(void) Cconws("OHCI USB controller found\r\n");
#ifdef CONFIG_USB_OHCI
board = usb_pci_table; /* compare table */
while(board->vendor) {
if((board->vendor == (id & 0xFFFF))
&& (board->device == (id >> 16))) {
if(usb_init(handle, board) >= 0)
usb_found = 1;
break;
}
board++;
}
#endif /* CONFIG_USB_OHCI */
}
else if((class >> 8) == PCI_CLASS_SERIAL_USB_EHCI)
(void) Cconws("EHCI USB controller found\r\n");
}
}
}
}
while(handle >= 0);
return usb_found;
}
#endif /* PCI_XBIOS */
int main(int argc, char **argv)
{
#ifdef CONFIG_USB_STORAGE
long p = 0;
int r;
if (__mint)
max_logical_drive = 24;
else max_logical_drive = 16;
if (argc == 1) {
short usb_found = 0;
usb_stor_curr_dev = -1;
usb_1st_disk_drive = 0;
usb_stop();
#ifdef PCI_XBIOS
usb_found = pci_init();
#else
if (usb_init() >= 0)
usb_found = 1;
#endif /* PCI_XBIOS */
if (usb_found) {
/* Scan and get info from all the storage devices found */
usb_stor_curr_dev = usb_stor_scan();
/* it doesn't really return current device *
* only 0 if it has found any store device *
* -1 otherwise */
if (usb_stor_curr_dev != -1) {
int dev_num = usb_stor_curr_dev;
block_dev_desc_t *stor_dev;
while ((stor_dev = usb_stor_get_dev(dev_num)) != NULL) {
int part_num = 1;
unsigned long part_type, part_offset, part_size;
/* Now find partitions in this storage device */
while (!fat_register_device(stor_dev, part_num, &part_type,
&part_offset, &part_size)) {
if (!(Super(SUP_INQUIRE))) {
p = SuperFromUser ();
}
/* install partition */
r = install_usb_stor(dev_num, part_type, part_offset,
part_size, stor_dev->vendor,
stor_dev->revision, stor_dev->product);
if (r == -1)
printf("unable to install storage device\n");
if (p)
SuperToUser(p);
part_num++;
}
dev_num++;
}
}
#if 0
long *drvbits;
long value;
p = SuperFromUser();
drvbits = 0x000004c2;
value = *drvbits;
printf("\ndrvbits: %x \n", (unsigned)value);
SuperToUser(p);
#endif
}
if (!__mint) {
printf(" Press any key");
Bconin(DEV_CONSOLE);
}
Ptermres( _PgmSize, 0);
}
#endif /* CONFIG_USB_STORAGE */
if (strncmp(argv[1], "tree", 4) == 0) {
argc = 2;
argv[1] = "start";
do_usb(argc, argv);
argv[1] = "inf";
do_usb(argc, argv);
argv[1] = "tree";
do_usb(argc, argv);
argv[1] = "storage";
do_usb(argc, argv);
// argc = 3;
// argv[1] = "dev";
// argv[2] = "0";
// do_usb(argc, argv);
// argc = 2;
argv[1] = "stop";
do_usb (argc, argv);
printf(" Press any key\r\n");
Bconin(DEV_CONSOLE);
}
return 0;
}

View File

@@ -0,0 +1,85 @@
ifeq ($(CROSS),yes)
CC = m68k-atari-mint-gcc
STRIP = m68k-atari-mint-strip
STACK = m68k-atari-mint-stack
INCLUDE_GEM_PATH = /usr/local/cross-mint/m68k-atari-mint/include
LIB_GEM_PATH = /usr/local/cross-mint/m68k-atari-mint/lib
else
CC = gcc
STRIP = /usr/bin/strip
STACK = stack
COMPRESS = upx
INCLUDE_GEM_PATH = /usr/GEM/include
LIB_GEM_PATH = /usr/GEM/lib
endif
ifeq ($(MAKECMDGOALS), aranym)
HCD_S = ./host/aranym/natfeat_asm.S
HCD_C = ./host/aranym/aranym-hcd.c ./host/aranym/natfeat.c
HCD_H = ./host/aranym/nf_ops.h ./host/aranym/usbhost_nfapi.h
PROGRAM = stor_ara.tos
endif
ifeq ($(MAKECMDGOALS), netusbee)
HCD_C = ./host/netusbee/isp116x-hcd.c
HCD_H = ./host/netusbee/isp116x.h
PROGRAM = stor_ntu.tos
endif
ifeq ($(MAKECMDGOALS), ethernat)
HCD_C = ./host/ethernat/isp116x-hcd.c
HCD_H = ./host/ethernat/isp116x.h
PROGRAM = stor_etn.tos
endif
ifeq ($(MAKECMDGOALS), ohci-pci)
HCD_C = ./host/ohci-pci/ohci-hcd.c ./host/ohci-pci/ltoa.c
HCD_H = ./host/ohci-pci/ohci.h ./host/ohci-pci/pcixbios.h
DEFS = -DPCI_XBIOS
PROGRAM = stor_pci.tos
endif
STACKSIZE = 64k
OPTIMISATION = -O -fomit-frame-pointer
CPU = -m68020-60
LIB =
ASFLAGS = $(CPU)
CFLAGS = $(CPU) $(OPTIMISATION) -Wall -Wshadow -I$(INCLUDE_GEM_PATH) $(DEFS) -g
LFLAGS = -L$(LIB_GEM_PATH)
COBJS = main.c udelay.c cmd_usb.c usb.c usb_mem.c usb_storage.c debug.c $(HCD_C)
SOBJS = debug2.S bios.S $(HCD_S)
HSRC = config.h debug.h part.h scsi.h super.h usb.h usb_defs.h vars.h $(HCD_H)
COBJECTS = $(COBJS:.c=.o)
SOBJECTS = $(SOBJS:.S=.o)
all:
make ethernat
make netusbee
make aranym
rm -f *.o
make ohci-pci
ethernat: $(PROGRAM)
aranym: $(PROGRAM)
netusbee: $(PROGRAM)
ohci-pci: $(PROGRAM)
$(PROGRAM): $(COBJECTS) $(SOBJECTS) $(HSRC)
$(CC) -o $@ $(COBJECTS) $(SOBJECTS)
strip:
$(STRIP) $(PROGRAM)
stack:
$(STACK) -S $(STACKSIZE) $(PROGRAM)
compress:
$(COMPRESS) $(PROGRAM)
clean:
rm -f *.tos *.log
find ./ -type f -name "*.o" -exec rm -f {} \;

View File

@@ -0,0 +1,88 @@
/*
* (C) Copyright 2000-2004
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _PART_H
#define _PART_H
typedef unsigned long long uint64_t;
typedef unsigned long lbaint_t;
typedef struct block_dev_desc {
int if_type; /* type of the interface */
int dev; /* device number */
unsigned char part_type; /* partition type */
unsigned char target; /* target SCSI ID */
unsigned char lun; /* target LUN */
unsigned char type; /* device type */
unsigned char removable; /* removable device */
#ifdef CONFIG_LBA48
unsigned char lba48; /* device can use 48bit addr (ATA/ATAPI v7) */
#endif
lbaint_t lba; /* number of blocks */
unsigned long blksz; /* block size */
char vendor [40+1]; /* IDE model, SCSI Vendor */
char product[20+1]; /* IDE Serial no, SCSI product */
char revision[8+1]; /* firmware revision */
unsigned long (*block_read)(int dev, unsigned long start, lbaint_t blkcnt, void *buffer);
unsigned long (*block_write)(int dev, unsigned long start, lbaint_t blkcnt, const void *buffer);
void *priv; /* driver private struct pointer */
}block_dev_desc_t;
/* Interface types: */
#define IF_TYPE_UNKNOWN 0
#define IF_TYPE_IDE 1
#define IF_TYPE_SCSI 2
#define IF_TYPE_ATAPI 3
#define IF_TYPE_USB 4
#define IF_TYPE_DOC 5
#define IF_TYPE_MMC 6
#define IF_TYPE_SD 7
#define IF_TYPE_SATA 8
/* Part types */
#define PART_TYPE_UNKNOWN 0x00
#define PART_TYPE_MAC 0x01
#define PART_TYPE_DOS 0x02
#define PART_TYPE_ISO 0x03
#define PART_TYPE_AMIGA 0x04
#define PART_TYPE_EFI 0x05
/*
* Type string for U-Boot bootable partitions
*/
#define BOOT_PART_TYPE "U-Boot" /* primary boot partition type */
#define BOOT_PART_COMP "PPCBoot" /* PPCBoot compatibility type */
/* device types */
#define DEV_TYPE_UNKNOWN 0xff /* not connected */
#define DEV_TYPE_HARDDISK 0x00 /* harddisk */
#define DEV_TYPE_TAPE 0x01 /* Tape */
#define DEV_TYPE_CDROM 0x05 /* CD-ROM */
#define DEV_TYPE_OPDISK 0x07 /* optical disk */
void print_part(block_dev_desc_t *dev_desc);
void init_part(block_dev_desc_t *dev_desc);
void dev_print(block_dev_desc_t *dev_desc);
int fat_register_device(block_dev_desc_t *dev_desc, int part_no, unsigned long *part_type, unsigned long *part_offset, unsigned long *part_size);
#endif /* _PART_H */

View File

@@ -0,0 +1,68 @@
This application allows you to mount an USB mass storage device though
the Ethernat hardware or the Aranym USB Natfeat, read or copy files from/to this device.
It's derived from the work done by Didier Mequignon for FireTOS.
This is still quite experimental so i am not responsable for any data loss
or corruption, play with it at your own risk. Please backup your data ;-)
**** Binaries ****
stor_etn.tos ---> EtherNat
stor_ara.tos ---> Aranym
stor_ntu.tos ---> NetUSBee
stor_pci.tos ---> PCI-OHCI
Note that NetUSBee and PCI-OHCI don't work yet
**** How it works *****
Depending on your hardware run stor_etn.tos or stor_ara.tos application from your desktop,
if everything goes well you can use the "install partition" option in your desktop menu to
access the new partitions.
It has been tested it under CT060 TOS and MiNT 1.16.3.
Teted in Aranym with MiNT 1.17.0 beta and TOS 4.04.
**** Limits/Problems *****
- The supported partitions are the supported partitions by the OS.
It has been tested with FAT16 in TOS4.04, with FAT16, FAT32 and ext2 with MiNT.
- There is still no handle for mounting/unmounting partitions. Neither detection for
devices already plugged, so when you mount one device you can't unmount it.
If you run the application several times with the same USB stick plugged, it
will mount the device again as a new different logical partition.
- It's VERY VERY slow, for now the transfer rate it's quite ridiculous. I hope
to solve this soon. Under Aranym it can be better.
- I don't think that it works together with umouse from Jan Thomas.
- This is only a start don't expect too much.
- Thing desktop crashes when inquiring to show info about the device.
For feedback, suggestions or tips mail me at dgalvez75@gmail.com
**** Histoy ****
* 5/10/2010 (alfa 05)
- XHDI working (assembler version).
- Under MiNT FAT32 and ext2 partitions can be accesed.
- Introduced NetUSBee sources (not working yet)
- Introduced OHCI-PCI sources (to be tested)
* 27/8/2010 (alfa 04)
- Start XHDI translation to C.
- Support for Aranym HCD.
* 19/5/2010 (alfa 03)
- Killed a bug that could produce some corruption in the pun_info struct.
* 26/4/2010 (alfa 02)
- Under MiNT if the number of partitions was greater than 16, the driver wasn't installed.
- Wait for a key pess before retuning the desktop under TOS when driver is loaded.
- Resolved big bug that produced that data written/read above the first 16 MB to be corrupted.
* 1/3/2010 (alfa 01)
- Initial release
David Galvez 05/10/2010
Version: alfa 05

View File

@@ -0,0 +1,209 @@
/*
* (C) Copyright 2001
* Denis Peter, MPL AG Switzerland
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*/
#ifndef _SCSI_H
#define _SCSI_H
typedef struct SCSI_cmd_block{
unsigned char cmd[16]; /* command */
unsigned char sense_buf[64]; /* for request sense */
unsigned char status; /* SCSI Status */
unsigned char target; /* Target ID */
unsigned char lun; /* Target LUN */
unsigned char cmdlen; /* command len */
unsigned long datalen; /* Total data length */
unsigned char * pdata; /* pointer to data */
unsigned char msgout[12]; /* Messge out buffer (NOT USED) */
unsigned char msgin[12]; /* Message in buffer */
unsigned char sensecmdlen; /* Sense command len */
unsigned long sensedatalen; /* Sense data len */
unsigned char sensecmd[6]; /* Sense command */
unsigned long contr_stat; /* Controller Status */
unsigned long trans_bytes; /* tranfered bytes */
unsigned int priv;
}ccb;
/*-----------------------------------------------------------
**
** SCSI constants.
**
**-----------------------------------------------------------
*/
/*
** Messages
*/
#define M_COMPLETE (0x00)
#define M_EXTENDED (0x01)
#define M_SAVE_DP (0x02)
#define M_RESTORE_DP (0x03)
#define M_DISCONNECT (0x04)
#define M_ID_ERROR (0x05)
#define M_ABORT (0x06)
#define M_REJECT (0x07)
#define M_NOOP (0x08)
#define M_PARITY (0x09)
#define M_LCOMPLETE (0x0a)
#define M_FCOMPLETE (0x0b)
#define M_RESET (0x0c)
#define M_ABORT_TAG (0x0d)
#define M_CLEAR_QUEUE (0x0e)
#define M_INIT_REC (0x0f)
#define M_REL_REC (0x10)
#define M_TERMINATE (0x11)
#define M_SIMPLE_TAG (0x20)
#define M_HEAD_TAG (0x21)
#define M_ORDERED_TAG (0x22)
#define M_IGN_RESIDUE (0x23)
#define M_IDENTIFY (0x80)
#define M_X_MODIFY_DP (0x00)
#define M_X_SYNC_REQ (0x01)
#define M_X_WIDE_REQ (0x03)
#define M_X_PPR_REQ (0x04)
/*
** Status
*/
#define S_GOOD (0x00)
#define S_CHECK_COND (0x02)
#define S_COND_MET (0x04)
#define S_BUSY (0x08)
#define S_INT (0x10)
#define S_INT_COND_MET (0x14)
#define S_CONFLICT (0x18)
#define S_TERMINATED (0x20)
#define S_QUEUE_FULL (0x28)
#define S_ILLEGAL (0xff)
#define S_SENSE (0x80)
/*
* Sense_keys
*/
#define SENSE_NO_SENSE 0x0
#define SENSE_RECOVERED_ERROR 0x1
#define SENSE_NOT_READY 0x2
#define SENSE_MEDIUM_ERROR 0x3
#define SENSE_HARDWARE_ERROR 0x4
#define SENSE_ILLEGAL_REQUEST 0x5
#define SENSE_UNIT_ATTENTION 0x6
#define SENSE_DATA_PROTECT 0x7
#define SENSE_BLANK_CHECK 0x8
#define SENSE_VENDOR_SPECIFIC 0x9
#define SENSE_COPY_ABORTED 0xA
#define SENSE_ABORTED_COMMAND 0xB
#define SENSE_VOLUME_OVERFLOW 0xD
#define SENSE_MISCOMPARE 0xE
#define SCSI_CHANGE_DEF 0x40 /* Change Definition (Optional) */
#define SCSI_COMPARE 0x39 /* Compare (O) */
#define SCSI_COPY 0x18 /* Copy (O) */
#define SCSI_COP_VERIFY 0x3A /* Copy and Verify (O) */
#define SCSI_INQUIRY 0x12 /* Inquiry (MANDATORY) */
#define SCSI_LOG_SELECT 0x4C /* Log Select (O) */
#define SCSI_LOG_SENSE 0x4D /* Log Sense (O) */
#define SCSI_MODE_SEL6 0x15 /* Mode Select 6-byte (Device Specific) */
#define SCSI_MODE_SEL10 0x55 /* Mode Select 10-byte (Device Specific) */
#define SCSI_MODE_SEN6 0x1A /* Mode Sense 6-byte (Device Specific) */
#define SCSI_MODE_SEN10 0x5A /* Mode Sense 10-byte (Device Specific) */
#define SCSI_READ_BUFF 0x3C /* Read Buffer (O) */
#define SCSI_REQ_SENSE 0x03 /* Request Sense (MANDATORY) */
#define SCSI_SEND_DIAG 0x1D /* Send Diagnostic (O) */
#define SCSI_TST_U_RDY 0x00 /* Test Unit Ready (MANDATORY) */
#define SCSI_WRITE_BUFF 0x3B /* Write Buffer (O) */
/***************************************************************************
* %%% Commands Unique to Direct Access Devices %%%
***************************************************************************/
#define SCSI_COMPARE 0x39 /* Compare (O) */
#define SCSI_FORMAT 0x04 /* Format Unit (MANDATORY) */
#define SCSI_LCK_UN_CAC 0x36 /* Lock Unlock Cache (O) */
#define SCSI_PREFETCH 0x34 /* Prefetch (O) */
#define SCSI_MED_REMOVL 0x1E /* Prevent/Allow medium Removal (O) */
#define SCSI_READ6 0x08 /* Read 6-byte (MANDATORY) */
#define SCSI_READ10 0x28 /* Read 10-byte (MANDATORY) */
#define SCSI_RD_CAPAC 0x25 /* Read Capacity (MANDATORY) */
#define SCSI_RD_DEFECT 0x37 /* Read Defect Data (O) */
#define SCSI_READ_LONG 0x3E /* Read Long (O) */
#define SCSI_REASS_BLK 0x07 /* Reassign Blocks (O) */
#define SCSI_RCV_DIAG 0x1C /* Receive Diagnostic Results (O) */
#define SCSI_RELEASE 0x17 /* Release Unit (MANDATORY) */
#define SCSI_REZERO 0x01 /* Rezero Unit (O) */
#define SCSI_SRCH_DAT_E 0x31 /* Search Data Equal (O) */
#define SCSI_SRCH_DAT_H 0x30 /* Search Data High (O) */
#define SCSI_SRCH_DAT_L 0x32 /* Search Data Low (O) */
#define SCSI_SEEK6 0x0B /* Seek 6-Byte (O) */
#define SCSI_SEEK10 0x2B /* Seek 10-Byte (O) */
#define SCSI_SEND_DIAG 0x1D /* Send Diagnostics (MANDATORY) */
#define SCSI_SET_LIMIT 0x33 /* Set Limits (O) */
#define SCSI_START_STP 0x1B /* Start/Stop Unit (O) */
#define SCSI_SYNC_CACHE 0x35 /* Synchronize Cache (O) */
#define SCSI_VERIFY 0x2F /* Verify (O) */
#define SCSI_WRITE6 0x0A /* Write 6-Byte (MANDATORY) */
#define SCSI_WRITE10 0x2A /* Write 10-Byte (MANDATORY) */
#define SCSI_WRT_VERIFY 0x2E /* Write and Verify (O) */
#define SCSI_WRITE_LONG 0x3F /* Write Long (O) */
#define SCSI_WRITE_SAME 0x41 /* Write Same (O) */
#if 0
/****************************************************************************
* decleration of functions which have to reside in the LowLevel Part Driver
*/
void scsi_print_error(ccb *pccb);
int scsi_exec(ccb *pccb);
void scsi_bus_reset(void);
void scsi_low_level_init(int busdevfunc);
/***************************************************************************
* functions residing inside cmd_scsi.c
*/
void scsi_init(void);
#endif
#define SCSI_IDENTIFY 0xC0 /* not used */
/* Hardware errors */
#define SCSI_SEL_TIME_OUT 0x00000101 /* Selection time out */
#define SCSI_HNS_TIME_OUT 0x00000102 /* Handshake */
#define SCSI_MA_TIME_OUT 0x00000103 /* Phase error */
#define SCSI_UNEXP_DIS 0x00000104 /* unexpected disconnect */
#define SCSI_INT_STATE 0x00010000 /* unknown Interrupt number is stored in 16 LSB */
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#endif /* _SCSI_H */

View File

@@ -0,0 +1,58 @@
/*
* super.h
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _SUPER_H
#define _SUPER_H
static inline
long SuperFromUser()
{
register long retvalue __asm__("d0");
__asm__ volatile
(
"clr.l -(%%sp)\n\t"
"move.w #0x20,-(%%sp)\n\t"
"trap #1\n\t"
"addq.l #6,%%sp"
: "=r"(retvalue) /* outputs */
: /* inputs */
: "d1", "d2", "a0", "a1", "a2" /* clobbered regs */
);
return retvalue;
}
static inline
void SuperToUser(long ssp)
{
register long spbackup;
__asm__ volatile
(
"move.l sp,%0\n\t"
"move.l %1,-(%%sp)\n\t"
"move.w #0x20,-(%%sp)\n\t"
"trap #1\n\t"
"move.l %0,sp"
: "=&r"(spbackup) /* outputs */
: "g"(ssp) /* inputs */
: "d0", "d1", "d2", "a0", "a1", "a2" /* clobbered regs */
);
}
#endif /* _SUPER_H */

View File

@@ -0,0 +1,39 @@
/*
* David Galvez. 2010, e-mail: dgalvez75@gmail.com
* Modified from MiNTlib
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <mint/mintbind.h>
#define USEC_PER_TICK (1000000L / ((unsigned long)CLOCKS_PER_SEC))
#define USEC_TO_CLOCK_TICKS(us) ((us) / USEC_PER_TICK )
/*
* Galvez: We should use usleep POSIX function in MiNTlib, but it gives problems related with
* Fselect system call, until we trace where the problems come from we are using this function
*/
void udelay(unsigned long usec)
{
long stop;
stop = _clock() + USEC_TO_CLOCK_TICKS(usec);
while (_clock() < stop);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,470 @@
/*
* Modified for Atari by David Gálvez 2010
* Modified for Atari by Didier Mequignon 2009
*
* (C) Copyright 2001
* Denis Peter, MPL AG Switzerland
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Note: Part of this code has been derived from linux
*
*/
#ifndef _USB_H_
#define _USB_H_
#include <mint/osbind.h>
#include <mint/sysvars.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "host/ohci-pci/mod_devicetable.h"
#include "usb_defs.h"
#include "asm-m68k/types.h"
#include "asm-m68k/byteorder.h"
#include "part.h"
#ifdef PCI_XBIOS
#define in8(addr) fast_read_mem_byte(usb_handle,addr)
#define in16r(addr) fast_read_mem_word(usb_handle,addr)
#define in32r(addr) fast_read_mem_longword(usb_handle,addr)
#define out8(addr,val) write_mem_byte(usb_handle,addr,val)
#define out16r(addr,val) write_mem_word(usb_handle,addr,val)
#define out32r(addr,val) write_mem_longword(usb_handle,addr,val)
#else /* !PCI_XBIOS */
extern long *tab_funcs_pci;
#define in8(addr) Fast_read_mem_byte(usb_handle,addr)
#define in16r(addr) Fast_read_mem_word(usb_handle,addr)
#define in32r(addr) Fast_read_mem_longword(usb_handle,addr)
#define out8(addr,val) Write_mem_byte(usb_handle,addr,val)
#define out16r(addr,val) Write_mem_word(usb_handle,addr,val)
#define out32r(addr,val) Write_mem_longword(usb_handle,addr,val)
#endif /* PCI_XBIOS */
/* Everything is aribtrary */
#define USB_ALTSETTINGALLOC 4
#define USB_MAXALTSETTING 128 /* Hard limit */
#define USB_MAX_DEVICE 32
#define USB_MAXCONFIG 8
#define USB_MAXINTERFACES 8
#define USB_MAXENDPOINTS 16
#define USB_MAXCHILDREN 8 /* This is arbitrary */
#define USB_MAX_HUB 16
#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
/* String descriptor */
struct usb_string_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short wData[1];
} __attribute__ ((packed));
/* device request (setup) */
struct devrequest {
unsigned char requesttype;
unsigned char request;
unsigned short value;
unsigned short index;
unsigned short length;
} __attribute__ ((packed));
/* All standard descriptors have these 2 fields in common */
struct usb_descriptor_header {
unsigned char bLength;
unsigned char bDescriptorType;
} __attribute__ ((packed));
/* Device descriptor */
struct usb_device_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short bcdUSB;
unsigned char bDeviceClass;
unsigned char bDeviceSubClass;
unsigned char bDeviceProtocol;
unsigned char bMaxPacketSize0;
unsigned short idVendor;
unsigned short idProduct;
unsigned short bcdDevice;
unsigned char iManufacturer;
unsigned char iProduct;
unsigned char iSerialNumber;
unsigned char bNumConfigurations;
} __attribute__ ((packed));
/* Endpoint descriptor */
struct usb_endpoint_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bEndpointAddress;
unsigned char bmAttributes;
unsigned short wMaxPacketSize;
unsigned char bInterval;
unsigned char bRefresh;
unsigned char bSynchAddress;
} __attribute__ ((packed)) __attribute__ ((aligned(2)));
/* Interface descriptor */
struct usb_interface_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bInterfaceNumber;
unsigned char bAlternateSetting;
unsigned char bNumEndpoints;
unsigned char bInterfaceClass;
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
unsigned char no_of_ep;
unsigned char num_altsetting;
unsigned char act_altsetting;
struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
} __attribute__ ((packed));
/* Configuration descriptor information.. */
struct usb_config_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short wTotalLength;
unsigned char bNumInterfaces;
unsigned char bConfigurationValue;
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char MaxPower;
unsigned char no_of_if; /* number of interfaces */
struct usb_interface_descriptor if_desc[USB_MAXINTERFACES];
} __attribute__ ((packed));
enum {
/* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
PACKET_SIZE_8 = 0,
PACKET_SIZE_16 = 1,
PACKET_SIZE_32 = 2,
PACKET_SIZE_64 = 3,
};
struct usb_device {
int devnum; /* Device number on USB bus */
int speed; /* full/low/high */
char mf[32]; /* manufacturer */
char prod[32]; /* product */
char serial[32]; /* serial number */
/* Maximum packet size; one of: PACKET_SIZE_* */
int maxpacketsize;
/* one bit for each endpoint ([0] = IN, [1] = OUT) */
unsigned int toggle[2];
/* endpoint halts; one bit per endpoint # & direction;
* [0] = IN, [1] = OUT
*/
unsigned int halted[2];
int epmaxpacketin[16]; /* INput endpoint specific maximums */
int epmaxpacketout[16]; /* OUTput endpoint specific maximums */
int configno; /* selected config number */
struct usb_device_descriptor descriptor; /* Device Descriptor */
struct usb_config_descriptor config; /* config descriptor */
int have_langid; /* whether string_langid is valid yet */
int string_langid; /* language ID for strings */
int (*irq_handle)(struct usb_device *dev);
unsigned long irq_status;
int irq_act_len; /* transfered bytes */
void *privptr;
/*
* Child devices - if this is a hub device
* Each instance needs its own set of data structures.
*/
unsigned long status;
int act_len; /* transfered bytes */
int maxchild; /* Number of ports if hub */
int portnr;
struct usb_device *parent;
struct usb_device *children[USB_MAXCHILDREN];
};
/**********************************************************************
* this is how the lowlevel part communicate with the outer world
*/
#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
defined(CONFIG_USB_ARANYM_HCD)
#ifdef PCI_XBIOS
int usb_lowlevel_init(long handle, const struct pci_device_id *ent);
#else
int usb_lowlevel_init(void);
#endif
int usb_lowlevel_stop(void);
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len);
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int transfer_len, struct devrequest *setup);
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int transfer_len, int interval);
#ifdef CONFIG_USB_INTERRUPT_POLLING
void usb_event_poll(void);
#else
void usb_enable_interrupt(int enable);
#endif
/* Defines */
#define USB_UHCI_VEND_ID 0x8086
#define USB_UHCI_DEV_ID 0x7112
#else
#error USB Lowlevel not defined
#endif
#ifdef CONFIG_USB_STORAGE
#define USB_MAX_STOR_DEV 2 /* GALVEZ: DEFAULT 5 */
block_dev_desc_t *usb_stor_get_dev(int idx);
int usb_stor_scan(void);
int usb_stor_info(void);
#endif
#ifdef CONFIG_USB_MOUSE
int drv_usb_mouse_init(void);
int usb_mouse_deregister(void);
#endif
#ifdef CONFIG_USB_KEYBOARD
int drv_usb_kbd_init(void);
int usb_kbd_deregister(void);
#endif
/* memory */
void *usb_malloc(long amount);
int usb_free(void *addr);
int usb_mem_init(void);
void usb_mem_stop(void);
/* routines */
#ifdef PCI_XBIOS
int usb_init(long handle, const struct pci_device_id *ent); /* initialize the USB Controller */
#else
int usb_init(void); /* initialize the USB Controller */
#endif
int usb_stop(void); /* stop the USB Controller */
int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol);
int usb_set_idle(struct usb_device *dev, int ifnum, int duration,
int report_id);
struct usb_device *usb_get_dev_index(int idx);
int usb_control_msg(struct usb_device *dev, unsigned int pipe,
unsigned char request, unsigned char requesttype,
unsigned short value, unsigned short idx,
void *data, unsigned short size, int timeout);
int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
void *data, int len, int *actual_length, int timeout);
int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval);
void usb_disable_asynch(int disable);
int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
inline void wait_ms(unsigned long ms);
int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
int cfgno);
int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
unsigned char id, void *buf, int size);
int usb_get_class_descriptor(struct usb_device *dev, int ifnum,
unsigned char type, unsigned char id, void *buf,
int size);
int usb_clear_halt(struct usb_device *dev, int pipe);
int usb_string(struct usb_device *dev, int idx, char *buf, size_t size);
int usb_set_interface(struct usb_device *dev, int interface, int alternate);
/* big endian -> little endian conversion */
/* some CPUs are already little endian e.g. the ARM920T */
#define __swap_16(x) \
({ unsigned short x_ = (unsigned short)x; \
(unsigned short)( \
((x_ & 0x00FFU) << 8) | ((x_ & 0xFF00U) >> 8)); \
})
#define __swap_32(x) \
({ unsigned long x_ = (unsigned long)x; \
(unsigned long)( \
((x_ & 0x000000FFUL) << 24) | \
((x_ & 0x0000FF00UL) << 8) | \
((x_ & 0x00FF0000UL) >> 8) | \
((x_ & 0xFF000000UL) >> 24)); \
})
#ifdef __LITTLE_ENDIAN
# define swap_16(x) (x)
# define swap_32(x) (x)
#else
# define swap_16(x) __swap_16(x)
# define swap_32(x) __swap_32(x)
#endif
/*
* Calling this entity a "pipe" is glorifying it. A USB pipe
* is something embarrassingly simple: it basically consists
* of the following information:
* - device number (7 bits)
* - endpoint number (4 bits)
* - current Data0/1 state (1 bit)
* - direction (1 bit)
* - speed (2 bits)
* - max packet size (2 bits: 8, 16, 32 or 64)
* - pipe type (2 bits: control, interrupt, bulk, isochronous)
*
* That's 18 bits. Really. Nothing more. And the USB people have
* documented these eighteen bits as some kind of glorious
* virtual data structure.
*
* Let's not fall in that trap. We'll just encode it as a simple
* unsigned int. The encoding is:
*
* - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64)
* - direction: bit 7 (0 = Host-to-Device [Out],
* (1 = Device-to-Host [In])
* - device: bits 8-14
* - endpoint: bits 15-18
* - Data0/1: bit 19
* - speed: bit 26 (0 = Full, 1 = Low Speed, 2 = High)
* - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
* 10 = control, 11 = bulk)
*
* Why? Because it's arbitrary, and whatever encoding we select is really
* up to us. This one happens to share a lot of bit positions with the UHCI
* specification, so that much of the uhci driver can just mask the bits
* appropriately.
*/
/* Create various pipes... */
#define create_pipe(dev,endpoint) \
(((dev)->devnum << 8) | (endpoint << 15) | \
((dev)->speed << 26) | (dev)->maxpacketsize)
#define default_pipe(dev) ((dev)->speed << 26)
#define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
create_pipe(dev, endpoint))
#define usb_rcvctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
create_pipe(dev, endpoint) | \
USB_DIR_IN)
#define usb_sndisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
create_pipe(dev, endpoint))
#define usb_rcvisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
create_pipe(dev, endpoint) | \
USB_DIR_IN)
#define usb_sndbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
create_pipe(dev, endpoint))
#define usb_rcvbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
create_pipe(dev, endpoint) | \
USB_DIR_IN)
#define usb_sndintpipe(dev, endpoint) ((PIPE_INTERRUPT << 30) | \
create_pipe(dev, endpoint))
#define usb_rcvintpipe(dev, endpoint) ((PIPE_INTERRUPT << 30) | \
create_pipe(dev, endpoint) | \
USB_DIR_IN)
#define usb_snddefctrl(dev) ((PIPE_CONTROL << 30) | \
default_pipe(dev))
#define usb_rcvdefctrl(dev) ((PIPE_CONTROL << 30) | \
default_pipe(dev) | \
USB_DIR_IN)
/* The D0/D1 toggle bits */
#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep))
#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = \
((dev)->toggle[out] & \
~(1 << ep)) | ((bit) << ep))
/* Endpoint halt control/status */
#define usb_endpoint_out(ep_dir) (((ep_dir >> 7) & 1) ^ 1)
#define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
#define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
#define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
#define usb_packetid(pipe) (((pipe) & USB_DIR_IN) ? USB_PID_IN : \
USB_PID_OUT)
#define usb_pipeout(pipe) ((((pipe) >> 7) & 1) ^ 1)
#define usb_pipein(pipe) (((pipe) >> 7) & 1)
#define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f)
#define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
#define usb_pipedata(pipe) (((pipe) >> 19) & 1)
#define usb_pipespeed(pipe) (((pipe) >> 26) & 3)
#define usb_pipeslow(pipe) (usb_pipespeed(pipe) == USB_SPEED_LOW)
#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL)
#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK)
/*************************************************************************
* Hub Stuff
*/
struct usb_port_status {
unsigned short wPortStatus;
unsigned short wPortChange;
} __attribute__ ((packed));
struct usb_hub_status {
unsigned short wHubStatus;
unsigned short wHubChange;
} __attribute__ ((packed));
/* Hub descriptor */
struct usb_hub_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bNbrPorts;
unsigned short wHubCharacteristics;
unsigned char bPwrOn2PwrGood;
unsigned char bHubContrCurrent;
unsigned char DeviceRemovable[(USB_MAXCHILDREN+1+7)/8];
unsigned char PortPowerCtrlMask[(USB_MAXCHILDREN+1+7)/8];
/* DeviceRemovable and PortPwrCtrlMask want to be variable-length
bitmaps that hold max 255 entries. (bit0 is ignored) */
} __attribute__ ((packed));
struct usb_hub_device {
struct usb_device *pusb_dev;
struct usb_hub_descriptor desc;
};
#endif /*_USB_H_ */

View File

@@ -0,0 +1,251 @@
/*
* (C) Copyright 2001
* Denis Peter, MPL AG Switzerland
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Note: Part of this code has been derived from linux
*
*/
#ifndef _USB_DEFS_H_
#define _USB_DEFS_H_
/* USB constants */
/* Device and/or Interface Class codes */
#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
#define USB_CLASS_AUDIO 1
#define USB_CLASS_COMM 2
#define USB_CLASS_HID 3
#define USB_CLASS_PRINTER 7
#define USB_CLASS_MASS_STORAGE 8
#define USB_CLASS_HUB 9
#define USB_CLASS_DATA 10
#define USB_CLASS_VENDOR_SPEC 0xff
/* some HID sub classes */
#define USB_SUB_HID_NONE 0
#define USB_SUB_HID_BOOT 1
/* some UID Protocols */
#define USB_PROT_HID_NONE 0
#define USB_PROT_HID_KEYBOARD 1
#define USB_PROT_HID_MOUSE 2
/* Sub STORAGE Classes */
#define US_SC_RBC 1 /* Typically, flash devices */
#define US_SC_8020 2 /* CD-ROM */
#define US_SC_QIC 3 /* QIC-157 Tapes */
#define US_SC_UFI 4 /* Floppy */
#define US_SC_8070 5 /* Removable media */
#define US_SC_SCSI 6 /* Transparent */
#define US_SC_MIN US_SC_RBC
#define US_SC_MAX US_SC_SCSI
/* STORAGE Protocols */
#define US_PR_CB 1 /* Control/Bulk w/o interrupt */
#define US_PR_CBI 0 /* Control/Bulk/Interrupt */
#define US_PR_BULK 0x50 /* bulk only */
/* USB types */
#define USB_TYPE_STANDARD (0x00 << 5)
#define USB_TYPE_CLASS (0x01 << 5)
#define USB_TYPE_VENDOR (0x02 << 5)
#define USB_TYPE_RESERVED (0x03 << 5)
/* USB recipients */
#define USB_RECIP_DEVICE 0x00
#define USB_RECIP_INTERFACE 0x01
#define USB_RECIP_ENDPOINT 0x02
#define USB_RECIP_OTHER 0x03
/* USB directions */
#define USB_DIR_OUT 0
#define USB_DIR_IN 0x80
/* USB device speeds */
#define USB_SPEED_FULL 0x0 /* 12Mbps */
#define USB_SPEED_LOW 0x1 /* 1.5Mbps */
#define USB_SPEED_HIGH 0x2 /* 480Mbps */
#define USB_SPEED_RESERVED 0x3
/* Descriptor types */
#define USB_DT_DEVICE 0x01
#define USB_DT_CONFIG 0x02
#define USB_DT_STRING 0x03
#define USB_DT_INTERFACE 0x04
#define USB_DT_ENDPOINT 0x05
#define USB_DT_HID (USB_TYPE_CLASS | 0x01)
#define USB_DT_REPORT (USB_TYPE_CLASS | 0x02)
#define USB_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
/* Descriptor sizes per descriptor type */
#define USB_DT_DEVICE_SIZE 18
#define USB_DT_CONFIG_SIZE 9
#define USB_DT_INTERFACE_SIZE 9
#define USB_DT_ENDPOINT_SIZE 7
#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
#define USB_DT_HUB_NONVAR_SIZE 7
#define USB_DT_HID_SIZE 9
/* Endpoints */
#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
#define USB_ENDPOINT_DIR_MASK 0x80
#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
#define USB_ENDPOINT_XFER_CONTROL 0
#define USB_ENDPOINT_XFER_ISOC 1
#define USB_ENDPOINT_XFER_BULK 2
#define USB_ENDPOINT_XFER_INT 3
/* USB Packet IDs (PIDs) */
#define USB_PID_UNDEF_0 0xf0
#define USB_PID_OUT 0xe1
#define USB_PID_ACK 0xd2
#define USB_PID_DATA0 0xc3
#define USB_PID_UNDEF_4 0xb4
#define USB_PID_SOF 0xa5
#define USB_PID_UNDEF_6 0x96
#define USB_PID_UNDEF_7 0x87
#define USB_PID_UNDEF_8 0x78
#define USB_PID_IN 0x69
#define USB_PID_NAK 0x5a
#define USB_PID_DATA1 0x4b
#define USB_PID_PREAMBLE 0x3c
#define USB_PID_SETUP 0x2d
#define USB_PID_STALL 0x1e
#define USB_PID_UNDEF_F 0x0f
/* Standard requests */
#define USB_REQ_GET_STATUS 0x00
#define USB_REQ_CLEAR_FEATURE 0x01
#define USB_REQ_SET_FEATURE 0x03
#define USB_REQ_SET_ADDRESS 0x05
#define USB_REQ_GET_DESCRIPTOR 0x06
#define USB_REQ_SET_DESCRIPTOR 0x07
#define USB_REQ_GET_CONFIGURATION 0x08
#define USB_REQ_SET_CONFIGURATION 0x09
#define USB_REQ_GET_INTERFACE 0x0A
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNCH_FRAME 0x0C
/* HID requests */
#define USB_REQ_GET_REPORT 0x01
#define USB_REQ_GET_IDLE 0x02
#define USB_REQ_GET_PROTOCOL 0x03
#define USB_REQ_SET_REPORT 0x09
#define USB_REQ_SET_IDLE 0x0A
#define USB_REQ_SET_PROTOCOL 0x0B
/* "pipe" definitions */
#define PIPE_ISOCHRONOUS 0
#define PIPE_INTERRUPT 1
#define PIPE_CONTROL 2
#define PIPE_BULK 3
#define PIPE_DEVEP_MASK 0x0007ff00
#define USB_ISOCHRONOUS 0
#define USB_INTERRUPT 1
#define USB_CONTROL 2
#define USB_BULK 3
/* USB-status codes: */
#define USB_ST_ACTIVE 0x1 /* TD is active */
#define USB_ST_STALLED 0x2 /* TD is stalled */
#define USB_ST_BUF_ERR 0x4 /* buffer error */
#define USB_ST_BABBLE_DET 0x8 /* Babble detected */
#define USB_ST_NAK_REC 0x10 /* NAK Received*/
#define USB_ST_CRC_ERR 0x20 /* CRC/timeout Error */
#define USB_ST_BIT_ERR 0x40 /* Bitstuff error */
#define USB_ST_NOT_PROC 0x80000000L /* Not yet processed */
/*************************************************************************
* Hub defines
*/
/*
* Hub request types
*/
#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
/*
* Hub Class feature numbers
*/
#define C_HUB_LOCAL_POWER 0
#define C_HUB_OVER_CURRENT 1
/*
* Port feature numbers
*/
#define USB_PORT_FEAT_CONNECTION 0
#define USB_PORT_FEAT_ENABLE 1
#define USB_PORT_FEAT_SUSPEND 2
#define USB_PORT_FEAT_OVER_CURRENT 3
#define USB_PORT_FEAT_RESET 4
#define USB_PORT_FEAT_POWER 8
#define USB_PORT_FEAT_LOWSPEED 9
#define USB_PORT_FEAT_HIGHSPEED 10
#define USB_PORT_FEAT_C_CONNECTION 16
#define USB_PORT_FEAT_C_ENABLE 17
#define USB_PORT_FEAT_C_SUSPEND 18
#define USB_PORT_FEAT_C_OVER_CURRENT 19
#define USB_PORT_FEAT_C_RESET 20
/* wPortStatus bits */
#define USB_PORT_STAT_CONNECTION 0x0001
#define USB_PORT_STAT_ENABLE 0x0002
#define USB_PORT_STAT_SUSPEND 0x0004
#define USB_PORT_STAT_OVERCURRENT 0x0008
#define USB_PORT_STAT_RESET 0x0010
#define USB_PORT_STAT_POWER 0x0100
#define USB_PORT_STAT_LOW_SPEED 0x0200
#define USB_PORT_STAT_HIGH_SPEED 0x0400 /* support for EHCI */
#define USB_PORT_STAT_SPEED \
(USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED)
/* wPortChange bits */
#define USB_PORT_STAT_C_CONNECTION 0x0001
#define USB_PORT_STAT_C_ENABLE 0x0002
#define USB_PORT_STAT_C_SUSPEND 0x0004
#define USB_PORT_STAT_C_OVERCURRENT 0x0008
#define USB_PORT_STAT_C_RESET 0x0010
/* wHubCharacteristics (masks) */
#define HUB_CHAR_LPSM 0x0003
#define HUB_CHAR_COMPOUND 0x0004
#define HUB_CHAR_OCPM 0x0018
/*
*Hub Status & Hub Change bit masks
*/
#define HUB_STATUS_LOCAL_POWER 0x0001
#define HUB_STATUS_OVERCURRENT 0x0002
#define HUB_CHANGE_LOCAL_POWER 0x0001
#define HUB_CHANGE_OVERCURRENT 0x0002
#endif /*_USB_DEFS_H_ */

View File

@@ -0,0 +1,220 @@
/*
* usb_mem.c
*
* based from Emutos / BDOS
*
* Copyright (c) 2001 Lineo, Inc.
*
* Authors: Karl T. Braun, Martin Doering, Laurent Vogel
*
* This file is distributed under the GPL, version 2 or at your
* option any later version.
*/
#include <mint/errno.h>
#include <mint/osbind.h>
#include <string.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define USB_BUFFER_SIZE 0x10000
static void *usb_buffer;
/* MD - Memory Descriptor */
#define MD struct _md_
MD
{
MD *m_link;
long m_start;
long m_length;
};
/* MPB - Memory Partition Block */
#define MPB struct _mpb
MPB
{
MD *mp_mfl;
MD *mp_mal;
MD *mp_rover;
};
#define MAXMD 100
static int count_md;
static MD tab_md[MAXMD];
static MPB pmd;
static MD *ffit(long amount, MPB *mp)
{
MD *p,*q,*p1; /* free list is composed of MD's */
int maxflg;
long maxval;
if(amount != -1)
{
amount += 15; /* 16 bytes alignment */
amount &= 0xFFFFFFF0;
}
if((q = mp->mp_rover) == 0) /* get rotating pointer */
return(0) ;
maxval = 0;
maxflg = (amount == -1 ? TRUE : FALSE) ;
p = q->m_link; /* start with next MD */
do /* search the list for an MD with enough space */
{
if(p == 0)
{
/* at end of list, wrap back to start */
q = (MD *) &mp->mp_mfl; /* q => mfl field */
p = q->m_link; /* p => 1st MD */
}
if((!maxflg) && (p->m_length >= amount))
{
/* big enough */
if(p->m_length == amount)
q->m_link = p->m_link; /* take the whole thing */
else
{
/* break it up - 1st allocate a new
MD to describe the remainder */
if(count_md >= MAXMD)
return(0);
p1 = &tab_md[count_md++];
/* init new MD */
p1->m_length = p->m_length - amount;
p1->m_start = p->m_start + amount;
p1->m_link = p->m_link;
p->m_length = amount; /* adjust allocated block */
q->m_link = p1;
}
/* link allocate block into allocated list,
mark owner of block, & adjust rover */
p->m_link = mp->mp_mal;
mp->mp_mal = p;
mp->mp_rover = (q == (MD *) &mp->mp_mfl ? q->m_link : q);
return(p); /* got some */
}
else if(p->m_length > maxval)
maxval = p->m_length;
p = ( q=p )->m_link;
}
while(q != mp->mp_rover);
/* return either the max, or 0 (error) */
if(maxflg)
{
maxval -= 15; /* 16 bytes alignment */
if(maxval < 0)
maxval = 0;
else
maxval &= 0xFFFFFFF0;
}
return(maxflg ? (MD *) maxval : 0);
}
static void freeit(MD *m, MPB *mp)
{
MD *p, *q;
q = 0;
for(p = mp->mp_mfl; p ; p = (q=p) -> m_link)
{
if(m->m_start <= p->m_start)
break;
}
m->m_link = p;
if(q)
q->m_link = m;
else
mp->mp_mfl = m;
if(!mp->mp_rover)
mp->mp_rover = m;
if(p)
{
if(m->m_start + m->m_length == p->m_start)
{ /* join to higher neighbor */
m->m_length += p->m_length;
m->m_link = p->m_link;
if(p == mp->mp_rover)
mp->mp_rover = m;
if(count_md>=0)
count_md--;
}
}
if(q)
{
if(q->m_start + q->m_length == m->m_start)
{ /* join to lower neighbor */
q->m_length += m->m_length;
q->m_link = m->m_link;
if(m == mp->mp_rover)
mp->mp_rover = q;
if(count_md>=0)
count_md--;
}
}
}
int usb_free(void *addr)
{
MD *p,**q;
MPB *mpb;
mpb = &pmd;
if(usb_buffer == NULL)
return(EFAULT);
for(p = *(q = &mpb->mp_mal); p; p = *(q = &p->m_link))
{
if((long)addr == p->m_start)
break;
}
if(!p)
return(EFAULT);
*q = p->m_link;
freeit(p,mpb);
return(0);
}
void *usb_malloc(long amount)
{
MD *m;
if(usb_buffer == NULL)
return(NULL);
if(amount == -1L)
return((void *)ffit(-1L,&pmd));
if(amount <= 0 )
return(0);
if((amount & 1))
amount++;
m = ffit(amount,&pmd);
if(m == NULL)
return(NULL);
return((void *)m->m_start);
}
int usb_mem_init(void)
{
usb_buffer = (void *)Mxalloc(USB_BUFFER_SIZE + 16, 0); /* STRAM - cache in writethough */
if(usb_buffer == NULL)
return(-1);
pmd.mp_mfl = pmd.mp_rover = &tab_md[0];
tab_md[0].m_link = (MD *)NULL;
tab_md[0].m_start = ((long)usb_buffer + 15) & ~15;
tab_md[0].m_length = USB_BUFFER_SIZE;
pmd.mp_mal = (MD *)NULL;
count_md = 1;
return(0);
}
void usb_mem_stop(void)
{
if(usb_buffer != NULL)
Mfree(usb_buffer);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,83 @@
/*
* Modified by David Gálvez 2010.
*
* TOS 4.04 Xbios vars for the CT60 board
* Didier Mequignon 2002-2005, e-mail: aniplay@wanadoo.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VARS_H
#define _VARS_H
#define etv_timer 0x400
#define etv_critic 0x404
#define memvalid 0x420
#define memctrl 0x424
#define resvalid 0x426
#define resvector 0x42A
#define phystop 0x42E
#define _memtop 0x436
#define memval2 0x43A
#define flock 0x43E
#define _timer_ms 0x442
#define _bootdev 0x446
#define sshiftmd 0x44C
#define _v_bas_ad 0x44E
#define vblsem 0x452
#define nvbls 0x454
#define _vblqueue 0x456
#define colorptr 0x45A
#define _vbclock 0x462
#define _frclock 0x466
#define hdv_init 0x46A
#define HDV_BPB 0x472
#define hdv_bpb 0x472
#define HDV_RW 0x476
#define hdv_rw 0x476
#define hdv_boot 0x47A
#define HDV_MEDIACH 0x47E
#define hdv_mediach 0x47E
#define _cmdload 0x482
#define conterm 0x484
#define trp14ret 0x486
#define __md 0x49E
#define savptr 0x4A2
#define _nflops 0x4A6
#define con_state 0x4A8
#define save_row 0x4AC
#define _hz_200 0x4BA
#define _DRVBITS 0x4C2
#define _drvbits 0x4C2
#define DSKBUFP 0x4C6
#define _dskbufp 0x4C6
#define _dumpflg 0x4EE
#define _sysbase 0x4F2
#define exec_os 0x4FE
#define dump_vec 0x502
#define ptr_stat 0x506
#define ptr_vec 0x50A
#define aux_sta 0x50E
#define aux_vec 0x512
#define PUN_PTR 0x516
#define memval3 0x51A
#define proc_type 0x59E
#define COOKIE 0x5A0
#define cookie 0x5A0
#endif

View File

@@ -0,0 +1,391 @@
/***************** NOT READY YET ***********************/
/**************** ONLY EXPERIMENTAL ********************/
/* TOS 4.04 Xbios dispatcher for the CT60/CTPCI boards
* and USB-disk / Ram-Disk utility
* Didier Mequignon 2005-2009, e-mail: aniplay@wanadoo.fr
*
* Translation to C by David Galvez. 2010, e-mail: dgalvez75@gmail.com
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <mint/osbind.h>
#include "config.h"
#include "vars.h"
#include "xhdi.h"
#include "debug.h"
long *drvbits = (long *)_DRVBITS;
struct pun_info *old_pun_ptr = (struct pun_info *)0x512;
struct usb_pun_info pun_ptr_usb;
XBRA xbra_hdv_bpb;
XBRA xbra_hdv_rw;
XBRA xbra_hdv_mediach;
extern long usb_1st_disk_drive;
extern short max_logical_drive;
extern unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer);
void drive_full_usb(void)
{
DEBUG_XHDI("\n");
}
long __CDECL hdv_bpb_usb(void)
{
unsigned short dev;
long r;
__asm__ volatile /* get arguments from the stack */
(
"move.w 12(%%sp),%0\n\t"
:/*outputs*/ "=m" (dev)
:/*inputs*/
);
__asm__ volatile /* call old vector */
(
"movem.l %%d2-%%d7/%%a2-%%a6,-(%%sp)\n\t" /* important to save register */
"move.l %1,%%a0\n\t"
"move.w #0,-(%%sp)\n\t"
"move.w %2,-(%%sp)\n\t"
"jsr (%%a0)\n\t"
"addq.l #4,%%sp\n\t"
"move.l %%d0,%0\n\t"
"movem.l (%%sp)+,%%d2-%%d7/%%a2-%%a6\n\t"
:/*outputs*/ "=r" (r)
:/*inputs*/ "m" (xbra_hdv_bpb.xb_oldvec), "m" (dev)
:"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a2", "a3", "a4", "a5" /*clobbered regs*/
);
return r;
}
long __CDECL hdv_rw_usb(void)
{
void *buf;
short count, recno, dev, mode;
long lrecno;
long r = 0;
__asm__ volatile /* get arguments from the stack */
(
"move.l 18(%%sp),%0\n\t"
"move.w 14(%%sp),%1\n\t"
"move.w 12(%%sp),%2\n\t"
"move.w 10(%%sp),%3\n\t"
"move.l 8(%%sp),%4\n\t"
"move.w 4(%%sp),%5\n\t"
:/*outputs*/ "=r" (lrecno), "=r" (dev) ,"=r" (recno), "=r" (count), "=r" (buf), "=r" (mode)
:/*inputs*/
);
DEBUG_XHDI("lrecno %lx dev %d recno %x count %d mode %x\n",
lrecno, dev, recno, count, mode);
DEBUG_XHDI("\n");
DEBUG_XHDI("rw\n");
__asm__ volatile /* call old vector */
(
"movem.l %%d2-%%d7/%%a2-%%a6,-(%%sp)\n\t"
"move.l %1,%%a0\n\t"
"move.l (%%a0),%%d0\n\t"
"move.w #0,-(%%sp)\n\t"
"move.l %2,-(%%sp)\n\t"
"move.w %3,-(%%sp)\n\t"
"move.w %4,-(%%sp)\n\t"
"move.w %5,-(%%sp)\n\t"
"move.l %6,-(%%sp)\n\t"
"move.w %7,-(%%sp)\n\t"
"move.l %%d0,%%a0\n\t"
"jsr (%%a0)\n\t"
"addq.l #4,%%sp\n\t"
"move.l %%d0,%0\n\t"
"movem.l (%%sp)+,%%d2-%%d7/%%a2-%%a6\n\t"
:/*outputs*/ "=r" (r)
:/*inputs*/ "r" (xbra_hdv_rw.xb_oldvec), "r" (lrecno), "r" (dev) ,"r" (recno), "r" (count), "r" (buf), "r" (mode)
:"d0"/*, "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a2", "a3", "a4", "a5" clobbered regs*/
);
// r = (*xbra_hdv_rw.xb_oldvec)(mode, buf, num, recno, dev, l);
DEBUG_XHDI (" r %lx \n", r);
return r;
}
long __CDECL hdv_mediach_usb(void)
{
DEBUG_XHDI("\n");
DEBUG_XHDI("mediach\n");
short dev, dev1, dev2;
long r;
__asm__ volatile /* get arguments from the stack */
(
"move.w 2(%%sp),%0\n\t"
"move.w 4(%%sp),%1\n\t"
"move.w 6(%%sp),%2\n\t"
:/*outputs*/ "=r" (dev), "=r" (dev1), "=r" (dev2)
:/*inputs*/
);
DEBUG_XHDI (" dev(2) %x dev(4) %x dev(6) %x\n", dev, dev1, dev2);
__asm__ volatile /* call old vector */
(
"movem.l %%d2-%%d7/%%a2-%%a6,-(%%sp)\n\t"
"move.l %1,%%a0\n\t"
"move.l (%%a0),%%d0\n\t"
"move.w #0,-(%%sp)\n\t"
"move.w %2,-(%%sp)\n\t"
"move.l %%d0,%%a0\n\t"
"jsr (%%a0)\n\t"
"addq.l #4,%%sp\n\t"
"move.l %%d0,%0\n\t"
"movem.l (%%sp)+,%%d2-%%d7/%%a2-%%a6\n\t"
:/*outputs*/ "=r" (r)
:/*inputs*/ "r" (xbra_hdv_mediach.xb_oldvec), "r" (dev)
:"d0"/*, "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a2", "a3", "a4", "a5" clobbered regs*/
);
// printf (" r %lx \n", r);
// r = (*xbra_hdv_mediach.xb_oldvec)(d);
// DEBUG_XHDI("Calling vector: %x\n", xbra_hdv_mediach.xb_oldvec);
// r = (*xbra_hdv_mediach.xb_oldvec)(5);
DEBUG_XHDI(" r %lx \n", r);
return r;
}
void install_xbra(XBRA *xbra_hd, long id, long old_vec, long (*handle)())
{
DEBUG_XHDI("\n");
#define XBRA_MAGIC 0x58425241L /* "XBRA" */
#define JMP_OPCODE 0x4EF9
xbra_hd->xb_magic = XBRA_MAGIC;
xbra_hd->xb_id = id;
xbra_hd->xb_oldvec = *((Func *)old_vec);
xbra_hd->jump = JMP_OPCODE;
xbra_hd->handle = (Func) handle;
*((Func *)old_vec) = xbra_hd->handle;
DEBUG_XHDI("id: %x xbra_hd->xb_oldvec %x old_vec %x old_vec (*) %x old_vec (&) %x\n",
xbra_hd->xb_id, xbra_hd->xb_oldvec, old_vec, *((Func *)old_vec), &old_vec);
__asm__ volatile /* clean cache ??? */
(
"cpusha BC\n\t"
:/*outputs*/
:/*inputs*/
);
}
void usb_drive_ok(void)
{
DEBUG_XHDI("\n");
}
long install_usb_partition(unsigned char drive, int dev_num, unsigned long part_type,
unsigned long part_offset, unsigned long part_size)
{
DEBUG_XHDI("\n");
int *dskbufp = (int *)DSKBUFP;
unsigned short status_register;
long old_hdv_bpb;
long old_hdv_rw;
long old_hdv_mediach;
if (drive < 16) {
(pun_ptr_usb.puns)++;
pun_ptr_usb.pun[drive] = dev_num | PUN_USB;
pun_ptr_usb.pstart[drive] = part_offset;
pun_ptr_usb.ptype[drive] = part_type;
pun_ptr_usb.psize[drive] = part_size;
/* flags B15:swap, B7:change, B0:bootable */
#define BOOTABLE 0x0001
#define CHANGE 0x0080
#define SWAP 0x8000
pun_ptr_usb.flags[drive] = CHANGE;
}
if (drive < 16) {
old_pun_ptr->puns++;
old_pun_ptr->pun[drive] = dev_num | PUN_USB;
}
if (usb_stor_read (dev_num, part_offset, 1, (void *)(*dskbufp)) == 0)
return -1;
if (usb_1st_disk_drive)
usb_drive_ok();
usb_1st_disk_drive = drive;
long r;
r = (long)Getbpb (2);
DEBUG_XHDI("Before int. Getbpb return: %x \n", r);
__asm__ volatile /* mask interrupts */
(
"move.w %%sr,%%d0\n\t"
"move.w %%d0,%0\n\t"
"or.l #0x700,%%d0\n\t"
"move.w %%d0,%%sr\n\t"
:/*outputs*/ "=r" (status_register)
:/*inputs*/
:"d0" /*clobbered regs*/
);
#define _USB 0x5F555342 /* _USB */
long id = _USB;
old_hdv_bpb = (long)HDV_BPB;
DEBUG_XHDI("id: %x old_hdv_bpb %x old_hdv_bpb (*) %x hdv_bpb_usb %x\n",
id, old_hdv_bpb, *((Func *)old_hdv_bpb), hdv_bpb_usb);
install_xbra(&xbra_hdv_bpb, id, old_hdv_bpb, hdv_bpb_usb);
DEBUG_XHDI("id: %x old_hdv_bpb %x old_hdv_bpb (*) %x hdv_bpb_usb %x\n",
xbra_hdv_bpb.xb_id, xbra_hdv_bpb.xb_oldvec, *((Func *)xbra_hdv_bpb.xb_oldvec), xbra_hdv_bpb.handle);
#if 0
old_hdv_rw = (long)HDV_RW;
DEBUG_XHDI("id: %x old_hdv_rw %x old_hdv_rw (*) %x hdv_rw_usb %x\n",
id, old_hdv_rw, *((Func *)old_hdv_rw), hdv_rw_usb);
install_xbra(&xbra_hdv_rw, id, old_hdv_rw, hdv_rw_usb);
DEBUG_XHDI("id: %x old_hdv_rw %x old_hdv_rw (*) %x hdv_rw_usb %x\n",
xbra_hdv_rw.xb_id, xbra_hdv_rw.xb_oldvec, *((Func *)xbra_hdv_rw.xb_oldvec), xbra_hdv_rw.handle);
old_hdv_mediach = (long)HDV_MEDIACH;
DEBUG_XHDI("id: %x old_hdv_mediach %x old_hdv_mediach (*) %x hdv_mediach_usb %x\n",
id, old_hdv_mediach, *((Func *)old_hdv_mediach), hdv_mediach_usb);
install_xbra(&xbra_hdv_mediach, id, old_hdv_mediach, hdv_mediach_usb);
DEBUG_XHDI("id: %x old_hdv_mediach %x old_hdv_mediach (*) %x hdv_mediach_usb %x\n",
xbra_hdv_mediach.xb_id, xbra_hdv_mediach.xb_oldvec, *((Func *)xbra_hdv_mediach.xb_oldvec), xbra_hdv_mediach.handle);
#endif
r = (long)Getbpb (4);
DEBUG_XHDI("Before int. Getbpb return: %x \n", r);
// Bconin(DEV_CONSOLE);
__asm__ volatile /* restore interrupts */
(
"move.w %%sr,%%d0\n\t"
"and.w %0,%%d0\n\t"
"move.w %%d0,%%sr\n\t"
:/*outputs*/
:/*inputs*/ "r" (status_register)
:"d0"
);
DEBUG_XHDI("after restore interrups\n");
// Bconin(DEV_CONSOLE);
return 0;
}
unsigned char search_empty_drive(int dev_num, unsigned long part_type,
unsigned long part_offset, unsigned long part_size)
{
DEBUG_XHDI("\n");
unsigned char drive = 2;
DEBUG_XHDI("drvbits: %x\n", *drvbits);
while (drive < MAX_LOGICAL_DRIVE) {
if (!(*drvbits & (0x00000001 << drive))) {
DEBUG_XHDI("drive: %d\n", drive);
if (install_usb_partition(drive, dev_num, part_type, part_offset, part_size) == -1) {
DEBUG_XHDI("Couldn't install USB partition\n");
return -1;
}
else return drive;
}
drive++;
}
printf("all drives already used!\n\r");
return -1;
}
unsigned char add_partition(int dev_num, unsigned long part_type,
unsigned long part_offset, unsigned long part_size)
{
DEBUG_XHDI("\n");
unsigned char i;
unsigned char drive;
pun_ptr_usb.puns = 0x0000;
pun_ptr_usb.version_num = 0x0300;
pun_ptr_usb.max_sect_siz = 0x4000;
for (i=0; i<16; i++)
pun_ptr_usb.pun[i] = 0xff;
if ((drive = search_empty_drive(dev_num, part_type, part_offset, part_size)) == -1)
return -1;
return drive;
}
int install_usb_stor(int dev_num, unsigned long part_type,
unsigned long part_offset, unsigned long part_size,
char *vendor, char *revision, char *product )
{
DEBUG_XHDI("\n");
unsigned char part_num;
if (dev_num <= PUN_DEV) { /* Max. of 32 USB storage devices */
switch (part_type) { /* Although real limit is 16 of pinfo struct */
case GEM:
break;
case BGM:
break;
case RAW:
break;
case FAT16_32MB:
break;
case FAT16:
break;
case FAT16_WIN95:
break;
case FAT32:
break;
case FAT32_II:
break;
default:
printf("Invalid partition type (0x%08lx)\r\n", part_type);
return -1;
}
if ((part_num = add_partition(dev_num, part_type, part_offset, part_size)) == -1)
return -1;
else return 0;
}
printf("Maxim number(%d) of USB storage device reached \n\r", dev_num);
return -1;
}

View File

@@ -0,0 +1,101 @@
/*
* David Galvez. 2010, e-mail: dgalvez75@gmail.com
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _XHDI_H
#define _XHDI_H
typedef long __CDECL (*Func)();
//#define old_pun_ptr 0x516
#undef PUN_PTR
//#define pun_ptr pun_ptr_usb
#define MAX_LOGICAL_DRIVE max_logical_drive
/* AHDI */
#define PUN_DEV 0x1F /* device number of HD */
#define PUN_UNIT 0x07 /* Unit number */
#define PUN_SCSI 0x08 /* 1=SCSI 0=ACSI */
#define PUN_IDE 0x10 /* Falcon IDE */
#define PUN_USB 0x20 /* USB */
#define PUN_REMOVABLE 0x40 /* Removable media */
#define PUN_VALID 0x80 /* zero if valid */
#define PINFO_PUNS 0 // 2 bytes
#define PINFO_PUN 2 // 16 bytes
#define PINFO_PSTART 18 // 16 x 4 bytes
#define PINFO_COOKIE 82 // 4 bytes
#define PINFO_COOKPTR 86 // 4 bytes
#define PINFO_VERNUM 90 // 2 bytes
#define PINFO_MAXSIZE 92 // 2 bytes
#define PINFO_PTYPE 94 // 16 x 4 bytes
#define PINFO_PSIZE 158 // 16 x 4 bytes
#define PINFO_FLAGS 222 // 16 x 2 bytes, internal use: B15:swap, B7:change, B0:bootable
#define PINFO_BPB 256 // 16 x 32 bytes
#define PINFO_SIZE 768
struct pun_info
{
short puns; /* Number of HD's */
char pun [16]; /* AND with masks below: */
long pstart [16];
long cookie; /* 'AHDI' if following valid */
long *cook_ptr; /* Points to 'cookie' */
unsigned short version_num; /* AHDI version */
unsigned short max_sect_siz; /* Max logical sec size */
long reserved[16]; /* Reserved */
};
struct usb_pun_info
{
short puns; /* Number of HD's */
char pun [16]; /* AND with masks below: */
long pstart [16];
long cookie; /* 'AHDI' if following valid */
long *cook_ptr; /* Points to 'cookie' */
unsigned short version_num; /* AHDI version */
unsigned short max_sect_siz; /* Max logical sec size */
long reserved[16]; /* Reserved */
long ptype[16];
long psize[16];
unsigned short flags[16];
};
/* PARTITIONS TYPES */
#define GEM 0x47454D // GEM up to 16 MB
#define BGM 0x42474D // BGM over 16 MB
#define RAW 0x524157 // RAW
#define FAT16_32MB 0x4 // DOS FAT16 up to 32 MB
#define FAT16 0x6 // DOS FAT16 over 32 MB
#define FAT16_WIN95 0xE // WIN95 FAT16
#define FAT32 0xB // FAT32
#define FAT32_II 0xC // FAT32
typedef struct xbra XBRA;
struct xbra {
long xb_magic; /* "XBRA" = 0x58425241 */
long xb_id; /* ID of four ASCII characters */
Func xb_oldvec; /* Old value of the vectors */
short jump;
Func handle;
};
#endif /* _XHDI_H */

View File

@@ -0,0 +1,6 @@
#!/bin/bash
export DSP_PATH=~/.wine/drive_c/Programme/Motorola/DSP56300/clas
wine $DSP_PATH/asm56300.exe -b -g -l $1.asm
wine $DSP_PATH/dsplnk.exe $1.cln
wine $DSP_PATH/cldlod.exe $1.cld > $1.lod

View File

@@ -0,0 +1,13 @@
move #1,n1
move #10,r1
nop
move (r1)+n1
move #15,m1
rep #10
move (r1)+n1
move #10,n1
rep #10
move (r1)+n1

View File

@@ -0,0 +1,12 @@
; clear CCR
andi #$00,CCR
move #>0.25,a
abs a
move #>-0.25,a
abs a
move #>0,a
abs a
move #>$80,a2
abs a

View File

@@ -0,0 +1,11 @@
move #>0,y0
move #>1,y1
clr b
move #>1,b0
; set only carry bit
andi #$00,ccr
ori #$01,ccr
adc y,b
move #>$800000,y1
move #>$80,b2
adc y,b

View File

@@ -0,0 +1,11 @@
move #>0,y0
move #>1,y1
clr b
move #>1,b0
; set only carry bit
andi #$00,ccr
ori #$01,ccr
add y,b
move #>$800000,y1
move #>$80,b2
add y,b

View File

@@ -0,0 +1,9 @@
move #>$55,a
clr b
move #>$55,b0
andi #$00,ccr
addl a,b
move #>$AA,a
addl a,b
move #>$80,b2
addl a,b

View File

@@ -0,0 +1,9 @@
move #>$55,a
clr b
move #>$55,b0
andi #$00,ccr
addr a,b
move #>$AA,a
addr a,b
move #>$80,b2
addr a,b

View File

@@ -0,0 +1,12 @@
move #>$000FFF,y0
move #>$FFFFFF,b
andi #$00,ccr
and y0,b
move #>$FFF000,y0
move #>$FFFFFF,b
andi #$00,ccr
and y0,b
move #>$000000,y0
move #>$FFFFFF,b
andi #$00,ccr
and y0,b

View File

@@ -0,0 +1,8 @@
; move #>0,y0
; move #>1,y1
clr b
move #>$A5,b0
move #>$A5,b1
move #>$A5,b2
andi #$00,ccr
asl b

View File

@@ -0,0 +1,8 @@
; move #>0,y0
; move #>1,y1
clr b
move #>$A5,b0
move #>$A5,b1
move #>$A5,b2
andi #$00,ccr
asr b

View File

@@ -0,0 +1,20 @@
clr a
clr b
andi #$00,ccr
move #>$7F,a2
move #>$7F,b2
add a,b
clr a
clr b
andi #$00,ccr
move #>$80,a2
move #>$7F,b2
add a,b
clr a
clr b
andi #$00,ccr
move #>$80,a2
move #>$80,b2
add a,b

View File

@@ -0,0 +1,9 @@
; clear CCR
andi #$00,CCR
move #>0.25,a
clr a
move #>-0.25,a
andi #$00,CCR
ori #$01,CCR
clr a

View File

@@ -0,0 +1,20 @@
move #$20,b
move #$24,y0
andi #$00,ccr
cmp y0,b
move #$20,b
move #$20,y0
andi #$00,ccr
cmp y0,b
move #$24,b
move #$20,y0
andi #$00,ccr
cmp y0,b
move #$800AAA,b
move #$20,y0
andi #$00,ccr
cmp y0,b
move #$800AAA,y0
move #$20,b
andi #$00,ccr
cmp y0,b

View File

@@ -0,0 +1,20 @@
move #$20,b
move #$24,y0
andi #$00,ccr
cmpm y0,b
move #$20,b
move #$20,y0
andi #$00,ccr
cmpm y0,b
move #$24,b
move #$20,y0
andi #$00,ccr
cmpm y0,b
move #$800AAA,b
move #$20,y0
andi #$00,ccr
cmpm y0,b
move #$800AAA,y0
move #$20,b
andi #$00,ccr
cmpm y0,b

View File

@@ -0,0 +1,8 @@
move #>$000FFF,y0
move #>$FF00FF,b
andi #$00,ccr
eor y0,b
move #>$FFFFFF,y0
move #>$FFFFFF,b
andi #$00,ccr
eor y0,b

View File

@@ -0,0 +1,7 @@
andi #$00,CCR
move #>0.25,a
move #>$AAAAAA,a
move #>$BCDEFA,a0
rep #24
lsl a

View File

@@ -0,0 +1,7 @@
andi #$00,CCR
move #>0.25,a
move #>$AAAAAA,a
move #>$BCDEFA,a0
rep #24
lsr a

View File

@@ -0,0 +1,17 @@
andi #$00,CCR
clr a
move #$80,a2
move #>0.25,x0
move #>0.50,y0
mac -x0,y0,a
move #>-0.25,x0
move #>-0.55,y0
mac x0,y0,a
move #>-0.20,x0
move #>+0.55,y0
mac x0,y0,a
move #>-0.20,x0
move #>+0.55,y0
mac -x0,y0,a

View File

@@ -0,0 +1,17 @@
andi #$00,CCR
clr a
move #$100000,a
move #>$123456,x0
move #>$123456,y0
macr x0,y0,a
move #$100001,a
move #>$123456,x0
move #>$123456,y0
macr x0,y0,a
move #$100000,a
move #$800000,a0
move #>$123456,x0
move #>$123456,y0
macr x0,y0,a

View File

@@ -0,0 +1,15 @@
andi #$00,CCR
move #>0.25,x0
move #>0.50,y0
mpy x0,y0,a
move #>-0.25,x0
move #>-0.55,y0
mpy x0,y0,a
move #>-0.20,x0
move #>+0.55,y0
mpy x0,y0,a
move #>-0.20,x0
move #>+0.55,y0
mpy -x0,y0,a

View File

@@ -0,0 +1,5 @@
andi #$00,CCR
move #>$654321,y0
mpyr -y0,y0,a

View File

@@ -0,0 +1,10 @@
andi #$00,CCR
move #>$654321,a
neg a
clr a
move #>$80,a2
neg a
move #>$800000,a
neg a

View File

@@ -0,0 +1,14 @@
clr a
move #$000001,a1
tst a
rep #$2F
norm R3,a
clr a
move #$FF0000,a
move #$84,a2
tst a
rep #$2F
norm R1,a
clr a
rep #$2F
norm R2,a

View File

@@ -0,0 +1,8 @@
move #>$000FFF,y0
move #>$7F00FF,b
andi #$00,ccr
not b
move #>$000000,y0
move #>$FFFFFF,b
andi #$00,ccr
not b

View File

@@ -0,0 +1,8 @@
move #>$000FFF,y0
move #>$FF00FF,b
andi #$00,ccr
or y0,b
move #>$000000,y0
move #>$000000,b
andi #$00,ccr
or y0,b

View File

@@ -0,0 +1,11 @@
andi #$00,CCR
move #>$123456,a1
move #>$789ABC,a0
rnd a
move #>$123456,a1
move #>$800000,a0
rnd a
move #>$123455,a1
move #>$800000,a0
rnd a

View File

@@ -0,0 +1,6 @@
andi #$00,CCR
move #>$AAAAAA,a
move #>$BCDEFA,a0
rep #24
rol a

View File

@@ -0,0 +1,6 @@
andi #$00,CCR
move #>$AAAAAA,a
move #>$BCDEFA,a0
rep #24
ror a

View File

@@ -0,0 +1,15 @@
move #>0,y0
move #>1,y1
clr b
move #>1,b0
; set only carry bit
andi #$00,ccr
ori #$01,ccr
sbc y,b
move #>$800000,y1
move #>$80,b2
sbc y,b
clr b
move #>$80,b2
move #>$1,y1
sbc y,b

View File

@@ -0,0 +1,15 @@
move #>0,y0
move #>1,y1
clr b
move #>1,b0
; set only carry bit
andi #$00,ccr
ori #$01,ccr
sub y,b
move #>$800000,y1
move #>$80,b2
sub y,b
clr b
move #>$80,b2
move #>$1,y1
sub y1,b

View File

@@ -0,0 +1,15 @@
move #>0,a0
move #>1,a1
clr b
move #>1,b0
; set only carry bit
andi #$00,ccr
ori #$01,ccr
subl a,b
move #>$800000,a1
move #>$80,b2
subl a,b
clr b
move #>$80,b2
move #>$1,a1
subl a,b

View File

@@ -0,0 +1,15 @@
move #>0,a0
move #>1,a1
clr b
move #>1,b0
; set only carry bit
andi #$00,ccr
ori #$01,ccr
subr a,b
move #>$800000,a1
move #>$80,b2
subr a,b
clr b
move #>$80,b2
move #>$1,a1
subr a,b

View File

@@ -0,0 +1,10 @@
move #20,r1
move #$ABCDEF,x0
move #$123456,b
andi #$00,ccr
tcs x0,a r1,r3
tcc x0,b r1,r2
; set Zero Flag
ori #$04,ccr
teq x0,a r1,r3
tne x0,b r1,r2

View File

@@ -0,0 +1,7 @@
move #$ABCDEF,a
move #$123456,b
tfr a,b b,a
move #$555555,x0
move #$AAAAAA,y1
tfr x0,a a,x0
tfr y1,b b,y0

Some files were not shown because too many files have changed in this diff Show More