📄 device.h
字号:
/****************************************************************/
/* */
/* device.h */
/* Device Driver Header File */
/* */
/* November 20, 1991 */
/* */
/* Copyright (c) 1995 */
/* Pasquale J. Villani */
/* All Rights Reserved */
/* */
/* This file is part of DOS-C. */
/* */
/* DOS-C is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation; either version */
/* 2, or (at your option) any later version. */
/* */
/* DOS-C 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 DOS-C; see the file COPYING. If not, */
/* write to the Free Software Foundation, 675 Mass Ave, */
/* Cambridge, MA 02139, USA. */
/****************************************************************/
/* $Logfile: C:/dos-c/hdr/device.h_v $ */
#ifdef MAIN
# ifdef VERSION_STRINGS
static BYTE *device_hRcsId = "$Header: C:/dos-c/hdr/device.h_v 1.7 11 Jan 1998 2:05:54 patv $";
# endif
#endif
/* $Log: C:/dos-c/hdr/device.h_v $
*
* Rev 1.7 11 Jan 1998 2:05:54 patv
* Added functionality to ioctl.
*
* Rev 1.6 04 Jan 1998 23:14:20 patv
* Changed Log for strip utility
*
* Rev 1.5 16 Jan 1997 12:46:06 patv
* pre-Release 0.92 feature additions
*
* Rev 1.4 29 May 1996 21:25:12 patv
* bug fixes for v0.91a
*
* Rev 1.3 19 Feb 1996 3:15:30 patv
* Added NLS, int2f and config.sys processing
*
* Rev 1.2 01 Sep 1995 17:35:40 patv
* First GPL release.
*
* Rev 1.1 30 Jul 1995 20:43:48 patv
* Eliminated version strings in ipl
*
* Rev 1.0 02 Jul 1995 10:39:30 patv
* Initial revision.
*/
/* $EndLog$ */
/*
* Status Word Bits
*/
#define S_ERROR 0x8000 /* Error bit */
#define S_BUSY 0x0200 /* Device busy bit */
#define S_DONE 0x0100 /* Device operation completed */
#define S_MASK 0x00ff /* Mask to extract error code */
/*
* MEDIA Descriptor Byte Bits
*/
#define MD_2SIDE 1 /* MEDIA is two sided */
#define MD_8SECTOR 2 /* MEDIA is eight sectored */
#define MD_REMOVABLE 4 /* MEDIA is removable (floppy) */
/*
* Media Return Codes
*/
#define M_CHANGED -1 /* MEDIA was changed */
#define M_DONT_KNOW 0 /* MEDIA state unkown */
#define M_NOT_CHANGED 1 /* MEDIA was not changed */
/*
* Error Return Codes
*/
#define E_WRPRT 0 /* Write Protect */
#define E_UNIT 1 /* Unknown Unit */
#define E_NOTRDY 2 /* Device Not Ready */
#define E_CMD 3 /* Unknown Command */
#define E_CRC 4 /* Crc Error */
#define E_LENGTH 5 /* Bad Length */
#define E_SEEK 6 /* Seek Error */
#define E_MEDIA 7 /* Unknown MEDIA */
#define E_NOTFND 8 /* Sector Not Found */
#define E_PAPER 9 /* No Paper */
#define E_WRITE 10 /* Write Fault */
#define E_READ 11 /* Read Fault */
#define E_FAILURE 12 /* General Failure */
/*
* Command codes
*/
#define C_INIT 0x00 /* Initialize */
#define C_MEDIACHK 0x01 /* MEDIA Check */
#define C_BLDBPB 0x02 /* Build BPB */
#define C_IOCTLIN 0x03 /* Ioctl In */
#define C_INPUT 0x04 /* Input (Read) */
#define C_NDREAD 0x05 /* Non-destructive Read */
#define C_ISTAT 0x06 /* Input Status */
#define C_IFLUSH 0x07 /* Input Flush */
#define C_OUTPUT 0x08 /* Output (Write) */
#define C_OUTVFY 0x09 /* Output with verify */
#define C_OSTAT 0x0a /* Output */
#define C_OFLUSH 0x0b /* Output Flush */
#define C_IOCTLOUT 0x0c /* Ioctl Out */
#define C_OPEN 0x0d /* Device Open */
#define C_CLOSE 0x0e /* Device Close */
#define C_REMMEDIA 0x0f /* Removable MEDIA */
#define C_OUB 0x10 /* Output till busy */
#define C_GENIOCTL 0x13 /* Generic Ioctl */
#define C_GETLDEV 0x17 /* Get Logical Device */
#define C_SETLDEV 0x18 /* Set Logical Device */
#define C_IOCTLQRY 0x19 /* Ioctl Query */
/*
* Convienence macros
*/
#define failure(x) (S_ERROR+S_DONE+x)
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define mk_offset(far_ptr) ((UWORD)(far_ptr))
#define mk_segment(far_ptr) ((UWORD)((ULONG)(far_ptr) >> 16))
#define far_ptr(seg, off) ((VOID FAR *)(((ULONG)(off))+((ULONG)(seg) << 16)))
/*
* structures
*/
/* Device header */
struct dhdr
{
struct dhdr
FAR *dh_next;
UWORD dh_attr;
VOID (*dh_strategy)();
VOID (*dh_interrupt)();
BYTE dh_name[8];
};
#define ATTR_CHAR 0x8000
#define ATTR_IOCTL 0x4000
#define ATTR_EXCALLS 0x0800
#define ATTR_QRYIOCTL 0x0080
#define ATTR_GENIOCTL 0x0040
#define ATTR_RAW 0x0400
#define ATTR_FASTCON 0x0010
#define ATTR_CLOCK 0x0008
#define ATTR_NULL 0x0004
#define ATTR_STDOUT 0x0002
#define ATTR_STDIN 0x0001
/* */
/* Bios Parameter Block structure */
/* */
/* The following offsets are computed as byte offsets and are based on */
/* the struct below. The struct itself cannot be used because on some */
/* compilers, structure alignement may be forced, throwing following */
/* fields off (e.g. - BYTE, followed by a WORD may have a byte of fill */
/* inserted in between; the WORD would then be at offset 2, not 1). */
/* */
#define BPB_NBYTE 0
#define BPB_NSECTOR 2
#define BPB_NRESERVED 3
#define BPB_NFAT 5
#define BPB_NDIRENT 6
#define BPB_NSIZE 8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -