Compare commits
134 Commits
R_0_9_1@31
...
i2cspi_BaS
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91f2dc9a16 | ||
|
|
a180851b50 | ||
|
|
d7d3b396d0 | ||
|
|
e842b2fdcd | ||
|
|
a822d3f8f5 | ||
|
|
9b9caf98e4 | ||
|
|
cc5720fea0 | ||
|
|
cf397f08c6 | ||
|
|
59e6ab844c | ||
|
|
457e781301 | ||
|
|
b19dead15f | ||
|
|
a9c85a1e94 | ||
|
|
143ad622a3 | ||
|
|
a51f325fb5 | ||
|
|
0f870ad920 | ||
|
|
e054082d95 | ||
|
|
adafdb01db | ||
|
|
f9d5a29740 | ||
|
|
33e7745b25 | ||
|
|
2330224714 | ||
|
|
e2fbb6e339 | ||
|
|
b6ef78cdfd | ||
|
|
fdbcfaf94e | ||
|
|
a92c134454 | ||
|
|
447f961088 | ||
|
|
d7c632c206 | ||
|
|
8069d83787 | ||
|
|
5d5fcd1c37 | ||
|
|
1731b417b6 | ||
|
|
657c105ee6 | ||
|
|
a1e072f16f | ||
|
|
83695a927a | ||
|
|
1a6d81ed1d | ||
|
|
b49c9e628d | ||
|
|
8f2612ae10 | ||
|
|
0a2afd578a | ||
|
|
860d0bd703 | ||
|
|
257e92df8b | ||
|
|
c28a1c49df | ||
|
|
63304d13c8 | ||
|
|
b37e507590 | ||
|
|
4615d7a757 | ||
|
|
5bf9679129 | ||
|
|
e9c7b5e453 | ||
|
|
af9815d6b8 | ||
|
|
f3825b729e | ||
|
|
864a67c7e5 | ||
|
|
6e0165f6b8 | ||
|
|
d81879b86a | ||
|
|
075062972b | ||
|
|
d4819749d6 | ||
|
|
67ede2fddb | ||
|
|
69f147e9cf | ||
|
|
d759370bfc | ||
|
|
307720cbfc | ||
|
|
b4f05cfdf3 | ||
|
|
14ac2e71ba | ||
|
|
a875f4062a | ||
|
|
b34d9fa714 | ||
|
|
2483fecf74 | ||
|
|
67a53b7f29 | ||
|
|
c5106fbe91 | ||
|
|
f0f829ab31 | ||
|
|
062db40213 | ||
|
|
0094bd87a7 | ||
|
|
b4d25e2f94 | ||
|
|
371adb5581 | ||
|
|
9a80c36081 | ||
|
|
a7065c2494 | ||
|
|
8f48e3b3af | ||
|
|
18e402f6c3 | ||
|
|
ee344278a7 | ||
|
|
edf004c542 | ||
|
|
b9c72eb9e8 | ||
|
|
58504bdf98 | ||
|
|
38247c79a9 | ||
|
|
b842c061e5 | ||
|
|
c461730076 | ||
|
|
fd1b041675 | ||
|
|
b257a93211 | ||
|
|
55c2f783b2 | ||
|
|
53842173cb | ||
|
|
b32848ebbd | ||
|
|
6bfdcea1ba | ||
|
|
88f3708506 | ||
|
|
613c55b7c6 | ||
|
|
cc41e6e49b | ||
|
|
21ff94f57c | ||
|
|
0fd987e847 | ||
|
|
5b7ee343e9 | ||
|
|
e298e1b4c9 | ||
|
|
68194329d2 | ||
|
|
499c6af355 | ||
|
|
a1c1b039b4 | ||
|
|
1a718db4aa | ||
|
|
b2f1b22335 | ||
|
|
51561769c6 | ||
|
|
97c82f6345 | ||
|
|
89b3d2980e | ||
|
|
9840bf0640 | ||
|
|
25d341b48f | ||
|
|
77f0164502 | ||
|
|
182ae661ce | ||
|
|
c6b029860f | ||
|
|
7cdf71810f | ||
|
|
b85b977223 | ||
|
|
bb5159cca4 | ||
|
|
8020d107b1 | ||
|
|
85d23c994a | ||
|
|
a9d3cfeeb5 | ||
|
|
5d97a5161e | ||
|
|
b084209e46 | ||
|
|
f2aa8f6bad | ||
|
|
459e39a42d | ||
|
|
55d26c5271 | ||
|
|
11b5d0c01b | ||
|
|
5ae1cf4cb1 | ||
|
|
1f89005d16 | ||
|
|
b3b93a8041 | ||
|
|
8edac06f30 | ||
|
|
f0d6cf3abd | ||
|
|
c826e061f2 | ||
|
|
2077415729 | ||
|
|
a38f607dfc | ||
|
|
77748bdbff | ||
|
|
1df70e6aee | ||
|
|
9aa82d6a91 | ||
|
|
e6f5d863fc | ||
|
|
f4a0dec4e1 | ||
|
|
700ee9adf6 | ||
|
|
b8eb3353db | ||
|
|
70bfe34a99 | ||
|
|
913ea1f46a | ||
|
|
08b35e4997 |
165
.cproject
165
.cproject
@@ -17,17 +17,37 @@
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="BaS_GNU" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="cdt.managedbuild.toolchain.gnu.cross.base.500844171" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.251316721" name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.2075717076" name="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.229077196" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.675708329" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="" id="cdt.managedbuild.targetPlatform.gnu.cross.1762656328" isAbstract="false" osList="all"/>
|
||||
<builder id="cdt.managedbuild.builder.gnu.cross.1405451926" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder"/>
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.237011896" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.272340778" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.572966236" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="" id="cdt.managedbuild.targetPlatform.gnu.cross.1946104397" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder id="cdt.managedbuild.builder.gnu.cross.116010461" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1346392496" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option id="gnu.c.compiler.option.include.paths.869536174" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/usr/m68k-elf/include"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2036594113" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1539098439" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.983740799" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.406272886" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.57852077" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1399280647" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1268440718" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.468245267" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<fileInfo id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.1693274825" name="Makefile" rcbsApplicability="disable" resourcePath="Makefile" toolsToInvoke=""/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686" moduleId="org.eclipse.cdt.core.settings" name="firebee-cross">
|
||||
@@ -37,38 +57,41 @@
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="BaS_GNU" buildProperties="" description="cross development for firebee firmware" errorParsers="org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser" id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686" name="firebee-cross" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686." name="/" resourcePath="">
|
||||
<toolChain errorParsers="" id="cdt.managedbuild.toolchain.gnu.cross.base.120730457" name="cdt.managedbuild.toolchain.gnu.cross.base" resourceTypeBasedDiscovery="true">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.904812232" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.1369935770" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="" id="cdt.managedbuild.targetPlatform.gnu.cross.1544284446" isAbstract="false" osList="all"/>
|
||||
<builder buildPath="${workspace_loc:/BaS_GNU}" errorParsers="" id="cdt.managedbuild.builder.gnu.cross.2120667679" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.1967179068" name="Cross GCC" resourceTypeBasedDiscovery="true" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.129963777" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.176129148" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="" id="cdt.managedbuild.targetPlatform.gnu.cross.2042576934" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder autoBuildTarget="all" buildPath="${workspace_loc:/BaS_GNU}" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.builder.gnu.cross.1808605670" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross">
|
||||
<outputEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="outputPath" name="objs"/>
|
||||
</outputEntries>
|
||||
</builder>
|
||||
<tool errorParsers="org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.tool.gnu.cross.assembler.1136616288" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.652605616" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.283290301" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option id="gnu.c.compiler.option.include.paths.103275678" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/BaS_gcc/include}""/>
|
||||
<listOptionValue builtIn="false" value="/usr/m68k-elf/include"/>
|
||||
<listOptionValue builtIn="false" value="/opt/cross-mint/m68k-atari-mint/include"/>
|
||||
<listOptionValue builtIn="false" value="/usr/lib/gcc/m68k-atari-mint/4.6.3/include"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1445023059" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.tool.gnu.cross.c.linker.2090138476" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1763299660" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1303101590" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.2089383321" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.305885086" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.cross.c.compiler.359669870" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option id="gnu.c.compiler.option.include.paths.2015956820" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/usr/m68k-elf/include"/>
|
||||
<listOptionValue builtIn="false" value="/opt/cross-mint/m68k-atari-mint/include"/>
|
||||
<listOptionValue builtIn="false" value="/usr/lib/gcc/m68k-atari-mint/4.6.3/include"/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/BaS_GNU/include}""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.374200372" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.413671435" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.88300823" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.810274043" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.719845882" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
@@ -82,19 +105,79 @@
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.cross.base.1557606920">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.1557606920" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.cross.base.1557606920" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.1557606920.894087346" name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.808036944" name="cdt.managedbuild.toolchain.gnu.cross.base" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.579880707" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.2139341053" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1712307593" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder id="cdt.managedbuild.builder.gnu.cross.1872779390" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1693427002" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option id="gnu.c.compiler.option.include.paths.559413321" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/usr/m68k-elf/include"/>
|
||||
<listOptionValue builtIn="false" value="/usr/lib/gcc/m68k-elf/4.6.3/include"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.589685537" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.66237432" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.651961483" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.801196180" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1012333610" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.273251286" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.2032495512" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1703324170" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.2129741386" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1949654614" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="BaS_GNU.null.2057987123" name="BaS_GNU"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope" versionNumber="1">
|
||||
<resource resourceType="PROJECT" workspacePath="/BaS_GNU"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="firebee-cross">
|
||||
<resource resourceType="PROJECT" workspacePath="/BaS_GNU"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Default">
|
||||
<resource resourceType="PROJECT" workspacePath="/BaS_GNU"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
|
||||
<doc-comment-owner id="org.eclipse.cdt.internal.ui.text.doctools.NullDocCommentOwner">
|
||||
<path value=""/>
|
||||
</doc-comment-owner>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
@@ -120,11 +203,19 @@
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="bfl" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>bfl</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686;cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686.;cdt.managedbuild.tool.gnu.cross.c.compiler.359669870;cdt.managedbuild.tool.gnu.c.compiler.input.374200372">
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171;cdt.managedbuild.toolchain.gnu.cross.base.500844171.251316721;cdt.managedbuild.tool.gnu.cross.c.compiler.1346392496;cdt.managedbuild.tool.gnu.c.compiler.input.2036594113">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686;cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686.;cdt.managedbuild.tool.gnu.cross.c.compiler.1024005096;cdt.managedbuild.tool.gnu.c.compiler.input.1427165564">
|
||||
@@ -140,11 +231,33 @@
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686;cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686.;cdt.managedbuild.tool.gnu.cross.c.compiler.283290301;cdt.managedbuild.tool.gnu.c.compiler.input.1445023059">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD "${plugin_state_location}/specs.c"" command="m68k-atari-mint-gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686;cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686.;cdt.managedbuild.tool.gnu.cross.c.compiler.359669870;cdt.managedbuild.tool.gnu.c.compiler.input.374200372">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171;cdt.managedbuild.toolchain.gnu.cross.base.500844171.251316721;cdt.managedbuild.tool.gnu.cross.c.compiler.915906842;cdt.managedbuild.tool.gnu.c.compiler.input.1420707322">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.500844171;cdt.managedbuild.toolchain.gnu.cross.base.500844171.2140460233;cdt.managedbuild.tool.gnu.cross.c.compiler.915906842.729509112;cdt.managedbuild.tool.gnu.c.compiler.input.2002421488">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.1557606920;cdt.managedbuild.toolchain.gnu.cross.base.1557606920.894087346;cdt.managedbuild.tool.gnu.cross.c.compiler.1693427002;cdt.managedbuild.tool.gnu.c.compiler.input.589685537">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
|
||||
6
.gdbinit
6
.gdbinit
@@ -1,12 +1,10 @@
|
||||
set disassemble-next-line on
|
||||
#set disassemble-next-line on
|
||||
define tr
|
||||
target remote | m68k-bdm-gdbserver pipe /dev/bdmcf3
|
||||
monitor bdm-reset
|
||||
end
|
||||
define tbtr
|
||||
target remote | m68k-bdm-gdbserver pipe /dev/tblcf3
|
||||
end
|
||||
|
||||
tr
|
||||
source mcf5474.gdb
|
||||
|
||||
|
||||
|
||||
17
.project
17
.project
@@ -17,6 +17,10 @@
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
@@ -25,13 +29,17 @@
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
@@ -41,19 +49,22 @@
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>false</value>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
|
||||
@@ -1,66 +1,68 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
|
||||
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},implicit\=>false}
|
||||
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
|
||||
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
|
||||
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true}}
|
||||
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.checkers.noreturn=Error
|
||||
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},implicit\=>false}
|
||||
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},unknown\=>false,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
|
||||
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=Info
|
||||
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},macro\=>true,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},paramNot\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},else\=>false,afterelse\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},macro\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},macro\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
|
||||
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
useParentScope=false
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
eclipse.preferences.version=1
|
||||
indexer/filesToParseUpFront=cstdarg, stdarg.h, stddef.h, sys/resource.h, ctime, sys/types.h, signal.h, cstdio
|
||||
indexer/indexAllFiles=true
|
||||
indexer/indexOnOpen=true
|
||||
indexer/indexUnusedHeadersWithDefaultLang=true
|
||||
indexer/indexerId=org.eclipse.cdt.core.fastIndexer
|
||||
indexer/skipFilesLargerThanMB=80
|
||||
indexer/skipImplicitReferences=false
|
||||
indexer/skipMacroReferences=false
|
||||
indexer/skipReferences=false
|
||||
indexer/skipTypeReferences=false
|
||||
indexer/useHeuristicIncludeResolution=true
|
||||
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
|
||||
org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
|
||||
org.eclipse.cdt.core.formatter.alignment_for_compact_if=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
|
||||
org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
|
||||
|
||||
2
.settings/org.eclipse.core.resources.prefs
Normal file
2
.settings/org.eclipse.core.resources.prefs
Normal file
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
674
COPYING
Normal file
674
COPYING
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
330
COPYING.LESSER
Normal file
330
COPYING.LESSER
Normal file
@@ -0,0 +1,330 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
94
Makefile
94
Makefile
@@ -10,7 +10,7 @@
|
||||
|
||||
# can be either "Y" or "N" (without quotes). "Y" for using the m68k-elf-, "N" for using the m68k-atari-mint
|
||||
# toolchain
|
||||
COMPILE_ELF=Y
|
||||
COMPILE_ELF=N
|
||||
|
||||
ifeq (Y,$(COMPILE_ELF))
|
||||
TCPREFIX=m68k-elf-
|
||||
@@ -26,13 +26,16 @@ CC=$(TCPREFIX)gcc
|
||||
LD=$(TCPREFIX)ld
|
||||
CPP=$(TCPREFIX)cpp
|
||||
OBJCOPY=$(TCPREFIX)objcopy
|
||||
AR=$(TCPREFIX)ar
|
||||
RANLIB=$(TCPREFIX)ranlib
|
||||
|
||||
INCLUDE=-Iinclude
|
||||
CFLAGS=-mcpu=5474\
|
||||
-Wall\
|
||||
-g\
|
||||
-Wno-multichar\
|
||||
-Os\
|
||||
-Winline\
|
||||
-O \
|
||||
-fomit-frame-pointer\
|
||||
-fno-strict-aliasing\
|
||||
-ffreestanding\
|
||||
@@ -42,51 +45,88 @@ CFLAGS=-mcpu=5474\
|
||||
SRCDIR=sources
|
||||
OBJDIR=objs
|
||||
|
||||
MAPFILE=bas.map
|
||||
|
||||
# Linker control file. The final $(LDCFILE) is intermediate only (preprocessed version of $(LDCSRC)
|
||||
LDCFILE=bas.lk
|
||||
LDRFILE=ram.lk
|
||||
LDCSRC=bas.lk.in
|
||||
LDCBSRC=basflash.lk.in
|
||||
LDCBFS=bashflash.lk
|
||||
|
||||
# this Makefile can create the BaS to flash or an arbitrary ram address (for BDM debugging). See
|
||||
# below for the definition of TARGET_ADDRESS
|
||||
FLASH_EXEC=bas.$(EXE)
|
||||
RAM_EXEC=ram.$(EXE)
|
||||
BASFLASH_EXEC=basflash.$(EXE)
|
||||
|
||||
CSRCS= \
|
||||
$(SRCDIR)/sysinit.c \
|
||||
$(SRCDIR)/init_fpga.c \
|
||||
$(SRCDIR)/bas_printf.c \
|
||||
$(SRCDIR)/bas_string.c \
|
||||
$(SRCDIR)/BaS.c \
|
||||
$(SRCDIR)/cache.c \
|
||||
$(SRCDIR)/sd_card.c
|
||||
$(SRCDIR)/mmc.c \
|
||||
$(SRCDIR)/unicode.c \
|
||||
$(SRCDIR)/ff.c \
|
||||
$(SRCDIR)/sd_card.c \
|
||||
$(SRCDIR)/wait.c \
|
||||
$(SRCDIR)/s19reader.c \
|
||||
$(SRCDIR)/flash.c \
|
||||
$(SRCDIR)/fifo.c \
|
||||
$(SRCDIR)/i2c_firebee.c \
|
||||
$(SRCDIR)/usb.c \
|
||||
$(SRCDIR)/usb_kbd.c \
|
||||
$(SRCDIR)/usb_mem.c \
|
||||
$(SRCDIR)/usb_mouse.c \
|
||||
$(SRCDIR)/usb_storage.c \
|
||||
$(SRCDIR)/ehci-hcd.c \
|
||||
$(SRCDIR)/ohci-hcd.c \
|
||||
$(SRCDIR)/flash.c \
|
||||
$(SRCDIR)/xhdi_sd.c \
|
||||
$(SRCDIR)/xhdi_interface.c
|
||||
|
||||
ASRCS= \
|
||||
$(SRCDIR)/startcf.S \
|
||||
$(SRCDIR)/printf_helper.S \
|
||||
$(SRCDIR)/mmu.S \
|
||||
$(SRCDIR)/sd_card_asm.S \
|
||||
$(SRCDIR)/exceptions.S \
|
||||
$(SRCDIR)/supervisor.S \
|
||||
$(SRCDIR)/ewf.S \
|
||||
$(SRCDIR)/illegal_instruction.S
|
||||
$(SRCDIR)/illegal_instruction.S \
|
||||
$(SRCDIR)/xhdi_vec.S
|
||||
|
||||
COBJS=$(patsubst $(SRCDIR)/%.o,$(OBJDIR)/%.o,$(patsubst %.c,%.o,$(CSRCS)))
|
||||
AOBJS=$(patsubst $(SRCDIR)/%.o,$(OBJDIR)/%.o,$(patsubst %.S,%.o,$(ASRCS)))
|
||||
|
||||
OBJS=$(COBJS) $(AOBJS)
|
||||
|
||||
all: $(FLASH_EXEC)
|
||||
LIBBAS=libbas.a
|
||||
|
||||
all: fls ram bfl lib
|
||||
fls: $(FLASH_EXEC)
|
||||
ram: $(RAM_EXEC)
|
||||
bfl: $(BASFLASH_EXEC)
|
||||
lib: $(LIBBAS)
|
||||
|
||||
.PHONY clean:
|
||||
@ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19\
|
||||
$(RAM_EXEC) $(RAM_EXEC).elf $(RAM_EXEC).s19\
|
||||
$(OBJS) $(MAPFILE) $(LDCFILE) depend
|
||||
@ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19 \
|
||||
$(RAM_EXEC) $(RAM_EXEC).elf $(RAM_EXEC).s19 \
|
||||
$(BASFLASH_EXEC) $(BASFLASH_EXEC).elf $(BASFLASH_EXEC).s19 $(OBJDIR)/basflash.o $(OBJDIR)/basflash_start.o \
|
||||
$(OBJS) $(LIBBAS) \
|
||||
bas.lk bas.map ram.lk ram.map basflash.lk basflash.map depend
|
||||
|
||||
$(FLASH_EXEC): TARGET_ADDRESS=0xe0000000
|
||||
$(RAM_EXEC): TARGET_ADDRESS=0x10000000
|
||||
$(FLASH_EXEC): LDCFILE=bas.lk
|
||||
$(FLASH_EXEC): MAPFILE=bas.map
|
||||
|
||||
$(FLASH_EXEC) $(RAM_EXEC): $(OBJS) $(LDCSRC)
|
||||
$(RAM_EXEC): TARGET_ADDRESS=0x10000000
|
||||
$(RAM_EXEC): LDCFILE=ram.lk
|
||||
$(RAM_EXEC): MAPFILE=ram.map
|
||||
|
||||
$(BASFLASH_EXEC): TARGET_ADDRESS=0x00100000
|
||||
$(BASFLASH_EXEC): LDCFILE=basflash.lk
|
||||
$(BASFLASH_EXEC): MAPFILE=basflash.map
|
||||
|
||||
# the final link stage (BaS in RAM and BaS in flash)
|
||||
$(FLASH_EXEC) $(RAM_EXEC): $(LIBBAS) $(LDCSRC)
|
||||
$(CPP) -P -DTARGET_ADDRESS=$(TARGET_ADDRESS) -DFORMAT=$(FORMAT) $(LDCSRC) -o $(LDCFILE)
|
||||
$(LD) --oformat $(FORMAT) -Map $(MAPFILE) --cref -T $(LDCFILE) -o $@
|
||||
ifeq ($(COMPILE_ELF),Y)
|
||||
@@ -94,9 +134,24 @@ ifeq ($(COMPILE_ELF),Y)
|
||||
else
|
||||
objcopy -I srec -O elf32-big --alt-machine-code 4 $@ $@.elf
|
||||
endif
|
||||
|
||||
|
||||
# the basflash (SD-card executable called from BaS) final link stage
|
||||
$(BASFLASH_EXEC): $(OBJDIR)/basflash.o $(OBJDIR)/basflash_start.o $(LIBBAS) $(LDCBFL)
|
||||
$(CPP) -P -DTARGET_ADDRESS=$(TARGET_ADDRESS) -DFORMAT=$(FORMAT) $(LDCBSRC) -o $(LDCFILE)
|
||||
$(LD) --oformat $(FORMAT) -Map $(MAPFILE) --cref -T $(LDCFILE) -L. -lbas -o $@
|
||||
ifeq ($(COMPILE_ELF),Y)
|
||||
$(OBJCOPY) -O srec $@ $@.s19
|
||||
else
|
||||
objcopy -I srec -O elf32-big --alt-machine-code 4 $@ $@.elf
|
||||
endif
|
||||
|
||||
# (re)create library. Currently suboptimal because it rewrites the whole lib even if only a single object changed
|
||||
$(LIBBAS): $(OBJS)
|
||||
$(AR) rv $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
# compile init_fpga with -mbitfield for testing purposes
|
||||
$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield
|
||||
#$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield
|
||||
|
||||
# compile printf pc-relative so it can be used as well before and after copy of BaS
|
||||
$(OBJDIR)/bas_printf.o: CFLAGS += -mpcrel
|
||||
@@ -110,8 +165,9 @@ $(OBJDIR)/%.o:$(SRCDIR)/%.S
|
||||
$(CC) -c $(CFLAGS) -Wa,--bitwise-or $(INCLUDE) $< -o $@
|
||||
|
||||
depend: $(ASRCS) $(CSRCS)
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -M $(ASRCS) $(CSRCS) > depend
|
||||
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -M $(ASRCS) $(CSRCS) | sed -e 's/^\(.*\).o:/$(OBJDIR)\/\1.o:/' > depend
|
||||
|
||||
|
||||
ifneq (clean,$(MAKECMDGOALS))
|
||||
-include depend
|
||||
endif
|
||||
|
||||
17
bas.lk.in
17
bas.lk.in
@@ -1,6 +1,6 @@
|
||||
MEMORY
|
||||
{
|
||||
bas_rom (RX) : ORIGIN = TARGET_ADDRESS, LENGTH = 0x00200000
|
||||
bas_rom (RX) : ORIGIN = TARGET_ADDRESS, LENGTH = 0x00100000
|
||||
bas_ram (WX) : ORIGIN = 0x1FE00000, LENGTH = 0x00100000 /* target to copy BaS to */
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ SECTIONS
|
||||
objs/startcf.o(.text) /* this one is the entry point so it must be the first */
|
||||
objs/sysinit.o(.text)
|
||||
objs/init_fpga.o(.text)
|
||||
objs/wait.o(.text)
|
||||
|
||||
#if (FORMAT == elf32-m68k)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
@@ -27,17 +29,24 @@ SECTIONS
|
||||
AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4))
|
||||
{
|
||||
objs/BaS.o(.text)
|
||||
objs/wait.o(.text)
|
||||
/* put other routines into the same segment (RAM) as BaS.o */
|
||||
objs/sd_card_asm.o(.text)
|
||||
objs/unicode.o(.text)
|
||||
objs/mmc.o(.text)
|
||||
objs/ff.o(.text)
|
||||
objs/sd_card.o(.text)
|
||||
objs/s19reader.o(.text)
|
||||
objs/bas_printf.o(.text)
|
||||
objs/bas_string.o(.text)
|
||||
objs/printf_helper.o(.text)
|
||||
objs/cache.o(.text)
|
||||
objs/sd_card.o(.text)
|
||||
objs/mmu.o(.text)
|
||||
objs/exceptions.o(.text)
|
||||
objs/supervisor.o(.text)
|
||||
objs/ewf.o(.text)
|
||||
objs/illegal_instruction.o(.text)
|
||||
objs/xhdi_sd.o(.text)
|
||||
objs/xhdi_interface.o(text)
|
||||
objs/xhdi_vec.o(text)
|
||||
*(.data)
|
||||
*(.bss)
|
||||
|
||||
|
||||
105
basflash.lk.in
Normal file
105
basflash.lk.in
Normal file
@@ -0,0 +1,105 @@
|
||||
MEMORY
|
||||
{
|
||||
flasher (WX) : ORIGIN = TARGET_ADDRESS, LENGTH = 0x00100000 /* target to load basflash */
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
objs/basflash_start.o(.text)
|
||||
objs/basflash.o(.text)
|
||||
|
||||
*(.data)
|
||||
*(.bss)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
} > flasher
|
||||
|
||||
.bas :
|
||||
{
|
||||
}
|
||||
|
||||
#define BAS_LABEL_LMA(x) ((x))
|
||||
_xprintf_before_copy = BAS_LABEL_LMA(_xprintf);
|
||||
_display_progress_before_copy = BAS_LABEL_LMA(_display_progress);
|
||||
/* _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); */
|
||||
|
||||
/*
|
||||
* Global memory map
|
||||
*/
|
||||
|
||||
/* SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes */
|
||||
___SDRAM = 0x00000000;
|
||||
___SDRAM_SIZE = 0x20000000;
|
||||
|
||||
/* ST-RAM */
|
||||
__STRAM = ___SDRAM;
|
||||
__STRAM_END = __TOS;
|
||||
|
||||
/* TOS */
|
||||
__TOS = 0x00e00000;
|
||||
|
||||
/* FastRAM */
|
||||
__FASTRAM = 0x10000000;
|
||||
__FASTRAM_END = 0x1FFFFFFF;
|
||||
|
||||
/* Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes) */
|
||||
___BOOT_FLASH = 0xe0000000;
|
||||
___BOOT_FLASH_SIZE = 0x00800000;
|
||||
|
||||
/* BaS */
|
||||
__BAS_LMA = LOADADDR(.bas);
|
||||
__BAS_IN_RAM = ADDR(.bas);
|
||||
__BAS_SIZE = SIZEOF(.bas);
|
||||
|
||||
/* Other flash components */
|
||||
__FIRETOS = 0xe0400000;
|
||||
__EMUTOS = 0xe0600000;
|
||||
__EMUTOS_SIZE = 0x00100000;
|
||||
|
||||
/* VIDEO RAM BASIS */
|
||||
__VRAM = 0x60000000;
|
||||
|
||||
/* Memory mapped registers */
|
||||
__MBAR = 0xFF000000;
|
||||
|
||||
/* 32KB on-chip System SRAM */
|
||||
__SYS_SRAM = 0xFF010000;
|
||||
__SYS_SRAM_SIZE = 0x00008000;
|
||||
|
||||
/* MMU memory mapped registers */
|
||||
__MMUBAR = 0xFF040000;
|
||||
|
||||
/*
|
||||
* 4KB on-chip Core SRAM0: -> exception table and exception stack
|
||||
*/
|
||||
__RAMBAR0 = 0xFF100000;
|
||||
__RAMBAR0_SIZE = 0x00001000;
|
||||
__SUP_SP = __RAMBAR0 + __RAMBAR0_SIZE - 4;
|
||||
|
||||
/* system variables */
|
||||
|
||||
/* RAMBAR0 0 to 0x7FF -> exception vectors */
|
||||
_rt_mod = __RAMBAR0 + 0x800;
|
||||
_rt_ssp = __RAMBAR0 + 0x804;
|
||||
_rt_usp = __RAMBAR0 + 0x808;
|
||||
_rt_vbr = __RAMBAR0 + 0x80C; /* (8)01 */
|
||||
_rt_cacr = __RAMBAR0 + 0x810; /* 002 */
|
||||
_rt_asid = __RAMBAR0 + 0x814; /* 003 */
|
||||
_rt_acr0 = __RAMBAR0 + 0x818; /* 004 */
|
||||
_rt_acr1 = __RAMBAR0 + 0x81c; /* 005 */
|
||||
_rt_acr2 = __RAMBAR0 + 0x820; /* 006 */
|
||||
_rt_acr3 = __RAMBAR0 + 0x824; /* 007 */
|
||||
_rt_mmubar = __RAMBAR0 + 0x828; /* 008 */
|
||||
_rt_sr = __RAMBAR0 + 0x82c;
|
||||
_d0_save = __RAMBAR0 + 0x830;
|
||||
_a7_save = __RAMBAR0 + 0x834;
|
||||
_video_tlb = __RAMBAR0 + 0x838;
|
||||
_video_sbt = __RAMBAR0 + 0x83C;
|
||||
_rt_mbar = __RAMBAR0 + 0x844; /* (c)0f */
|
||||
|
||||
/* 4KB on-chip Core SRAM1: -> modified code */
|
||||
__RAMBAR1 = 0xFF101000;
|
||||
__RAMBAR1_SIZE = 0x00001000;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
; This is the board specific initialization file used in CodeWarrior Embedded product for ColdFire architecture
|
||||
; $RCSfile: M5475EVB.cfg,v $
|
||||
; $Revision: 1.4 $ $Date: 2008/01/09 11:46:41 $
|
||||
; Please do NOT modifiy this file. If you wish to modify this file, please keep a backup copy of this file.
|
||||
|
||||
ResetHalt
|
||||
|
||||
;Set VBR - debugger must know this in order
|
||||
; to do exception capture
|
||||
writecontrolreg 0x0801 0x00000000
|
||||
|
||||
; If MBAR changes all following writes must change
|
||||
; and if a memory configuration file is used,
|
||||
; the reserved areas in the register block must
|
||||
; change also.
|
||||
;Turn on MBAR at 0xFF00_0000
|
||||
writecontrolreg 0x0C0F 0xFF000000
|
||||
|
||||
;Turn on RAMBAR0 at address FF10_0000
|
||||
writecontrolreg 0x0C04 0xFF100035
|
||||
|
||||
;Turn on RAMBAR1 at address FF10_1000
|
||||
writecontrolreg 0x0C05 0xFF101035
|
||||
|
||||
;Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes)
|
||||
writemem.l 0xFF000500 0xE0000000;
|
||||
writemem.l 0xFF000508 0x00101980; 16-bit port
|
||||
writemem.l 0xFF000504 0x007F0001;
|
||||
|
||||
;SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes
|
||||
writemem.l 0xFF000004 0x000002AA; SDRAMDS configuration
|
||||
writemem.l 0xFF000020 0x0000001A; SDRAM CS0 configuration (128Mbytes 0000_0000 - 07FF_FFFF)
|
||||
writemem.l 0xFF000024 0x0800001A; SDRAM CS1 configuration (128Mbytes 0800_0000 - 0FFF_FFFF)
|
||||
writemem.l 0xFF000028 0x1000001A; SDRAM CS2 configuration (128Mbytes 1000_0000 - 07FF_FFFF)
|
||||
writemem.l 0xFF00002C 0x1800001A; SDRAM CS3 configuration (128Mbytes 1800_0000 - 1FFF_FFFF)
|
||||
;writemem.l 0xFF000108 0x73611730; SDCFG1
|
||||
writemem.l 0xFF000108 0x53611730; SDCFG1
|
||||
;writemem.l 0xFF00010C 0x46770000; SDCFG2
|
||||
writemem.l 0xFF00010C 0x24730000; SDCFG2
|
||||
|
||||
;writemem.l 0xFF000104 0xE10D0002; SDCR + IPALL
|
||||
writemem.l 0xFF000104 0xE10F0002; SDCR + IPALL
|
||||
writemem.l 0xFF000100 0x40010000; SDMR (write to LEMR)
|
||||
;writemem.l 0xFF000100 0x048D0000; SDMR (write to LMR)
|
||||
writemem.l 0xFF000100 0x04890000; SDMR (write to LMR)
|
||||
;writemem.l 0xFF000104 0xE10D0002; SDCR + IPALL
|
||||
writemem.l 0xFF000104 0xE10F0002; SDCR + IPALL
|
||||
;writemem.l 0xFF000104 0xE10D0004; SDCR + IREF (first refresh)
|
||||
writemem.l 0xFF000104 0xE10F0004; SDCR + IREF (first refresh)
|
||||
;writemem.l 0xFF000104 0xE10D0004; SDCR + IREF (second refresh)
|
||||
writemem.l 0xFF000104 0xE10F0004; SDCR + IREF (first refresh)
|
||||
;writemem.l 0xFF000100 0x008D0000; SDMR (write to LMR)
|
||||
writemem.l 0xFF000100 0x00890000; SDMR (write to LMR)
|
||||
;writemem.l 0xFF000104 0x71100F00; SDCR (lock SDMR and enable refresh)
|
||||
writemem.l 0xFF000104 0x71100F00; SDCR (lock SDMR and enable refresh)
|
||||
|
||||
delay 1000
|
||||
@@ -1,47 +0,0 @@
|
||||
// Memory Configuration File
|
||||
//
|
||||
// Description:
|
||||
// A memory configuration file contains commands that define the legally accessible
|
||||
// areas of memory for your specific board. Useful for example when the debugger
|
||||
// tries to display the content of a "char *" variable, that has not yet been initialized.
|
||||
// In this case the debugger may try to read from a bogus address, which could cause a
|
||||
// bus error.
|
||||
//
|
||||
// Board:
|
||||
// LogicPD COLDARI1
|
||||
//
|
||||
// Reference:
|
||||
// MCF5475RM.pdf
|
||||
|
||||
|
||||
// All reserved ranges read back 0xBABA...
|
||||
reservedchar 0xBA
|
||||
|
||||
address MBAR_BASE 0xFF000000
|
||||
address MMUBAR_BASE 0xFF040000
|
||||
|
||||
usederivative "MCF5475"
|
||||
|
||||
// Memory Map:
|
||||
// ----------------------------------------------------------------------
|
||||
range 0x00000000 0x1FFFFFFF 4 ReadWrite // 512MB DDR SDRAM
|
||||
reserved 0x20000000 0x5FFFFFFF
|
||||
|
||||
range 0x60000000 0x7FFFFFFF 4 ReadWrite
|
||||
|
||||
range 0x80000000 0xCFFFFFFF 4 ReadWrite
|
||||
|
||||
range 0xD0000000 0xFBFFFFFF 4 ReadWrite
|
||||
|
||||
reserved 0xFC000000 $MBAR_BASE-1
|
||||
|
||||
$MBAR_BASE $MBAR_BASE+0x3FFFF // Memory Mapped Registers
|
||||
range $MBAR_BASE+0x10000 $MBAR_BASE+0x17FFC 4 ReadWrite // 32K Internal SRAM
|
||||
|
||||
range $MMUBAR_BASE $MMUBAR_BASE+0xFFFF
|
||||
reserved $MMUBAR_BASE+1x0000 0xFF0FFFFF // Added to fill gap in MMR
|
||||
|
||||
range 0xFF100000 0xFF100FFF 4 ReadWrite // 4K SRAM0 (RAMBAR0)
|
||||
range 0xFF101000 0xFFFFFFFF 4 ReadWrite // 4K SRAM1 (RAMBAR1)
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
; This is the board specific initialization file used in CodeWarrior Embedded product for ColdFire architecture
|
||||
; $RCSfile: M5475EVB.cfg,v $
|
||||
; $Revision: 1.4 $ $Date: 2008/01/09 11:46:41 $
|
||||
; Please do NOT modifiy this file. If you wish to modify this file, please keep a backup copy of this file.
|
||||
|
||||
|
||||
;Init CS0 (BootFLASH @ FE00_0000 - FE7F_FFFF 8Mbytes)
|
||||
writemem.l 0xFF000500 0xFE000000;
|
||||
writemem.l 0xFF000508 0x00101980; 16-bit port
|
||||
writemem.l 0xFF000504 0x007F0001;
|
||||
|
||||
48
cfg/mem.cfg
48
cfg/mem.cfg
@@ -1,48 +0,0 @@
|
||||
; This is the board specific initialization file used in CodeWarrior Embedded product for ColdFire architecture
|
||||
; $RCSfile: M5475EVB.cfg,v $
|
||||
; $Revision: 1.4 $ $Date: 2008/01/09 11:46:41 $
|
||||
; Please do NOT modifiy this file. If you wish to modify this file, please keep a backup copy of this file.
|
||||
|
||||
ResetHalt
|
||||
|
||||
;Set VBR - debugger must know this in order
|
||||
; to do exception capture
|
||||
writecontrolreg 0x0801 0x00000000
|
||||
|
||||
; If MBAR changes all following writes must change
|
||||
; and if a memory configuration file is used,
|
||||
; the reserved areas in the register block must
|
||||
; change also.
|
||||
;Turn on MBAR at 0xFF00_0000
|
||||
writecontrolreg 0x0C0F 0xFF000000
|
||||
|
||||
;Turn on RAMBAR0 at address FF10_0000
|
||||
writecontrolreg 0x0C04 0xFF100035
|
||||
|
||||
;Turn on RAMBAR1 at address FF10_1000
|
||||
writecontrolreg 0x0C05 0xFF101035
|
||||
|
||||
;Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes)
|
||||
writemem.l 0xFF000500 0xE0000000;
|
||||
writemem.l 0xFF000508 0x00001180; 16-bit port
|
||||
writemem.l 0xFF000504 0x007F0001;
|
||||
|
||||
;SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes
|
||||
writemem.l 0xFF000004 0x000002AA; SDRAMDS configuration
|
||||
writemem.l 0xFF000020 0x0000001A; SDRAM CS0 configuration (128Mbytes 0000_0000 - 07FF_FFFF)
|
||||
writemem.l 0xFF000024 0x0800001A; SDRAM CS1 configuration (128Mbytes 0800_0000 - 0FFF_FFFF)
|
||||
writemem.l 0xFF000028 0x1000001A; SDRAM CS2 configuration (128Mbytes 1000_0000 - 17FF_FFFF)
|
||||
writemem.l 0xFF00002C 0x1800001A; SDRAM CS3 configuration (128Mbytes 1800_0000 - 1FFF_FFFF)
|
||||
writemem.l 0xFF000108 0x53722938; SDCFG1
|
||||
writemem.l 0xFF00010C 0x24330000; SDCFG2
|
||||
|
||||
writemem.l 0xFF000104 0xE10F0002; SDCR + IPALL
|
||||
writemem.l 0xFF000100 0x40010000; SDMR (write to LEMR)
|
||||
writemem.l 0xFF000100 0x05890000; SDRM (write to LMR)
|
||||
writemem.l 0xFF000104 0xE10F0002; SDCR + IPALL
|
||||
writemem.l 0xFF000104 0xE10F0004; SDCR + IREF (first refresh)
|
||||
writemem.l 0xFF000104 0xE10F0004; SDCR + IREF (second refresh)
|
||||
writemem.l 0xFF000100 0x01890000; SDMR (write to LMR)
|
||||
writemem.l 0xFF000104 0x710F0F00; SDCR (lock SDMR and enable refresh)
|
||||
|
||||
delay 1000
|
||||
38
cfg/mem.mem
38
cfg/mem.mem
@@ -1,38 +0,0 @@
|
||||
// Memory Configuration File
|
||||
//
|
||||
// Description:
|
||||
// A memory configuration file contains commands that define the legally accessible
|
||||
// areas of memory for your specific board. Useful for example when the debugger
|
||||
// tries to display the content of a "char *" variable, that has not yet been initialized.
|
||||
// In this case the debugger may try to read from a bogus address, which could cause a
|
||||
// bus error.
|
||||
//
|
||||
// Board:
|
||||
// LogicPD COLDARI1
|
||||
//
|
||||
// Reference:
|
||||
// MCF5475RM.pdf
|
||||
|
||||
|
||||
// All reserved ranges read back 0xBABA...
|
||||
reservedchar 0xBA
|
||||
|
||||
address MBAR_BASE 0xFF000000
|
||||
address MMUBAR_BASE 0xFF040000
|
||||
|
||||
usederivative "MCF5475"
|
||||
|
||||
// Memory Map:
|
||||
// ----------------------------------------------------------------------
|
||||
range 0x00000000 0x1FFFFFFF 4 ReadWrite // 512MB DDR SDRAM
|
||||
reserved 0x20000000 $MBAR_BASE-1
|
||||
|
||||
$MBAR_BASE $MBAR_BASE+0x3FFFF 4 ReadWrite // Memory Mapped Registers
|
||||
range $MBAR_BASE+0x10000 $MBAR_BASE+0x17FFC 4 ReadWrite // 32K Internal SRAM
|
||||
reserved $MBAR_BASE+0x17FFD $MBAR_BASE+0x1FFBF
|
||||
|
||||
$MMUBAR_BASE $MMUBAR_BASE+0x001B
|
||||
reserved $MMUBAR_BASE+0x001C 0xFF0FFFFF
|
||||
|
||||
range 0xFF100000 0xFF100FFF 4 ReadWrite // 4K SRAM0 (RAMBAR0)
|
||||
range 0xFF101000 0xFF101FFF 4 ReadWrite // 4K SRAM1 (RAMBAR1)
|
||||
52
flash_scripts/flash_bas.bdm
Executable file
52
flash_scripts/flash_bas.bdm
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/local/bin/bdmctrl -D2
|
||||
#
|
||||
# firebee board initialization for bdmctrl
|
||||
#
|
||||
open $1
|
||||
reset
|
||||
sleep 10
|
||||
|
||||
wait
|
||||
|
||||
# Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes)
|
||||
write 0xFF000500 0xE0000000 4
|
||||
write 0xFF000508 0x00001180 4
|
||||
write 0xFF000504 0x007F0001 4
|
||||
|
||||
|
||||
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
||||
flash 0xE0000000
|
||||
|
||||
# flash-plugin (target-based flashing) does not work yet
|
||||
#flash-plugin 0x10000000 0x4000 flash29.plugin
|
||||
|
||||
# Erase flash from 0xE0000000 to 0xE00FFFFF (reserved space for BaS)
|
||||
#
|
||||
# Caution: sector offset numbers need to be the ones from the x16 address range
|
||||
# column and they vary in size - needs to be exactly as in the data sheet (p. 9)
|
||||
#
|
||||
# contrary to documentation, it seems we need to erase-wait after each sector
|
||||
|
||||
erase 0xE0000000 0x00000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x01000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x02000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x03000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x04000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x05000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x06000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x07000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x08000
|
||||
erase-wait 0xE0000000
|
||||
erase 0xE0000000 0x10000
|
||||
erase-wait 0xE0000000
|
||||
blank-chk 0xE0000000 0x00000
|
||||
load -v bas.elf
|
||||
wait
|
||||
56
flash_scripts/flash_etos.bdm
Executable file
56
flash_scripts/flash_etos.bdm
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/local/bin/bdmctrl -D2
|
||||
#
|
||||
# flash EmuTOS using bdmctrl
|
||||
#
|
||||
open $1
|
||||
reset
|
||||
|
||||
# Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes)
|
||||
write 0xFF000500 0xE0000000 4
|
||||
write 0xFF000508 0x00001180 4
|
||||
write 0xFF000504 0x007F0001 4
|
||||
|
||||
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
||||
flash 0xe0000000
|
||||
|
||||
# Erase flash from 0xE0600000 to 0xE06FFFFF (reserved space for EmuTOS)
|
||||
#
|
||||
# Caution: sector offset numbers need to be the ones from the x16 address range
|
||||
# column and they vary in size - needs to be exactly as in the data sheet (p. 9)
|
||||
#
|
||||
# contrary to documentation, it seems we need to erase-wait after each sector
|
||||
|
||||
erase 0xe0000000 0x300000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x308000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x310000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x318000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x320000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x328000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x330000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x338000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x340000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x348000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x350000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x358000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x360000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x368000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x370000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x378000
|
||||
erase-wait 0xe0000000
|
||||
|
||||
load -v emutosfb.elf
|
||||
59
flash_scripts/flash_firetos.bdm
Executable file
59
flash_scripts/flash_firetos.bdm
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/local/bin/bdmctrl -D2
|
||||
#
|
||||
# firebee board initialization for bdmctrl
|
||||
#
|
||||
open $1
|
||||
reset
|
||||
|
||||
# Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes)
|
||||
write 0xFF000500 0xE0000000 4
|
||||
write 0xFF000508 0x00001180 4
|
||||
write 0xFF000504 0x007F0001 4
|
||||
|
||||
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
||||
flash 0xe0000000
|
||||
|
||||
# flash-plugin (target-based flashing) does not work yet
|
||||
# flash-plugin 0x10000000 0x4000 flash29.plugin
|
||||
|
||||
# Erase flash from 0xE0400000 to 0xE04FFFFF (reserved space for FireTOS)
|
||||
#
|
||||
# Caution: sector offset numbers need to be the ones from the x16 address range
|
||||
# column and they vary in size - needs to be exactly as in the data sheet (p. 9)
|
||||
#
|
||||
# contrary to documentation, it seems we need to erase-wait after each sector
|
||||
|
||||
erase 0xe0000000 0x200000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x208000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x210000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x218000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x220000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x228000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x230000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x238000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x240000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x248000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x250000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x258000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x260000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x268000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x270000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x278000
|
||||
erase-wait 0xe0000000
|
||||
|
||||
load -v firetos.elf
|
||||
77
flash_scripts/flash_fpga.bdm
Executable file
77
flash_scripts/flash_fpga.bdm
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/usr/local/bin/bdmctrl -D2
|
||||
#
|
||||
# firebee board initialization for bdmctrl
|
||||
#
|
||||
open $1
|
||||
#reset
|
||||
|
||||
# Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes)
|
||||
write 0xFF000500 0xE0000000 4
|
||||
write 0xFF000508 0x00001180 4
|
||||
write 0xFF000504 0x007F0001 4
|
||||
|
||||
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
||||
flash 0xe0000000
|
||||
|
||||
# flash-plugin (target-based flashing) does not work yet
|
||||
#flash-plugin 0x10000000 0x4000 flash29.plugin
|
||||
|
||||
# Erase flash from 0xE0700000 to 0xE07FFFFF (reserved space for FPGA)
|
||||
#
|
||||
# Caution: sector offset numbers need to be the ones from the x16 address range
|
||||
# column and they vary in size - needs to be exactly as in the data sheet (p. 9)
|
||||
#
|
||||
# contrary to documentation, it seems we need to erase-wait after each sector
|
||||
|
||||
erase 0xe0000000 0x380000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x388000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x390000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x398000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3A0000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3A0000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3A8000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3B0000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3B8000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3C0000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3C8000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3D0000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3D8000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3E0000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3E8000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3F0000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3F8000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3F9000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3FA000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3FB000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3FC000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3FD000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3FE000
|
||||
erase-wait 0xe0000000
|
||||
erase 0xe0000000 0x3FF000
|
||||
erase-wait 0xe0000000
|
||||
|
||||
wait
|
||||
|
||||
load -v FPGA.elf
|
||||
@@ -1,7 +1,30 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef _BAS_PRINTF_H_
|
||||
#define _BAS_PRINTF_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
typedef uint32_t size_t;
|
||||
#include <stddef.h>
|
||||
|
||||
extern void xvsnprintf(char *str, size_t size, const char *fmt, va_list va);
|
||||
extern void xvprintf(const char *fmt, va_list va);
|
||||
|
||||
27
include/bas_string.h
Normal file
27
include/bas_string.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* bas_string.h
|
||||
*
|
||||
* Created on: 26.02.2013
|
||||
* Author: mfro
|
||||
*/
|
||||
|
||||
#ifndef BAS_STRING_H_
|
||||
#define BAS_STRING_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern int strncmp(const char *s1, const char *s2, int max);
|
||||
extern char *strcpy(char *dst, const char *src);
|
||||
char *strncpy(char *dst, const char *src, int max);
|
||||
extern size_t strlen(const char *str);
|
||||
extern char *strcat(char *dst, const char *src);
|
||||
extern char *strncat(char *dst, const char *src, int max);
|
||||
extern int atoi(const char *c);
|
||||
|
||||
#define isdigit(c) (((c) >= '0') && ((c) <= '9'))
|
||||
#define isupper(c) ((c) >= 'A' && ((c) <= 'Z'))
|
||||
#define islower(c) ((c) >= 'a' && ((c) <= 'z'))
|
||||
#define isalpha(c) (isupper((c)) || islower(c))
|
||||
#define tolower(c) (isupper(c) ? ((c) + 'a' - 'A') : (c))
|
||||
|
||||
#endif /* BAS_STRING_H_ */
|
||||
37
include/bas_types.h
Normal file
37
include/bas_types.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* bas_types.h
|
||||
*
|
||||
* Created on: 17.11.2012
|
||||
* Author: mfro
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BAS_TYPES_H_
|
||||
#define BAS_TYPES_H_
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stdbool.h>
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
||||
#endif /* BAS_TYPES_H_ */
|
||||
32
include/cache.h
Normal file
32
include/cache.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _CACHE_H_
|
||||
#define _CACHE_H_
|
||||
|
||||
/*
|
||||
* cache.h
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern void flush_and_invalidate_caches(void);
|
||||
|
||||
#endif /* _CACHE_H_ */
|
||||
115
include/config.h
Normal file
115
include/config.h
Normal file
@@ -0,0 +1,115 @@
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
#ifndef COLDFIRE
|
||||
#define COLDFIRE
|
||||
#endif
|
||||
|
||||
/* DEBUG */
|
||||
#define DEBUG
|
||||
|
||||
/* DBUG */
|
||||
#define DBUG
|
||||
|
||||
/* PCI XBIOS */
|
||||
#undef PCI_XBIOS /* faster by cookie */
|
||||
|
||||
/* NETWORK */
|
||||
#ifdef COLDFIRE
|
||||
#define NETWORK
|
||||
#define ETHERNET_PORT 0 /* FEC channel */
|
||||
#undef TEST_NETWORK
|
||||
#undef DEBUG_PRINT
|
||||
#define LWIP
|
||||
#define WEB_LIGHT
|
||||
#undef FTP_SERVER
|
||||
#define ERRNO
|
||||
#define MCD_PROGQUERY
|
||||
#undef MCD_DEBUG
|
||||
|
||||
#ifdef MCF5445X /* target untested */
|
||||
#ifndef LWIP
|
||||
#undef NETWORK /* to do */
|
||||
#endif /* LWIP */
|
||||
#endif /* MCF5445X */
|
||||
|
||||
/* XBIOS */
|
||||
#define TOS_ATARI_LOGO /* defined for use TOS4.04 logo */
|
||||
|
||||
/* BDOS */
|
||||
#define NEWCODE
|
||||
#endif /* COLDFIRE */
|
||||
|
||||
/* fVDI */
|
||||
#define FVDI_STRUCT_2006
|
||||
|
||||
/* NVDI */
|
||||
#define PATCH_NVDI
|
||||
|
||||
/* VDI */
|
||||
#undef TOS_TABLES /* defined for use TOS4.04 index tables */
|
||||
|
||||
/* X86 emulator */
|
||||
#undef DEBUG_X86EMU
|
||||
#undef DEBUG_X86EMU_PCI
|
||||
#define __BIG_ENDIAN__
|
||||
#define NO_LONG_LONG
|
||||
|
||||
/* Radeon */
|
||||
#define DEFAULT_MONITOR_LAYOUT ""
|
||||
#define ATI_LOGO
|
||||
#define CONFIG_FB_RADEON_I2C
|
||||
#define CONFIG_FB_MODE_HELPERS
|
||||
#undef RADEON_TILING /* normally faster but tile 16 x 16 is not compatible with accel.c read_pixel, blit/expand_area and writes on screen frame buffer */
|
||||
#ifndef COLDFIRE
|
||||
#define RADEON_RENDER
|
||||
#endif
|
||||
#undef RADEON_THEATRE /* unfinished */
|
||||
#define RADEON_DIRECT_ACCESS /* MMIO access faster but don't check endian - little -> big conversion !!! */
|
||||
|
||||
/* Radeon VIDIX */
|
||||
#undef VIDIX_FILTER
|
||||
#undef VIDIX_ENABLE_BM /* unfinished */
|
||||
|
||||
/* RTC M5485EVB */
|
||||
#undef USE_RTC
|
||||
|
||||
/* LynxEM M5485EVB */
|
||||
#ifdef COLDFIRE
|
||||
#ifndef MCF5445X
|
||||
#ifndef MCF547X
|
||||
#undef CONFIG_VIDEO_SMI_LYNXEM
|
||||
#endif
|
||||
#endif
|
||||
#endif /* COLDFIRE */
|
||||
|
||||
/* XBIOS Setscreen */
|
||||
#define MAX_WIDTH_EMU_MONO 1024
|
||||
#define MAX_HEIGHT_EMU_MONO 768
|
||||
|
||||
/* AC97 */
|
||||
#define SOUND_AC97
|
||||
|
||||
/* USB */
|
||||
#undef USB_DEVICE /* Coldfire USB device */
|
||||
#define USB_BUFFER_SIZE 0x10000
|
||||
#define CONFIG_USB_OHCI /* PCI USB 1.1 */
|
||||
#define CONFIG_USB_EHCI /* PCI USB 2.0 */
|
||||
#undef CONFIG_EHCI_DCACHE
|
||||
#define CONFIG_SYS_OHCI_SWAP_REG_ACCESS
|
||||
#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15
|
||||
#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 15
|
||||
#if defined(COLDFIRE) && !defined(MCF547X)
|
||||
#undef CONFIG_USB_INTERRUPT_POLLING
|
||||
#else
|
||||
#define CONFIG_USB_INTERRUPT_POLLING
|
||||
#endif /* COLDFIRE */
|
||||
#undef CONFIG_LEGACY_USB_INIT_SEQ
|
||||
#define CONFIG_USB_KEYBOARD
|
||||
#define CONFIG_USB_MOUSE
|
||||
#define CONFIG_USB_STORAGE
|
||||
#ifdef COLDFIRE
|
||||
#define CONFIG_USB_MEM_NO_CACHE
|
||||
#endif /* COLDFIRE */
|
||||
|
||||
#endif /* _CONFIG_H_ */
|
||||
90
include/diskio.h
Normal file
90
include/diskio.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*-----------------------------------------------------------------------
|
||||
/ Low level disk interface modlue include file (C)ChaN, 2012
|
||||
/-----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _DISKIO_DEFINED
|
||||
#define _DISKIO_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _USE_WRITE 1 /* 1: Enable disk_write function */
|
||||
#define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/* Status of Disk Functions */
|
||||
typedef uint8_t DSTATUS;
|
||||
|
||||
/* Results of Disk Functions */
|
||||
typedef enum {
|
||||
RES_OK = 0, /* 0: Successful */
|
||||
RES_ERROR, /* 1: R/W Error */
|
||||
RES_WRPRT, /* 2: Write Protected */
|
||||
RES_NOTRDY, /* 3: Not Ready */
|
||||
RES_PARERR /* 4: Invalid Parameter */
|
||||
} DRESULT;
|
||||
|
||||
|
||||
/*---------------------------------------*/
|
||||
/* Prototypes for disk control functions */
|
||||
|
||||
|
||||
DSTATUS disk_initialize (uint8_t);
|
||||
DSTATUS disk_status (uint8_t);
|
||||
DRESULT disk_read (uint8_t, uint8_t*, uint32_t, uint8_t);
|
||||
#if _READONLY == 0
|
||||
DRESULT disk_write (uint8_t, const uint8_t*, uint32_t, uint8_t);
|
||||
#endif
|
||||
DRESULT disk_ioctl (uint8_t, uint8_t, void*);
|
||||
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||
#define STA_PROTECT 0x04 /* Write protected */
|
||||
|
||||
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic command (used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
|
||||
#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
|
||||
|
||||
/* Generic command (not used by FatFs) */
|
||||
#define CTRL_POWER 5 /* Get/Set power status */
|
||||
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
|
||||
#define CTRL_EJECT 7 /* Eject media */
|
||||
#define CTRL_FORMAT 8 /* Create physical format on the media */
|
||||
|
||||
/* MMC/SDC specific ioctl command */
|
||||
#define MMC_GET_TYPE 10 /* Get card type */
|
||||
#define MMC_GET_CSD 11 /* Get CSD */
|
||||
#define MMC_GET_CID 12 /* Get CID */
|
||||
#define MMC_GET_OCR 13 /* Get OCR */
|
||||
#define MMC_GET_SDSTAT 14 /* Get SD status */
|
||||
|
||||
/* ATA/CF specific ioctl command */
|
||||
#define ATA_GET_REV 20 /* Get F/W revision */
|
||||
#define ATA_GET_MODEL 21 /* Get model name */
|
||||
#define ATA_GET_SN 22 /* Get serial number */
|
||||
|
||||
|
||||
/* MMC card type flags (MMC_GET_TYPE) */
|
||||
#define CT_MMC 0x01 /* MMC ver 3 */
|
||||
#define CT_SD1 0x02 /* SD ver 1 */
|
||||
#define CT_SD2 0x04 /* SD ver 2 */
|
||||
#define CT_SDC (CT_SD1|CT_SD2) /* SD */
|
||||
#define CT_BLOCK 0x08 /* Block addressing */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
207
include/ehci.h
Normal file
207
include/ehci.h
Normal file
@@ -0,0 +1,207 @@
|
||||
/*-
|
||||
* Copyright (c) 2007-2008, Juniper Networks, Inc.
|
||||
* Copyright (c) 2008, Michael Trimarchi <trimarchimichael@yahoo.it>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 version 2 of
|
||||
* the License.
|
||||
*
|
||||
* 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 USB_EHCI_H
|
||||
#define USB_EHCI_H
|
||||
|
||||
#if !defined(CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS)
|
||||
#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 2
|
||||
#endif
|
||||
|
||||
/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
|
||||
#define DeviceRequest \
|
||||
((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
|
||||
|
||||
#define DeviceOutRequest \
|
||||
((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
|
||||
|
||||
#define InterfaceRequest \
|
||||
((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
|
||||
|
||||
#define EndpointRequest \
|
||||
((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
|
||||
|
||||
#define EndpointOutRequest \
|
||||
((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
|
||||
|
||||
/*
|
||||
* Register Space.
|
||||
*/
|
||||
struct ehci_hccr {
|
||||
uint32_t cr_capbase;
|
||||
#define HC_LENGTH(p) (((p) >> 0) & 0x00ff)
|
||||
#define HC_VERSION(p) (((p) >> 16) & 0xffff)
|
||||
uint32_t cr_hcsparams;
|
||||
#define HCS_PPC(p) ((p) & (1 << 4))
|
||||
#define HCS_INDICATOR(p) ((p) & (1 << 16)) /* Port indicators */
|
||||
#define HCS_N_PORTS(p) (((p) >> 0) & 0xf)
|
||||
uint32_t cr_hccparams;
|
||||
uint8_t cr_hcsp_portrt[8];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ehci_hcor {
|
||||
uint32_t or_usbcmd;
|
||||
#define CMD_PARK (1 << 11) /* enable "park" */
|
||||
#define CMD_PARK_CNT(c) (((c) >> 8) & 3) /* how many transfers to park */
|
||||
#define CMD_ASE (1 << 5) /* async schedule enable */
|
||||
#define CMD_LRESET (1 << 7) /* partial reset */
|
||||
#define CMD_IAAD (1 << 5) /* "doorbell" interrupt */
|
||||
#define CMD_PSE (1 << 4) /* periodic schedule enable */
|
||||
#define CMD_RESET (1 << 1) /* reset HC not bus */
|
||||
#define CMD_RUN (1 << 0) /* start/stop HC */
|
||||
uint32_t or_usbsts;
|
||||
#define STD_ASS (1 << 15)
|
||||
#define STS_PSSTAT (1 << 14)
|
||||
#define STS_RECL ( 1 << 13)
|
||||
#define STS_HALT (1 << 12)
|
||||
#define STS_IAA (1 << 5)
|
||||
#define STS_HSE (1 << 4)
|
||||
#define STS_FLR (1 << 3)
|
||||
#define STS_PCD (1 << 2)
|
||||
#define STS_USBERRINT (1 << 1)
|
||||
#define STS_USBINT (1 << 0)
|
||||
uint32_t or_usbintr;
|
||||
#define INTR_IAAE (1 << 5)
|
||||
#define INTR_HSEE (1 << 4)
|
||||
#define INTR_FLRE (1 << 3)
|
||||
#define INTR_PCDE (1 << 2)
|
||||
#define INTR_USBERRINTE (1 << 1)
|
||||
#define INTR_USBINTE (1 << 0)
|
||||
uint32_t or_frindex;
|
||||
uint32_t or_ctrldssegment;
|
||||
uint32_t or_periodiclistbase;
|
||||
uint32_t or_asynclistaddr;
|
||||
uint32_t _reserved_[9];
|
||||
uint32_t or_configflag;
|
||||
#define FLAG_CF (1 << 0) /* true: we'll support "high speed" */
|
||||
uint32_t or_portsc[CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS];
|
||||
uint32_t or_systune;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USBMODE 0x68 /* USB Device mode */
|
||||
#define USBMODE_SDIS (1 << 3) /* Stream disable */
|
||||
#define USBMODE_BE (1 << 2) /* BE/LE endiannes select */
|
||||
#define USBMODE_CM_HC (3 << 0) /* host controller mode */
|
||||
#define USBMODE_CM_IDLE (0 << 0) /* idle state */
|
||||
|
||||
/* Interface descriptor */
|
||||
struct usb_linux_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;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Configuration descriptor information.. */
|
||||
struct usb_linux_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;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#if defined CONFIG_EHCI_DESC_BIG_ENDIAN
|
||||
#define ehci_readl(x) (*((volatile u32 *)(x)))
|
||||
#define ehci_writel(a, b) (*((volatile u32 *)(a)) = ((volatile u32)b))
|
||||
#else
|
||||
#define ehci_readl(x) cpu_to_le32((*((volatile u32 *)(x))))
|
||||
#define ehci_writel(a, b) (*((volatile u32 *)(a)) = cpu_to_le32(((volatile u32)b)))
|
||||
#endif
|
||||
|
||||
#if defined CONFIG_EHCI_MMIO_BIG_ENDIAN
|
||||
#define hc32_to_cpu(x) be32_to_cpu((x))
|
||||
#define cpu_to_hc32(x) cpu_to_be32((x))
|
||||
#else
|
||||
#define hc32_to_cpu(x) le32_to_cpu((x))
|
||||
#define cpu_to_hc32(x) cpu_to_le32((x))
|
||||
#endif
|
||||
|
||||
#define EHCI_PS_WKOC_E (1 << 22) /* RW wake on over current */
|
||||
#define EHCI_PS_WKDSCNNT_E (1 << 21) /* RW wake on disconnect */
|
||||
#define EHCI_PS_WKCNNT_E (1 << 20) /* RW wake on connect */
|
||||
#define EHCI_PS_PO (1 << 13) /* RW port owner */
|
||||
#define EHCI_PS_PP (1 << 12) /* RW,RO port power */
|
||||
#define EHCI_PS_LS (3 << 10) /* RO line status */
|
||||
#define EHCI_PS_PR (1 << 8) /* RW port reset */
|
||||
#define EHCI_PS_SUSP (1 << 7) /* RW suspend */
|
||||
#define EHCI_PS_FPR (1 << 6) /* RW force port resume */
|
||||
#define EHCI_PS_OCC (1 << 5) /* RWC over current change */
|
||||
#define EHCI_PS_OCA (1 << 4) /* RO over current active */
|
||||
#define EHCI_PS_PEC (1 << 3) /* RWC port enable change */
|
||||
#define EHCI_PS_PE (1 << 2) /* RW port enable */
|
||||
#define EHCI_PS_CSC (1 << 1) /* RWC connect status change */
|
||||
#define EHCI_PS_CS (1 << 0) /* RO connect status */
|
||||
#define EHCI_PS_CLEAR (EHCI_PS_OCC | EHCI_PS_PEC | EHCI_PS_CSC)
|
||||
|
||||
#define EHCI_PS_IS_LOWSPEED(x) (((x) & EHCI_PS_LS) == (1 << 10))
|
||||
|
||||
/*
|
||||
* Schedule Interface Space.
|
||||
*
|
||||
* IMPORTANT: Software must ensure that no interface data structure
|
||||
* reachable by the EHCI host controller spans a 4K page boundary!
|
||||
*
|
||||
* Periodic transfers (i.e. isochronous and interrupt transfers) are
|
||||
* not supported.
|
||||
*/
|
||||
|
||||
/* Queue Element Transfer Descriptor (qTD). */
|
||||
struct qTD {
|
||||
uint32_t qt_next;
|
||||
#define QT_NEXT_TERMINATE 1
|
||||
uint32_t qt_altnext;
|
||||
uint32_t qt_token;
|
||||
uint32_t qt_buffer[5];
|
||||
};
|
||||
|
||||
/* Queue Head (QH). */
|
||||
struct QH {
|
||||
uint32_t qh_link;
|
||||
#define QH_LINK_TERMINATE 1
|
||||
#define QH_LINK_TYPE_ITD 0
|
||||
#define QH_LINK_TYPE_QH 2
|
||||
#define QH_LINK_TYPE_SITD 4
|
||||
#define QH_LINK_TYPE_FSTN 6
|
||||
uint32_t qh_endpt1;
|
||||
uint32_t qh_endpt2;
|
||||
uint32_t qh_curtd;
|
||||
struct qTD qh_overlay;
|
||||
/*
|
||||
* Add dummy fill value to make the size of this struct
|
||||
* aligned to 32 bytes
|
||||
*/
|
||||
uint8_t fill[16];
|
||||
};
|
||||
|
||||
/* Low level init functions */
|
||||
int ehci_hcd_init(void);
|
||||
int ehci_hcd_stop(void);
|
||||
|
||||
#endif /* USB_EHCI_H */
|
||||
337
include/ff.h
Normal file
337
include/ff.h
Normal file
@@ -0,0 +1,337 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module include file R0.09a (C)ChaN, 2012
|
||||
/----------------------------------------------------------------------------/
|
||||
/ FatFs module is a generic FAT file system module for small embedded systems.
|
||||
/ This is a free software that opened for education, research and commercial
|
||||
/ developments under license policy of following terms.
|
||||
/
|
||||
/ Copyright (C) 2012, ChaN, all right reserved.
|
||||
/
|
||||
/ * The FatFs module is a free software and there is NO WARRANTY.
|
||||
/ * No restriction on use. You can use, modify and redistribute it for
|
||||
/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
|
||||
/ * Redistributions of source code must retain the above copyright notice.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _FATFS
|
||||
#define _FATFS 4004 /* Revision ID */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ffconf.h> /* FatFs configuration options */
|
||||
|
||||
#if _FATFS != _FFCONF
|
||||
#error Wrong configuration file (ffconf.h).
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Definitions of volume management */
|
||||
|
||||
#if _MULTI_PARTITION /* Multiple partition configuration */
|
||||
typedef struct {
|
||||
uint8_t pd; /* Physical drive number */
|
||||
uint8_t pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
||||
} PARTITION;
|
||||
extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
|
||||
#define LD2PD(vol) (VolToPart[vol].pd) /* Get physical drive number */
|
||||
#define LD2PT(vol) (VolToPart[vol].pt) /* Get partition index */
|
||||
|
||||
#else /* Single partition configuration */
|
||||
#define LD2PD(vol) (uint8_t)(vol) /* Each logical drive is bound to the same physical drive number */
|
||||
#define LD2PT(vol) 0 /* Always mounts the 1st partition or in SFD */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Type of path name strings on FatFs API */
|
||||
|
||||
#if _LFN_UNICODE /* Unicode string */
|
||||
#if !_USE_LFN
|
||||
#error _LFN_UNICODE must be 0 in non-LFN cfg.
|
||||
#endif
|
||||
#ifndef _INC_TCHAR
|
||||
typedef uint16_t TCHAR;
|
||||
#define _T(x) L ## x
|
||||
#define _TEXT(x) L ## x
|
||||
#endif
|
||||
|
||||
#else /* ANSI/OEM string */
|
||||
#ifndef _INC_TCHAR
|
||||
typedef char TCHAR;
|
||||
#define _T(x) x
|
||||
#define _TEXT(x) x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* File system object structure (FATFS) */
|
||||
|
||||
typedef struct {
|
||||
uint8_t fs_type; /* FAT sub-type (0:Not mounted) */
|
||||
uint8_t drv; /* Physical drive number */
|
||||
uint8_t csize; /* Sectors per cluster (1,2,4...128) */
|
||||
uint8_t n_fats; /* Number of FAT copies (1,2) */
|
||||
uint8_t wflag; /* win[] dirty flag (1:must be written back) */
|
||||
uint8_t fsi_flag; /* fsinfo dirty flag (1:must be written back) */
|
||||
uint16_t id; /* File system mount ID */
|
||||
uint16_t n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||
#if _MAX_SS != 512
|
||||
uint16_t ssize; /* Bytes per sector (512, 1024, 2048 or 4096) */
|
||||
#endif
|
||||
#if _FS_REENTRANT
|
||||
_SYNC_t sobj; /* Identifier of sync object */
|
||||
#endif
|
||||
#if !_FS_READONLY
|
||||
uint32_t last_clust; /* Last allocated cluster */
|
||||
uint32_t free_clust; /* Number of free clusters */
|
||||
uint32_t fsi_sector; /* fsinfo sector (FAT32) */
|
||||
#endif
|
||||
#if _FS_RPATH
|
||||
uint32_t cdir; /* Current directory start cluster (0:root) */
|
||||
#endif
|
||||
uint32_t n_fatent; /* Number of FAT entries (= number of clusters + 2) */
|
||||
uint32_t fsize; /* Sectors per FAT */
|
||||
uint32_t fatbase; /* FAT start sector */
|
||||
uint32_t dirbase; /* Root directory start sector (FAT32:Cluster#) */
|
||||
uint32_t database; /* Data start sector */
|
||||
uint32_t winsect; /* Current sector appearing in the win[] */
|
||||
uint8_t win[_MAX_SS]; /* Disk access window for Directory, FAT (and Data on tiny cfg) */
|
||||
} FATFS;
|
||||
|
||||
|
||||
|
||||
/* File object structure (FIL) */
|
||||
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the related file system object */
|
||||
uint16_t id; /* File system mount ID of the related file system object */
|
||||
uint8_t flag; /* File status flags */
|
||||
uint8_t pad1;
|
||||
uint32_t fptr; /* File read/write pointer (0ed on file open) */
|
||||
uint32_t fsize; /* File size */
|
||||
uint32_t sclust; /* File data start cluster (0:no data cluster, always 0 when fsize is 0) */
|
||||
uint32_t clust; /* Current cluster of fpter */
|
||||
uint32_t dsect; /* Current data sector of fpter */
|
||||
#if !_FS_READONLY
|
||||
uint32_t dir_sect; /* Sector containing the directory entry */
|
||||
uint8_t* dir_ptr; /* Pointer to the directory entry in the window */
|
||||
#endif
|
||||
#if _USE_FASTSEEK
|
||||
uint32_t* cltbl; /* Pointer to the cluster link map table (null on file open) */
|
||||
#endif
|
||||
#if _FS_LOCK
|
||||
uint32_t lockid; /* File lock ID (index of file semaphore table Files[]) */
|
||||
#endif
|
||||
#if !_FS_TINY
|
||||
uint8_t buf[_MAX_SS]; /* File data read/write buffer */
|
||||
#endif
|
||||
} FIL;
|
||||
|
||||
|
||||
|
||||
/* Directory object structure (DIR) */
|
||||
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the owner file system object */
|
||||
uint16_t id; /* Owner file system mount ID */
|
||||
uint16_t index; /* Current read/write index number */
|
||||
uint32_t sclust; /* Table start cluster (0:Root dir) */
|
||||
uint32_t clust; /* Current cluster */
|
||||
uint32_t sect; /* Current sector */
|
||||
uint8_t* dir; /* Pointer to the current SFN entry in the win[] */
|
||||
uint8_t* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
|
||||
#if _USE_LFN
|
||||
uint16_t* lfn; /* Pointer to the LFN working buffer */
|
||||
uint16_t lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
|
||||
#endif
|
||||
} DIR;
|
||||
|
||||
|
||||
|
||||
/* File status structure (FILINFO) */
|
||||
|
||||
typedef struct {
|
||||
uint32_t fsize; /* File size */
|
||||
uint16_t fdate; /* Last modified date */
|
||||
uint16_t ftime; /* Last modified time */
|
||||
uint8_t fattrib; /* Attribute */
|
||||
TCHAR fname[13]; /* Short file name (8.3 format) */
|
||||
#if _USE_LFN
|
||||
TCHAR* lfname; /* Pointer to the LFN buffer */
|
||||
uint32_t lfsize; /* Size of LFN buffer in TCHAR */
|
||||
#endif
|
||||
} FILINFO;
|
||||
|
||||
|
||||
|
||||
/* File function return code (FRESULT) */
|
||||
|
||||
typedef enum {
|
||||
FR_OK = 0, /* (0) Succeeded */
|
||||
FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
|
||||
FR_INT_ERR, /* (2) Assertion failed */
|
||||
FR_NOT_READY, /* (3) The physical drive cannot work */
|
||||
FR_NO_FILE, /* (4) Could not find the file */
|
||||
FR_NO_PATH, /* (5) Could not find the path */
|
||||
FR_INVALID_NAME, /* (6) The path name format is invalid */
|
||||
FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
|
||||
FR_EXIST, /* (8) Access denied due to prohibited access */
|
||||
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
|
||||
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
|
||||
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
|
||||
FR_NOT_ENABLED, /* (12) The volume has no work area */
|
||||
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
|
||||
FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any parameter error */
|
||||
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
|
||||
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
|
||||
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
|
||||
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_SHARE */
|
||||
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
|
||||
} FRESULT;
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* FatFs module application interface */
|
||||
|
||||
FRESULT f_mount (uint8_t, FATFS*); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_open (FIL*, const TCHAR*, uint8_t); /* Open or create a file */
|
||||
FRESULT f_read (FIL*, void*, uint32_t, uint32_t*); /* Read data from a file */
|
||||
FRESULT f_lseek (FIL*, uint32_t); /* Move file pointer of a file object */
|
||||
FRESULT f_close (FIL*); /* Close an open file object */
|
||||
FRESULT f_opendir (DIR*, const char*); /* Open an existing directory */
|
||||
FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
|
||||
FRESULT f_stat (const TCHAR*, FILINFO*); /* Get file status */
|
||||
FRESULT f_write (FIL*, const void*, uint32_t, uint32_t*); /* Write data to a file */
|
||||
FRESULT f_getfree (const TCHAR*, uint32_t*, FATFS**); /* Get number of free clusters on the drive */
|
||||
FRESULT f_truncate (FIL*); /* Truncate file */
|
||||
FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
|
||||
FRESULT f_unlink (const TCHAR*); /* Delete an existing file or directory */
|
||||
FRESULT f_mkdir (const TCHAR*); /* Create a new directory */
|
||||
FRESULT f_chmod (const TCHAR*, uint8_t, uint8_t); /* Change attribute of the file/dir */
|
||||
FRESULT f_utime (const TCHAR*, const FILINFO*); /* Change times-tamp of the file/dir */
|
||||
FRESULT f_rename (const TCHAR*, const TCHAR*); /* Rename/Move a file or directory */
|
||||
FRESULT f_chdrive (uint8_t); /* Change current drive */
|
||||
FRESULT f_chdir (const TCHAR*); /* Change current directory */
|
||||
FRESULT f_getcwd (TCHAR*, uint32_t); /* Get current directory */
|
||||
FRESULT f_forward (FIL*, uint32_t(*)(const uint8_t*,uint32_t), uint32_t, uint32_t*); /* Forward data to the stream */
|
||||
FRESULT f_mkfs (uint8_t, uint8_t, uint32_t); /* Create a file system on the drive */
|
||||
FRESULT f_fdisk (uint8_t, const uint32_t[], void*); /* Divide a physical drive into some partitions */
|
||||
int f_putc (TCHAR, FIL*); /* Put a character to the file */
|
||||
int f_puts (const TCHAR*, FIL*); /* Put a string to the file */
|
||||
int f_printf (FIL*, const TCHAR*, ...); /* Put a formatted string to the file */
|
||||
TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */
|
||||
|
||||
#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
|
||||
#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
||||
#define f_tell(fp) ((fp)->fptr)
|
||||
#define f_size(fp) ((fp)->fsize)
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Additional user defined functions */
|
||||
|
||||
/* RTC function */
|
||||
#if !_FS_READONLY
|
||||
uint32_t get_fattime (void);
|
||||
#endif
|
||||
|
||||
/* Unicode support functions */
|
||||
#if _USE_LFN /* Unicode - OEM code conversion */
|
||||
uint16_t ff_convert (uint16_t, uint32_t); /* OEM-Unicode bidirectional conversion */
|
||||
uint16_t ff_wtoupper (uint16_t); /* Unicode upper-case conversion */
|
||||
#if _USE_LFN == 3 /* Memory functions */
|
||||
void* ff_memalloc (uint32_t); /* Allocate memory block */
|
||||
void ff_memfree (void*); /* Free memory block */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Sync functions */
|
||||
#if _FS_REENTRANT
|
||||
int ff_cre_syncobj (uint8_t, _SYNC_t*);/* Create a sync object */
|
||||
int ff_req_grant (_SYNC_t); /* Lock sync object */
|
||||
void ff_rel_grant (_SYNC_t); /* Unlock sync object */
|
||||
int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Flags and offset address */
|
||||
|
||||
|
||||
/* File access control and file status flags (FIL.flag) */
|
||||
|
||||
#define FA_READ 0x01
|
||||
#define FA_OPEN_EXISTING 0x00
|
||||
#define FA__ERROR 0x80
|
||||
|
||||
#if !_FS_READONLY
|
||||
#define FA_WRITE 0x02
|
||||
#define FA_CREATE_NEW 0x04
|
||||
#define FA_CREATE_ALWAYS 0x08
|
||||
#define FA_OPEN_ALWAYS 0x10
|
||||
#define FA__WRITTEN 0x20
|
||||
#define FA__DIRTY 0x40
|
||||
#endif
|
||||
|
||||
|
||||
/* FAT sub type (FATFS.fs_type) */
|
||||
|
||||
#define FS_FAT12 1
|
||||
#define FS_FAT16 2
|
||||
#define FS_FAT32 3
|
||||
|
||||
|
||||
/* File attribute bits for directory entry */
|
||||
|
||||
#define AM_RDO 0x01 /* Read only */
|
||||
#define AM_HID 0x02 /* Hidden */
|
||||
#define AM_SYS 0x04 /* System */
|
||||
#define AM_VOL 0x08 /* Volume label */
|
||||
#define AM_LFN 0x0F /* LFN entry */
|
||||
#define AM_DIR 0x10 /* Directory */
|
||||
#define AM_ARC 0x20 /* Archive */
|
||||
#define AM_MASK 0x3F /* Mask of defined bits */
|
||||
|
||||
|
||||
/* Fast seek feature */
|
||||
#define CREATE_LINKMAP 0xFFFFFFFF
|
||||
|
||||
|
||||
|
||||
/*--------------------------------*/
|
||||
/* Multi-byte word access macros */
|
||||
|
||||
#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
|
||||
#define LD_WORD(ptr) (uint16_t)(* (uint16_t *)(uint8_t *)(ptr))
|
||||
#define LD_DWORD(ptr) (uint32_t)(* (uint32_t *)(uint8_t *)(ptr))
|
||||
#define ST_WORD(ptr,val) *(uint16_t *) (uint8_t *)(ptr) = (uint16_t)(val)
|
||||
#define ST_DWORD(ptr,val) *(uint32_t *) (uint8_t *)(ptr) = (uint32_t)(val)
|
||||
#else /* Use byte-by-byte access to the FAT structure */
|
||||
#define LD_WORD(ptr) (uint16_t)(((uint16_t)*((uint8_t *)(ptr) + 1) << 8) | (uint16_t) *(uint8_t *)(ptr))
|
||||
#define LD_DWORD(ptr) (uint32_t)(((uint32_t)*((uint8_t *)(ptr) + 3) << 24) | ((uint32_t)*((uint8_t*)(ptr) + 2) << 16) | ((uint16_t) *((uint8_t*)(ptr) + 1) << 8) | *(uint8_t*)(ptr))
|
||||
#define ST_WORD(ptr,val) *(uint8_t *)(ptr) = (uint8_t)(val); *((uint8_t *)(ptr) + 1) = (uint8_t)((uint16_t)(val) >> 8)
|
||||
#define ST_DWORD(ptr,val) *(uint8_t *)(ptr) = (uint8_t)(val); *((uint8_t *)(ptr) + 1) = (uint8_t)((uint16_t)(val) >> 8); *((uint8_t*)(ptr) + 2) = (uint8_t)((uint32_t)(val) >> 16); *((uint8_t *)(ptr) + 3) = (uint8_t)((uint32_t)(val) >> 24)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FATFS */
|
||||
190
include/ffconf.h
Normal file
190
include/ffconf.h
Normal file
@@ -0,0 +1,190 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module configuration file R0.09a (C)ChaN, 2012
|
||||
/----------------------------------------------------------------------------/
|
||||
/
|
||||
/ CAUTION! Do not forget to make clean the project after any changes to
|
||||
/ the configuration options.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
#ifndef _FFCONF
|
||||
#define _FFCONF 4004 /* Revision ID */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Functions and Buffer Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _FS_TINY 0 /* 0:Normal or 1:Tiny */
|
||||
/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
|
||||
/ object instead of the sector buffer in the individual file object for file
|
||||
/ data transfer. This reduces memory consumption 512 bytes each file object. */
|
||||
|
||||
|
||||
#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
|
||||
/* Setting _FS_READONLY to 1 defines read only configuration. This removes
|
||||
/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
|
||||
/ f_truncate and useless f_getfree. */
|
||||
|
||||
|
||||
#define _FS_MINIMIZE 0 /* 0 to 3 */
|
||||
/* The _FS_MINIMIZE option defines minimization level to remove some functions.
|
||||
/
|
||||
/ 0: Full function.
|
||||
/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
|
||||
/ are removed.
|
||||
/ 2: f_opendir and f_readdir are removed in addition to 1.
|
||||
/ 3: f_lseek is removed in addition to 2. */
|
||||
|
||||
|
||||
#define _USE_STRFUNC 1 /* 0:Disable or 1-2:Enable */
|
||||
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
|
||||
|
||||
|
||||
#define _USE_MKFS 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
|
||||
|
||||
|
||||
#define _USE_FORWARD 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
|
||||
|
||||
|
||||
#define _USE_FASTSEEK 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable fast seek feature, set _USE_FASTSEEK to 1. */
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Locale and Namespace Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _CODE_PAGE 858
|
||||
/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect setting of the code page can cause a file open failure.
|
||||
/
|
||||
/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
|
||||
/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
|
||||
/ 949 - Korean (DBCS, OEM, Windows)
|
||||
/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
|
||||
/ 1250 - Central Europe (Windows)
|
||||
/ 1251 - Cyrillic (Windows)
|
||||
/ 1252 - Latin 1 (Windows)
|
||||
/ 1253 - Greek (Windows)
|
||||
/ 1254 - Turkish (Windows)
|
||||
/ 1255 - Hebrew (Windows)
|
||||
/ 1256 - Arabic (Windows)
|
||||
/ 1257 - Baltic (Windows)
|
||||
/ 1258 - Vietnam (OEM, Windows)
|
||||
/ 437 - U.S. (OEM)
|
||||
/ 720 - Arabic (OEM)
|
||||
/ 737 - Greek (OEM)
|
||||
/ 775 - Baltic (OEM)
|
||||
/ 850 - Multilingual Latin 1 (OEM)
|
||||
/ 858 - Multilingual Latin 1 + Euro (OEM)
|
||||
/ 852 - Latin 2 (OEM)
|
||||
/ 855 - Cyrillic (OEM)
|
||||
/ 866 - Russian (OEM)
|
||||
/ 857 - Turkish (OEM)
|
||||
/ 862 - Hebrew (OEM)
|
||||
/ 874 - Thai (OEM, Windows)
|
||||
/ 1 - ASCII only (Valid for non LFN cfg.)
|
||||
*/
|
||||
|
||||
|
||||
#define _USE_LFN 0 /* 0 to 3 */
|
||||
#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
|
||||
/* The _USE_LFN option switches the LFN support.
|
||||
/
|
||||
/ 0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT reentrant.
|
||||
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
||||
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
||||
/
|
||||
/ The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. To enable LFN,
|
||||
/ Unicode handling functions ff_convert() and ff_wtoupper() must be added
|
||||
/ to the project. When enable to use heap, memory control functions
|
||||
/ ff_memalloc() and ff_memfree() must be added to the project. */
|
||||
|
||||
|
||||
#define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */
|
||||
/* To switch the character code set on FatFs API to Unicode,
|
||||
/ enable LFN feature and set _LFN_UNICODE to 1. */
|
||||
|
||||
|
||||
#define _FS_RPATH 0 /* 0 to 2 */
|
||||
/* The _FS_RPATH option configures relative path feature.
|
||||
/
|
||||
/ 0: Disable relative path feature and remove related functions.
|
||||
/ 1: Enable relative path. f_chdrive() and f_chdir() are available.
|
||||
/ 2: f_getcwd() is available in addition to 1.
|
||||
/
|
||||
/ Note that output of the f_readdir fnction is affected by this option. */
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Physical Drive Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _VOLUMES 1
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
|
||||
|
||||
#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
|
||||
/* Maximum sector size to be handled.
|
||||
/ Always set 512 for memory card and hard disk but a larger value may be
|
||||
/ required for on-board flash memory, floppy disk and optical disk.
|
||||
/ When _MAX_SS is larger than 512, it configures FatFs to variable sector size
|
||||
/ and GET_SECTOR_SIZE command must be implememted to the disk_ioctl function. */
|
||||
|
||||
|
||||
#define _MULTI_PARTITION 0 /* 0:Single partition, 1/2:Enable multiple partition */
|
||||
/* When set to 0, each volume is bound to the same physical drive number and
|
||||
/ it can mount only first primaly partition. When it is set to 1, each volume
|
||||
/ is tied to the partitions listed in VolToPart[]. */
|
||||
|
||||
|
||||
#define _USE_ERASE 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable sector erase feature, set _USE_ERASE to 1. CTRL_ERASE_SECTOR command
|
||||
/ should be added to the disk_ioctl functio. */
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ System Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _WORD_ACCESS 0 /* 0 or 1 */
|
||||
/* Set 0 first and it is always compatible with all platforms. The _WORD_ACCESS
|
||||
/ option defines which access method is used to the word data on the FAT volume.
|
||||
/
|
||||
/ 0: Byte-by-byte access.
|
||||
/ 1: Word access. Do not choose this unless following condition is met.
|
||||
/
|
||||
/ When the byte order on the memory is big-endian or address miss-aligned word
|
||||
/ access results incorrect behavior, the _WORD_ACCESS must be set to 0.
|
||||
/ If it is not the case, the value can also be set to 1 to improve the
|
||||
/ performance and code size.
|
||||
*/
|
||||
|
||||
|
||||
/* A header file that defines sync object types on the O/S, such as
|
||||
/ windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
|
||||
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||
#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
|
||||
|
||||
/* The _FS_REENTRANT option switches the reentrancy (thread safe) of the FatFs module.
|
||||
/
|
||||
/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
|
||||
/ 1: Enable reentrancy. Also user provided synchronization handlers,
|
||||
/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
|
||||
/ function must be added to the project. */
|
||||
|
||||
|
||||
#define _FS_LOCK 0 /* 0:Disable or >=1:Enable */
|
||||
/* To enable file lock control feature, set _FS_LOCK to 1 or greater.
|
||||
The value defines how many files can be opened simultaneously. */
|
||||
|
||||
|
||||
#endif /* _FFCONFIG */
|
||||
55
include/fifo.h
Normal file
55
include/fifo.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This is taken from general implementations
|
||||
* on the internet, and definately needs some
|
||||
* work.
|
||||
*
|
||||
* good enough for now.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FIREBEE_FIFO
|
||||
#define FIREBEE_FIFO
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/*
|
||||
* FIFO
|
||||
*
|
||||
* Make this look exactly like IOREC, so that
|
||||
* we can interchange the two. But ignore the
|
||||
* low, high watermarks. For now.
|
||||
*
|
||||
* in IOREC, the notion of head/tail is opposite
|
||||
* to ours. So we place our head/tail, in the
|
||||
* equivalent positions as TOS use is. So
|
||||
* we can use this structure, intermittantly
|
||||
* with TOS.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char * buf;
|
||||
int16_t size;
|
||||
int16_t tail;
|
||||
int16_t head;
|
||||
int16_t low;
|
||||
int16_t high;
|
||||
} fifo_t;
|
||||
|
||||
void fifo_init(fifo_t*, char*, int16_t);
|
||||
void fifo_advance(fifo_t*, int16_t*);
|
||||
|
||||
uint8_t fifo_get(fifo_t*);
|
||||
void fifo_put(fifo_t*, uint8_t);
|
||||
|
||||
void fifo_clear(fifo_t*);
|
||||
|
||||
int fifo_used(fifo_t*);
|
||||
int fifo_unused(fifo_t*);
|
||||
|
||||
int fifo_full(fifo_t*);
|
||||
int fifo_empty(fifo_t*);
|
||||
|
||||
int fifo_read(fifo_t*, unsigned char *, int16_t);
|
||||
int fifo_write(fifo_t*, const unsigned char*, int16_t);
|
||||
|
||||
#endif
|
||||
48
include/i2c_firebee.h
Normal file
48
include/i2c_firebee.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* i2c.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef I2CFIREBEE_h
|
||||
#define I2CFIREBEE_h
|
||||
|
||||
#include <fifo.h>
|
||||
|
||||
#ifndef BUFSIZ
|
||||
#define BUFSIZ 512
|
||||
#endif
|
||||
|
||||
#define I2CTLREAD (('i'<<8) | 1)
|
||||
#define I2CTLWRITE (('i'<<8) | 2)
|
||||
#define I2CTLSBUF (('i'<<8) | 3)
|
||||
#define I2CTLINIT (('i'<<8) | 4)
|
||||
#define I2CTLDEV (('i'<<8) | 5)
|
||||
|
||||
// Set a specific bit
|
||||
#define set_bit(p,bit) p |= (bit)
|
||||
#define set_bit_nr(p,nr) set_bit(p,(1<<(nr)))
|
||||
|
||||
// Clear a specific bit
|
||||
#define clear_bit(p,bit) p &= ~(bit)
|
||||
#define clear_bit_nr(p,nr) clear_bit(p,(1<<(nr)))
|
||||
|
||||
#define ELAPSED(t) (t - ReadTimer())
|
||||
|
||||
#define I2C_BUFFER_LENGTH 32
|
||||
|
||||
#define I2C_READY 0
|
||||
#define I2C_MXRX 1
|
||||
#define I2C_MXTX 2
|
||||
|
||||
#define I2C_ADDR 6
|
||||
|
||||
#define I2C_READ 1
|
||||
#define I2C_WRITE 0
|
||||
|
||||
unsigned long ReadTimer();
|
||||
void DelayMicroSec(unsigned long);
|
||||
|
||||
void I2C_Init();
|
||||
int I2C_ioctl(unsigned int, unsigned long);
|
||||
|
||||
#endif
|
||||
165
include/mod_devicetable.h
Normal file
165
include/mod_devicetable.h
Normal 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 */
|
||||
480
include/ohci.h
Normal file
480
include/ohci.h
Normal file
@@ -0,0 +1,480 @@
|
||||
/*
|
||||
* 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:\r\nLast data packet from endpoint contained a bit stuffing violation",
|
||||
"DATATOGGLEMISMATCH:\r\n Last packet from endpoint had data toggle PID\r\n" \
|
||||
"that did not match the expected value.",
|
||||
"STALL: TD was moved to the Done Queue because the endpoint returned a STALL PID",
|
||||
"DEVICENOTRESPONDING:\r\nDevice did not respond to token (IN) or did\r\n" \
|
||||
"not provide a handshake (OUT)",
|
||||
"PIDCHECKFAILURE:\r\nCheck bits on PID from endpoint failed on data PID\r\n"\
|
||||
"(IN) or handshake (OUT)",
|
||||
"UNEXPECTEDPID:\r\nReceive PID was not valid when encountered or PID\r\n" \
|
||||
"value is not defined.",
|
||||
"DATAOVERRUN:\r\nThe amount of data returned by the endpoint exceeded\r\n" \
|
||||
"either the size of the maximum data packet allowed\r\n" \
|
||||
"from the endpoint (found in MaximumPacketSize field\r\n" \
|
||||
"of ED) or the remaining buffer size.",
|
||||
"DATAUNDERRUN:\r\nThe endpoint returned less than MaximumPacketSize\r\n" \
|
||||
"and that amount was not sufficient to fill the\r\n" \
|
||||
"specified buffer",
|
||||
"reserved1",
|
||||
"reserved2",
|
||||
"BUFFEROVERRUN:\r\nDuring an IN, HC received data from endpoint faster\r\n" \
|
||||
"than it could be written to system memory",
|
||||
"BUFFERUNDERRUN:\r\nDuring an OUT, HC could not retrieve data from\r\n" \
|
||||
"system memory fast enough to keep up with data USB data rate.",
|
||||
"NOT ACCESSED:\r\nThis code is set by software before the TD is placed\r\n" \
|
||||
"on a list to be processed by the HC.(1)",
|
||||
"NOT ACCESSED:\r\nThis code is set by software before the TD is placed\r\n" \
|
||||
"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 {
|
||||
/* ------- common part -------- */
|
||||
long handle; /* PCI BIOS */
|
||||
const struct pci_device_id *ent;
|
||||
int usbnum;
|
||||
/* ---- end of common part ---- */
|
||||
int big_endian; /* PCI BIOS */
|
||||
int controller;
|
||||
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;
|
||||
|
||||
int irq_enabled;
|
||||
int stat_irq;
|
||||
int irq;
|
||||
int disabled; /* e.g. got a UE, we're hung */
|
||||
int sleeping;
|
||||
#define OHCI_FLAGS_NEC 0x80000000
|
||||
unsigned long flags; /* for HC bugs */
|
||||
|
||||
unsigned long offset;
|
||||
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 virt_root_hub rh;
|
||||
|
||||
const char *slot_name;
|
||||
|
||||
/* device which was disconnected */
|
||||
struct usb_device *devgone;
|
||||
} 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(ohci_t * ohci, 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;
|
||||
}
|
||||
|
||||
|
||||
89
include/part.h
Normal file
89
include/part.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* (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 */
|
||||
long (*block_read)(int dev, unsigned long start, lbaint_t blkcnt, void *buffer);
|
||||
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
|
||||
#define PART_TYPE_GEMDOS 0x06
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
2624
include/pci_ids.h
Normal file
2624
include/pci_ids.h
Normal file
File diff suppressed because it is too large
Load Diff
348
include/pcixbios.h
Normal file
348
include/pcixbios.h
Normal file
@@ -0,0 +1,348 @@
|
||||
/* 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 _CT60_XBIOS_PCI_H
|
||||
#define _CT60_XBIOS_PCI_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_ROM 0x2000 /* Expansion ROM */
|
||||
#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 "d0", "d1", "d2", "a0", "a1", "a2", "memory"
|
||||
#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) \
|
||||
: OSBIND_CLOBBER_LIST \
|
||||
); \
|
||||
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) \
|
||||
: OSBIND_CLOBBER_LIST \
|
||||
); \
|
||||
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) \
|
||||
: OSBIND_CLOBBER_LIST \
|
||||
); \
|
||||
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) \
|
||||
: OSBIND_CLOBBER_LIST \
|
||||
); \
|
||||
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) \
|
||||
: OSBIND_CLOBBER_LIST \
|
||||
); \
|
||||
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
|
||||
47
include/s19reader.h
Normal file
47
include/s19reader.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* s19reader.h
|
||||
*
|
||||
* Created on: 17.11.2012
|
||||
* Author: mfro
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _S19READER_H_
|
||||
#define _S19READER_H_
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OK, /* no error */
|
||||
FAIL, /* general error aka "I don't know what went wrong" */
|
||||
FILE_OPEN, /* file open failed */
|
||||
FILE_READ, /* file read failed */
|
||||
SREC_CORRUPT, /* file doesn't seem to contain valid S-records */
|
||||
MEMCPY_FAILED, /* could not copy buffer to destination */
|
||||
CODE_OVERLAPS, /* copying would overwrite ourself */
|
||||
VERIFY_FAILED, /* destination does not read as we've written to */
|
||||
ILLEGAL_SECTOR /* flash sector number invalid */
|
||||
} err_t;
|
||||
|
||||
typedef err_t (*memcpy_callback_t)(uint8_t *dst, uint8_t *src, uint32_t length);
|
||||
|
||||
extern void srec_execute(char *filename);
|
||||
extern err_t read_srecords(char *filename, void **start_address, uint32_t *actual_length, memcpy_callback_t callback);
|
||||
|
||||
#endif /* _S19READER_H_ */
|
||||
209
include/scsi.h
Normal file
209
include/scsi.h
Normal 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 */
|
||||
45
include/sd_card.h
Normal file
45
include/sd_card.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* sd_card.h
|
||||
*
|
||||
* Exported sd-card access routines for the FireBee BaS
|
||||
*
|
||||
* Created on: 19.11.2012
|
||||
* Author: mfro
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SD_CARD_H_
|
||||
#define _SD_CARD_H_
|
||||
|
||||
#include <MCF5475.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern void sd_card_init(void);
|
||||
|
||||
/* MMC card type flags (MMC_GET_TYPE) */
|
||||
#define CT_MMC 0x01 /* MMC ver 3 */
|
||||
#define CT_SD1 0x02 /* SD ver 1 */
|
||||
#define CT_SD2 0x04 /* SD ver 2 */
|
||||
#define CT_SDC (CT_SD1|CT_SD2) /* SD */
|
||||
#define CT_BLOCK 0x08 /* Block addressing */
|
||||
|
||||
#endif /* _SD_CARD_H_ */
|
||||
9
include/startcf.h
Normal file
9
include/startcf.h
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
#define SYSTEM_CLOCK 133
|
||||
#define cf_stack
|
||||
|
||||
#define DIP_SWITCH (*(volatile uint8_t *)(&_MBAR[0xA2C]))
|
||||
#define DIP_SWITCHa __MBAR + 0xA2C
|
||||
|
||||
#define sca_page_ID 6
|
||||
|
||||
45
include/sysinit.h
Normal file
45
include/sysinit.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* File: sysinit.h
|
||||
* Purpose: Firebee Power-on Reset configuration
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SYSINIT_H__
|
||||
#define __SYSINIT_H__
|
||||
|
||||
extern void wait_10us(void);
|
||||
|
||||
/* send a 16-bit word out on the serial port */
|
||||
#define uart_out_word(a) MCF_PSC0_PSCTB_8BIT = (a)
|
||||
|
||||
/* adresses where FPGA data lives in flash */
|
||||
#define FPGA_FLASH_DATA ((uint8_t *) 0xe0700000L)
|
||||
#define FPGA_FLASH_DATA_END ((uint8_t *) 0xe0800000L)
|
||||
|
||||
/* function(s) from init_fpga.c */
|
||||
extern void init_fpga(void);
|
||||
|
||||
#endif /* __SYSINIT_H__ */
|
||||
|
||||
|
||||
524
include/usb.h
Normal file
524
include/usb.h
Normal file
@@ -0,0 +1,524 @@
|
||||
/*
|
||||
* (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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <bas_printf.h>
|
||||
#include "pcixbios.h"
|
||||
#include "mod_devicetable.h"
|
||||
#include "pci_ids.h"
|
||||
#include "part.h"
|
||||
#include "wait.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 */
|
||||
|
||||
#define __u8 unsigned char
|
||||
#define __u16 unsigned short
|
||||
#define __u32 unsigned long
|
||||
#define u8 unsigned char
|
||||
#define u16 unsigned short
|
||||
#define u32 unsigned long
|
||||
#define uint8_t unsigned char
|
||||
#define uint32_t unsigned long
|
||||
#define uint16_t unsigned short
|
||||
|
||||
extern void kprint(const char *fmt, ...);
|
||||
extern int sprintD(char *s, const char *fmt, ...);
|
||||
#if defined(COLDFIRE) && defined(NETWORK) && defined(LWIP)
|
||||
extern void board_printf(const char *fmt, ...);
|
||||
#else
|
||||
#define board_printf kprint
|
||||
#endif
|
||||
|
||||
#include "usb_defs.h"
|
||||
|
||||
/* Everything is aribtrary */
|
||||
#define USB_ALTSETTINGALLOC 4
|
||||
#define USB_MAXALTSETTING 128 /* Hard limit */
|
||||
|
||||
#define USB_MAX_BUS 3
|
||||
#define USB_MAX_DEVICE 16
|
||||
#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];
|
||||
void *priv_hcd;
|
||||
int (*deregister)(struct usb_device *dev);
|
||||
|
||||
struct usb_hub_device *hub;
|
||||
int usbnum;
|
||||
};
|
||||
|
||||
/* Structure returned by Iorec() */
|
||||
typedef struct {
|
||||
char *ibuf;
|
||||
short ibufsiz;
|
||||
volatile short ibufhd;
|
||||
volatile short ibuftl;
|
||||
short ibuflow;
|
||||
short ibufhi;
|
||||
} _IOREC;
|
||||
/**********************************************************************
|
||||
* this is how the lowlevel part communicate with the outer world
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || defined(CONFIG_USB_EHCI)
|
||||
|
||||
#ifdef CONFIG_USB_UHCI
|
||||
int uhci_usb_lowlevel_init(long handle, const struct pci_device_id *ent, void **priv);
|
||||
int uhci_usb_lowlevel_stop(void *priv);
|
||||
int uhci_submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len);
|
||||
int uhci_submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, struct devrequest *setup);
|
||||
int uhci_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, int interval);
|
||||
#ifdef CONFIG_USB_INTERRUPT_POLLING
|
||||
void uhci_usb_event_poll(int interrupt);
|
||||
#else
|
||||
void uhci_usb_enable_interrupt(int enable);
|
||||
#endif /* CONFIG_USB_INTERRUPT_POLLING */
|
||||
#endif /* CONFIG_USB_UHCI */
|
||||
|
||||
#ifdef CONFIG_USB_OHCI
|
||||
int ohci_usb_lowlevel_init(long handle, const struct pci_device_id *ent, void **priv);
|
||||
int ohci_usb_lowlevel_stop(void *priv);
|
||||
int ohci_submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len);
|
||||
int ohci_submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, struct devrequest *setup);
|
||||
int ohci_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, int interval);
|
||||
#ifdef CONFIG_USB_INTERRUPT_POLLING
|
||||
void ohci_usb_event_poll(int interrupt);
|
||||
#else
|
||||
void ohci_usb_enable_interrupt(int enable);
|
||||
#endif /* CONFIG_USB_INTERRUPT_POLLING */
|
||||
#endif /* CONFIG_USB_OHCI */
|
||||
|
||||
#ifdef CONFIG_USB_EHCI
|
||||
int ehci_usb_lowlevel_init(long handle, const struct pci_device_id *ent, void **priv);
|
||||
int ehci_usb_lowlevel_stop(void *priv);
|
||||
int ehci_submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len);
|
||||
int ehci_submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, struct devrequest *setup);
|
||||
int ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, int interval);
|
||||
#ifdef CONFIG_USB_INTERRUPT_POLLING
|
||||
void ehci_usb_event_poll(int interrupt);
|
||||
#else
|
||||
void ehci_usb_enable_interrupt(int enable);
|
||||
#endif /* CONFIG_USB_INTERRUPT_POLLING */
|
||||
#endif /* CONFIG_USB_EHCI */
|
||||
|
||||
#else
|
||||
#error USB Lowlevel not defined
|
||||
#endif /* defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || defined(CONFIG_USB_EHCI) */
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_POLLING
|
||||
void usb_event_poll(int interrupt);
|
||||
#else
|
||||
void usb_enable_interrupt(int enable);
|
||||
#endif /* CONFIG_USB_INTERRUPT_POLLING */
|
||||
|
||||
#ifdef CONFIG_USB_STORAGE
|
||||
#define USB_MAX_STOR_DEV 5
|
||||
block_dev_desc_t *usb_stor_get_dev(int index);
|
||||
int usb_stor_scan(void);
|
||||
int usb_stor_info(void);
|
||||
int usb_stor_register(struct usb_device *dev);
|
||||
int usb_stor_deregister(struct usb_device *dev);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_KEYBOARD
|
||||
int drv_usb_kbd_init(void);
|
||||
int usb_kbd_register(struct usb_device *dev);
|
||||
int usb_kbd_deregister(struct usb_device *dev);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_MOUSE
|
||||
int drv_usb_mouse_init(void);
|
||||
int usb_mouse_register(struct usb_device *dev);
|
||||
int usb_mouse_deregister(struct usb_device *dev);
|
||||
#endif
|
||||
|
||||
extern char usb_error_str[256];
|
||||
|
||||
/* memory */
|
||||
void *usb_malloc(long amount);
|
||||
int usb_free(void *addr);
|
||||
int usb_mem_init(void);
|
||||
void usb_mem_stop(void);
|
||||
|
||||
/* routines */
|
||||
int usb_init(long handle, const struct pci_device_id *ent); /* initialize the USB Controller */
|
||||
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 index, int bus);
|
||||
int usb_control_msg(struct usb_device *dev, unsigned int pipe, unsigned char request, unsigned char requesttype, unsigned short value,
|
||||
unsigned short index, 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);
|
||||
|
||||
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 index, 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)); \
|
||||
})
|
||||
|
||||
#define swap_16(x) __swap_16(x)
|
||||
#define swap_32(x) __swap_32(x)
|
||||
|
||||
extern unsigned short swap_short(unsigned short val);
|
||||
extern unsigned long swap_long(unsigned long val);
|
||||
|
||||
#define le16_to_cpu cpu_to_le16
|
||||
#define le32_to_cpu cpu_to_le32
|
||||
#define cpu_to_be32(a) a
|
||||
|
||||
static inline unsigned short cpu_to_le16(unsigned short val)
|
||||
{
|
||||
return(swap_short(val));
|
||||
}
|
||||
static inline unsigned long cpu_to_le32(unsigned long val)
|
||||
{
|
||||
return(swap_long(val));
|
||||
}
|
||||
|
||||
static inline void le16_to_cpus(unsigned short *val)
|
||||
{
|
||||
*val = le16_to_cpu(*val);
|
||||
}
|
||||
static inline void le32_to_cpus(unsigned long *val)
|
||||
{
|
||||
*val = le32_to_cpu(*val);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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_ */
|
||||
251
include/usb_defs.h
Normal file
251
include/usb_defs.h
Normal 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_ */
|
||||
65
include/wait.h
Normal file
65
include/wait.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* wait.h
|
||||
*
|
||||
* Author: mfro
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WAIT_H_
|
||||
#define _WAIT_H_
|
||||
|
||||
#include <bas_types.h>
|
||||
#include <stdint.h>
|
||||
#include "MCF5475.h"
|
||||
|
||||
typedef bool (*checker_func)(void);
|
||||
|
||||
extern __inline__ void wait(uint32_t) __attribute__((always_inline));
|
||||
extern __inline__ bool waitfor(uint32_t us, checker_func condition) __attribute__((always_inline));
|
||||
/*
|
||||
* wait for the specified number of us on slice timer 0. Replaces the original routines that had
|
||||
* the number of useconds to wait for hardcoded in their name.
|
||||
*/
|
||||
extern __inline__ void wait(uint32_t us)
|
||||
{
|
||||
uint32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
||||
|
||||
while (MCF_SLT_SCNT(0) > target);
|
||||
}
|
||||
|
||||
/*
|
||||
* the same as above, with a checker function which gets called while
|
||||
* busy waiting and allows for an early return if it returns true
|
||||
*/
|
||||
extern __inline__ bool waitfor(uint32_t us, checker_func condition)
|
||||
{
|
||||
uint32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
||||
uint32_t res;
|
||||
|
||||
do
|
||||
{
|
||||
if ((res = (*condition)()))
|
||||
return res;
|
||||
} while (MCF_SLT_SCNT(0) > target);
|
||||
return false;
|
||||
}
|
||||
#endif /* _WAIT_H_ */
|
||||
137
include/xhdi_sd.h
Normal file
137
include/xhdi_sd.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* xhdi_sd.h
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Created on: 01.05.2013
|
||||
* Copyright 2012 M. Fröschle
|
||||
*/
|
||||
#ifndef _XHDI_SD_H_
|
||||
#define _XHDI_SD_H_
|
||||
|
||||
/* XHDI function numbers */
|
||||
|
||||
#define XHDI_VERSION 0
|
||||
#define XHDI_INQUIRE_TARGET 1
|
||||
#define XHDI_RESERVE 2
|
||||
#define XHDI_LOCK 3
|
||||
#define XHDI_STOP 4
|
||||
#define XHDI_EJECT 5
|
||||
#define XHDI_DRIVEMAP 6
|
||||
#define XHDI_INQUIRE_DEVICE 7
|
||||
#define XHDI_INQUIRE_DRIVER 8
|
||||
#define XHDI_NEW_COOKIE 9
|
||||
#define XHDI_READ_WRITE 10
|
||||
#define XHDI_INQUIRE_TARGET2 11
|
||||
#define XHDI_INQUIRE_DEVICE2 12
|
||||
#define XHDI_DRIVER_SPECIAL 13
|
||||
#define XHDI_GET_CAPACITY 14
|
||||
#define XHDI_MEDIUM_CHANGED 15
|
||||
#define XHDI_MINT_INFO 16
|
||||
#define XHDI_DOS_LIMITS 17
|
||||
#define XHDI_LAST_ACCESS 18
|
||||
#define XHDI_REACCESS 19
|
||||
|
||||
/* XHDI error codes */
|
||||
|
||||
#define E_OK 0 /* OK */
|
||||
#define ERROR -1 /* unspecified error */
|
||||
#define EDRVNR -2 /* drive not ready */
|
||||
#define EUNDEV -15 /* invalid device/target number */
|
||||
#define EINVFN -32 /* invalid function number */
|
||||
#define EACCDN -36 /* access denied (device currently reserved) */
|
||||
#define EDRIVE -46 /* BIOS device not served by driver */
|
||||
|
||||
/* XHDI device capabilities */
|
||||
|
||||
#define XH_TARGET_STOPPABLE (1 << 0)
|
||||
#define XH_TARGET_REMOVABLE (1 << 1)
|
||||
#define XH_TARGET_LOCKABLE (1 << 2)
|
||||
#define XH_TARGET_EJECTABLE (1 << 3)
|
||||
#define XH_TARGET_LOCKED (1 << 29)
|
||||
#define XH_TARGET_STOPPED (1 << 30)
|
||||
#define XH_TARGET_RESERVED (1 << 31)
|
||||
|
||||
typedef struct _BPB
|
||||
{
|
||||
uint16_t recsiz; /* Bytes per sector */
|
||||
uint16_t clsiz; /* Sectors per cluster */
|
||||
uint16_t clsizb; /* Bytes per cluster */
|
||||
uint16_t rdlen; /* Directory length */
|
||||
uint16_t fsiz; /* Length of the FAT */
|
||||
uint16_t fatrec; /* Start of the 2nd FAT */
|
||||
uint16_t datrec; /* 1st free sector */
|
||||
uint16_t numcl; /* Total numbr of clusters */
|
||||
uint16_t bflags; /* Flags as bit-vector */
|
||||
/* Bit 0: 0 (12-Bit-FAT), 1 16-Bit-FAT */
|
||||
/* Bit 1: 0 (two FATs), 1 (one FAT) */
|
||||
/* only available since TOS 2.06 */
|
||||
} BPB;
|
||||
|
||||
/* a riddle: how do you typedef a function pointer to a function that returns its own type? ;) */
|
||||
typedef void* (*xhdi_call_fun)(int xhdi_fun, ...);
|
||||
|
||||
extern unsigned long xhdi_call(uint16_t *stack);
|
||||
|
||||
extern xhdi_call_fun xhdi_sd_install(xhdi_call_fun old_vector) __attribute__((__interrupt__));
|
||||
|
||||
extern uint16_t xhdi_version(void); /* XHDI 0 */
|
||||
|
||||
extern uint32_t xhdi_inquire_target(uint16_t major, uint16_t minor, uint32_t *block_size, uint32_t *flags,
|
||||
char *product_name); /* XHDI 1 */
|
||||
|
||||
extern uint32_t xhdi_reserve(uint16_t major, uint16_t minor, uint16_t do_reserve, uint16_t key); /* XHDI 2 */
|
||||
|
||||
extern uint32_t xhdi_lock(uint16_t major, uint16_t minor, uint16_t do_lock, uint16_t key); /* XHDI 3 */
|
||||
|
||||
extern uint32_t xhdi_stop(uint16_t major, uint16_t minor, uint16_t do_stop, uint16_t key); /* XHDI 4 */
|
||||
|
||||
extern uint32_t xhdi_eject(uint16_t major, uint16_t minor, uint16_t do_eject, uint16_t key); /* XHDI 5 */
|
||||
|
||||
extern uint32_t xhdi_drivemap(void); /* XHDI 6 */
|
||||
|
||||
extern uint32_t xhdi_inquire_device(uint16_t bios_device, uint16_t *major, uint16_t *minor,
|
||||
uint32_t *start_sector, /* BPB */ void *bpb); /* XHDI 7 */
|
||||
|
||||
extern uint32_t xhdi_inquire_driver(uint16_t bios_device, char *name, char *version,
|
||||
char *company, uint16_t *ahdi_version, uint16_t *maxIPL); /* XHDI 8 */
|
||||
|
||||
extern uint32_t xhdi_new_cookie(uint32_t newcookie); /* XHDI 9 */
|
||||
|
||||
extern uint32_t xhdi_read_write(uint16_t major, uint16_t minor, uint16_t rwflag,
|
||||
uint32_t recno, uint16_t count, void *buf); /* XHDI 10 */
|
||||
|
||||
extern uint32_t xhdi_inquire_target2(uint16_t major, uint16_t minor, uint32_t *block_size,
|
||||
uint32_t *device_flags, char *product_name, uint16_t stringlen); /* XHDI 11 */
|
||||
|
||||
extern uint32_t xhdi_inquire_device2(uint16_t bios_device, uint16_t *major, uint16_t *minor,
|
||||
uint32_t *start_sector, BPB *bpb, uint32_t *blocks, char *partid); /* XHDI 12 */
|
||||
|
||||
extern uint32_t xhdi_driver_special(uint32_t key1, uint32_t key2, uint16_t subopcode, void *data); /* XHDI 13 */
|
||||
|
||||
extern uint32_t xhdi_get_capacity(uint16_t major, uint16_t minor, uint32_t *blocks, uint32_t *bs); /* XHDI 14 */
|
||||
|
||||
extern uint32_t xhdi_medium_changed(uint16_t major, uint16_t minor); /* XHDI 15 */
|
||||
|
||||
extern uint32_t xhdi_mint_info(uint16_t opcode, void *data); /* XHDI 16 */
|
||||
|
||||
extern uint32_t xhdi_dos_limits(uint16_t which, uint32_t limit); /* XHDI 17 */
|
||||
|
||||
extern uint32_t xhdi_last_access(uint16_t major, uint16_t minor, uint32_t *ms); /* XHDI 18 */
|
||||
|
||||
extern uint32_t xhdi_reaccess(uint16_t major, uint16_t minor); /* XHDI 19 */
|
||||
|
||||
#endif /* _XHDI_SD_H_ */
|
||||
12
mcf5474.gdb
12
mcf5474.gdb
@@ -4,11 +4,14 @@
|
||||
|
||||
define addresses
|
||||
set $vbr = 0x00000000
|
||||
monitor bdm-ctl-set 0x0801 0x00000000
|
||||
monitor bdm-ctl-set 0x0801 0x00000000
|
||||
|
||||
set $mbar = 0xFF000000
|
||||
monitor bdm-ctl-set 0x0C0F 0xFF000000
|
||||
|
||||
set $rambar0 = 0xFF100000
|
||||
monitor bdm-ctl-set 0x0C04 0xFF100007
|
||||
|
||||
set $rambar1 = 0xFF101000
|
||||
monitor bdm-ctl-set 0x0C05 0xFF101001
|
||||
end
|
||||
@@ -54,7 +57,10 @@ end
|
||||
#
|
||||
|
||||
define ib
|
||||
addresses
|
||||
setup-dram
|
||||
addresses
|
||||
setup-dram
|
||||
end
|
||||
|
||||
tr
|
||||
ib
|
||||
load
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/usr/local/bin/bdmctrl
|
||||
#!/usr/local/bin/bdmctrl -D2
|
||||
#
|
||||
# firebee board initialization for bdmctrl
|
||||
#
|
||||
open $1
|
||||
reset
|
||||
sleep 10
|
||||
|
||||
wait
|
||||
|
||||
@@ -28,21 +29,21 @@ write 0xFF000500 0xE0000000 4
|
||||
write 0xFF000508 0x00001180 4
|
||||
write 0xFF000504 0x007F0001 4
|
||||
# Init CS1 (Atari I/O address range)
|
||||
#write 0xFF00050C 0xFFF00000 4
|
||||
#write 0xFF000514 0x00002180 4
|
||||
#write 0xFF000510 0x000F0001 4
|
||||
write 0xFF00050C 0xFFF00000 4
|
||||
write 0xFF000514 0x00002180 4
|
||||
write 0xFF000510 0x000F0001 4
|
||||
# Init CS2 (FireBee 32 bit I/O address range)
|
||||
#write 0xFF000518 0xF0000000 4
|
||||
#write 0xFF000520 0x00002100 4
|
||||
#write 0xFF00051C 0x07FF0001 4
|
||||
write 0xFF000518 0xF0000000 4
|
||||
write 0xFF000520 0x00002100 4
|
||||
write 0xFF00051C 0x07FF0001 4
|
||||
# Init CS3 (FireBee 16 bit I/O address range)
|
||||
#write 0xFF000524 0xF8000000 4
|
||||
#write 0xFF00052C 0x00000180 4
|
||||
#write 0xFF000528 0x03FF0001 4
|
||||
write 0xFF000524 0xF8000000 4
|
||||
write 0xFF00052C 0x00000180 4
|
||||
write 0xFF000528 0x03FF0001 4
|
||||
# Init CS4 (FireBee video address range)
|
||||
#write 0xFF000530 0x40000000 4
|
||||
#write 0xFF000538 0x00000018 4
|
||||
#write 0xFF000534 0x003F0001 4
|
||||
write 0xFF000530 0x40000000 4
|
||||
write 0xFF000538 0x00000018 4
|
||||
write 0xFF000534 0x003F0001 4
|
||||
|
||||
|
||||
# SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes
|
||||
@@ -65,11 +66,7 @@ write 0xFF000104 0x710D0F00 4 # SDCR (lock SDMR and enable refresh)
|
||||
|
||||
write 0xFF000240 0x80000000 4 # disable watchdog arbiter
|
||||
|
||||
# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29
|
||||
flash 0xE0000000 flash29
|
||||
# do not flash yet. First check if board can be initialized correctly
|
||||
|
||||
load -v ram.elf
|
||||
wait
|
||||
sleep 1000
|
||||
sleep 100
|
||||
execute
|
||||
155
sources/BaS.c
155
sources/BaS.c
@@ -1,24 +1,45 @@
|
||||
/*
|
||||
* BaS
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "MCF5475.h"
|
||||
#include "MCF5475_SLT.h"
|
||||
#include "startcf.h"
|
||||
#include "cache.h"
|
||||
#include "bas_printf.h"
|
||||
|
||||
#include "bas_types.h"
|
||||
#include "sd_card.h"
|
||||
#include "wait.h"
|
||||
|
||||
#include "diskio.h"
|
||||
#include "ff.h"
|
||||
#include "s19reader.h"
|
||||
|
||||
/* imported routines */
|
||||
extern int mmu_init();
|
||||
extern int vec_init();
|
||||
extern int illegal_table_make();
|
||||
extern void sd_card_idle();
|
||||
extern int sd_card_init();
|
||||
|
||||
/* wait...() routines moved to sysinit.c */
|
||||
extern void wait(uint32_t us);
|
||||
|
||||
/* Symbols from the linker script */
|
||||
extern uint8_t _STRAM_END[];
|
||||
@@ -32,29 +53,49 @@ extern uint8_t _EMUTOS[];
|
||||
extern uint8_t _EMUTOS_SIZE[];
|
||||
#define EMUTOS_SIZE ((uint32_t)_EMUTOS_SIZE) /* size of EmuTOS, in bytes */
|
||||
|
||||
/*
|
||||
* check if it is possible to transfer data to PIC
|
||||
*/
|
||||
static inline bool pic_txready(void)
|
||||
{
|
||||
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* check if it is possible to receive data from PIC
|
||||
*/
|
||||
static inline bool pic_rxready(void)
|
||||
{
|
||||
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void write_pic_byte(uint8_t value)
|
||||
{
|
||||
/* Wait until the tramsmitter is ready */
|
||||
while (!(MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY));
|
||||
/* Wait until the transmitter is ready or 1000us are passed */
|
||||
waitfor(1000, pic_txready);
|
||||
|
||||
/* Transmit the byte */
|
||||
//MCF_PSC3_PSCTB_8BIT = value; // This define is actually 32-bit
|
||||
*(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT) = value; // Really 8-bit
|
||||
}
|
||||
|
||||
uint8_t read_pic_byte(void)
|
||||
{
|
||||
/* Wait until a byte has been received */
|
||||
while (!(MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY));
|
||||
/* Wait until a byte has been received or 1000us are passed */
|
||||
waitfor(1000, pic_rxready);
|
||||
|
||||
/* Return the received byte */
|
||||
//return MCF_PSC3_PSCRB_8BIT; // This define is actually 32-bit
|
||||
return *(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT); // Really 8-bit
|
||||
}
|
||||
|
||||
void pic_init(void)
|
||||
{
|
||||
char answer[4];
|
||||
char answer[4] = "OLD";
|
||||
|
||||
xprintf("initialize the PIC: ");
|
||||
|
||||
@@ -70,7 +111,14 @@ void pic_init(void)
|
||||
answer[2] = read_pic_byte();
|
||||
answer[3] = '\0';
|
||||
|
||||
xprintf("%s\r\n", answer);
|
||||
if (answer[0] != 'O' || answer[1] != 'K' || answer[2] != '!')
|
||||
{
|
||||
xprintf("PIC initialization failed. Already initialized?\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("%s\r\n", answer);
|
||||
}
|
||||
}
|
||||
|
||||
void nvram_init(void)
|
||||
@@ -101,22 +149,37 @@ void nvram_init(void)
|
||||
xprintf("finished\r\n");
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
void enable_coldfire_interrupts()
|
||||
{
|
||||
xprintf("enable interrupts: ");
|
||||
* (volatile uint32_t *) 0xf0010004 = 0L; /* disable all interrupts */
|
||||
MCF_EPORT_EPPAR = 0xaaa8; /* all interrupts on falling edge */
|
||||
|
||||
MCF_GPT0_GMS = MCF_GPT_GMS_ICT(1) | /* timer 0 on, video change capture on rising edge */
|
||||
MCF_GPT_GMS_IEN |
|
||||
MCF_GPT_GMS_TMS(1);
|
||||
MCF_INTC_ICR62 = 0x3f;
|
||||
|
||||
* (volatile uint8_t *) 0xf0010004 = 0xfe; /* enable int 1-7 */
|
||||
MCF_EPORT_EPIER = 0xfe; /* int 1-7 on */
|
||||
MCF_EPORT_EPFR = 0xff; /* clear all pending interrupts */
|
||||
MCF_INTC_IMRL = 0xffffff00; /* int 1-7 on */
|
||||
MCF_INTC_IMRH = 0xbffffffe; /* psc3 and timer 0 int on */
|
||||
|
||||
xprintf("finished\r\n");
|
||||
}
|
||||
|
||||
void disable_coldfire_interrupts()
|
||||
{
|
||||
* (volatile uint32_t *) 0xf0010004 = 0L; /* disable all interrupts */
|
||||
}
|
||||
|
||||
void BaS(void)
|
||||
{
|
||||
int az_sectors;
|
||||
uint8_t *src;
|
||||
uint8_t *dst = (uint8_t *)TOS;
|
||||
uint32_t *adr;
|
||||
|
||||
|
||||
az_sectors = sd_card_init();
|
||||
|
||||
if (az_sectors > 0)
|
||||
{
|
||||
//sd_card_idle();
|
||||
}
|
||||
|
||||
pic_init();
|
||||
nvram_init();
|
||||
|
||||
@@ -140,28 +203,9 @@ void BaS(void)
|
||||
|
||||
xprintf("initialize exception vector table: ");
|
||||
vec_init();
|
||||
illegal_table_make();
|
||||
xprintf("finished\r\n");
|
||||
|
||||
/* interrupts */
|
||||
|
||||
xprintf("enable interrupts: ");
|
||||
* (volatile uint32_t *) 0xf0010004 = 0L; /* disable all interrupts */
|
||||
MCF_EPORT_EPPAR = 0xaaa8; /* all interrupts on falling edge */
|
||||
|
||||
MCF_GPT0_GMS = MCF_GPT_GMS_ICT(1) | /* timer 0 on, video change capture on rising edge */
|
||||
MCF_GPT_GMS_IEN |
|
||||
MCF_GPT_GMS_TMS(1);
|
||||
MCF_INTC_ICR62 = 0x3f;
|
||||
|
||||
* (volatile uint8_t *) 0xf0010004 = 0xfe; /* enable int 1-7 */
|
||||
MCF_EPORT_EPIER = 0xfe; /* int 1-7 on */
|
||||
MCF_EPORT_EPFR = 0xff; /* clear all pending interrupts */
|
||||
MCF_INTC_IMRL = 0xffffff00; /* int 1-7 on */
|
||||
MCF_INTC_IMRH = 0xbffffffe; /* psc3 and timer 0 int on */
|
||||
|
||||
MCF_MMU_MMUCR = MCF_MMU_MMUCR_EN; /* MMU on */
|
||||
xprintf("finished\r\n");
|
||||
|
||||
xprintf("IDE reset: ");
|
||||
/* IDE reset */
|
||||
@@ -172,7 +216,6 @@ void BaS(void)
|
||||
* (volatile uint8_t *) (0xffff8802 - 0) = 0;
|
||||
|
||||
xprintf("finished\r\n");
|
||||
|
||||
xprintf("enable video: ");
|
||||
/*
|
||||
* video setup (25MHz)
|
||||
@@ -195,6 +238,7 @@ void BaS(void)
|
||||
|
||||
xprintf("finished\r\n");
|
||||
|
||||
sd_card_init();
|
||||
|
||||
/*
|
||||
* memory setup
|
||||
@@ -220,18 +264,24 @@ void BaS(void)
|
||||
* (uint32_t *) 0x5a4 = FASTRAM_END; /* ramtop TOS system variable */
|
||||
* (uint32_t *) 0x5a8 = 0x1357bd13; /* ramvalid TOS system variable */
|
||||
|
||||
#define NOP() __asm__ __volatile__("nop\n\t" : : : "memory")
|
||||
|
||||
xprintf("init ACIA: ");
|
||||
/* init ACIA */
|
||||
* (uint8_t *) 0xfffffc00 = 3;
|
||||
__asm__ __volatile__("nop \n\t" : : : "memory");
|
||||
NOP();
|
||||
|
||||
* (uint8_t *) 0xfffffc04 = 3;
|
||||
__asm__ __volatile__("nop \n\t" : : : "memory");
|
||||
NOP();
|
||||
|
||||
* (uint8_t *) 0xfffffc00 = 0x96;
|
||||
__asm__ __volatile__("nop \n\t" : : : "memory");
|
||||
NOP();
|
||||
|
||||
* (uint8_t *) 0xfffffa0f = -1;
|
||||
__asm__ __volatile__("nop \n\t" : : : "memory");
|
||||
NOP();
|
||||
|
||||
* (uint8_t *) 0xfffffa11 = -1;
|
||||
__asm__ __volatile__("nop \n\t" : : : "memory");
|
||||
NOP();
|
||||
|
||||
xprintf("finished\r\n");
|
||||
|
||||
@@ -242,6 +292,8 @@ void BaS(void)
|
||||
__asm__ __volatile__("move.w #0x0700,sr \n\t" : : : "memory");
|
||||
}
|
||||
|
||||
srec_execute("BASFLASH.S19");
|
||||
|
||||
/* Jump into the OS */
|
||||
typedef void void_func(void);
|
||||
typedef struct {
|
||||
@@ -249,7 +301,8 @@ void BaS(void)
|
||||
void_func *initial_pc;
|
||||
} ROM_HEADER;
|
||||
|
||||
xprintf("Call OS. BaS finished...\r\n");
|
||||
xprintf("Call OS. BaS initialization finished...\r\n");
|
||||
enable_coldfire_interrupts();
|
||||
|
||||
ROM_HEADER* os_header = (ROM_HEADER*)TOS;
|
||||
os_header->initial_pc();
|
||||
|
||||
@@ -32,8 +32,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "MCF5475.h"
|
||||
#include <bas_printf.h>
|
||||
#include "bas_printf.h"
|
||||
#include "bas_string.h"
|
||||
|
||||
/*
|
||||
* Lexical definitions.
|
||||
*
|
||||
@@ -54,7 +57,6 @@
|
||||
|
||||
#define INF 32766 /* should be bigger than any field to print */
|
||||
|
||||
static char buf[128];
|
||||
static char snil[] = "(nil)";
|
||||
|
||||
static void xputchar(int c)
|
||||
@@ -70,37 +72,9 @@ static void xputchar(int c)
|
||||
);
|
||||
}
|
||||
|
||||
#define isdigit(c) (((c) >= '0') && ((c) <= '9'))
|
||||
#define isupper(c) ((c) >= 'A' && ((c) <= 'Z'))
|
||||
#define islower(c) ((c) >= 'a' && ((c) <= 'z'))
|
||||
#define isalpha(c) (isupper((c)) || islower(c))
|
||||
#define tolower(c) (isupper(c) ? ((c) + 'a' - 'A') : (c))
|
||||
|
||||
static int atoi(const char *c)
|
||||
{
|
||||
int value = 0;
|
||||
while (isdigit(*c))
|
||||
{
|
||||
value *= 10;
|
||||
value += (int) (*c - '0');
|
||||
c++;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
size_t strlen(const char *s)
|
||||
{
|
||||
int length = 0;
|
||||
|
||||
while (*s++)
|
||||
{
|
||||
length++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
static void doprnt(void (*addchar)(int), const char *sfmt, va_list ap)
|
||||
{
|
||||
char buf[128]; /* FIXME: this gets allocated in BSS which is not reachable in -mpcrel code */
|
||||
char *bp;
|
||||
const char *f;
|
||||
long l;
|
||||
@@ -385,6 +359,7 @@ void display_progress()
|
||||
{
|
||||
static int _progress_index;
|
||||
char progress_char[] = "|/-\\";
|
||||
|
||||
xputchar(progress_char[_progress_index++ % strlen(progress_char)]);
|
||||
xputchar('\r');
|
||||
}
|
||||
|
||||
81
sources/bas_string.c
Normal file
81
sources/bas_string.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* bas_string.c
|
||||
*
|
||||
* Created on: 26.02.2013
|
||||
* Author: mfro
|
||||
*/
|
||||
|
||||
#include "bas_string.h"
|
||||
|
||||
int strncmp(const char *s1, const char *s2, int max)
|
||||
{
|
||||
int i;
|
||||
int cmp;
|
||||
|
||||
for (i = 0; i < max && *s1++ && *s2++; i++);
|
||||
{
|
||||
cmp = (*s1 - *s2);
|
||||
if (cmp != 0) return cmp;
|
||||
}
|
||||
return cmp;
|
||||
}
|
||||
|
||||
char *strcpy(char *dst, const char *src)
|
||||
{
|
||||
char *ptr = dst;
|
||||
|
||||
while ((*dst++ = *src++) != '\0');
|
||||
return ptr;
|
||||
}
|
||||
|
||||
char *strncpy(char *dst, const char *src, int max)
|
||||
{
|
||||
char *ptr = dst;
|
||||
|
||||
while ((*dst++ = *src++) != '\0' && max-- >= 0);
|
||||
return ptr;
|
||||
}
|
||||
int atoi(const char *c)
|
||||
{
|
||||
int value = 0;
|
||||
while (isdigit(*c))
|
||||
{
|
||||
value *= 10;
|
||||
value += (int) (*c - '0');
|
||||
c++;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
size_t strlen(const char *s)
|
||||
{
|
||||
const char *start = s;
|
||||
|
||||
while (*s++);
|
||||
|
||||
return s - start - 1;
|
||||
}
|
||||
|
||||
|
||||
char *strcat(char *dst, const char *src)
|
||||
{
|
||||
char *ret = dst;
|
||||
dst = &dst[strlen(dst)];
|
||||
while ((*dst++ = *src++) != '\0');
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *strncat(char *dst, const char *src, int max)
|
||||
{
|
||||
int i;
|
||||
char *ret = dst;
|
||||
|
||||
dst = &dst[strlen(dst)];
|
||||
for (i = 0; i < max && *src; i++)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst++ = '\0';
|
||||
|
||||
return ret;
|
||||
}
|
||||
420
sources/basflash.c
Normal file
420
sources/basflash.c
Normal file
@@ -0,0 +1,420 @@
|
||||
/*
|
||||
* basflash.c
|
||||
*
|
||||
* Created on: 18.12.2012
|
||||
* Author: mfro
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "bas_string.h"
|
||||
#include "bas_printf.h"
|
||||
#include "diskio.h"
|
||||
#include "ff.h"
|
||||
#include "s19reader.h"
|
||||
|
||||
|
||||
|
||||
static uint32_t mx29lv640d_flash_sectors[] =
|
||||
{
|
||||
0xe0000000, 0xe0002000, 0xe0004000, 0xe0006000, 0xe0008000, 0xe000a000, 0xe000c000, 0xe000e000,
|
||||
0xe0010000, 0xe0020000, 0xe0030000, 0xe0040000, 0xe0050000, 0xe0060000, 0xe0070000, 0xe0080000,
|
||||
0xe0090000, 0xe00a0000, 0xe00b0000, 0xe00c0000, 0xe00d0000, 0xe00e0000, 0xe00f0000, 0xe0100000,
|
||||
0xe0110000, 0xe0120000, 0xe0130000, 0xe0140000, 0xe0150000, 0xe0160000, 0xe0170000, 0xe0180000,
|
||||
0xe0190000, 0xe01a0000, 0xe01b0000, 0xe01c0000, 0xe01d0000, 0xe01e0000, 0xe01f0000, 0xe0200000,
|
||||
0xe0210000, 0xe0220000, 0xe0230000, 0xe0240000, 0xe0250000, 0xe0260000, 0xe0270000, 0xe0280000,
|
||||
0xe0290000, 0xe02a0000, 0xe02b0000, 0xe02c0000, 0xe02d0000, 0xe02e0000, 0xe02f0000, 0xe0300000,
|
||||
0xe0310000, 0xe0320000, 0xe0330000, 0xe0340000, 0xe0350000, 0xe0360000, 0xe0370000, 0xe0380000,
|
||||
0xe0390000, 0xe03a0000, 0xe03b0000, 0xe03c0000, 0xe03d0000, 0xe03e0000, 0xe03f0000, 0xe0400000,
|
||||
0xe0410000, 0xe0420000, 0xe0430000, 0xe0440000, 0xe0450000, 0xe0460000, 0xe0470000, 0xe0480000,
|
||||
0xe0490000, 0xe04a0000, 0xe04b0000, 0xe04c0000, 0xe04d0000, 0xe04e0000, 0xe04f0000, 0xe0500000,
|
||||
0xe0510000, 0xe0520000, 0xe0530000, 0xe0540000, 0xe0550000, 0xe0560000, 0xe0570000, 0xe0580000,
|
||||
0xe0590000, 0xe05a0000, 0xe05b0000, 0xe05c0000, 0xe05d0000, 0xe05e0000, 0xe05f0000, 0xe0600000,
|
||||
0xe0610000, 0xe0620000, 0xe0630000, 0xe0640000, 0xe0650000, 0xe0660000, 0xe0670000, 0xe0680000,
|
||||
0xe0690000, 0xe06a0000, 0xe06b0000, 0xe06c0000, 0xe06d0000, 0xe06e0000, 0xe06f0000, 0xe0700000,
|
||||
0xe0710000, 0xe0720000, 0xe0730000, 0xe0740000, 0xe0750000, 0xe0760000, 0xe0770000, 0xe0780000,
|
||||
0xe0790000, 0xe07a0000, 0xe07b0000, 0xe07c0000, 0xe07d0000, 0xe07e0000, 0xe07f0000, 0xe0800000
|
||||
};
|
||||
static const int num_flash_sectors = sizeof(mx29lv640d_flash_sectors) / sizeof(uint32_t);
|
||||
|
||||
typedef struct romram
|
||||
{
|
||||
uint32_t flash_address;
|
||||
uint32_t ram_address;
|
||||
char *name;
|
||||
} ROMRAM;
|
||||
|
||||
static const struct romram flash_areas[] =
|
||||
{
|
||||
{ 0xe0600000, 0x00e00000, "EmuTOS" }, /* EmuTOS */
|
||||
{ 0xe0400000, 0x00e00000, "FireTOS" }, /* FireTOS */
|
||||
{ 0xe0700000, 0x00e00000, "FPGA" }, /* FPGA config */
|
||||
};
|
||||
static const int num_flash_areas = sizeof(flash_areas) / sizeof(struct romram);
|
||||
|
||||
#define FLASH_ADDRESS 0xe0000000
|
||||
static volatile uint16_t *flash_unlock1 = (volatile uint16_t *) FLASH_ADDRESS + 0xaaa;
|
||||
static volatile uint16_t *flash_unlock2 = (volatile uint16_t *) FLASH_ADDRESS + 0x554;
|
||||
static const uint16_t cmd_unlock1 = 0xaa;
|
||||
static const uint16_t cmd_unlock2 = 0x55;
|
||||
static const uint16_t cmd_sector_erase1 = 0x80;
|
||||
static const uint16_t cmd_sector_erase2 = 0x30;
|
||||
static const uint16_t cmd_sector_erase_suspend = 0xb0;
|
||||
static const uint16_t cmd_sector_erase_resume = 0x30;
|
||||
static const uint16_t cmd_program = 0xa0;
|
||||
static const uint16_t cmd_autoselect = 0x90;
|
||||
static const uint16_t cmd_read = 0xf0;
|
||||
|
||||
/*
|
||||
* this callback just does nothing besides returning OK. Meant to do a dry run over the file to check its integrity
|
||||
*/
|
||||
static err_t simulate()
|
||||
{
|
||||
err_t ret = OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static err_t memcpy(uint8_t *dst, uint8_t *src, uint32_t length)
|
||||
{
|
||||
uint8_t *end = src + length;
|
||||
|
||||
do
|
||||
{
|
||||
*dst++ = *src++;
|
||||
} while (src < end);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static err_t flash(uint8_t *dst, uint8_t *src, uint32_t length)
|
||||
{
|
||||
err_t ret = OK;
|
||||
|
||||
/* TODO: do the actual flash */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* this callback verifies the data against the S-record file contents after a write to destination
|
||||
*/
|
||||
static err_t verify(uint8_t *dst, uint8_t *src, uint32_t length)
|
||||
{
|
||||
uint8_t *end = src + length;
|
||||
|
||||
do
|
||||
{
|
||||
if (*src++ != *dst++)
|
||||
return FAIL;
|
||||
} while (src < end);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* unlock a flash sector
|
||||
*/
|
||||
|
||||
err_t unlock_flash_sector(int sector_num)
|
||||
{
|
||||
volatile uint32_t rd;
|
||||
uint32_t size = (sector_num < num_flash_sectors ?
|
||||
mx29lv640d_flash_sectors[sector_num + 1] - mx29lv640d_flash_sectors[sector_num] :
|
||||
0);
|
||||
|
||||
*flash_unlock1 = cmd_unlock1;
|
||||
*flash_unlock2 = cmd_unlock2;
|
||||
*flash_unlock1 = cmd_autoselect;
|
||||
rd = * (volatile uint32_t *) FLASH_ADDRESS;
|
||||
* (volatile uint32_t *) FLASH_ADDRESS = size;
|
||||
(void) rd; /* get rid of "unused variable" compiler warning */
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* erase a flash sector
|
||||
*
|
||||
* sector_num is the index into the sector table above.
|
||||
*
|
||||
* FIXME: need to disable data cache to ensure proper operation
|
||||
*/
|
||||
err_t erase_flash_sector(int sector_num)
|
||||
{
|
||||
volatile uint32_t rd;
|
||||
uint32_t size = (sector_num < num_flash_sectors ?
|
||||
mx29lv640d_flash_sectors[sector_num + 1] - mx29lv640d_flash_sectors[sector_num] :
|
||||
0);
|
||||
|
||||
if (unlock_flash_sector(sector_num) == OK)
|
||||
{
|
||||
*flash_unlock1 = cmd_unlock1;
|
||||
*flash_unlock2 = cmd_unlock2;
|
||||
*flash_unlock1 = cmd_sector_erase1;
|
||||
*flash_unlock1 = cmd_unlock1;
|
||||
*flash_unlock2 = cmd_unlock2;
|
||||
*flash_unlock1 = cmd_sector_erase1;
|
||||
rd = * (volatile uint32_t *) FLASH_ADDRESS;
|
||||
* (volatile uint32_t *) FLASH_ADDRESS = size;
|
||||
(void) rd; /* get rid of "unused variable" compiler warning */
|
||||
return OK;
|
||||
}
|
||||
return ILLEGAL_SECTOR;
|
||||
}
|
||||
|
||||
err_t erase_flash_region(void *start_address, uint32_t length)
|
||||
{
|
||||
err_t err;
|
||||
int sector = -1;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* determine first sector to erase
|
||||
*
|
||||
* FIXME: if the start address of the .s19 file does not fall on a sector boundary, we
|
||||
* will probably erase vital code in the previous flash sector. This should not happen on the Firebee
|
||||
* where we have fixed areas for the different flash codes, but we should probably take care anyway
|
||||
*/
|
||||
for (i = 0; i < num_flash_sectors; i++)
|
||||
{
|
||||
if (start_address >= (void *) mx29lv640d_flash_sectors[i] && start_address <= (void *) mx29lv640d_flash_sectors[i])
|
||||
sector = i;
|
||||
}
|
||||
|
||||
if (sector >= 0 && sector <= num_flash_sectors)
|
||||
{
|
||||
/*
|
||||
* erase sectors until free space equals length
|
||||
*
|
||||
* FIXME: same as above. Currently, there is no prevention against overlapping flash areas.
|
||||
*/
|
||||
do {
|
||||
err = erase_flash_sector(sector);
|
||||
sector++;
|
||||
} while ((uint8_t *) mx29lv640d_flash_sectors[sector] < (uint8_t *) start_address + length && ! err);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = ILLEGAL_SECTOR;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
void srec_flash(char *flash_filename)
|
||||
{
|
||||
DRESULT res;
|
||||
FRESULT fres;
|
||||
FATFS fs;
|
||||
FIL file;
|
||||
err_t err;
|
||||
void *start_address;
|
||||
uint32_t length;
|
||||
|
||||
res = disk_status(0);
|
||||
if (res == RES_OK)
|
||||
{
|
||||
fres = f_mount(0, &fs);
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
if ((fres = f_open(&file, flash_filename, FA_READ) != FR_OK))
|
||||
{
|
||||
xprintf("flasher file %s not present on disk\r\n", flash_filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
f_close(&file);
|
||||
|
||||
/* first pass: parse and check for inconsistencies */
|
||||
xprintf("check file integrity: ");
|
||||
err = read_srecords(flash_filename, &start_address, &length, simulate);
|
||||
if (err == OK)
|
||||
{
|
||||
xprintf("OK.\r\nerase flash area (from %p, length 0x%lx): ", start_address, length);
|
||||
err = erase_flash_region(start_address, length);
|
||||
|
||||
/* next pass: copy data to destination */
|
||||
xprintf("OK.\r\flash data: ");
|
||||
err = read_srecords(flash_filename, &start_address, &length, memcpy);
|
||||
if (err == OK)
|
||||
{
|
||||
/* next pass: verify data */
|
||||
xprintf("OK.\r\nverify data: ");
|
||||
err = read_srecords(flash_filename, &start_address, &length, verify);
|
||||
if (err == OK)
|
||||
{
|
||||
typedef void void_func(void);
|
||||
void_func *func;
|
||||
|
||||
xprintf("OK.\r\n");
|
||||
|
||||
xprintf("target successfully written and verified. Start address: %p\r\n", start_address);
|
||||
|
||||
func = (void_func *) start_address;
|
||||
(*func)();
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// xprintf("could not mount FAT FS\r\n");
|
||||
}
|
||||
f_mount(0, 0L);
|
||||
}
|
||||
else
|
||||
{
|
||||
// xprintf("could not initialize SD card\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
err_t srec_load(char *flash_filename)
|
||||
{
|
||||
FRESULT fres;
|
||||
FIL file;
|
||||
err_t err;
|
||||
void *start_address;
|
||||
uint32_t length;
|
||||
|
||||
if ((fres = f_open(&file, flash_filename, FA_READ) != FR_OK))
|
||||
{
|
||||
xprintf("flasher file %s not present on disk\r\n", flash_filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
f_close(&file);
|
||||
|
||||
/* first pass: parse and check for inconsistencies */
|
||||
xprintf("check file integrity: ");
|
||||
err = read_srecords(flash_filename, &start_address, &length, simulate);
|
||||
if (err == OK)
|
||||
{
|
||||
/* next pass: copy data to destination */
|
||||
xprintf("OK.\r\ncopy/flash data: ");
|
||||
err = read_srecords(flash_filename, &start_address, &length, memcpy);
|
||||
if (err == OK)
|
||||
{
|
||||
/* next pass: verify data */
|
||||
xprintf("OK.\r\nverify data: ");
|
||||
err = read_srecords(flash_filename, &start_address, &length, verify);
|
||||
if (err == OK)
|
||||
{
|
||||
typedef void void_func(void);
|
||||
void_func *func;
|
||||
|
||||
xprintf("OK.\r\n");
|
||||
xprintf("target successfully written and verified. Start address: %p\r\n", start_address);
|
||||
|
||||
func = (void_func *) start_address;
|
||||
(*func)();
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
void basflash(void)
|
||||
{
|
||||
const char *basflash_str = "\\BASFLASH";
|
||||
const char *bastest_str = "\\BASTEST";
|
||||
DRESULT res;
|
||||
FRESULT fres;
|
||||
FATFS fs;
|
||||
|
||||
xprintf("\r\nHello from BASFLASH.S19!\r\n\r\n");
|
||||
|
||||
/*
|
||||
* read \BASTEST\ folder contents (search for .S19-files). If found load them to their final destination
|
||||
* (after BaS has copied them, not their flash location) and return.
|
||||
*
|
||||
* Files located in the BASTEST-folder thus override those in flash. Useful for testing before flashing
|
||||
*/
|
||||
res = disk_status(0);
|
||||
xprintf("disk_status(0) = %d\r\n", res);
|
||||
if (res == RES_OK)
|
||||
{
|
||||
fres = f_mount(0, &fs);
|
||||
xprintf("f_mount() = %d\r\n", fres);
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
DIR directory;
|
||||
|
||||
fres = f_opendir(&directory, bastest_str);
|
||||
xprintf("f_opendir() = %d\r\n", fres);
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
FILINFO fileinfo;
|
||||
|
||||
fres = f_readdir(&directory, &fileinfo);
|
||||
xprintf("f_readdir() = %d\r\n", fres);
|
||||
while (fres == FR_OK)
|
||||
{
|
||||
const char *srec_ext = ".S19";
|
||||
char path[30];
|
||||
|
||||
if (fileinfo.fname[0] != '\0') /* found a file */
|
||||
{
|
||||
xprintf("check file %s (%s == %s ?)\r\n", fileinfo.fname, &fileinfo.fname[strlen(fileinfo.fname) - 4], srec_ext);
|
||||
if (strlen(fileinfo.fname) >= 4 && strncmp(&fileinfo.fname[strlen(fileinfo.fname) - 4], srec_ext, 4) == 0) /* we have a .S19 file */
|
||||
{
|
||||
/*
|
||||
* build path + filename
|
||||
*/
|
||||
strcpy(path, bastest_str);
|
||||
strcat(path, "\\");
|
||||
strncat(path, fileinfo.fname, 13);
|
||||
|
||||
xprintf("loading file %s\r\n", path);
|
||||
/*
|
||||
* load file
|
||||
*/
|
||||
if (srec_load(path) != OK)
|
||||
{
|
||||
xprintf("failed to load file %s\r\n", path);
|
||||
// error handling
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break; /* exit if no file found */
|
||||
fres = f_readdir(&directory, &fileinfo);
|
||||
xprintf("f_readdir() = %d\r\n", fres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("f_opendir %s failed with error code %d\r\n", bastest_str, fres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// xprintf("could not mount FAT FS\r\n");
|
||||
}
|
||||
f_mount(0, 0L); /* unmount SD card */
|
||||
}
|
||||
}
|
||||
26
sources/basflash_start.c
Normal file
26
sources/basflash_start.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* basflash_start.c
|
||||
*
|
||||
* Created on: 16.02.2013
|
||||
* Author: mfro
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static uint32_t ownstack[4096];
|
||||
static uint32_t *stackptr = &ownstack[4095];
|
||||
|
||||
/*
|
||||
* setup our own stack in SDRAM to prevent clashing BaS's in SRAM (size limited).
|
||||
*/
|
||||
void startup(void)
|
||||
{
|
||||
static uint32_t oldstack;
|
||||
|
||||
void basflash(void);
|
||||
__asm__ __volatile__("move.l sp,%0\n\t" : "=g"(oldstack) : :);
|
||||
__asm__ __volatile__("move.l %0,sp\n\t" : : "g"(stackptr) : );
|
||||
basflash();
|
||||
__asm__ __volatile__("move.l %0,sp\n\t" : : "g"(oldstack) : "sp");
|
||||
(void) stackptr; /* make compiler happy about unused variables */
|
||||
}
|
||||
@@ -1,6 +1,27 @@
|
||||
/*
|
||||
* cache handling
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cache.h"
|
||||
|
||||
void flush_and_invalidate_caches(void)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef _CACHE_H_
|
||||
#define _CACHE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern void flush_and_invalidate_caches(void);
|
||||
|
||||
#endif /* _CACHE_H_ */
|
||||
3798
sources/cc932.c
Normal file
3798
sources/cc932.c
Normal file
File diff suppressed because it is too large
Load Diff
10973
sources/cc936.c
Normal file
10973
sources/cc936.c
Normal file
File diff suppressed because it is too large
Load Diff
8603
sources/cc949.c
Normal file
8603
sources/cc949.c
Normal file
File diff suppressed because it is too large
Load Diff
6829
sources/cc950.c
Normal file
6829
sources/cc950.c
Normal file
File diff suppressed because it is too large
Load Diff
540
sources/ccsbcs.c
Normal file
540
sources/ccsbcs.c
Normal file
@@ -0,0 +1,540 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Unicode - Local code bidirectional converter (C)ChaN, 2009 */
|
||||
/* (SBCS code pages) */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* 437 U.S. (OEM)
|
||||
/ 720 Arabic (OEM)
|
||||
/ 1256 Arabic (Windows)
|
||||
/ 737 Greek (OEM)
|
||||
/ 1253 Greek (Windows)
|
||||
/ 1250 Central Europe (Windows)
|
||||
/ 775 Baltic (OEM)
|
||||
/ 1257 Baltic (Windows)
|
||||
/ 850 Multilingual Latin 1 (OEM)
|
||||
/ 852 Latin 2 (OEM)
|
||||
/ 1252 Latin 1 (Windows)
|
||||
/ 855 Cyrillic (OEM)
|
||||
/ 1251 Cyrillic (Windows)
|
||||
/ 866 Russian (OEM)
|
||||
/ 857 Turkish (OEM)
|
||||
/ 1254 Turkish (Windows)
|
||||
/ 858 Multilingual Latin 1 + Euro (OEM)
|
||||
/ 862 Hebrew (OEM)
|
||||
/ 1255 Hebrew (Windows)
|
||||
/ 874 Thai (OEM, Windows)
|
||||
/ 1258 Vietnam (OEM, Windows)
|
||||
*/
|
||||
|
||||
#include <ff.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if _CODE_PAGE == 437
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP437(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
|
||||
0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 720
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */
|
||||
0x0000, 0x0000, 0x00E9, 0x00E2, 0x0000, 0x00E0, 0x0000, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0651, 0x0652, 0x00F4, 0x00A4, 0x0640, 0x00FB, 0x00F9,
|
||||
0x0621, 0x0622, 0x0623, 0x0624, 0x00A3, 0x0625, 0x0626, 0x0627,
|
||||
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
|
||||
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0641, 0x00B5, 0x0642,
|
||||
0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A,
|
||||
0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0xO650, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 737
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP737(0x80-0xFF) to Unicode conversion table */
|
||||
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398,
|
||||
0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0,
|
||||
0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9,
|
||||
0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
|
||||
0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0,
|
||||
0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD,
|
||||
0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E,
|
||||
0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 775
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP775(0x80-0xFF) to Unicode conversion table */
|
||||
0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107,
|
||||
0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A,
|
||||
0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4,
|
||||
0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6,
|
||||
0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0104, 0x010C, 0x0118,
|
||||
0x0116, 0x2563, 0x2551, 0x2557, 0x255D, 0x012E, 0x0160, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0172, 0x016A,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x017D,
|
||||
0x0105, 0x010D, 0x0119, 0x0117, 0x012F, 0x0161, 0x0173, 0x016B,
|
||||
0x017E, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144,
|
||||
0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019,
|
||||
0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E,
|
||||
0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 850
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP850(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
|
||||
0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE,
|
||||
0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE,
|
||||
0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
|
||||
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 852
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP852(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7,
|
||||
0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106,
|
||||
0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A,
|
||||
0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E,
|
||||
0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A,
|
||||
0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE,
|
||||
0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161,
|
||||
0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4,
|
||||
0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 855
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP855(0x80-0xFF) to Unicode conversion table */
|
||||
0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404,
|
||||
0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408,
|
||||
0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C,
|
||||
0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A,
|
||||
0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414,
|
||||
0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438,
|
||||
0x0418, 0x2563, 0x2551, 0x2557, 0x255D, 0x0439, 0x0419, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x043A, 0x041A,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x043B, 0x041B, 0x043C, 0x041C, 0x043D, 0x041D, 0x043E, 0x041E,
|
||||
0x043F, 0x2518, 0x250C, 0x2588, 0x2584, 0x041F, 0x044F, 0x2580,
|
||||
0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443,
|
||||
0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116,
|
||||
0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D,
|
||||
0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 857
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP857(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F,
|
||||
0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
|
||||
0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x00BA, 0x00AA, 0x00CA, 0x00CB, 0x00C8, 0x0000, 0x00CD, 0x00CE,
|
||||
0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x0000,
|
||||
0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4,
|
||||
0x00AD, 0x00B1, 0x0000, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 858
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP858(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
|
||||
0x00A9, 0x2563, 0x2551, 0x2557, 0x2550, 0x00A2, 0x00A5, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x20AC, 0x00CD, 0x00CE,
|
||||
0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00C6, 0x00CC, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE,
|
||||
0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
|
||||
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 862
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP862(0x80-0xFF) to Unicode conversion table */
|
||||
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
|
||||
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
||||
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
|
||||
0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
|
||||
0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 866
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP866(0x80-0xFF) to Unicode conversion table */
|
||||
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
||||
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
||||
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
||||
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
||||
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
||||
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
||||
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
|
||||
0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 874
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP874(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x2026, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07,
|
||||
0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
|
||||
0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17,
|
||||
0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
|
||||
0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
|
||||
0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
|
||||
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
|
||||
0x0E38, 0x0E39, 0x0E3A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0E3F,
|
||||
0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47,
|
||||
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
|
||||
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
|
||||
0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1250
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1250(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A,
|
||||
0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B,
|
||||
0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C,
|
||||
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
|
||||
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
|
||||
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
|
||||
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
|
||||
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
|
||||
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
|
||||
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
|
||||
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1251
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1251(0x80-0xFF) to Unicode conversion table */
|
||||
0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
|
||||
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2111, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
|
||||
0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7,
|
||||
0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
|
||||
0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457,
|
||||
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
||||
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
||||
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
||||
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
||||
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
||||
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
||||
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
||||
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1252
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1252(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1253
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1253(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0000, 0x2039, 0x000C, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
|
||||
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
||||
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
|
||||
0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
|
||||
0x03A8, 0x03A9, 0x03AA, 0x03AD, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
|
||||
0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
|
||||
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
|
||||
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
|
||||
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1254
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1254(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x210A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00BD, 0x00DC, 0x0130, 0x015E, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1255
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1255(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7,
|
||||
0x05B8, 0x05B9, 0x0000, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF,
|
||||
0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3,
|
||||
0x05F4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
|
||||
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
||||
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
|
||||
0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1256
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1256(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
|
||||
0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
|
||||
0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
|
||||
0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
||||
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
|
||||
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7,
|
||||
0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0640, 0x0642, 0x0643,
|
||||
0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
|
||||
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
|
||||
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2
|
||||
}
|
||||
|
||||
#elif _CODE_PAGE == 1257
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1257(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x00AF, 0x02DB, 0x0000,
|
||||
0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x0000, 0x00A6, 0x00A7,
|
||||
0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
|
||||
0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112,
|
||||
0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
|
||||
0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
|
||||
0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113,
|
||||
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
|
||||
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x0173, 0x014E, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1258
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const uint16_t Tbl[] = { /* CP1258(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0000, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0000, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !_TBLDEF || !_USE_LFN
|
||||
#error This file is not needed in current configuration. Remove from the project.
|
||||
#endif
|
||||
|
||||
|
||||
uint16_t ff_convert ( /* Converted character, Returns zero on error */
|
||||
uint16_t src, /* Character code to be converted */
|
||||
uint32_t dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */
|
||||
)
|
||||
{
|
||||
uint16_t c;
|
||||
|
||||
|
||||
if (src < 0x80) { /* ASCII */
|
||||
c = src;
|
||||
|
||||
} else {
|
||||
if (dir) { /* OEMCP to Unicode */
|
||||
c = (src >= 0x100) ? 0 : Tbl[src - 0x80];
|
||||
|
||||
} else { /* Unicode to OEMCP */
|
||||
for (c = 0; c < 0x80; c++) {
|
||||
if (src == Tbl[c]) break;
|
||||
}
|
||||
c = (c + 0x80) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
uint16_t ff_wtoupper ( /* Upper converted character */
|
||||
uint16_t chr /* Input character */
|
||||
)
|
||||
{
|
||||
static const uint16_t tbl_lower[] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xA1, 0x00A2, 0x00A3, 0x00A5, 0x00AC, 0x00AF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x0FF, 0x101, 0x103, 0x105, 0x107, 0x109, 0x10B, 0x10D, 0x10F, 0x111, 0x113, 0x115, 0x117, 0x119, 0x11B, 0x11D, 0x11F, 0x121, 0x123, 0x125, 0x127, 0x129, 0x12B, 0x12D, 0x12F, 0x131, 0x133, 0x135, 0x137, 0x13A, 0x13C, 0x13E, 0x140, 0x142, 0x144, 0x146, 0x148, 0x14B, 0x14D, 0x14F, 0x151, 0x153, 0x155, 0x157, 0x159, 0x15B, 0x15D, 0x15F, 0x161, 0x163, 0x165, 0x167, 0x169, 0x16B, 0x16D, 0x16F, 0x171, 0x173, 0x175, 0x177, 0x17A, 0x17C, 0x17E, 0x192, 0x3B1, 0x3B2, 0x3B3, 0x3B4, 0x3B5, 0x3B6, 0x3B7, 0x3B8, 0x3B9, 0x3BA, 0x3BB, 0x3BC, 0x3BD, 0x3BE, 0x3BF, 0x3C0, 0x3C1, 0x3C3, 0x3C4, 0x3C5, 0x3C6, 0x3C7, 0x3C8, 0x3C9, 0x3CA, 0x430, 0x431, 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439, 0x43A, 0x43B, 0x43C, 0x43D, 0x43E, 0x43F, 0x440, 0x441, 0x442, 0x443, 0x444, 0x445, 0x446, 0x447, 0x448, 0x449, 0x44A, 0x44B, 0x44C, 0x44D, 0x44E, 0x44F, 0x451, 0x452, 0x453, 0x454, 0x455, 0x456, 0x457, 0x458, 0x459, 0x45A, 0x45B, 0x45C, 0x45E, 0x45F, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217A, 0x217B, 0x217C, 0x217D, 0x217E, 0x217F, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, 0xFF58, 0xFF59, 0xFF5A, 0 };
|
||||
static const uint16_t tbl_upper[] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x21, 0xFFE0, 0xFFE1, 0xFFE5, 0xFFE2, 0xFFE3, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0x178, 0x100, 0x102, 0x104, 0x106, 0x108, 0x10A, 0x10C, 0x10E, 0x110, 0x112, 0x114, 0x116, 0x118, 0x11A, 0x11C, 0x11E, 0x120, 0x122, 0x124, 0x126, 0x128, 0x12A, 0x12C, 0x12E, 0x130, 0x132, 0x134, 0x136, 0x139, 0x13B, 0x13D, 0x13F, 0x141, 0x143, 0x145, 0x147, 0x14A, 0x14C, 0x14E, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15A, 0x15C, 0x15E, 0x160, 0x162, 0x164, 0x166, 0x168, 0x16A, 0x16C, 0x16E, 0x170, 0x172, 0x174, 0x176, 0x179, 0x17B, 0x17D, 0x191, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39A, 0x39B, 0x39C, 0x39D, 0x39E, 0x39F, 0x3A0, 0x3A1, 0x3A3, 0x3A4, 0x3A5, 0x3A6, 0x3A7, 0x3A8, 0x3A9, 0x3AA, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41A, 0x41B, 0x41C, 0x41D, 0x41E, 0x41F, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, 0x428, 0x429, 0x42A, 0x42B, 0x42C, 0x42D, 0x42E, 0x42F, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, 0x408, 0x409, 0x40A, 0x40B, 0x40C, 0x40E, 0x40F, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216A, 0x216B, 0x216C, 0x216D, 0x216E, 0x216F, 0xFF21, 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27, 0xFF28, 0xFF29, 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F, 0xFF30, 0xFF31, 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37, 0xFF38, 0xFF39, 0xFF3A, 0 };
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; tbl_lower[i] && chr != tbl_lower[i]; i++) ;
|
||||
|
||||
return tbl_lower[i] ? tbl_upper[i] : chr;
|
||||
}
|
||||
514
sources/cmd_usb.c
Normal file
514
sources/cmd_usb.c
Normal file
@@ -0,0 +1,514 @@
|
||||
/*
|
||||
* (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 <stdarg.h>
|
||||
#include "usb.h"
|
||||
|
||||
#undef RESET_START_STOP_CMDS
|
||||
#undef CONFIG_USB_STORAGE
|
||||
|
||||
#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || defined(CONFIG_USB_EHCI)
|
||||
|
||||
#ifdef CONFIG_USB_STORAGE
|
||||
extern int usb_stor_curr_dev; /* current device */
|
||||
#endif
|
||||
|
||||
#if defined(COLDFIRE) && defined(NETWORK) && defined(LWIP)
|
||||
extern long pxCurrentTCB, tid_TOS;
|
||||
// #define info(format, arg...) do { if(pxCurrentTCB == tid_TOS) kprint(format, ## arg); else board_printf(format, ## arg); } while(0)
|
||||
#else
|
||||
#define info(format, arg...) kprint(format, ## arg)
|
||||
#endif
|
||||
|
||||
#if defined(COLDFIRE) && defined(NETWORK) && defined(LWIP)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int dest;
|
||||
void (*func)(char);
|
||||
char *loc;
|
||||
} PRINTK_INFO;
|
||||
|
||||
#define DEST_CONSOLE (1)
|
||||
#define DEST_STRING (2)
|
||||
|
||||
extern int printk(PRINTK_INFO *info, const char *fmt, va_list ap);
|
||||
|
||||
static void info(const char *const fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
PRINTK_INFO info;
|
||||
static char buf[1024];
|
||||
info.dest = DEST_STRING;
|
||||
info.loc = buf;
|
||||
va_start(ap, fmt);
|
||||
printk(&info, fmt, ap);
|
||||
*info.loc = '\0';
|
||||
if(pxCurrentTCB == tid_TOS)
|
||||
kprint(buf);
|
||||
else
|
||||
board_printf(buf);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#endif /* defined(COLDFIRE) && defined(NETWORK) && defined(LWIP) */
|
||||
|
||||
/* 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:
|
||||
info("See Interface");
|
||||
break;
|
||||
case USB_CLASS_HID:
|
||||
info("Human Interface, Subclass: ");
|
||||
switch(subclass)
|
||||
{
|
||||
case USB_SUB_HID_NONE: info("None"); break;
|
||||
case USB_SUB_HID_BOOT:
|
||||
info("Boot ");
|
||||
switch(proto)
|
||||
{
|
||||
case USB_PROT_HID_NONE: info("None"); break;
|
||||
case USB_PROT_HID_KEYBOARD: info("Keyboard"); break;
|
||||
case USB_PROT_HID_MOUSE: info("Mouse"); break;
|
||||
default: info("reserved"); break;
|
||||
}
|
||||
break;
|
||||
default: info("reserved"); break;
|
||||
}
|
||||
break;
|
||||
case USB_CLASS_MASS_STORAGE:
|
||||
info("Mass Storage, ");
|
||||
switch(subclass)
|
||||
{
|
||||
case US_SC_RBC: info("RBC "); break;
|
||||
case US_SC_8020: info("SFF-8020i (ATAPI)"); break;
|
||||
case US_SC_QIC: info("QIC-157 (Tape)"); break;
|
||||
case US_SC_UFI: info("UFI"); break;
|
||||
case US_SC_8070: info("SFF-8070"); break;
|
||||
case US_SC_SCSI: info("Transp. SCSI"); break;
|
||||
default: info("reserved"); break;
|
||||
}
|
||||
info(", ");
|
||||
switch (proto)
|
||||
{
|
||||
case US_PR_CB: info("Command/Bulk"); break;
|
||||
case US_PR_CBI: info("Command/Bulk/Int"); break;
|
||||
case US_PR_BULK: info("Bulk only"); break;
|
||||
default: info("reserved"); break;
|
||||
}
|
||||
break;
|
||||
default: info("%s", usb_get_class_desc(dclass)); break;
|
||||
}
|
||||
}
|
||||
|
||||
void usb_display_string(struct usb_device *dev, int index)
|
||||
{
|
||||
char buffer[256];
|
||||
if(index != 0)
|
||||
{
|
||||
if(usb_string(dev, index, &buffer[0], 256) > 0)
|
||||
info("String: \"%s\"", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void usb_display_desc(struct usb_device *dev)
|
||||
{
|
||||
if(dev->descriptor.bDescriptorType == USB_DT_DEVICE)
|
||||
{
|
||||
info("%d: %s, USB Revision %x.%x\r\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))
|
||||
info(" - %s %s %s\r\n", dev->mf, dev->prod, dev->serial);
|
||||
if(dev->descriptor.bDeviceClass)
|
||||
{
|
||||
info(" - Class: ");
|
||||
usb_display_class_sub(dev->descriptor.bDeviceClass, dev->descriptor.bDeviceSubClass, dev->descriptor.bDeviceProtocol);
|
||||
info("\r\n");
|
||||
}
|
||||
else
|
||||
info(" - Class: (from Interface) %s\r\n", usb_get_class_desc(dev->config.if_desc[0].bInterfaceClass));
|
||||
info(" - PacketSize: %d Configurations: %d\r\n",
|
||||
dev->descriptor.bMaxPacketSize0,
|
||||
dev->descriptor.bNumConfigurations);
|
||||
info(" - Vendor: 0x%04x Product 0x%04x Version %d.%d\r\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)
|
||||
{
|
||||
info(" Configuration: %d\r\n", config->bConfigurationValue);
|
||||
info(" - Interfaces: %d %s%s%dmA\r\n", config->bNumInterfaces, (config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ", (config->bmAttributes & 0x20) ? "Remote Wakeup " : "", config->MaxPower*2);
|
||||
if(config->iConfiguration)
|
||||
{
|
||||
info(" - ");
|
||||
usb_display_string(dev, config->iConfiguration);
|
||||
info("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
void usb_display_if_desc(struct usb_interface_descriptor *ifdesc, struct usb_device *dev)
|
||||
{
|
||||
info(" Interface: %d\r\n", ifdesc->bInterfaceNumber);
|
||||
info(" - Alternate Setting %d, Endpoints: %d\r\n", ifdesc->bAlternateSetting, ifdesc->bNumEndpoints);
|
||||
info(" - Class ");
|
||||
usb_display_class_sub(ifdesc->bInterfaceClass, ifdesc->bInterfaceSubClass, ifdesc->bInterfaceProtocol);
|
||||
info("\r\n");
|
||||
if(ifdesc->iInterface)
|
||||
{
|
||||
info(" - ");
|
||||
usb_display_string(dev, ifdesc->iInterface);
|
||||
info("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc)
|
||||
{
|
||||
info(" - Endpoint %d %s ", epdesc->bEndpointAddress & 0xf, (epdesc->bEndpointAddress & 0x80) ? "In" : "Out");
|
||||
switch((epdesc->bmAttributes & 0x03))
|
||||
{
|
||||
case 0: info("Control"); break;
|
||||
case 1: info("Isochronous"); break;
|
||||
case 2: info("Bulk"); break;
|
||||
case 3: info("Interrupt"); break;
|
||||
}
|
||||
info(" MaxPacket %d", epdesc->wMaxPacketSize);
|
||||
if((epdesc->bmAttributes & 0x03) == 0x3)
|
||||
info(" Interval %dms", epdesc->bInterval);
|
||||
info("\r\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);
|
||||
}
|
||||
}
|
||||
info("\r\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, index;
|
||||
int has_child, last_child, port;
|
||||
index = strlen(pre);
|
||||
info(" %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 */
|
||||
info("\b+-");
|
||||
/* correct last child */
|
||||
if(last_child)
|
||||
pre[index-1] = ' ';
|
||||
} /* if not root hub */
|
||||
else
|
||||
info(" ");
|
||||
info("%d ", dev->devnum);
|
||||
pre[index++] = ' ';
|
||||
pre[index++] = has_child ? '|' : ' ';
|
||||
pre[index] = 0;
|
||||
info(" %s (%s, %dmA)\r\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))
|
||||
info(" %s %s %s %s\r\n", pre, dev->mf, dev->prod, dev->serial);
|
||||
info(" %s\r\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[index] = 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 command intepreter
|
||||
*/
|
||||
int uif_cmd_usb(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
struct usb_device *dev = NULL;
|
||||
#ifdef CONFIG_USB_STORAGE
|
||||
block_dev_desc_t *stor_dev;
|
||||
#endif
|
||||
#ifdef RESET_START_STOP_CMDS
|
||||
extern char usb_started;
|
||||
if((strncmp(argv[1], "reset", 5) == 0) || (strncmp(argv[1], "start", 5) == 0))
|
||||
{
|
||||
usb_stop();
|
||||
info("(Re)start USB...\r\n");
|
||||
i = usb_init(0, NULL);
|
||||
#ifdef CONFIG_USB_STORAGE
|
||||
/* try to recognize storage devices immediately */
|
||||
if(i >= 0)
|
||||
usb_stor_curr_dev = usb_stor_scan();
|
||||
#endif /* CONFIG_USB_STORAGE */
|
||||
return 0;
|
||||
}
|
||||
if(strncmp(argv[1], "stop", 4) == 0)
|
||||
{
|
||||
#ifdef CONFIG_USB_KEYBOARD
|
||||
if(argc == 2)
|
||||
{
|
||||
if(usb_kbd_deregister() != 0)
|
||||
{
|
||||
info("USB not stopped: usbkbd still using USB\r\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else /* forced stop, switch console in to serial */
|
||||
usb_kbd_deregister();
|
||||
#endif /* CONFIG_USB_KEYBOARD */
|
||||
info("stopping USB..\r\n");
|
||||
usb_stop();
|
||||
return 0;
|
||||
}
|
||||
if(!usb_started)
|
||||
{
|
||||
info("USB is stopped. Please issue 'usb start' first.\r\n");
|
||||
return 1;
|
||||
}
|
||||
#endif /* RESET_START_STOP_CMDS */
|
||||
if(strncmp(argv[1], "tree", 4) == 0)
|
||||
{
|
||||
info("\r\nUSB Device Tree:\r\n");
|
||||
for(i = 0; i < USB_MAX_BUS; i++)
|
||||
{
|
||||
struct usb_device *dev = usb_get_dev_index(0, i);
|
||||
if(dev == NULL)
|
||||
break;
|
||||
info(" USB controller %d:\r\n", i);
|
||||
usb_show_tree(dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(strncmp(argv[1], "inf", 3) == 0)
|
||||
{
|
||||
int b, d;
|
||||
if(argc == 2)
|
||||
{
|
||||
for(b = 0; b < USB_MAX_BUS; b++)
|
||||
{
|
||||
for(d = 0; d < USB_MAX_DEVICE; d++)
|
||||
{
|
||||
dev = usb_get_dev_index(d, b);
|
||||
if(dev == NULL)
|
||||
break;
|
||||
if(!d)
|
||||
info("USB controller %d:\r\n\n", b);
|
||||
usb_display_desc(dev);
|
||||
usb_display_config(dev);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int d;
|
||||
i = strtoul(argv[2], NULL, 16);
|
||||
info("config for device %d\r\n", i);
|
||||
for(d = 0; d < USB_MAX_DEVICE; d++)
|
||||
{
|
||||
dev = usb_get_dev_index(d, 0);
|
||||
if(dev == NULL)
|
||||
break;
|
||||
if(dev->devnum == i)
|
||||
break;
|
||||
}
|
||||
if(dev == NULL)
|
||||
{
|
||||
info("*** NO Device avaiable ***\r\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(strcmp(argv[1], "read") == 0)
|
||||
{
|
||||
if(usb_stor_curr_dev < 0)
|
||||
{
|
||||
info("no current device selected\r\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;
|
||||
info("\r\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);
|
||||
info("%ld blocks read: %s\r\n", n, (n == cnt) ? "OK" : "ERROR");
|
||||
if(n == cnt)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if(strncmp(argv[1], "dev", 3) == 0)
|
||||
{
|
||||
if(argc == 3)
|
||||
{
|
||||
int dev = (int)strtoul(argv[2], NULL, 10);
|
||||
info("\r\nUSB device %d: ", dev);
|
||||
if(dev >= USB_MAX_STOR_DEV)
|
||||
{
|
||||
info("unknown device\r\n");
|
||||
return 1;
|
||||
}
|
||||
info("\r\n Device %d: ", dev);
|
||||
stor_dev = usb_stor_get_dev(dev);
|
||||
dev_print(stor_dev);
|
||||
if(stor_dev->type == DEV_TYPE_UNKNOWN)
|
||||
return 1;
|
||||
usb_stor_curr_dev = dev;
|
||||
info("... is now current device\r\n");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
info("\r\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;
|
||||
}
|
||||
info(
|
||||
#ifdef RESET_START_STOP_CMDS
|
||||
"usb reset - reset (rescan) USB controller\r\n"
|
||||
"usb stop [f] - stop USB [f]=force stop\r\n"
|
||||
#endif
|
||||
"usb tree - show USB device tree\r\n"
|
||||
"usb info [dev] - show available USB devices\r\n"
|
||||
"usb storage - show details of USB storage devices\r\n"
|
||||
"usb dev [dev] - show or set current USB storage device\r\n"
|
||||
"usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\r\n"
|
||||
" to memory address `addr'\r\n");
|
||||
#else /* !CONFIG_USB_STORAGE */
|
||||
info(
|
||||
#ifdef RESET_START_STOP_CMDS
|
||||
"usb reset - reset (rescan) USB controller\r\n"
|
||||
"usb stop [f] - stop USB [f]=force stop\r\n"
|
||||
#endif
|
||||
"usb tree - show USB device tree\r\n"
|
||||
"usb info [dev] - show available USB devices\r\n");
|
||||
#endif /* CONFIG_USB_STORAGE */
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USB_UHCI || CONFIG_USB_OHCI || CONFIG_USB_EHCI */
|
||||
1326
sources/div.s
1326
sources/div.s
File diff suppressed because it is too large
Load Diff
1180
sources/ehci-hcd.c
Normal file
1180
sources/ehci-hcd.c
Normal file
File diff suppressed because it is too large
Load Diff
1563
sources/ewf.S
1563
sources/ewf.S
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@
|
||||
.extern _video_tlb
|
||||
.extern _video_sbt
|
||||
.extern cpusha
|
||||
.extern _xhdi_sd_install /* trap #0 exception vector for installation of xhdi SD card driver */
|
||||
|
||||
/* Register read/write macros */
|
||||
#define MCF_MMU_MMUCR __MMUBAR
|
||||
@@ -131,31 +132,31 @@
|
||||
|
||||
move.w #0x2700,sr // disable interrupt
|
||||
subq.l #8,a7
|
||||
movem.l d0/a5,(a7) // register sichern
|
||||
movem.l d0/a5,(a7) // save registers
|
||||
lea MCF_EPORT_EPFR,a5
|
||||
move.b #\clr_int,(a5) // clear int pending
|
||||
// test auf protect mode ---------------------
|
||||
move.b DIP_SWITCHa,d0
|
||||
btst #7,d0
|
||||
bne irq_protect // ja->
|
||||
bne irq_protect // ja->
|
||||
// -------------------------------------------
|
||||
movem.l (a7),d0/a5 // register zurück
|
||||
movem.l (a7),d0/a5 // restore registers
|
||||
addq.l #8,a7
|
||||
move.l \vector,-(a7)
|
||||
move #0x2\int_mask\()00,sr
|
||||
rts
|
||||
irq_protect:
|
||||
move.l usp,a5 // usp holen
|
||||
tst.b _rt_mod // supervisor?
|
||||
bne sev_supint // ja ->
|
||||
mov3q.l #-1,_rt_mod // auf supervisor setzen
|
||||
move.l a5,_rt_usp // rt_usp speichern
|
||||
move.l _rt_ssp,a5 // rt_ssp holen
|
||||
move.l usp,a5 // get usp
|
||||
tst.b _rt_mod // supervisor mode active?
|
||||
bne sev_supint // yes ->
|
||||
mov3q.l #-1,_rt_mod // enable supervisor mode
|
||||
move.l a5,_rt_usp // save rt_usp
|
||||
move.l _rt_ssp,a5 // get rt_ssp
|
||||
#ifdef cf_stack
|
||||
move.l 12(a7),-(a5) // pc transferieren
|
||||
move.l 12(a7),-(a5) // transfer pc
|
||||
move.l 8(a7),-(a5) // sr,vec
|
||||
#else
|
||||
move.w 8(a7),-(a5) // vector nr.
|
||||
move.w 8(a7),-(a5) // vector no
|
||||
move.l 12(a7),-(a5) // pc verschieben
|
||||
move.w 10(a7),-(a5) // sr verschieben
|
||||
#endif
|
||||
@@ -209,15 +210,15 @@ _vec_init:
|
||||
clr.l _rt_ssp
|
||||
clr.l _rt_usp
|
||||
clr.l _rt_vbr
|
||||
move.l #__RAMBAR0,d0 // sind in rambar0
|
||||
move.l #__RAMBAR0,d0 // exception vectors reside in rambar0
|
||||
movec d0,VBR
|
||||
move.l d0,a0
|
||||
move.l a0,a2
|
||||
init_vec:
|
||||
move.l #256,d0
|
||||
lea std_exc_vec(pc),a1 // standard vector
|
||||
lea std_exc_vec(pc),a1 // standard vector
|
||||
init_vec_loop:
|
||||
move.l a1,(a2)+ // mal standard vector f<EFBFBD>r alle setzen
|
||||
move.l a1,(a2)+ // set standard vector for all exceptions
|
||||
subq.l #1,d0
|
||||
bne init_vec_loop
|
||||
|
||||
@@ -265,6 +266,10 @@ init_vec_loop:
|
||||
move.l a1,0xdc(a0)
|
||||
no_protect_vectors:
|
||||
|
||||
// trap #0 (without any parameters for now) is used to provide BaS' XHDI
|
||||
// routine address to EmuTOS.
|
||||
lea _xhdi_sd_install,a1
|
||||
move.l a1,0x80(a0) // trap #0 exception vector
|
||||
|
||||
// int 1-7
|
||||
lea irq1(pc),a1
|
||||
@@ -360,14 +365,14 @@ sev_sup:
|
||||
add.l _rt_vbr,d0 // + basis
|
||||
move.l d0,a5
|
||||
move.l (a5),12(a7) // hier geht's weiter
|
||||
movem.l (a7),d0/a5 // register zur<EFBFBD>ck
|
||||
movem.l (a7),d0/a5 // register zurück
|
||||
addq.l #8,a7
|
||||
rte // und weg
|
||||
//*******************************************
|
||||
reset_vector:
|
||||
move.w #0x2700,sr // disable interrupt
|
||||
move.l #0x31415926,d0
|
||||
cmp.l 0x426,d0 // reset vector g<EFBFBD>ltg?
|
||||
cmp.l 0x426,d0 // reset vector gültg?
|
||||
beq std_exc_vec // ja->
|
||||
jmp _rom_entry // sonst kaltstart
|
||||
acess:
|
||||
@@ -467,7 +472,7 @@ irq6: // mfp
|
||||
// test auf timeout screen adr change -------------------------------------------------------
|
||||
move.l _video_sbt,d0
|
||||
beq irq6_non_sca // wenn 0 nichts zu tun
|
||||
sub.l #0x70000000,d0 // 14 sec abz<EFBFBD>hlen
|
||||
sub.l #0x70000000,d0 // 14 sec abzählen
|
||||
lea MCF_SLT0_SCNT,a5
|
||||
cmp.l (a5),d0 // aktuelle zeit weg
|
||||
ble irq6_non_sca // noch nicht abgelaufen
|
||||
@@ -487,13 +492,13 @@ irq6: // mfp
|
||||
swap d4
|
||||
move.l d4,MCF_MMU_MMUAR
|
||||
mvz.w #0x10e,d4
|
||||
move.l d4,MCF_MMU_MMUOR // eintr<EFBFBD>ge holen aus mmu
|
||||
move.l d4,MCF_MMU_MMUOR // einträge holen aus mmu
|
||||
nop
|
||||
move.l MCF_MMU_MMUTR,d4 // ID holen
|
||||
lsr.l #2,d4 // bit 9 bis 2
|
||||
cmp.w #sca_page_ID,d4 // ist screen change ID?
|
||||
bne irq6_sca_pn // nein -> page keine screen area next
|
||||
// eintrag <EFBFBD>ndern
|
||||
// eintrag <EFBFBD>ndern
|
||||
add.l #std_mmutr,d0
|
||||
move.l d3,d1 // page 0?
|
||||
beq irq6_sca_pn0 // ja ->
|
||||
@@ -527,9 +532,9 @@ irq6_sca_pn:
|
||||
|
||||
move.l #0x2000,d0
|
||||
move.l d0,_video_tlb // anfangszustand wieder herstellen
|
||||
clr.l _video_sbt // zeit l<EFBFBD>schen
|
||||
clr.l _video_sbt // zeit löschen
|
||||
|
||||
movem.l (a7),d0-d4/a0-a1 // register zur<EFBFBD>ck
|
||||
movem.l (a7),d0-d4/a0-a1 // register zurück
|
||||
lea 28(a7),a7
|
||||
irq6_non_sca:
|
||||
// test auf acsi dma -----------------------------------------------------------------
|
||||
@@ -566,9 +571,9 @@ irq6_2:
|
||||
move.l 0xF0020000,a5 // vector holen
|
||||
add.l _rt_vbr,a5 // basis
|
||||
move.l (a5),d0 // vector holen
|
||||
move.l 4(a7),a5 // a5 zur<EFBFBD>ck
|
||||
move.l 4(a7),a5 // a5 zurück
|
||||
move.l d0,4(a7) // vector eintragen
|
||||
move.l (a7)+,d0 // d0 zur<EFBFBD>ck
|
||||
move.l (a7)+,d0 // d0 zurück
|
||||
move #0x2600,sr
|
||||
rts
|
||||
irq6_3:
|
||||
@@ -590,7 +595,7 @@ irq6_3:
|
||||
move.l 0xF0020000,a5 // vector holen: intack routine
|
||||
add.l _rt_vbr,a5 // virtuelle VBR des Systems
|
||||
move.l (a5),12(a7) // hier gehts weiter
|
||||
movem.l (a7),d0/a5 // register zur<EFBFBD>ck
|
||||
movem.l (a7),d0/a5 // register zurück
|
||||
addq.l #8,a7
|
||||
move.b #6,2(a7) // intmaske setzen
|
||||
rte // und weg
|
||||
@@ -609,7 +614,7 @@ sev_sup6:
|
||||
move.l 0xF0020000,a5 // vector holen: intack routine
|
||||
add.l _rt_vbr,a5 // virtuelle VBR des Systems
|
||||
move.l (a5),12(a7) // hier gehts weiter
|
||||
movem.l (a7),d0/a5 // register zur<EFBFBD>ck
|
||||
movem.l (a7),d0/a5 // register zurück
|
||||
rts
|
||||
|
||||
.data
|
||||
@@ -626,9 +631,9 @@ acsi_dma: // atari dma
|
||||
move.l d1,-(a7)
|
||||
|
||||
lea MCF_PSC0_PSCTB_8BIT,a1 // ++ vr
|
||||
mchar move.l, 'D,'M','A,'\ ,(a1)
|
||||
mchar move.l, 'D','M','A','\'' ,(a1)
|
||||
//move.l #"DMA ",(a1)
|
||||
mchar move.l,'I,'N,'T,'!,(a1)
|
||||
mchar move.l,'I','N','T','!',(a1)
|
||||
// move.l #'INT!',(a1)
|
||||
|
||||
lea 0xf0020110,a5 // fifo daten
|
||||
|
||||
4158
sources/ff.c
Normal file
4158
sources/ff.c
Normal file
File diff suppressed because it is too large
Load Diff
108
sources/fifo.c
Normal file
108
sources/fifo.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* fifo.c
|
||||
*
|
||||
* A general implementation of a fifo buffer
|
||||
*
|
||||
*/
|
||||
|
||||
#include <fifo.h>
|
||||
|
||||
//This initializes the FIFO structure with the given buffer and size
|
||||
void fifo_init(fifo_t * f, char * buf, int16_t size)
|
||||
{
|
||||
f->head = 0;
|
||||
f->tail = 0;
|
||||
f->size = size;
|
||||
f->buf = buf;
|
||||
f->low = 0;
|
||||
f->high = 0;
|
||||
}
|
||||
|
||||
// Get one byte from the fifo buffer
|
||||
uint8_t fifo_get(fifo_t *f)
|
||||
{
|
||||
uint8_t ch = 0;
|
||||
|
||||
if( !fifo_empty(f) )
|
||||
{
|
||||
fifo_advance(f,&f->tail);
|
||||
ch = f->buf[f->tail];
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
// Put one byte into the buffer
|
||||
void fifo_put(fifo_t *f, uint8_t byte)
|
||||
{
|
||||
if( fifo_unused(f) <= 0 )
|
||||
return;
|
||||
fifo_advance(f,&f->head);
|
||||
f->buf[f->head] = byte;
|
||||
}
|
||||
|
||||
void fifo_clear(fifo_t *f)
|
||||
{
|
||||
f->head = f->tail = 0;
|
||||
}
|
||||
|
||||
int fifo_used(fifo_t *f)
|
||||
{
|
||||
if( f->head > f->tail )
|
||||
return (f->head - f->tail);
|
||||
return (f->size - f->tail + f->head);
|
||||
}
|
||||
|
||||
int fifo_unused(fifo_t *f)
|
||||
{
|
||||
if( f->head > f->tail )
|
||||
return (f->size-f->head+f->tail);
|
||||
return (f->tail-f->head);
|
||||
}
|
||||
|
||||
int fifo_full(fifo_t *f)
|
||||
{
|
||||
if( f->head+1 >= f->size )
|
||||
return (f->tail == 0);
|
||||
return (f->head+1 == f->tail);
|
||||
}
|
||||
|
||||
int fifo_empty(fifo_t *f)
|
||||
{
|
||||
return (f->head == f->tail);
|
||||
}
|
||||
|
||||
void fifo_advance(fifo_t *f, int16_t *ix)
|
||||
{
|
||||
if( ++*ix > f->size )
|
||||
*ix=0;
|
||||
}
|
||||
|
||||
//This reads at most nbytes bytes from the FIFO
|
||||
//The number of bytes read is returned
|
||||
int fifo_read(fifo_t *f, unsigned char *buf, int16_t nbytes){
|
||||
int n = 0;
|
||||
|
||||
while( n < nbytes && !fifo_empty(f) )
|
||||
{
|
||||
n++;
|
||||
*buf++ = fifo_get(f);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
//This writes up to nbytes bytes to the FIFO
|
||||
//If the head runs in to the tail, not all bytes are written
|
||||
//The number of bytes written is returned
|
||||
int fifo_write(fifo_t *f, const unsigned char *buf, int16_t nbytes){
|
||||
int n = 0;
|
||||
|
||||
while( n < nbytes && !fifo_full(f) )
|
||||
{
|
||||
fifo_put(f,*buf++);
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
111
sources/flash.c
Normal file
111
sources/flash.c
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* flash.c
|
||||
*
|
||||
* flashing routines for BaS_gcc
|
||||
*
|
||||
* Created on: 19.12.2012
|
||||
* Author: mfro
|
||||
* The ACP Firebee project
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2012 M. Froeschle
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void chip_erase(uint8_t *address)
|
||||
{
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0x80;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0x10;
|
||||
}
|
||||
|
||||
void sector_erase(uint8_t *address, uint16_t sector)
|
||||
{
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0x80;
|
||||
* (volatile uint8_t *) (address + 0xaaa) = 0xaa;
|
||||
* (volatile uint8_t *) (address + 0x555) = 0x55;
|
||||
* (volatile uint8_t *) (address + sector) = 0x30;
|
||||
|
||||
do {
|
||||
;
|
||||
} while (* (volatile uint32_t *) (address + sector) != 0xffffffff);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _NOT_USED_
|
||||
* MX28LV640DB.alg
|
||||
bra lab0x5a
|
||||
move.w #0xaa,d0
|
||||
move.w d0,0xaaa(a5)
|
||||
move.w #0xff,d0
|
||||
move.w d0,0x554(a5)
|
||||
move.w #0x20,d0
|
||||
move.w d0,0xaaa(a5)
|
||||
lab0x1c:
|
||||
move.w #0xa0,d0
|
||||
move.w d0,(a5)
|
||||
moveq #0,d0
|
||||
move.w (a3),d0
|
||||
move.w d0,(a4)
|
||||
lab0x28:
|
||||
move.w (a4),d1
|
||||
andi.l #0xffff,d1
|
||||
cmp.l d1,d0
|
||||
bne.s lab0x28
|
||||
adda.l #2,a3
|
||||
adda.l #2,a4
|
||||
cmpa.l a2,a3
|
||||
blt.s lab0x1c
|
||||
move.w #0x90,d0
|
||||
move.w d0,(a5)
|
||||
move.w #0,d0
|
||||
move.w d0,(a5)
|
||||
lab0x50:
|
||||
nop
|
||||
nop
|
||||
halt
|
||||
nop
|
||||
bra.s lab0x50
|
||||
lab0x5a:
|
||||
move.w #0xaa,d0
|
||||
move.w d0,0xaaa(a5)
|
||||
move.w #0x55,d0
|
||||
move.w d0,0x554(a5)
|
||||
move.w #0x80,d0
|
||||
move.w d0,0xaaa(a5)
|
||||
move.w #0xaa,d0
|
||||
move.w d0,0xaaa(a5)
|
||||
move.w #0x55,d0
|
||||
move.w d0,0x554(a5)
|
||||
move.w #0x30,d0
|
||||
move.w d0,(a4)
|
||||
lab0x88:
|
||||
move.l (a4),d1
|
||||
move.l #-1,d0
|
||||
cmp.l d1,d0
|
||||
bne.s lab0x88
|
||||
nop
|
||||
nop
|
||||
halt
|
||||
nop
|
||||
#endif /* _NOT_USED_ */
|
||||
208
sources/i2c_firebee.c
Normal file
208
sources/i2c_firebee.c
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* i2c.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include <MCF5475.h>
|
||||
#include <i2c_firebee.h>
|
||||
|
||||
#include <fifo.h>
|
||||
|
||||
int register_handler(uint8_t,uint8_t,void (*func)());
|
||||
|
||||
static struct
|
||||
{
|
||||
uint8_t state;
|
||||
long delay;
|
||||
uint16_t len;
|
||||
fifo_t fifo;
|
||||
unsigned char *_buf;
|
||||
uint16_t device;
|
||||
} i2c_param;
|
||||
|
||||
char local_buf[BUFSIZ];
|
||||
|
||||
#define FIFO &i2c_param.fifo
|
||||
|
||||
void __attribute__ ((interrupt)) I2C_InterruptHandler(void)
|
||||
{
|
||||
char ch;
|
||||
|
||||
clear_bit(MCF_I2C_I2SR, MCF_I2C_I2SR_IIF);
|
||||
if (MCF_I2C_I2CR & MCF_I2C_I2CR_MSTA)
|
||||
{ // Masters of the known universe
|
||||
if (MCF_I2C_I2SR & MCF_I2C_I2SR_ICF)
|
||||
{
|
||||
switch (i2c_param.state)
|
||||
{
|
||||
case I2C_MXRX:
|
||||
if (fifo_used(&i2c_param.fifo) + 1 == i2c_param.len)
|
||||
{
|
||||
clear_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_MSTA);
|
||||
i2c_param.state = I2C_READY;
|
||||
}
|
||||
else if (fifo_used(&i2c_param.fifo) + 2 == i2c_param.len)
|
||||
{
|
||||
set_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_TXAK);
|
||||
i2c_param.state = I2C_READY;
|
||||
}
|
||||
fifo_put(&i2c_param.fifo, MCF_I2C_I2DR );
|
||||
break;
|
||||
case I2C_ADDR:
|
||||
if (fifo_empty(&i2c_param.fifo))
|
||||
{
|
||||
i2c_param.state = I2C_MXRX;
|
||||
clear_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_MTX); // Receive mode
|
||||
set_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_RSTA);
|
||||
ch = MCF_I2C_I2DR; // Dummy read
|
||||
break;
|
||||
}
|
||||
case I2C_MXTX:
|
||||
if (fifo_empty(&i2c_param.fifo)
|
||||
|| (MCF_I2C_I2SR & MCF_I2C_I2SR_RXAK))
|
||||
{
|
||||
clear_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_MSTA);
|
||||
i2c_param.state = I2C_READY;
|
||||
}
|
||||
else
|
||||
MCF_I2C_I2DR = fifo_get(&i2c_param.fifo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Slave mode.
|
||||
int set;
|
||||
|
||||
if ((set = (MCF_I2C_I2SR & MCF_I2C_I2SR_IAL)))
|
||||
clear_bit(MCF_I2C_I2SR, MCF_I2C_I2SR_IAL);
|
||||
if (MCF_I2C_I2SR & MCF_I2C_I2SR_IAAS)
|
||||
{
|
||||
if (MCF_I2C_I2SR & MCF_I2C_I2SR_SRW)
|
||||
{
|
||||
set_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_MTX);
|
||||
fifo_put(&i2c_param.fifo, MCF_I2C_I2DR );
|
||||
}
|
||||
else
|
||||
{
|
||||
clear_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_MTX);
|
||||
ch = MCF_I2C_I2DR;
|
||||
}
|
||||
}
|
||||
else if (!set)
|
||||
{
|
||||
if (MCF_I2C_I2CR & MCF_I2C_I2CR_MTX)
|
||||
{
|
||||
if (MCF_I2C_I2SR & MCF_I2C_I2SR_RXAK)
|
||||
MCF_I2C_I2DR = fifo_get(&i2c_param.fifo);
|
||||
else
|
||||
{
|
||||
clear_bit(MCF_I2C_I2CR, MCF_I2C_I2CR_MTX);
|
||||
ch = MCF_I2C_I2DR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fifo_put(&i2c_param.fifo, MCF_I2C_I2DR );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* I2Cinit: I2C initilazation as master
|
||||
*
|
||||
* Parameters: None.
|
||||
*
|
||||
* Return : None.
|
||||
*/
|
||||
void I2C_Init()
|
||||
{
|
||||
i2c_param.fifo.buf = local_buf;
|
||||
i2c_param.fifo.size = BUFSIZ;
|
||||
i2c_param.delay = 133 * 10L; // We can safely ignore this
|
||||
i2c_param.len = 0;
|
||||
I2C_ioctl(0, 0);
|
||||
register_handler(1,40,I2C_InterruptHandler);
|
||||
xprintf("Registered I2C Handler ...\n\r");
|
||||
}
|
||||
|
||||
void I2C_send(unsigned short device, unsigned char *buf, unsigned short len)
|
||||
{
|
||||
if (len > i2c_param.fifo.size)
|
||||
return;
|
||||
i2c_param.len = len;
|
||||
fifo_clear(&i2c_param.fifo);
|
||||
if (device > 127) // Use I2C 10 bit address
|
||||
{
|
||||
fifo_put(FIFO, 0b11110 | ((device >> 5) & 6) | I2C_WRITE);
|
||||
fifo_put(FIFO, device & 255);
|
||||
}
|
||||
else
|
||||
fifo_put(FIFO, ((device << 1) & 0xFE) | I2C_WRITE);
|
||||
fifo_write(FIFO, buf, len);
|
||||
i2c_param.state = I2C_MXTX;
|
||||
}
|
||||
|
||||
void I2C_receive(unsigned short device, unsigned char *buf, unsigned short len)
|
||||
{
|
||||
if (len > i2c_param.fifo.size)
|
||||
return;
|
||||
i2c_param.len = len;
|
||||
fifo_clear(FIFO);
|
||||
if (device > 127) // Use I2C 10 bit address
|
||||
{
|
||||
fifo_put(FIFO, 0b11110 | ((device >> 5) & 6) | I2C_READ);
|
||||
fifo_put(FIFO, device & 255);
|
||||
}
|
||||
else
|
||||
fifo_put(FIFO, ((device << 1) & 0xFE) | I2C_READ);
|
||||
i2c_param.state = I2C_ADDR;
|
||||
}
|
||||
|
||||
int I2C_ioctl(unsigned int index, unsigned long val)
|
||||
{
|
||||
unsigned short len = val;
|
||||
uint8_t temp;
|
||||
|
||||
// Set device as slave or
|
||||
switch (index)
|
||||
{
|
||||
case I2CTLINIT: // make me master
|
||||
/* set the frequency near 400KHz */
|
||||
MCF_I2C_I2FDR = MCF_I2C_I2FDR_IC(0x10);
|
||||
/* start the module */
|
||||
MCF_I2C_I2CR = MCF_I2C_I2CR_IIEN | MCF_I2C_I2CR_IEN;
|
||||
/* if bit busy set, send a stop condition to slave module */
|
||||
if (MCF_I2C_I2SR & MCF_I2C_I2SR_IBB)
|
||||
{
|
||||
MCF_I2C_I2CR = 0; /* clear control register */
|
||||
MCF_I2C_I2CR = MCF_I2C_I2CR_IIEN | MCF_I2C_I2CR_IEN
|
||||
| MCF_I2C_I2CR_MSTA; /* enable module & send a START condition */
|
||||
temp = MCF_I2C_I2DR; /* dummy read */
|
||||
MCF_I2C_I2SR = 0; /* clear status register */
|
||||
MCF_I2C_I2CR = 0; /* clear control register */
|
||||
MCF_I2C_I2CR = MCF_I2C_I2CR_IIEN | MCF_I2C_I2CR_IEN; /* enable the module again */
|
||||
}
|
||||
i2c_param.state = I2C_READY;
|
||||
i2c_param._buf = 0;
|
||||
break;
|
||||
case I2CTLSBUF:
|
||||
i2c_param._buf = (unsigned char *) val;
|
||||
break;
|
||||
case I2CTLDEV:
|
||||
i2c_param.device = val;
|
||||
break;
|
||||
case I2CTLREAD:
|
||||
if (i2c_param._buf == 0 || i2c_param.device == 0)
|
||||
return -1;
|
||||
I2C_receive(i2c_param.device, i2c_param._buf, len);
|
||||
break;
|
||||
case I2CTLWRITE:
|
||||
if (i2c_param._buf == 0 || i2c_param.device == 0)
|
||||
return -1;
|
||||
I2C_send(i2c_param.device, i2c_param._buf, len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
581
sources/ii_add.h
581
sources/ii_add.h
@@ -1,581 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// add
|
||||
//--------------------------------------------------------------------
|
||||
/*****************************************************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// byt
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// add.b #im,dx
|
||||
//--------------------------------------------------------------------
|
||||
addbir_macro:.macro
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
mvs.b \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.b d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add ea,dx
|
||||
//--------------------------------------------------------------------
|
||||
adddd:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add ea,dx (first ea->a1 z.B. f<>r a0,a1,USP)
|
||||
//--------------------------------------------------------------------
|
||||
addddd:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 a1,d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add (ea),dx (first ea->a1 z.B. f<>r a0,a1,USP)
|
||||
//--------------------------------------------------------------------
|
||||
adddda:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add (ay)+,dx (first ea->a1 z.B. f<>r a0,a1,USP)
|
||||
//--------------------------------------------------------------------
|
||||
addddai:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1)+,d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add -(ay),dx (first ea->a1 z.B. f<>r a0,a1,USP)
|
||||
//--------------------------------------------------------------------
|
||||
addddad:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 -(a1),d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add d16(ay),dx
|
||||
//--------------------------------------------------------------------
|
||||
addd16ad:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add d8(ay,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
addd8ad:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
addxwd:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add xxx.l,dx
|
||||
//--------------------------------------------------------------------
|
||||
addxld:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add d16(pc),dx
|
||||
//--------------------------------------------------------------------
|
||||
addd16pcd:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add d8(pc,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
addd8pcd:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// add dy,ea
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,(ay) (first ea->a1 z.B. f<>r a0,a1,USP)
|
||||
//--------------------------------------------------------------------
|
||||
addeda:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,(ay)+ (first ea->a1 z.B. f<>r a0,a1,USP)
|
||||
//--------------------------------------------------------------------
|
||||
addedai:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)+
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,(ay)+
|
||||
//--------------------------------------------------------------------
|
||||
addedaid:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2+
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
addedad:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 -(a1),d1
|
||||
move.l a1,\2
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
addedadd:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 -\2,d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,d16(ay)
|
||||
//--------------------------------------------------------------------
|
||||
adde16ad:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
mvs.\3 (a1),d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add.w d8(ay,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
adde8ad:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
move.l \1,d0
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
mvs.\3 \1,d0
|
||||
.endif
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
addxwe:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // add dx,xxx.l
|
||||
//--------------------------------------------------------------------
|
||||
addxle:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
add.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
/******************************************************/
|
||||
// adress register
|
||||
/******************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w ea,ax (ea = dx;ax;(ax);(ax)+,-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
addaw:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l a0,pc_off(a7) // pc auf next
|
||||
movem.l (a7),d0/d1/a0/a1 // register zurp<72>ck
|
||||
mvs.w \1,d0
|
||||
adda.l d0,\2
|
||||
move.l d0_off(a7),d0
|
||||
lea ii_ss(a7),a7 // stack erh<72>hen
|
||||
rte
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// add.w ea,usp
|
||||
//--------------------------------------------------------------------
|
||||
addawa7:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.w \1,d0
|
||||
move.l usp,a1
|
||||
add.l d0,a1
|
||||
move.l a1,usp
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w ea,usp (ea = dx;ax;(ax);(ax)+,-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
addawu:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l a0,pc_off(a7) // pc auf next
|
||||
movem.l (a7),d0/d1/a0/a1 // register zurp<72>ck
|
||||
move.l a7,_a7_save
|
||||
move.l usp,a7
|
||||
move.l \1,d0
|
||||
adda.l d0,\2
|
||||
move.l a7,usp
|
||||
move.l _a7_save,a7
|
||||
move.l d0_off(a7),d0
|
||||
lea ii_ss(a7),a7 // stack erh<72>hen
|
||||
rte
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w ea,usp (ea = a7 => dx;ax;(ax);(ax)+,-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
addawua7:.macro
|
||||
addawu \1,\2
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w d16(ay),ax
|
||||
//--------------------------------------------------------------------
|
||||
addawd16a:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.w (a0)+,d0
|
||||
adda.l d0,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
add.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
addawd8a:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
add.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w xxx.w,ax
|
||||
//--------------------------------------------------------------------
|
||||
addawxwax:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.w \1,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
adda.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w xxx.l,ax
|
||||
//--------------------------------------------------------------------
|
||||
addawxlax:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
adda.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w d16(pc),ax
|
||||
//--------------------------------------------------------------------
|
||||
addawd16pcax:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.w \1,a1
|
||||
adda.l a0,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
adda.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
addawd8pcax:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
adda.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.w #im,ax
|
||||
//--------------------------------------------------------------------
|
||||
addawim:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
mvs.w \1,d0
|
||||
move.l \2,a1
|
||||
adda.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.l d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
addald8a:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
move.l (a1),d0
|
||||
move.l \2,a1
|
||||
adda.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // adda.l d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
addakd8pcax:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
move.l (a1),d0
|
||||
move.l \2,a1
|
||||
adda.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//*****************************************************************************************
|
||||
// addx
|
||||
//*****************************************************************************************
|
||||
//--------------------------------------------------------------------
|
||||
// // addx dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
adddx:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.b sr_off+1(a7),d0 //ccr holen
|
||||
move d0,ccr //setzen
|
||||
mvs.\3 \2,d0
|
||||
mvs.\3 \1,d1
|
||||
addx.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\1
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // addx -(ay),-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
adddax:.macro
|
||||
#ifdef halten_add
|
||||
halt
|
||||
#endif
|
||||
move.b sr_off+1(a7),d0 //ccr holen
|
||||
move d0,ccr //setzen
|
||||
move.l \1,a1
|
||||
.ifc \3,l
|
||||
move.l -(a1),d0
|
||||
.else
|
||||
mvs.\3 -(a1),d0
|
||||
.endif
|
||||
move.l \2,a1
|
||||
.ifc \3,l
|
||||
move.l -(a1),d0
|
||||
.else
|
||||
mvs.\3 -(a1),d1
|
||||
.endif
|
||||
addx.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
441
sources/ii_and.h
441
sources/ii_and.h
@@ -1,441 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// and
|
||||
//--------------------------------------------------------------------
|
||||
/*****************************************************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// byt
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// and.b #im,dx
|
||||
//--------------------------------------------------------------------
|
||||
andbir_macro:.macro
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
mvs.b \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.b d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and ea,dx
|
||||
//--------------------------------------------------------------------
|
||||
anddd:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and ea(l)->dy(w),dx z.B. f<>r USP
|
||||
//--------------------------------------------------------------------
|
||||
andddd:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 a1,d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and (ea)->dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
anddda:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and ea->ay,(ay)+,dx
|
||||
//--------------------------------------------------------------------
|
||||
andddai:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1)+,d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and ea->ay,-(ay),dx
|
||||
//--------------------------------------------------------------------
|
||||
andddad:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 -(a1),d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and d16(ay),dx
|
||||
//--------------------------------------------------------------------
|
||||
andd16ad:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and d8(ay,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
andd8ad:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
andxwd:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and xxx.l,dx
|
||||
//--------------------------------------------------------------------
|
||||
andxld:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and d16(pc),dx
|
||||
//--------------------------------------------------------------------
|
||||
andd16pcd:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and d8(pc,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
andd8pcd:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// and dx,ea
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,(ea)->dy
|
||||
//--------------------------------------------------------------------
|
||||
andeda:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,ea->ay,(ay)+
|
||||
//--------------------------------------------------------------------
|
||||
andedai:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)+
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,ea->ay,(ay)+
|
||||
//--------------------------------------------------------------------
|
||||
andedaid:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2+
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,ea->ay,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
andedad:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 -(a1),d1
|
||||
move.l a1,\2
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,ea->ay,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
andedadd:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 -\2,d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,d16(ay)
|
||||
//--------------------------------------------------------------------
|
||||
ande16ad:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
mvs.\3 (a1),d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and.w dx,d8(ay,dy)
|
||||
//--------------------------------------------------------------------
|
||||
ande8ad:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
move.l \1,d0
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
mvs.\3 \1,d0
|
||||
.endif
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
andxwe:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // and dx,xxx.l
|
||||
//--------------------------------------------------------------------
|
||||
andxle:.macro
|
||||
#ifdef halten_and
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
and.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w ea,ax
|
||||
//--------------------------------------------------------------------
|
||||
andaw:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// and.w ea,usp
|
||||
//--------------------------------------------------------------------
|
||||
andawa7:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w usp?,ax
|
||||
//--------------------------------------------------------------------
|
||||
andawu:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w usp?,usp
|
||||
//--------------------------------------------------------------------
|
||||
andawua7:.macro
|
||||
andawu \1,\2
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w d16(ay),ax
|
||||
//--------------------------------------------------------------------
|
||||
andawd16a:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
andawd8a:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w xxx.w,ax
|
||||
//--------------------------------------------------------------------
|
||||
andawxwax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w xxx.l,ax
|
||||
//--------------------------------------------------------------------
|
||||
andawxlax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w d16(pc),ax
|
||||
//--------------------------------------------------------------------
|
||||
andawd16pcax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
andawd8pcax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.w #im,ax
|
||||
//--------------------------------------------------------------------
|
||||
andawim:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.l d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
andald8a:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // anda.l d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
andald8pcax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//*****************************************************************************************
|
||||
// spezial addx subx etc.
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// // addx dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
anddx:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // addx -(ay),-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
anddax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
@@ -1,117 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// dbcc,trapcc
|
||||
//--------------------------------------------------------------------
|
||||
.text
|
||||
ii_lset_dbcc:.macro
|
||||
// dbra
|
||||
ii_lset_opeau 51,c
|
||||
ii_lset_opeau 52,c
|
||||
ii_lset_opeau 53,c
|
||||
ii_lset_opeau 54,c
|
||||
ii_lset_opeau 55,c
|
||||
ii_lset_opeau 56,c
|
||||
ii_lset_opeau 57,c
|
||||
ii_lset_opeau 58,c
|
||||
ii_lset_opeau 59,c
|
||||
ii_lset_opeau 5a,c
|
||||
ii_lset_opeau 5b,c
|
||||
ii_lset_opeau 5c,c
|
||||
ii_lset_opeau 5d,c
|
||||
ii_lset_opeau 5e,c
|
||||
ii_lset_opeau 5f,c
|
||||
.endm
|
||||
|
||||
ii_dbcc_func:.macro
|
||||
ii_0x51c8:
|
||||
dbra_macro d0_off+2(a7)
|
||||
ii_0x51c9:
|
||||
dbra_macro d1_off+2(a7)
|
||||
ii_0x51ca:
|
||||
dbra_macro d2
|
||||
ii_0x51cb:
|
||||
dbra_macro d3
|
||||
ii_0x51cc:
|
||||
dbra_macro d4
|
||||
ii_0x51cd:
|
||||
dbra_macro d5
|
||||
ii_0x51ce:
|
||||
dbra_macro d6
|
||||
ii_0x51cf:
|
||||
dbra_macro d7
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// dbcc dx
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_dbcc 2,hi
|
||||
ii_dbcc 3,ls
|
||||
ii_dbcc 4,cc
|
||||
ii_dbcc 5,cs
|
||||
ii_dbcc 6,ne
|
||||
ii_dbcc 7,eq
|
||||
ii_dbcc 8,vc
|
||||
ii_dbcc 9,vs
|
||||
ii_dbcc a,pl
|
||||
ii_dbcc b,mi
|
||||
ii_dbcc c,ge
|
||||
ii_dbcc d,lt
|
||||
ii_dbcc e,gt
|
||||
ii_dbcc f,le
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// dbra dx
|
||||
//---------------------------------------------------------------------------------------------
|
||||
dbra_macro:.macro
|
||||
#ifdef halten_dbcc
|
||||
halt
|
||||
#endif
|
||||
mvz.w \1,d1 // dx holen
|
||||
subq.l #1,d1 // dx-1
|
||||
bcc dbra\@ // bra if plus?
|
||||
addq.l #2,a0 // offset <20>berspringen
|
||||
move.w d1,\1 // dx sichern
|
||||
ii_end
|
||||
dbra\@:
|
||||
move.w (a0),a1 // offset (wird auf long erweitert)
|
||||
add.l a1,a0 // dazuadieren
|
||||
move.w d1,\1 // dx sichern
|
||||
ii_end
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// dbcc dx
|
||||
//---------------------------------------------------------------------------------------------
|
||||
dbcc_macro:.macro
|
||||
#ifdef halten_dbcc
|
||||
halt
|
||||
#endif
|
||||
b\2 dbncc\@
|
||||
mvz.w \1,d1 // dx holen
|
||||
subq.l #1,d1 // dx-1
|
||||
bcc dbcc\@ // bra if plus?
|
||||
dbncc\@:
|
||||
addq.l #2,a0 // offset <20>berspringen
|
||||
move.w d1,\1 // dx sichern
|
||||
ii_end
|
||||
dbcc\@:
|
||||
move.w (a0),a1 // offset (wird auf long erweitert)
|
||||
add.l a1,a0 // dazuadieren
|
||||
move.w d1,\1 // dx sichern
|
||||
ii_end
|
||||
.endm
|
||||
//db
|
||||
ii_dbcc:.macro
|
||||
ii_0x5\1c8:
|
||||
dbcc_macro d0_off+2(a7),\2
|
||||
ii_0x5\1c9:
|
||||
dbcc_macro d1_off+2(a7),\2
|
||||
ii_0x5\1ca:
|
||||
dbcc_macro d2,\2
|
||||
ii_0x5\1cb:
|
||||
dbcc_macro d3,\2
|
||||
ii_0x5\1cc:
|
||||
dbcc_macro d4,\2
|
||||
ii_0x5\1cd:
|
||||
dbcc_macro d5,\2
|
||||
ii_0x5\1ce:
|
||||
dbcc_macro d6,\2
|
||||
ii_0x5\1cf:
|
||||
dbcc_macro d7,\2
|
||||
.endm
|
||||
181
sources/ii_ewf.h
181
sources/ii_ewf.h
@@ -1,181 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// extension word format missing
|
||||
//--------------------------------------------------------------------
|
||||
.text
|
||||
ii_ewf_lset:.macro
|
||||
// pea
|
||||
ii_lset_opeag 48,7
|
||||
ii_lset 0x487b
|
||||
// jmp
|
||||
ii_lset_opeag 4e,f
|
||||
ii_lset 0x4efb
|
||||
// jsr
|
||||
ii_lset_opeag 4e,b
|
||||
ii_lset 0x4ebb
|
||||
// tas
|
||||
ii_lset_opeag 4a,f
|
||||
ii_lset 0x4ebb
|
||||
// tst.b
|
||||
ii_lset_opeag 4a,3
|
||||
ii_lset 0x4ebb
|
||||
// tst.w
|
||||
ii_lset_opeag 4a,7
|
||||
ii_lset 0x4ebb
|
||||
// tst.l
|
||||
ii_lset_opeag 4a,b
|
||||
ii_lset 0x4ebb
|
||||
// clr.b
|
||||
ii_lset_opeag 42,3
|
||||
ii_lset 0x423b
|
||||
// clr.w
|
||||
ii_lset_opeag 42,7
|
||||
ii_lset 0x423b
|
||||
// clr.l
|
||||
ii_lset_opeag 42,b
|
||||
ii_lset 0x423b
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_ewf_func:.macro
|
||||
ewf_func_macro pea,487
|
||||
ewf_func_macro jmp,4ef
|
||||
ewf_func_macro jsr,4eb
|
||||
ewf_func_macro tas,4af
|
||||
ewf_func_macro tstb,4a3
|
||||
ewf_func_macro tstw,4a7
|
||||
ewf_func_macro tstl,4ab
|
||||
ewf_func_macro clrb,423
|
||||
ewf_func_macro clrw,427
|
||||
ewf_func_macro clrl,42b
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
pea_macro:.macro
|
||||
jsr ewf
|
||||
move.l (a1),d0
|
||||
move.l usp,a1
|
||||
move.l d0,-(a1)
|
||||
move.l a1,usp
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
jmp_macro:.macro
|
||||
jsr ewf
|
||||
move.l a1,a0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
jsr_macro:.macro
|
||||
jsr ewf
|
||||
move.l a1,d0
|
||||
move.l usp,a1
|
||||
move.l a0,-(a1)
|
||||
move.l a1,usp
|
||||
move.l d0,a0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
tas_macro:.macro
|
||||
jsr ewf
|
||||
tas (a1)
|
||||
set_cc0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
tstb_macro:.macro
|
||||
jsr ewf
|
||||
tst.b (a1)
|
||||
set_cc0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
tstw_macro:.macro
|
||||
jsr ewf
|
||||
tst.w (a1)
|
||||
set_cc0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
tstl_macro:.macro
|
||||
jsr ewf
|
||||
tst.l (a1)
|
||||
set_cc0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
clrb_macro:.macro
|
||||
jsr ewf
|
||||
clr.b (a1)
|
||||
set_cc0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
clrw_macro:.macro
|
||||
jsr ewf
|
||||
clr.w (a1)
|
||||
set_cc0
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
clrl_macro:.macro
|
||||
jsr ewf
|
||||
clr.l (a1)
|
||||
set_cc0
|
||||
ii_end
|
||||
.endm
|
||||
//--------------------------------------------------------------------
|
||||
ewf_func_macro:.macro //1=art 2=code
|
||||
ii_0x\20:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a0_off(a7),a1
|
||||
\1_macro
|
||||
ii_0x\21:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a1_off(a7),a1
|
||||
\1_macro
|
||||
ii_0x\22:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a2,a1
|
||||
\1_macro
|
||||
ii_0x\23:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a3,a1
|
||||
\1_macro
|
||||
ii_0x\24:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a4,a1
|
||||
\1_macro
|
||||
ii_0x\25:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a5,a1
|
||||
\1_macro
|
||||
ii_0x\26:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a6,a1
|
||||
\1_macro
|
||||
ii_0x\27:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l usp,a1
|
||||
\1_macro
|
||||
ii_0x\2b:
|
||||
#ifdef halten_ewf
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
\1_macro
|
||||
.endm
|
||||
|
||||
120
sources/ii_exg.h
120
sources/ii_exg.h
@@ -1,120 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// exg
|
||||
//--------------------------------------------------------------------
|
||||
.text
|
||||
ii_exg_lset:.macro
|
||||
/* ii_lset_dxu c,40 //dx,d0
|
||||
ii_lset_dxu c,41 //dx,d1
|
||||
ii_lset_dxu c,42 //dx,d2
|
||||
ii_lset_dxu c,43 //dx,d3
|
||||
ii_lset_dxu c,44 //dx,d4
|
||||
ii_lset_dxu c,45 //dx,d5
|
||||
ii_lset_dxu c,46 //dx,d6
|
||||
ii_lset_dxu c,47 //dx,d7
|
||||
ii_lset_dxu c,48 //ax,a0
|
||||
ii_lset_dxu c,49 //ax,a1
|
||||
ii_lset_dxu c,4a //ax,a2
|
||||
ii_lset_dxu c,4b //ax,a3
|
||||
ii_lset_dxu c,4c //ax,a4
|
||||
ii_lset_dxu c,4d //ax,a5
|
||||
ii_lset_dxu c,4e //ax,a6
|
||||
ii_lset_dxu c,4f //ax,a7 */ -->setting by "and"
|
||||
ii_lset_dxu c,88 //dx,a0
|
||||
ii_lset_dxu c,89 //dx,a1
|
||||
ii_lset_dxu c,8a //dx,a2
|
||||
ii_lset_dxu c,8b //dx,a3
|
||||
ii_lset_dxu c,8c //dx,a4
|
||||
ii_lset_dxu c,8d //dx,a5
|
||||
ii_lset_dxu c,8e //dx,a6
|
||||
ii_lset_dxu c,8f //dx,a7
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_exg_func:.macro
|
||||
// exg dx,dy
|
||||
ii_exg_dx_dx 14,d0_off(a7)
|
||||
ii_exg_dx_dx 34,d1_off(a7)
|
||||
ii_exg_dx_dx 54,d2
|
||||
ii_exg_dx_dx 74,d3
|
||||
ii_exg_dx_dx 94,d4
|
||||
ii_exg_dx_dx b4,d5
|
||||
ii_exg_dx_dx d4,d6
|
||||
ii_exg_dx_dx f4,d7
|
||||
// exg ax,ay
|
||||
ii_exg_to_ax 14,a0_off(a7)
|
||||
ii_exg_to_ax 34,a1_off(a7)
|
||||
ii_exg_to_ax 54,a2
|
||||
ii_exg_to_ax 74,a3
|
||||
ii_exg_to_ax 94,a4
|
||||
ii_exg_to_ax b4,a5
|
||||
ii_exg_to_ax d4,a6
|
||||
ii_exg_to_ax f4,usp
|
||||
// exg dx,ay
|
||||
ii_exg_to_ax 18,d0_off(a7)
|
||||
ii_exg_to_ax 38,d1_off(a7)
|
||||
ii_exg_to_ax 58,d2
|
||||
ii_exg_to_ax 78,d3
|
||||
ii_exg_to_ax 98,d4
|
||||
ii_exg_to_ax b8,d5
|
||||
ii_exg_to_ax d8,d6
|
||||
ii_exg_to_ax f8,d7
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
exg_macro:.macro
|
||||
#ifdef halten_exg
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
.ifc \2,usp
|
||||
move.l a1,d0
|
||||
move.l \2,a1
|
||||
move.l a1,\1
|
||||
move.l d0,a1
|
||||
.else
|
||||
.ifc \1,usp
|
||||
move.l a1,d0
|
||||
move.l \2,a1
|
||||
move.l a1,\1
|
||||
move.l d0,a1
|
||||
.else
|
||||
move.l \2,\1
|
||||
.endif
|
||||
.endif
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm
|
||||
ii_exg_dx_dx:.macro
|
||||
ii_0xc\10:
|
||||
exg_macro \2,d0_off(a7)
|
||||
ii_0xc\11:
|
||||
exg_macro \2,d1_off(a7)
|
||||
ii_0xc\12:
|
||||
exg_macro \2,d2
|
||||
ii_0xc\13:
|
||||
exg_macro \2,d3
|
||||
ii_0xc\14:
|
||||
exg_macro \2,d4
|
||||
ii_0xc\15:
|
||||
exg_macro \2,d5
|
||||
ii_0xc\16:
|
||||
exg_macro \2,d6
|
||||
ii_0xc\17:
|
||||
exg_macro \2,d7
|
||||
.endm
|
||||
ii_exg_to_ax:.macro
|
||||
ii_0xc\18:
|
||||
exg_macro \2,a0_off(a7)
|
||||
ii_0xc\19:
|
||||
exg_macro \2,a1_off(a7)
|
||||
ii_0xc\1a:
|
||||
exg_macro \2,a2
|
||||
ii_0xc\1b:
|
||||
exg_macro \2,a3
|
||||
ii_0xc\1c:
|
||||
exg_macro \2,a4
|
||||
ii_0xc\1d:
|
||||
exg_macro \2,a5
|
||||
ii_0xc\1e:
|
||||
exg_macro \2,a6
|
||||
ii_0xc\1f:
|
||||
exg_macro \2,usp
|
||||
.endm
|
||||
@@ -1,945 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// functionen macros
|
||||
//--------------------------------------------------------------------
|
||||
ii_lset_func:.macro
|
||||
/******************************************************/
|
||||
// byt
|
||||
/******************************************************/
|
||||
// func.b dy,dx
|
||||
ii_lset_dx \1,00 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
ii_lset_dx \1,01
|
||||
ii_lset_dx \1,02
|
||||
ii_lset_dx \1,03
|
||||
ii_lset_dx \1,04
|
||||
ii_lset_dx \1,05
|
||||
ii_lset_dx \1,06
|
||||
ii_lset_dx \1,07
|
||||
// func.b ax,dx
|
||||
ii_lset_dxu \1,08
|
||||
ii_lset_dxu \1,09
|
||||
ii_lset_dxu \1,0a
|
||||
ii_lset_dxu \1,0b
|
||||
ii_lset_dxu \1,0c
|
||||
ii_lset_dxu \1,0d
|
||||
ii_lset_dxu \1,0e
|
||||
ii_lset_dxu \1,0f
|
||||
// func.b (ax),dx
|
||||
ii_lset_dx \1,10
|
||||
ii_lset_dx \1,11
|
||||
ii_lset_dx \1,12
|
||||
ii_lset_dx \1,13
|
||||
ii_lset_dx \1,14
|
||||
ii_lset_dx \1,15
|
||||
ii_lset_dx \1,16
|
||||
ii_lset_dx \1,17
|
||||
// func.b (ax)+,dx
|
||||
ii_lset_dx \1,18
|
||||
ii_lset_dx \1,19
|
||||
ii_lset_dx \1,1a
|
||||
ii_lset_dx \1,1b
|
||||
ii_lset_dx \1,1c
|
||||
ii_lset_dx \1,1d
|
||||
ii_lset_dx \1,1e
|
||||
ii_lset_dx \1,1f
|
||||
// func.b -(ax),dx
|
||||
ii_lset_dx \1,20
|
||||
ii_lset_dx \1,21
|
||||
ii_lset_dx \1,22
|
||||
ii_lset_dx \1,23
|
||||
ii_lset_dx \1,24
|
||||
ii_lset_dx \1,25
|
||||
ii_lset_dx \1,26
|
||||
ii_lset_dx \1,27
|
||||
// func.b d16(ax),dx
|
||||
ii_lset_dx \1,28
|
||||
ii_lset_dx \1,29
|
||||
ii_lset_dx \1,2a
|
||||
ii_lset_dx \1,2b
|
||||
ii_lset_dx \1,2c
|
||||
ii_lset_dx \1,2d
|
||||
ii_lset_dx \1,2e
|
||||
ii_lset_dx \1,2f
|
||||
// func.b dd8(ax,dy),dx
|
||||
ii_lset_dx \1,30
|
||||
ii_lset_dx \1,31
|
||||
ii_lset_dx \1,32
|
||||
ii_lset_dx \1,33
|
||||
ii_lset_dx \1,34
|
||||
ii_lset_dx \1,35
|
||||
ii_lset_dx \1,36
|
||||
ii_lset_dx \1,37
|
||||
// func.b xxx.w,dx
|
||||
ii_lset_dx \1,38 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.b xxx.l,dx
|
||||
ii_lset_dx \1,39 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.b d16(pc),dx
|
||||
ii_lset_dxg \1,7a // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.b d8(pc,dy),dx
|
||||
ii_lset_dxg \1,3b // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.b #im,dx
|
||||
ii_lset_dxg \1,3c // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
/******************************************************/
|
||||
// word
|
||||
/******************************************************/
|
||||
// func.w dy,dx
|
||||
ii_lset_dx \1,40 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
ii_lset_dx \1,41
|
||||
ii_lset_dx \1,42
|
||||
ii_lset_dx \1,43
|
||||
ii_lset_dx \1,44
|
||||
ii_lset_dx \1,45
|
||||
ii_lset_dx \1,46
|
||||
ii_lset_dx \1,47
|
||||
// func.w ax,dx
|
||||
ii_lset_dx \1,48
|
||||
ii_lset_dx \1,49
|
||||
ii_lset_dx \1,4a
|
||||
ii_lset_dx \1,4b
|
||||
ii_lset_dx \1,4c
|
||||
ii_lset_dx \1,4d
|
||||
ii_lset_dx \1,4e
|
||||
ii_lset_dx \1,4f
|
||||
// func.w (ax),dx
|
||||
ii_lset_dx \1,50
|
||||
ii_lset_dx \1,51
|
||||
ii_lset_dx \1,52
|
||||
ii_lset_dx \1,53
|
||||
ii_lset_dx \1,54
|
||||
ii_lset_dx \1,55
|
||||
ii_lset_dx \1,56
|
||||
ii_lset_dx \1,57
|
||||
// func.w (ax)+,dx
|
||||
ii_lset_dx \1,58
|
||||
ii_lset_dx \1,59
|
||||
ii_lset_dx \1,5a
|
||||
ii_lset_dx \1,5b
|
||||
ii_lset_dx \1,5c
|
||||
ii_lset_dx \1,5d
|
||||
ii_lset_dx \1,5e
|
||||
ii_lset_dx \1,5f
|
||||
// func.w -(ax),dx
|
||||
ii_lset_dx \1,60
|
||||
ii_lset_dx \1,61
|
||||
ii_lset_dx \1,62
|
||||
ii_lset_dx \1,63
|
||||
ii_lset_dx \1,64
|
||||
ii_lset_dx \1,65
|
||||
ii_lset_dx \1,66
|
||||
ii_lset_dx \1,67
|
||||
// func.w d16(ax),dx
|
||||
ii_lset_dx \1,68
|
||||
ii_lset_dx \1,69
|
||||
ii_lset_dx \1,6a
|
||||
ii_lset_dx \1,6b
|
||||
ii_lset_dx \1,6c
|
||||
ii_lset_dx \1,6d
|
||||
ii_lset_dx \1,6e
|
||||
ii_lset_dx \1,6f
|
||||
// func.w d8(ax,dy),dx
|
||||
ii_lset_dx \1,70
|
||||
ii_lset_dx \1,71
|
||||
ii_lset_dx \1,72
|
||||
ii_lset_dx \1,73
|
||||
ii_lset_dx \1,74
|
||||
ii_lset_dx \1,75
|
||||
ii_lset_dx \1,76
|
||||
ii_lset_dx \1,77
|
||||
// func.w xxx.w,dx
|
||||
ii_lset_dx \1,78 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.w xxx.l,dx
|
||||
ii_lset_dx \1,79 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.w d16(pc),dx
|
||||
ii_lset_dxg \1,7a // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.w d8(pc,dy),dx
|
||||
ii_lset_dxg \1,7b // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
// func.w #im,dx
|
||||
ii_lset_dxg \1,7c // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
/******************************************************/
|
||||
// long
|
||||
/******************************************************/
|
||||
// func.l ax,dx -> -(ay),-(ax)
|
||||
ii_lset_dxu \1,c8
|
||||
ii_lset_dxu \1,c9
|
||||
ii_lset_dxu \1,ca
|
||||
ii_lset_dxu \1,cb
|
||||
ii_lset_dxu \1,cc
|
||||
ii_lset_dxu \1,cd
|
||||
ii_lset_dxu \1,ce
|
||||
ii_lset_dxu \1,cf
|
||||
// func.w d8(ax,dy),dx
|
||||
ii_lset_dx \1,b0
|
||||
ii_lset_dx \1,b1
|
||||
ii_lset_dx \1,b2
|
||||
ii_lset_dx \1,b3
|
||||
ii_lset_dx \1,b4
|
||||
ii_lset_dx \1,b5
|
||||
ii_lset_dx \1,b6
|
||||
ii_lset_dx \1,b7
|
||||
// func.l d8(pc,dy),dx
|
||||
ii_lset_dxg \1,bb // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
/******************************************************/
|
||||
// adress register
|
||||
/******************************************************/
|
||||
//func.w dy,ax
|
||||
ii_lset_dxg \1,c0
|
||||
ii_lset_dxg \1,c1
|
||||
ii_lset_dxg \1,c2
|
||||
ii_lset_dxg \1,c3
|
||||
ii_lset_dxg \1,c4
|
||||
ii_lset_dxg \1,c5
|
||||
ii_lset_dxg \1,c6
|
||||
ii_lset_dxg \1,c7
|
||||
//func.w ay,ax
|
||||
ii_lset_dxg \1,c8
|
||||
ii_lset_dxg \1,c9
|
||||
ii_lset_dxg \1,ca
|
||||
ii_lset_dxg \1,cb
|
||||
ii_lset_dxg \1,cc
|
||||
ii_lset_dxg \1,cd
|
||||
ii_lset_dxg \1,ce
|
||||
ii_lset_dxg \1,cf
|
||||
//func.w (ay),ax
|
||||
ii_lset_dxg \1,d0
|
||||
ii_lset_dxg \1,d1
|
||||
ii_lset_dxg \1,d2
|
||||
ii_lset_dxg \1,d3
|
||||
ii_lset_dxg \1,d4
|
||||
ii_lset_dxg \1,d5
|
||||
ii_lset_dxg \1,d6
|
||||
ii_lset_dxg \1,d7
|
||||
//func.w (ay)+,ax
|
||||
ii_lset_dxg \1,d8
|
||||
ii_lset_dxg \1,d9
|
||||
ii_lset_dxg \1,da
|
||||
ii_lset_dxg \1,db
|
||||
ii_lset_dxg \1,dc
|
||||
ii_lset_dxg \1,dd
|
||||
ii_lset_dxg \1,de
|
||||
ii_lset_dxg \1,df
|
||||
//func.w -(ay),ax
|
||||
ii_lset_dxg \1,e0
|
||||
ii_lset_dxg \1,e1
|
||||
ii_lset_dxg \1,e2
|
||||
ii_lset_dxg \1,e3
|
||||
ii_lset_dxg \1,e4
|
||||
ii_lset_dxg \1,e5
|
||||
ii_lset_dxg \1,e6
|
||||
ii_lset_dxg \1,e7
|
||||
//func.w d16(ay),ax
|
||||
ii_lset_dxg \1,e8
|
||||
ii_lset_dxg \1,e9
|
||||
ii_lset_dxg \1,ea
|
||||
ii_lset_dxg \1,eb
|
||||
ii_lset_dxg \1,ec
|
||||
ii_lset_dxg \1,ed
|
||||
ii_lset_dxg \1,ee
|
||||
ii_lset_dxg \1,ef
|
||||
//func.w d8(ay,dy),ax
|
||||
ii_lset_dxg \1,f0
|
||||
ii_lset_dxg \1,f1
|
||||
ii_lset_dxg \1,f2
|
||||
ii_lset_dxg \1,f3
|
||||
ii_lset_dxg \1,f4
|
||||
ii_lset_dxg \1,f5
|
||||
ii_lset_dxg \1,f6
|
||||
ii_lset_dxg \1,f7
|
||||
// func.w xxx.w,ax
|
||||
ii_lset_dxg \1,f8
|
||||
// func.w xxx.l,ax
|
||||
ii_lset_dxg \1,f9
|
||||
// func.w d16(pc),ax
|
||||
ii_lset_dxg \1,fa
|
||||
// func.w d8(pc,dy),ax
|
||||
ii_lset_dxg \1,fb
|
||||
// func.w #im,ax
|
||||
ii_lset_dxg \1,fc
|
||||
//--------------------------------------------------------------------
|
||||
// ende
|
||||
.endm;
|
||||
/*****************************************************************************************/
|
||||
ii_func:.macro
|
||||
//--------------------------------------------------------------------
|
||||
// byt
|
||||
//--------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------
|
||||
// func.b ds,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,00,\2dd,d0_off+3(a7)
|
||||
funcbeadx \1,01,\2dd,d1_off+3(a7)
|
||||
funcbeadx \1,02,\2dd,d2
|
||||
funcbeadx \1,03,\2dd,d3
|
||||
funcbeadx \1,04,\2dd,d4
|
||||
funcbeadx \1,05,\2dd,d5
|
||||
funcbeadx \1,06,\2dd,d6
|
||||
funcbeadx \1,07,\2dd,d7
|
||||
//--------------------------------------------------------------------
|
||||
// func.b (ax),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,10,\2dda,a0_off(a7)
|
||||
funcbeadx \1,11,\2dda,a1_off(a7)
|
||||
funcbeadx \1,12,\2dd,(a2)
|
||||
funcbeadx \1,13,\2dd,(a3)
|
||||
funcbeadx \1,14,\2dd,(a4)
|
||||
funcbeadx \1,15,\2dd,(a5)
|
||||
funcbeadx \1,16,\2dd,(a6)
|
||||
funcbeadx \1,17,\2dda,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b (ax)+,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,18,\2ddai,a0_off(a7)
|
||||
funcbeadx \1,19,\2ddai,a1_off(a7)
|
||||
funcbeadx \1,1a,\2dd,(a2)+
|
||||
funcbeadx \1,1b,\2dd,(a3)+
|
||||
funcbeadx \1,1c,\2dd,(a4)+
|
||||
funcbeadx \1,1d,\2dd,(a5)+
|
||||
funcbeadx \1,1e,\2dd,(a6)+
|
||||
funcbeadx \1,1f,\2ddai,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b -(ax),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,20,\2ddad,a0_off(a7)
|
||||
funcbeadx \1,21,\2ddad,a1_off(a7)
|
||||
funcbeadx \1,22,\2dd,-(a2)
|
||||
funcbeadx \1,23,\2dd,-(a3)
|
||||
funcbeadx \1,24,\2dd,-(a4)
|
||||
funcbeadx \1,25,\2dd,-(a5)
|
||||
funcbeadx \1,26,\2dd,-(a6)
|
||||
funcbeadx \1,27,\2ddad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b d16(ax),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,28,\2d16ad,a0_off(a7)
|
||||
funcbeadx \1,29,\2d16ad,a1_off(a7)
|
||||
funcbeadx \1,2a,\2d16ad,a2
|
||||
funcbeadx \1,2b,\2d16ad,a3
|
||||
funcbeadx \1,2c,\2d16ad,a4
|
||||
funcbeadx \1,2d,\2d16ad,a5
|
||||
funcbeadx \1,2e,\2d16ad,a6
|
||||
funcbeadx \1,2f,\2d16ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b d8(ax,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,30,\2d8ad,a0_off(a7)
|
||||
funcbeadx \1,31,\2d8ad,a1_off(a7)
|
||||
funcbeadx \1,32,\2d8ad,a2
|
||||
funcbeadx \1,33,\2d8ad,a3
|
||||
funcbeadx \1,34,\2d8ad,a4
|
||||
funcbeadx \1,35,\2d8ad,a5
|
||||
funcbeadx \1,36,\2d8ad,a6
|
||||
funcbeadx \1,37,\2d8ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,38,\2xwd,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.b xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,39,\2xld,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.b d16(pc),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,3a,\2d16pcd,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.b d8(pc,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,3b,\2d8pcd,(a0)+ (a0 wird nicht verwendet)
|
||||
//--------------------------------------------------------------------
|
||||
// func.b #im,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcbeadx \1,3c,\2bir_macro,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.b dy,ea
|
||||
//--------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------
|
||||
// func.b dx,dd -> addx subx etc. src und dest vertauscht!
|
||||
//--------------------------------------------------------------------
|
||||
funcbdxea \1,00,\2dx,d0_off+3(a7)
|
||||
funcbdxea \1,01,\2dx,d1_off+3(a7)
|
||||
funcbdxea \1,02,\2dx,d2
|
||||
funcbdxea \1,03,\2dx,d3
|
||||
funcbdxea \1,04,\2dx,d4
|
||||
funcbdxea \1,05,\2dx,d5
|
||||
funcbdxea \1,06,\2dx,d6
|
||||
funcbdxea \1,07,\2dx,d7
|
||||
//--------------------------------------------------------------------
|
||||
// func.b -(ax),-(ay) addx subx etc. src und dest vertauscht!
|
||||
//--------------------------------------------------------------------
|
||||
funcaxay \1,08,\2dax,a0_off(a7),b
|
||||
funcaxay \1,09,\2dax,a1_off(a7).b
|
||||
funcaxay \1,0a,\2dax,a2,b
|
||||
funcaxay \1,0b,\2dax,a3,b
|
||||
funcaxay \1,0c,\2dax,a4,b
|
||||
funcaxay \1,0d,\2dax,a5,b
|
||||
funcaxay \1,0e,\2dax,a6,b
|
||||
funcaxay \1,0f,\2dax,usp,b
|
||||
//--------------------------------------------------------------------
|
||||
// func.b dy,(ax)
|
||||
//--------------------------------------------------------------------
|
||||
funcbdxea \1,10,\2eda,a0_off(a7)
|
||||
funcbdxea \1,11,\2eda,a1_off(a7)
|
||||
funcbdxea \1,12,\2dd,(a2)
|
||||
funcbdxea \1,13,\2dd,(a3)
|
||||
funcbdxea \1,14,\2dd,(a4)
|
||||
funcbdxea \1,15,\2dd,(a5)
|
||||
funcbdxea \1,16,\2dd,(a6)
|
||||
funcbdxea \1,17,\2eda,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b dy,(ax)+
|
||||
//--------------------------------------------------------------------
|
||||
funcbdxea \1,18,\2edai,a0_off(a7)
|
||||
funcbdxea \1,19,\2edai,a1_off(a7)
|
||||
funcbdxea \1,1a,\2edaid,(a2)
|
||||
funcbdxea \1,1b,\2edaid,(a3)
|
||||
funcbdxea \1,1c,\2edaid,(a4)
|
||||
funcbdxea \1,1d,\2edaid,(a5)
|
||||
funcbdxea \1,1e,\2edaid,(a6)
|
||||
funcbdxea \1,1f,\2edai,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b dy,-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
funcbdxea \1,20,\2edad,a0_off(a7)
|
||||
funcbdxea \1,21,\2edad,a1_off(a7)
|
||||
funcbdxea \1,22,\2edadd,(a2)
|
||||
funcbdxea \1,23,\2edadd,(a3)
|
||||
funcbdxea \1,24,\2edadd,(a4)
|
||||
funcbdxea \1,25,\2edadd,(a5)
|
||||
funcbdxea \1,26,\2edadd,(a6)
|
||||
funcbdxea \1,27,\2edad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b dy,d16(ax)
|
||||
//--------------------------------------------------------------------
|
||||
funcbdxea \1,28,\2e16ad,a0_off(a7)
|
||||
funcbdxea \1,29,\2e16ad,a1_off(a7)
|
||||
funcbdxea \1,2a,\2e16ad,a2
|
||||
funcbdxea \1,2b,\2e16ad,a3
|
||||
funcbdxea \1,2c,\2e16ad,a4
|
||||
funcbdxea \1,2d,\2e16ad,a5
|
||||
funcbdxea \1,2e,\2e16ad,a6
|
||||
funcbdxea \1,2f,\2e16ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.b dy,d8(ax,dy)
|
||||
//--------------------------------------------------------------------
|
||||
funcbdxea \1,30,\2e8ad,a0_off(a7)
|
||||
funcbdxea \1,31,\2e8ad,a1_off(a7)
|
||||
funcbdxea \1,32,\2e8ad,a2
|
||||
funcbdxea \1,33,\2e8ad,a3
|
||||
funcbdxea \1,34,\2e8ad,a4
|
||||
funcbdxea \1,35,\2e8ad,a5
|
||||
funcbdxea \1,36,\2e8ad,a6
|
||||
funcbdxea \1,37,\2e8ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,38,\2xwe,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,39,\2xld,(a0)+
|
||||
/*****************************************************************************************/
|
||||
// word
|
||||
/*****************************************************************************************/
|
||||
// func.w ds,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,40,\2dd,d0_off+2(a7)
|
||||
funcweadx \1,41,\2dd,d1_off+2(a7)
|
||||
funcweadx \1,42,\2dd,d2
|
||||
funcweadx \1,43,\2dd,d3
|
||||
funcweadx \1,44,\2dd,d4
|
||||
funcweadx \1,45,\2dd,d5
|
||||
funcweadx \1,46,\2dd,d6
|
||||
funcweadx \1,47,\2dd,d7
|
||||
//--------------------------------------------------------------------
|
||||
// func.w ax,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,48,\2dd,a0_off+2(a7)
|
||||
funcweadx \1,49,\2dd,a1_off+2(a7)
|
||||
funcweadx \1,4a,\2dd,a2
|
||||
funcweadx \1,4b,\2dd,a3
|
||||
funcweadx \1,4c,\2dd,a4
|
||||
funcweadx \1,4d,\2dd,a5
|
||||
funcweadx \1,4e,\2dd,a6
|
||||
funcweadx \1,4f,\2ddd,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w (ax),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,50,\2dda,a0_off(a7)
|
||||
funcweadx \1,51,\2dda,a1_off(a7)
|
||||
funcweadx \1,52,\2dd,(a2)
|
||||
funcweadx \1,53,\2dd,(a3)
|
||||
funcweadx \1,54,\2dd,(a4)
|
||||
funcweadx \1,55,\2dd,(a5)
|
||||
funcweadx \1,56,\2dd,(a6)
|
||||
funcweadx \1,57,\2dda,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w (ax)+,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,58,\2ddai,a0_off(a7)
|
||||
funcweadx \1,59,\2ddai,a1_off(a7)
|
||||
funcweadx \1,5a,\2dd,(a2)+
|
||||
funcweadx \1,5b,\2dd,(a3)+
|
||||
funcweadx \1,5c,\2dd,(a4)+
|
||||
funcweadx \1,5d,\2dd,(a5)+
|
||||
funcweadx \1,5e,\2dd,(a6)+
|
||||
funcweadx \1,5f,\2ddai,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w -(ax),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,60,\2ddad,a0_off(a7)
|
||||
funcweadx \1,61,\2ddad,a1_off(a7)
|
||||
funcweadx \1,62,\2dd,-(a2)
|
||||
funcweadx \1,63,\2dd,-(a3)
|
||||
funcweadx \1,64,\2dd,-(a4)
|
||||
funcweadx \1,65,\2dd,-(a5)
|
||||
funcweadx \1,66,\2dd,-(a6)
|
||||
funcweadx \1,67,\2ddad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d16(ax),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,68,\2d16ad,a0_off(a7)
|
||||
funcweadx \1,69,\2d16ad,a1_off(a7)
|
||||
funcweadx \1,6a,\2d16ad,a2
|
||||
funcweadx \1,6b,\2d16ad,a3
|
||||
funcweadx \1,6c,\2d16ad,a4
|
||||
funcweadx \1,6d,\2d16ad,a5
|
||||
funcweadx \1,6e,\2d16ad,a6
|
||||
funcweadx \1,6f,\2d16ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d8(ax,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,70,\2d8ad,a0_off(a7)
|
||||
funcweadx \1,71,\2d8ad,a1_off(a7)
|
||||
funcweadx \1,72,\2d8ad,a2
|
||||
funcweadx \1,73,\2d8ad,a3
|
||||
funcweadx \1,74,\2d8ad,a4
|
||||
funcweadx \1,75,\2d8ad,a5
|
||||
funcweadx \1,76,\2d8ad,a6
|
||||
funcweadx \1,77,\2d8ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,78,\2xwd,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,79,\2xld,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d16(pc),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,7a,\2d16pcd,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d8(pc,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,7b,\2d8pcd,(a0)+ (a0 wird nicht verwendet)
|
||||
//--------------------------------------------------------------------
|
||||
// func.w #im,dx
|
||||
//--------------------------------------------------------------------
|
||||
funcweadx \1,7c,\2dd,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,ea
|
||||
//--------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------
|
||||
// func.w dx,dd -> addx subx etc.
|
||||
//--------------------------------------------------------------------
|
||||
.ifnc \2,and //platz f<>r exg
|
||||
funcwdxea \1,40,\2dx,d0_off+2(a7)
|
||||
funcwdxea \1,41,\2dx,d1_off+2(a7)
|
||||
funcwdxea \1,42,\2dx,d2
|
||||
funcwdxea \1,43,\2dx,d3
|
||||
funcwdxea \1,44,\2dx,d4
|
||||
funcwdxea \1,45,\2dx,d5
|
||||
funcwdxea \1,46,\2dx,d6
|
||||
funcwdxea \1,47,\2dx,d7
|
||||
//--------------------------------------------------------------------
|
||||
// func.w -(ax),-(ay) -> addx,subx
|
||||
//--------------------------------------------------------------------
|
||||
funcaxay \1,48,\2dax,a0_off(a7),w
|
||||
funcaxay \1,49,\2dax,a1_off(a7).w
|
||||
funcaxay \1,4a,\2dax,a2,w
|
||||
funcaxay \1,4b,\2dax,a3,w
|
||||
funcaxay \1,4c,\2dax,a4,w
|
||||
funcaxay \1,4d,\2dax,a5,w
|
||||
funcaxay \1,4e,\2dax,a6,w
|
||||
funcaxay \1,4f,\2dax,usp,w
|
||||
.endif
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,(ax)
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,50,\2eda,a0_off(a7)
|
||||
funcwdxea \1,51,\2eda,a1_off(a7)
|
||||
funcwdxea \1,52,\2dd,(a2)
|
||||
funcwdxea \1,53,\2dd,(a3)
|
||||
funcwdxea \1,54,\2dd,(a4)
|
||||
funcwdxea \1,55,\2dd,(a5)
|
||||
funcwdxea \1,56,\2dd,(a6)
|
||||
funcwdxea \1,57,\2eda,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,(ax)+
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,58,\2edai,a0_off(a7)
|
||||
funcwdxea \1,59,\2edai,a1_off(a7)
|
||||
funcwdxea \1,5a,\2edaid,(a2)
|
||||
funcwdxea \1,5b,\2edaid,(a3)
|
||||
funcwdxea \1,5c,\2edaid,(a4)
|
||||
funcwdxea \1,5d,\2edaid,(a5)
|
||||
funcwdxea \1,5e,\2edaid,(a6)
|
||||
funcwdxea \1,5f,\2edai,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,60,\2edad,a0_off(a7)
|
||||
funcwdxea \1,61,\2edad,a1_off(a7)
|
||||
funcwdxea \1,62,\2edadd,(a2)
|
||||
funcwdxea \1,63,\2edadd,(a3)
|
||||
funcwdxea \1,64,\2edadd,(a4)
|
||||
funcwdxea \1,65,\2edadd,(a5)
|
||||
funcwdxea \1,66,\2edadd,(a6)
|
||||
funcwdxea \1,67,\2edad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,d16(ax)
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,68,\2e16ad,a0_off(a7)
|
||||
funcwdxea \1,69,\2e16ad,a1_off(a7)
|
||||
funcwdxea \1,6a,\2e16ad,a2
|
||||
funcwdxea \1,6b,\2e16ad,a3
|
||||
funcwdxea \1,6c,\2e16ad,a4
|
||||
funcwdxea \1,6d,\2e16ad,a5
|
||||
funcwdxea \1,6e,\2e16ad,a6
|
||||
funcwdxea \1,6f,\2e16ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,d8(ax,dy)
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,70,\2e8ad,a0_off(a7)
|
||||
funcwdxea \1,71,\2e8ad,a1_off(a7)
|
||||
funcwdxea \1,72,\2e8ad,a2
|
||||
funcwdxea \1,73,\2e8ad,a3
|
||||
funcwdxea \1,74,\2e8ad,a4
|
||||
funcwdxea \1,75,\2e8ad,a5
|
||||
funcwdxea \1,76,\2e8ad,a6
|
||||
funcwdxea \1,77,\2e8ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,78,\2xwe,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dy,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
funcwdxea \1,79,\2xld,(a0)+
|
||||
/*****************************************************************************************/
|
||||
// long
|
||||
/*****************************************************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// func.l -(ax),-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
funcaxay \1,c8,\2dax,a0_off(a7),l
|
||||
funcaxay \1,c9,\2dax,a1_off(a7).l
|
||||
funcaxay \1,ca,\2dax,a2,l
|
||||
funcaxay \1,cb,\2dax,a3,l
|
||||
funcaxay \1,cc,\2dax,a4,l
|
||||
funcaxay \1,cd,\2dax,a5,l
|
||||
funcaxay \1,ce,\2dax,a6,l
|
||||
funcaxay \1,cf,\2dax,usp,l
|
||||
//--------------------------------------------------------------------
|
||||
// func.l d8(ax,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcleadx \1,b0,\2d8ad,a0_off(a7)
|
||||
funcleadx \1,b1,\2d8ad,a1_off(a7)
|
||||
funcleadx \1,b2,\2d8ad,a2
|
||||
funcleadx \1,b3,\2d8ad,a3
|
||||
funcleadx \1,b4,\2d8ad,a4
|
||||
funcleadx \1,b5,\2d8ad,a5
|
||||
funcleadx \1,b6,\2d8ad,a6
|
||||
funcleadx \1,b7,\2d8ad,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.l d8(pc,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
funcleadx \1,bb,\2d8pcd,(a0)+ (a0 wird nicht verwendet)
|
||||
//--------------------------------------------------------------------
|
||||
// func.l dy,d8(ax,dy)
|
||||
//--------------------------------------------------------------------
|
||||
funcldxea \1,b0,\2e8ad,a0_off(a7)
|
||||
funcldxea \1,b1,\2e8ad,a1_off(a7)
|
||||
funcldxea \1,b2,\2e8ad,a2
|
||||
funcldxea \1,b3,\2e8ad,a3
|
||||
funcldxea \1,b4,\2e8ad,a4
|
||||
funcldxea \1,b5,\2e8ad,a5
|
||||
funcldxea \1,b6,\2e8ad,a6
|
||||
funcldxea \1,b7,\2e8ad,usp
|
||||
/******************************************************/
|
||||
// adress register
|
||||
/******************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// func.w ea,ax
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// func.w dx,ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaax \1,c0,\2aw,d0
|
||||
funcweaax \1,c1,\2aw,d1
|
||||
funcweaax \1,c2,\2aw,d2
|
||||
funcweaax \1,c3,\2aw,d3
|
||||
funcweaax \1,c4,\2aw,d4
|
||||
funcweaax \1,c5,\2aw,d5
|
||||
funcweaax \1,c6,\2aw,d6
|
||||
funcweaax \1,c7,\2aw,d7
|
||||
//--------------------------------------------------------------------
|
||||
// func.w ay,ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaax \1,c8,\2aw,a0
|
||||
funcweaax \1,c9,\2aw,a1
|
||||
funcweaax \1,ca,\2aw,a2
|
||||
funcweaax \1,cb,\2aw,a3
|
||||
funcweaax \1,cc,\2aw,a4
|
||||
funcweaax \1,cd,\2aw,a5
|
||||
funcweaax \1,ce,\2aw,a6
|
||||
funcweaax \1,cf,\2awu,a7
|
||||
//--------------------------------------------------------------------
|
||||
// func.w (ay),ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaax \1,d0,\2aw,(a0)
|
||||
funcweaax \1,d1,\2aw,(a1)
|
||||
funcweaax \1,d2,\2aw,(a2)
|
||||
funcweaax \1,d3,\2aw,(a3)
|
||||
funcweaax \1,d4,\2aw,(a4)
|
||||
funcweaax \1,d5,\2aw,(a5)
|
||||
funcweaax \1,d6,\2aw,(a6)
|
||||
funcweaax \1,d7,\2awu,(a7)
|
||||
//--------------------------------------------------------------------
|
||||
// func.w (ay)+,ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaax \1,d8,\2aw,(a0)+
|
||||
funcweaax \1,d9,\2aw,(a1)+
|
||||
funcweaax \1,da,\2aw,(a2)+
|
||||
funcweaax \1,db,\2aw,(a3)+
|
||||
funcweaax \1,dc,\2aw,(a4)+
|
||||
funcweaax \1,dd,\2aw,(a5)+
|
||||
funcweaax \1,de,\2aw,(a6)+
|
||||
funcweaax \1,df,\2awu,(a7)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w -(ay),ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaax \1,e0,\2aw,-(a0)
|
||||
funcweaax \1,e1,\2aw,-(a1)
|
||||
funcweaax \1,e2,\2aw,-(a2)
|
||||
funcweaax \1,e3,\2aw,-(a3)
|
||||
funcweaax \1,e4,\2aw,-(a4)
|
||||
funcweaax \1,e5,\2aw,-(a5)
|
||||
funcweaax \1,e6,\2aw,-(a6)
|
||||
funcweaax \1,e7,\2awu,-(a7)
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d16(ay),ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaaxn \1,e8,\2awd16a,a0_off(a7)
|
||||
funcweaaxn \1,e9,\2awd16a,a1_off(a7)
|
||||
funcweaaxn \1,ea,\2awd16a,a2
|
||||
funcweaaxn \1,eb,\2awd16a,a3
|
||||
funcweaaxn \1,ec,\2awd16a,a4
|
||||
funcweaaxn \1,ed,\2awd16a,a5
|
||||
funcweaaxn \1,ee,\2awd16a,a6
|
||||
funcweaaxn \1,ef,\2awd16a,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaaxn \1,f0,\2awd8a,a0_off(a7)
|
||||
funcweaaxn \1,f1,\2awd8a,a1_off(a7)
|
||||
funcweaaxn \1,f2,\2awd8a,a2
|
||||
funcweaaxn \1,f3,\2awd8a,a3
|
||||
funcweaaxn \1,f4,\2awd8a,a4
|
||||
funcweaaxn \1,f5,\2awd8a,a5
|
||||
funcweaaxn \1,f6,\2awd8a,a6
|
||||
funcweaaxn \1,f7,\2awd8a,usp
|
||||
//--------------------------------------------------------------------
|
||||
// func.w xxx.w,ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaaxn \1,f8,\2awxwax,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w xxxlw,ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaaxn \1,f9,\2awxlax,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d16(pc),ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaaxn \1,fa,\2awd16pcax,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// func.w d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaaxn \1,fb,\2awd8pcax,(a0)+ //(a0 wird nicht verwendet)
|
||||
//--------------------------------------------------------------------
|
||||
// func.w #im,ax
|
||||
//--------------------------------------------------------------------
|
||||
funcweaaxn \1,fc,\2awim,(a0)+
|
||||
//--------------------------------------------------------------------
|
||||
// ende
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// byt
|
||||
funcbeadx:.macro // function byt: im,dx
|
||||
ii_0x\10\2:
|
||||
\3 \4,d0_off+3(a7),b
|
||||
ii_0x\12\2:
|
||||
\3 \4,d1_off+3(a7),b
|
||||
ii_0x\14\2:
|
||||
\3 \4,d2,b
|
||||
ii_0x\16\2:
|
||||
\3 \4,d3,b
|
||||
ii_0x\18\2:
|
||||
\3 \4,d4,b
|
||||
ii_0x\1a\2:
|
||||
\3 \4,d5,b
|
||||
ii_0x\1c\2:
|
||||
\3 \4,d6,b
|
||||
ii_0x\1e\2:
|
||||
\3 \4,d7,b
|
||||
.endm;
|
||||
funcbdxea:.macro // ea(\4) function(\3) dx -> ea
|
||||
ii_0x\11\2:
|
||||
\3 d0_off+3(a7),\4,b
|
||||
ii_0x\13\2:
|
||||
\3 d1_off+3(a7),\4,b
|
||||
ii_0x\15\2:
|
||||
\3 d2,\4,b
|
||||
ii_0x\17\2:
|
||||
\3 d3,\4,b
|
||||
ii_0x\19\2:
|
||||
\3 d4,\4,b
|
||||
ii_0x\1b\2:
|
||||
\3 d5,\4,b
|
||||
ii_0x\1d\2:
|
||||
\3 d6,\4,b
|
||||
ii_0x\1f\2:
|
||||
\3 d7,\4,b
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// word
|
||||
funcweadx:.macro // dx function(\3) ea(\4) -> dx
|
||||
ii_0x\10\2:
|
||||
\3 \4,d0_off+2(a7),w
|
||||
ii_0x\12\2:
|
||||
\3 \4,d1_off+2(a7),w
|
||||
ii_0x\14\2:
|
||||
\3 \4,d2,w
|
||||
ii_0x\16\2:
|
||||
\3 \4,d3,w
|
||||
ii_0x\18\2:
|
||||
\3 \4,d4,w
|
||||
ii_0x\1a\2:
|
||||
\3 \4,d5,w
|
||||
ii_0x\1c\2:
|
||||
\3 \4,d6,w
|
||||
ii_0x\1e\2:
|
||||
\3 \4,d7,w
|
||||
.endm;
|
||||
funcwdxea:.macro // ea(\4) function(\3) dx -> ea
|
||||
ii_0x\11\2:
|
||||
\3 d0_off+2(a7),\4,w
|
||||
ii_0x\13\2:
|
||||
\3 d1_off+2(a7),\4,w
|
||||
ii_0x\15\2:
|
||||
\3 d2,\4,w
|
||||
ii_0x\17\2:
|
||||
\3 d3,\4,w
|
||||
ii_0x\19\2:
|
||||
\3 d4,\4,w
|
||||
ii_0x\1b\2:
|
||||
\3 d5,\4,w
|
||||
ii_0x\1d\2:
|
||||
\3 d6,\4,w
|
||||
ii_0x\1f\2:
|
||||
\3 d7,\4,w
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// long
|
||||
funcleadx:.macro // dx function(\3) ea(\4) -> dx
|
||||
ii_0x\10\2:
|
||||
\3 \4,d0_off(a7),w
|
||||
ii_0x\12\2:
|
||||
\3 \4,d1_off(a7),w
|
||||
ii_0x\14\2:
|
||||
\3 \4,d2,w
|
||||
ii_0x\16\2:
|
||||
\3 \4,d3,w
|
||||
ii_0x\18\2:
|
||||
\3 \4,d4,w
|
||||
ii_0x\1a\2:
|
||||
\3 \4,d5,w
|
||||
ii_0x\1c\2:
|
||||
\3 \4,d6,w
|
||||
ii_0x\1e\2:
|
||||
\3 \4,d7,w
|
||||
.endm;
|
||||
funcldxea:.macro // ea(\4) function(\3) dx -> ea
|
||||
ii_0x\11\2:
|
||||
\3 d0_off(a7),\4,w
|
||||
ii_0x\13\2:
|
||||
\3 d1_off(a7),\4,w
|
||||
ii_0x\15\2:
|
||||
\3 d2,\4,w
|
||||
ii_0x\17\2:
|
||||
\3 d3,\4,w
|
||||
ii_0x\19\2:
|
||||
\3 d4,\4,w
|
||||
ii_0x\1b\2:
|
||||
\3 d5,\4,w
|
||||
ii_0x\1d\2:
|
||||
\3 d6,\4,w
|
||||
ii_0x\1f\2:
|
||||
\3 d7,\4,w
|
||||
.endm;
|
||||
//--------------------------------------------------------------
|
||||
// address
|
||||
funcweaax:.macro // ax function(\3) ea(\4)(ext long!) -> ax
|
||||
ii_0x\10\2:
|
||||
\3 \4,a0
|
||||
ii_0x\12\2:
|
||||
\3 \4,a1
|
||||
ii_0x\14\2:
|
||||
\3 \4,a2
|
||||
ii_0x\16\2:
|
||||
\3 \4,a3
|
||||
ii_0x\18\2:
|
||||
\3 \4,a4
|
||||
ii_0x\1a\2:
|
||||
\3 \4,a5
|
||||
ii_0x\1c\2:
|
||||
\3 \4,a6
|
||||
ii_0x\1e\2:
|
||||
\3a7 \4,a7 // "a7" beachten wegen usp
|
||||
.endm;
|
||||
funcweaaxn:.macro // ax function(\3) ea(\4)(ext long!) -> ax
|
||||
ii_0x\10\2:
|
||||
\3 \4,a0_off(a7)
|
||||
ii_0x\12\2:
|
||||
\3 \4,a1_off(a7)
|
||||
ii_0x\14\2:
|
||||
\3 \4,a2
|
||||
ii_0x\16\2:
|
||||
\3 \4,a3
|
||||
ii_0x\18\2:
|
||||
\3 \4,a4
|
||||
ii_0x\1a\2:
|
||||
\3 \4,a5
|
||||
ii_0x\1c\2:
|
||||
\3 \4,a6
|
||||
ii_0x\1e\2:
|
||||
\3 \4,usp
|
||||
.endm;
|
||||
//--------------------------------------------------------------
|
||||
// byt, word, long
|
||||
//--------------------------------------------------------------
|
||||
funcaxay:.macro // ea(\4) function(\3) dx -> ea,\5 = size
|
||||
ii_0x\11\2:
|
||||
\3 a0_off(a7),\4,\5
|
||||
ii_0x\13\2:
|
||||
\3 a1_off(a7),\4,\5
|
||||
ii_0x\15\2:
|
||||
\3 a2,\4,\5
|
||||
ii_0x\17\2:
|
||||
\3 a3,\4,\5
|
||||
ii_0x\19\2:
|
||||
\3 a4,\4,\5
|
||||
ii_0x\1b\2:
|
||||
\3 a5,\4,\5
|
||||
ii_0x\1d\2:
|
||||
\3 a6,\4,\5
|
||||
ii_0x\1f\2:
|
||||
\3 usp,\4,\5
|
||||
.endm;
|
||||
@@ -1,59 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// extension word format missing
|
||||
//--------------------------------------------------------------------
|
||||
ii_\1_func:.macro
|
||||
ii_0x\20:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a0_off(a7),a1
|
||||
\1_macro
|
||||
ii_0x\21:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a1_off(a7),a1
|
||||
\1_macro
|
||||
ii_0x\22:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a2,a1
|
||||
\1_macro
|
||||
ii_0x\23:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a3,a1
|
||||
\1_macro
|
||||
ii_0x\24:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a4,a1
|
||||
\1_macro
|
||||
ii_0x\25:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a5,a1
|
||||
\1_macro
|
||||
ii_0x\26:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a6,a1
|
||||
\1_macro
|
||||
ii_0x\27:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l usp,a1
|
||||
\1_macro
|
||||
ii_0x\2b:
|
||||
#ifdef halten_\1
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
\1_macro
|
||||
.endm
|
||||
105
sources/ii_lea.h
105
sources/ii_lea.h
@@ -1,105 +0,0 @@
|
||||
//-------------------------------------------------------------------
|
||||
// lea
|
||||
//-------------------------------------------------------------------
|
||||
.text
|
||||
ii_lea_lset:.macro
|
||||
ii_lset_dxu 4,f0 // lea d8(a0,dy.w),a0-a7
|
||||
ii_lset_dxu 4,f1 // lea d8(a1,dy.w),a0-a7
|
||||
ii_lset_dxu 4,f2 // lea d8(a2,dy.w),a0-a7
|
||||
ii_lset_dxu 4,f3 // lea d8(a3,dy.w),a0-a7
|
||||
ii_lset_dxu 4,f4 // lea d8(a4,dy.w),a0-a7
|
||||
ii_lset_dxu 4,f5 // lea d8(a5,dy.w),a0-a7
|
||||
ii_lset_dxu 4,f6 // lea d8(a6,dy.w),a0-a7
|
||||
ii_lset_dxu 4,f7 // lea d8(a7,dy.w),a0-a7
|
||||
ii_lset_dxu 4,fb // lea d8(pc,dy.w),a0-a7
|
||||
.endm
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// function
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_lea_sub:.macro
|
||||
ii_0x4\1\2:
|
||||
#ifdef halten_lea
|
||||
halt
|
||||
#endif
|
||||
move.l \4,a1
|
||||
jsr ewf
|
||||
move.l a1,\3
|
||||
ii_end
|
||||
.endm
|
||||
ii_lea_func:.macro
|
||||
//lea d8(ax,dy.w),a0-a7
|
||||
ii_lea_sub 1,f0,a0_off(a7),a0_off(a7)
|
||||
ii_lea_sub 1,f1,a0_off(a7),a1_off(a7)
|
||||
ii_lea_sub 1,f2,a0_off(a7),a2
|
||||
ii_lea_sub 1,f3,a0_off(a7),a3
|
||||
ii_lea_sub 1,f4,a0_off(a7),a4
|
||||
ii_lea_sub 1,f5,a0_off(a7),a5
|
||||
ii_lea_sub 1,f6,a0_off(a7),a6
|
||||
ii_lea_sub 1,f7,a0_off(a7),usp
|
||||
ii_lea_sub 3,f0,a1_off(a7),a0_off(a7)
|
||||
ii_lea_sub 3,f1,a1_off(a7),a1_off(a7)
|
||||
ii_lea_sub 3,f2,a1_off(a7),a2
|
||||
ii_lea_sub 3,f3,a1_off(a7),a3
|
||||
ii_lea_sub 3,f4,a1_off(a7),a4
|
||||
ii_lea_sub 3,f5,a1_off(a7),a5
|
||||
ii_lea_sub 3,f6,a1_off(a7),a6
|
||||
ii_lea_sub 3,f7,a1_off(a7),usp
|
||||
ii_lea_sub 5,f0,a2,a0_off(a7)
|
||||
ii_lea_sub 5,f1,a2,a1_off(a7)
|
||||
ii_lea_sub 5,f2,a2,a2
|
||||
ii_lea_sub 5,f3,a2,a3
|
||||
ii_lea_sub 5,f4,a2,a4
|
||||
ii_lea_sub 5,f5,a2,a5
|
||||
ii_lea_sub 5,f6,a2,a6
|
||||
ii_lea_sub 5,f7,a2,usp
|
||||
ii_lea_sub 7,f0,a3,a0_off(a7)
|
||||
ii_lea_sub 7,f1,a3,a1_off(a7)
|
||||
ii_lea_sub 7,f2,a3,a2
|
||||
ii_lea_sub 7,f3,a3,a3
|
||||
ii_lea_sub 7,f4,a3,a4
|
||||
ii_lea_sub 7,f5,a3,a5
|
||||
ii_lea_sub 7,f6,a3,a6
|
||||
ii_lea_sub 7,f7,a3,usp
|
||||
ii_lea_sub 9,f0,a4,a0_off(a7)
|
||||
ii_lea_sub 9,f1,a4,a1_off(a7)
|
||||
ii_lea_sub 9,f2,a4,a2
|
||||
ii_lea_sub 9,f3,a4,a3
|
||||
ii_lea_sub 9,f4,a4,a4
|
||||
ii_lea_sub 9,f5,a4,a5
|
||||
ii_lea_sub 9,f6,a4,a6
|
||||
ii_lea_sub 9,f7,a4,usp
|
||||
ii_lea_sub b,f0,a5,a0_off(a7)
|
||||
ii_lea_sub b,f1,a5,a1_off(a7)
|
||||
ii_lea_sub b,f2,a5,a2
|
||||
ii_lea_sub b,f3,a5,a3
|
||||
ii_lea_sub b,f4,a5,a4
|
||||
ii_lea_sub b,f5,a5,a5
|
||||
ii_lea_sub b,f6,a5,a6
|
||||
ii_lea_sub b,f7,a6,usp
|
||||
ii_lea_sub d,f0,a6,a0_off(a7)
|
||||
ii_lea_sub d,f1,a6,a1_off(a7)
|
||||
ii_lea_sub d,f2,a6,a2
|
||||
ii_lea_sub d,f3,a6,a3
|
||||
ii_lea_sub d,f4,a6,a4
|
||||
ii_lea_sub d,f5,a6,a5
|
||||
ii_lea_sub d,f6,a6,a6
|
||||
ii_lea_sub d,f7,a6,usp
|
||||
ii_lea_sub f,f0,usp,a0_off(a7)
|
||||
ii_lea_sub f,f1,usp,a1_off(a7)
|
||||
ii_lea_sub f,f2,usp,a2
|
||||
ii_lea_sub f,f3,usp,a3
|
||||
ii_lea_sub f,f4,usp,a4
|
||||
ii_lea_sub f,f5,usp,a5
|
||||
ii_lea_sub f,f6,usp,a6
|
||||
ii_lea_sub f,f7,usp,usp
|
||||
// lea d8(pc,dy.w),az
|
||||
ii_lea_sub 1,fb,a0_off(a7),a0
|
||||
ii_lea_sub 3,fb,a1_off(a7),a0
|
||||
ii_lea_sub 5,fb,a2,a0
|
||||
ii_lea_sub 7,fb,a3,a0
|
||||
ii_lea_sub 9,fb,a4,a0
|
||||
ii_lea_sub b,fb,a5,a0
|
||||
ii_lea_sub d,fb,a6,a0
|
||||
ii_lea_sub f,fb,usp,a0
|
||||
.endm
|
||||
@@ -1,144 +0,0 @@
|
||||
/*******************************************************/
|
||||
// constanten
|
||||
/*******************************************************/
|
||||
.extern ___RAMBAR1
|
||||
.extern _rt_cacr
|
||||
.extern _rt_mod
|
||||
.extern _rt_ssp
|
||||
.extern _rt_usp
|
||||
.extern _rt_vbr
|
||||
.extern _d0_save
|
||||
.extern _a7_save
|
||||
|
||||
ii_ss = 16
|
||||
d0_off = 0
|
||||
d1_off = 4
|
||||
a0_off = 8
|
||||
a1_off = 12
|
||||
format_off = 16
|
||||
sr_off = 18
|
||||
ccr_off = 19
|
||||
pc_off = 20
|
||||
|
||||
#define table 0x20000000-0x8000-0xF000*4 // Adresse Sprungtabelle -> 8000=Sprungbereich mod cod, 61k(ohne 0xFxxx!)x4= tabelle
|
||||
|
||||
/*******************************************************/
|
||||
// allgemeine macros
|
||||
/*******************************************************/
|
||||
ii_end: .macro
|
||||
move.l a0,pc_off(a7)
|
||||
movem.l (a7),d0/d1/a0/a1
|
||||
lea ii_ss(a7),a7
|
||||
rte
|
||||
.endm;
|
||||
|
||||
set_cc0:.macro
|
||||
move.w ccr,d0
|
||||
move.b d0,ccr_off(a7)
|
||||
.endm;
|
||||
|
||||
ii_esr: .macro // geht nicht!!??
|
||||
movem.l (a7),d0/d1/a0/a1
|
||||
lea ii_ss+8(a7),a7 // stack erh<72>hen
|
||||
move.w d0,_d0_save // d0.w sicheren
|
||||
move.w -6(a7),d0 // sr holen
|
||||
move.w d0,sr // sr setzen
|
||||
nop
|
||||
move.w _d0_save,d0 // d0.w zur<75>ck
|
||||
.endm;
|
||||
|
||||
ii_end_mvm:.macro
|
||||
move.l a0_off(a7),a0
|
||||
lea 16(a7),a7
|
||||
rte
|
||||
.endm;
|
||||
|
||||
ii_endj:.macro
|
||||
movem.l (a7),d0/d1/a0/a1 // register zur<75>ck
|
||||
lea ii_ss(a7),a7 // korr
|
||||
rte // ende
|
||||
.endm;
|
||||
|
||||
set_nzvc:.macro // set ccr bits nzvc
|
||||
move.w ccr,d1
|
||||
bclr #4,d1
|
||||
btst #4,ccr_off(a7)
|
||||
beq snzvc2\@
|
||||
bset #4,d1
|
||||
snzvc2\@:
|
||||
move.b d1,ccr_off(a7)
|
||||
.endm;
|
||||
|
||||
set_cc1:.macro
|
||||
move.w ccr,d1
|
||||
move.b d1,ccr_off(a7)
|
||||
.endm;
|
||||
|
||||
set_cc_b:.macro
|
||||
move.w ccr,d1
|
||||
btst #7,d0 // byt negativ?
|
||||
beq set_cc_b2\@
|
||||
bset #3,d1 // make negativ
|
||||
set_cc_b2\@:
|
||||
move.b d1,ccr_off(a7)
|
||||
.endm;
|
||||
|
||||
set_cc_w:.macro
|
||||
move.w ccr,d1
|
||||
btst #15,d0 // byt negativ?
|
||||
beq set_cc_w2\@
|
||||
bset #3,d1 // make negativ
|
||||
set_cc_w2\@:
|
||||
move.b d1,ccr_off(a7)
|
||||
.endm;
|
||||
|
||||
get_pc: .macro
|
||||
lea.l (a0),a1
|
||||
.endm;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
ii_lset:.macro offs
|
||||
lea table+\offs*4,a0
|
||||
move.l #ii_\offs,(a0)
|
||||
.endm;
|
||||
ii_lset_dx:.macro // 0x1.22 -> z.B. 1=d,2=4 ->0xd040 -> 0xde40
|
||||
ii_lset_dxg \1,\2
|
||||
ii_lset_dxu \1,\2
|
||||
.endm;
|
||||
ii_lset_dxg:.macro // gerade: 0x1.22 -> z.B. 1=d,2=4 ->0xd040 -> 0xde40
|
||||
lea table+0x\10\2*4,a0
|
||||
move.l #ii_0x\10\2,(a0)
|
||||
lea 0x800(a0),a0 // 4 * 0x200
|
||||
move.l #ii_0x\12\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\14\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\16\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\18\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\1a\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\1c\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\1e\2,(a0)
|
||||
.endm;
|
||||
ii_lset_dxu:.macro // ungerade: 0x1.22 -> z.B. 1=d,2=4 ->0xd140 -> 0xdf40
|
||||
lea table+0x\11\2*4,a0
|
||||
move.l #ii_0x\11\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\13\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\15\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\17\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\19\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\1b\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\1d\2,(a0)
|
||||
lea 0x800(a0),a0
|
||||
move.l #ii_0x\1f\2,(a0)
|
||||
.endm;
|
||||
|
||||
1270
sources/ii_move.h
1270
sources/ii_move.h
File diff suppressed because it is too large
Load Diff
@@ -1,374 +0,0 @@
|
||||
//***********************************************************************************/
|
||||
// movem
|
||||
//***********************************************************************************/
|
||||
ii_movem_lset: .macro
|
||||
// movem.l rx,xxx.L
|
||||
ii_lset 0x48f9
|
||||
// movem.l xxx.L,rx
|
||||
ii_lset 0x4cf9
|
||||
// movem.w rx,xxx.L
|
||||
ii_lset 0x48b9
|
||||
// movem.w xxx.L,rx
|
||||
ii_lset 0x4cb9
|
||||
// movem.l rx,-(ax)
|
||||
ii_lset 0x48e0
|
||||
ii_lset 0x48e1
|
||||
ii_lset 0x48e2
|
||||
ii_lset 0x48e3
|
||||
ii_lset 0x48e4
|
||||
ii_lset 0x48e5
|
||||
ii_lset 0x48e6
|
||||
ii_lset 0x48e7
|
||||
// movem.l (ax)+,rx
|
||||
ii_lset 0x4cd8
|
||||
ii_lset 0x4cd9
|
||||
ii_lset 0x4cda
|
||||
ii_lset 0x4cdb
|
||||
ii_lset 0x4cdc
|
||||
ii_lset 0x4cdd
|
||||
ii_lset 0x4cde
|
||||
ii_lset 0x4cdf
|
||||
.endm
|
||||
//***********************************************************************************/
|
||||
ii_movem_func: .macro
|
||||
//-------------------------------------------------------------------
|
||||
// movem.l
|
||||
//--------------------------------------------------------------------
|
||||
// movem.l (ax)+,reg
|
||||
//--------------------------------------------------------------------
|
||||
.long 0
|
||||
az_reg_table:
|
||||
.byte 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 // 0-f
|
||||
.byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 10-1f
|
||||
.byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 20-2f
|
||||
.byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 30-3f
|
||||
.byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 40-4f
|
||||
.byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 50
|
||||
.byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 60
|
||||
.byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // 70
|
||||
.byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 80-8f
|
||||
.byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 90
|
||||
.byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // a0
|
||||
.byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // b0
|
||||
.byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // c0
|
||||
.byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // d0
|
||||
.byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // e0
|
||||
.byte 4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8 // f0
|
||||
//-------------------------------------------------------------------------------
|
||||
ii_0x48e0: // movem.l reglist,-(a0)
|
||||
mvm_mem_macro 0x48d0,a0_off(a7),2
|
||||
ii_0x48e1: // movem.l reglist,-(a1)
|
||||
mvm_mem_macro 0x48d1,a1_off(a7),2
|
||||
ii_0x48e2: // movem.l reglist,-(a2)
|
||||
mvm_mem_macro 0x48d2,a2,2
|
||||
ii_0x48e3: // movem.l reglist,-(a3)
|
||||
mvm_mem_macro 0x48d3,a3,2
|
||||
ii_0x48e4: // movem.l reglist,-(a4)
|
||||
mvm_mem_macro 0x48d4,a4,2
|
||||
ii_0x48e5: // movem.l reglist,-(a5)
|
||||
mvm_mem_macro 0x48d5,a5,2
|
||||
ii_0x48e6: // movem.l reglist,-(a6)
|
||||
mvm_mem_macro 0x48d6,a6,2
|
||||
ii_0x48e7: // movem.l reglist,-(a7)
|
||||
mvm_mem_macro 0x48d7,usp,2
|
||||
//-------------------------------------------------------------------------------
|
||||
ii_0x4cd8: // movem.l (a0)+,reglist
|
||||
mvm_reg_macro 0x4cd0,0x41e8,2
|
||||
ii_0x4cd9: // movem.l (a1)+,reglist
|
||||
mvm_reg_macro 0x4cd1,0x43e9,2
|
||||
ii_0x4cda: // movem.l (a2)+,reglist
|
||||
mvm_reg_macro 0x4cd2,0x45ea,2
|
||||
ii_0x4cdb: // movem.l (a3)+,reglist
|
||||
mvm_reg_macro 0x4cd3,0x47eb,2
|
||||
ii_0x4cdc: // movem.l (a4)+,reglist
|
||||
mvm_reg_macro 0x4cd4,0x49ec,2
|
||||
ii_0x4cdd: // movem.l (a5)+,reglist
|
||||
mvm_reg_macro 0x4cd5,0x4bed,2
|
||||
ii_0x4cde: // movem.l (a6)+,reglist
|
||||
mvm_reg_macro 0x4cd6,0x4dee,2
|
||||
ii_0x4cdf: // movem.l (a7)+,reglist
|
||||
mvm_reg_macro 0x4cd7,0x4fef,2
|
||||
//----------------------------------------------------------------------------
|
||||
ii_0x48f9: // movem.l reg,xxx.L
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,d0
|
||||
move.l (a0)+,a1
|
||||
movemrm_macro l
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_0x4cf9: // movem.l xxx.L,reg
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,d0
|
||||
move.l (a0)+,a1
|
||||
movemmr_macro l
|
||||
//----------------------------------------------------------------------------
|
||||
ii_0x48b9: // movem.w reg,xxx.L
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,d0
|
||||
move.l (a0)+,a1
|
||||
movemrm_macro w
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_0x4cb9: // movem.w xxx.L,reg
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,d0
|
||||
move.l (a0)+,a1
|
||||
movemmr_macro w
|
||||
.endm
|
||||
//==============================================================
|
||||
mvm_mem_macro:.macro
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
lea az_reg_table,a1
|
||||
mvz.b (a0),d1
|
||||
mvz.b 0(a1,d1)+,d0
|
||||
mvz.b 1(a0),d1
|
||||
mvz.b 0(a1,d1)+,d1
|
||||
add.l d0,d1
|
||||
lsl.l #\3,d1 // * anzahl byts pro wert
|
||||
move.l \2,a1
|
||||
sub.l d1,a1 // ax-anzahl byts
|
||||
move.l a1,\2
|
||||
lea ___RAMBAR1,a1
|
||||
move.l a1,pc_off(a7)
|
||||
move.l a1,d0
|
||||
addq.l #1,d0
|
||||
movec d0,RAMBAR1
|
||||
move.w #\1,(a1)+ // movem.x reg_list,-(a7)
|
||||
move.w (a0)+,(a1)+ // register list
|
||||
move.w #0x4ef9,(a1)+ // jmp.l
|
||||
move.l a0,(a1) // r<>cksprungadresse
|
||||
move.l #___RAMBAR1 + 0x81,d0 // instruction
|
||||
movec d0,RAMBAR1
|
||||
movem.l (a7),d0/d1/a0/a1
|
||||
lea ii_ss(a7),a7 // stack erh<72>hen
|
||||
rte
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------
|
||||
mvm_reg_macro:.macro
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
lea az_reg_table,a1
|
||||
mvz.b (a0),d1
|
||||
mvz.b 0(a1,d1)+,d0
|
||||
mvz.b 1(a0),d1
|
||||
mvz.b 0(a1,d1)+,d1
|
||||
add.l d0,d1
|
||||
lea ___RAMBAR1,a1
|
||||
move.l a1,pc_off(a7)
|
||||
move.l a1,d0
|
||||
addq.l #1,d0
|
||||
movec d0,RAMBAR1
|
||||
move.w #\1,(a1)+ // movem.x (ax),reg_list
|
||||
move.w (a0)+,(a1)+ // register list
|
||||
move.w #\2,(a1)+ // lea 0(ax),ax
|
||||
lsl.l #\3,d1 // * anzahl byts pro wert
|
||||
move.w d1,(a1)+ // offset von lea
|
||||
move.w #0x4ef9,(a1)+ // jmp.l
|
||||
move.l a0,(a1) // r<>cksprungadresse
|
||||
move.l #___RAMBAR1 + 0x81,d0 // instruction
|
||||
movec d0,RAMBAR1
|
||||
movem.l (a7),d0/d1/a0/a1
|
||||
lea ii_ss(a7),a7 // stack erh<72>hen
|
||||
rte
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------
|
||||
movemrm_macro:.macro // in d0 register liste, in a1 zieladresse
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
tst.b d0 // datenregister zu verschieben?
|
||||
bne mrm_dx\@ // ja->
|
||||
lsr.l #8,d0 // sonst zu addressregister
|
||||
jmp mmrm_nd7\@ // ->
|
||||
mrm_dx\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd0\@
|
||||
.ifc 1,l
|
||||
move.l d0_off(a7),(a1)+
|
||||
.else
|
||||
move.w d0_off+2(a7),(a1)+
|
||||
.endif
|
||||
mmrm_nd0\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd1\@
|
||||
.ifc 1,l
|
||||
move.l d1_off(a7),(a1)+
|
||||
.else
|
||||
move.w d1_off+2(a7),(a1)+
|
||||
.endif
|
||||
mmrm_nd1\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd2\@
|
||||
move.\1 d2,(a1)+
|
||||
mmrm_nd2\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd3\@
|
||||
move.\1 d3,(a1)+
|
||||
mmrm_nd3\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd4\@
|
||||
move.\1 d4,(a1)+
|
||||
mmrm_nd4\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd5\@
|
||||
move.\1 d5,(a1)+
|
||||
mmrm_nd5\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd6\@
|
||||
move.l d6,(a1)+
|
||||
mmrm_nd6\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_nd7\@
|
||||
move.\1 d7,(a1)+
|
||||
mmrm_nd7\@:
|
||||
tst.b d0 // addressregister zu verschieben?
|
||||
beq mmrm_na7\@
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na0\@
|
||||
.ifc 1,l
|
||||
move.l a0_off(a7),(a1)+
|
||||
.else
|
||||
move.w a0_off+2(a7),(a1)+
|
||||
.endif
|
||||
mmrm_na0\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na1\@
|
||||
.ifc 1,l
|
||||
move.l a1_off(a7),(a1)+
|
||||
.else
|
||||
move.w a1_off+2(a7),(a1)+
|
||||
.endif
|
||||
mmrm_na1\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na2\@
|
||||
move.\1 a2,(a1)+
|
||||
mmrm_na2\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na3\@
|
||||
move.\1 a3,(a1)+
|
||||
mmrm_na3\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na4\@
|
||||
move.\1 a4,(a1)+
|
||||
mmrm_na4\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na5\@
|
||||
move.\1 a5,(a1)+
|
||||
mmrm_na5\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na6\@
|
||||
move.\1 a6,(a1)+
|
||||
mmrm_na6\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmrm_na7\@
|
||||
move.l a0,d1 // sichern
|
||||
move.l usp,a0 // ist ja usp
|
||||
move.\1 a0,(a1)+ // nach a0
|
||||
move.l d1,a0 // pc zur<75>ck
|
||||
mmrm_na7\@:
|
||||
ii_end
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
movemmr_macro:.macro // in d0 register liste, in a1 source adr
|
||||
#ifdef halten_movem
|
||||
halt
|
||||
#endif
|
||||
tst.b d0 // datenregister zu verschieben?
|
||||
bne mmr_dx\@ // ja->
|
||||
lsr.l #8,d0 // sonst zu addressregister
|
||||
bra mmmr_nd7\@ // ->
|
||||
mmr_dx\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd0\@
|
||||
.ifc 1,l
|
||||
move.l (a1)+,d0_off(a7)
|
||||
.else
|
||||
move.w (a1)+,d0_off+2(a7)
|
||||
.endif
|
||||
mmmr_nd0\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd1\@
|
||||
.ifc 1,l
|
||||
move.l (a1)+,d1_off(a7)
|
||||
.else
|
||||
move.w (a1)+,d1_off+2(a7)
|
||||
.endif
|
||||
mmmr_nd1\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd2\@
|
||||
move.\1 (a1)+,d2
|
||||
mmmr_nd2\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd3\@
|
||||
move.\1 (a1)+,d3
|
||||
mmmr_nd3\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd4\@
|
||||
move.\1 (a1)+,d4
|
||||
mmmr_nd4\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd5\@
|
||||
move.\1 (a1)+,d5
|
||||
mmmr_nd5\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd6\@
|
||||
move.\1 (a1)+,d6
|
||||
mmmr_nd6\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_nd7\@
|
||||
move.\1 (a1)+,d7
|
||||
mmmr_nd7\@:
|
||||
tst.b d0 // addressregister zu verschieben?
|
||||
beq mmmr_na7\@ // nein->
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na0\@
|
||||
.ifc 1,l
|
||||
move.l (a1)+,a0_off(a7)
|
||||
.else
|
||||
move.w (a1)+,a0_off+2(a7)
|
||||
.endif
|
||||
mmmr_na0\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na1\@
|
||||
.ifc 1,l
|
||||
move.l (a1)+,a1_off(a7)
|
||||
.else
|
||||
move.w (a1)+,a1_off+2(a7)
|
||||
.endif
|
||||
mmmr_na1\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na2\@
|
||||
move.\1 (a1)+,a2
|
||||
mmmr_na2\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na3\@
|
||||
move.\1 (a1)+,a3
|
||||
mmmr_na3\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na4\@
|
||||
move.\1 (a1)+,a4
|
||||
mmmr_na4\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na5\@
|
||||
move.\1 (a1)+,a5
|
||||
mmmr_na5\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na6\@
|
||||
move.\1 (a1)+,a6
|
||||
mmmr_na6\@:
|
||||
lsr.l #1,d0
|
||||
bcc mmmr_na7\@
|
||||
move.\1 (a1)+,a1 // nach a0
|
||||
move.l a1,usp // war ja usp
|
||||
mmmr_na7\@:
|
||||
ii_end
|
||||
.endm
|
||||
@@ -1,179 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// movep
|
||||
//--------------------------------------------------------------------
|
||||
.text
|
||||
ii_movep_lset:.macro
|
||||
ii_lset_opeau 01,0 //movep.w d(a0-7),d0
|
||||
ii_lset_opeau 03,0 //movep.w d(a0-7),d1
|
||||
ii_lset_opeau 05,0 //movep.w d(a0-7),d2
|
||||
ii_lset_opeau 07,0 //movep.w d(a0-7),d3
|
||||
ii_lset_opeau 09,0 //movep.w d(a0-7),d4
|
||||
ii_lset_opeau 0b,0 //movep.w d(a0-7),d5
|
||||
ii_lset_opeau 0d,0 //movep.w d(a0-7),d6
|
||||
ii_lset_opeau 0f,0 //movep.w d(a0-7),d7
|
||||
|
||||
ii_lset_opeau 01,4 //movep.w d0,d(a0-7)
|
||||
ii_lset_opeau 03,4 //movep.w d1,d(a0-7)
|
||||
ii_lset_opeau 05,4 //movep.w d2,d(a0-7)
|
||||
ii_lset_opeau 07,4 //movep.w d3,d(a0-7)
|
||||
ii_lset_opeau 09,4 //movep.w d4,d(a0-7)
|
||||
ii_lset_opeau 0b,4 //movep.w d5,d(a0-7)
|
||||
ii_lset_opeau 0d,4 //movep.w d6,d(a0-7)
|
||||
ii_lset_opeau 0f,4 //movep.w d7,d(a0-7)
|
||||
|
||||
ii_lset_opeau 01,8 //movep.l d(a0-7),d0
|
||||
ii_lset_opeau 03,8 //movep.l d(a0-7),d1
|
||||
ii_lset_opeau 05,8 //movep.l d(a0-7),d2
|
||||
ii_lset_opeau 07,8 //movep.l d(a0-7),d3
|
||||
ii_lset_opeau 09,8 //movep.l d(a0-7),d4
|
||||
ii_lset_opeau 0b,8 //movep.l d(a0-7),d5
|
||||
ii_lset_opeau 0d,8 //movep.l d(a0-7),d6
|
||||
ii_lset_opeau 0f,8 //movep.l d(a0-7),d7
|
||||
|
||||
ii_lset_opeau 01,c //movep.l d0,d(a0-7)
|
||||
ii_lset_opeau 03,c //movep.l d1,d(a0-7)
|
||||
ii_lset_opeau 05,c //movep.l d2,d(a0-7)
|
||||
ii_lset_opeau 07,c //movep.l d3,d(a0-7)
|
||||
ii_lset_opeau 09,c //movep.l d4,d(a0-7)
|
||||
ii_lset_opeau 0b,c //movep.l d5,d(a0-7)
|
||||
ii_lset_opeau 0d,c //movep.l d6,d(a0-7)
|
||||
ii_lset_opeau 0f,c //movep.l d7,d(a0-7)
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_movep_func:.macro
|
||||
//movep.w d(a0-7),d0-7
|
||||
ii_movep 010,d0_off(a7),wad
|
||||
ii_movep 030,d1_off(a7),wad
|
||||
ii_movep 050,d2,wad
|
||||
ii_movep 070,d3,wad
|
||||
ii_movep 090,d4,wad
|
||||
ii_movep 0b0,d5,wad
|
||||
ii_movep 0d0,d6,wad
|
||||
ii_movep 0f0,d7,wad
|
||||
//movep.w d0-7,d(a0-7)
|
||||
ii_movep 014,d0_off(a7),wda
|
||||
ii_movep 034,d1_off(a7),wda
|
||||
ii_movep 054,d2,wda
|
||||
ii_movep 074,d3,wda
|
||||
ii_movep 094,d4,wda
|
||||
ii_movep 0b4,d5,wda
|
||||
ii_movep 0d4,d6,wda
|
||||
ii_movep 0f4,d7,wda
|
||||
//movep.l d(a0-7),d0-7
|
||||
ii_movep 018,d0_off(a7),lad
|
||||
ii_movep 038,d1_off(a7),lad
|
||||
ii_movep 058,d2,lad
|
||||
ii_movep 078,d3,lad
|
||||
ii_movep 098,d4,lad
|
||||
ii_movep 0b8,d5,lad
|
||||
ii_movep 0d8,d6,lad
|
||||
ii_movep 0f8,d7,lad
|
||||
//movep.l d0-7,d(a0-7)
|
||||
ii_movep 01c,d0_off(a7),lda
|
||||
ii_movep 03c,d1_off(a7),lda
|
||||
ii_movep 05c,d2,lda
|
||||
ii_movep 07c,d3,lda
|
||||
ii_movep 09c,d4,lda
|
||||
ii_movep 0bc,d5,lda
|
||||
ii_movep 0dc,d6,lda
|
||||
ii_movep 0fc,d7,lda
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_movep:.macro //1=code ziffer 1-3 2=register 3=art
|
||||
ii_0x\18:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l a0_off(a7),a1
|
||||
ii_movep\3_up1 \2
|
||||
ii_0x\19:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l a1_off(a7),a1
|
||||
ii_movep\3_up1 \2
|
||||
ii_0x\1a:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l a2,a1
|
||||
ii_movep\3_up1 \2
|
||||
ii_0x\1b:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l a3,a1
|
||||
ii_movep\3_up1 \2
|
||||
ii_0x\1c:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l a4,a1
|
||||
ii_movep\3_up1 \2
|
||||
ii_0x\1d:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l a5,a1
|
||||
ii_movep\3_up1 \2
|
||||
ii_0x\1e:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l a6,a1
|
||||
ii_movep\3_up1 \2
|
||||
ii_0x\1f:
|
||||
#ifdef halten_movep
|
||||
halt
|
||||
#endif
|
||||
move.l usp,a1
|
||||
ii_movep\3_up1 \2
|
||||
.endm
|
||||
|
||||
ii_movepwad_up1:.macro
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
move.b (a1),d0
|
||||
lsl.l #8,d0
|
||||
move.b 2(a1,d1.l),d0
|
||||
move.w d0,\1
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
ii_movepwda_up1:.macro
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
move.w \1,d0
|
||||
move.b d0,2(a1)
|
||||
lsr.l #8,d0
|
||||
move.b d0,(a1)
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
ii_moveplad_up1:.macro
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
move.b (a1),d0
|
||||
lsl.l #8,d0
|
||||
move.b 2(a1),d0
|
||||
lsl.l #8,d0
|
||||
move.b 4(a1),d0
|
||||
lsl.l #8,d0
|
||||
move.b 6(a1),d0
|
||||
move.l d0,\1
|
||||
ii_end
|
||||
.endm
|
||||
|
||||
ii_moveplda_up1:.macro
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
move.l \1,d0
|
||||
move.b d0,6(a1)
|
||||
lsr.l #8,d0
|
||||
move.b d0,4(a1)
|
||||
lsr.l #8,d0
|
||||
move.b d0,2(a1)
|
||||
lsr.l #8,d0
|
||||
move.b d0,(a1)
|
||||
ii_end
|
||||
.endm
|
||||
661
sources/ii_op.h
661
sources/ii_op.h
@@ -1,661 +0,0 @@
|
||||
/*****************************************************************************************/
|
||||
// opertionen
|
||||
/*****************************************************************************************/
|
||||
ii_lset_op:.macro
|
||||
//byt
|
||||
ii_lset_opea \1,0 // dx,ax
|
||||
ii_lset_opea \1,1 // (ax), (ax)+
|
||||
ii_lset_opea \1,2 // -(ax),d16(ax)
|
||||
ii_lset_opeag \1,3 // d8(ax,dy)
|
||||
lea table+0x\1\238*4,a0
|
||||
move.l #ii_0x\138,(a0)+ // xxx.w
|
||||
move.l #ii_0x\139,(a0)+ // xxx.l
|
||||
//word
|
||||
ii_lset_opea \1,4 // dx,ax
|
||||
ii_lset_opea \1,5 // (ax), (ax)+
|
||||
ii_lset_opea \1,6 // -(ax),d16(ax)
|
||||
ii_lset_opeag \1,7 // d8(ax,dy)
|
||||
lea table+0x\178*4,a0
|
||||
move.l #ii_0x\178,(a0)+ // xxx.w
|
||||
move.l #ii_0x\179,(a0)+ // xxx.l
|
||||
//long
|
||||
ii_lset_opea \1,8 // dx,ax
|
||||
ii_lset_opea \1,9 // (ax), (ax)+
|
||||
ii_lset_opea \1,a // -(ax),d16(ax)
|
||||
ii_lset_opeag \1,b // d8(ax,dy)
|
||||
lea table+0x\1b8*4,a0
|
||||
move.l #ii_0x\1b8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\1b9,(a0)+ // xxx.l
|
||||
.endm
|
||||
|
||||
ii_lset_opeag:.macro // 0x1120-0x1127
|
||||
lea table+0x\1\20*4,a0
|
||||
move.l #ii_0x\1\20,(a0)+
|
||||
move.l #ii_0x\1\21,(a0)+
|
||||
move.l #ii_0x\1\22,(a0)+
|
||||
move.l #ii_0x\1\23,(a0)+
|
||||
move.l #ii_0x\1\24,(a0)+
|
||||
move.l #ii_0x\1\25,(a0)+
|
||||
move.l #ii_0x\1\26,(a0)+
|
||||
move.l #ii_0x\1\27,(a0)+
|
||||
.endm;
|
||||
|
||||
ii_lset_opeau:.macro // 0x1128-0x112f
|
||||
lea table+0x\1\28*4,a0
|
||||
move.l #ii_0x\1\28,(a0)+
|
||||
move.l #ii_0x\1\29,(a0)+
|
||||
move.l #ii_0x\1\2a,(a0)+
|
||||
move.l #ii_0x\1\2b,(a0)+
|
||||
move.l #ii_0x\1\2c,(a0)+
|
||||
move.l #ii_0x\1\2d,(a0)+
|
||||
move.l #ii_0x\1\2e,(a0)+
|
||||
move.l #ii_0x\1\2f,(a0)+
|
||||
.endm;
|
||||
|
||||
ii_lset_opea:.macro
|
||||
ii_lset_opeag \1,\2
|
||||
ii_lset_opeau \1,\2
|
||||
.endm
|
||||
/******************************************************/
|
||||
ii_op:.macro // 1=code 2=operation 3 = normal oder immediat/quick
|
||||
// byt
|
||||
opdx \1,\2,b,0,\3 // dx,ax
|
||||
opia \1,\2,b,1,\3 // (ax),(ax)+
|
||||
opdia \1,\2,b,2,\3 // -(ax),d16(ax)
|
||||
opd8a \1,\2,b,3,\3 // d8(ax),xxx
|
||||
// word
|
||||
opdx \1,\2,w,4,\3 // dx,ax
|
||||
opia \1,\2,w,5,\3 // (ax),(ax)+
|
||||
opdia \1,\2,w,6,\3 // -(ax),d16(ax)
|
||||
opd8a \1,\2,w,7,\3 // d8(ax),xxx
|
||||
// long
|
||||
opdx \1,\2,l,8,\3 // dx,ax
|
||||
opia \1,\2,l,9,\3 // (ax),(ax)+
|
||||
opdia \1,\2,l,a,\3 // -(ax),d16(ax)
|
||||
opd8a \1,\2,l,b,\3 // d8(ax),xxx
|
||||
.endm
|
||||
/******************************************************/
|
||||
// byt word long
|
||||
/******************************************************/
|
||||
opdx: .macro //register: \1=code \2 = operation \3 = size \4=size and adressierungsart 5 = immediate oder normal
|
||||
ii_0x\1\40:
|
||||
.ifc \3,b
|
||||
op\5smd \2,d0_off+3(a7),d0_off+3(a7),\3
|
||||
.else
|
||||
.ifc \3,w
|
||||
op\5smd \2,d0_off+2(a7),d0_off+2(a7),\3
|
||||
.else
|
||||
op\5smd \2,d0_off(a7),d0_off(a7),\3
|
||||
.endif
|
||||
.endif
|
||||
ii_0x\1\41:
|
||||
.ifc \3,b
|
||||
op\5smd \2,d1_off+3(a7),d1_off+3(a7),\3
|
||||
.else
|
||||
.ifc \3,w
|
||||
op\5smd \2,d1_off+2(a7),d1_off+2(a7),\3
|
||||
.else
|
||||
op\5smd \2,d1_off(a7),d1_off(a7),\3
|
||||
.endif
|
||||
.endif
|
||||
ii_0x\1\42:
|
||||
op\5smd \2,d2,d2,\3
|
||||
ii_0x\1\43:
|
||||
op\5smd \2,d3,d3,\3
|
||||
ii_0x\1\44:
|
||||
op\5smd \2,d4,d4,\3
|
||||
ii_0x\1\45:
|
||||
op\5smd \2,d5,d5,\3
|
||||
ii_0x\1\46:
|
||||
op\5smd \2,d6,d6,\3
|
||||
ii_0x\1\47:
|
||||
op\5smd \2,d7,d7,\3
|
||||
//ax
|
||||
ii_0x\1\48:
|
||||
opa\5smd \2,a0_off(a7),a0_off(a7),\3
|
||||
ii_0x\1\49:
|
||||
opa\5smd \2,a1_off(a7),a1_off(a7),\3
|
||||
ii_0x\1\4a:
|
||||
opa\5smd \2,a2,a2,\3
|
||||
ii_0x\1\4b:
|
||||
opa\5smd \2,a3,a3,\3
|
||||
ii_0x\1\4c:
|
||||
opa\5smd \2,a4,a4,\3
|
||||
ii_0x\1\4d:
|
||||
opa\5smd \2,a5,a5,\3
|
||||
ii_0x\1\4e:
|
||||
opa\5smd \2,a6,a6,\3
|
||||
ii_0x\1\4f:
|
||||
opa\5smd \2,usp,usp,\3
|
||||
.endm;
|
||||
//-----------------------------------------------
|
||||
opia: .macro // (ax) \1=code \2 = operation \3 = size \4=size and adressierungsart 5 = immediate oder normal
|
||||
//(ax)
|
||||
ii_0x\1\40:
|
||||
op\5sia \2,a0_off(a7),(a1),(a1),\3
|
||||
ii_0x\1\41:
|
||||
op\5sia \2,a1_off(a7),(a1),(a1),\3
|
||||
ii_0x\1\42:
|
||||
op\5smd \2,(a2),(a2),\3
|
||||
ii_0x\1\43:
|
||||
op\5smd \2,(a3),(a3),\3
|
||||
ii_0x\1\44:
|
||||
op\5smd \2,(a4),(a4),\3
|
||||
ii_0x\1\45:
|
||||
op\5smd \2,(a5),(a5),\3
|
||||
ii_0x\1\46:
|
||||
op\5smd \2,(a6),(a6),\3
|
||||
ii_0x\1\47:
|
||||
op\5sia \2,usp,(a1),(a1),\3
|
||||
//(ax)+
|
||||
ii_0x\1\48:
|
||||
op\5sia \2,a0_off(a7),(a1),(a1)+,\3
|
||||
ii_0x\1\49:
|
||||
op\5sia \2,a1_off(a7),(a1),(a1)+,\3
|
||||
ii_0x\1\4a:
|
||||
op\5smd \2,(a2),(a2)+,\3
|
||||
ii_0x\1\4b:
|
||||
op\5smd \2,(a3),(a3)+,\3
|
||||
ii_0x\1\4c:
|
||||
op\5smd \2,(a4),(a4)+,\3
|
||||
ii_0x\1\4d:
|
||||
op\5smd \2,(a5),(a5)+,\3
|
||||
ii_0x\1\4e:
|
||||
op\5smd \2,(a6),(a6)+,\3
|
||||
ii_0x\1\4f:
|
||||
op\5sia \2,usp,(a1),(a1)+,\3
|
||||
.endm;
|
||||
//-----------------------------------------------
|
||||
opdia: .macro // -(ax) \1=code \2 = operation \3 = size \4 size and adressierungsart 5 = immediate oder normal
|
||||
ii_0x\1\40:
|
||||
op\5sia \2,a0_off(a7),-(a1),(a1),\3
|
||||
ii_0x\1\41:
|
||||
op\5sia \2,a1_off(a7),-(a1),(a1),\3
|
||||
ii_0x\1\42:
|
||||
op\5smd \2,-(a2),(a2),\3
|
||||
ii_0x\1\43:
|
||||
op\5smd \2,-(a3),(a3),\3
|
||||
ii_0x\1\44:
|
||||
op\5smd \2,-(a4),(a4),\3
|
||||
ii_0x\1\45:
|
||||
op\5smd \2,-(a5),(a5),\3
|
||||
ii_0x\1\46:
|
||||
op\5smd \2,-(a6),(a6),\3
|
||||
ii_0x\1\47:
|
||||
op\5sia \2,usp,-(a1),(a1),\3
|
||||
|
||||
ii_0x\1\48:
|
||||
op\5sd16a \2,a0_off(a7),\3
|
||||
ii_0x\1\49:
|
||||
op\5sd16a \2,a1_off(a7),\3
|
||||
ii_0x\1\4a:
|
||||
op\5sd16a \2,a2,\3
|
||||
ii_0x\1\4b:
|
||||
op\5sd16a \2,a3,\3
|
||||
ii_0x\1\4c:
|
||||
op\5sd16a \2,a4,\3
|
||||
ii_0x\1\4d:
|
||||
op\5sd16a \2,a5,\3
|
||||
ii_0x\1\4e:
|
||||
op\5sd16a \2,a6,\3
|
||||
ii_0x\1\4f:
|
||||
op\5sd16a \2,usp,\3
|
||||
.endm;
|
||||
//-----------------------------------------------
|
||||
opd8a: .macro // d8(ax,dy) \1=code \2 = operation \3 = size \4=size and adressierungsart 5 = immediate oder normal
|
||||
ii_0x\1\40:
|
||||
op\5sd8a \2,a0_off(a7),\3
|
||||
ii_0x\1\41:
|
||||
op\5sd8a \2,a1_off(a7),\3
|
||||
ii_0x\1\42:
|
||||
op\5sd8a \2,a2,\3
|
||||
ii_0x\1\43:
|
||||
op\5sd8a \2,a3,\3
|
||||
ii_0x\1\44:
|
||||
op\5sd8a \2,a4,\3
|
||||
ii_0x\1\45:
|
||||
op\5sd8a \2,a5,\3
|
||||
ii_0x\1\46:
|
||||
op\5sd8a \2,a6,\3
|
||||
ii_0x\1\47:
|
||||
op\5sd8a \2,usp,\3
|
||||
|
||||
ii_0x\1\48:
|
||||
op\5sxx \2,\3,w
|
||||
ii_0x\1\49:
|
||||
op\5sxx \2,\3,l
|
||||
.endm;
|
||||
//-----------------------------------------------
|
||||
opnsmd:.macro // direct dx: 1=operation 2=ea src 3=ea dest 4=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
.ifc \4,l
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\4 \2,d1
|
||||
.endif
|
||||
.ifc \1,negx
|
||||
move.b sr_off+1(a7),d1 //ccr holen
|
||||
move d1,ccr //setzen
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\4 d1,\3
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opansmd:.macro // direct ax: 1=operation 2=ea src 3=ea dest 4=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \2,usp
|
||||
move.l usp,a1
|
||||
move.l a1,d1
|
||||
.else
|
||||
move.l \2,d1
|
||||
.endif
|
||||
\1 d1
|
||||
.ifc \3,usp
|
||||
move.l d1,a1
|
||||
move.l a1,usp
|
||||
.else
|
||||
move.l d1,\3
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opnsia:.macro // indirect: 1=operation 2=adress register 3= src 4=dest 5=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
move.l \2,a1
|
||||
.ifc \5,l
|
||||
move.l \3,d1
|
||||
.else
|
||||
mvs.\5 \3,d1
|
||||
.endif
|
||||
.ifc \1,negx
|
||||
move.b sr_off+1(a7),d1 //ccr holen
|
||||
move d1,ccr //setzen
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\5 d1,\4
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opnsd16a:.macro // indirect: 1=operation 2=adress register 3=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
.ifc \1,negx
|
||||
move.b sr_off+1(a7),d1 //ccr holen
|
||||
move d1,ccr //setzen
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opnsd8a:.macro // indirect: 1=operation 2=adress register 3=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
.ifc \1,negx
|
||||
move.b sr_off+1(a7),d1 //ccr holen
|
||||
move d1,ccr //setzen
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opnsxx:.macro // indirect: 1=operation 2=size 3=size adresse
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \2,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\2 (a1),d1
|
||||
.endif
|
||||
move.\3 (a0)+,a1
|
||||
.ifc \1,negx
|
||||
move.b sr_off+1(a7),d1 //ccr holen
|
||||
move d1,ccr //setzen
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\2 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//*******************************************************************************3
|
||||
opismd:.macro // immediate dx: 1=opieration 2=ea src 3=ea dest 4=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \4,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
.ifc \4,l
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\4 \2,d1
|
||||
.endif
|
||||
\1 d0,d1
|
||||
set_cc0
|
||||
.ifnc \1,cmp.l
|
||||
move.\4 d1,\3
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opaismd:.macro // immediate ax: 1=opieration 2=ea src 3=ea dest 4=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \4,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
.ifc \2,usp
|
||||
move.l usp,a1
|
||||
move.l a1,d1
|
||||
.else
|
||||
move.l \2,d1
|
||||
.endif
|
||||
\1 d0,d1
|
||||
.ifnc \1,cmp.l
|
||||
.ifc \3,usp
|
||||
move.l d1,a1
|
||||
move.l a1,usp
|
||||
.else
|
||||
move.l d1,\3
|
||||
.endif
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opisia:.macro // indirect: 1=opieration 2=adress register 3= src 4=dest 5=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \5,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \5,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.l \2,a1
|
||||
.ifc \5,l
|
||||
move.l \3,d1
|
||||
.else
|
||||
mvs.\5 \3,d1
|
||||
.endif
|
||||
\1 d0,d1
|
||||
set_cc0
|
||||
.ifnc \1,cmp.l
|
||||
move.\5 d1,\4
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opisd16a:.macro // indirect: 1=opieration 2=adress register 3=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \3,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \3,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
\1 d0,d1
|
||||
set_cc0
|
||||
.ifnc \1,cmp.l
|
||||
move.\3 d1,(a1)
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opisd8a:.macro // indirect: 1=opieration 2=adress register 3=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \3,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \3,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.l d0,_d0_save
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
move.l _d0_save,d0
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
\1 d0,d1
|
||||
set_cc0
|
||||
.ifnc \1,cmp.l
|
||||
move.\3 d1,(a1)
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opisxx:.macro // immediate: 1=opieration 2=size 3=size adresse
|
||||
.ifc \2,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \2,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.\3 (a0)+,a1
|
||||
.ifc \2,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\2 (a1),d1
|
||||
.endif
|
||||
\1 d0,d1
|
||||
set_cc0
|
||||
.ifnc \1,cmp.l
|
||||
move.\2 d1,(a1)
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
//*******************************************************************************3
|
||||
opqsmd:.macro // quick: 1=opieration 2=ea src 3=ea dest 4=size
|
||||
.ifc \4,l
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\4 \2,d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d0
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 ,d1
|
||||
set_cc0
|
||||
move.\4 d1,\3
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opaqsmd:.macro // quick: 1=opieration 2=ea src 3=ea dest 4=size
|
||||
.ifc \2,usp
|
||||
move.l usp,a1
|
||||
move.l a1,d1
|
||||
.else
|
||||
move.l \2,d1
|
||||
.endif
|
||||
\1 ,d1
|
||||
.ifc \3,usp
|
||||
move.l d1,a1
|
||||
move.l a1,usp
|
||||
.else
|
||||
move.l d1,\3
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opqsia:.macro // indirect: 1=opieration 2=adress register 3= src 4=dest 5=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
move.l \2,a1
|
||||
.ifc \5,l
|
||||
move.l \3,d1
|
||||
.else
|
||||
mvs.\5 \3,d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d0
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 ,d1
|
||||
set_cc0
|
||||
move.\5 d1,\4
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opqsd16a:.macro // indirect: 1=opieration 2=adress register 3=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d0
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 ,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opqsd8a:.macro // indirect: 1=opieration 2=adress register 3=size
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
move.l d0,_d0_save
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
move.l _d0_save,d0
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d0
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 ,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opqsxx:.macro // quick: 1=opieration 2=size 3=size adresse
|
||||
#ifdef halten_op
|
||||
halt
|
||||
#endif
|
||||
|
||||
move.\3 (a0)+,a1
|
||||
.ifc \2,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\2 (a1),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d0
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 ,d1
|
||||
set_cc0
|
||||
move.\2 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
263
sources/ii_opc.h
263
sources/ii_opc.h
@@ -1,263 +0,0 @@
|
||||
/*****************************************************************************************/
|
||||
// functionen macros: fehlende adressierungsarte (MCF nur Dx support) ohne ax
|
||||
// zusammen mit op.h
|
||||
/*****************************************************************************************/
|
||||
ii_lset_opc:.macro
|
||||
ii_lset_opeag \1,c // dx,ax
|
||||
ii_lset_opea \1,d // (ax), (ax)+
|
||||
ii_lset_opea \1,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \1,f // d8(ax,dy)
|
||||
lea table+0x\1b8*4,a0
|
||||
move.l #ii_0x\1b8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\1b9,(a0)+ // xxx.l
|
||||
.endm
|
||||
|
||||
/******************************************************/
|
||||
ii_opc:.macro // 1=code 2=operation 3 = normal oder immediat
|
||||
opcdx \1,\2,l,c,\3 // dx,ax
|
||||
opia \1,\2,l,d,\3 // (ax),(ax)+
|
||||
opdia \1,\2,l,e,\3 // -(ax),d16(ax)
|
||||
opd8a \1,\2,l,f,\3 // d8(ax),xxx
|
||||
.endm
|
||||
//*******************************************************************************3
|
||||
/******************************************************/
|
||||
// byt word long
|
||||
/******************************************************/
|
||||
opcdx: .macro //register: \1=code \2 = operation \3 = size \4=size and adressierungsart 5 = immediate oder normal
|
||||
ii_0x\1\40:
|
||||
#ifdef halten_opc
|
||||
halt
|
||||
#endif
|
||||
.ifc \3,b
|
||||
op\5smd \2,d0_off+3(a7),d0_off+3(a7),\3
|
||||
.else
|
||||
.ifc \3,w
|
||||
op\5smd \2,d0_off+2(a7),d0_off+2(a7),\3
|
||||
.else
|
||||
op\5smd \2,d0_off(a7),d0_off(a7),\3
|
||||
.endif
|
||||
.endif
|
||||
ii_0x\1\41:
|
||||
.ifc \3,b
|
||||
op\5smd \2,d1_off+3(a7),d1_off+3(a7),\3
|
||||
.else
|
||||
.ifc \3,w
|
||||
op\5smd \2,d1_off+2(a7),d1_off+2(a7),\3
|
||||
.else
|
||||
op\5smd \2,d1_off(a7),d1_off(a7),\3
|
||||
.endif
|
||||
.endif
|
||||
ii_0x\1\42:
|
||||
op\5smd \2,d2,d2,\3
|
||||
ii_0x\1\43:
|
||||
op\5smd \2,d3,d3,\3
|
||||
ii_0x\1\44:
|
||||
op\5smd \2,d4,d4,\3
|
||||
ii_0x\1\45:
|
||||
op\5smd \2,d5,d5,\3
|
||||
ii_0x\1\46:
|
||||
op\5smd \2,d6,d6,\3
|
||||
ii_0x\1\47:
|
||||
op\5smd \2,d7,d7,\3
|
||||
.endm
|
||||
//-----------------------------------------------------
|
||||
opcsmd:.macro // dx: 1=opieration 2=ea src 3=ea dest 4=size
|
||||
#ifdef halten_opc
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \4,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
.ifc \4,l
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\4 \2,d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\4 d1,\3
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opacsmd:.macro // ax: 1=opieration 2=ea src 3=ea dest 4=size
|
||||
#ifdef halten_opc
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \4,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
.ifc \2,usp
|
||||
move.l usp,a1
|
||||
move.l a1,d1
|
||||
.else
|
||||
move.l \2,d1
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
.ifc \3,usp
|
||||
move.l d1,a1
|
||||
move.l a1,usp
|
||||
.else
|
||||
move.l d1,\3
|
||||
.endif
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opcsia:.macro // (ax) (ax)+ -(ax): 1=opieration 2=adress register 3= src 4=dest 5=size
|
||||
#ifdef halten_opc
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \4,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.l \2,a1
|
||||
.ifc \5,l
|
||||
move.l \3,d1
|
||||
.else
|
||||
mvs.\5 \3,d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\5 d1,\4
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opcsd16a:.macro // d16(ax): 1=opieration 2=adress register 3=size
|
||||
#ifdef halten_opc
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \4,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opcsd8a:.macro // indirect: 1=opieration 2=adress register 3=size
|
||||
#ifdef halten_opc
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \4,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.l d0,_d0_save
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
move.l _d0_save,d0
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
|
||||
opcsxx:.macro // indirect: 1=opieration 2=size 3=size adresse
|
||||
#ifdef halten_opc
|
||||
halt
|
||||
#endif
|
||||
|
||||
.ifc \2,l
|
||||
move.l (a0)+,d0
|
||||
.else
|
||||
.ifc \2,w
|
||||
mvs.w (a0)+,d0
|
||||
.else
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
.endif
|
||||
.endif
|
||||
move.\3 (a0)+,a1
|
||||
.ifc \2,l
|
||||
move.l (a1),d1
|
||||
.else
|
||||
mvs.\2 (a1),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d0
|
||||
move.l d0_off(a7),d1
|
||||
.endif
|
||||
.ifc \1,eor.l d1
|
||||
move.l d1_off(a7),d1
|
||||
.endif
|
||||
\1 d1
|
||||
set_cc0
|
||||
move.\2 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
442
sources/ii_or.h
442
sources/ii_or.h
@@ -1,442 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// or
|
||||
//--------------------------------------------------------------------
|
||||
/*****************************************************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// byt
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// or.b #im,dx
|
||||
//--------------------------------------------------------------------
|
||||
orbir_macro:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
mvs.b \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.b d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or ea,dx
|
||||
//--------------------------------------------------------------------
|
||||
ordd:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or ea(l)->dy(w),dx z.B. f<>r USP
|
||||
//--------------------------------------------------------------------
|
||||
orddd:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 a1,d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or (ea)->dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
ordda:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or ea->ay,(ay)+,dx
|
||||
//--------------------------------------------------------------------
|
||||
orddai:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1)+,d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or ea->ay,-(ay),dx
|
||||
//--------------------------------------------------------------------
|
||||
orddad:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 -(a1),d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or d16(ay),dx
|
||||
//--------------------------------------------------------------------
|
||||
ord16ad:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or d8(ay,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
ord8ad:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
orxwd:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or xxx.l,dx
|
||||
//--------------------------------------------------------------------
|
||||
orxld:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or d16(pc),dx
|
||||
//--------------------------------------------------------------------
|
||||
ord16pcd:.macro
|
||||
halt
|
||||
move.l a0,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or d8(pc,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
ord8pcd:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// or dy,ea
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// // or (ea)->dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
oreda:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or dx,ea->ay,(ay)+
|
||||
//--------------------------------------------------------------------
|
||||
oredai:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)+
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or dx,ea->ay,(ay)+
|
||||
//--------------------------------------------------------------------
|
||||
oredaid:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2+
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or dx,ea->ay,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
oredad:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 -(a1),d1
|
||||
move.l a1,\2
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or dx,ea->ay,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
oredadd:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 -\2,d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or dx,d16(ay)
|
||||
//--------------------------------------------------------------------
|
||||
ore16ad:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
mvs.\3 (a1),d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or.w dx,d8(ay,dy)
|
||||
//--------------------------------------------------------------------
|
||||
ore8ad:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
move.l \1,d0
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
mvs.\3 \1,d0
|
||||
.endif
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or dx,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
orxwe:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // or dx,xxx.l
|
||||
//--------------------------------------------------------------------
|
||||
orxle:.macro
|
||||
#ifdef halten_or
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
or.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w ea,ax
|
||||
//--------------------------------------------------------------------
|
||||
oraw:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// or.w ea,usp
|
||||
//--------------------------------------------------------------------
|
||||
orawa7:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w usp?,ax
|
||||
//--------------------------------------------------------------------
|
||||
orawu:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w usp?,usp
|
||||
//--------------------------------------------------------------------
|
||||
orawua7:.macro
|
||||
orawu \1,\2
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w d16(ay),ax
|
||||
//--------------------------------------------------------------------
|
||||
orawd16a:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
orawd8a:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w xxx.w,ax
|
||||
//--------------------------------------------------------------------
|
||||
orawxwax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w xxx.l,ax
|
||||
//--------------------------------------------------------------------
|
||||
orawxlax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w d16(pc),ax
|
||||
//--------------------------------------------------------------------
|
||||
orawd16pcax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
orawd8pcax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.w #im,ax
|
||||
//--------------------------------------------------------------------
|
||||
orawim:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.l d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
orald8a:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // ora.l d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
orald8pcax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//*****************************************************************************************
|
||||
// spezial addx subx etc.
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// // addx dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
ordx:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // addx -(ay),-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
ordax:.macro
|
||||
jmp ii_error
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
@@ -1,74 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// pea
|
||||
//--------------------------------------------------------------------
|
||||
.text
|
||||
ii_pea_lset:.macro
|
||||
ii_lset_opeag 48,7
|
||||
ii_lset 0x487b
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
ii_pea_func:.macro
|
||||
ii_0x4870:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a0_off(a7),a1
|
||||
pea_macro
|
||||
ii_0x4871:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a1_off(a7),a1
|
||||
pea_macro
|
||||
ii_0x4872:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a2,a1
|
||||
pea_macro
|
||||
ii_0x4873:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a3,a1
|
||||
pea_macro
|
||||
ii_0x4874:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a4,a1
|
||||
pea_macro
|
||||
ii_0x4875:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a5,a1
|
||||
pea_macro
|
||||
ii_0x4876:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a6,a1
|
||||
pea_macro
|
||||
ii_0x4877:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l usp,a1
|
||||
pea_macro
|
||||
ii_0x487b:
|
||||
#ifdef halten_pea
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
pea_macro
|
||||
.endm
|
||||
//---------------------------------------------------------------------------------------------
|
||||
pea_macro:.macro
|
||||
jsr ewf
|
||||
move.l (a1),d0
|
||||
move.l usp,a1
|
||||
move.l d0,-(a1)
|
||||
move.l a1,usp
|
||||
ii_end
|
||||
.endm
|
||||
247
sources/ii_shd.h
247
sources/ii_shd.h
@@ -1,247 +0,0 @@
|
||||
/*****************************************************************************************/
|
||||
// opertionen
|
||||
/*****************************************************************************************/
|
||||
ii_lset_shd:.macro
|
||||
ii_lset_shdx e0 //r d0
|
||||
ii_lset_shdx e2 //r d1
|
||||
ii_lset_shdx e4 //r d2
|
||||
ii_lset_shdx e6 //r d3
|
||||
ii_lset_shdx e8 //r d4
|
||||
ii_lset_shdx ea //r d5
|
||||
ii_lset_shdx ec //r d6
|
||||
ii_lset_shdx ee //r d7
|
||||
|
||||
ii_lset_shdx e1 //l d0
|
||||
ii_lset_shdx e3 //l d1
|
||||
ii_lset_shdx e4 //l d2
|
||||
ii_lset_shdx e5 //l d3
|
||||
ii_lset_shdx e9 //l d4
|
||||
ii_lset_shdx eb //l d5
|
||||
ii_lset_shdx ed //l d6
|
||||
ii_lset_shdx ef //l d7
|
||||
.endm
|
||||
|
||||
ii_lset_shdx:.macro
|
||||
//byt
|
||||
ii_lset_opea \1,0 // as,ls #im,dx
|
||||
ii_lset_opea \1,1 // rox,ro #im,dx
|
||||
ii_lset_opea \1,2 // as,ls dy,dx
|
||||
ii_lset_opea \1,3 // rox,ro dy,dx
|
||||
//word
|
||||
ii_lset_opea \1,4 // as,ls #im,dx
|
||||
ii_lset_opea \1,5 // rox,ro #im,dx
|
||||
ii_lset_opea \1,6 // as,ls dy,dx
|
||||
ii_lset_opea \1,7 // rox,ro dy,dx
|
||||
//long
|
||||
// ii_lset_opea \1,8 // as,ls #im,dx -> vorhanden
|
||||
ii_lset_opea \1,9 // rox,ro #im,dx
|
||||
// ii_lset_opea \1,a // as,ls dy,dx -> vorhanden
|
||||
ii_lset_opea \1,b // rox,ro dy,dx
|
||||
.endm
|
||||
/******************************************************/
|
||||
ii_shd:.macro // 1=code 2=operation 3 = normal, direct oder immediat
|
||||
// byt
|
||||
opdx \1,\2,b,0,\3 // dx
|
||||
// word
|
||||
opdx \1,\2,w,4,\3 // dx
|
||||
// long
|
||||
opdx \1,\2,l,8,\3 // dx
|
||||
.endm
|
||||
/******************************************************/
|
||||
// byt word long routinen
|
||||
/******************************************************/
|
||||
sh_asr: .macro // asr -> 1=operation 2 = dx 3 = dy/im 4 = size b/w
|
||||
mvs.\4 \2,d1
|
||||
sh_shal \1,\2,\3,\4
|
||||
.endm
|
||||
|
||||
sh_lsr: .macro // asl -> 1=operation 2 = dx 3 = dy/im 4 = size b/w
|
||||
mvz.\4 \2,d1
|
||||
sh_shal \1,\2,\3,\4
|
||||
.endm
|
||||
|
||||
sh_shal:.macro
|
||||
move.w \3,d0
|
||||
\1.l d0,d1
|
||||
set_cc0
|
||||
move.\4 d1,\2
|
||||
.endm
|
||||
|
||||
sh_all: .macro // asl/lsl -> 1=operation 2 = dx 3 = dy/im 4 = size b/w
|
||||
mvz.\4 \2,d1
|
||||
.ifc \4,b
|
||||
byterev.l d1
|
||||
.else
|
||||
swap.w d1
|
||||
.endif
|
||||
sh_asr \1,\2,\3,\4
|
||||
.endm
|
||||
|
||||
sh_ror: .macro // ror -> 1=operation 2 = dx 3 = dy/im 4 = size b/w/l
|
||||
move.\4 \2,d1 /
|
||||
move.w \3,d0
|
||||
.ifc \4,b
|
||||
lsl.l #8,d1
|
||||
move.b \2,d1
|
||||
and.l #0x7,d0
|
||||
lsr.l d0,d1
|
||||
.else
|
||||
.ifc \4,w
|
||||
swap.w d1
|
||||
move.w \2,d1
|
||||
and.l #0xf,d0
|
||||
lsr.l d0,d1
|
||||
.else
|
||||
and.l #0x1f,d0
|
||||
lsr.l d0,d1
|
||||
move.l d1,a1
|
||||
move.l \2,d1
|
||||
sub.l #32,d0
|
||||
neg.l d0
|
||||
lsl.l d0,d1
|
||||
add.l a1,d1
|
||||
.endif
|
||||
.endif
|
||||
move.\4 d1,\2
|
||||
move.w ccr,d0
|
||||
and.l #1,d1 // ist auch carry bit
|
||||
or.l d1,d0
|
||||
move.b d0,ccr_off(a7)
|
||||
.endm
|
||||
|
||||
sh_rol: .macro // rol -> 1=operation 2 = dx 3 = dy/im 4 = size b/w/l
|
||||
move.\4 \2,d1
|
||||
move.w \3,d0
|
||||
.ifc \4,b
|
||||
lsl.l #8,d1
|
||||
move.b \2,d1
|
||||
and.l #0x7,d0
|
||||
lsl.l d0,d1
|
||||
lsr.l #8,d1
|
||||
moveq #7,d0
|
||||
.else
|
||||
.ifc \4,w
|
||||
swap.w d1
|
||||
move.w \2,d1
|
||||
and.l #0xf,d0
|
||||
lsr.l d0,d1
|
||||
swap.w d1
|
||||
moveq #15,d0
|
||||
.else
|
||||
and.l #0x1f,d0
|
||||
lsl.l d0,d1
|
||||
move.l d1,a1
|
||||
move.l \2,d1
|
||||
sub.l #32,d0
|
||||
neg.l d0
|
||||
lsr.l d0,d1
|
||||
add.l a1,d1
|
||||
moveq #31,d0
|
||||
.endif
|
||||
.endif
|
||||
move.\4 d1,\2
|
||||
lsr.l d0,d1 // carry bit schieben
|
||||
move.w ccr,d0
|
||||
and.l #1,d1
|
||||
or.l d1,d0
|
||||
move.b d0,ccr_off(a7)
|
||||
.endm
|
||||
|
||||
sh_roxr: .macro // roxr -> 1=operation 2 = dx 3 = dy/im 4 = size b/w/l
|
||||
clr.l d0
|
||||
addx.l d0,d0
|
||||
ifc \4,b
|
||||
mvz.b \2,d1
|
||||
lsl.l #1,d1
|
||||
add.l d0,d1
|
||||
lsl.l #8,d1
|
||||
move.b \2,d1
|
||||
move.w \3,d0
|
||||
and.l #0x7,d0
|
||||
lsr.l d0,d1
|
||||
set_cc0
|
||||
else
|
||||
.ifc \4,w
|
||||
mvz.b \2,d1
|
||||
lsl.l #1,d1
|
||||
add.l d0,d1
|
||||
lsl.l #8,d1
|
||||
lsl.l #8,d1
|
||||
move.w \2,d1
|
||||
move.w \3,d0
|
||||
and.l #0xf,d0
|
||||
lsr.l d0,d1
|
||||
set_cc0
|
||||
.else
|
||||
bitrev.l d0
|
||||
move.l \2,d1
|
||||
lsr.l #1,d1
|
||||
add.l d0,d1
|
||||
move.w \3,d0
|
||||
subq.l #1,d0
|
||||
and.l #0x1f,d0
|
||||
lsr.l d0,d1
|
||||
move.l d1,a1
|
||||
set_cc1
|
||||
move.l \2,d1
|
||||
sub.l #32,d0
|
||||
neg.l d0
|
||||
lsl.l d0,d1
|
||||
add.l a1,d1
|
||||
.endif
|
||||
.endif
|
||||
move.\4 d1,\2
|
||||
.endm
|
||||
|
||||
sh_roxl: .macro // roxl -> 1=operation 2 = dx 3 = dy/im 4 = size b/w/l
|
||||
clr.l d0
|
||||
addx.l d0,d0
|
||||
ifc \4,b
|
||||
mvz.b \2,d1
|
||||
lsl.l #1,d1
|
||||
add.l d0,d1
|
||||
lsl.l #8,d1
|
||||
move.b \2,d1
|
||||
lsl.l #8,d1
|
||||
lsl.l #7,d1
|
||||
move.w \3,d0
|
||||
and.l #0x7,d0
|
||||
lsl.l d0,d1
|
||||
set_cc0
|
||||
byterev.l d1
|
||||
else
|
||||
.ifc \4,w
|
||||
mvz.b \2,d1
|
||||
lsl.l #1,d1
|
||||
add.l d0,d1
|
||||
lsl.l #8,d1
|
||||
lsl.l #7,d1
|
||||
mvz.w \2,d0
|
||||
lsr.l #1,d0
|
||||
add.l d0,d1
|
||||
move.w \3,d0
|
||||
and.l #0xf,d0
|
||||
lsl.l d0,d1
|
||||
set_cc0
|
||||
swap.w d1
|
||||
.else
|
||||
move.l \2,d1
|
||||
lsl.l #1,d1
|
||||
add.l d0,d1
|
||||
move.w \3,d0
|
||||
subq.l #1,d0
|
||||
and.l #0x1f,d0
|
||||
lsl.l d0,d1
|
||||
move.l d1,a1
|
||||
set_cc1
|
||||
move.l \2,d1
|
||||
sub.l #32,d0
|
||||
neg.l d0
|
||||
lsr.l d0,d1
|
||||
add.l a1,d1
|
||||
.endif
|
||||
.endif
|
||||
move.\4 d1,\2
|
||||
.endm
|
||||
|
||||
|
||||
@@ -1,687 +0,0 @@
|
||||
/*****************************************************************************************/
|
||||
// opertionen
|
||||
/*****************************************************************************************/
|
||||
ii_shift_lset:.macro
|
||||
/******************************************************/
|
||||
// byt
|
||||
/******************************************************/
|
||||
// asx.b #,dx
|
||||
ii_lset_dx \1,00 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
ii_lset_dx \1,01
|
||||
ii_lset_dx \1,02
|
||||
ii_lset_dx \1,03
|
||||
ii_lset_dx \1,04
|
||||
ii_lset_dx \1,05
|
||||
ii_lset_dx \1,06
|
||||
ii_lset_dx \1,07
|
||||
// lsx.b #,dx
|
||||
ii_lset_dxu \1,08
|
||||
ii_lset_dxu \1,09
|
||||
ii_lset_dxu \1,0a
|
||||
ii_lset_dxu \1,0b
|
||||
ii_lset_dxu \1,0c
|
||||
ii_lset_dxu \1,0d
|
||||
ii_lset_dxu \1,0e
|
||||
ii_lset_dxu \1,0f
|
||||
// roxx.b #,dx
|
||||
ii_lset_dx \1,10
|
||||
ii_lset_dx \1,11
|
||||
ii_lset_dx \1,12
|
||||
ii_lset_dx \1,13
|
||||
ii_lset_dx \1,14
|
||||
ii_lset_dx \1,15
|
||||
ii_lset_dx \1,16
|
||||
ii_lset_dx \1,17
|
||||
// rox.b #,dx
|
||||
ii_lset_dx \1,18
|
||||
ii_lset_dx \1,19
|
||||
ii_lset_dx \1,1a
|
||||
ii_lset_dx \1,1b
|
||||
ii_lset_dx \1,1c
|
||||
ii_lset_dx \1,1d
|
||||
ii_lset_dx \1,1e
|
||||
ii_lset_dx \1,1f
|
||||
// asx.b dy,dx
|
||||
ii_lset_dx \1,20
|
||||
ii_lset_dx \1,21
|
||||
ii_lset_dx \1,22
|
||||
ii_lset_dx \1,23
|
||||
ii_lset_dx \1,24
|
||||
ii_lset_dx \1,25
|
||||
ii_lset_dx \1,26
|
||||
ii_lset_dx \1,27
|
||||
// lsx.b dy,dx
|
||||
ii_lset_dx \1,28
|
||||
ii_lset_dx \1,29
|
||||
ii_lset_dx \1,2a
|
||||
ii_lset_dx \1,2b
|
||||
ii_lset_dx \1,2c
|
||||
ii_lset_dx \1,2d
|
||||
ii_lset_dx \1,2e
|
||||
ii_lset_dx \1,2f
|
||||
// roxx.dy,dx
|
||||
ii_lset_dx \1,30
|
||||
ii_lset_dx \1,31
|
||||
ii_lset_dx \1,32
|
||||
ii_lset_dx \1,33
|
||||
ii_lset_dx \1,34
|
||||
ii_lset_dx \1,35
|
||||
ii_lset_dx \1,36
|
||||
ii_lset_dx \1,37
|
||||
// rox.b dy,dx
|
||||
ii_lset_dx \1,38
|
||||
ii_lset_dx \1,39
|
||||
ii_lset_dx \1,3a
|
||||
ii_lset_dx \1,3b
|
||||
ii_lset_dx \1,3c
|
||||
ii_lset_dx \1,3d
|
||||
ii_lset_dx \1,3e
|
||||
ii_lset_dx \1,3f
|
||||
/******************************************************/
|
||||
// word
|
||||
/******************************************************/
|
||||
// asx.w #x,dx
|
||||
ii_lset_dx \1,40 // 0x1.22 -> z.B. 1=d2=4 ->0xd07c -> 0xde7c
|
||||
ii_lset_dx \1,41
|
||||
ii_lset_dx \1,42
|
||||
ii_lset_dx \1,43
|
||||
ii_lset_dx \1,44
|
||||
ii_lset_dx \1,45
|
||||
ii_lset_dx \1,46
|
||||
ii_lset_dx \1,47
|
||||
// lsx.w #,dx
|
||||
ii_lset_dx \1,48
|
||||
ii_lset_dx \1,49
|
||||
ii_lset_dx \1,4a
|
||||
ii_lset_dx \1,4b
|
||||
ii_lset_dx \1,4c
|
||||
ii_lset_dx \1,4d
|
||||
ii_lset_dx \1,4e
|
||||
ii_lset_dx \1,4f
|
||||
// roxx.w #,dx
|
||||
ii_lset_dx \1,50
|
||||
ii_lset_dx \1,51
|
||||
ii_lset_dx \1,52
|
||||
ii_lset_dx \1,53
|
||||
ii_lset_dx \1,54
|
||||
ii_lset_dx \1,55
|
||||
ii_lset_dx \1,56
|
||||
ii_lset_dx \1,57
|
||||
// rox.w #xdx
|
||||
ii_lset_dx \1,58
|
||||
ii_lset_dx \1,59
|
||||
ii_lset_dx \1,5a
|
||||
ii_lset_dx \1,5b
|
||||
ii_lset_dx \1,5c
|
||||
ii_lset_dx \1,5d
|
||||
ii_lset_dx \1,5e
|
||||
ii_lset_dx \1,5f
|
||||
// asx.w dy,dx
|
||||
ii_lset_dx \1,60
|
||||
ii_lset_dx \1,61
|
||||
ii_lset_dx \1,62
|
||||
ii_lset_dx \1,63
|
||||
ii_lset_dx \1,64
|
||||
ii_lset_dx \1,65
|
||||
ii_lset_dx \1,66
|
||||
ii_lset_dx \1,67
|
||||
// lsx.w dy,dx
|
||||
ii_lset_dx \1,68
|
||||
ii_lset_dx \1,69
|
||||
ii_lset_dx \1,6a
|
||||
ii_lset_dx \1,6b
|
||||
ii_lset_dx \1,6c
|
||||
ii_lset_dx \1,6d
|
||||
ii_lset_dx \1,6e
|
||||
ii_lset_dx \1,6f
|
||||
// roxx.w dy,dx
|
||||
ii_lset_dx \1,70
|
||||
ii_lset_dx \1,71
|
||||
ii_lset_dx \1,72
|
||||
ii_lset_dx \1,73
|
||||
ii_lset_dx \1,74
|
||||
ii_lset_dx \1,75
|
||||
ii_lset_dx \1,76
|
||||
ii_lset_dx \1,77
|
||||
// rox.w dy,dx
|
||||
ii_lset_dx \1,78
|
||||
ii_lset_dx \1,79
|
||||
ii_lset_dx \1,7a
|
||||
ii_lset_dx \1,7b
|
||||
ii_lset_dx \1,7c
|
||||
ii_lset_dx \1,7d
|
||||
ii_lset_dx \1,7e
|
||||
ii_lset_dx \1,7f
|
||||
/******************************************************/
|
||||
// long
|
||||
/******************************************************/
|
||||
// roxx.l #,dx
|
||||
ii_lset_dx \1,90
|
||||
ii_lset_dx \1,91
|
||||
ii_lset_dx \1,92
|
||||
ii_lset_dx \1,93
|
||||
ii_lset_dx \1,94
|
||||
ii_lset_dx \1,95
|
||||
ii_lset_dx \1,96
|
||||
ii_lset_dx \1,97
|
||||
// rox.l #xdx
|
||||
ii_lset_dx \1,98
|
||||
ii_lset_dx \1,99
|
||||
ii_lset_dx \1,9a
|
||||
ii_lset_dx \1,9b
|
||||
ii_lset_dx \1,9c
|
||||
ii_lset_dx \1,9d
|
||||
ii_lset_dx \1,9e
|
||||
ii_lset_dx \1,9f
|
||||
// roxx.l dy,dx
|
||||
ii_lset_dx \1,b0
|
||||
ii_lset_dx \1,b1
|
||||
ii_lset_dx \1,b2
|
||||
ii_lset_dx \1,b3
|
||||
ii_lset_dx \1,b4
|
||||
ii_lset_dx \1,b5
|
||||
ii_lset_dx \1,b6
|
||||
ii_lset_dx \1,b7
|
||||
// rox.l dy,dx
|
||||
ii_lset_dx \1,b8
|
||||
ii_lset_dx \1,b9
|
||||
ii_lset_dx \1,ba
|
||||
ii_lset_dx \1,bb
|
||||
ii_lset_dx \1,bc
|
||||
ii_lset_dx \1,bd
|
||||
ii_lset_dx \1,be
|
||||
ii_lset_dx \1,bf
|
||||
//--------------------------------------------------------------------
|
||||
// asr.w ea
|
||||
ii_lset_opea \10,d // (ax), (ax)+
|
||||
ii_lset_opea \10,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \10,f // d8(ax,dy)
|
||||
lea table+0x\10\2f8*4,a0
|
||||
move.l #ii_0x\10f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\10f9,(a0)+ // xxx.l
|
||||
// asl.w ea
|
||||
ii_lset_opea \11,d // (ax), (ax)+
|
||||
ii_lset_opea \11,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \11,f // d8(ax,dy)
|
||||
lea table+0x\11\2f8*4,a0
|
||||
move.l #ii_0x\11f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\11f9,(a0)+ // xxx.l
|
||||
// lsr.w ea
|
||||
ii_lset_opea \12,d // (ax), (ax)+
|
||||
ii_lset_opea \12,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \12,f // d8(ax,dy)
|
||||
lea table+0x\12\2f8*4,a0
|
||||
move.l #ii_0x\12f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\12f9,(a0)+ // xxx.l
|
||||
// lsr.w ea
|
||||
ii_lset_opea \13,d // (ax), (ax)+
|
||||
ii_lset_opea \13,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \13,f // d8(ax,dy)
|
||||
lea table+0x\13\2f8*4,a0
|
||||
move.l #ii_0x\13f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\13f9,(a0)+ // xxx.l
|
||||
// roxr.w ea
|
||||
ii_lset_opea \14,d // (ax), (ax)+
|
||||
ii_lset_opea \14,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \14,f // d8(ax,dy)
|
||||
lea table+0x\14\2f8*4,a0
|
||||
move.l #ii_0x\14f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\14f9,(a0)+ // xxx.l
|
||||
// roxl.w ea
|
||||
ii_lset_opea \15,e // (ax), (ax)+
|
||||
ii_lset_opea \15,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \15,f // d8(ax,dy)
|
||||
lea table+0x\15\2f8*4,a0
|
||||
move.l #ii_0x\15f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\15f9,(a0)+ // xxx.l
|
||||
// ror.w ea
|
||||
ii_lset_opea \16,d // (ax), (ax)+
|
||||
ii_lset_opea \16,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \16,f // d8(ax,dy)
|
||||
lea table+0x\16\2f8*4,a0
|
||||
move.l #ii_0x\16f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\16f9,(a0)+ // xxx.l
|
||||
// rol.w ea
|
||||
ii_lset_opea \17,d // (ax), (ax)+
|
||||
ii_lset_opea \17,e // -(ax),d16(ax)
|
||||
ii_lset_opeag \17,f // d8(ax,dy)
|
||||
lea table+0x\17\2f8*4,a0
|
||||
move.l #ii_0x\17f8,(a0)+ // xxx.w
|
||||
move.l #ii_0x\17f9,(a0)+ // xxx.l
|
||||
// ende
|
||||
.endm;
|
||||
/******************************************************/
|
||||
ii_shift_op:.macro // 1=code
|
||||
//byt-------------------------------
|
||||
//asx.b #x,dx
|
||||
ii_shift_op2agb 0,as,a
|
||||
//lsx.b #x,dx
|
||||
ii_shift_op2aub 0,ls,a
|
||||
//roxx.b #x,dx
|
||||
ii_shift_op2agb 1,rox,a
|
||||
//rox.b #x,dx
|
||||
ii_shift_op2aub 1,ro,a
|
||||
//asx.b dy,dx
|
||||
ii_shift_op2agb 2,as,b
|
||||
//lsx.b dy,dx
|
||||
ii_shift_op2aub 2,ls,b
|
||||
//roxx.b dy,dx
|
||||
ii_shift_op2agb 3,rox,b
|
||||
//rox.b dy,dx
|
||||
ii_shift_op2aub 3,ro,b
|
||||
// word ---------------------------------------
|
||||
//asx.w #x,dx
|
||||
ii_shift_op2agw 4,as,a
|
||||
//lsx.w #x,dx
|
||||
ii_shift_op2auw 4,ls,a
|
||||
//roxx.w #x,dx
|
||||
ii_shift_op2agw 5,rox,a
|
||||
//rox.w #x,dx
|
||||
ii_shift_op2auw 5,ro,a
|
||||
//asx.w dy,dx
|
||||
ii_shift_op2agw 6,as,b
|
||||
//lsx.w dy,dx
|
||||
ii_shift_op2auw 6,ls,b
|
||||
//roxx.w dy,dx
|
||||
ii_shift_op2agw 7,rox,b
|
||||
//rox.w dy,dx
|
||||
ii_shift_op2auw 7,ro,b
|
||||
// long ---------------------------------------
|
||||
//roxx.l #x,dx
|
||||
ii_shift_op2agw 9,rox,a
|
||||
//rox.l #x,dx
|
||||
ii_shift_op2auw 9,ro,a
|
||||
//roxx.l dy,dx
|
||||
ii_shift_op2agw b,rox,b
|
||||
//rox.l dy,dx
|
||||
ii_shift_op2auw b,ro,b
|
||||
// ea ---------------------------------------
|
||||
//asr.w #1,ea
|
||||
ii_shift_op2ea 0,asr
|
||||
//asl.w #1,ea
|
||||
ii_shift_op2ea 1,asl
|
||||
//lsr.w #1,ea
|
||||
ii_shift_op2ea 2,lsr,
|
||||
//lsl.w #1,ea
|
||||
ii_shift_op2ea 3,lsl
|
||||
//roxr.w #1,ea
|
||||
ii_shift_op2ea 4,roxr
|
||||
//roxl.w #1,ea
|
||||
ii_shift_op2ea 5,roxl
|
||||
//ror.w #1,ea
|
||||
ii_shift_op2ea 6,ror
|
||||
//rol.w #1,ea
|
||||
ii_shift_op2ea 7,rol
|
||||
.endm
|
||||
//byt ============================================
|
||||
ii_shift_op2agb:.macro //byt: 1=code 2=operation 3=quick(a) oder register(b)
|
||||
ii_shift_op1\3b \1,0,\2,d0_off+3(a7)
|
||||
ii_shift_op1\3b \1,1,\2,d1_off+3(a7)
|
||||
ii_shift_op1\3b \1,2,\2,d2
|
||||
ii_shift_op1\3b \1,3,\2,d3
|
||||
ii_shift_op1\3b \1,4,\2,d4
|
||||
ii_shift_op1\3b \1,5,\2,d5
|
||||
ii_shift_op1\3b \1,6,\2,d6
|
||||
ii_shift_op1\3b \1,7,\2,d7
|
||||
.endm
|
||||
|
||||
ii_shift_op2aub:.macro //byt: 1=code 2=operation
|
||||
ii_shift_op1\3b \1,8,\2,d0_off+3(a7)
|
||||
ii_shift_op1\3b \1,9,\2,d1_off+3(a7)
|
||||
ii_shift_op1\3b \1,a,\2,d2
|
||||
ii_shift_op1\3b \1,b,\2,d3
|
||||
ii_shift_op1\3b \1,c,\2,d4
|
||||
ii_shift_op1\3b \1,d,\2,d5
|
||||
ii_shift_op1\3b \1,e,\2,d6
|
||||
ii_shift_op1\3b \1,f,\2,d7
|
||||
.endm
|
||||
|
||||
ii_shift_op1ab:.macro // z.B. asr.w. #x,dx 1=code 3.ziffer 2=code 4.ziffer 3=shift art 4=dx
|
||||
ii_shift_op0 0\1\2,b,\3r,#8,\4
|
||||
ii_shift_op0 2\1\2,b,\3r,#1,\4
|
||||
ii_shift_op0 4\1\2,b,\3r,#2,\4
|
||||
ii_shift_op0 6\1\2,b,\3r,#3,\4
|
||||
ii_shift_op0 8\1\2,b,\3r,#4,\4
|
||||
ii_shift_op0 a\1\2,b,\3r,#5,\4
|
||||
ii_shift_op0 c\1\2,b,\3r,#6,\4
|
||||
ii_shift_op0 e\1\2,b,\3r,#7,\4
|
||||
ii_shift_op0 1\1\2,b,\3l,#8,\4
|
||||
ii_shift_op0 3\1\2,b,\3l,#1,\4
|
||||
ii_shift_op0 5\1\2,b,\3l,#2,\4
|
||||
ii_shift_op0 7\1\2,b,\3l,#3,\4
|
||||
ii_shift_op0 9\1\2,b,\3l,#4,\4
|
||||
ii_shift_op0 b\1\2,b,\3l,#5,\4
|
||||
ii_shift_op0 d\1\2,b,\3l,#6,\4
|
||||
ii_shift_op0 f\1\2,b,\3l,#7,\4
|
||||
.endm
|
||||
|
||||
ii_shift_op1bb:.macro // z.B. asr.w. #x,dx 1=code 3.ziffer 2=code 4.ziffer 3=shift art 4=dx
|
||||
ii_shift_op0b 0\1\2,b,\3r,d0_off(a7),\4
|
||||
ii_shift_op0b 2\1\2,b,\3r,d1_off(a7),\4
|
||||
ii_shift_op0 4\1\2,b,\3r,d2,\4
|
||||
ii_shift_op0 6\1\2,b,\3r,d3,\4
|
||||
ii_shift_op0 8\1\2,b,\3r,d4,\4
|
||||
ii_shift_op0 a\1\2,b,\3r,d5,\4
|
||||
ii_shift_op0 c\1\2,b,\3r,d6,\4
|
||||
ii_shift_op0 e\1\2,b,\3r,d7,\4
|
||||
ii_shift_op0b 1\1\2,b,\3l,d0_off(a7),\4
|
||||
ii_shift_op0b 3\1\2,b,\3l,d1_off(a7),\4
|
||||
ii_shift_op0 5\1\2,b,\3l,d2,\4
|
||||
ii_shift_op0 7\1\2,b,\3l,d3,\4
|
||||
ii_shift_op0 9\1\2,b,\3l,d4,\4
|
||||
ii_shift_op0 b\1\2,b,\3l,d5,\4
|
||||
ii_shift_op0 d\1\2,b,\3l,d6,\4
|
||||
ii_shift_op0 f\1\2,b,\3l,d7,\4
|
||||
.endm
|
||||
// word ---------------------------------------
|
||||
ii_shift_op2agw:.macro //byt: 1=code 2=operation 3=quick(a) oder register(b)
|
||||
ii_shift_op1\3w \1,0,\2,d0_off+2(a7)
|
||||
ii_shift_op1\3w \1,1,\2,d1_off+2(a7)
|
||||
ii_shift_op1\3w \1,2,\2,d2
|
||||
ii_shift_op1\3w \1,3,\2,d3
|
||||
ii_shift_op1\3w \1,4,\2,d4
|
||||
ii_shift_op1\3w \1,5,\2,d5
|
||||
ii_shift_op1\3w \1,6,\2,d6
|
||||
ii_shift_op1\3w \1,7,\2,d7
|
||||
.endm
|
||||
|
||||
ii_shift_op2auw:.macro //byt: 1=code 2=operation
|
||||
ii_shift_op1\3w \1,8,\2,d0_off+2(a7)
|
||||
ii_shift_op1\3w \1,9,\2,d1_off+2(a7)
|
||||
ii_shift_op1\3w \1,a,\2,d2
|
||||
ii_shift_op1\3w \1,b,\2,d3
|
||||
ii_shift_op1\3w \1,c,\2,d4
|
||||
ii_shift_op1\3w \1,d,\2,d5
|
||||
ii_shift_op1\3w \1,e,\2,d6
|
||||
ii_shift_op1\3w \1,f,\2,d7
|
||||
.endm
|
||||
|
||||
ii_shift_op1aw:.macro // z.B. asr.w. #x,dx 1=code 3.ziffer 2=code 4.ziffer 3=shift art 4=dx
|
||||
ii_shift_op0 0\1\2,w,\3r,#8,\4
|
||||
ii_shift_op0 2\1\2,w,\3r,#1,\4
|
||||
ii_shift_op0 4\1\2,w,\3r,#2,\4
|
||||
ii_shift_op0 6\1\2,w,\3r,#3,\4
|
||||
ii_shift_op0 8\1\2,w,\3r,#4,\4
|
||||
ii_shift_op0 a\1\2,w,\3r,#5,\4
|
||||
ii_shift_op0 c\1\2,w,\3r,#6,\4
|
||||
ii_shift_op0 e\1\2,w,\3r,#7,\4
|
||||
ii_shift_op0 1\1\2,w,\3l,#8,\4
|
||||
ii_shift_op0 3\1\2,w,\3l,#1,\4
|
||||
ii_shift_op0 5\1\2,w,\3l,#2,\4
|
||||
ii_shift_op0 7\1\2,w,\3l,#3,\4
|
||||
ii_shift_op0 9\1\2,w,\3l,#4,\4
|
||||
ii_shift_op0 b\1\2,w,\3l,#5,\4
|
||||
ii_shift_op0 d\1\2,w,\3l,#6,\4
|
||||
ii_shift_op0 f\1\2,w,\3l,#7,\4
|
||||
.endm
|
||||
|
||||
ii_shift_op1bw:.macro // z.B. asr.w. #x,dx 1=code 3.ziffer 2=code 4.ziffer 3=shift art 4=dx
|
||||
ii_shift_op0b 0\1\2,w,\3r,d0_off(a7),\4
|
||||
ii_shift_op0b 2\1\2,w,\3r,d1_off(a7),\4
|
||||
ii_shift_op0 4\1\2,w,\3r,d2,\4
|
||||
ii_shift_op0 6\1\2,w,\3r,d3,\4
|
||||
ii_shift_op0 8\1\2,w,\3r,d4,\4
|
||||
ii_shift_op0 a\1\2,w,\3r,d5,\4
|
||||
ii_shift_op0 c\1\2,w,\3r,d6,\4
|
||||
ii_shift_op0 e\1\2,w,\3r,d7,\4
|
||||
ii_shift_op0b 1\1\2,w,\3l,d0_off(a7),\4
|
||||
ii_shift_op0b 3\1\2,w,\3l,d1_off(a7),\4
|
||||
ii_shift_op0 5\1\2,w,\3l,d2,\4
|
||||
ii_shift_op0 7\1\2,w,\3l,d3,\4
|
||||
ii_shift_op0 9\1\2,w,\3l,d4,\4
|
||||
ii_shift_op0 b\1\2,w,\3l,d5,\4
|
||||
ii_shift_op0 d\1\2,w,\3l,d6,\4
|
||||
ii_shift_op0 f\1\2,w,\3l,d7,\4
|
||||
.endm
|
||||
// long ---------------------------------------
|
||||
ii_shift_op2agl:.macro //byt: 1=code 2=operation 3=quick(a) oder register(b)
|
||||
ii_shift_op1\3l \1,0,\2,d0_off(a7)
|
||||
ii_shift_op1\3l \1,1,\2,d1_off(a7)
|
||||
ii_shift_op1\3l \1,2,\2,d2
|
||||
ii_shift_op1\3l \1,3,\2,d3
|
||||
ii_shift_op1\3l \1,4,\2,d4
|
||||
ii_shift_op1\3l \1,5,\2,d5
|
||||
ii_shift_op1\3l \1,6,\2,d6
|
||||
ii_shift_op1\3l \1,7,\2,d7
|
||||
.endm
|
||||
|
||||
ii_shift_op2aul:.macro //byt: 1=code 2=operation
|
||||
ii_shift_op1\3l \1,8,\2,d0_off(a7)
|
||||
ii_shift_op1\3l \1,9,\2,d1_off(a7)
|
||||
ii_shift_op1\3l \1,a,\2,d2
|
||||
ii_shift_op1\3l \1,b,\2,d3
|
||||
ii_shift_op1\3l \1,c,\2,d4
|
||||
ii_shift_op1\3l \1,d,\2,d5
|
||||
ii_shift_op1\3l \1,e,\2,d6
|
||||
ii_shift_op1\3l \1,f,\2,d7
|
||||
.endm
|
||||
|
||||
ii_shift_op1al:.macro // z.B. asr.w. #x,dx 1=code 3.ziffer 2=code 4.ziffer 3=shift art 4=dx
|
||||
ii_shift_op0 0\1\2,l,\3r,#8,\4
|
||||
ii_shift_op0 2\1\2,l,\3r,#1,\4
|
||||
ii_shift_op0 4\1\2,l,\3r,#2,\4
|
||||
ii_shift_op0 6\1\2,l,\3r,#3,\4
|
||||
ii_shift_op0 8\1\2,l,\3r,#4,\4
|
||||
ii_shift_op0 a\1\2,l,\3r,#5,\4
|
||||
ii_shift_op0 c\1\2,l,\3r,#6,\4
|
||||
ii_shift_op0 e\1\2,l,\3r,#7,\4
|
||||
ii_shift_op0 1\1\2,l,\3l,#8,\4
|
||||
ii_shift_op0 3\1\2,l,\3l,#1,\4
|
||||
ii_shift_op0 5\1\2,l,\3l,#2,\4
|
||||
ii_shift_op0 7\1\2,l,\3l,#3,\4
|
||||
ii_shift_op0 9\1\2,l,\3l,#4,\4
|
||||
ii_shift_op0 b\1\2,l,\3l,#5,\4
|
||||
ii_shift_op0 d\1\2,l,\3l,#6,\4
|
||||
ii_shift_op0 f\1\2,l,\3l,#7,\4
|
||||
.endm
|
||||
|
||||
ii_shift_op1bl:.macro // z.B. asr.w. #x,dx 1=code 3.ziffer 2=code 4.ziffer 3=shift art 4=dx
|
||||
ii_shift_op0b 0\1\2,l,\3r,d0_off(a7),\4
|
||||
ii_shift_op0b 2\1\2,l,\3r,d1_off(a7),\4
|
||||
ii_shift_op0 4\1\2,l,\3r,d2,\4
|
||||
ii_shift_op0 6\1\2,l,\3r,d3,\4
|
||||
ii_shift_op0 8\1\2,l,\3r,d4,\4
|
||||
ii_shift_op0 a\1\2,l,\3r,d5,\4
|
||||
ii_shift_op0 c\1\2,l,\3r,d6,\4
|
||||
ii_shift_op0 e\1\2,l,\3r,d7,\4
|
||||
ii_shift_op0b 1\1\2,l,\3l,d0_off(a7),\4
|
||||
ii_shift_op0b 3\1\2,l,\3l,d1_off(a7),\4
|
||||
ii_shift_op0 5\1\2,l,\3l,d2,\4
|
||||
ii_shift_op0 7\1\2,l,\3l,d3,\4
|
||||
ii_shift_op0 9\1\2,l,\3l,d4,\4
|
||||
ii_shift_op0 b\1\2,l,\3l,d5,\4
|
||||
ii_shift_op0 d\1\2,l,\3l,d6,\4
|
||||
ii_shift_op0 f\1\2,l,\3l,d7,\4
|
||||
.endm
|
||||
// .word ea ============================================
|
||||
ii_shift_op2ea:.macro //1=code 2.ziffer 2=shiftart
|
||||
// (a0) bis (a7) ----------------------------
|
||||
ii_0xe\1d0:
|
||||
move.l a0_off(a7),a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1d1:
|
||||
move.l a1_off(a7),a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1d2:
|
||||
ii_shift_typ w,\2,#1,(a2),(a2).
|
||||
ii_0xe\1d3:
|
||||
ii_shift_typ w,\2,#1,(a3),(a3).
|
||||
ii_0xe\1d4:
|
||||
ii_shift_typ w,\2,#1,(a4),(a4).
|
||||
ii_0xe\1d5:
|
||||
ii_shift_typ w,\2,#1,(a5),(a5).
|
||||
ii_0xe\1d6:
|
||||
ii_shift_typ w,\2,#1,(a6),(a6).
|
||||
ii_0xe\1d7:
|
||||
move.l usp,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
// (a0)+ bis (a7)+ -----------------------------
|
||||
ii_0xe\1d8:
|
||||
move.l a0_off(a7),a1
|
||||
addq.l #2,a0_off(a7)
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1d9:
|
||||
move.l a1_off(a7),a1
|
||||
addq.l #2,a0_off(a7)
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1da:
|
||||
ii_shift_typ w,\2,#1,(a2),(a2)+.
|
||||
ii_0xe\1db:
|
||||
ii_shift_typ w,\2,#1,(a3),(a3)+
|
||||
ii_0xe\1dc:
|
||||
ii_shift_typ w,\2,#1,(a4),(a4)+
|
||||
ii_0xe\1dd:
|
||||
ii_shift_typ w,\2,#1,(a5),(a5)+
|
||||
ii_0xe\1de:
|
||||
ii_shift_typ w,\2,#1,(a6),(a6)+
|
||||
ii_0xe\1df:
|
||||
move.l usp,a1
|
||||
addq.l #2,a1
|
||||
move.l a1,usp
|
||||
subq.l #2,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
// -(a0) bis -(a7) -----------------------------
|
||||
ii_0xe\1e0:
|
||||
move.l a0_off(a7),a1
|
||||
subq.l #2,a1
|
||||
move.l a1,a0_off(a7)
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1e1:
|
||||
move.l a1_off(a7),a1
|
||||
subq.l #2,a1
|
||||
move.l a1,a1_off(a7)
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1e2:
|
||||
ii_shift_typ w,\2,#1,-(a2),(a2).
|
||||
ii_0xe\1e3:
|
||||
ii_shift_typ w,\2,#1,-(a3),(a3)
|
||||
ii_0xe\1e4:
|
||||
ii_shift_typ w,\2,#1,-(a4),(a4)
|
||||
ii_0xe\1e5:
|
||||
ii_shift_typ w,\2,#1,-(a5),(a5)
|
||||
ii_0xe\1e6:
|
||||
ii_shift_typ w,\2,#1,-(a6),(a6)
|
||||
ii_0xe\1e7:
|
||||
move.l usp,a1
|
||||
subq.l #2,a1
|
||||
move.l a1,usp
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
// d16(a0) bis d16(a7) -----------------------------
|
||||
ii_0xe\1e8:
|
||||
move.w (a0)+,a1
|
||||
add.l a0_off(a7),a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1e9:
|
||||
move.w (a0)+,a1
|
||||
add.l a1_off(a7),a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1ea:
|
||||
move.w (a0)+,a1
|
||||
add.l a2,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1eb:
|
||||
move.w (a0)+,a1
|
||||
add.l a3,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1)
|
||||
ii_0xe\1ec:
|
||||
move.w (a0)+,a1
|
||||
add.l a4,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1)
|
||||
ii_0xe\1ed:
|
||||
move.w (a0)+,a1
|
||||
add.l a5,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1)
|
||||
ii_0xe\1ee:
|
||||
move.w (a0)+,a1
|
||||
add.l a6,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1)
|
||||
ii_0xe\1ef:
|
||||
mvs.w (a0)+,d0
|
||||
move.l usp,a1
|
||||
add.l d0,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
// d8(a0,dy) bis d8(a7,dy) -----------------------------
|
||||
ii_0xe\1f0:
|
||||
move.l a0_off(a0),a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f1:
|
||||
move.l a1_off(a0),a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f2:
|
||||
move.l a2,a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f3:
|
||||
move.l a3,a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f4:
|
||||
move.l a4,a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f5:
|
||||
move.l a5,a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f6:
|
||||
move.l a6,a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f7:
|
||||
move.l usp,a1
|
||||
jsr ewf
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
// xxx.w xxx.l
|
||||
ii_0xe\1f8:
|
||||
move.w (a0)+,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
ii_0xe\1f9:
|
||||
move.l (a0)+,a1
|
||||
ii_shift_typ w,\2,#1,(a1),(a1).
|
||||
.endm
|
||||
//============================================================================
|
||||
//subroutine
|
||||
//------------------------------
|
||||
ii_shift_op0:.macro // shift: 1=code 2=size 3=shift art 4=shift wert 5=ea
|
||||
ii_0xe\1:
|
||||
ii_shift_typ \2,\3,\4,\5,\5
|
||||
.endm
|
||||
|
||||
ii_shift_op0b:.macro // shift wert nach d0 holen: 1=code 2=size 3=shift art 4=shift wert 5=ea
|
||||
ii_0xe\1:
|
||||
move.l \4,d0
|
||||
ii_shift_typ \2,\3,d0,\5,\5
|
||||
.endm
|
||||
|
||||
ii_shift_typ:.macro //1=size 2=shift art 3=shift wert 4=source 5=dest
|
||||
#ifdef halten
|
||||
halt
|
||||
#endif
|
||||
.ifc asr,\2
|
||||
mvs.\1 \4,d1
|
||||
.else
|
||||
mvz.\1 \4,d1
|
||||
.endif
|
||||
.ifc roxr,\2
|
||||
nop
|
||||
.else
|
||||
.ifc roxl,\2
|
||||
nop
|
||||
.else
|
||||
.ifc ror,\2
|
||||
nop
|
||||
.else
|
||||
.ifc rol,\2
|
||||
nop
|
||||
.else
|
||||
\2.l \3,d1
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
set_cc0
|
||||
move.\1 d1,\5
|
||||
ii_end
|
||||
.endm
|
||||
584
sources/ii_sub.h
584
sources/ii_sub.h
@@ -1,584 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// sub
|
||||
//--------------------------------------------------------------------
|
||||
/*****************************************************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// byt
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// sub.b #im,dx
|
||||
//--------------------------------------------------------------------
|
||||
subbir_macro:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,d0
|
||||
extb.l d0
|
||||
mvs.b \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.b d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub ea,dx
|
||||
//--------------------------------------------------------------------
|
||||
subdd:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub ea(l)->dy(w),dx z.B. f<>r USP
|
||||
//--------------------------------------------------------------------
|
||||
subddd:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 a1,d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub (ea)->dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
subdda:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub ea->ay,(ay)+,dx
|
||||
//--------------------------------------------------------------------
|
||||
subddai:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 (a1)+,d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub ea->ay,-(ay),dx
|
||||
//--------------------------------------------------------------------
|
||||
subddad:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.\3 -(a1),d0
|
||||
move.l a1,\1
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub d16(ay),dx
|
||||
//--------------------------------------------------------------------
|
||||
subd16ad:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub d8(ay,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
subd8ad:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub xxx.w,dx
|
||||
//--------------------------------------------------------------------
|
||||
subxwd:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub xxx.l,dx
|
||||
//--------------------------------------------------------------------
|
||||
subxld:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub d16(pc),dx
|
||||
//--------------------------------------------------------------------
|
||||
subd16pcd:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
mvs.w (a0)+,d0
|
||||
add.l d0,a1
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub d8(pc,dy),dx
|
||||
//--------------------------------------------------------------------
|
||||
subd8pcd:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d0
|
||||
move.l \2,d1
|
||||
.else
|
||||
mvs.\3 (a1),d0
|
||||
mvs.\3 \2,d1
|
||||
.endif
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// sub dy,ea
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// // sub (ea)->dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
subeda:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,ea->ay,(ay)+
|
||||
//--------------------------------------------------------------------
|
||||
subedai:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 (a1),d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)+
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,ea->ay,(ay)+
|
||||
//--------------------------------------------------------------------
|
||||
subedaid:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 \2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2+
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,ea->ay,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
subedad:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.\3 -(a1),d1
|
||||
move.l a1,\2
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,ea->ay,-(ay)
|
||||
//--------------------------------------------------------------------
|
||||
subedadd:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
mvs.\3 -\2,d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,d16(ay)
|
||||
//--------------------------------------------------------------------
|
||||
sube16ad:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l \2,a1
|
||||
mvs.w (a0)+,d1
|
||||
add.l d1,a1
|
||||
mvs.\3 (a1),d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,d8(ay,dy)
|
||||
//--------------------------------------------------------------------
|
||||
sube8ad:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \2,a1
|
||||
jsr ewf
|
||||
.ifc \3,l
|
||||
move.l (a1),d1
|
||||
move.l \1,d0
|
||||
.else
|
||||
mvs.\3 (a1),d1
|
||||
mvs.\3 \1,d0
|
||||
.endif
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,xxx.w
|
||||
//--------------------------------------------------------------------
|
||||
subxwe:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.w (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // sub dx,xxx.l
|
||||
//--------------------------------------------------------------------
|
||||
subxle:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.\3 \1,d0
|
||||
move.l (a0)+,a1
|
||||
mvs.\3 (a1),d1
|
||||
sub.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
/******************************************************/
|
||||
// adress register
|
||||
/******************************************************/
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w ea,ax
|
||||
//--------------------------------------------------------------------
|
||||
subaw:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l a0,pc_off(a7) // pc auf next
|
||||
movem.l (a7),d0/d1/a0/a1 // register zurp<72>ck
|
||||
mvs.w \1,d0
|
||||
suba.l d0,\2
|
||||
move.l d0_off(a7),d0
|
||||
lea ii_ss(a7),a7 // stack erh<72>hen
|
||||
rte
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// sub.w ea,usp
|
||||
//--------------------------------------------------------------------
|
||||
subawa7:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.w \1,d0
|
||||
move.l usp,a1
|
||||
sub.l d0,a1
|
||||
move.l a1,usp
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w usp?,ax
|
||||
//--------------------------------------------------------------------
|
||||
subawu:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l a0,pc_off(a7) // pc auf next
|
||||
movem.l (a7),d0/d1/a0/a1 // register zurp<72>ck
|
||||
move.l a7,_a7_save
|
||||
move.l usp,a7
|
||||
move.l \1,d0
|
||||
suba.l d0,\2
|
||||
move.l a7,usp
|
||||
move.l _a7_save,a7
|
||||
move.l d0_off(a7),d0
|
||||
lea ii_ss(a7),a7 // stack erh<72>hen
|
||||
rte
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w usp?,usp
|
||||
//--------------------------------------------------------------------
|
||||
subawua7:.macro
|
||||
subawu \1,\2
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w d16(ay),ax
|
||||
//--------------------------------------------------------------------
|
||||
subawd16a:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
mvs.w (a0)+,d0
|
||||
adda.l d0,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
sub.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
subawd8a:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
sub.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w xxx.w,ax
|
||||
//--------------------------------------------------------------------
|
||||
subawxwax:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
suba.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w xxx.l,ax
|
||||
//--------------------------------------------------------------------
|
||||
subawxlax:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l (a0)+,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
suba.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w d16(pc),ax
|
||||
//--------------------------------------------------------------------
|
||||
subawd16pcax:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.w (a0)+,a1
|
||||
adda.l a0,a1
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
suba.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
subawd8pcax:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
mvs.w (a1),d0
|
||||
move.l \2,a1
|
||||
sub.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.w #im,ax
|
||||
//--------------------------------------------------------------------
|
||||
subawim:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
mvs.w \1,d0
|
||||
move.l \2,a1
|
||||
sub.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.l d8(ay,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
subald8a:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l \1,a1
|
||||
jsr ewf
|
||||
move.l (a1),d0
|
||||
move.l \2,a1
|
||||
sub.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // suba.l d8(pc,dy),ax
|
||||
//--------------------------------------------------------------------
|
||||
subakd8pcax:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.l a0,a1
|
||||
jsr ewf
|
||||
move.l (a1),d0
|
||||
move.l \2,a1
|
||||
sub.l d0,a1
|
||||
move.l a1,\2
|
||||
ii_end
|
||||
.endm;
|
||||
//*****************************************************************************************
|
||||
// subx
|
||||
//*****************************************************************************************
|
||||
//--------------------------------------------------------------------
|
||||
// // subx dy,dx
|
||||
//--------------------------------------------------------------------
|
||||
subdx:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.b sr_off+1(a7),d0 //ccr holen
|
||||
move d0,ccr //setzen
|
||||
mvs.\3 \2,d0
|
||||
mvs.\3 \1,d1
|
||||
subx.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,\1
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
// // subx -(ay),-(ax)
|
||||
//--------------------------------------------------------------------
|
||||
subdax:.macro
|
||||
#ifdef halten_sub
|
||||
halt
|
||||
#endif
|
||||
move.b sr_off+1(a7),d0 //ccr holen
|
||||
move d0,ccr //setzen
|
||||
move.l \1,a1
|
||||
.ifc \3,l
|
||||
move.l -(a1),d0
|
||||
.else
|
||||
mvs.\3 -(a1),d0
|
||||
.endif
|
||||
move.l \2,a1
|
||||
.ifc \3,l
|
||||
move.l -(a1),d0
|
||||
.else
|
||||
mvs.\3 -(a1),d1
|
||||
.endif
|
||||
subx.l d0,d1
|
||||
set_cc0
|
||||
move.\3 d1,(a1)
|
||||
ii_end
|
||||
.endm;
|
||||
//--------------------------------------------------------------------
|
||||
@@ -1,24 +1,30 @@
|
||||
/*
|
||||
* illegal_instruction.S
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*/
|
||||
|
||||
.global _illegal_instruction
|
||||
.global _illegal_table_make
|
||||
|
||||
#include "startcf.h"
|
||||
#include "ii_macro.h"
|
||||
#include "ii_func.h"
|
||||
#include "ii_op.h"
|
||||
#include "ii_opc.h"
|
||||
#include "ii_add.h"
|
||||
#include "ii_sub.h"
|
||||
#include "ii_or.h"
|
||||
#include "ii_and.h"
|
||||
#include "ii_dbcc.h"
|
||||
#include "ii_shd.h"
|
||||
#include "ii_movem.h"
|
||||
#include "ii_lea.h"
|
||||
#include "ii_shift.h"
|
||||
#include "ii_exg.h"
|
||||
#include "ii_movep.h"
|
||||
#include "ii_ewf.h"
|
||||
#include "ii_move.h"
|
||||
|
||||
.extern _ii_shift_vec
|
||||
.extern ewf
|
||||
@@ -32,297 +38,5 @@ ii_error:
|
||||
nop
|
||||
|
||||
_illegal_instruction:
|
||||
#ifdef ii_on
|
||||
move.w #0x2700,sr
|
||||
lea -ii_ss(a7),a7
|
||||
movem.l d0/d1/a0/a1,(a7)
|
||||
move.l pc_off(a7),a0 // pc
|
||||
mvz.w (a0)+,d0 // code
|
||||
lea table,a1
|
||||
move.l 0(a1,d0*4),a1
|
||||
jmp (a1)
|
||||
/*************************************************************************************************/
|
||||
#endif
|
||||
_illegal_table_make:
|
||||
#ifdef ii_on
|
||||
lea table,a0
|
||||
moveq #0,d0
|
||||
_itm_loop:
|
||||
move.l #ii_error,(a0)+
|
||||
addq.l #1,d0
|
||||
cmp.l #0xF000,d0
|
||||
bne _itm_loop
|
||||
//-------------------------------------------------------------------------
|
||||
ii_ewf_lset // diverse fehlende adressierungn
|
||||
//-------------------------------------------------------------------------
|
||||
// 0x0000
|
||||
// ori
|
||||
ii_lset_op 00
|
||||
// andi
|
||||
ii_lset_op 02
|
||||
// subi
|
||||
ii_lset_op 04
|
||||
// addi
|
||||
ii_lset_op 06
|
||||
// eori
|
||||
ii_lset_op 0a
|
||||
// cmpi
|
||||
ii_lset_op 0c
|
||||
// movep
|
||||
ii_movep_lset
|
||||
//-------------------------------------------------------------------------
|
||||
// 0x1000 move.b
|
||||
// 0x2000 move.l
|
||||
// 0x3000 move.w
|
||||
ii_move_lset
|
||||
//-------------------------------------------------------------------------
|
||||
// 0x4000
|
||||
//-------------------------------------------------------------------------
|
||||
// negx
|
||||
ii_lset_op 40
|
||||
// neg
|
||||
ii_lset_op 44
|
||||
// not
|
||||
ii_lset_op 46
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// lea d8(ax,dy.w),az; d8(pc,dy.w),az
|
||||
//-------------------------------------------------------------------
|
||||
ii_lea_lset
|
||||
//-------------------------------------------------------------------
|
||||
// movem
|
||||
//-------------------------------------------------------------------
|
||||
ii_movem_lset
|
||||
//-------------------------------------------------------------------------
|
||||
// 0x5000
|
||||
//-------------------------------------------------------------------------
|
||||
// addq, subq
|
||||
ii_lset_op 50
|
||||
ii_lset_op 51
|
||||
ii_lset_op 52
|
||||
ii_lset_op 53
|
||||
ii_lset_op 54
|
||||
ii_lset_op 55
|
||||
ii_lset_op 56
|
||||
ii_lset_op 57
|
||||
ii_lset_op 58
|
||||
ii_lset_op 59
|
||||
ii_lset_op 5a
|
||||
ii_lset_op 5b
|
||||
ii_lset_op 5c
|
||||
ii_lset_op 5d
|
||||
ii_lset_op 5e
|
||||
ii_lset_op 5f
|
||||
// dbcc
|
||||
ii_lset_dbcc
|
||||
// scc
|
||||
ii_lset_opc 50
|
||||
ii_lset_opc 51
|
||||
ii_lset_opc 52
|
||||
ii_lset_opc 53
|
||||
ii_lset_opc 54
|
||||
ii_lset_opc 55
|
||||
ii_lset_opc 56
|
||||
ii_lset_opc 57
|
||||
ii_lset_opc 58
|
||||
ii_lset_opc 59
|
||||
ii_lset_opc 5a
|
||||
ii_lset_opc 5b
|
||||
ii_lset_opc 5c
|
||||
ii_lset_opc 5d
|
||||
ii_lset_opc 5e
|
||||
ii_lset_opc 5f
|
||||
//-------------------------------------------------------------------------
|
||||
// 0x8000 or
|
||||
//-------------------------------------------------------------------------
|
||||
ii_lset_func 8
|
||||
//-------------------------------------------------------------------------
|
||||
// 0x9000 sub
|
||||
//-------------------------------------------------------------------------
|
||||
ii_lset_func 9
|
||||
//-------------------------------------------------------------------------
|
||||
// 0xb000
|
||||
//-------------------------------------------------------------------------
|
||||
// eor
|
||||
ii_lset_op b1
|
||||
ii_lset_op b3
|
||||
ii_lset_op b5
|
||||
ii_lset_op b7
|
||||
ii_lset_op b9
|
||||
ii_lset_op bb
|
||||
ii_lset_op bd
|
||||
ii_lset_op bf
|
||||
//-------------------------------------------------------------------------
|
||||
// 0xc000
|
||||
//-------------------------------------------------------------------------
|
||||
// and
|
||||
ii_lset_func c
|
||||
// exg
|
||||
ii_exg_lset
|
||||
//-------------------------------------------------------------------------
|
||||
// 0xd000 add
|
||||
//-------------------------------------------------------------------------
|
||||
ii_lset_func d
|
||||
//-------------------------------------------------------------------------
|
||||
// 0xe000
|
||||
//-------------------------------------------------------------------------
|
||||
// shift register
|
||||
ii_shift_lset e
|
||||
//-------------------------------------------------
|
||||
// differenz zwischen orginal und gemoved korrigieren
|
||||
lea ii_error(pc),a1
|
||||
move.l a1,d1
|
||||
sub.l #ii_error,d1
|
||||
lea table,a0
|
||||
moveq #0,d0
|
||||
_itkorr_loop:
|
||||
add.l d1,(a0)+
|
||||
addq.l #1,d0
|
||||
cmp.l #0xF000,d0
|
||||
bne _itkorr_loop
|
||||
#endif
|
||||
rts
|
||||
#ifdef ii_on
|
||||
//***********************************************************************************/
|
||||
//-------------------------------------------------------------------------
|
||||
ii_ewf_func // diverse fehlende adressierungn
|
||||
//-------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x0000
|
||||
//--------------------------------------------------------------------
|
||||
// ori 00
|
||||
ii_op 00,or.l,i
|
||||
//--------------------------------------------------------------------
|
||||
// andi 02
|
||||
ii_op 02,and.l,i
|
||||
//--------------------------------------------------------------------
|
||||
// subi 04
|
||||
ii_op 04,and.l,i
|
||||
//--------------------------------------------------------------------
|
||||
// addi 06
|
||||
ii_op 06,add.l,i
|
||||
//--------------------------------------------------------------------
|
||||
// eori 0a
|
||||
ii_op 0a,eor.l,i
|
||||
//--------------------------------------------------------------------
|
||||
// cmpi 0c
|
||||
ii_op 0c,cmp.l,i
|
||||
//--------------------------------------------------------------------
|
||||
// movep
|
||||
ii_movep_func
|
||||
///---------------------------------------------------------------------------------------------
|
||||
// 0x1000 move.b
|
||||
// 0x2000 move.l
|
||||
// 0x3000 move.w
|
||||
ii_move_op
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x4000
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// neg 0x40..
|
||||
ii_op 40,negx.l,n
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// neg 0x44..
|
||||
ii_op 44,neg.l,n
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// not 0x46..
|
||||
ii_op 46,not.l,n
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// lea d8(ax,dy.w),az; d8(pc,dy.w),az
|
||||
//-------------------------------------------------------------------
|
||||
ii_lea_func
|
||||
//-------------------------------------------------------------------
|
||||
// movem
|
||||
//--------------------------------------------------------------------
|
||||
ii_movem_func
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x5000
|
||||
//---------------------------------------------------------------------------------------------
|
||||
//dbcc
|
||||
ii_dbcc_func
|
||||
// addq 0x5...
|
||||
ii_op 50,addq.l #8,q
|
||||
ii_op 52,addq.l #1,q
|
||||
ii_op 54,addq.l #2,q
|
||||
ii_op 56,addq.l #3,q
|
||||
ii_op 58,addq.l #4,q
|
||||
ii_op 5a,addq.l #5,q
|
||||
ii_op 5c,addq.l #6,q
|
||||
ii_op 5e,addq.l #7,q
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// subq 0x5...
|
||||
ii_op 51,subq.l #8,q
|
||||
ii_op 53,subq.l #1,q
|
||||
ii_op 55,subq.l #2,q
|
||||
ii_op 57,subq.l #3,q
|
||||
ii_op 59,subq.l #4,q
|
||||
ii_op 5b,subq.l #5,q
|
||||
ii_op 5d,subq.l #6,q
|
||||
ii_op 5f,subq.l #7,q
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x5... scc
|
||||
ii_opc 50,st,c
|
||||
ii_opc 51,sf,c
|
||||
ii_opc 52,shi,c
|
||||
ii_opc 53,sls,c
|
||||
ii_opc 54,scc,c
|
||||
ii_opc 55,scs,c
|
||||
ii_opc 56,sne,c
|
||||
ii_opc 57,seq,c
|
||||
ii_opc 58,svc,c
|
||||
ii_opc 59,svs,c
|
||||
ii_opc 5a,spl,c
|
||||
ii_opc 5b,smi,c
|
||||
ii_opc 5c,sge,c
|
||||
ii_opc 5d,slt,c
|
||||
ii_opc 5e,sgt,c
|
||||
ii_opc 5f,sle,c
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x6000
|
||||
//--------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x7000
|
||||
//--------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x8000
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// or
|
||||
ii_func 8,or
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0x9000
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// sub
|
||||
ii_func 9,sub
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0xa000
|
||||
//--------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0xb000
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// eor
|
||||
ii_op b1,eor.l d0,q
|
||||
ii_op b3,eor.l d1,q
|
||||
ii_op b5,eor.l d2,q
|
||||
ii_op b7,eor.l d3,q
|
||||
ii_op b9,eor.l d4,q
|
||||
ii_op bb,eor.l d5,q
|
||||
ii_op bd,eor.l d6,q
|
||||
ii_op bf,eor.l d7,q
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0xc000
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// and
|
||||
ii_func c,and
|
||||
// exg
|
||||
ii_exg_func
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0xd000
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// add
|
||||
ii_func d,add
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// 0xe000 shift
|
||||
//--------------------------------------------------------------------
|
||||
ii_shift_op
|
||||
//--------------------------------------------------------------------
|
||||
// 0xf000
|
||||
//--------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
/*
|
||||
* init_fpga.c
|
||||
*
|
||||
* Created on: 16.10.2012
|
||||
* Author: Markus Fröschle
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*
|
||||
*/
|
||||
|
||||
#include <MCF5475.h>
|
||||
#include "sysinit.h"
|
||||
|
||||
@@ -14,8 +32,6 @@
|
||||
#define FPGA_CONF_DONE (1 << 5)
|
||||
|
||||
extern void xprintf_before_copy(const char *fmt, ...);
|
||||
extern void display_progress_before_copy(void);
|
||||
extern void wait_10ms();
|
||||
|
||||
#define xprintf xprintf_before_copy
|
||||
#define display_progress display_progress_before_copy
|
||||
@@ -27,7 +43,7 @@ void init_fpga(void)
|
||||
register uint8_t *fpga_data;
|
||||
register int i;
|
||||
|
||||
xprintf("FPGA load data...\r\n");
|
||||
xprintf("FPGA load config... ");
|
||||
|
||||
|
||||
MCF_GPIO_PODR_FEC1L &= ~FPGA_CLOCK; /* FPGA clock => low */
|
||||
@@ -60,12 +76,6 @@ void init_fpga(void)
|
||||
do
|
||||
{
|
||||
uint8_t value = *fpga_data++;
|
||||
|
||||
if (((int) fpga_data % 0x100) == 0) {
|
||||
xprintf("%08x ", fpga_data);
|
||||
display_progress();
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++, value >>= 1)
|
||||
{
|
||||
|
||||
@@ -87,12 +97,13 @@ void init_fpga(void)
|
||||
|
||||
if (fpga_data < (uint8_t *) FPGA_FLASH_DATA_END)
|
||||
{
|
||||
for (i = 0; i < 4000; i++)
|
||||
while (fpga_data++ < (uint8_t *) FPGA_FLASH_DATA_END)
|
||||
{
|
||||
/* toggle a little more since it's fun ;) */
|
||||
MCF_GPIO_PODR_FEC1L |= FPGA_CLOCK;
|
||||
MCF_GPIO_PODR_FEC1L &= ~FPGA_CLOCK;
|
||||
}
|
||||
|
||||
xprintf("finished\r\n");
|
||||
}
|
||||
else
|
||||
|
||||
70
sources/interrupts.c
Normal file
70
sources/interrupts.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Interrupts
|
||||
*
|
||||
* Handle interrupts, the levels.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <i2c_firebee.h>
|
||||
|
||||
#include <MCF5475.h>
|
||||
|
||||
int
|
||||
register_handler(uint8_t priority, uint8_t intr, void (*func)())
|
||||
{
|
||||
int i;
|
||||
uint8_t level = 0b01111111;
|
||||
uint32_t *adr = MBAR_ADDRESS;
|
||||
uint8_t ol = 0,op = 0;
|
||||
|
||||
intr &= 63;
|
||||
priority &= 7;
|
||||
|
||||
if( intr <= 0 )
|
||||
return -1;
|
||||
|
||||
for(i=1;i<64;i++)
|
||||
if( i!=intr )
|
||||
{
|
||||
if( MCF_INTC_ICR(i)&7 == priority )
|
||||
clear_bit_nr(level,(MCF_INTC_ICR(i)>>3)&7);
|
||||
}
|
||||
|
||||
for(i=0;1<7;i++)
|
||||
if( level&(1<<i) )
|
||||
break;
|
||||
|
||||
if( i>=7 )
|
||||
return -1;
|
||||
|
||||
// Make sure priority level is high, before changing registers
|
||||
__asm__ volatile (
|
||||
"move.w sr,d0\n\t" \
|
||||
"move.w d0,-(sp) \n\t" \
|
||||
"move.w #0x2700,sr\n\t" \
|
||||
: \
|
||||
: \
|
||||
: "sp","d0","memory" \
|
||||
);
|
||||
|
||||
if( intr < 32 )
|
||||
clear_bit(MCF_INTC_IMRL,(1<<intr));
|
||||
else
|
||||
clear_bit(MCF_INTC_IMRH,(1<<(intr-32)));
|
||||
|
||||
MCF_INTC_ICR(intr) = MCF_INTC_ICR_IP(priority)|MCF_INTC_ICR_IL(i);
|
||||
adr[intr*4] = func;
|
||||
|
||||
// Return the saved priority level
|
||||
__asm__ volatile (
|
||||
"move.w (sp)+,d2\n\t" \
|
||||
"move.w d2,sr\n\t"
|
||||
: \
|
||||
: \
|
||||
: "sp","d2","memory" \
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/*******************************************************/
|
||||
// allgemeine macros
|
||||
/*******************************************************/
|
||||
.text
|
||||
wait_pll: .macro
|
||||
wait1_pll\@:
|
||||
tst.w (a1)
|
||||
bmi wait1_pll\@
|
||||
rts
|
||||
.endm
|
||||
100
sources/main.c
Normal file
100
sources/main.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* FatFs sample project for generic microcontrollers (C)ChaN, 2012 */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ff.h"
|
||||
|
||||
|
||||
FATFS Fatfs; /* File system object */
|
||||
FIL Fil; /* File object */
|
||||
uint8_t Buff[128]; /* File read buffer */
|
||||
|
||||
|
||||
void die ( /* Stop with dying message */
|
||||
FRESULT rc /* FatFs return value */
|
||||
)
|
||||
{
|
||||
xprintf("Failed with rc=%u.\n", rc);
|
||||
for (;;) ;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Program Main */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
int main (void)
|
||||
{
|
||||
FRESULT rc; /* Result code */
|
||||
DIR dir; /* Directory object */
|
||||
FILINFO fno; /* File information object */
|
||||
uint32_t bw, br, i;
|
||||
|
||||
|
||||
f_mount(0, &Fatfs); /* Register volume work area (never fails) */
|
||||
|
||||
xprintf("\nOpen an existing file (message.txt).\n");
|
||||
rc = f_open(&Fil, "MESSAGE.TXT", FA_READ);
|
||||
if (rc) die(rc);
|
||||
|
||||
xprintf("\nType the file content.\n");
|
||||
for (;;) {
|
||||
rc = f_read(&Fil, Buff, sizeof Buff, &br); /* Read a chunk of file */
|
||||
if (rc || !br) break; /* Error or end of file */
|
||||
for (i = 0; i < br; i++) /* Type the data */
|
||||
putchar(Buff[i]);
|
||||
}
|
||||
if (rc) die(rc);
|
||||
|
||||
xprintf("\nClose the file.\n");
|
||||
rc = f_close(&Fil);
|
||||
if (rc) die(rc);
|
||||
|
||||
xprintf("\nCreate a new file (hello.txt).\n");
|
||||
rc = f_open(&Fil, "HELLO.TXT", FA_WRITE | FA_CREATE_ALWAYS);
|
||||
if (rc) die(rc);
|
||||
|
||||
xprintf("\nWrite a text data. (Hello world!)\n");
|
||||
rc = f_write(&Fil, "Hello world!\r\n", 14, &bw);
|
||||
if (rc) die(rc);
|
||||
xprintf("%u bytes written.\n", bw);
|
||||
|
||||
xprintf("\nClose the file.\n");
|
||||
rc = f_close(&Fil);
|
||||
if (rc) die(rc);
|
||||
|
||||
xprintf("\nOpen root directory.\n");
|
||||
rc = f_opendir(&dir, "");
|
||||
if (rc) die(rc);
|
||||
|
||||
xprintf("\nDirectory listing...\n");
|
||||
for (;;) {
|
||||
rc = f_readdir(&dir, &fno); /* Read a directory item */
|
||||
if (rc || !fno.fname[0]) break; /* Error or end of dir */
|
||||
if (fno.fattrib & AM_DIR)
|
||||
xprintf(" <dir> %s\n", fno.fname);
|
||||
else
|
||||
xprintf("%8lu %s\n", fno.fsize, fno.fname);
|
||||
}
|
||||
if (rc) die(rc);
|
||||
|
||||
xprintf("\nTest completed.\n");
|
||||
for (;;) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------*/
|
||||
/* User Provided Timer Function for FatFs module */
|
||||
/*---------------------------------------------------------*/
|
||||
|
||||
uint32_t get_fattime (void)
|
||||
{
|
||||
return ((uint32_t)(2012 - 1980) << 25) /* Year = 2012 */
|
||||
| ((uint32_t)1 << 21) /* Month = 1 */
|
||||
| ((uint32_t)1 << 16) /* Day_m = 1*/
|
||||
| ((uint32_t)0 << 11) /* Hour = 0 */
|
||||
| ((uint32_t)0 << 5) /* Min = 0 */
|
||||
| ((uint32_t)0 >> 1); /* Sec = 0 */
|
||||
}
|
||||
652
sources/mmc.c
Normal file
652
sources/mmc.c
Normal file
@@ -0,0 +1,652 @@
|
||||
#include <stdint.h>
|
||||
#include <bas_types.h>
|
||||
#include <sd_card.h>
|
||||
#include <bas_printf.h>
|
||||
#include <sysinit.h>
|
||||
#include <wait.h>
|
||||
#include <MCF5475.h>
|
||||
|
||||
/*
|
||||
* Firebee: MMCv3/SDv1/SDv2 (SPI mode) control module
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2011, ChaN, all right reserved.
|
||||
*
|
||||
* This software is a free software and there is NO WARRANTY.
|
||||
* No restriction on use. You can use, modify and redistribute it for
|
||||
* personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
|
||||
* Redistributions of source code must retain the above copyright notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2012, mfro, all rights reserved. */
|
||||
|
||||
|
||||
#define CS_HIGH() { dspi_fifo_val &= ~MCF_DSPI_DTFR_CS5; }
|
||||
#define CS_LOW() { dspi_fifo_val |= MCF_DSPI_DTFR_CS5; }
|
||||
|
||||
#define SPICLK_FAST() { MCF_DSPI_DCTAR0 = MCF_DSPI_DCTAR_TRSZ(0b111) | /* transfer size = 8 bit */ \
|
||||
MCF_DSPI_DCTAR_PCSSCK(0b11) | /* 1 clock DSPICS to DSPISCK delay prescaler */ \
|
||||
MCF_DSPI_DCTAR_PASC_3CLK | /* 1 clock DSPISCK to DSPICS negation prescaler */ \
|
||||
MCF_DSPI_DCTAR_PDT_3CLK | /* 1 clock delay between DSPICS assertions prescaler */ \
|
||||
MCF_DSPI_DCTAR_PBR_3CLK | /* 3 clock Baudrate prescaler */ \
|
||||
MCF_DSPI_DCTAR_ASC(0b0000) | /* 2 */ \
|
||||
MCF_DSPI_DCTAR_DT(0b0000) | /* 2 */ \
|
||||
MCF_DSPI_DCTAR_BR(0b0000); } /* clock / 2 */
|
||||
|
||||
#define SPICLK_SLOW() { MCF_DSPI_DCTAR0 = MCF_DSPI_DCTAR_TRSZ(0b111) | /* transfer size = 8 bit */ \
|
||||
MCF_DSPI_DCTAR_PCSSCK(0b01) | /* 3 clock DSPICS to DSPISCK delay prescaler */ \
|
||||
MCF_DSPI_DCTAR_PASC_3CLK | /* 3 clock DSPISCK to DSPICS negation prescaler */ \
|
||||
MCF_DSPI_DCTAR_PDT_3CLK | /* 3 clock delay between DSPICS assertions prescaler */ \
|
||||
MCF_DSPI_DCTAR_PBR_3CLK | /* 3 clock prescaler */ \
|
||||
MCF_DSPI_DCTAR_ASC(0b1001) | /* 1024 */ \
|
||||
MCF_DSPI_DCTAR_DT(0b1001) | /* 1024 */ \
|
||||
MCF_DSPI_DCTAR_BR(0b0111); }
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
Module Private Functions
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#include "diskio.h"
|
||||
|
||||
|
||||
/* MMC/SD command */
|
||||
#define CMD0 (0) /* GO_IDLE_STATE */
|
||||
#define CMD1 (1) /* SEND_OP_COND (MMC) */
|
||||
#define ACMD41 (0x80+41) /* SEND_OP_COND (SDC) */
|
||||
#define CMD8 (8) /* SEND_IF_COND */
|
||||
#define CMD9 (9) /* SEND_CSD */
|
||||
#define CMD10 (10) /* SEND_CID */
|
||||
#define CMD12 (12) /* STOP_TRANSMISSION */
|
||||
#define ACMD13 (0x80+13) /* SD_STATUS (SDC) */
|
||||
#define CMD16 (16) /* SET_BLOCKLEN */
|
||||
#define CMD17 (17) /* READ_SINGLE_BLOCK */
|
||||
#define CMD18 (18) /* READ_MULTIPLE_BLOCK */
|
||||
#define CMD23 (23) /* SET_BLOCK_COUNT (MMC) */
|
||||
#define ACMD23 (0x80+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */
|
||||
#define CMD24 (24) /* WRITE_BLOCK */
|
||||
#define CMD25 (25) /* WRITE_MULTIPLE_BLOCK */
|
||||
#define CMD32 (32) /* ERASE_ER_BLK_START */
|
||||
#define CMD33 (33) /* ERASE_ER_BLK_END */
|
||||
#define CMD38 (38) /* ERASE */
|
||||
#define CMD55 (55) /* APP_CMD */
|
||||
#define CMD58 (58) /* READ_OCR */
|
||||
|
||||
|
||||
static volatile DSTATUS Stat = 0 /* STA_NOINIT */; /* Physical drive status */
|
||||
static uint8_t CardType; /* Card type flags */
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Send/Receive data to the MMC (Platform dependent) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static uint32_t dspi_fifo_val = /* CONT disable continous chip select */
|
||||
/* CTAS use DCTAR0 for clock and attributes */
|
||||
MCF_DSPI_DTFR_EOQ | /* current transfer is last in queue */
|
||||
MCF_DSPI_DTFR_CTCNT;
|
||||
|
||||
/* Exchange a byte */
|
||||
static uint8_t xchg_spi(uint8_t byte)
|
||||
{
|
||||
uint32_t fifo = dspi_fifo_val | byte;
|
||||
uint8_t res;
|
||||
|
||||
MCF_DSPI_DTFR = fifo;
|
||||
while (! (MCF_DSPI_DSR & MCF_DSPI_DSR_TCF)); /* wait until DSPI transfer complete */
|
||||
MCF_DSPI_DSR = 0xffffffff; /* clear DSPI status register */
|
||||
|
||||
fifo = MCF_DSPI_DRFR;
|
||||
MCF_DSPI_DSR = 0xffffffff;
|
||||
res = fifo & 0xff;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/* Receive multiple byte
|
||||
*
|
||||
* buff: pointer to data buffer
|
||||
* btr: number of bytes to receive (16, 64 or 512)
|
||||
*/
|
||||
static void rcvr_spi_multi(uint8_t *buff, uint32_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
*buff++ = xchg_spi(0xff);
|
||||
}
|
||||
|
||||
|
||||
#if _USE_WRITE
|
||||
/* Send multiple byte
|
||||
*
|
||||
* buff: pointer to data
|
||||
* btx: number of bytes to send
|
||||
*/
|
||||
static void xmit_spi_multi(const uint8_t *buff, uint32_t btx)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < btx; i++)
|
||||
xchg_spi(*buff++);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static bool card_ready(void)
|
||||
{
|
||||
uint8_t d;
|
||||
|
||||
d = xchg_spi(0xff);
|
||||
return (d == 0xff);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for card ready
|
||||
*
|
||||
* wt: timeout in ms
|
||||
* returns 1: ready, 0: timeout
|
||||
*/
|
||||
static int wait_ready(uint32_t wt)
|
||||
{
|
||||
return waitfor(wt, card_ready);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Deselect card and release SPI
|
||||
*/
|
||||
static void deselect(void)
|
||||
{
|
||||
CS_HIGH();
|
||||
xchg_spi(0xFF); /* Dummy clock (force DO hi-z for multiple slave SPI) */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Select card and wait for ready
|
||||
*/
|
||||
|
||||
static int select(void) /* 1:OK, 0:Timeout */
|
||||
{
|
||||
CS_LOW();
|
||||
|
||||
xchg_spi(0xFF); /* Dummy clock (force DO enabled) */
|
||||
|
||||
if (wait_ready(5000000))
|
||||
return 1; /* OK */
|
||||
deselect();
|
||||
return 0; /* Timeout */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Control SPI module (Platform dependent)
|
||||
*/
|
||||
static void power_on (void) /* Enable SSP module */
|
||||
{
|
||||
MCF_PAD_PAR_DSPI = 0x1fff; /* configure all DSPI GPIO pins for DSPI usage */
|
||||
|
||||
/*
|
||||
* FIXME: really necessary or just an oversight
|
||||
* that PAD_PAR_DSPI is only 16 bit?
|
||||
*/
|
||||
// MCF_PAD_PAR_TIMER = 0xff; leave off for now
|
||||
|
||||
/*
|
||||
* initialize DSPI module configuration register
|
||||
*/
|
||||
MCF_DSPI_DMCR = MCF_DSPI_DMCR_MSTR | /* FireBee is DSPI master*/
|
||||
MCF_DSPI_DMCR_CSIS5 | /* CS5 inactive state high */
|
||||
MCF_DSPI_DMCR_CSIS3 | /* CS3 inactive state high */
|
||||
MCF_DSPI_DMCR_CSIS2 | /* CS2 inactive state high */
|
||||
MCF_DSPI_DMCR_DTXF | /* disable transmit FIFO */
|
||||
MCF_DSPI_DMCR_DRXF | /* disable receive FIFO */
|
||||
MCF_DSPI_DMCR_CTXF | /* clear transmit FIFO */
|
||||
MCF_DSPI_DMCR_CRXF; /* clear receive FIFO */
|
||||
|
||||
/* initialize DSPI clock and transfer attributes register 0 */
|
||||
MCF_DSPI_DCTAR0 = MCF_DSPI_DCTAR_TRSZ(0b111) | /* transfer size = 8 bit */
|
||||
MCF_DSPI_DCTAR_PCSSCK(0b01) | /* 3 clock DSPICS to DSPISCK delay prescaler */
|
||||
MCF_DSPI_DCTAR_PASC_3CLK | /* 3 clock DSPISCK to DSPICS negation prescaler */
|
||||
MCF_DSPI_DCTAR_PDT_3CLK | /* 3 clock delay between DSPICS assertions prescaler */
|
||||
MCF_DSPI_DCTAR_PBR_3CLK | /* 3 clock prescaler */
|
||||
MCF_DSPI_DCTAR_ASC(0b1001) | /* 1024 */
|
||||
MCF_DSPI_DCTAR_DT(0b1001) | /* 1024 */
|
||||
MCF_DSPI_DCTAR_BR(0b0111);
|
||||
|
||||
CS_HIGH(); /* Set CS# high */
|
||||
|
||||
/* card should now be initialized as MMC */
|
||||
|
||||
wait(10 * 1000); /* 10ms */
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void power_off (void) /* Disable SPI function */
|
||||
{
|
||||
select(); /* Wait for card ready */
|
||||
deselect();
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Receive a data packet from the MMC */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static
|
||||
int rcvr_datablock ( /* 1:OK, 0:Error */
|
||||
uint8_t *buff, /* Data buffer */
|
||||
uint32_t btr /* Data block length (byte) */
|
||||
)
|
||||
{
|
||||
uint8_t token;
|
||||
uint32_t target = MCF_SLT_SCNT(0) - (400 * 1000L * 132);
|
||||
|
||||
do { /* Wait for DataStart token in timeout of 200ms */
|
||||
token = xchg_spi(0xFF);
|
||||
/* This loop will take a time. Insert rot_rdq() here for multitask envilonment. */
|
||||
} while ((token == 0xFF) && MCF_SLT_SCNT(0) > target);
|
||||
if(token != 0xFE) return 0; /* Function fails if invalid DataStart token or timeout */
|
||||
|
||||
rcvr_spi_multi(buff, btr); /* Store trailing data to the buffer */
|
||||
xchg_spi(0xFF); xchg_spi(0xFF); /* Discard CRC */
|
||||
|
||||
return 1; /* Function succeeded */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Send a data packet to the MMC */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#if _USE_WRITE
|
||||
static
|
||||
int xmit_datablock ( /* 1:OK, 0:Failed */
|
||||
const uint8_t *buff, /* Ponter to 512 byte data to be sent */
|
||||
uint8_t token /* Token */
|
||||
)
|
||||
{
|
||||
uint8_t resp;
|
||||
|
||||
|
||||
if (!wait_ready(500)) return 0; /* Wait for card ready */
|
||||
|
||||
xchg_spi(token); /* Send token */
|
||||
if (token != 0xFD) { /* Send data if token is other than StopTran */
|
||||
xmit_spi_multi(buff, 512); /* Data */
|
||||
xchg_spi(0xFF); xchg_spi(0xFF); /* Dummy CRC */
|
||||
|
||||
resp = xchg_spi(0xFF); /* Receive data resp */
|
||||
if ((resp & 0x1F) != 0x05) /* Function fails if the data packet was not accepted */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Send a command packet to the MMC */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
static uint8_t send_cmd ( /* Return value: R1 resp (bit7==1:Failed to send) */
|
||||
uint8_t cmd, /* Command index */
|
||||
uint32_t arg /* Argument */
|
||||
)
|
||||
{
|
||||
uint8_t n, res;
|
||||
|
||||
|
||||
if (cmd & 0x80) { /* Send a CMD55 prior to ACMD<n> */
|
||||
cmd &= 0x7F;
|
||||
res = send_cmd(CMD55, 0);
|
||||
if (res > 1) return res;
|
||||
}
|
||||
|
||||
/* Select card */
|
||||
deselect();
|
||||
if (!select()) return 0xFF;
|
||||
|
||||
/* Send command packet */
|
||||
xchg_spi(0x40 | cmd); /* Start + command index */
|
||||
xchg_spi((uint8_t)(arg >> 24)); /* Argument[31..24] */
|
||||
xchg_spi((uint8_t)(arg >> 16)); /* Argument[23..16] */
|
||||
xchg_spi((uint8_t)(arg >> 8)); /* Argument[15..8] */
|
||||
xchg_spi((uint8_t)arg); /* Argument[7..0] */
|
||||
n = 0x01; /* Dummy CRC + Stop */
|
||||
if (cmd == CMD0) n = 0x95; /* Valid CRC for CMD0(0) */
|
||||
if (cmd == CMD8) n = 0x87; /* Valid CRC for CMD8(0x1AA) */
|
||||
xchg_spi(n);
|
||||
|
||||
/* Receive command resp */
|
||||
if (cmd == CMD12) xchg_spi(0xFF); /* Diacard following one byte when CMD12 */
|
||||
n = 10; /* Wait for response (10 bytes max) */
|
||||
do
|
||||
res = xchg_spi(0xFF);
|
||||
while ((res & 0x80) && --n);
|
||||
|
||||
return res; /* Return received response */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
|
||||
Public Functions
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
* Initialize disk drive
|
||||
*
|
||||
* drv: physical drive number (0)
|
||||
*/
|
||||
DSTATUS disk_initialize(uint8_t drv)
|
||||
{
|
||||
uint8_t n, cmd, ty, ocr[4];
|
||||
|
||||
|
||||
if (drv) return STA_NOINIT; /* Supports only drive 0 */
|
||||
power_on(); /* Initialize SPI */
|
||||
|
||||
if (Stat & STA_NODISK) return Stat; /* Is card existing in the socket? */
|
||||
|
||||
SPICLK_SLOW();
|
||||
for (n = 10; n; n--) xchg_spi(0xFF); /* Send 80 dummy clocks */
|
||||
|
||||
ty = 0;
|
||||
if (send_cmd(CMD0, 0) == 1) { /* Put the card SPI/Idle state */
|
||||
uint32_t target = MCF_SLT_SCNT(0) - (1000L * 1000L * 132); /* 1 sec */
|
||||
|
||||
if (send_cmd(CMD8, 0x1AA) == 1) { /* SDv2? */
|
||||
for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF); /* Get 32 bit return value of R7 resp */
|
||||
if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* Is the card supports vcc of 2.7-3.6V? */
|
||||
while (MCF_SLT_SCNT(0) > target && send_cmd(ACMD41, 1UL << 30)) ; /* Wait for end of initialization with ACMD41(HCS) */
|
||||
if (MCF_SLT_SCNT(0) > target && send_cmd(CMD58, 0) == 0) { /* Check CCS bit in the OCR */
|
||||
for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF);
|
||||
ty = (ocr[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2; /* Card id SDv2 */
|
||||
}
|
||||
}
|
||||
} else { /* Not SDv2 card */
|
||||
if (send_cmd(ACMD41, 0) <= 1) { /* SDv1 or MMC? */
|
||||
ty = CT_SD1; cmd = ACMD41; /* SDv1 (ACMD41(0)) */
|
||||
} else {
|
||||
ty = CT_MMC; cmd = CMD1; /* MMCv3 (CMD1(0)) */
|
||||
}
|
||||
while (MCF_SLT_SCNT(0) > target && send_cmd(cmd, 0)) ; /* Wait for end of initialization */
|
||||
if (!MCF_SLT_SCNT(0) > target || send_cmd(CMD16, 512) != 0) /* Set block length: 512 */
|
||||
ty = 0;
|
||||
}
|
||||
}
|
||||
CardType = ty; /* Card type */
|
||||
deselect();
|
||||
|
||||
if (ty) { /* OK */
|
||||
SPICLK_FAST(); /* Set fast clock */
|
||||
Stat &= ~STA_NOINIT; /* Clear STA_NOINIT flag */
|
||||
} else { /* Failed */
|
||||
power_off();
|
||||
Stat = STA_NOINIT;
|
||||
}
|
||||
|
||||
return Stat;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get disk status */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS disk_status (
|
||||
uint8_t drv /* Physical drive number (0) */
|
||||
)
|
||||
{
|
||||
if (drv) return STA_NOINIT; /* Supports only drive 0 */
|
||||
|
||||
return Stat; /* Return disk status */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Read sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT disk_read (
|
||||
uint8_t drv, /* Physical drive number (0) */
|
||||
uint8_t *buff, /* Pointer to the data buffer to store read data */
|
||||
uint32_t sector, /* Start sector number (LBA) */
|
||||
uint8_t count /* Number of sectors to read (1..128) */
|
||||
)
|
||||
{
|
||||
if (drv || !count) return RES_PARERR; /* Check parameter */
|
||||
if (Stat & STA_NOINIT) return RES_NOTRDY; /* Check if drive is ready */
|
||||
|
||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* LBA ot BA conversion (byte addressing cards) */
|
||||
|
||||
if (count == 1) { /* Single sector read */
|
||||
if ((send_cmd(CMD17, sector) == 0) /* READ_SINGLE_BLOCK */
|
||||
&& rcvr_datablock(buff, 512))
|
||||
count = 0;
|
||||
}
|
||||
else { /* Multiple sector read */
|
||||
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
|
||||
do {
|
||||
if (!rcvr_datablock(buff, 512)) break;
|
||||
buff += 512;
|
||||
} while (--count);
|
||||
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
|
||||
}
|
||||
}
|
||||
deselect();
|
||||
|
||||
return count ? RES_ERROR : RES_OK; /* Return result */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Write sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#if _USE_WRITE
|
||||
DRESULT disk_write (
|
||||
uint8_t drv, /* Physical drive number (0) */
|
||||
const uint8_t *buff, /* Ponter to the data to write */
|
||||
uint32_t sector, /* Start sector number (LBA) */
|
||||
uint8_t count /* Number of sectors to write (1..128) */
|
||||
)
|
||||
{
|
||||
if (drv || !count) return RES_PARERR; /* Check parameter */
|
||||
if (Stat & STA_NOINIT) return RES_NOTRDY; /* Check drive status */
|
||||
if (Stat & STA_PROTECT) return RES_WRPRT; /* Check write protect */
|
||||
|
||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* LBA ==> BA conversion (byte addressing cards) */
|
||||
|
||||
if (count == 1) { /* Single sector write */
|
||||
if ((send_cmd(CMD24, sector) == 0) /* WRITE_BLOCK */
|
||||
&& xmit_datablock(buff, 0xFE))
|
||||
count = 0;
|
||||
}
|
||||
else { /* Multiple sector write */
|
||||
if (CardType & CT_SDC) send_cmd(ACMD23, count); /* Predefine number of sectors */
|
||||
if (send_cmd(CMD25, sector) == 0) { /* WRITE_MULTIPLE_BLOCK */
|
||||
do {
|
||||
if (!xmit_datablock(buff, 0xFC)) break;
|
||||
buff += 512;
|
||||
} while (--count);
|
||||
if (!xmit_datablock(0, 0xFD)) /* STOP_TRAN token */
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
deselect();
|
||||
|
||||
return count ? RES_ERROR : RES_OK; /* Return result */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Miscellaneous drive controls other than data read/write */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#if _USE_IOCTL
|
||||
DRESULT disk_ioctl (
|
||||
uint8_t drv, /* Physical drive number (0) */
|
||||
uint8_t ctrl, /* Control command code */
|
||||
void *buff /* Pointer to the conrtol data */
|
||||
)
|
||||
{
|
||||
DRESULT res;
|
||||
uint8_t n, csd[16], *ptr = buff;
|
||||
uint32_t *dp, st, ed, csize;
|
||||
|
||||
|
||||
if (drv) return RES_PARERR; /* Check parameter */
|
||||
if (Stat & STA_NOINIT) return RES_NOTRDY; /* Check if drive is ready */
|
||||
|
||||
res = RES_ERROR;
|
||||
|
||||
switch (ctrl) {
|
||||
case CTRL_SYNC : /* Wait for end of internal write process of the drive */
|
||||
if (select()) {
|
||||
deselect();
|
||||
res = RES_OK;
|
||||
}
|
||||
break;
|
||||
|
||||
case GET_SECTOR_COUNT : /* Get drive capacity in unit of sector (DWORD) */
|
||||
if ((send_cmd(CMD9, 0) == 0) && rcvr_datablock(csd, 16)) {
|
||||
if ((csd[0] >> 6) == 1) { /* SDC ver 2.00 */
|
||||
csize = csd[9] + ((uint16_t)csd[8] << 8) + ((uint32_t)(csd[7] & 63) << 16) + 1;
|
||||
*(uint32_t*)buff = csize << 10;
|
||||
} else { /* SDC ver 1.XX or MMC ver 3 */
|
||||
n = (csd[5] & 15) + ((csd[10] & 128) >> 7) + ((csd[9] & 3) << 1) + 2;
|
||||
csize = (csd[8] >> 6) + ((uint16_t)csd[7] << 2) + ((uint16_t)(csd[6] & 3) << 10) + 1;
|
||||
*(uint32_t*)buff = csize << (n - 9);
|
||||
}
|
||||
res = RES_OK;
|
||||
}
|
||||
break;
|
||||
|
||||
case GET_SECTOR_SIZE : /* Get sector size in unit of byte (WORD) */
|
||||
*(uint16_t*)buff = 512;
|
||||
res = RES_OK;
|
||||
break;
|
||||
|
||||
case GET_BLOCK_SIZE : /* Get erase block size in unit of sector (DWORD) */
|
||||
if (CardType & CT_SD2) { /* SDC ver 2.00 */
|
||||
if (send_cmd(ACMD13, 0) == 0) { /* Read SD status */
|
||||
xchg_spi(0xFF);
|
||||
if (rcvr_datablock(csd, 16)) { /* Read partial block */
|
||||
for (n = 64 - 16; n; n--) xchg_spi(0xFF); /* Purge trailing data */
|
||||
*(uint32_t*)buff = 16UL << (csd[10] >> 4);
|
||||
res = RES_OK;
|
||||
}
|
||||
}
|
||||
} else { /* SDC ver 1.XX or MMC */
|
||||
if ((send_cmd(CMD9, 0) == 0) && rcvr_datablock(csd, 16)) { /* Read CSD */
|
||||
if (CardType & CT_SD1) { /* SDC ver 1.XX */
|
||||
*(uint32_t*)buff = (((csd[10] & 63) << 1) + ((uint16_t)(csd[11] & 128) >> 7) + 1) << ((csd[13] >> 6) - 1);
|
||||
} else { /* MMC */
|
||||
*(uint32_t*)buff = ((uint16_t)((csd[10] & 124) >> 2) + 1) * (((csd[11] & 3) << 3) + ((csd[11] & 224) >> 5) + 1);
|
||||
}
|
||||
res = RES_OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CTRL_ERASE_SECTOR : /* Erase a block of sectors (used when _USE_ERASE == 1) */
|
||||
if (!(CardType & CT_SDC)) break; /* Check if the card is SDC */
|
||||
if (disk_ioctl(drv, MMC_GET_CSD, csd)) break; /* Get CSD */
|
||||
if (!(csd[0] >> 6) && !(csd[10] & 0x40)) break; /* Check if sector erase can be applied to the card */
|
||||
dp = buff; st = dp[0]; ed = dp[1]; /* Load sector block */
|
||||
if (!(CardType & CT_BLOCK)) {
|
||||
st *= 512; ed *= 512;
|
||||
}
|
||||
if (send_cmd(CMD32, st) == 0 && send_cmd(CMD33, ed) == 0 && send_cmd(CMD38, 0) == 0 && wait_ready(30000)) /* Erase sector block */
|
||||
res = RES_OK; /* FatFs does not check result of this command */
|
||||
break;
|
||||
|
||||
/* Following command are not used by FatFs module */
|
||||
|
||||
case MMC_GET_TYPE : /* Get MMC/SDC type (BYTE) */
|
||||
*ptr = CardType;
|
||||
res = RES_OK;
|
||||
break;
|
||||
|
||||
case MMC_GET_CSD : /* Read CSD (16 bytes) */
|
||||
if (send_cmd(CMD9, 0) == 0 /* READ_CSD */
|
||||
&& rcvr_datablock(ptr, 16))
|
||||
res = RES_OK;
|
||||
break;
|
||||
|
||||
case MMC_GET_CID : /* Read CID (16 bytes) */
|
||||
if (send_cmd(CMD10, 0) == 0 /* READ_CID */
|
||||
&& rcvr_datablock(ptr, 16))
|
||||
res = RES_OK;
|
||||
break;
|
||||
|
||||
case MMC_GET_OCR : /* Read OCR (4 bytes) */
|
||||
if (send_cmd(CMD58, 0) == 0) { /* READ_OCR */
|
||||
for (n = 4; n; n--) *ptr++ = xchg_spi(0xFF);
|
||||
res = RES_OK;
|
||||
}
|
||||
break;
|
||||
|
||||
case MMC_GET_SDSTAT : /* Read SD status (64 bytes) */
|
||||
if (send_cmd(ACMD13, 0) == 0) { /* SD_STATUS */
|
||||
xchg_spi(0xFF);
|
||||
if (rcvr_datablock(ptr, 64))
|
||||
res = RES_OK;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
res = RES_PARERR;
|
||||
break;
|
||||
}
|
||||
|
||||
deselect();
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Device timer function */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* This function must be called from timer interrupt routine in period
|
||||
/ of 1 ms to generate card control timing.
|
||||
*/
|
||||
|
||||
#ifdef _NOT_USED_
|
||||
void disk_timerproc (void)
|
||||
{
|
||||
uint8_t s;
|
||||
|
||||
s = Stat;
|
||||
if (WP) /* Write protected */
|
||||
s |= STA_PROTECT;
|
||||
else /* Write enabled */
|
||||
s &= ~STA_PROTECT;
|
||||
//if (INS) /* Card is in socket */
|
||||
s &= ~STA_NODISK;
|
||||
//else /* Socket empty */
|
||||
// s |= (STA_NODISK | STA_NOINIT);
|
||||
Stat = s;
|
||||
}
|
||||
#endif /* _NOT_USED_ */
|
||||
2115
sources/ohci-hcd.c
Normal file
2115
sources/ohci-hcd.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,28 @@
|
||||
// assembler trampoline to let printf (compiled -mpcrel) indirectly reference __MBAR
|
||||
/*
|
||||
* printf_helper.S
|
||||
*
|
||||
* assembler trampoline to let printf (compiled -mpcrel) indirectly reference __MBAR
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2010 - 2012 F. Aschwanden
|
||||
* Copyright 2011 - 2012 V. Riviere
|
||||
* Copyright 2012 M. Froeschle
|
||||
*/
|
||||
|
||||
|
||||
.global printf_helper
|
||||
printf_helper:
|
||||
|
||||
424
sources/s19reader.c
Normal file
424
sources/s19reader.c
Normal file
@@ -0,0 +1,424 @@
|
||||
/*
|
||||
* s19reader.c
|
||||
*
|
||||
* Created on: 17.12.2012
|
||||
* Author: mfro
|
||||
* The ACP Firebee project
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2012 M. Froeschle
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "bas_printf.h"
|
||||
#include "sd_card.h"
|
||||
#include "diskio.h"
|
||||
#include "ff.h"
|
||||
#include "s19reader.h"
|
||||
#include "cache.h"
|
||||
|
||||
/*
|
||||
* Yes, I know. The following doesn't really look like code should look like...
|
||||
*
|
||||
* I did try to map structures over the S-records with (packed) which didn't work reliably due to gcc _not_ packing them appropiate
|
||||
* and finally ended up with this. Not nice, put paid (and working).
|
||||
*
|
||||
*/
|
||||
#define SREC_TYPE(a) (a)[0] /* type of record */
|
||||
#define SREC_COUNT(a) (a)[1] /* length of valid bytes to follow */
|
||||
#define SREC_ADDR16(a) (256 * (a)[2] + (a)[3]) /* 2 byte address field */
|
||||
#define SREC_ADDR24(a) (0x10000 * (a)[2] + 0x100 * \
|
||||
(a)[3] + (a)[4]) /* 3 byte address field */
|
||||
#define SREC_ADDR32(a) (0x1000000 * a[2] + 0x10000 * \
|
||||
a[3] + 0x100 * (a)[4] + (a)[5]) /* 4 byte address field */
|
||||
#define SREC_DATA16(a) ((uint8_t *)&((a)[4])) /* address of first byte of data in a record */
|
||||
#define SREC_DATA24(a) ((uint8_t *)&((a)[5])) /* address of first data byte in 24 bit record */
|
||||
#define SREC_DATA32(a) ((uint8_t *)&((a)[6])) /* adress of first byte of a record with 32 bit address field */
|
||||
#define SREC_DATA16_SIZE(a) (SREC_COUNT((a)) - 3) /* length of the data[] array without the checksum field */
|
||||
#define SREC_DATA24_SIZE(a) (SREC_COUNT((a)) - 4) /* length of the data[] array without the checksum field */
|
||||
#define SREC_DATA32_SIZE(a) (SREC_COUNT((a)) - 5) /* length of the data[] array without the checksum field */
|
||||
#define SREC_CHECKSUM(a) (a)[SREC_COUNT(a) + 2 - 1] /* record's checksum (two's complement of the sum of all bytes) */
|
||||
|
||||
/*
|
||||
* convert a single hex character into byte
|
||||
*/
|
||||
static uint8_t nibble_to_byte(uint8_t nibble)
|
||||
{
|
||||
if ((nibble >= '0') && (nibble <= '9'))
|
||||
return nibble - '0';
|
||||
else if ((nibble >= 'A' && nibble <= 'F'))
|
||||
return 10 + nibble - 'A';
|
||||
else if ((nibble >= 'a' && nibble <= 'f'))
|
||||
return 10 + nibble - 'a';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* convert two hex characters into byte
|
||||
*/
|
||||
static uint8_t hex_to_byte(uint8_t hex[2])
|
||||
{
|
||||
return 16 * (nibble_to_byte(hex[0])) + (nibble_to_byte(hex[1]));
|
||||
}
|
||||
|
||||
/*
|
||||
* convert four hex characters into a 16 bit word
|
||||
*/
|
||||
static uint16_t hex_to_word(uint8_t hex[4])
|
||||
{
|
||||
return 256 * hex_to_byte(&hex[0]) + hex_to_byte(&hex[2]);
|
||||
}
|
||||
|
||||
/*
|
||||
* convert eight hex characters into a 32 bit word
|
||||
*/
|
||||
static uint32_t hex_to_long(uint8_t hex[8])
|
||||
{
|
||||
return 65536 * hex_to_word(&hex[0]) + hex_to_word(&hex[4]);
|
||||
}
|
||||
|
||||
/*
|
||||
* compute the record checksum
|
||||
*
|
||||
* it consists of the one's complement of the byte sum of the data from the count field until the end
|
||||
*/
|
||||
static uint8_t checksum(uint8_t arr[])
|
||||
{
|
||||
int i;
|
||||
uint8_t checksum = SREC_COUNT(arr);
|
||||
|
||||
for (i = 0; i < SREC_COUNT(arr) - 1; i++)
|
||||
{
|
||||
checksum += arr[i + 2];
|
||||
}
|
||||
return ~checksum;
|
||||
}
|
||||
|
||||
#ifdef _NOT_USED_
|
||||
void print_record(uint8_t *arr)
|
||||
{
|
||||
switch (SREC_TYPE(arr))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
xprintf("type 0x%x ", SREC_TYPE(arr));
|
||||
xprintf("count 0x%x ", SREC_COUNT(arr));
|
||||
xprintf("addr 0x%x ", SREC_ADDR16(arr));
|
||||
xprintf("module %11.11s ", SREC_DATA16(arr));
|
||||
xprintf("chk 0x%x 0x%x\r\n", SREC_CHECKSUM(arr), checksum(arr));
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case 7:
|
||||
{
|
||||
xprintf("type 0x%x ", SREC_TYPE(arr));
|
||||
xprintf("count 0x%x ", SREC_COUNT(arr));
|
||||
xprintf("addr 0x%x ", SREC_ADDR32(arr));
|
||||
xprintf("data %02x,%02x,%02x,%02x,... ",
|
||||
SREC_DATA32(arr)[0], SREC_DATA32(arr)[1], SREC_DATA32(arr)[3], SREC_DATA32(arr)[4]);
|
||||
xprintf("chk 0x%x 0x%x\r\n", SREC_CHECKSUM(arr), checksum(arr));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
xprintf("unsupported report type %d in print_record\r\n", arr[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* _NOT_USED_ */
|
||||
|
||||
/*
|
||||
* convert an S-record line into its corresponding byte vector (ASCII->binary)
|
||||
*/
|
||||
static void line_to_vector(uint8_t *buff, uint8_t *vector)
|
||||
{
|
||||
int i;
|
||||
int length;
|
||||
uint8_t *vp = vector;
|
||||
|
||||
length = hex_to_byte(buff + 2);
|
||||
|
||||
buff++;
|
||||
*vp++ = nibble_to_byte(*buff); /* record type. Only one single nibble */
|
||||
buff++;
|
||||
|
||||
for (i = 0; i <= length; i++)
|
||||
{
|
||||
*vp++ = hex_to_byte(buff);
|
||||
buff += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* read and parse a Motorola S-record file and copy contents to dst. The theory of operation is to read and parse the S-record file
|
||||
* and to use the supplied callback routine to copy the buffer to the destination once the S-record line is converted.
|
||||
* The memcpy callback can be anything (as long as it conforms parameter-wise) - a basically empty function to just let
|
||||
* read_srecords validate the file, a standard memcpy() to copy file contents to destination RAM or a more sophisticated
|
||||
* routine that does write/erase flash
|
||||
*
|
||||
* FIXME: Currently only records that the gcc toolchain emits are supported.
|
||||
*
|
||||
* Parameters:
|
||||
* IN
|
||||
* filename - the filename that contains the S-records
|
||||
* callback - the memcpy() routine discussed above
|
||||
* OUT
|
||||
* start_address - the execution address of the code as read from the file. Can be used to jump into and execute it
|
||||
* actual_length - the overall length of the binary code read from the file
|
||||
* returns
|
||||
* OK or an err_t error code if anything failed
|
||||
*/
|
||||
err_t read_srecords(char *filename, void **start_address, uint32_t *actual_length, memcpy_callback_t callback)
|
||||
{
|
||||
FRESULT fres;
|
||||
FIL file;
|
||||
err_t ret = OK;
|
||||
|
||||
if ((fres = f_open(&file, filename, FA_READ) == FR_OK))
|
||||
{
|
||||
uint8_t line[80];
|
||||
int lineno = 0;
|
||||
int data_records = 0;
|
||||
bool found_block_header = false;
|
||||
bool found_block_end = false;
|
||||
bool found_block_data = false;
|
||||
|
||||
while (ret == OK && (uint8_t *) f_gets((char *) line, sizeof(line), &file) != NULL)
|
||||
{
|
||||
lineno++;
|
||||
uint8_t vector[80];
|
||||
|
||||
line_to_vector(line, vector); /* vector now contains the decoded contents of line, from line[1] on */
|
||||
|
||||
if (line[0] == 'S')
|
||||
{
|
||||
if (SREC_CHECKSUM(vector) != checksum(vector))
|
||||
{
|
||||
xprintf("invalid checksum 0x%x (should be 0x%x) in line %d\r\n",
|
||||
SREC_CHECKSUM(vector), checksum(vector), lineno);
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
switch (vector[0])
|
||||
{
|
||||
case 0: /* block header */
|
||||
found_block_header = true;
|
||||
if (found_block_data || found_block_end)
|
||||
{
|
||||
xprintf("S7 or S3 record found before S0: S-records corrupt?\r\n");
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2: /* three byte address field data record */
|
||||
if (!found_block_header || found_block_end)
|
||||
{
|
||||
xprintf("S3 record found before S0 or after S7: S-records corrupt?\r\n");
|
||||
ret = FAIL;
|
||||
}
|
||||
ret = callback((uint8_t *) SREC_ADDR24(vector), SREC_DATA24(vector), SREC_DATA24_SIZE(vector));
|
||||
data_records++;
|
||||
break;
|
||||
|
||||
case 3: /* four byte address field data record */
|
||||
if (!found_block_header || found_block_end)
|
||||
{
|
||||
xprintf("S3 record found before S0 or after S7: S-records corrupt?\r\n");
|
||||
ret = FAIL;
|
||||
}
|
||||
ret = callback((uint8_t *) SREC_ADDR32(vector), SREC_DATA32(vector), SREC_DATA32_SIZE(vector));
|
||||
data_records++;
|
||||
break;
|
||||
|
||||
case 7: /* four byte address field end record */
|
||||
if (!found_block_header || found_block_end)
|
||||
{
|
||||
xprintf("S7 record found before S0 or after S7: S-records corrupt?\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
||||
*start_address = (void *) SREC_ADDR32(vector);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: /* three byte address field end record */
|
||||
if (!found_block_header || found_block_end)
|
||||
{
|
||||
xprintf("S8 record found before S0 or after S8: S-records corrupt?\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
||||
*start_address = (void *) SREC_ADDR24(vector);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
xprintf("unsupported record type (%d) found in line %d\r\n", vector[0], lineno);
|
||||
xprintf("offending line: \r\n");
|
||||
xprintf("%s\r\n", line);
|
||||
ret = FAIL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("illegal character ('%c') found on line %d: S-records corrupt?\r\n", line[0], lineno);
|
||||
ret = FAIL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
f_close(&file);
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("could not open file %s\r\n", filename);
|
||||
ret = FILE_OPEN;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* this callback just does nothing besides returning OK. Meant to do a dry run over the file to check its integrity
|
||||
*/
|
||||
static err_t simulate()
|
||||
{
|
||||
err_t ret = OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static err_t memcpy(uint8_t *dst, uint8_t *src, uint32_t length)
|
||||
{
|
||||
uint8_t *end = src + length;
|
||||
|
||||
do
|
||||
{
|
||||
*dst++ = *src++;
|
||||
} while (src < end);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static err_t flash(uint8_t *dst, uint8_t *src, uint32_t length)
|
||||
{
|
||||
err_t ret = OK;
|
||||
|
||||
/* TODO: do the actual flash */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* this callback verifies the data against the S-record file contents after a write to destination
|
||||
*/
|
||||
static err_t verify(uint8_t *dst, uint8_t *src, uint32_t length)
|
||||
{
|
||||
uint8_t *end = src + length;
|
||||
|
||||
do
|
||||
{
|
||||
if (*src++ != *dst++)
|
||||
return FAIL;
|
||||
} while (src < end);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void srec_execute(char *flasher_filename)
|
||||
{
|
||||
DRESULT res;
|
||||
FRESULT fres;
|
||||
FATFS fs;
|
||||
FIL file;
|
||||
err_t err;
|
||||
void *start_address;
|
||||
uint32_t length;
|
||||
|
||||
disk_initialize(0);
|
||||
res = disk_status(0);
|
||||
if (res == RES_OK)
|
||||
{
|
||||
fres = f_mount(0, &fs);
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
if ((fres = f_open(&file, flasher_filename, FA_READ) != FR_OK))
|
||||
{
|
||||
xprintf("flasher file %s not present on disk\r\n", flasher_filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
f_close(&file);
|
||||
|
||||
/* first pass: parse and check for inconsistencies */
|
||||
xprintf("check file integrity: ");
|
||||
err = read_srecords(flasher_filename, &start_address, &length, simulate);
|
||||
if (err == OK)
|
||||
{
|
||||
/* next pass: copy data to destination */
|
||||
xprintf("OK.\r\ncopy/flash data: ");
|
||||
err = read_srecords(flasher_filename, &start_address, &length, memcpy);
|
||||
if (err == OK)
|
||||
{
|
||||
/* next pass: verify data */
|
||||
xprintf("OK.\r\nverify data: ");
|
||||
err = read_srecords(flasher_filename, &start_address, &length, verify);
|
||||
if (err == OK)
|
||||
{
|
||||
xprintf("OK.\r\n");
|
||||
typedef void void_func(void);
|
||||
void_func *func;
|
||||
xprintf("target successfully written and verified. Start address: %p\r\n", start_address);
|
||||
|
||||
func = start_address;
|
||||
flush_and_invalidate_caches();
|
||||
(*func)();
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("failed\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// xprintf("could not mount FAT FS\r\n");
|
||||
}
|
||||
f_mount(0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// xprintf("could not initialize SD card\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,121 @@
|
||||
/*
|
||||
* sd card
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <MCF5475.h>
|
||||
|
||||
void sd_card_idle(void)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
".extern sd_idle\n\t"
|
||||
"bsr sd_idle\n\t"
|
||||
/* output */:
|
||||
/* input */ :
|
||||
/* clobber */: "a0","a1","a2","a3","a4","a5",
|
||||
"d0","d1","d2","d3","d4","d5","d6","d7","memory"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int sd_card_init(void)
|
||||
{
|
||||
register int ret __asm__("d0");
|
||||
|
||||
__asm__ __volatile__ (
|
||||
".extern sd_init\n\t"
|
||||
"bsr.l sd_init\n\t"
|
||||
/* output */: "=r" (ret)
|
||||
/* input */ :
|
||||
/* clobber */: "a0","a1","a2","a3","a4","a5",
|
||||
"d1","d2","d3","d4","d5","d6","d7","memory"
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* sd_card.c
|
||||
*
|
||||
* Created on: 16.12.2012
|
||||
* Author: mfro
|
||||
*
|
||||
* This file is part of BaS_gcc.
|
||||
*
|
||||
* BaS_gcc 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BaS_gcc 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 BaS_gcc. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2012 M. Froeschle
|
||||
*/
|
||||
|
||||
#include <sd_card.h>
|
||||
#include <diskio.h>
|
||||
#include <ff.h>
|
||||
#include <bas_printf.h>
|
||||
|
||||
#define WELCOME_NAME "WELCOME.MSG"
|
||||
#define FLASHCODE_NAME "BENCH.BIN"
|
||||
|
||||
#define FLASHCODE_ADDRESS 0x03000000L
|
||||
|
||||
/*
|
||||
* initialize SD-card and FF FAT filesystem routines. Harness to load a file during boot.
|
||||
*
|
||||
* This is currently more like a proof of concept,
|
||||
* but will be extended to load and execute a bootstrap flasher to be able to flash the Bee directly
|
||||
* from card.
|
||||
*/
|
||||
void sd_card_init(void)
|
||||
{
|
||||
DRESULT res;
|
||||
FATFS fs;
|
||||
FRESULT fres;
|
||||
|
||||
disk_initialize(0);
|
||||
res = disk_status(0);
|
||||
xprintf("disk status of SD card is %d\r\n", res);
|
||||
if (res == RES_OK)
|
||||
{
|
||||
fres = f_mount(0, &fs);
|
||||
xprintf("mount status of SD card fs is %d\r\n", fres);
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
DIR directory;
|
||||
FIL file;
|
||||
|
||||
fres = f_opendir(&directory, "\\");
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
FILINFO fi;
|
||||
|
||||
while (((fres = f_readdir(&directory, &fi)) == FR_OK) && fi.fname[0])
|
||||
{
|
||||
xprintf("%13.13s %d\r\n", fi.fname, fi.fsize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("could not open directory \"\\\" on SD-card! Error code: %d\r\n", fres);
|
||||
}
|
||||
|
||||
/*
|
||||
* let's see if we find our boot flashing executable on disk
|
||||
*/
|
||||
fres = f_open(&file, FLASHCODE_NAME, FA_READ);
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
/*
|
||||
* yes, load and execute it
|
||||
*
|
||||
* FIXME: we will need some kind of user confirmation here
|
||||
* to avoid unwanted flashing or "bootsector viruses" before going productive
|
||||
*/
|
||||
uint32_t size; /* length of code piece read */
|
||||
uint32_t total_size = 0L;
|
||||
uint32_t start_time = MCF_SLT_SCNT(0);
|
||||
uint32_t end_time;
|
||||
uint32_t time = 0;
|
||||
|
||||
while ((fres = f_read(&file, (void *) FLASHCODE_ADDRESS, 1024 * 1000, &size)) == FR_OK && size > 0)
|
||||
{
|
||||
total_size += size / 1024;
|
||||
xprintf("read hunk of %d bytes, total_size = %d kBytes\r\n", size, total_size);
|
||||
}
|
||||
end_time = MCF_SLT_SCNT(0);
|
||||
time = (end_time - start_time) / 132L;
|
||||
xprintf("result of f_read: %ld, %ld kbytes read\r\n", fres, total_size);
|
||||
xprintf("time to load %s: %ld s\r\n", FLASHCODE_NAME, time / 1000 / 100);
|
||||
xprintf("equals to about %ld kBytes/second\r\n", total_size / (time / 1000 / 100));
|
||||
|
||||
}
|
||||
f_close(&file);
|
||||
|
||||
fres = f_open(&file, WELCOME_NAME, FA_READ);
|
||||
if (fres == FR_OK)
|
||||
{
|
||||
char line[128];
|
||||
|
||||
while (f_gets(line, sizeof(line), &file))
|
||||
{
|
||||
xprintf("%s", line);
|
||||
}
|
||||
}
|
||||
f_close(&file);
|
||||
}
|
||||
f_mount(0, 0L); /* release work area */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,439 +0,0 @@
|
||||
/********************************************************************/
|
||||
// sd card
|
||||
/********************************************************************/
|
||||
#define dspi_dtar0 0x0c
|
||||
#define dspi_dsr 0x2c
|
||||
#define dspi_dtfr 0x34
|
||||
#define dspi_drfr 0x38
|
||||
|
||||
#define LONGASC(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | (d))
|
||||
|
||||
#define MCF_PAD_PAR_DSPI (__MBAR+0xA50)
|
||||
#define MCF_PSC0_PSCTB_8BIT (__MBAR+0x860C)
|
||||
#define MCF_DSPI_DMCR (__MBAR+0x8A00)
|
||||
#define MCF_SLT0_SCNT (__MBAR + 0x908)
|
||||
|
||||
.text
|
||||
|
||||
warte_10ms:
|
||||
move.l d0,-(sp)
|
||||
move.l MCF_SLT0_SCNT,d0
|
||||
sub.l #1320000,d0
|
||||
warte_d6:
|
||||
cmp.l MCF_SLT0_SCNT,d0
|
||||
bcs warte_d6
|
||||
move.l (sp)+,d0
|
||||
rts
|
||||
|
||||
warte_1ms:
|
||||
move.l d0,-(sp)
|
||||
move.l MCF_SLT0_SCNT,d0
|
||||
sub.l #132000,d0
|
||||
warte_d5:
|
||||
cmp.l MCF_SLT0_SCNT,d0
|
||||
bcs warte_d5
|
||||
move.l (sp)+,d0
|
||||
rts
|
||||
|
||||
.global sd_idle
|
||||
.global sd_init
|
||||
|
||||
sd_init:
|
||||
lea MCF_PSC0_PSCTB_8BIT,a6
|
||||
move.l #LONGASC('S', 'D', '-', 'C'),(a6)
|
||||
move.l #LONGASC('a', 'r', 'd', ' '),(a6)
|
||||
|
||||
move.l buffer,a5 // basis addresse (diesen bereich brauchen wir nicht mehr!)
|
||||
move.l #0x1fffffff,d0 // normal dspi
|
||||
move.l d0,MCF_PAD_PAR_DSPI
|
||||
lea MCF_DSPI_DMCR,a0
|
||||
move.l #0x800d3c00,(a0) // 8 bit cs5 on
|
||||
move.l #0x38558897,d0
|
||||
move.l d0,dspi_dtar0(a0) // 400kHz
|
||||
move.l #0x082000ff,d4 // tx vorbesetzen
|
||||
mov3q.l #-1,dspi_dsr(a0)
|
||||
|
||||
bsr.l warte_1ms
|
||||
move.l #0xc00d3c00,(a0) // 8 bit 4MHz clocken cs off
|
||||
bsr.l warte_10ms
|
||||
move.l #0x800d3c00,(a0) // 8 bit 4MHz normal cs on
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
move.l #0x802d3c00,(a0) // 8 bit 4MHz normal cs off
|
||||
clr.b d4
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
move.l #0x800d3c00,(a0) // 8 bit 4MHz normal cs on
|
||||
move.b #0xff,d4
|
||||
bsr sd_com
|
||||
bsr sd_com
|
||||
move.l #0x802d3c00,(a0) // 8 bit 4MHz normal cs off
|
||||
bsr.l warte_10ms
|
||||
|
||||
// sd idle
|
||||
move.l #100,d6 // 100 versuche
|
||||
move.l #10,d3 // 10 versuche
|
||||
sd_idle:
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
move.b #0x40,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #0x95,d4
|
||||
bsr sd_com
|
||||
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
cmp.b #0x01,d5
|
||||
beq idle_end
|
||||
bsr sd_com
|
||||
cmp.b #0x01,d5
|
||||
beq idle_end
|
||||
bsr sd_com
|
||||
cmp.b #0x01,d5
|
||||
beq idle_end
|
||||
bsr sd_com
|
||||
cmp.b #0x01,d5
|
||||
beq idle_end
|
||||
bsr sd_com
|
||||
cmp.b #0x01,d5
|
||||
beq idle_end
|
||||
bsr sd_com
|
||||
cmp.b #0x01,d5
|
||||
beq idle_end
|
||||
subq.l #1,d6
|
||||
beq sd_not
|
||||
bra sd_idle
|
||||
idle_end:
|
||||
// cdm 8
|
||||
read_ic:
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
move.b #0x48,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #0x01,d4
|
||||
bsr sd_com
|
||||
move.b #0xaa,d4
|
||||
bsr sd_com
|
||||
move.b #0x87,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_get_status
|
||||
cmp.b #5,d5
|
||||
beq sd_v1
|
||||
cmp.b #1,d5
|
||||
bne read_ic
|
||||
|
||||
move.b #0xff,d4
|
||||
bsr sd_com
|
||||
move.b d5,d0
|
||||
bsr sd_com
|
||||
move.b d5,d1
|
||||
bsr sd_com
|
||||
move.b d5,d2
|
||||
bsr sd_com
|
||||
cmp.b #0xaa,d5
|
||||
bne sd_testd3
|
||||
move.l #LONGASC('S', 'D', 'H', 'C'),(a6)
|
||||
move.b #' ',(a6)
|
||||
sd_v1:
|
||||
|
||||
// cdm 58
|
||||
read_ocr:
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
move.b #0x7a,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_get_status
|
||||
move.l #LONGASC('V', 'e', 'r', '1'),d6
|
||||
cmp.b #5,d5
|
||||
beq read_ocr
|
||||
cmp.b #1,d5
|
||||
bne read_ocr
|
||||
|
||||
move.b #0xff,d4
|
||||
bsr sd_com
|
||||
move.b d5,d0
|
||||
bsr sd_com
|
||||
move.b d5,d1
|
||||
bsr sd_com
|
||||
move.b d5,d2
|
||||
bsr sd_com
|
||||
|
||||
// acdm 41
|
||||
move.l #20000,d6 // 20000 versuche ready can bis 1 sec gehen
|
||||
wait_of_aktiv:
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
move.b #0x77,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #0x95,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_get_status
|
||||
cmp.b #0x05,d5
|
||||
beq wait_of_aktiv
|
||||
|
||||
wait_of_aktiv2:
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
move.b #0x69,d4
|
||||
bsr sd_com
|
||||
move.b #0x40,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x95,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_get_status
|
||||
tst.b d5
|
||||
beq sd_init_ok
|
||||
cmp.b #0x05,d5
|
||||
beq wait_of_aktiv2
|
||||
subq.l #1,d6
|
||||
bne wait_of_aktiv
|
||||
sd_testd3:
|
||||
subq.l #1,d3
|
||||
bne sd_idle
|
||||
bra sd_error
|
||||
|
||||
sd_init_ok:
|
||||
// cdm 10
|
||||
read_cid:
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
move.b #0x4a,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x95,d4
|
||||
bsr sd_com
|
||||
|
||||
move.l a5,a4 // adresse setzen
|
||||
bsr sd_rcv_info
|
||||
|
||||
// name ausgeben
|
||||
lea 1(a5),a4
|
||||
moveq #7,d7
|
||||
sd_nam_loop:
|
||||
move.b (a4)+,(a6)
|
||||
subq.l #1,d7
|
||||
bne sd_nam_loop
|
||||
move.b #' ',(a6)
|
||||
|
||||
// cdm 9
|
||||
read_csd:
|
||||
move.b #0xff,d4 // receive byt
|
||||
bsr sd_com
|
||||
move.b #0x49,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x00,d4
|
||||
bsr sd_com
|
||||
move.b #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
move.l a5,a4 // adresse setzen
|
||||
bsr sd_rcv_info
|
||||
|
||||
mvz.b (a5),d0
|
||||
lsr.l #6,d0
|
||||
|
||||
bne sd_csd2 // format v2
|
||||
move.l 6(a5),d1
|
||||
moveq #14,d0 // bit 73..62 c_size
|
||||
lsr.l d0,d1 // bits extrahieren
|
||||
and.l #0xfff,d1 // 12 bits
|
||||
addq.l #1,d1
|
||||
mvz.w 9(a5),d0
|
||||
lsr.l #7,d0 // bits 49..47
|
||||
and.l #0x7,d0 // 3 bits
|
||||
moveq.l #8,d2 // x256 (dif v1 v2)
|
||||
sub.l d0,d2
|
||||
lsr.l d2,d1
|
||||
bra sd_print_size
|
||||
sd_csd2:
|
||||
mvz.w 8(a5),d1
|
||||
addq.l #1,d1
|
||||
sd_print_size:
|
||||
swap d1
|
||||
lsl.l #1,d1
|
||||
bcc sd_16G
|
||||
move.l #LONGASC('3', '2', 'G', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_16G:
|
||||
lsl.l #1,d1
|
||||
bcc sd_8G
|
||||
move.l #LONGASC('1', '6', 'G', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_8G:
|
||||
lsl.l #1,d1
|
||||
bcc sd_4G
|
||||
move.l #LONGASC(' ', '4', 'G', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_4G:
|
||||
lsl.l #1,d1
|
||||
bcc sd_2G
|
||||
move.l #LONGASC(' ', '4', 'G', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_2G:
|
||||
lsl.l #1,d1
|
||||
bcc sd_1G
|
||||
move.l #LONGASC(' ', '2', 'G', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_1G:
|
||||
lsl.l #1,d1
|
||||
bcc sd_512M
|
||||
move.l #LONGASC(' ', '1', 'G', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_512M:
|
||||
lsl.l #1,d1
|
||||
bcc sd_256M
|
||||
move.b #'5',(a6)
|
||||
move.l #LONGASC('1', '2', 'M', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_256M:
|
||||
lsl.l #1,d1
|
||||
bcc sd_128M
|
||||
move.b #'2',(a6)
|
||||
move.l #LONGASC('5', '6', 'M', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_128M:
|
||||
lsl.l #1,d1
|
||||
bcc sd_64M
|
||||
move.b #'1',(a6)
|
||||
move.l #LONGASC('2', '8', 'M', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_64M:
|
||||
lsl.l #1,d1
|
||||
bcc sd_32M
|
||||
move.l #LONGASC('6', '4', 'M', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_32M:
|
||||
lsl.l #1,d1
|
||||
bcc sd_16M
|
||||
move.l #LONGASC('3', '2', 'M', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_16M:
|
||||
lsl.l #1,d1
|
||||
bcc sd_8M
|
||||
move.l #LONGASC('1', '6', 'M', 'B'),(a6)
|
||||
bra sd_ok
|
||||
sd_8M:
|
||||
move.l #LONGASC('<', '9', 'M', 'B'),(a6)
|
||||
sd_ok:
|
||||
move.l #LONGASC(' ', 'O', 'K', '!'),(a6)
|
||||
move.l #0x0a0d,(a6)
|
||||
//halt
|
||||
//halt
|
||||
rts
|
||||
// subs ende -------------------------------
|
||||
sd_V1:
|
||||
move.l #LONGASC('n', 'o', 'n', '!'),(a6)
|
||||
move.l #0x0a0d,(a6)
|
||||
//halt
|
||||
//halt
|
||||
rts
|
||||
sd_error:
|
||||
move.l #LONGASC('E', 'r', 'r', 'o'),(a0)
|
||||
move.l #LONGASC('r', '!', '', ''), (a0)
|
||||
move.l #0x0a0d,(a6)
|
||||
halt
|
||||
halt
|
||||
rts
|
||||
sd_not:
|
||||
move.l #LONGASC('n', 'o', 'n', '!'),(a0)
|
||||
move.l #0x0a0d,(a6)
|
||||
halt
|
||||
halt
|
||||
rts
|
||||
|
||||
// status holen -------------------------------
|
||||
sd_get_status:
|
||||
move.b #0xff,d4
|
||||
bsr sd_com
|
||||
cmp.b #0xff,d5
|
||||
beq sd_get_status
|
||||
rts
|
||||
// byt senden und holen ---------------------
|
||||
sd_com:
|
||||
move.l d4,dspi_dtfr(a0)
|
||||
wait_auf_complett:
|
||||
btst.b #7,dspi_dsr(a0)
|
||||
beq wait_auf_complett
|
||||
move.l dspi_drfr(a0),d5
|
||||
mov3q.l #-1,dspi_dsr(a0) // clr status register
|
||||
rts
|
||||
|
||||
// daten holen ----------------------------
|
||||
sd_rcv_info:
|
||||
moveq #18,d3 // 16 byts + 2 byts crc
|
||||
move.b #0xff,d4
|
||||
sd_rcv_rb_w:
|
||||
bsr sd_get_status
|
||||
cmp.b #0xfe,d5 // daten bereit?
|
||||
bne sd_rcv_rb_w // nein->
|
||||
sd_rcv_rd_rb:
|
||||
bsr sd_com
|
||||
move.b d5,(a4)+
|
||||
subq.l #1,d3
|
||||
bne sd_rcv_rd_rb
|
||||
rts
|
||||
/******************************************/
|
||||
|
||||
.data
|
||||
buffer: dc.l 0, 0, 0, 0, 0, 0, 0, 0
|
||||
540
sources/sd_ide.c
540
sources/sd_ide.c
@@ -1,540 +0,0 @@
|
||||
#include "MCF5475.h"
|
||||
#include "startcf.h"
|
||||
|
||||
|
||||
|
||||
/* imported routines */
|
||||
//extern int warten_20ms();
|
||||
//extern int warten_200us();
|
||||
//extern int warten_10us();
|
||||
|
||||
/********************************************************************/
|
||||
void asm sd_test(void)
|
||||
{
|
||||
clr.w MCF_PAD_PAR_DSPI
|
||||
lea MCF_GPIO_PPDSDR_DSPI,a2 // data in
|
||||
lea MCF_GPIO_PODR_DSPI,a1 // data out
|
||||
move.b #0x00,(a1) // alle auf 0
|
||||
lea MCF_GPIO_PDDR_DSPI,a0
|
||||
move.b #0x7d,(a0) // din = input rest output
|
||||
|
||||
bsr warten_20ms
|
||||
|
||||
move.b #0x7f,(a1) // alle auf 1
|
||||
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
// sd idle
|
||||
sd_idle:
|
||||
bsr sd_16clk
|
||||
moveq #0x40,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x95,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x05,d5
|
||||
beq sd_test
|
||||
cmp.b #0x01,d5
|
||||
beq wait_of_aktiv
|
||||
cmp.b #0x04,d5
|
||||
beq sd_init_ok
|
||||
cmp.b #0x00,d5
|
||||
beq sd_init_ok
|
||||
bra sd_idle
|
||||
|
||||
// acdm 41
|
||||
wait_of_aktiv:
|
||||
bsr sd_16clk
|
||||
|
||||
moveq #0x77,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
bsr sd_16clk
|
||||
|
||||
move.l #0xff,d6
|
||||
moveq #0x69,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #0x02,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
beq sd_init_ok
|
||||
cmp.b #0x05,d5
|
||||
beq sd_test
|
||||
bra wait_of_aktiv
|
||||
|
||||
sd_init_ok:
|
||||
|
||||
// blockgr<67>sse 512byt
|
||||
sd_bg:
|
||||
bsr sd_16clk
|
||||
moveq #0x50,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #02,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_bg
|
||||
|
||||
// read block
|
||||
sd_rb:
|
||||
bsr sd_16clk
|
||||
moveq #0x51,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x08,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_rb
|
||||
|
||||
lea 0xc00000,a4
|
||||
move.l #513,d7
|
||||
rd_rb:
|
||||
bsr sd_receive
|
||||
move.b d5,(a4)+
|
||||
subq.l #1,d7
|
||||
bne rd_rb
|
||||
|
||||
// write block
|
||||
sd_wb:
|
||||
bsr sd_16clk
|
||||
moveq #0x58,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x08,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_wb
|
||||
|
||||
lea 0xc00000,a4
|
||||
move.l #513,d7
|
||||
moveq.l #0x66,d4
|
||||
wr_wb:
|
||||
bsr sd_com
|
||||
// subq.l #1,d4
|
||||
moveq #0x66,d4
|
||||
subq.l #1,d7
|
||||
bne wr_wb
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
wr_wb_el:
|
||||
moveq #0xff,d4
|
||||
bsr sd_com
|
||||
cmp.b #0xff,d5
|
||||
bne wr_wb_el
|
||||
|
||||
|
||||
// read block 2
|
||||
sd_rb2:
|
||||
bsr sd_16clk
|
||||
moveq #0x51,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x08,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_rb2
|
||||
|
||||
lea 0xc00400,a4
|
||||
move.l #513,d7
|
||||
rd_rb2:
|
||||
bsr sd_receive
|
||||
move.b d5,(a4)+
|
||||
subq.l #1,d7
|
||||
bne rd_rb2
|
||||
|
||||
|
||||
nop
|
||||
nop
|
||||
|
||||
rts
|
||||
|
||||
sd_receive:
|
||||
moveq #0xff,d4
|
||||
bsr sd_com
|
||||
cmp.b #0xff,d5
|
||||
beq sd_receive
|
||||
rts
|
||||
|
||||
sd_com:
|
||||
bclr.b #6,(a1)
|
||||
sd_comb:
|
||||
bsr warten_10us
|
||||
moveq #7,d2
|
||||
clr.l d5
|
||||
sd_com_loop:
|
||||
btst d2,d4
|
||||
beq sd_com2
|
||||
bset.b #0,(a1)
|
||||
bra sd_com2_1
|
||||
sd_com2:
|
||||
bclr.b #0,(a1)
|
||||
sd_com2_1:
|
||||
bsr sd_clk
|
||||
and.l #0x02,d3
|
||||
beq sd_com3
|
||||
bset.b d2,d5
|
||||
sd_com3:
|
||||
subq.l #1,d2
|
||||
bge sd_com_loop
|
||||
bsr warten_10us
|
||||
bset.b #6,(a1)
|
||||
bset.b #0,(a1)
|
||||
bsr warten_200us
|
||||
rts
|
||||
sd_clk:
|
||||
tst.b 0xfffff700
|
||||
tst.b 0xfffff700
|
||||
bset.b #2,(a1)
|
||||
tst.b 0xfffff700
|
||||
tst.b 0xfffff700
|
||||
move.b (a2),d3
|
||||
tst.b 0xfffff700
|
||||
bclr.b #2,(a1)
|
||||
rts
|
||||
|
||||
sd_15clk:
|
||||
move #15,d0
|
||||
bra sd_16clk
|
||||
sd_16clk:
|
||||
moveq #16,d0
|
||||
sd_16clk1:
|
||||
bsr sd_clk
|
||||
subq.l #1,d0
|
||||
bne sd_16clk1
|
||||
bsr warten_10us
|
||||
rts
|
||||
// warteschleife ca. 20ms
|
||||
warten_20ms:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #700000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 200us
|
||||
warten_200us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #7000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 10us
|
||||
warten_10us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #333,d6
|
||||
warten_loop:
|
||||
move.l (a0),d1
|
||||
sub.l d0,d1
|
||||
add.l d6,d1
|
||||
bpl warten_loop
|
||||
move.l (sp)+,d0
|
||||
move.l (sp)+,d1
|
||||
move.l (sp)+,d6
|
||||
move.l (sp)+,a0
|
||||
rts;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
void asm ide_test(void)
|
||||
{
|
||||
lea MCF_PAD_PAR_DSPI,a0
|
||||
move.w #0x1fff,(a0)
|
||||
lea MCF_DSPI_DCTAR0,a0
|
||||
move.l #0x38a644e4,(a0)
|
||||
lea MCF_DSPI_DMCR,a0
|
||||
move.l #0x802d3c00,(a0)
|
||||
clr.l MCF_DSPI_DTCR
|
||||
bsr warten_20ms
|
||||
lea MCF_DSPI_DTFR,a0
|
||||
lea MCF_DSPI_DRFR,a1
|
||||
|
||||
moveq #10,d0
|
||||
sd_reset:
|
||||
move.l #0x000100ff,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
subq.l #1,d0
|
||||
bne sd_reset
|
||||
|
||||
moveq #10,d1
|
||||
sd_loop1:
|
||||
bsr warten_20ms
|
||||
moveq #-1,d0
|
||||
// cmd 0 set to idle
|
||||
move.l #0x00200040,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200095,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
cmp.w #0x0001,d0
|
||||
beq sd_loop2
|
||||
subq.l #1,d1
|
||||
bne sd_loop1
|
||||
moveq #10,d1
|
||||
bra sd_test
|
||||
sd_loop2:
|
||||
moveq #-1,d0
|
||||
// cmd 41
|
||||
move.l #0x00200069,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200000,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
move.l #0x00200001,(a0)
|
||||
bsr warten_20ms
|
||||
and.l (a1),d0
|
||||
tst.w d0
|
||||
bne sd_loop2
|
||||
|
||||
nop
|
||||
nop
|
||||
/********************************************************************/
|
||||
#define cmd_reg (0x1d)
|
||||
#define status_reg (0x1d)
|
||||
#define seccnt (0x09)
|
||||
|
||||
ide_test:
|
||||
lea 0xfff00040,a0
|
||||
lea 0xc00000,a1
|
||||
move.b #0xec,cmd_reg(a0) //identify devcie cmd
|
||||
bsr wait_int
|
||||
bsr ds_rx
|
||||
// read sector normal
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x20,cmd_reg(a0) // read cmd
|
||||
bsr wait_int
|
||||
bsr ds_rx
|
||||
|
||||
// write testpattern sector
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x30,cmd_reg(a0) // write cmd
|
||||
bsr drq_wait
|
||||
// write pattern
|
||||
move.l #256,d0
|
||||
ide_test_loop3:
|
||||
move.w #0xa55a,(a0)
|
||||
subq.l #1,d0
|
||||
bne ide_test_loop3
|
||||
bsr wait_int
|
||||
// read testpattern sector
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x20,cmd_reg(a0) // read
|
||||
bsr wait_int
|
||||
bsr ds_rx
|
||||
// sector restauriern
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x30,cmd_reg(a0) // write
|
||||
lea -0x400(a1),a1 // vorletzer
|
||||
bsr drq_wait
|
||||
bsr ds_tx
|
||||
bsr wait_int
|
||||
// fertig und zur<75>ck
|
||||
nop
|
||||
rts
|
||||
// wait auf int
|
||||
wait_int:
|
||||
move.b 0xfffffa01,d0
|
||||
btst.b #5,d0
|
||||
bne wait_int
|
||||
move.b status_reg(a0),d0
|
||||
rts
|
||||
// wait auf drq
|
||||
drq_wait:
|
||||
move.b status_reg(a0),d0
|
||||
btst #3,d0
|
||||
beq drq_wait
|
||||
rts
|
||||
|
||||
// 1 sector lesen word
|
||||
ds_rx:
|
||||
move.l #256,d0
|
||||
ds_rx_loop:
|
||||
move.w (a0),(a1)+
|
||||
subq.l #1,d0
|
||||
bne ds_rx_loop
|
||||
rts
|
||||
// 1 sector lesen long
|
||||
ds_rxl:
|
||||
move.l #128,d0
|
||||
ds_rxl_loop:
|
||||
move.l (a0),(a1)+
|
||||
subq.l #1,d0
|
||||
bne ds_rxl_loop
|
||||
rts
|
||||
// 1 sector schreiben word
|
||||
ds_tx:
|
||||
move.l #256,d0
|
||||
ds_tx_loop:
|
||||
move.w (a1)+,(a0)
|
||||
subq.l #1,d0
|
||||
bne ds_tx_loop
|
||||
rts
|
||||
// 1 sector schreiben word
|
||||
ds_txl:
|
||||
move.l #128,d0
|
||||
ds_txl_loop:
|
||||
move.l (a1)+,(a0)
|
||||
subq.l #1,d0
|
||||
bne ds_txl_loop
|
||||
rts
|
||||
// warteschleife ca. 20ms
|
||||
warten_20ms:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #700000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 200us
|
||||
warten_200us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #7000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 10us
|
||||
warten_10us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #333,d6
|
||||
warten_loop:
|
||||
move.l (a0),d1
|
||||
sub.l d0,d1
|
||||
add.l d6,d1
|
||||
bpl warten_loop
|
||||
move.l (sp)+,d0
|
||||
move.l (sp)+,d1
|
||||
move.l (sp)+,d6
|
||||
move.l (sp)+,a0
|
||||
rts;
|
||||
}
|
||||
/********************************************************************/
|
||||
458
sources/sd_ide.s
458
sources/sd_ide.s
@@ -1,458 +0,0 @@
|
||||
|
||||
|
||||
//.include "startcf.h"
|
||||
|
||||
//.extern ___MBAR
|
||||
//#define MCF_SLT0_SCNT ___MBAR+0x908
|
||||
|
||||
//.global ide_test
|
||||
|
||||
.text
|
||||
/*
|
||||
sd_test:
|
||||
clr.w MCF_PAD_PAR_DSPI
|
||||
lea MCF_GPIO_PPDSDR_DSPI,a2 // data in
|
||||
lea MCF_GPIO_PODR_DSPI,a1 // data out
|
||||
move.b #0x00,(a1) // alle auf 0
|
||||
lea MCF_GPIO_PDDR_DSPI,a0
|
||||
move.b #0x7d,(a0) // din = input rest output
|
||||
|
||||
bsr warten_20ms
|
||||
|
||||
move.b #0x7f,(a1) // alle auf 1
|
||||
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
bsr sd_16clk
|
||||
// sd idle
|
||||
sd_idle:
|
||||
bsr sd_16clk
|
||||
moveq #0x40,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x95,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x05,d5
|
||||
beq sd_test
|
||||
cmp.b #0x01,d5
|
||||
beq wait_of_aktiv
|
||||
cmp.b #0x04,d5
|
||||
beq sd_init_ok
|
||||
cmp.b #0x00,d5
|
||||
beq sd_init_ok
|
||||
bra sd_idle
|
||||
|
||||
// acdm 41
|
||||
wait_of_aktiv:
|
||||
bsr sd_16clk
|
||||
|
||||
moveq #0x77,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
bsr sd_16clk
|
||||
|
||||
move.l #0xff,d6
|
||||
moveq #0x69,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #0x02,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
and d5,d6
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
beq sd_init_ok
|
||||
cmp.b #0x05,d5
|
||||
beq sd_test
|
||||
bra wait_of_aktiv
|
||||
|
||||
sd_init_ok:
|
||||
|
||||
// blockgr<EFBFBD>sse 512byt
|
||||
sd_bg:
|
||||
bsr sd_16clk
|
||||
moveq #0x50,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #02,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_bg
|
||||
|
||||
// read block
|
||||
sd_rb:
|
||||
bsr sd_16clk
|
||||
moveq #0x51,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x08,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_rb
|
||||
|
||||
lea 0xc00000,a4
|
||||
move.l #513,d7
|
||||
rd_rb:
|
||||
bsr sd_receive
|
||||
move.b d5,(a4)+
|
||||
subq.l #1,d7
|
||||
bne rd_rb
|
||||
|
||||
// write block
|
||||
sd_wb:
|
||||
bsr sd_16clk
|
||||
moveq #0x58,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x08,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_wb
|
||||
|
||||
lea 0xc00000,a4
|
||||
move.l #513,d7
|
||||
moveq.l #0x66,d4
|
||||
wr_wb:
|
||||
bsr sd_com
|
||||
// subq.l #1,d4
|
||||
moveq #0x66,d4
|
||||
subq.l #1,d7
|
||||
bne wr_wb
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
wr_wb_el:
|
||||
moveq #0xff,d4
|
||||
bsr sd_com
|
||||
cmp.b #0xff,d5
|
||||
bne wr_wb_el
|
||||
|
||||
|
||||
// read block 2
|
||||
sd_rb2:
|
||||
bsr sd_16clk
|
||||
moveq #0x51,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x08,d4
|
||||
bsr sd_com
|
||||
moveq #00,d4
|
||||
bsr sd_com
|
||||
moveq #0x01,d4
|
||||
bsr sd_com
|
||||
|
||||
bsr sd_receive
|
||||
|
||||
cmp.b #0x00,d5
|
||||
bne sd_rb2
|
||||
|
||||
lea 0xc00400,a4
|
||||
move.l #513,d7
|
||||
rd_rb2:
|
||||
bsr sd_receive
|
||||
move.b d5,(a4)+
|
||||
subq.l #1,d7
|
||||
bne rd_rb2
|
||||
|
||||
|
||||
nop
|
||||
nop
|
||||
|
||||
rts
|
||||
|
||||
sd_receive:
|
||||
moveq #0xff,d4
|
||||
bsr sd_com
|
||||
cmp.b #0xff,d5
|
||||
beq sd_receive
|
||||
rts
|
||||
|
||||
sd_com:
|
||||
bclr.b #6,(a1)
|
||||
sd_comb:
|
||||
bsr warten_10us
|
||||
moveq #7,d2
|
||||
clr.l d5
|
||||
sd_com_loop:
|
||||
btst d2,d4
|
||||
beq sd_com2
|
||||
bset.b #0,(a1)
|
||||
bra sd_com2_1
|
||||
sd_com2:
|
||||
bclr.b #0,(a1)
|
||||
sd_com2_1:
|
||||
bsr sd_clk
|
||||
and.l #0x02,d3
|
||||
beq sd_com3
|
||||
bset.b d2,d5
|
||||
sd_com3:
|
||||
subq.l #1,d2
|
||||
bge sd_com_loop
|
||||
bsr warten_10us
|
||||
bset.b #6,(a1)
|
||||
bset.b #0,(a1)
|
||||
bsr warten_200us
|
||||
rts
|
||||
sd_clk:
|
||||
tst.b 0xfffff700
|
||||
tst.b 0xfffff700
|
||||
bset.b #2,(a1)
|
||||
tst.b 0xfffff700
|
||||
tst.b 0xfffff700
|
||||
move.b (a2),d3
|
||||
tst.b 0xfffff700
|
||||
bclr.b #2,(a1)
|
||||
rts
|
||||
|
||||
sd_15clk:
|
||||
move #15,d0
|
||||
bra sd_16clk
|
||||
sd_16clk:
|
||||
moveq #16,d0
|
||||
sd_16clk1:
|
||||
bsr sd_clk
|
||||
subq.l #1,d0
|
||||
bne sd_16clk1
|
||||
bsr warten_10us
|
||||
rts
|
||||
// warteschleife ca. 20ms
|
||||
warten_20ms:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #700000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 200us
|
||||
warten_200us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #7000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 10us
|
||||
warten_10us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #333,d6
|
||||
warten_loop:
|
||||
move.l (a0),d1
|
||||
sub.l d0,d1
|
||||
add.l d6,d1
|
||||
bpl warten_loop
|
||||
move.l (sp)+,d0
|
||||
move.l (sp)+,d1
|
||||
move.l (sp)+,d6
|
||||
move.l (sp)+,a0
|
||||
rts;
|
||||
/********************************************************************/
|
||||
#define cmd_reg (0x1d)
|
||||
#define status_reg (0x1d)
|
||||
#define seccnt (0x09)
|
||||
|
||||
ide_test:
|
||||
lea 0xfff00040,a0
|
||||
lea 0xc00000,a1
|
||||
move.b #0xec,cmd_reg(a0) //identify devcie cmd
|
||||
bsr wait_int
|
||||
bsr ds_rx
|
||||
// read sector normal
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x20,cmd_reg(a0) // read cmd
|
||||
bsr wait_int
|
||||
bsr ds_rx
|
||||
|
||||
// write testpattern sector
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x30,cmd_reg(a0) // write cmd
|
||||
bsr drq_wait
|
||||
// write pattern
|
||||
move.l #256,d0
|
||||
ide_test_loop3:
|
||||
move.w #0xa55a,(a0)
|
||||
subq.l #1,d0
|
||||
bne ide_test_loop3
|
||||
bsr wait_int
|
||||
// read testpattern sector
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x20,cmd_reg(a0) // read
|
||||
bsr wait_int
|
||||
bsr ds_rx
|
||||
// sector restauriern
|
||||
move.b #1,seccnt(a0) // 1 sector
|
||||
move.b #0x30,cmd_reg(a0) // write
|
||||
lea -0x400(a1),a1 // vorletzer
|
||||
bsr drq_wait
|
||||
bsr ds_tx
|
||||
bsr wait_int
|
||||
// fertig und zur<EFBFBD>ck
|
||||
nop
|
||||
rts
|
||||
// wait auf int
|
||||
wait_int:
|
||||
move.b 0xfffffa01,d0
|
||||
btst #5,d0
|
||||
bne wait_int
|
||||
move.b status_reg(a0),d0
|
||||
rts
|
||||
// wait auf drq
|
||||
drq_wait:
|
||||
move.b status_reg(a0),d0
|
||||
btst #3,d0
|
||||
beq drq_wait
|
||||
rts
|
||||
|
||||
// 1 sector lesen word
|
||||
ds_rx:
|
||||
move.l #256,d0
|
||||
ds_rx_loop:
|
||||
move.w (a0),(a1)+
|
||||
subq.l #1,d0
|
||||
bne ds_rx_loop
|
||||
rts
|
||||
// 1 sector lesen long
|
||||
ds_rxl:
|
||||
move.l #128,d0
|
||||
ds_rxl_loop:
|
||||
move.l (a0),(a1)+
|
||||
subq.l #1,d0
|
||||
bne ds_rxl_loop
|
||||
rts
|
||||
// 1 sector schreiben word
|
||||
ds_tx:
|
||||
move.l #256,d0
|
||||
ds_tx_loop:
|
||||
move.w (a1)+,(a0)
|
||||
subq.l #1,d0
|
||||
bne ds_tx_loop
|
||||
rts
|
||||
// 1 sector schreiben word
|
||||
ds_txl:
|
||||
move.l #128,d0
|
||||
ds_txl_loop:
|
||||
move.l (a1)+,(a0)
|
||||
subq.l #1,d0
|
||||
bne ds_txl_loop
|
||||
rts
|
||||
// warteschleife ca. 20ms
|
||||
warten_20ms:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #700000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 200us
|
||||
warten_200us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #7000,d6
|
||||
bra warten_loop
|
||||
// warteschleife ca. 10us
|
||||
warten_10us:
|
||||
move.l a0,-(sp)
|
||||
move.l d6,-(sp)
|
||||
move.l d1,-(sp)
|
||||
move.l d0,-(sp)
|
||||
lea MCF_SLT0_SCNT,a0
|
||||
move.l (a0),d0
|
||||
move.l #333,d6
|
||||
warten_loop:
|
||||
move.l (a0),d1
|
||||
sub.l d0,d1
|
||||
add.l d6,d1
|
||||
bpl warten_loop
|
||||
move.l (sp)+,d0
|
||||
move.l (sp)+,d1
|
||||
move.l (sp)+,d6
|
||||
move.l (sp)+,a0
|
||||
rts;
|
||||
/********************************************************************/
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user