Subversion Repositories Kolibri OS

Rev

Rev 1992 | Rev 2100 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1992 Rev 2089
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2009. 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
 
Line 8... Line 8...
8
$Revision: 1992 $
8
$Revision: 2089 $
9
 
9
 
Line 10... Line 10...
10
 
10
 
11
DRV_COMPAT   equ  5  ;minimal required drivers version
11
DRV_COMPAT   equ  5  ;minimal required drivers version
Line 12... Line 12...
12
DRV_CURRENT  equ  5  ;current drivers model version
12
DRV_CURRENT  equ  6  ;current drivers model version
13
 
13
 
Line -... Line 14...
-
 
14
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
-
 
15
PID_KERNEL  equ 1    ;os_idle thread
-
 
16
 
14
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
17
align 4
Line 15... Line 18...
15
PID_KERNEL  equ 1    ;os_idle thread
18
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
16
 
19
 
17
align 4
20
         pushfd
18
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
21
         cli
19
 
22
 
20
         push ebx
23
         push ebx
21
 
24
 
22
         mov  ebx, [irq]                   ;irq num
25
         mov  ebx, [irq]                   ;irq num
23
         test ebx, ebx
-
 
24
         jz   .err
-
 
25
         cmp  ebx, 15                      ; hidnplayr says: we only have 16 IRQ's
-
 
26
         ja   .err
-
 
27
         mov  eax, [handler]
-
 
28
         test eax, eax
-
 
Line 29... Line -...
29
         jz   .err
-
 
30
         cmp  [irq_owner + 4 * ebx], 0
26
         test ebx, ebx
31
         je   @f
-
 
32
 
-
 
33
         mov  ecx, [irq_rights + 4 * ebx]  ; Rights : 0 - full access, 1 - read only, 2 - forbidden
-
 
34
         test ecx, ecx
-
 
35
         jnz  .err
-
 
36
 
-
 
37
@@:
27
         jz   .err
38
         mov  [irq_tab+ebx*4], eax
28
         cmp  ebx, 15                      ; hidnplayr says: we only have 16 IRQ's
39
 
29
         ja   .err
-
 
30
         mov  eax, [handler]
40
         mov  eax, [access_rights]
31
         test eax, eax
41
         mov  [irq_rights + 4 * ebx], eax
32
         jz   .err
42
 
33
 
43
         mov  [irq_owner + 4 * ebx], PID_KERNEL  ; all handlers belong to a kernel
34
         mov  [irq_tab+ebx*4], eax
-
 
35
         stdcall enable_irq, [irq]
44
 
36
         pop ebx
45
         stdcall enable_irq, [irq]
37
         mov eax, 1
Line 46... Line -...
46
         pop ebx
-
 
47
         mov eax, 1
-
 
48
         ret
-
 
49
.err:
-
 
50
         pop ebx
-
 
51
         xor eax, eax
-
 
52
         ret
38
         popfd
Line 53... Line 39...
53
endp
39
         ret
Line 54... Line -...
54
 
-
 
55
uglobal
-
 
56
 
-
 
57
	irq_rights	 rd	 16
40
.err:
58
 
41
         pop ebx
59
endg
-
 
60
 
-
 
61
proc get_int_handler stdcall, irq:dword
-
 
62
 
-
 
63
	mov	eax, [irq]
-
 
64
 
42
         xor eax, eax
Line 65... Line 43...
65
	cmp	[irq_rights + 4 * eax], dword 1
43
         popfd
66
	ja	.err
44
         ret