Rev 4961 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4961 | Rev 5057 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
- | 8 | format PE DLL native 0.05 |
|
Line 8... | Line 9... | ||
8 | format MS COFF |
9 | entry START |
Line 9... | Line 10... | ||
9 | 10 | ||
10 | include 'CONFIG.INC' |
- | |
11 | 11 | include 'CONFIG.INC' |
|
12 | ;structs---------------------------------------------------------- |
- | |
13 | struc IOCTL |
- | |
14 | { .handle dd ? |
- | |
15 | .io_code dd ? |
- | |
16 | .input dd ? |
- | |
17 | .inp_size dd ? |
- | |
18 | .output dd ? |
- | |
19 | .out_size dd ? |
- | |
20 | } |
- | |
21 | - | ||
22 | virtual at 0 |
- | |
23 | IOCTL IOCTL |
- | |
24 | end virtual |
- | |
25 | 12 | ||
26 | ;something-------------------------------------------------------- |
- | |
27 | public START |
- | |
28 | public service_proc |
13 | section '.flat' code readable writable executable |
29 | public version |
14 | include '..\..\struct.inc' |
30 | - | ||
31 | include '..\proc32.inc' |
- | |
Line 32... | Line 15... | ||
32 | include '..\imports.inc' |
15 | include '..\..\macros.inc' |
Line 33... | Line 16... | ||
33 | 16 | include '..\..\proc32.inc' |
|
34 | section '.flat' code readable align 16 |
17 | include '..\..\peimport.inc' |
35 | 18 | ||
36 | include 'SB16.INC' |
19 | include 'SB16.INC' |
37 | 20 | ||
Line 38... | Line 21... | ||
38 | ;------------------------------------------------------------------------------- |
21 | ;------------------------------------------------------------------------------- |
39 | proc START stdcall, state:dword |
22 | proc START c uses ebx esi edi, state:dword, cmdline:dword |
40 | cmp [state], 1 |
23 | cmp [state], 1 |
41 | jne .stop |
24 | jne .stop |
Line 42... | Line 25... | ||
42 | .entry: |
25 | .entry: |
43 | 26 | ||
44 | if DEBUG |
27 | if DEBUG |
Line 62... | Line 45... | ||
62 | dec eax |
45 | dec eax |
63 | jz .sb_say_about_found_dsp |
46 | jz .sb_say_about_found_dsp |
64 | mov dword[esi], '16 ' |
47 | mov dword[esi], '16 ' |
65 | .sb_say_about_found_dsp: |
48 | .sb_say_about_found_dsp: |
66 | mov esi, msgDSPFound |
49 | mov esi, msgDSPFound |
67 | call SysMsgBoardStr |
50 | invoke SysMsgBoardStr |
68 | end if |
51 | end if |
Line 69... | Line 52... | ||
69 | 52 | ||
70 | xor ebx, ebx |
53 | xor ebx, ebx |
71 | mov ecx, [sb_base_port] |
54 | mov ecx, [sb_base_port] |
72 | lea edx, [ecx+0xF] |
55 | lea edx, [ecx+0xF] |
Line 73... | Line 56... | ||
73 | call ReservePortArea ;these ports must be mine ! |
56 | invoke ReservePortArea ;these ports must be mine ! |
74 | 57 | ||
Line 75... | Line 58... | ||
75 | dec eax |
58 | dec eax |
76 | jnz @f |
59 | jnz @f |
77 | 60 | ||
78 | if DEBUG |
61 | if DEBUG |
79 | mov esi, msgErrRsrvPorts |
62 | mov esi, msgErrRsrvPorts |
Line 80... | Line 63... | ||
80 | call SysMsgBoardStr |
63 | invoke SysMsgBoardStr |
- | 64 | end if |
|
- | 65 | jmp .exit |
|
- | 66 | ||
- | 67 | @@: |
|
Line 81... | Line 68... | ||
81 | end if |
68 | invoke AllocDMA24, sb_buffer_size |
Line 82... | Line 69... | ||
82 | jmp .exit |
69 | test eax, eax |
Line 83... | Line 70... | ||
83 | 70 | jz .exit |
|
84 | @@: |
71 | mov [SB16Buffer], eax |
85 | 72 | ||
Line 86... | Line 73... | ||
86 | call sb_setup ;clock it, etc |
73 | call sb_setup ;clock it, etc |
87 | 74 | ||
Line 88... | Line 75... | ||
88 | stdcall AttachIntHandler, sb_irq_num, sb_irq, 0 |
75 | invoke AttachIntHandler, sb_irq_num, sb_irq, 0 |
89 | 76 | ||
Line 90... | Line 77... | ||
90 | if DEBUG |
77 | if DEBUG |
91 | test eax, eax |
78 | test eax, eax |
92 | jnz @f |
79 | jnz @f |
93 | 80 | ||
94 | mov esi, msgErrAtchIRQ |
81 | mov esi, msgErrAtchIRQ |
95 | call SysMsgBoardStr |
82 | invoke SysMsgBoardStr |
96 | 83 | ||
97 | ; stdcall GetIntHandler, sb_irq_num |
84 | ; stdcall GetIntHandler, sb_irq_num |
98 | ; call SysMsgBoardNum |
85 | ; call SysMsgBoardNum |
99 | 86 | ||
Line 100... | Line 87... | ||
100 | jmp .stop |
87 | jmp .stop |
101 | @@: |
88 | @@: |
102 | mov esi, msgSucAtchIRQ |
89 | mov esi, msgSucAtchIRQ |
103 | call SysMsgBoardStr |
90 | invoke SysMsgBoardStr |
Line 104... | Line 91... | ||
104 | end if |
91 | end if |
105 | stdcall RegService, my_service, service_proc |
92 | invoke RegService, my_service, service_proc |
106 | ret |
93 | ret |
107 | .stop: |
94 | .stop: |
Line 108... | Line -... | ||
108 | call sb_reset |
- | |
109 | .exit: |
- | |
110 | - | ||
111 | if DEBUG |
- | |
112 | mov esi, msgExit |
- | |
113 | call SysMsgBoardStr |
- | |
114 | end if |
- | |
115 | - | ||
116 | xor eax, eax |
95 | call sb_reset |
117 | ret |
96 | .exit: |
118 | endp |
97 | |
119 | ;------------------------------------------------------------------------------- |
98 | if DEBUG |
120 | 99 | mov esi, msgExit |
|
Line 121... | Line 100... | ||
121 | handle equ IOCTL.handle |
100 | invoke SysMsgBoardStr |
122 | io_code equ IOCTL.io_code |
101 | end if |
123 | input equ IOCTL.input |
102 | |
124 | inp_size equ IOCTL.inp_size |
103 | xor eax, eax |
125 | output equ IOCTL.output |
104 | ret |
126 | out_size equ IOCTL.out_size |
105 | endp |
127 | 106 | ;------------------------------------------------------------------------------- |
|
128 | align 4 |
107 | |
129 | proc service_proc stdcall, ioctl:dword |
108 | proc service_proc stdcall uses ebx esi edi, ioctl:dword |
130 | mov edi, [ioctl] |
109 | mov edi, [ioctl] |
131 | mov eax, [edi+io_code] |
110 | mov eax, [edi+IOCTL.io_code] |
132 | cmp eax, SRV_GETVERSION |
111 | cmp eax, SRV_GETVERSION |
133 | jne @F |
112 | jne @F |
134 | 113 | ||
Line 135... | Line 114... | ||
135 | mov eax, [edi+output] |
114 | mov eax, [edi+IOCTL.output] |
136 | cmp [edi+out_size], 4 |
115 | cmp [edi+IOCTL.out_size], 4 |
Line 169... | Line 148... | ||
169 | @@: |
148 | @@: |
170 | cmp eax, DEV_CALLBACK |
149 | cmp eax, DEV_CALLBACK |
171 | jne @f |
150 | jne @f |
172 | if DEBUG |
151 | if DEBUG |
173 | mov esi, msgCallback |
152 | mov esi, msgCallback |
174 | call SysMsgBoardStr |
153 | invoke SysMsgBoardStr |
175 | end if |
154 | end if |
176 | mov edi, [edi+input] |
155 | mov edi, [edi+IOCTL.input] |
177 | mov eax, [edi] |
156 | mov eax, [edi] |
178 | mov [callback], eax |
157 | mov [callback], eax |
179 | if DEBUG |
158 | if DEBUG |
180 | call SysMsgBoardNum |
159 | call SysMsgBoardNum |
181 | end if |
160 | end if |
Line 186... | Line 165... | ||
186 | jne @F ;DEV_SET(GET)_MASTERVOL, although mixer doesn't use it. |
165 | jne @F ;DEV_SET(GET)_MASTERVOL, although mixer doesn't use it. |
187 | ;It doesn't use it _in current version_ - but in the future... |
166 | ;It doesn't use it _in current version_ - but in the future... |
Line 188... | Line 167... | ||
188 | 167 | ||
189 | if DEBUG |
168 | if DEBUG |
190 | mov esi, msgSetVol |
169 | mov esi, msgSetVol |
191 | call SysMsgBoardStr |
170 | invoke SysMsgBoardStr |
192 | end if |
171 | end if |
193 | mov eax, [edi+input] |
172 | mov eax, [edi+IOCTL.input] |
194 | mov eax, [eax] |
173 | mov eax, [eax] |
195 | call sb_set_master_vol |
174 | call sb_set_master_vol |
196 | xor eax, eax |
175 | xor eax, eax |
197 | ret |
176 | ret |
198 | @@: |
177 | @@: |
199 | cmp eax, DEV_GET_MASTERVOL |
178 | cmp eax, DEV_GET_MASTERVOL |
200 | jne @F |
179 | jne @F |
201 | if DEBUG |
180 | if DEBUG |
202 | mov esi, msgGetVol |
181 | mov esi, msgGetVol |
203 | call SysMsgBoardStr |
182 | invoke SysMsgBoardStr |
204 | end if |
183 | end if |
205 | mov eax, [edi+output] |
184 | mov eax, [edi+IOCTL.output] |
206 | mov edx, [sb_master_vol] |
185 | mov edx, [sb_master_vol] |
207 | mov [eax], edx |
186 | mov [eax], edx |
208 | xor eax, eax |
187 | xor eax, eax |
Line 209... | Line 188... | ||
209 | ret |
188 | ret |
210 | 189 | ||
211 | .fail: |
190 | .fail: |
212 | or eax, -1 |
191 | or eax, -1 |
Line 213... | Line -... | ||
213 | ret |
- | |
214 | endp |
- | |
215 | - | ||
216 | restore handle |
- | |
217 | restore io_code |
- | |
218 | restore input |
- | |
219 | restore inp_size |
- | |
220 | restore output |
192 | ret |
221 | restore out_size |
- | |
222 | 193 | endp |
|
223 | ;------------------------------------------------------------------------------- |
194 | |
224 | align 4 |
195 | ;------------------------------------------------------------------------------- |
225 | proc sb_irq |
196 | proc sb_irq |
Line 233... | Line 204... | ||
233 | mov eax, [eax] |
204 | mov eax, [eax] |
234 | test eax, eax |
205 | test eax, eax |
235 | jns .fill_second_half |
206 | jns .fill_second_half |
Line 236... | Line 207... | ||
236 | 207 | ||
- | 208 | if sb_buffer_size eq small_buffer |
|
237 | if sb_buffer_size eq small_buffer |
209 | mov eax, [SB16Buffer] |
238 | stdcall [callback], SB16Buffer0 ;for 32k buffer |
210 | stdcall [callback], eax ;for 32k buffer |
- | 211 | else if sb_buffer_size eq full_buffer |
|
- | 212 | mov eax, [SB16Buffer] |
|
239 | else if sb_buffer_size eq full_buffer |
213 | push eax |
- | 214 | stdcall [callback], eax ;for 64k buffer |
|
- | 215 | pop eax |
|
240 | stdcall [callback], SB16Buffer0 ;for 64k buffer |
216 | add eax, 16384 |
241 | stdcall [callback], SB16Buffer1 ;for 64k buffer |
217 | stdcall [callback], eax ;for 64k buffer |
242 | end if |
218 | end if |
243 | xor eax, eax |
219 | xor eax, eax |
244 | not eax |
220 | not eax |
Line 245... | Line 221... | ||
245 | ret |
221 | ret |
246 | 222 | ||
- | 223 | .fill_second_half: |
|
- | 224 | if sb_buffer_size eq small_buffer |
|
247 | .fill_second_half: |
225 | mov eax, [SB16Buffer] |
248 | if sb_buffer_size eq small_buffer |
226 | add eax, 16384 |
- | 227 | stdcall [callback], eax ;for 32k buffer |
|
- | 228 | else if sb_buffer_size eq full_buffer |
|
- | 229 | mov eax, [SB16Buffer] |
|
249 | stdcall [callback], SB16Buffer1 ;for 32k buffer |
230 | add eax, 32768 |
- | 231 | push eax |
|
- | 232 | stdcall [callback], eax ;for 64k buffer |
|
250 | else if sb_buffer_size eq full_buffer |
233 | pop eax |
251 | stdcall [callback], SB16Buffer2 ;for 64k buffer |
234 | add eax, 16384 |
252 | stdcall [callback], SB16Buffer3 ;for 64k buffer |
235 | stdcall [callback], eax ;for 64k buffer |
253 | end if |
236 | end if |
254 | xor eax, eax |
237 | xor eax, eax |
255 | not eax |
238 | not eax |
Line 335... | Line 318... | ||
335 | @@: |
318 | @@: |
336 | mov [esi+ecx], al |
319 | mov [esi+ecx], al |
337 | shr ebx, 4 |
320 | shr ebx, 4 |
338 | loop .1 |
321 | loop .1 |
339 | dec esi |
322 | dec esi |
340 | call SysMsgBoardStr |
323 | invoke SysMsgBoardStr |
341 | ret |
324 | ret |
342 | endp |
325 | endp |
343 | end if |
326 | end if |
344 | ;all initialized data place here |
327 | ;all initialized data place here |
345 | align 4 |
328 | align 4 |
346 | version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
- | |
Line 347... | Line 329... | ||
347 | 329 | ||
348 | sb_base_port: |
330 | sb_base_port: |
Line 349... | Line 331... | ||
349 | dd 200h ;don't ask me why - see the code&docs |
331 | dd 200h ;don't ask me why - see the code&docs |
Line 382... | Line 364... | ||
382 | sb_DSP_description: |
364 | sb_DSP_description: |
383 | db 32,32,32,32,13,10,0 |
365 | db 32,32,32,32,13,10,0 |
384 | ;------------------------------------------------------------------------------- |
366 | ;------------------------------------------------------------------------------- |
385 | end if |
367 | end if |
Line -... | Line 368... | ||
- | 368 | ||
386 | 369 | align 4 |
|
387 | section '.data' data readable writable align 16 |
370 | data fixups |
Line -... | Line 371... | ||
- | 371 | end data |
|
388 | ;all uninitialized data place here |
372 | |
Line 389... | Line 373... | ||
389 | 373 | align 4 |
|
Line 390... | Line 374... | ||
390 | ;pTempBuf rd 1 |
374 | SB16Buffer rd 1 |