1 /* 2 * xhdi.h - XHDI like disk driver interface - declaration 3 * 4 * Copyright (c) 2002-2008 Petr Stehlik of ARAnyM dev team (see AUTHORS) 5 * 6 * This file is part of the ARAnyM project which builds a new and powerful 7 * TOS/FreeMiNT compatible virtual machine running on almost any hardware. 8 * 9 * ARAnyM is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * ARAnyM is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with ARAnyM; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #ifndef _XHDI_H 25 #define _XHDI_H 26 #include "nf_base.h" 27 #include "parameters.h" 28 29 #define ACSI_START 0 30 #define ACSI_END 7 31 #define SCSI_START 8 32 #define SCSI_END 15 33 #define IDE_START 16 34 #define IDE_END 17 35 36 typedef memptr wmemptr; 37 typedef memptr lmemptr; 38 39 struct disk_t { 40 char path[512]; 41 char name[41]; 42 bool present; 43 bool readonly; 44 bool byteswap; 45 bool sim_root; // true if the disk has to simulate root sector 46 char partID[3]; // partition ID - not used for real harddisks 47 int size_blocks; // partition size in blocks - not used for real harddisks 48 FILE *file; 49 }; 50 51 class XHDIDriver : public NF_Base 52 { 53 private: 54 disk_t disks[IDE_END+1]; // ACSI + SCSI + IDE 55 56 private: 57 void copy_atadevice_settings(const bx_atadevice_options_t *src, disk_t *dest); 58 void copy_scsidevice_settings(int index, const bx_scsidevice_options_t *src, disk_t *dest); 59 disk_t *dev2disk(uint16 major, uint16 minor); 60 void byteSwapBuf(uint8 *buf, int size); 61 bool setDiskSizeInBlocks(disk_t *disk); 62 void init_disks(void); 63 void close_disks(void); 64 65 protected: 66 int32 XHDrvMap(); 67 int32 XHInqDriver(uint16 bios_device, memptr name, memptr version, 68 memptr company, wmemptr ahdi_version, wmemptr maxIPL); 69 int32 XHReadWrite(uint16 major, uint16 minor, uint16 rwflag, 70 uint32 recno, uint16 count, memptr buf); 71 int32 XHInqTarget2(uint16 major, uint16 minor, lmemptr blocksize, 72 lmemptr device_flags, memptr product_name, uint16 stringlen); 73 int32 XHInqDev2(uint16 bios_device, wmemptr major, wmemptr minor, 74 lmemptr start_sector, memptr bpb, lmemptr blocks, 75 memptr partid); 76 int32 XHGetCapacity(uint16 major, uint16 minor, 77 lmemptr blocks, lmemptr blocksize); 78 79 public: 80 XHDIDriver(); 81 ~XHDIDriver(); 82 void reset(); name()83 const char *name() { return "XHDI"; } isSuperOnly()84 bool isSuperOnly() { return true; } 85 int32 dispatch(uint32 fncode); 86 }; 87 88 #endif /* _XHDI_H */ 89 90 /* 91 vim:ts=4:sw=4: 92 */ 93