OSDN Git Service

[VM][Qt][UI][EMU][WIP] Use EMU_TEMPLATE:: instead of EMU:: . Some VMs are not apply...
[csp-qt/common_source_project-fm7.git] / source / src / vm / scsi_hdd.h
1 /*
2         Skelton for retropc emulator
3
4         Author : Takeda.Toshiya
5         Date   : 2016.03.01-
6
7         [ SCSI/SASI hard disk drive ]
8 */
9
10 #ifndef _SCSI_HDD_H_
11 #define _SCSI_HDD_H_
12
13 #include "scsi_dev.h"
14
15 class HARDDISK;
16
17 class SCSI_HDD : public SCSI_DEV
18 {
19 private:
20         HARDDISK* disk[8];
21         
22 //protected:
23 //      csp_state_utils *state_entry;
24
25         _TCHAR image_path[8][_MAX_PATH];
26         int sector_size[8];
27 public:
28         SCSI_HDD(VM_TEMPLATE* parent_vm, EMU_TEMPLATE* parent_emu) : SCSI_DEV(parent_vm, parent_emu) 
29         {
30                 for(int i = 0; i < 8; i++) {
31                         disk[i] = NULL;
32                         image_path[i][0] = _T('\0');
33                 }
34                 my_sprintf_s(vendor_id, 9, "NECITSU");
35                 my_sprintf_s(product_id, 17, "SCSI-HDD");
36                 device_type = 0x00;
37                 is_removable = is_hot_swappable = false;
38
39                 seek_time = 10000; // 10msec
40                 bytes_per_sec = 0x500000; // 5MB/sec
41                 
42 //              default_drive_size = 0x2800000; // 40MB
43                 set_device_name(_T("SCSI HDD"));
44         }
45         ~SCSI_HDD() {}
46         
47         // common functions
48         bool process_state(FILEIO* state_fio, bool loading);
49         
50         // virtual scsi functions
51         void release();
52         void reset();
53         bool is_device_existing();
54         uint32_t physical_block_size();
55         uint32_t logical_block_size();
56         uint32_t max_logical_block_addr();
57         bool read_buffer(int length);
58         bool write_buffer(int length);
59         
60         // unique functions
61         void set_disk_handler(int drv, HARDDISK* device)
62         {
63                 if(drv < 8) {
64                         disk[drv] = device;
65                 }
66         }
67         HARDDISK* get_disk_handler(int drv)
68         {
69                 if(drv < 8) {
70                         return disk[drv];
71                 }
72                 return NULL;
73         }
74         void open(int drv, const _TCHAR* file_path, int default_sector_size);
75         void close(int drv);
76         bool mounted(int drv);
77         bool accessed(int drv);
78
79         // virtual scsi functions
80         virtual void out_debug_log(const _TCHAR *format, ...);
81         virtual void start_command();
82 };
83
84 class SASI_HDD : public SCSI_HDD
85 {
86 public:
87         SASI_HDD(VM_TEMPLATE* parent_vm, EMU_TEMPLATE* parent_emu) : SCSI_HDD(parent_vm, parent_emu)
88         {
89                 set_device_name(_T("SASI Hard Disk Drive"));
90         }
91         ~SASI_HDD() {}
92         
93         // virtual scsi functions
94         virtual void out_debug_log(const _TCHAR *format, ...);
95         void start_command();
96 };
97
98 #endif
99