-
Notifications
You must be signed in to change notification settings - Fork 4
/
device.h
131 lines (103 loc) · 3.85 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
125
126
127
128
129
130
131
/*
* SCSI DaynaPORT Device (scsidayna.device) by RobSmithDev
*
* based LARGELY on the MNT ZZ9000 Network Driver
* Copyright (C) 2016-2019, Lukas F. Hartmann <[email protected]>
* MNT Research GmbH, Berlin
* https://mntre.com
* Copyright (C) 2018 Henryk Richter <[email protected]>
*
* SPDX-License-Identifier: GPL-3.0-or-later
* GNU General Public License v3.0 or later
*
* https://spdx.org/licenses/GPL-3.0-or-later.html
*/
/*
device.h
(C) 2018 Henryk Richter <[email protected]>
Device Functions and Definitions
*/
#ifndef _INC_DEVICE_H
#define _INC_DEVICE_H
/* includes */
#include "compiler.h"
#include <dos/dos.h>
#include <exec/lists.h>
#include <exec/libraries.h>
#include <exec/devices.h>
#include <exec/semaphores.h>
#include "debug.h"
#include "sana2.h"
/* reassign Library bases from global definitions to own struct */
#define SysBase db->db_SysBase
#define DOSBase db->db_DOSBase
#define UtilityBase db->db_UtilityBase
struct DevUnit {
/* HW Data (generic for now) (example only, unused in construct)*/
ULONG du_hwl0;
ULONG du_hwl1;
ULONG du_hwl2;
APTR du_hwp0;
APTR du_hwp1;
APTR du_hwp2;
};
struct devbase {
struct Library db_Lib;
BPTR db_SegList; /* from Device Init */
struct Library *db_SysBase; /* Exec Base */
struct Library *db_DOSBase;
struct Library *db_UtilityBase;
struct Sana2DeviceStats db_DevStats;
volatile USHORT db_online;
volatile USHORT db_currentWifiState; // the *actual* online state
// SCSI device (in the main task)
void* db_scsiSettings; // A pointer to a ScsiDaynaSettings struct
USHORT db_scsiDeviceID; // The device ID that should be used going forward (auto-detect)
USHORT db_scsiMode; // Scsi mode
struct List db_ReadList;
struct SignalSemaphore db_ReadListSem;
struct List db_WriteList;
struct SignalSemaphore db_WriteListSem;
struct List db_EventList;
struct SignalSemaphore db_EventListSem;
struct List db_ReadOrphanList;
struct SignalSemaphore db_ReadOrphanListSem;
struct Process* db_Proc;
struct SignalSemaphore db_ProcExitSem;
};
#ifndef DEVBASETYPE
#define DEVBASETYPE struct devbase
#endif
#ifndef DEVBASEP
#define DEVBASEP DEVBASETYPE *db
#endif
/* PROTOS */
ASM LONG LibNull( void );
ASM SAVEDS struct Device *DevInit(ASMR(d0) DEVBASEP ASMREG(d0),
ASMR(a0) BPTR seglist ASMREG(a0),
ASMR(a6) struct Library *_SysBase ASMREG(a6) );
ASM SAVEDS LONG DevOpen( ASMR(a1) struct IOSana2Req *ios2 ASMREG(a1),
ASMR(d0) ULONG unit ASMREG(d0),
ASMR(d1) ULONG flags ASMREG(d1),
ASMR(a6) DEVBASEP ASMREG(a6) );
ASM SAVEDS BPTR DevClose( ASMR(a1) struct IORequest *ios2 ASMREG(a1),
ASMR(a6) DEVBASEP ASMREG(a6) );
ASM SAVEDS BPTR DevExpunge( ASMR(a6) DEVBASEP ASMREG(a6) );
ASM SAVEDS VOID DevBeginIO( ASMR(a1) struct IOSana2Req *ios2 ASMREG(a1),
ASMR(a6) DEVBASEP ASMREG(a6) );
ASM SAVEDS LONG DevAbortIO( ASMR(a1) struct IORequest *ios2 ASMREG(a1),
ASMR(a6) DEVBASEP ASMREG(a6) );
void DevTermIO( DEVBASETYPE*, struct IORequest * );
/* private functions */
#ifdef DEVICE_MAIN
#endif /* DEVICE_MAIN */
#define HW_ADDRFIELDSIZE 6
#define HW_ETH_HDR_SIZE 14 /* ethernet header: dst, src, type */
typedef BOOL (*BMFunc)(__reg("a0") void* a, __reg("a1") void* b, __reg("d0") long c);
typedef struct BufferManagement
{
struct MinNode bm_Node;
BMFunc bm_CopyFromBuffer;
BMFunc bm_CopyToBuffer;
} BufferManagement;
#endif /* _INC_DEVICE_H */