fixed incorrect size of the alib_intvec structure, which misaligned the
[lugburz] / src / amiga / amigalib.h
1 /* structures and functions necessary to access amiga ROM services */
2 #ifndef AMIGALIB_H_
3 #define AMIGALIB_H_
4
5 #include <stdint.h>
6
7 #define ALIB_MEMF_ANY           0L
8 #define ALIB_MEMF_PUBLIC        0x0001L
9 #define ALIB_MEMF_CHIP          0x0002L
10 #define ALIB_MEMF_FAST          0x0004L
11 #define ALIB_MEMF_CLEAR         0x0100L
12 #define ALIB_MEMF_LARGEST       0x0200L
13 #define ALIB_MEMF_REVERSE       0x0400L
14 #define ALIB_MEMF_TOTAL         0x0800L
15
16 #define ALIB_NODE_COMMON(NODE_TYPE) \
17         NODE_TYPE *n_next; \
18         NODE_TYPE *n_prev; \
19         uint8_t n_type; \
20         int8_t n_prio; \
21         char *n_name
22
23 struct alib_memchunk {
24         struct alib_memchunk *next;
25         uint32_t size;
26 } __attribute__((packed));
27
28 struct alib_intrnode {
29         ALIB_NODE_COMMON(struct alib_intrnode);
30         void *data;
31         void (*code)();
32 } __attribute__((packed));
33
34 struct alib_memnode {
35         ALIB_NODE_COMMON(struct alib_memnode);
36         uint16_t attrib;
37         struct alib_memchunk *freelist;
38         void *start, *end;
39         uint32_t freesz;
40 } __attribute__((packed));
41
42 struct alib_memlist {
43         struct alib_memnode *head, *tail, *tailpred;
44         uint8_t type;
45         uint8_t pad;
46 } __attribute__((packed));
47
48 struct alib_library {
49         ALIB_NODE_COMMON(struct alib_library);
50         uint8_t flags;
51         uint8_t pad;
52         uint16_t negsz, possz;
53         uint16_t ver_major, ver_minor;
54         char *idstr;
55         uint32_t csum;
56         uint16_t nref;
57 } __attribute__((packed));
58
59 struct alib_intvec {
60         void *data;
61         void (*code)();
62         struct alib_intrnode *node;
63 } __attribute__((packed));
64
65 struct alib_execbase {
66         struct alib_library lib;
67         uint16_t softver;
68         int16_t lowmem_csum;
69         uint32_t chkbase;
70         void *coldcap_vect, *coolcap_vect, *warmcap_vect;
71         void *sysstack_upper, *sysstack_lower;
72         uint32_t chipmem_top;
73         void *dbg_entry, *dbg_data, *alert_data;
74         void *extmem_top;
75         uint16_t csum;
76
77         struct alib_intvec intvec[16];
78
79         void *curtask;
80         uint32_t idle_count, disp_count;
81         uint16_t tmslice, nticks;
82         uint16_t sysflags;
83         int8_t intr_dis_nest, task_dis_nest;
84         uint16_t attn_flags, attn_resched;
85         void *resmod;
86         void *tasktrap, *taskexcept, *taks_exit;
87         uint32_t task_sig_alloc;
88         uint16_t task_trap_alloc;
89
90         struct alib_memlist memlist;
91         /* ... more ... */
92 } __attribute__((packed));
93
94 struct alib_execbase *execbase;
95
96 int alib_init(void);
97
98 #endif  /* AMIGALIB_H_ */