not used anymore - concept changed
This commit is contained in:
@@ -1,102 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
|
||||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.694917944">
|
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.694917944" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
|
||||||
<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 artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.694917944" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
|
|
||||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.694917944." name="/" resourcePath="">
|
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1336300819" name="Cross GCC" resourceTypeBasedDiscovery="true" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
|
|
||||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.477708060" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" value="m68k-atari-mint-" valueType="string"/>
|
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1963886481" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
|
||||||
<builder buildPath="${workspace_loc:/emutos_sd}" id="cdt.managedbuild.builder.gnu.cross.1819972676" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.803027918" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
|
||||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1254378396" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
|
|
||||||
<option id="gnu.c.compiler.option.debugging.level.389596925" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.563116483" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
|
||||||
</tool>
|
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.583729215" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
|
||||||
<option id="gnu.cpp.compiler.option.optimization.level.370238961" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
|
||||||
<option id="gnu.cpp.compiler.option.debugging.level.29543400" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
|
||||||
</tool>
|
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1182913790" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.535589739" 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.911168179" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
|
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1385759316" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.348061269" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.2024812805" 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="emutos_sd.cdt.managedbuild.target.gnu.cross.exe.1146694340" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
|
||||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
|
||||||
<configuration configurationName="Debug">
|
|
||||||
<resource resourceType="PROJECT" workspacePath="/emutos_sd"/>
|
|
||||||
</configuration>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
|
||||||
<storageModule moduleId="scannerConfiguration">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.694917944;cdt.managedbuild.config.gnu.cross.exe.debug.694917944.;cdt.managedbuild.tool.gnu.cross.c.compiler.803027918;cdt.managedbuild.tool.gnu.c.compiler.input.563116483">
|
|
||||||
<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>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
|
||||||
<buildTargets>
|
|
||||||
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>make</buildCommand>
|
|
||||||
<buildTarget>all</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>true</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>make</buildCommand>
|
|
||||||
<buildTarget>clean</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>true</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
<target name="test" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
|
||||||
<buildCommand>make</buildCommand>
|
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>test</buildTarget>
|
|
||||||
<stopOnError>true</stopOnError>
|
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
|
||||||
<runAllBuilders>true</runAllBuilders>
|
|
||||||
</target>
|
|
||||||
</buildTargets>
|
|
||||||
</storageModule>
|
|
||||||
</cproject>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>emu_sd</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
|
||||||
<triggers>clean,full,incremental,</triggers>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
|
||||||
<triggers>full,incremental,</triggers>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
encoding/<project>=UTF-8
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
# Makefile for the EmuTOS to BaS_gcc SD-card "driver connector"
|
|
||||||
#
|
|
||||||
# The driver actually resides within BaS_gcc. All we need to do within the AUTO-folder program is to find the driver
|
|
||||||
# entry point and put its address into the respective cookie
|
|
||||||
|
|
||||||
TOOLCHAIN_PREFIX=m68k-atari-mint-
|
|
||||||
CC=$(TOOLCHAIN_PREFIX)gcc
|
|
||||||
|
|
||||||
CFLAGS=-mcpu=547x \
|
|
||||||
-Os \
|
|
||||||
-fomit-frame-pointer \
|
|
||||||
-Wno-multichar\
|
|
||||||
-Wall
|
|
||||||
EMUSD=emusd
|
|
||||||
APP=$(EMUSD).prg
|
|
||||||
|
|
||||||
all: $(APP) xhditest.prg
|
|
||||||
|
|
||||||
SOURCES=$(EMUSD).c \
|
|
||||||
cookie.c
|
|
||||||
|
|
||||||
OBJECTS=$(SOURCES:.c=.o)
|
|
||||||
|
|
||||||
$(APP): $(OBJECTS) depend
|
|
||||||
$(CC) $(CFLAGS) $(OBJECTS) -o $(APP)
|
|
||||||
|
|
||||||
test: xhditest.prg
|
|
||||||
xhditest.prg: xhdi_test.c depend
|
|
||||||
$(CC) $(CFLAGS) xhdi_test.c -o xhditest.prg
|
|
||||||
|
|
||||||
.PHONY clean:
|
|
||||||
- rm -rf *.o depend xhditest.prg
|
|
||||||
|
|
||||||
depend: $(SOURCES)
|
|
||||||
$(CC) $(CFLAGS) $(INCLUDE) -M $(SOURCES) xhdi_test.c > depend
|
|
||||||
|
|
||||||
|
|
||||||
ifneq (clean,$(MAKECMDGOALS))
|
|
||||||
-include depend
|
|
||||||
endif
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* cookie.c
|
|
||||||
*
|
|
||||||
* Created on: 03.05.2013
|
|
||||||
* Author: mfro
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <osbind.h>
|
|
||||||
|
|
||||||
static uint32_t cookieptr(void)
|
|
||||||
{
|
|
||||||
return * (uint32_t *) 0x5a0L;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getcookie(uint32_t cookie, uint32_t *p_value)
|
|
||||||
{
|
|
||||||
uint32_t *cookiejar = (uint32_t *) Supexec(cookieptr);
|
|
||||||
|
|
||||||
if (!cookiejar) return 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (cookiejar[0] == cookie)
|
|
||||||
{
|
|
||||||
if (p_value) *p_value = cookiejar[1];
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
cookiejar = &(cookiejar[2]);
|
|
||||||
} while (cookiejar[-2]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setcookie(uint32_t cookie, uint32_t value)
|
|
||||||
{
|
|
||||||
uint32_t *cookiejar = (uint32_t *) Supexec(cookieptr);
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (cookiejar[0] == cookie)
|
|
||||||
{
|
|
||||||
cookiejar[1] = value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
cookiejar = &(cookiejar[2]);
|
|
||||||
} while (cookiejar[-2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* cookie.h
|
|
||||||
*
|
|
||||||
* Created on: 05.05.2013
|
|
||||||
* Author: mfro
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _COOKIE_H_
|
|
||||||
#define _COOKIE_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get and set named cookies. Although these routines do access the cookiejar system variable (which is
|
|
||||||
* protected), they do not need to be called in supervisor mode
|
|
||||||
*/
|
|
||||||
extern int getcookie(uint32_t cookie, uint32_t *p_value);
|
|
||||||
extern void setcookie(uint32_t cookie, uint32_t value);
|
|
||||||
|
|
||||||
#endif /* _COOKIE_H_ */
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* emusd.c
|
|
||||||
*
|
|
||||||
* The driver actually resides within BaS_gcc. All we need to do within the AUTO-folder program is to find the driver
|
|
||||||
* entry point and put its address into the XHDI cookie
|
|
||||||
*
|
|
||||||
* Created on: 01.05.2013
|
|
||||||
* Author: mfro
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <osbind.h>
|
|
||||||
|
|
||||||
#include "cookie.h"
|
|
||||||
#include "xhdi.h"
|
|
||||||
|
|
||||||
#define XHDIMAGIC 0x27011992L
|
|
||||||
|
|
||||||
typedef uint32_t (*cookie_fun)(uint16_t opcode,...);
|
|
||||||
|
|
||||||
static cookie_fun old_vector = NULL;
|
|
||||||
|
|
||||||
static cookie_fun get_fun_ptr(void)
|
|
||||||
{
|
|
||||||
static cookie_fun xhdi = NULL;
|
|
||||||
static int have_it = 0;
|
|
||||||
|
|
||||||
if (!have_it)
|
|
||||||
{
|
|
||||||
uint32_t *magic_test;
|
|
||||||
|
|
||||||
getcookie ('XHDI', (uint32_t *) &xhdi);
|
|
||||||
have_it = 1;
|
|
||||||
|
|
||||||
/* check magic */
|
|
||||||
|
|
||||||
magic_test = (uint32_t *) xhdi;
|
|
||||||
if (magic_test && (magic_test[-1] != XHDIMAGIC))
|
|
||||||
xhdi = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return xhdi;
|
|
||||||
}
|
|
||||||
|
|
||||||
cookie_fun bas_sd_vector(cookie_fun old_vector)
|
|
||||||
{
|
|
||||||
register long retvalue __asm__("d0");
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"move.l %[retvalue],-(sp)\n\t"
|
|
||||||
"trap #0\n\t"
|
|
||||||
"addq.l #4,sp\n\t"
|
|
||||||
: [retvalue]"=r"(retvalue)
|
|
||||||
: "g"(old_vector)
|
|
||||||
: "d1","d2","d3","a0","a1","a2"
|
|
||||||
);
|
|
||||||
return (cookie_fun) retvalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
uint32_t value;
|
|
||||||
cookie_fun bas_vector;
|
|
||||||
|
|
||||||
if (getcookie('XHDI', &value))
|
|
||||||
{
|
|
||||||
if ((old_vector = get_fun_ptr()))
|
|
||||||
{
|
|
||||||
printf("old XHDI vector (%p) found and saved\r\n", old_vector);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bas_vector = bas_sd_vector(old_vector);
|
|
||||||
printf("got vector from BaS: %p\r\n", bas_vector);
|
|
||||||
//setcookie('XHDI', (uint32_t) bas_vector);
|
|
||||||
XHNewCookie(old_vector, bas_vector);
|
|
||||||
printf("vector to BaS driver set\r\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
581
sd-emutos/xhdi.h
581
sd-emutos/xhdi.h
@@ -1,581 +0,0 @@
|
|||||||
/*
|
|
||||||
* xhdi.h
|
|
||||||
*
|
|
||||||
* Created on: 03.05.2013
|
|
||||||
* Author: mfro
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef XHDI_H_
|
|
||||||
#define XHDI_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)
|
|
||||||
|
|
||||||
/* XHDI DOS limits */
|
|
||||||
|
|
||||||
#define XH_DL_SECSIZ (0) /* Maximum sector size (BIOS level) */
|
|
||||||
#define XH_DL_MINFAT (1) /* Minimum number of FATs */
|
|
||||||
#define XH_DL_MAXFAT (2) /* Maximal number of FATs */
|
|
||||||
#define XH_DL_MINSPC (3) /* Minimum sectors per cluster */
|
|
||||||
#define XH_DL_MAXSPC (4) /* Maximum sectors per cluster */
|
|
||||||
#define XH_DL_CLUSTS (5) /* Maximum number of clusters of a 16-bit FAT */
|
|
||||||
#define XH_DL_MAXSEC (6) /* Maximum number of sectors */
|
|
||||||
#define XH_DL_DRIVES (7) /* Maximum number of BIOS drives supported by the DOS */
|
|
||||||
#define XH_DL_CLSIZB (8) /* Maximum cluster size */
|
|
||||||
#define XH_DL_RDLEN (9) /* Max. (bpb->rdlen * bpb->recsiz/32) */
|
|
||||||
#define XH_DL_CLUSTS12 (12) /* Max. number of clusters of a 12-bit FAT */
|
|
||||||
#define XH_DL_CLUSTS32 (13) /* Max. number of clusters of a 32 bit FAT */
|
|
||||||
#define XH_DL_BFLAGS (14) /* Supported bits in bpb->bflags */
|
|
||||||
|
|
||||||
#ifndef _FEATURES_H
|
|
||||||
#include <features.h>
|
|
||||||
#endif /* _FEATURES_H */
|
|
||||||
|
|
||||||
|
|
||||||
extern long xhdi_entrypoint;
|
|
||||||
|
|
||||||
#define CLOBBER_REGISTERS "a0","memory" /* */
|
|
||||||
|
|
||||||
/* XHDI #0 */
|
|
||||||
#define XHGetVersion(xhdi_entry) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w #0,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"addq.l #2,sp\n\t" \
|
|
||||||
: [retvalue]"=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry] "g" (xhdi_entry) /* inputs */ \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #1 */
|
|
||||||
#define XHInqTarget(xhdi_entry, major, minor, block_size, flags, product_name) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_product_name],-(sp)\n\t" \
|
|
||||||
"move.l %[a_flags],-(sp)\n\t" \
|
|
||||||
"move.l %[a_block_size],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #1,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 18(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_block_size]"g"(block_size), \
|
|
||||||
[a_flags]"g"(flags), \
|
|
||||||
[a_product_name]"g"(product_name) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #2 */
|
|
||||||
#define XHReserve(xhdi_entry, major, minor, do_reserve, key) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w %[a_key],-(sp)\n\t" \
|
|
||||||
"move.w %[a_do_reserve],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #2,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 10(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_do_reserve]"g"(do_reserve), \
|
|
||||||
[a_key]"g"(key) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #3 */
|
|
||||||
#define XHLock(xhdi_entry, major, minor, do_lock, key) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w %[a_key],-(sp)\n\t" \
|
|
||||||
"move.w %[a_do_lock],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #3,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 10(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_do_lock]"g"(do_lock), \
|
|
||||||
[a_key]"g"(key) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #4 */
|
|
||||||
#define XHStop(xhdi_entry, major, minor, do_stop, key) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w %[a_key],-(sp)\n\t" \
|
|
||||||
"move.w %[a_do_stop],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #4,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 10(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_do_stop]"g"(do_stop), \
|
|
||||||
[a_key]"g"(key) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #5 */
|
|
||||||
#define XHEject(xhdi_entry, major, minor, do_eject, key) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w %[a_key],-(sp)\n\t" \
|
|
||||||
"move.w %[a_do_eject],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #5,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 10(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_do_eject]"g"(do_eject), \
|
|
||||||
[a_key]"g"(key) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #6 */
|
|
||||||
#define XHDrvMap(xhdi_entry) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w #6,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"addq.l #2,sp\n\t" \
|
|
||||||
: [retvalue] "=r" (retvalue)/* outputs */ \
|
|
||||||
: [entry] "m" (xhdi_entry) /* inputs */ \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #7 */
|
|
||||||
#define XHInqDev(xhdi_entry, bios_device, major, minor, start_sector, bpb) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_bpb],-(sp)\n\t" \
|
|
||||||
"move.l %[a_start_sector],-(sp)\n\t" \
|
|
||||||
"move.l %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.l %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w %[a_bios_device],-(sp)\n\t" \
|
|
||||||
"move.w #7,-(sp)\n\t" \
|
|
||||||
"move.l %[a_entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 20(sp),sp\n\t" \
|
|
||||||
: [retvalue]"=r"(retvalue) /* outputs */ \
|
|
||||||
: [a_entry]"g"(xhdi_entry), \
|
|
||||||
[a_bios_device]"g"(bios_device), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_start_sector]"g"(start_sector), \
|
|
||||||
[a_bpb]"g"(bpb) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #8 */
|
|
||||||
#define XHInqDriver(xhdi_entry, bios_device, name, version, company, ahdi_version, max_ipl) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_max_ipl],-(sp)\n\t" \
|
|
||||||
"move.l %[a_ahdi_version],-(sp)\n\t" \
|
|
||||||
"move.l %[a_company],-(sp)\n\t" \
|
|
||||||
"move.l %[a_version],-(sp)\n\t" \
|
|
||||||
"move.l %[a_name],-(sp)\n\t" \
|
|
||||||
"move.w %[a_bios_device],-(sp)\n\t" \
|
|
||||||
"move.w #8,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 16(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_bios_device]"g"(bios_device), \
|
|
||||||
[a_name]"g"(name), \
|
|
||||||
[a_version]"g"(version), \
|
|
||||||
[a_company]"g"(company), \
|
|
||||||
[a_ahdi_version]"g"(ahdi_version), \
|
|
||||||
[a_max_ipl]"g"(max_ipl) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #9 */
|
|
||||||
#define XHNewCookie(xhdi_entry, newcookie) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_newcookie],-(sp)\n\t" \
|
|
||||||
"move.w #9,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"addq.l #6,sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry] "g" (xhdi_entry), \
|
|
||||||
[a_newcookie]"g"(newcookie) /* inputs */ \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #10 */
|
|
||||||
#define XHReadWrite(xhdi_entry, major, minor, rwflag, recno, count, buf) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_buf],-(sp)\n\t" \
|
|
||||||
"move.w %[a_count],-(sp)\n\t" \
|
|
||||||
"move.l %[a_recno],-(sp)\n\t" \
|
|
||||||
"move.w %[a_rwflag],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #10,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 18(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_rwflag]"g"(rwflag), \
|
|
||||||
[a_recno]"g"(recno), \
|
|
||||||
[a_count]"g"(count), \
|
|
||||||
[a_buf]"g"(buf) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #11 */
|
|
||||||
#define XHInqTarget2(xhdi_entry, major, minor, block_size, device_flags, product_name, stringlen) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w %[a_stringlen],-(sp)\n\t" \
|
|
||||||
"move.l %[a_product_name],-(sp)\n\t" \
|
|
||||||
"move.l %[a_device_flags],-(sp)\n\t" \
|
|
||||||
"move.l %[a_block_size],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #11,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 24(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_block_size]"g"(block_size), \
|
|
||||||
[a_device_flags]"g"(device_flags), \
|
|
||||||
[a_product_name]"g"(product_name), \
|
|
||||||
[a_stringlen]"g"(stringlen) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #12 */
|
|
||||||
#define XHInqDev2(xhdi_entry, bios_device, major, minor, start_sector, bpb, blocks, partid) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_partid],-(sp)\n\t" \
|
|
||||||
"move.l %[a_blocks],-(sp)\n\t" \
|
|
||||||
"move.l %[a_bpb],-(sp)\n\t" \
|
|
||||||
"move.l %[a_start_sector],-(sp)\n\t" \
|
|
||||||
"move.l %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.l %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w %[a_bios_device],-(sp)\n\t" \
|
|
||||||
"move.w #12,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 28(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_bios_device]"g"(bios_device), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_start_sector]"g"(start_sector), \
|
|
||||||
[a_bpb]"g"(bpb), \
|
|
||||||
[a_blocks]"g"(blocks), \
|
|
||||||
[a_partid]"g"(partid) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #13 */
|
|
||||||
#define XHDriverSpecial(xhdi_entry, key1, key2, subopcode, data) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_data],-(sp)\n\t" \
|
|
||||||
"move.w %[a_subopcode],-(sp)\n\t" \
|
|
||||||
"move.l %[a_key2],-(sp)\n\t" \
|
|
||||||
"move.l %[a_key1],-(sp)\n\t" \
|
|
||||||
"move.w #13,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 16(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_key1]"g"(key1), \
|
|
||||||
[a_key2]"g"(key2), \
|
|
||||||
[a_subopcode]"g"(subopcode), \
|
|
||||||
[a_data]"g"(data) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #14 */
|
|
||||||
#define XHGetCapacity(xhdi_entry, major, minor, blocks, bs) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_bs],-(sp)\n\t" \
|
|
||||||
"move.l %[a_blocks],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #14,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 14(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_blocks]"g"(blocks), \
|
|
||||||
[a_bs]"g"(bs) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #15 */
|
|
||||||
#define XHMediumChanged(xhdi_entry, major, minor) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #15,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"addq.l #6,sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #16 */
|
|
||||||
#define XHMintInfo(xhdi_entry, opcode, data) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_data],-(sp)\n\t" \
|
|
||||||
"move.w %[a_opcode],-(sp)\n\t" \
|
|
||||||
"move.w #16,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 8(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_opcode]"g"(opcode), \
|
|
||||||
[a_data]"g"(data) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #17 */
|
|
||||||
#define XHDOSLimits(xhdi_entry, which, limit) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_limit],-(sp)\n\t" \
|
|
||||||
"move.w %[a_which],-(sp)\n\t" \
|
|
||||||
"move.w #17,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 8(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_which]"g"(which), \
|
|
||||||
[a_limit]"g"(limit) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #18 */
|
|
||||||
#define XHLastAccess(xhdi_entry, major, minor, ms) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.l %[a_ms],-(sp)\n\t" \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #18,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"lea 10(sp),sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor), \
|
|
||||||
[a_ms]"g"(ms) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* XHDI #19 */
|
|
||||||
#define XHReaccess(xhdi_entry, major, minor) \
|
|
||||||
__extension__ \
|
|
||||||
({ \
|
|
||||||
register long retvalue __asm__("d0"); \
|
|
||||||
\
|
|
||||||
__asm__ volatile( \
|
|
||||||
"move.w %[a_minor],-(sp)\n\t" \
|
|
||||||
"move.w %[a_major],-(sp)\n\t" \
|
|
||||||
"move.w #19,-(sp)\n\t" \
|
|
||||||
"move.l %[entry],a0\n\t" \
|
|
||||||
"jsr (a0)\n\t" \
|
|
||||||
"addq.l #6,sp\n\t" \
|
|
||||||
: "=r"(retvalue) /* outputs */ \
|
|
||||||
: [entry]"g"(xhdi_entry), \
|
|
||||||
[a_major]"g"(major), \
|
|
||||||
[a_minor]"g"(minor) \
|
|
||||||
: CLOBBER_REGISTERS /* clobbered regs */ \
|
|
||||||
); \
|
|
||||||
retvalue; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#endif /* XHDI_H_ */
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
/*
|
|
||||||
* xhdi_test.c
|
|
||||||
*
|
|
||||||
* Created on: 04.05.2013
|
|
||||||
* Author: mfro
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <osbind.h>
|
|
||||||
#include "xhdi.h"
|
|
||||||
|
|
||||||
|
|
||||||
static uint32_t *xhdi;
|
|
||||||
|
|
||||||
static uint32_t cookieptr(void)
|
|
||||||
{
|
|
||||||
return * (uint32_t *) 0x5a0L;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getcookie(uint32_t cookie, uint32_t *p_value)
|
|
||||||
{
|
|
||||||
uint32_t *cookiejar = (uint32_t *) Supexec(cookieptr);
|
|
||||||
|
|
||||||
if (!cookiejar) return 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (cookiejar[0] == cookie)
|
|
||||||
{
|
|
||||||
if (p_value) *p_value = cookiejar[1];
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
cookiejar = &(cookiejar[2]);
|
|
||||||
} while (cookiejar[-2]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_bpb(_BPB *bpb)
|
|
||||||
{
|
|
||||||
printf("\t\trecsiz = %u\r\n", bpb->recsiz);
|
|
||||||
printf("\t\tclsiz = %u\r\n", bpb->clsiz);
|
|
||||||
printf("\t\tclsizb = %u\r\n", bpb->clsizb);
|
|
||||||
printf("\t\trdlen = %u\r\n", bpb->rdlen);
|
|
||||||
printf("\t\tfsiz = %u\r\n", bpb->fsiz);
|
|
||||||
printf("\t\tfatrec = %u\r\n", bpb->fatrec);
|
|
||||||
printf("\t\tdatrec = %u\r\n", bpb->datrec);
|
|
||||||
printf("\t\tnumcl = %u\r\n", bpb->numcl);
|
|
||||||
printf("\t\tbflags = %x\r\n", bpb->bflags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XHDI test routine
|
|
||||||
*
|
|
||||||
* XHDI functions must be called in supervisor mode - pack everything in a function that can be called by Supexec()
|
|
||||||
*/
|
|
||||||
void xhdi_test(void)
|
|
||||||
{
|
|
||||||
long drvmap;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
printf("XHDI cookie: %p\r\n\r\n", xhdi);
|
|
||||||
|
|
||||||
printf("XHGetVersion = %lx\r\n", XHGetVersion(xhdi));
|
|
||||||
drvmap = XHDrvMap(xhdi);
|
|
||||||
printf("XHDrvmap = %lx\r\n", drvmap);
|
|
||||||
|
|
||||||
printf("XHInqDev and XHInqDriver for all XHDI devices\r\n");
|
|
||||||
for (i = 0; i < 32; i++)
|
|
||||||
{
|
|
||||||
char driver_name[17];
|
|
||||||
char driver_version[7];
|
|
||||||
char driver_company[17];
|
|
||||||
uint16_t ahdi_version;
|
|
||||||
uint16_t max_ipl;
|
|
||||||
|
|
||||||
uint16_t major = 0;
|
|
||||||
uint16_t minor = 0;
|
|
||||||
long start_sector = 0L;
|
|
||||||
uint32_t ret;
|
|
||||||
_BPB *bpb = NULL;
|
|
||||||
long blocks;
|
|
||||||
char part_id[20];
|
|
||||||
|
|
||||||
if ((drvmap >> i) & 1)
|
|
||||||
{
|
|
||||||
printf("XHInqDev(%d):\r\n", i);
|
|
||||||
ret = XHInqDev(xhdi, i, &major, &minor, &start_sector, &bpb);
|
|
||||||
if (ret == E_OK || ret == EDRVNR)
|
|
||||||
{
|
|
||||||
long block_size;
|
|
||||||
long flags;
|
|
||||||
char product_name[33];
|
|
||||||
char buff[512];
|
|
||||||
unsigned long blocks;
|
|
||||||
unsigned long blocksize;
|
|
||||||
unsigned long ms;
|
|
||||||
|
|
||||||
printf("drive %d returned %d:\r\n", i, ret);
|
|
||||||
printf("\tmajor = %x, minor = %x, start_sector = %lx, bpb = %p\r\n", major, minor, start_sector, bpb);
|
|
||||||
if (bpb != NULL)
|
|
||||||
print_bpb(bpb);
|
|
||||||
|
|
||||||
printf("XHInqTarget() major = %x, minor = %x. result = %ld\r\n", major, minor,
|
|
||||||
XHInqTarget(xhdi, major, minor, &block_size, &flags, &product_name));
|
|
||||||
printf("block_size = %ld, flags = %lx, product_name = \"%s\"\r\n", block_size, flags, product_name);
|
|
||||||
|
|
||||||
printf("XHInqTarget2() major = %x, minor = %x. result = %ld\r\n", major, minor,
|
|
||||||
XHInqTarget2(xhdi, major, minor, &block_size, &flags, &buff, 512));
|
|
||||||
printf("block_size = %ld, flags = %lx, product_name = \"%s\"\r\n", block_size, flags, product_name);
|
|
||||||
|
|
||||||
printf("try to read sector 1 from device major = %x, minor = %x. Result: %ld\r\n",
|
|
||||||
major, minor, XHReadWrite(xhdi, major, minor, 0, 1, 1, &buff));
|
|
||||||
|
|
||||||
(void) Cconws("\r\n<press any key>\r\n");
|
|
||||||
(void) Cconin();
|
|
||||||
|
|
||||||
printf("XHEject() on device major = %x, minor = %x. result = %ld\r\n",
|
|
||||||
major, minor, XHEject(xhdi, major, minor, 1, 1));
|
|
||||||
|
|
||||||
printf("XHLock() on device major = %x, minor = %x. result = %ld\r\n",
|
|
||||||
major, minor, XHLock(xhdi, major, minor, 1, 1));
|
|
||||||
|
|
||||||
printf("XHReserve() on device major = %x, minor = %x. result = %ld\r\n",
|
|
||||||
major, minor, XHReserve(xhdi, major, minor, 1, 1));
|
|
||||||
|
|
||||||
printf("XHStop() on device major = %x, minor = %x. result = %ld\r\n",
|
|
||||||
major, minor, XHStop(xhdi, major, minor, 1, 1));
|
|
||||||
|
|
||||||
printf("XHDriverSpecial() on device major = %x, minor = %x. result = %ld\r\n",
|
|
||||||
major, minor, XHDriverSpecial(xhdi, 'EMUT', 0x12345678, 0, NULL));
|
|
||||||
|
|
||||||
printf("XHGetCapacity() on device major = %x, minor = %x. result = %ld\r\n",
|
|
||||||
major, minor, XHGetCapacity(xhdi, major, minor, &blocks, &blocksize));
|
|
||||||
printf("blocks = %ld, blocksize = %ld\r\n", blocks, blocksize);
|
|
||||||
|
|
||||||
printf("XHMediumChanged() on device major = %x, minor = %x. Result = %ld\r\n",
|
|
||||||
major, minor, XHMediumChanged(xhdi, major, minor));
|
|
||||||
|
|
||||||
printf("XHMintInfo() on driver. Result = %ld\r\n",
|
|
||||||
XHMintInfo(xhdi, 1, &buff));
|
|
||||||
|
|
||||||
(void) Cconws("\r\n<press any key>\r\n");
|
|
||||||
(void) Cconin();
|
|
||||||
|
|
||||||
printf("XHDOSLimits(XH_DL_SECSIZ); on driver. Result = %ld\r\n",
|
|
||||||
XHDOSLimits(xhdi, XH_DL_SECSIZ, 0));
|
|
||||||
|
|
||||||
ms = 0L;
|
|
||||||
printf("XHLastAccess() on device major = %x, minor = %x. Result = %ld\r\n",
|
|
||||||
major, minor, XHLastAccess(xhdi, major, minor, &ms));
|
|
||||||
printf("ms = %ld\r\n", ms);
|
|
||||||
|
|
||||||
printf("XHReaccess() on device major = %x, minor = %x. Result = %ld\r\n",
|
|
||||||
major, minor, XHReaccess(xhdi, major, minor));
|
|
||||||
}
|
|
||||||
printf("XHInqDriver(%d):", i);
|
|
||||||
ret = XHInqDriver(xhdi, i, &driver_name, &driver_version, &driver_company, &ahdi_version, &max_ipl);
|
|
||||||
printf("%d\r\n", ret);
|
|
||||||
if (ret == E_OK || ret == EDRVNR)
|
|
||||||
{
|
|
||||||
printf("driver_name = %s, driver_version = %s, driver_company = %s, ahdi_version = %d, max_ipl = %d\r\n",
|
|
||||||
driver_name, driver_version, driver_company, ahdi_version, max_ipl);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("XHInqDev2(%d):\r\n", i);
|
|
||||||
ret = XHInqDev2(xhdi, i, &major, &minor, &start_sector, &bpb, &blocks, &part_id);
|
|
||||||
if (ret == E_OK || ret == EDRVNR)
|
|
||||||
{
|
|
||||||
printf("drive %d returned %d:\r\n", i, ret);
|
|
||||||
printf("\tmajor = %x, minor = %x, start_sector = %lx, bpb = %p, blocks = %ld, part_id = %s\r\n",
|
|
||||||
major, minor, start_sector, bpb, blocks, part_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bpb = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
(void) Cconws("\033EGCC XHDI Test Program\r\n=====================\r\n\r\n");
|
|
||||||
|
|
||||||
if (getcookie('XHDI', (uint32_t *) &xhdi))
|
|
||||||
{
|
|
||||||
Supexec(xhdi_test);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
(void) Cconws("no XHDI cookie found.\r\n");
|
|
||||||
|
|
||||||
(void) Cconws("\r\n<press any key to return to desktop>\r\n");
|
|
||||||
(void) Cconin();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user