!**************************************************************************
!*
!* Network driver interface for netboot bootrom
!*
!* Module:  ndisdos.inc
!* Purpose: Definitions for DOS simulator interface private to NDIS interface
!* Entries: None
!*
!**************************************************************************
!*
!* Copyright (C) 1998-2003 Gero Kuhlmann <gero@gkminix.han.de>
!*
!*  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
!*  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., 675 Mass Ave, Cambridge, MA 02139, USA.
!*
!* $Id: ndisdos.inc,v 1.4 2003/01/25 23:29:41 gkminix Exp $
!*

#ifndef _NETDRVR_NDIS2_NDISDOS_INC
#define _NETDRVR_NDIS2_NDISDOS_INC


!
!**************************************************************************
!
! Include private header file of DOS simulator. This will, among
! others, include DOS error codes and predefined file handles.
!
#include "../dossim/dospriv.inc"


!
!**************************************************************************
!
! DOS functions which are not part of the DOS simulator and which we
! have to implement ourselves:
!
DOSFN_OPEN	equ	$3D		! open device or file
DOSFN_CLOSE	equ	$3E		! close device or file
DOSFN_IOCTL	equ	$44		! IOCTL for device or file


!
!**************************************************************************
!
! File handle to use for protocol manager. This has to follow the last
! handle used by the DOS simulator for standard devices.
!
PM_HANDLE	equ	RES_HANDLES


!
!**************************************************************************
!
! Attribute and device information for protocol manager device
!
PM_ATTRIB	equ	$8000		! Character device attribute
PM_DEVINFO	equ	$4880		! Device supports IOCTL/OPEN/CLOSE


!
!**************************************************************************
!
! Subfunction codes for IOCTL call:
!
IOCTL_GETINFO	equ	0		! get device information
IOCTL_SETINFO	equ	1		! set device information
IOCTL_RDCHAR	equ	2		! read from char device control channel
IOCTL_WRCHAR	equ	3		! write to char device control channel
IOCTL_RDBLOCK	equ	4		! read from block device control channel
IOCTL_WRBLOCK	equ	5		! write to block device control channel
IOCTL_INSTS	equ	6		! get device input status
IOCTL_OUTSTS	equ	7		! get device output status
IOCTL_REMOVE	equ	8		! check if block device is removable
IOCTL_DEVREM	equ	9		! check if block device is remote
IOCTL_HDLREM	equ	10		! check if handle is remote
IOCTL_RTRYCNT	equ	11		! set sharing retry count
IOCTL_CHARREQ	equ	12		! generic char device request
IOCTL_BLOCKREQ	equ	13		! generic block device request
IOCTL_GETDRVMAP	equ	14		! get logical drive map
IOCTL_SETDRVMAP	equ	15		! set logical drive map


!
!**************************************************************************
!
! Layout of device header
!
DEVHDR_NEXT	equ	$0000		! offset to far ptr to next device
DEVHDR_ATTR	equ	$0004		! offset to device attribute
DEVHDR_STRAT	equ	$0006		! offset to strategy routine pointer
DEVHDR_INT	equ	$0008		! offset to interrupt handler pointer
DEVHDR_NAME	equ	$000A		! offset to device name

DEV_NAME_SIZE	equ	8		! size of device name


!
!**************************************************************************
!
! Device driver opcodes:
!
DEV_INIT	equ	$0000		! initialize device
DEV_MEDIA_CHECK	equ	$0001		! media check for block device
DEV_BUILD_BPB	equ	$0002		! build block device parameter block
DEV_IOCTL_INP	equ	$0003		! read from IOCTL control channel
DEV_INPUT	equ	$0004		! read from device
DEV_NOWAIT	equ	$0005		! read from device without waiting
DEV_INP_STATUS	equ	$0006		! input status
DEV_INP_FLUSH	equ	$0007		! flush input buffers
DEV_OUTPUT	equ	$0008		! write to device
DEV_OUT_VERIFY	equ	$0009		! write to device with verify
DEV_OUT_STATUS	equ	$000A		! output status
DEV_OUT_FLUSH	equ	$000B		! flush output buffers
DEV_IOCTL_OUT	equ	$000C		! write to IOCTL control channel
DEV_OPEN	equ	$000D		! open device
DEV_CLOSE	equ	$000E		! close device
DEV_REMOVE	equ	$000F		! check for removable media
DEV_OUT_BUSY	equ	$0010		! output until busy


!
!**************************************************************************
!
! General request header for devices:
!
DEVREQ_LENGTH	equ	$0000		! length of device header
DEVREQ_SUBUNIT	equ	$0001		! number of device subunit
DEVREQ_COMMAND	equ	$0002		! command opcode
DEVREQ_STATUS	equ	$0003		! return result code
DEVREQ_SIZE	equ	$0004		! length of standard header

! Request header for device function 00 (initialize device):

DEV0_UNITS	equ	$000D		! number of subunits
DEV0_MEMAVAIL	equ	$000E		! far ptr past end of available memory
DEV0_FREE	equ	$000E		! far ptr to first free byte
DEV0_CMDLINE	equ	$0012		! far ptr to command line
DEV0_BPB	equ	$0012		! far ptr to BPB
DEV0_FIRST	equ	$0016		! drive number of first subunit
DEV0_LENGTH	equ	$0018		! length of request header

! Request header for device function 01 (media check):

DEV1_MEDIA	equ	$000D		! media descriptor
DEV1_STATUS	equ	$000E		! media status
DEV1_VOLUME	equ	$000F		! far ptr to volume ID
DEV1_LENGTH	equ	$0014		! length of request header

! Request header for device function 02 (build BPB):

DEV2_MEDIA	equ	$000D		! media descriptor
DEV2_TXADDR	equ	$000E		! far ptr to transfer address
DEV2_BPB	equ	$0012		! far ptr to BPB
DEV2_LENGTH	equ	$0016		! length of request header

! Request header for device functions 03 and 0C (read/write IOCTL channel):

DEV3_MEDIA	equ	$000D		! media descriptor
DEV3_TXADDR	equ	$000E		! transfer address
DEV3_BUFLEN	equ	$0012		! number of bytes to read/write
DEV3_LENGTH	equ	$0016		! length of request header

! Request header for device functions 04, 08 and 09 (read/write device):

DEV4_MEDIA	equ	$000D		! media descriptor
DEV4_TXADDR	equ	$000E		! transfer address
DEV4_COUNT	equ	$0012		! byte/sector count
DEV4_SECTOR	equ	$0014		! starting sector (block device)
DEV4_VOLUME	equ	$0016		! far ptr to volume ID
DEV4_SECT32	equ	$001A		! 32-bit starting sector number
DEV4_LENGTH	equ	$001D		! length of request header

! Request header for device function 05 (read character device without waiting):

DEV5_CHAR	equ	$000D		! character read
DEV5_LENGTH	equ	$000E		! length of request header

! Request header for device function 10 (write until busy):

DEV10_TXADDR	equ	$000E		! transfer address
DEV10_BUFLEN	equ	$0012		! number of bytes to write
DEV10_LENGTH	equ	$0016		! length of request header


!
!**************************************************************************
!
! Device driver error codes:
!
DEVERR_SUCCESS	equ	$0100		! success
DEVERR_PROTECT	equ	$8100		! write protect violation
DEVERR_UNKNOWN	equ	$8101		! unknown unit
DEVERR_NOTREADY	equ	$8102		! device not ready
DEVERR_COMMAND	equ	$8103		! unknown command
DEVERR_CRC	equ	$8104		! CRC error
DEVERR_LENGTH	equ	$8105		! bad driver request structure length
DEVERR_SEEK	equ	$8106		! seek error
DEVERR_MEDIA	equ	$8107		! unknown media type
DEVERR_SECTOR	equ	$8108		! sector not found
DEVERR_PAPER	equ	$8109		! printer out of paper
DEVERR_WRITE	equ	$810A		! write error
DEVERR_READ	equ	$810B		! read error
DEVERR_GENERAL	equ	$810C		! general error


!
!**************************************************************************
!
#endif



syntax highlighted by Code2HTML, v. 0.9.1