Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
/*
 *	dos.h
 *	Human68k DOS call interface
 *
 *	written by ITOH Yasufumi
 *	(based on PD libc 1.1.32 by PROJECT C Library)
 *	public domain
 *
 *	$NetBSD: dos.h,v 1.8 2011/02/21 02:31:59 itohy Exp $
 */
/*
 * PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
 * --------------------------------------------------------------------
 * This file is written by the Project C Library Group,  and completely
 * in public domain. You can freely use, copy, modify, and redistribute
 * the whole contents, without this notice.
 * --------------------------------------------------------------------
 * Id: dos.h,v 1.6 1994/07/27 13:44:11 mura Exp
 * Id: dos_p.h,v 1.3 1993/10/06 16:46:07 mura Exp
 */

#ifndef __X68K_DOS_H__
#define __X68K_DOS_H__

#include <sys/cdefs.h>

typedef int	dos_mode_t;

struct dos_inpptr {
	unsigned char	max;
	unsigned char	length;
	char		buffer[256];
};

struct dos_nameckbuf {
	char	drive[2];
	char	path[65];
	char	name[19];
	char	ext[5];
};

union dos_fcb {
	struct {
		unsigned char	dupcnt;
		unsigned char	devattr;
		void		*deventry;
		char		nouse_1[8];
		unsigned char	openmode;
		char		nouse_2[21];
		char		name1[8];
		char		ext[3];
		char		nouse_3;
		char		name2[10];
		char		nouse_4[38];
	} __attribute__((__packed__)) chr;
	struct {
		unsigned char	dupcnt;
		unsigned	mode	: 1;
		unsigned	unknown : 2;
		unsigned	physdrv : 5;
		void		*deventry;
		unsigned int	fileptr;
		unsigned int	exclptr;
		unsigned char	openmode;
		unsigned char	entryidx;
		unsigned char	clustidx;
		char		nouse_2;
		unsigned short	acluster;
		unsigned int	asector;
		void		*iobuf;
		unsigned long	dirsec;
		unsigned int	fptrmax;
		char		name1[8];
		char		ext[3];
		unsigned char	attr;
		char		name2[10];
		unsigned short	time;
		unsigned short	date;
		unsigned short	fatno;
		unsigned long	size;
		char		nouse_4[28];
	} __attribute__((__packed__)) blk;
};

struct dos_indos {
	unsigned short	indosf;
	unsigned char	doscmd;
	unsigned char	fat_flg;
	unsigned short	retry_count;
	unsigned short	retry_time;
	unsigned short	verifyf;
	unsigned char	breakf;
	unsigned char	ctrlpf;
	unsigned char	reserved;
	unsigned char	wkcurdrv;
};

struct dos_mep {
	void	*prev_mp;
	void	*parent_mp;
	void	*block_end;
	void	*next_mp;
};

struct dos_psp {
	char		*env;
	void		*exit;
	void		*ctrlc;
	void		*errexit;
	char		*comline;
	unsigned char	handle[12];
	void		*bss;
	void		*heap;
	void		*stack;
	void		*usp;
	void		*ssp;
	unsigned short	sr;
	unsigned short	abort_sr;
	void		*abort_ssp;
	void		*trap10;
	void		*trap11;
	void		*trap12;
	void		*trap13;
	void		*trap14;
	unsigned int	osflg;
	unsigned char	reserve_1[28];
	char		exe_path[68];
	char		exe_name[24];
	char		reserve_2[36];
};

struct dos_comline {
	unsigned char	len;
	char		buffer[255];
};

struct dos_namestbuf {
	unsigned char	flg;
	unsigned char	drive;
	char		path[65];
	char		name1[8];
	char		ext[3];
	char		name2[10];
};

struct dos_freeinf {
	unsigned short	free;
	unsigned short	max;
	unsigned short	sec;
	unsigned short	byte;
};

struct dos_dpbptr {
	unsigned char	drive;
	unsigned char	unit;
	unsigned short	byte;
	unsigned char	sec;
	unsigned char	shift;
	unsigned short	fatsec;
	unsigned char	fatcount;
	unsigned char	fatlen;
	unsigned short	dircount;
	unsigned short	datasec;
	unsigned short	maxfat;
	unsigned short	dirsec;
	int		driver;
	unsigned char	ide;
	unsigned char	flg;
	struct dos_dpbptr *next;
	unsigned short	dirfat;
	char		dirbuf[64];
} __attribute__((__packed__));

struct dos_filbuf {
	unsigned char	searchatr;
	unsigned char	driveno;
	unsigned long	dirsec;
	unsigned short	dirlft;
	unsigned short	dirpos;
	char		filename[8];
	char		ext[3];
	unsigned char	atr;
	unsigned short	time;
	unsigned short	date;
	unsigned int	filelen;
	char		name[23];
} __attribute__((__packed__));

struct dos_exfilbuf {
	unsigned char	searchatr;
	unsigned char	driveno;
	unsigned long	dirsec;
	unsigned short	dirlft;
	unsigned short	dirpos;
	char		filename[8];
	char		ext[3];
	unsigned char	atr;
	unsigned short	time;
	unsigned short	date;
	unsigned int	filelen;
	char		name[23];
	char		drive[2];
	char		path[65];
	char		unused[21];
} __attribute__((__packed__));

struct dos_dregs {
	int	d0;
	int	d1;
	int	d2;
	int	d3;
	int	d4;
	int	d5;
	int	d6;
	int	d7;
	int	a0;
	int	a1;
	int	a2;
	int	a3;
	int	a4;
	int	a5;
	int	a6;
};

struct dos_prcctrl {
	long		length;
	unsigned char	*buf_ptr;
	unsigned short	command;
	unsigned short	your_id;
};

struct dos_prcptr {
	struct dos_prcptr *next_ptr;
	unsigned char	wait_flg;
	unsigned char	counter;
	unsigned char	max_counter;
	unsigned char	doscmd;
	unsigned int	psp_id;
	unsigned int	usp_reg;
	unsigned int	d_reg[8];
	unsigned int	a_reg[7];
	unsigned short	sr_reg;
	unsigned int	pc_reg;
	unsigned int	ssp_reg;
	unsigned short	indosf;
	unsigned int	indosp;
	struct dos_prcctrl *buf_ptr;
	unsigned char	name[16];
	long		wait_time;
} __attribute__((__packed__));

/*
 * arguments:
 *	l		32bit arg -> 32bit DOS arg
 *	w		32bit arg -> lower 16bit DOS arg
 *	lb31		32bit arg -> 32bit (arg | 0x80000000) DOS arg
 *	wb8		32bit arg -> 16bit (arg | 0x100) DOS arg
 *	wb15		32bit arg -> 16bit (arg | 0x8000) DOS arg
 *	(num).l		(no C arg)-> 32bit (num) DOS arg
 *	(num).w		(no C arg)-> 16bit (num) DOS arg
 *	drvctrl		special arg for DOS_DRVCTRL
 *	super		special arg for DOS_SUPER
 * opts:
 *	e		d0 < 0  is an error code
 *	estrct		d0 > 0xffffff00  (unsigned) is an error code
 *	ealloc		error handling of memory allocation
 *	ep		error handling of process operation
 *	sv		save and restore  d2-d7/a2-a6
 *	noret		the DOS call never returns
 *	alias NAME	specify another entry name
 *	super		special for DOS_SUPER
 *	super_jsr	special for DOS_SUPER_JSR
 */

/* ff00 ; noret */	__dead void DOS_EXIT (void);
/* ff01 */		int DOS_GETCHAR (void);
/* ff02 w */		void DOS_PUTCHAR (int);
/* ff03 */		int DOS_COMINP (void);
/* ff04 w */		void DOS_COMOUT (int);
/* ff05 w */		void DOS_PRNOUT (int);
/* ff06 w */		int DOS_INPOUT (int);
/* ff07 */		int DOS_INKEY (void);
/* ff08 */		int DOS_GETC (void);
/* ff09 l */		void DOS_PRINT (const char *);
/* ff0a l */		int DOS_GETS (struct dos_inpptr *);
/* ff0b */		int DOS_KEYSNS (void);
/* ff0c 1.w */		int DOS_KFLUSHGP (void);
/* ff0c 6.w w */	int DOS_KFLUSHIO (int);
/* ff0c 7.w */		int DOS_KFLUSHIN (void);
/* ff0c 8.w */		int DOS_KFLUSHGC (void);
/* ff0c 10.w l */	int DOS_KFLUSHGS (struct dos_inpptr *);
/* ff0d */		void DOS_FFLUSH (void);
/* ff0e w */		int DOS_CHGDRV (int);
/* ff0f drvctrl */	int DOS_DRVCTRL (int, int);
/* ff10 */		int DOS_CONSNS (void);
/* ff11 */		int DOS_PRNSNS (void);
/* ff12 */		int DOS_CINSNS (void);
/* ff13 */		int DOS_COUTSNS (void);
/* ff17 l l ; e */	int DOS_FATCHK (const char *, unsigned short *);
/* ff17 l lb31 w ; e */	int DOS_FATCHK2 (const char *, unsigned short *, int);
/* ff18 0.w */		int DOS_HENDSPMO (void);
/* ff18 1.w w l */	int DOS_HENDSPMP (int, const char *);
/* ff18 2.w w l */	int DOS_HENDSPMR (int, const char *);
/* ff18 3.w */		void DOS_HENDSPMC (void);
/* ff18 4.w */		int DOS_HENDSPIO (void);
/* ff18 5.w w l */	int DOS_HENDSPIP (int, const char *);
/* ff18 6.w w l */	int DOS_HENDSPIR (int, const char *);
/* ff18 7.w w */	void DOS_HENDSPIC (int);
/* ff18 8.w */		int DOS_HENDSPSO (void);
/* ff18 9.w w l */	int DOS_HENDSPSP (int, const char *);
/* ff18 10.w w l */	int DOS_HENDSPSR (int, const char *);
/* ff18 11.w */		void DOS_HENDSPSC (void);
/* ff19 */		int DOS_CURDRV (void);
/* ff1a l */		int DOS_GETSS (struct dos_inpptr *);
/* ff1b w */		int DOS_FGETC (int);
/* ff1c l w */		int DOS_FGETS (struct dos_inpptr *, int);
/* ff1d w w */		void DOS_FPUTC (int, int);
/* ff1e l w */		void DOS_FPUTS (const char *, int);
/* ff1f */		void DOS_ALLCLOSE (void);
/* ff20 super ; super e */	int DOS_SUPER (int);
/* ff21 w l ; e */	void DOS_FNCKEYGT (int, char *);
/* ff21 wb8 l ; e */	void DOS_FNCKEYST (int, const char *);
/* ff23 0.w w */	int DOS_C_PUTC (int);
/* ff23 1.w l */	int DOS_C_PRINT (const char *);
/* ff23 2.w w */	int DOS_C_COLOR (int);
/* ff23 3.w w w */	int DOS_C_LOCATE (int, int);
/* ff23 4.w */		int DOS_C_DOWN_S (void);
/* ff23 5.w */		int DOS_C_UP_S (void);
/* ff23 6.w w */	int DOS_C_UP (int);
/* ff23 7.w w */	int DOS_C_DOWN (int);
/* ff23 8.w w */	int DOS_C_RIGHT (int);
/* ff23 9.w w */	int DOS_C_LEFT (int);
/* ff23 10.w 0.w */	int DOS_C_CLS_ED (void);
/* ff23 10.w 1.w */	int DOS_C_CLS_ST (void);
/* ff23 10.w 2.w */	int DOS_C_CLS_AL (void);
/* ff23 11.w 0.w */	int DOS_C_ERA_ED (void);
/* ff23 11.w 1.w */	int DOS_C_ERA_ST (void);
/* ff23 11.w 2.w */	int DOS_C_ERA_AL (void);
/* ff23 12.w w */	int DOS_C_INS (int);
/* ff23 13.w w */	int DOS_C_DEL (int);
/* ff23 14.w w */	int DOS_C_FNKMOD (int);
/* ff23 15.w w w */	int DOS_C_WINDOW (int, int);
/* ff23 16.w w */	int DOS_C_WIDTH (int);
/* ff23 17.w */		int DOS_C_CURON (void);
/* ff23 18.w */		int DOS_C_CUROFF (void);
/* ff24 0.w */		int DOS_K_KEYINP (void);
/* ff24 1.w */		int DOS_K_KEYSNS (void);
/* ff24 2.w */		int DOS_K_SFTSNS (void);
/* ff24 3.w w */	int DOS_K_KEYBIT (int);
/* ff24 4.w w */	void DOS_K_INSMOD (int);
/* ff25 w l */		void *DOS_INTVCS (int, void *);
/* ff26 l */		void DOS_PSPSET (struct dos_psp *);
/* ff27 */		int DOS_GETTIM2 (void);
/* ff28 l ; e */	int DOS_SETTIM2 (int);
/* ff29 l l ; e */	int DOS_NAMESTS (const char *, struct dos_namestbuf *);
/* ff2a */		int DOS_GETDATE (void);
/* ff2b w ; e */	int DOS_SETDATE (int);
/* ff2c */		int DOS_GETTIME (void);
/* ff2d w ; e */	int DOS_SETTIME (int);
/* ff2e w */		void DOS_VERIFY (int);
/* ff2f w w ; e */	int DOS_DUP0 (int, int);
/* ff30 */		int __pure DOS_VERNUM (void);
/* ff31 l w ; noret */	__dead void DOS_KEEPPR (int, int);
/* ff32 w l ; e */	int DOS_GETDPB (int, struct dos_dpbptr *);
/* ff33 w */		int DOS_BREAKCK (int);
/* ff34 w w ; e */	void DOS_DRVXCHG (int, int);
/* ff35 w */		void *DOS_INTVCG (int);
/* ff36 w l ; estrct */	int DOS_DSKFRE (int, struct dos_freeinf *);
/* ff37 l l ; e */	int DOS_NAMECK (const char *, struct dos_nameckbuf *);
/* ff39 l ; e */	int DOS_MKDIR (const char *);
/* ff3a l ; e */	int DOS_RMDIR (const char *);
/* ff3b l ; e */	int DOS_CHDIR (const char *);
/* ff3c l w ; e */	int DOS_CREATE (const char *, dos_mode_t);
/* ff3d l w ; e */	int DOS_OPEN (const char *, int);
/* ff3e w ; e */	int DOS_CLOSE (int);
/* ff3f w l l ; e */	int DOS_READ (int, char *, int);
/* ff40 w l l ; e */	int DOS_WRITE (int, const char *, int);
/* ff41 l ; e */	int DOS_DELETE (const char *);
/* ff42 w l w ; e */	long DOS_SEEK (int, int, int);
/* ff43 l w ; e */	dos_mode_t DOS_CHMOD (const char *, dos_mode_t);
/* ff44 0.w w ; e */	int DOS_IOCTRLGT (int);
/* ff44 1.w w w ; e */	int DOS_IOCTRLST (int, int);
/* ff44 2.w w l l ; e */	int DOS_IOCTRLRH (int, char *, int);
/* ff44 3.w w l l ; e */	int DOS_IOCTRLWH (int, const char *, int);
/* ff44 4.w w l l ; e */	int DOS_IOCTRLRD (int, char *, int);
/* ff44 5.w w l l ; e */	int DOS_IOCTRLWD (int, const char *, int);
/* ff44 6.w w ; e */	int DOS_IOCTRLIS (int);
/* ff44 7.w w ; e */	int DOS_IOCTRLOS (int);
/* ff44 9.w w ; e */	int DOS_IOCTRLDVGT (int);
/* ff44 10.w w ; e */	int DOS_IOCTRLFDGT (int);
/* ff44 11.w w w ; e */	int DOS_IOCTRLRTSET (int, int);
/* ff44 12.w w w l ; e */	int DOS_IOCTRLDVCTL (int, int, char *);
/* ff44 13.w w w l ; e */	int DOS_IOCTRLFDCTL (int, int, char *);
/* ff45 w ; e */	int DOS_DUP (int);
/* ff46 w w ; e */	int DOS_DUP2 (int, int);
/* ff47 w l ; e */	int DOS_CURDIR (int, char *);
/* ff48 l ; ealloc */	void *DOS_MALLOC (int);
/* ff49 l ; e */	int DOS_MFREE (void *);
/* ff4a l l ; ealloc */	int DOS_SETBLOCK (void *, int);
/* ff4b 0.w l l l ; sv e */	int DOS_LOADEXEC (const char *, const struct dos_comline *, const char *);
/* ff4b 1.w l l l ; sv e */	int DOS_LOAD (const char *, const struct dos_comline *, const char *);
/* ff4b 2.w l l l ; e */	int DOS_PATHCHK (const char *, const struct dos_comline *, const char *);
/* ff4b 3.w l l l ; e */	int DOS_LOADONLY (const char *, const void *, const void *);
/* ff4b 4.w l ; sv e */		int DOS_EXECONLY (void *);
/* ff4b 5.w l l 0.l ; sv e */	int DOS_BINDNO (const char *, const char *);
		/*^ 0.l is required?? */
/* ff4b w l l l ; sv e */	int DOS_EXEC2 (int, const char *, const char *, const char *);
/* ff4c w ; noret */	__dead void DOS_EXIT2 (int);
/* ff4d */		int DOS_WAIT (void);
/* ff4e l l w ; e */	int DOS_FILES (struct dos_filbuf *, const char *, int);
/* ff4e lb31 l w ; e */	int DOS_EXFILES (struct dos_exfilbuf *, const char *, int);
/* ff4f l ; e */	int DOS_NFILES (struct dos_filbuf *);
/* ff4f lb31 ; e */	int DOS_EXNFILES (struct dos_exfilbuf *);
/* ff80 l */		struct dos_psp *DOS_SETPDB (struct dos_psp *);
/* ff81 */		struct dos_psp *DOS_GETPDB (void);
/* ff82 l l l ; e */	int DOS_SETENV (const char *, const char *, const char *);
/* ff83 l l l ; e */	int DOS_GETENV (const char *, const char *, char *);
/* ff84 */		int DOS_VERIFYG (void);
/* ff85 0.w l ; e */		int DOS_COMMON_CK (const char *);
/* ff85 1.w l l l l ; e */	int DOS_COMMON_RD (const char *, int, char *, int);
/* ff85 2.w l l l l ; e */	int DOS_COMMON_WT (const char *, int, const char *, int);
/* ff85 3.w l l l l ; e */	int DOS_COMMON_LK (const char *, int, int, int);
/* ff85 4.w l l l l ; e */	int DOS_COMMON_FRE (const char *, int, int, int);
/* ff85 5.w l ; e */		int DOS_COMMON_DEL (const char *);
/* ff86 l l ; e */	int DOS_MOVE (const char *, const char *);
			int DOS_RENAME (const char *, const char *);
/* ff87 w l ; estrct */	int DOS_FILEDATE (int, int);
/* ff88 w l ; ealloc */	void *DOS_MALLOC2 (int, int);
/* ff88 wb15 l l ; ealloc */	void *DOS_MALLOC0 (int, int, int);
/* ff8a l w ; e */	int DOS_MAKETMP (const char *, int);
/* ff8b l w ; e */	int DOS_NEWFILE (const char *, dos_mode_t);
/* ff8c 0.w w l l ; e */	int DOS_LOCK (int, int, int);
/* ff8c 1.w w l l ; e */	int DOS_UNLOCK (int, int, int);
/* ff8f 0.w l l ; e */	int DOS_GETASSIGN (const char *, char *);
/* ff8f 1.w l l w ; e */	int DOS_MAKEASSIGN (const char *, const char *, int);
/* ff8f 4.w l ; e */	int DOS_RASSIGN (const char *);
/* ffaa w */		int DOS_FFLUSH_SET (int);
/* ffab w l ; e */	void *DOS_OS_PATCH (unsigned int, void *);
/* ffac w ; e */	union dos_fcb *DOS_GET_FCB_ADR (unsigned int);
/* ffad w l ; ealloc */	void *DOS_S_MALLOC (int, int);
/* ffad wb15 l l ; ealloc */	void *DOS_S_MALLOC0 (int, int);
/* ffae l ; e */	int DOS_S_MFREE (void *);
/* ffaf w l l l ; ep */	int DOS_S_PROCESS (int, int, int, int);
/* fff0 ; alias DOS_EXITVC noret */	__dead void DOS_RETSHELL (void);
			__dead void DOS_EXITVC (void);
/* fff1 ; noret */	__dead void DOS_CTLABORT (void);
/* fff2 ; noret */	__dead void DOS_ERRABORT (void);
/* fff3 l w w w */	void DOS_DISKRED (void *, int, int, int);
/* fff3 lb31 w l l */	void DOS_DISKRED2 (void *, int, int, int);
/* fff4 l w w w */	void DOS_DISKWRT (const void *, int, int, int);
/* fff4 lb31 w l l */	void DOS_DISKWRT2 (const void *, int, int, int);
/* fff5 */		struct dos_indos *DOS_INDOSFLG (void);
/* fff6 l ; super_jsr sv */	void DOS_SUPER_JSR (void (*)(void), struct dos_dregs *, struct dos_dregs *);
/* fff7 l l w ; alias DOS_BUS_ERR e */	int DOS_MEMCPY (void *, void *, int);
			int DOS_BUS_ERR (void *, void *, int);
/* fff8 l w l l w l l l ; e */	int DOS_OPEN_PR (const char *, int, int, int, int, int, struct dos_prcctrl *, long);
/* fff9 ; e */		int DOS_KILL_PR (void);
/* fffa w l ; e */	int DOS_GET_PR (int, struct dos_prcptr *);
/* fffb w ; ep */	int DOS_SUSPEND_PR (int);
/* fffc l */		int DOS_SLEEP_PR (long);
/* fffd w w w l l ; ep */	int DOS_SEND_PR (int, int, int, char *, long);
/* fffe */		long DOS_TIME_PR (void);
/* ffff */		void DOS_CHANGE_PR (void);

#endif /* __X68K_DOS_H__ */