1 |
/* |
2 |
* PearPC |
3 |
* ata.h |
4 |
* |
5 |
* Copyright (C) 2003 Sebastian Biallas (sb@biallas.net) |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License version 2 as |
9 |
* published by the Free Software Foundation. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
#ifndef __ATA_H__ |
22 |
#define __ATA_H__ |
23 |
|
24 |
#include "system/file.h" |
25 |
#include "idedevice.h" |
26 |
|
27 |
// Flags for IDEDevice::mMode |
28 |
#define ATA_DEVICE_MODE_PLAIN 0 // just a 512 byte sector |
29 |
#define ATA_DEVICE_MODE_ECC 1 // add 4 byte ECC |
30 |
|
31 |
class ATADevice: public IDEDevice { |
32 |
public: |
33 |
int mCyl; |
34 |
int mHeads; |
35 |
int mSpt; |
36 |
uint blocks; |
37 |
|
38 |
ATADevice(const char *name); |
39 |
virtual ~ATADevice(); |
40 |
void init(int aHeads, int aCyl, int mSpt); |
41 |
virtual uint getBlockSize(); |
42 |
virtual uint getBlockCount(); |
43 |
}; |
44 |
|
45 |
class ATADeviceFile: public ATADevice { |
46 |
SYS_FILE *mFile; |
47 |
public: |
48 |
ATADeviceFile(const char *name, const char *filename); |
49 |
virtual ~ATADeviceFile(); |
50 |
|
51 |
virtual bool seek(uint64 blockno); |
52 |
virtual void flush(); |
53 |
virtual int readBlock(byte *buf); |
54 |
virtual int writeBlock(byte *buf); |
55 |
|
56 |
virtual bool promSeek(uint64 pos); |
57 |
virtual uint promRead(byte *buf, uint size); |
58 |
}; |
59 |
|
60 |
#endif |