newer at_wini.c (really incl atapi dma this time)
[minix.git] / include / tools.h
blobb59e00ecbc0d2da00df2019591f8050258f02942
1 #ifndef _INCLUDE_TOOLS_H
2 #define _INCLUDE_TOOLS_H 1
4 /* Constants describing the disk */
5 #define SECTOR_SIZE 512
6 #define SECTOR_SHIFT 9
7 #define RATIO(b) ((b)/SECTOR_SIZE)
8 #define ISO_SECTOR_SIZE 2048
9 #define ISO_PVD_OFFSET 16
10 #define HRATIO (SECTOR_SIZE / HCLICK_SIZE)
11 #define PARAMSEC 1 /* sector containing boot parameters */
12 #define DSKBASE 0x1E /* floppy disk parameter vector */
13 #define DSKPARSIZE 11 /* there are this many bytes of parameters */
14 #define ESC '\33' /* escape key */
15 #define HEADERSEG 0x0060 /* place for an array of struct exec's */
16 #define MINIXSEG 0x0080 /* MINIX loaded here (rounded up to a click) */
17 #define BOOTSEG 0x07C0 /* bootstraps are loaded here */
18 #define SIGNATURE 0xAA55 /* proper bootstraps have this signature */
19 #define SIGNATPOS 510 /* offset within bootblock */
20 #define FREESEG 0x0800 /* Memory from FREESEG to cseg is free */
21 #define MSEC_PER_TICK 55 /* 18.2 ticks per second */
23 /* Scan codes for four different keyboards (from kernel/keyboard.c) */
24 #define DUTCH_EXT_SCAN 32 /* 'd' */
25 #define OLIVETTI_SCAN 12 /* '=' key on olivetti */
26 #define STANDARD_SCAN 13 /* '=' key on IBM */
27 #define US_EXT_SCAN 22 /* 'u' */
29 /* Other */
30 #define ROOT_INO ((ino_t) 1) /* Inode nr of root dir. */
31 #define IM_NAME_MAX 63
33 /* Variables */
34 #ifndef EXTERN
35 #define EXTERN extern
36 #endif
38 typedef struct vector {
39 u16_t offset;
40 u16_t segment;
41 } vector;
43 struct image_header {
44 char name[IM_NAME_MAX + 1]; /* Null terminated. */
45 struct exec process;
48 EXTERN vector rem_part; /* boot partition table entry */
49 EXTERN u16_t cseg, dseg; /* code and data segment of the boot program */
50 EXTERN u32_t runsize; /* size of this program */
51 EXTERN u16_t device; /* drive being booted from */
52 EXTERN u16_t heads, sectors; /* the drive's number of heads and sectors */
53 extern u16_t eqscancode; /* Set by peek/getch() if they see a '=' */
55 /* Sticky attributes */
56 #define E_SPECIAL 0x01 /* These are known to the program */
57 #define E_DEV 0x02 /* The value is a device name */
58 #define E_RESERVED 0x04 /* May not be set by user, e.g. scancode */
59 #define E_STICKY 0x07 /* Don't go once set */
61 /* Volatile attributes */
62 #define E_VAR 0x08 /* Variable */
63 #define E_FUNCTION 0x10 /* Function definition */
65 typedef struct environment {
66 struct environment *next;
67 char flags;
68 char *name; /* name = value */
69 char *arg; /* name(arg) {value} */
70 char *value;
71 char *defval; /* Safehouse for default values */
72 } environment;
74 /* External variables */
75 EXTERN environment *env; /* Lists the environment */
76 EXTERN int fsok; /* True if the boot device contains an FS */
77 EXTERN u32_t lowsec; /* Offset to the file system on the boot dev */
79 /* Prototypes */
80 _PROTOTYPE( off_t r_super, (void));
81 _PROTOTYPE( void r_stat, (Ino_t _inum, struct stat *_stp ));
82 _PROTOTYPE( ino_t r_readdir, (char *_name ));
83 _PROTOTYPE( off_t r_vir2abs, (off_t _virblk ));
84 _PROTOTYPE( ino_t r_lookup, (Ino_t _cwd, char *_path ));
86 #ifdef _MONHEAD
87 _PROTOTYPE( void readerr, (off_t _sec, int _err ));
88 _PROTOTYPE( int numprefix, (char *_s, char **_ps ));
89 _PROTOTYPE( int numeric, (char *_s ));
90 _PROTOTYPE( dev_t name2dev, (char *_name ));
91 _PROTOTYPE( int delay, (char *_msec ));
92 _PROTOTYPE( char *unix_err, (int _err ));
93 _PROTOTYPE( void init_cache, (void));
94 _PROTOTYPE( void invalidate_cache, (void));
95 _PROTOTYPE( char *b_value, (char *_name ));
96 _PROTOTYPE( void raw_copy, (int _doff, int _dseg, int _soff, int _sseg,
97 int _count));
98 _PROTOTYPE( void raw_clear, (int _off, int _seg, int _count));
99 _PROTOTYPE( void bootstrap, (int _device, int _partoff, int _partseg));
101 _PROTOTYPE( long a2l, (char *_a ));
102 _PROTOTYPE( char *ul2a, (u32_t _n ));
103 _PROTOTYPE( char *u2a, (int _n1 ));
105 /* Functions defined in monhead.s and usable by other files. */
106 _PROTOTYPE( void reset_video, (int color));
107 _PROTOTYPE( int dev_geometry, (void));
108 _PROTOTYPE( u16_t get_ext_memsize, (void));
109 _PROTOTYPE( u16_t get_low_memsize, (void));
110 _PROTOTYPE( u16_t get_processor, (void));
111 _PROTOTYPE( u32_t get_tick, (void));
112 _PROTOTYPE( u16_t get_video, (void));
113 _PROTOTYPE( u16_t get_word, (int _off, int _seg));
114 _PROTOTYPE( int getchar, (void));
115 _PROTOTYPE( void minix, (void));
116 _PROTOTYPE( void minix86, (int _kcs, int _kds, char *_bpar, int _psize));
117 _PROTOTYPE( void minix386, (int _kcs, int _kds, char *_bpar, int _psize));
118 _PROTOTYPE( int peekchar, (void));
119 _PROTOTYPE( void put_word, (int _off, int _seg, int _word));
120 _PROTOTYPE( int putchar, (char _c));
121 _PROTOTYPE( int readsectors, (int _off, int _seg, off_t _adr, int _ct));
122 _PROTOTYPE( void reboot, (void));
123 _PROTOTYPE( void relocate, (void));
124 _PROTOTYPE( int writesectors, (int _off, int _seg, off_t _adr, int _ct));
125 #endif
127 #endif