File: dat.h

package info (click to toggle)
vblade 11-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 144 kB
  • ctags: 141
  • sloc: ansic: 831; makefile: 57; sh: 6
file content (122 lines) | stat: -rw-r--r-- 1,635 bytes parent folder | download
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
/* dat.h: include file for vblade AoE target */

#define	nil	((void *)0)
/*
 *	tunable variables
 */

enum {
	VBLADE_VERSION		= 11,

	// Firmware version
	FWV			= 0x4000 + VBLADE_VERSION,
};

#undef major
#undef minor
#undef makedev

#define	major(x)		((x) >> 24 & 0xFF)
#define	minor(x)		((x) & 0xffffff)
#define	makedev(x, y)	((x) << 24 | (y))

typedef unsigned char uchar;
//typedef unsigned short ushort;
#ifdef __FreeBSD__
typedef unsigned long ulong;
#else
//typedef unsigned long ulong;
#endif
typedef long long vlong;

typedef struct Aoehdr Aoehdr;
typedef struct Ata Ata;
typedef struct Conf Conf;
typedef struct Ataregs Ataregs;


struct Ataregs
{
	vlong	lba;
	uchar	cmd;
	uchar	status;
	uchar	err;
	uchar	feature;
	uchar	sectors;
};

struct Aoehdr
{
	uchar	dst[6];
	uchar	src[6];
	ushort	type;
	uchar	flags;
	uchar	error;
	ushort	maj;
	uchar	min;
	uchar	cmd;
	uchar	tag[4];
};

struct Ata
{
	Aoehdr	h;
	uchar	aflag;
	uchar	err;
	uchar	sectors;
	uchar	cmd;
	uchar	lba[6];
	uchar	resvd[2];
	uchar	data[1024];
};

struct Conf
{
	Aoehdr	h;
	ushort	bufcnt;
	ushort	firmware;
	uchar	filler;
	uchar	vercmd;
	ushort	len;
	uchar	data[1024];
};


enum {
	AoEver = 1,

	ATAcmd = 0,		// command codes
	Config,

	Resp = (1<<3),		// flags
	Error = (1<<2),

	BadCmd = 1,
	BadArg,
	DevUnavailable,
	ConfigErr,
	BadVersion,

	Write = (1<<0),
	Async = (1<<1),
	Device = (1<<4),
	Extend = (1<<6),

	Qread = 0,
	Qtest,
	Qprefix,
	Qset,
	Qfset,

	Nretries = 3,

	Bufcount = 32,
};

int	shelf, slot;
ulong	aoetag;
uchar	mac[6];
int	bfd;		// block file descriptor
int	sfd;		// socket file descriptor
vlong	size;		// size of vblade
char	*progname;