Rev 769 | Rev 797 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 769 | Rev 774 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. 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: 769 $ |
8 | $Revision: 774 $ |
9 | 9 | ||
Line 10... | Line 10... | ||
10 | 10 | ||
Line 11... | Line 11... | ||
11 | DRV_COMPAT equ 5 ;minimal required drivers version |
11 | DRV_COMPAT equ 5 ;minimal required drivers version |
12 | DRV_CURRENT equ 5 ;current drivers model version |
12 | DRV_CURRENT equ 5 ;current drivers model version |
Line 13... | Line 13... | ||
13 | 13 | ||
14 | DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT |
14 | DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT |
15 | 15 | ||
16 | align 4 |
16 | align 4 |
17 | proc attach_int_handler stdcall, irq:dword, handler:dword |
17 | proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword |
18 | 18 | ||
19 | mov ebx, [irq] ;irq num |
19 | mov ebx, [irq] ;irq num |
20 | test ebx, ebx |
20 | test ebx, ebx |
21 | jz .err |
21 | jz .err |
- | 22 | cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's |
|
- | 23 | ja .err |
|
- | 24 | mov eax, [handler] |
|
- | 25 | test eax, eax |
|
22 | cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's |
26 | jz .err |
- | 27 | cmp [irq_owner + 4 * ebx], 0 |
|
- | 28 | je @f |
|
23 | ja .err |
29 | |
Line -... | Line 30... | ||
- | 30 | mov ecx, [irq_rights + 4 * ebx] ; Rights : 0 - full access, 1 - read only, 2 - forbidden |
|
- | 31 | test ecx, ecx |
|
24 | mov eax, [handler] |
32 | jnz .err |
25 | test eax, eax |
33 | |
26 | jz .err |
34 | @@: |
- | 35 | mov [irq_tab+ebx*4], eax |
|
- | 36 | ||
27 | cmp [irq_owner + 4 * ebx], 0 |
37 | mov eax, [access_rights] |
28 | jne .err |
38 | mov [irq_rights + 4 * ebx], eax |
Line 29... | Line 39... | ||
29 | mov [irq_tab+ebx*4], eax |
39 | ;push eax |
30 | 40 | ;mov eax, [TASK_BASE] |
|
31 | ;push eax |
41 | ;mov eax, [eax + TASKDATA.pid] ; faster or smaller? :) |
32 | ;mov eax, [TASK_BASE] |
42 | call get_pid |
33 | ;mov eax, [eax + TASKDATA.pid] |
43 | |
34 | mov [irq_owner + 4 * ebx], 1 |
44 | mov [irq_owner + 4 * ebx], eax |
Line -... | Line 45... | ||
- | 45 | ;pop eax |
|
- | 46 | ||
- | 47 | stdcall enable_irq, [irq] |
|
- | 48 | ret |
|
- | 49 | .err: |
|
- | 50 | xor eax, eax |
|
- | 51 | ret |
|
- | 52 | endp |
|
- | 53 | ||
- | 54 | uglobal |
|
- | 55 | ||
- | 56 | irq_rights rd 16 |
|
- | 57 | ||
- | 58 | endg |
|
- | 59 | ||
- | 60 | proc get_int_handler stdcall, irq:dword |
|
- | 61 | ||
- | 62 | mov eax, [irq] |
|
- | 63 | ||
- | 64 | cmp [irq_rights + 4 * eax], dword 1 |
|
- | 65 | ja .err |
|
- | 66 | ||
35 | ;pop eax |
67 | mov eax, [irq_tab + 4 * eax] |
36 | 68 | ret |
|
Line 37... | Line 69... | ||
37 | stdcall enable_irq, [irq] |
69 | |
38 | ret |
70 | .err: |