1 | #ifndef DISK_H
|
---|
2 | #define DISK_H
|
---|
3 |
|
---|
4 | #include "dev.h"
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Structure returned from disk_probe and passed to other driver
|
---|
8 | * functions.
|
---|
9 | */
|
---|
10 | struct disk
|
---|
11 | {
|
---|
12 | struct dev dev; /* This must come first */
|
---|
13 | int (*read)(struct disk *, sector_t sector);
|
---|
14 | unsigned int drive;
|
---|
15 | unsigned long hw_sector_size; /* The hardware sector size for dealing
|
---|
16 | * with partition tables and the like.
|
---|
17 | * Must be >= 512
|
---|
18 | */
|
---|
19 | unsigned int sectors_per_read; /* The number of 512 byte sectors
|
---|
20 | * returned by each read call.
|
---|
21 | * All I/O must be aligned to this size.
|
---|
22 | */
|
---|
23 | unsigned int bytes; /* The number of bytes in the read buffer. */
|
---|
24 | sector_t sectors; /* The number of sectors on the drive. */
|
---|
25 | sector_t sector; /* The first sector in the driver buffer */
|
---|
26 | unsigned char *buffer; /* The data read from the drive */
|
---|
27 | void *priv; /* driver can hang private data here */
|
---|
28 |
|
---|
29 | unsigned long disk_offset;
|
---|
30 | int direction;
|
---|
31 | };
|
---|
32 |
|
---|
33 | extern struct disk disk;
|
---|
34 | extern int url_file(const char *name,
|
---|
35 | int (*fnc)(unsigned char *, unsigned int, unsigned int, int));
|
---|
36 |
|
---|
37 | extern int disk_probe(struct dev *dev);
|
---|
38 | extern int disk_load_configuration(struct dev *dev);
|
---|
39 | extern int disk_load(struct dev *dev);
|
---|
40 | extern void disk_disable(void);
|
---|
41 |
|
---|
42 |
|
---|
43 | #ifndef DOWNLOAD_PROTO_DISK
|
---|
44 | #define disk_disable() do { } while(0)
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | #define SECTOR_SIZE 512
|
---|
48 | #define SECTOR_SHIFT 9
|
---|
49 |
|
---|
50 | /* Maximum block_size that may be set. */
|
---|
51 | #define DISK_BUFFER_SIZE (18 * SECTOR_SIZE)
|
---|
52 |
|
---|
53 | #endif /* DISK_H */
|
---|