Exemple #1
0
long XHInqTarget(UWORD major, UWORD minor, ULONG *blocksize,
                 ULONG *deviceflags, char *productname)
{
#if CONF_WITH_XHDI
    if (next_handler) {
        long ret = next_handler(XHINQTARGET, major, minor, blocksize, deviceflags, productname);
        if (ret != EINVFN && ret != EUNDEV)
            return ret;
    }
#endif

    return XHInqTarget2(major, minor, blocksize, deviceflags, productname, 33);
}
Exemple #2
0
int32 XHDIDriver::dispatch(uint32 fncode)
{
	D(bug("ARAnyM XHDI(%u)", fncode));
	int32 ret;
	switch(fncode) {
		case  0: ret = 0x0130;	/* XHDI version */
				break;

		case  1: ret = XHInqTarget2(
						getParameter(0), /* UWORD major */
						getParameter(1), /* UWORD minor */
						getParameter(2), /* ULONG *block_size */
						getParameter(3), /* ULONG *device_flags */
						getParameter(4), /* char  *product_name */
						             33  /* UWORD stringlen */
						);
				break;

		case  6: ret = XHDrvMap();
				break;

		case  7: ret = XHInqDev2(
						getParameter(0), /* UWORD bios_device */
						getParameter(1), /* UWORD *major */
						getParameter(2), /* UWORD *minor */
						getParameter(3), /* ULONG *start_sector */
						getParameter(4), /* BPB   *bpb */
						              0, /* ULONG *blocks */
						              0  /* char *partid */
						);
				break;

		case  8: ret = XHInqDriver(
						getParameter(0), /* UWORD bios_device */
						getParameter(1), /* char  *name */
						getParameter(2), /* char  *version */
						getParameter(3), /* char  *company */
						getParameter(4), /* UWORD *ahdi_version */
						getParameter(5)  /* UWORD *maxIPL */
						);
				break;

		case 10: ret = XHReadWrite(
						getParameter(0), /* UWORD major */
						getParameter(1), /* UWORD minor */
						getParameter(2), /* UWORD rwflag */
						getParameter(3), /* ULONG recno */
						getParameter(4), /* UWORD count */
						getParameter(5)  /* void *buf */
						);
				break;

		case 11: ret = XHInqTarget2(
						getParameter(0), /* UWORD major */
						getParameter(1), /* UWORD minor */
						getParameter(2), /* ULONG *block_size */
						getParameter(3), /* ULONG *device_flags */
						getParameter(4), /* char  *product_name */
						getParameter(5)  /* UWORD stringlen */
						);
				break;

		case 12: ret = XHInqDev2(
						getParameter(0), /* UWORD bios_device */
						getParameter(1), /* UWORD *major */
						getParameter(2), /* UWORD *minor */
						getParameter(3), /* ULONG *start_sector */
						getParameter(4), /* BPB   *bpb */
						getParameter(5), /* ULONG *blocks */
						getParameter(6)  /* char *partid */
						);
				break;

		case 14: ret = XHGetCapacity(
						getParameter(0), /* UWORD major */
						getParameter(1), /* UWORD minor */
						getParameter(2), /* ULONG *blocks */
						getParameter(3)  /* ULONG *blocksize */
						);
				break;
				
		default: ret = EINVFN;
				D(bug("Unimplemented ARAnyM XHDI function #%d", fncode));
				break;
	}
	D(bug("ARAnyM XHDI function returning with %d", ret));
	return ret;
}
Exemple #3
0
long xhdi_handler(UWORD *stack)
{
    UWORD opcode = *stack;

    switch (opcode)
    {
        case XHGETVERSION:
        {
            return XHGetVersion();
        }

        case XHINQTARGET:
        {
            struct XHINQTARGET_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                ULONG *blocksize;
                ULONG *deviceflags;
                char *productname;
            } *args = (struct XHINQTARGET_args *)stack;

            return XHInqTarget(args->major, args->minor, args->blocksize, args->deviceflags, args->productname);
        }

        case XHRESERVE:
        {
            struct XHRESERVE_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                UWORD do_reserve;
                UWORD key;
            } *args = (struct XHRESERVE_args *)stack;

            return XHReserve(args->major, args->minor, args->do_reserve, args->key);
        }

        case XHLOCK:
        {
            struct XHLOCK_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                UWORD do_lock;
                UWORD key;
            } *args = (struct XHLOCK_args *)stack;

            return XHLock(args->major, args->minor, args->do_lock, args->key);
        }

        case XHSTOP:
        {
            struct XHSTOP_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                UWORD do_stop;
                UWORD key;
            } *args = (struct XHSTOP_args *)stack;

            return XHStop(args->major, args->minor, args->do_stop, args->key);
        }

        case XHEJECT:
        {
            struct XHEJECT_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                UWORD do_eject;
                UWORD key;
            } *args = (struct XHEJECT_args *)stack;

            return XHEject(args->major, args->minor, args->do_eject, args->key);
        }

        case XHDRVMAP:
        {
            return XHDrvMap();
        }

        case XHINQDEV:
        {
            struct XHINQDEV_args
            {
                UWORD opcode;
                UWORD drv;
                UWORD *major;
                UWORD *minor;
                ULONG *start;
                BPB *bpb;
            } *args = (struct XHINQDEV_args *)stack;

            return XHInqDev(args->drv, args->major, args->minor, args->start, args->bpb);
        }

        case XHINQDRIVER:
        {
            struct XHINQDRIVER_args
            {
                UWORD opcode;
                UWORD dev;
                char *name;
                char *version;
                char *company;
                UWORD *ahdi_version;
                UWORD *maxIPL;
            } *args = (struct XHINQDRIVER_args *)stack;

            return XHInqDriver(args->dev, args->name, args->version, args->company, args->ahdi_version, args->maxIPL);
        }

        case XHNEWCOOKIE:
        {
            struct XHNEWCOOKIE_args
            {
                UWORD opcode;
                ULONG newcookie;
            } *args = (struct XHNEWCOOKIE_args *)stack;

            return XHNewCookie(args->newcookie);
        }

        case XHREADWRITE:
        {
            struct XHREADWRITE_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                UWORD rw;
                ULONG sector;
                UWORD count;
                void *buf;
            } *args = (struct XHREADWRITE_args *)stack;

            return XHReadWrite(args->major, args->minor, args->rw, args->sector, args->count, args->buf);
        }

        case XHINQTARGET2:
        {
            struct XHINQTARGET2_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                ULONG *blocksize;
                ULONG *deviceflags;
                char *productname;
                UWORD stringlen;
            } *args = (struct XHINQTARGET2_args *)stack;

            return XHInqTarget2(args->major, args->minor, args->blocksize, args->deviceflags, args->productname, args->stringlen);
        }

        case XHINQDEV2:
        {
            struct XHINQDEV2_args
            {
                UWORD opcode;
                UWORD drv;
                UWORD *major;
                UWORD *minor;
                ULONG *start;
                BPB *bpb;
                ULONG *blocks;
                char *partid;
            } *args = (struct XHINQDEV2_args *)stack;

            return XHInqDev2(args->drv, args->major, args->minor, args->start, args->bpb, args->blocks, args->partid);
        }

        case XHDRIVERSPECIAL:
        {
            struct XHDRIVERSPECIAL_args
            {
                UWORD opcode;
                ULONG key1;
                ULONG key2;
                UWORD subopcode;
                void *data;
            } *args = (struct XHDRIVERSPECIAL_args *)stack;

            return XHDriverSpecial(args->key1, args->key2, args->subopcode, args->data);
        }

        case XHGETCAPACITY:
        {
            struct XHGETCAPACITY_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                ULONG *blocks;
                ULONG *blocksize;
            } *args = (struct XHGETCAPACITY_args *)stack;

            return XHGetCapacity(args->major, args->minor, args->blocks, args->blocksize);
        }

        case XHMEDIUMCHANGED:
        {
            struct XHMEDIUMCHANGED_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
            } *args = (struct XHMEDIUMCHANGED_args *)stack;

            return XHMediumChanged(args->major, args->minor);
        }

/* 
       MiNT places itself at the beginning of the chain,
       We don't need to pass this call.

        case XHMINTINFO:
        {
            return XHMiNTInfo();
        }
*/
        case XHDOSLIMITS:
        {
            struct XHDOSLIMITS_args
            {
                UWORD opcode;
                UWORD which;
                ULONG limit;
            } *args = (struct XHDOSLIMITS_args *)stack;

            return XHDOSLimits(args->which, args->limit);
        }

        case XHLASTACCESS:
        {
            struct XHLASTACCESS_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
                ULONG *ms;
            } *args = (struct XHLASTACCESS_args *)stack;

            return XHLastAccess(args->major, args->minor, args->ms);
        }

        case XHREACCESS:
        {
            struct XHREACCESS_args
            {
                UWORD opcode;
                UWORD major;
                UWORD minor;
            } *args = (struct XHREACCESS_args *)stack;

            return XHReaccess(args->major, args->minor);
        }

        default:
        {
            return EINVFN;
        }
    }
}