-
Notifications
You must be signed in to change notification settings - Fork 3
/
device.h
124 lines (113 loc) · 3.25 KB
/
device.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// SPDX-License-Identifier: GPL-2.0-only
/* This file is part of lide.device
* Copyright (C) 2023 Matthew Harlum <[email protected]>
*/
#ifndef _DEVICE_H
#define _DEVICE_H
#include <dos/filehandler.h>
#include <exec/semaphores.h>
#include <stdbool.h>
#define OAHR_MANUF_ID 5194
#define BSC_MANUF_ID 2092
#define A1K_MANUF_ID 2588
#define RIPPLE_PROD_ID 7
#define MAX_UNITS 4
enum xfer {
longword_movem,
longword_move
};
/**
* Drive struct
*
*/
struct Drive {
volatile UWORD *data;
volatile UBYTE *error_features;
volatile UBYTE *sectorCount;
volatile UBYTE *lbaLow;
volatile UBYTE *lbaMid;
volatile UBYTE *lbaHigh;
volatile UBYTE *devHead;
volatile UBYTE *status_command;
};
struct IDEUnit {
struct MinNode mn_Node;
struct Unit io_unit;
struct ConfigDev *cd;
struct ExecBase *SysBase;
struct IDETask *itask;
struct Drive drive;
BYTE (*write_taskfile)(struct IDEUnit *, UBYTE, ULONG, UBYTE, UBYTE);
enum xfer xferMethod;
void (*read_fast)(void *, void *);
void (*write_fast)(void *, void *);
void (*read_unaligned)(void *, void *);
void (*write_unaligned)(void *, void *);
volatile UBYTE *shadowDevHead;
volatile void *changeInt;
volatile bool deferTUR;
UBYTE unitNum;
UBYTE channel;
UBYTE deviceType;
UBYTE last_error[6];
bool primary;
bool present;
bool atapi;
bool mediumPresent;
bool mediumPresentPrev;
bool xferMultiple;
bool lba;
bool lba48;
UWORD openCount;
UWORD changeCount;
UWORD heads;
UWORD sectorsPerTrack;
UWORD blockSize;
UWORD blockShift;
ULONG cylinders;
ULONG logicalSectors;
struct MinList changeInts;
UBYTE multipleCount;
};
struct DeviceBase {
struct Library lib;
struct ExecBase *SysBase;
struct Library *ExpansionBase;
struct Task *ChangeTask;
BPTR saved_seg_list;
bool isOpen;
ULONG numUnits;
ULONG highestUnit;
UBYTE numTasks;
struct MinList units;
struct SignalSemaphore ulSem;
struct MinList ideTasks;
};
struct IDETask {
struct MinNode mn_Node;
struct Task *task;
struct Task *parent;
struct DeviceBase *dev;
struct ConfigDev *cd;
struct MsgPort *iomp;
struct MsgPort *timermp;
struct timerequest *tr;
volatile bool active;
UBYTE shadowDevHead;
UBYTE boardNum;
UBYTE taskNum;
UBYTE channel;
};
#define STR(s) #s /* Turn s into a string literal without expanding macro definitions (however, \
if invoked from a macro, macro arguments are expanded). */
#define XSTR(s) STR(s) /* Turn s into a string literal after macro-expanding it. */
#ifndef LIDE_IS_SCSI
#define DEVICE_NAME " lide.device"
#else
#define DEVICE_NAME " scsi.device"
#endif
#define DEVICE_ID_STRING "lide " XSTR(DEVICE_VERSION) "." XSTR(DEVICE_REVISION) " (" XSTR(BUILD_DATE) ") " XSTR(GIT_REF)
#define DEVICE_VERSION 40
#define DEVICE_REVISION 9
#define DEVICE_PRIORITY 0 /* Most people will not need a priority and should leave it at zero. */
#endif