]> icculus.org git repositories - btb/d2x.git/blob - arch/dos/allg_snd/sound/interndj.h
added new arg and printfs for mouse driver problems (d1x r1.2, r1.2)
[btb/d2x.git] / arch / dos / allg_snd / sound / interndj.h
1 /*         ______   ___    ___ 
2  *        /\  _  \ /\_ \  /\_ \ 
3  *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___ 
4  *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
5  *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
6  *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7  *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8  *                                           /\____/
9  *                                           \_/__/
10  *      By Shawn Hargreaves,
11  *      1 Salisbury Road,
12  *      Market Drayton,
13  *      Shropshire,
14  *      England, TF9 1AJ.
15  *
16  *      Some definitions for internal use by the library code.
17  *      This should not be included by user programs.
18  *
19  *      See readme.txt for copyright information.
20  */
21
22
23 #ifndef INTERNDJ_H
24 #define INTERNDJ_H
25
26 #ifndef DJGPP
27 #error This file should only be used by the djgpp version of Allegro
28 #endif
29
30
31 #include <dos.h>
32
33
34 /* file access macros */
35 #define FILE_OPEN(filename, handle)             handle = open(filename, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR)
36 #define FILE_CREATE(filename, handle)           handle = open(filename, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)
37 #define FILE_CLOSE(handle)                      close(handle)
38 #define FILE_READ(handle, buf, size, sz)        sz = read(handle, buf, size)
39 #define FILE_WRITE(handle, buf, size, sz)       sz = write(handle, buf, size) 
40 #define FILE_SEARCH_STRUCT                      struct ffblk
41 #define FILE_FINDFIRST(filename, attrib, dta)   findfirst(filename, dta, attrib)
42 #define FILE_FINDNEXT(dta)                      findnext(dta)
43 #define FILE_ATTRIB                             ff_attrib
44 #define FILE_SIZE                               ff_fsize
45 #define FILE_NAME                               ff_name
46 #define FILE_TIME                               ff_ftime
47 #define FILE_DATE                               ff_fdate
48
49
50 /* macros to enable and disable interrupts */
51 #define DISABLE()   asm volatile ("cli")
52 #define ENABLE()    asm volatile ("sti")
53
54
55 __INLINE__ void enter_critical() 
56 {
57    if (windows_version >= 3) {
58       __dpmi_regs r;
59       r.x.ax = 0x1681; 
60       __dpmi_int(0x2F, &r);
61    }
62
63    DISABLE();
64 }
65
66
67 __INLINE__ void exit_critical() 
68 {
69    if (windows_version >= 3) {
70       __dpmi_regs r;
71       r.x.ax = 0x1682; 
72       __dpmi_int(0x2F, &r);
73    }
74
75    ENABLE();
76 }
77
78
79 /* interrupt hander stuff */
80 int _install_irq(int num, int (*handler)());
81 void _remove_irq(int num);
82
83 typedef struct _IRQ_HANDLER
84 {
85    int (*handler)();             /* our C handler */
86    int number;                   /* irq number */
87    __dpmi_paddr old_vector;      /* original protected mode vector */
88 } _IRQ_HANDLER;
89
90
91 /* DPMI memory mapping routines */
92 int _create_physical_mapping(unsigned long *linear, int *segment, unsigned long physaddr, int size);
93 void _remove_physical_mapping(unsigned long *linear, int *segment);
94 int _create_linear_mapping(unsigned long *linear, unsigned long physaddr, int size);
95 void _remove_linear_mapping(unsigned long *linear);
96 int _create_selector(int *segment, unsigned long linear, int size);
97 void _remove_selector(int *segment);
98 void _unlock_dpmi_data(void *addr, int size);
99
100
101 /* bank switching routines */
102 void _vesa_window_1();
103 void _vesa_window_1_end();
104 void _vesa_window_2();
105 void _vesa_window_2_end();
106
107 void _vesa_pm_window_1();
108 void _vesa_pm_window_1_end();
109 void _vesa_pm_window_2();
110 void _vesa_pm_window_2_end();
111
112 void _vesa_pm_es_window_1();
113 void _vesa_pm_es_window_1_end();
114 void _vesa_pm_es_window_2();
115 void _vesa_pm_es_window_2_end();
116
117 void _vbeaf_bank();
118 void _vbeaf_bank_end();
119
120 void _vbeaf_linear_lookup();
121 void _vbeaf_linear_lookup_end();
122
123 void _ati_bank();
124 void _ati_bank_end();
125
126 void _mach64_write_bank();
127 void _mach64_write_bank_end();
128 void _mach64_read_bank();
129 void _mach64_read_bank_end();
130
131 void _cirrus64_write_bank();
132 void _cirrus64_write_bank_end();
133 void _cirrus64_read_bank();
134 void _cirrus64_read_bank_end();
135
136 void _cirrus54_bank();
137 void _cirrus54_bank_end();
138
139 void _paradise_write_bank();
140 void _paradise_read_bank();
141 void _paradise_write_bank_end();
142 void _paradise_read_bank_end();
143
144 void _s3_bank();
145 void _s3_bank_end();
146
147 void _trident_bank();
148 void _trident_bank_end();
149 void _trident_read_bank();
150 void _trident_read_bank_end();
151 void _trident_write_bank();
152 void _trident_write_bank_end();
153
154 void _et3000_write_bank();
155 void _et3000_write_bank_end();
156 void _et3000_read_bank();
157 void _et3000_read_bank_end();
158
159 void _et4000_write_bank();
160 void _et4000_write_bank_end();
161 void _et4000_read_bank();
162 void _et4000_read_bank_end();
163
164 void _video7_bank();
165 void _video7_bank_end();
166
167
168 /* stuff for the VESA and VBE/AF drivers */
169 extern __dpmi_regs _dpmi_reg;
170
171 extern int _window_2_offset;
172
173 extern void (*_pm_vesa_switcher)();
174 extern void (*_pm_vesa_scroller)();
175 extern void (*_pm_vesa_pallete)();
176
177 extern int _mmio_segment;
178
179 extern void *_af_driver;
180
181 extern int _af_active;
182
183 extern void *_af_set_bank;
184 extern void *_af_wait_till_idle;
185 extern void *_af_enable_direct_access;
186
187
188 /* stuff for setting up bitmaps */
189 long _vesa_vidmem_check(long mem);
190
191
192 /* sound lib stuff */
193 extern int _fm_port;
194 extern int _mpu_port;
195 extern int _sb_freq;
196 extern int _sb_port; 
197 extern int _sb_dma; 
198 extern int _sb_irq; 
199
200 int _sb_read_dsp_version();
201 int _sb_set_mixer(int digi_volume, int midi_volume);
202
203 int _dma_allocate_mem(int bytes, int *sel, unsigned long *phys);
204 void _dma_start(int channel, unsigned long addr, int size, int auto_init);
205 void _dma_stop(int channel);
206 unsigned long _dma_todo(int channel);
207 void _dma_lock_mem();
208
209
210 #endif          /* ifndef INTERNDJ_H */