Rev 1635 | Rev 2010 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1635 | Rev 1638 | ||
---|---|---|---|
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: 1491 $ |
8 | $Revision: 1638 $ |
9 | 9 | ||
Line 20... | Line 20... | ||
20 | push ebx |
20 | push ebx |
Line 21... | Line 21... | ||
21 | 21 | ||
22 | mov ebx, [irq] ;irq num |
22 | mov ebx, [irq] ;irq num |
23 | test ebx, ebx |
23 | test ebx, ebx |
24 | jz .err |
24 | jz .err |
- | 25 | cmp ebx, [IRQ_COUNT] ; hidnplayr says: we only have 16 IRQ's |
|
25 | cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's |
26 | ; Ghost says: we can have more... |
26 | ja .err |
27 | jae .err |
27 | mov eax, [handler] |
28 | mov eax, [handler] |
28 | test eax, eax |
29 | test eax, eax |
29 | jz .err |
30 | jz .err |
30 | cmp [irq_owner + 4 * ebx], 0 |
31 | cmp [irq_owner + 4 * ebx], 0 |
Line 52... | Line 53... | ||
52 | ret |
53 | ret |
53 | endp |
54 | endp |
Line 54... | Line 55... | ||
54 | 55 | ||
Line 55... | Line 56... | ||
55 | uglobal |
56 | uglobal |
Line 56... | Line 57... | ||
56 | 57 | ||
Line 57... | Line 58... | ||
57 | irq_rights rd 16 |
58 | irq_rights rd IRQ_RESERVE |
Line 78... | Line 79... | ||
78 | proc detach_int_handler |
79 | proc detach_int_handler |
Line 79... | Line 80... | ||
79 | 80 | ||
80 | ret |
81 | ret |
Line 81... | Line -... | ||
81 | endp |
- | |
82 | - | ||
83 | align 4 |
- | |
84 | proc enable_irq stdcall, irq_line:dword |
- | |
85 | mov ebx, [irq_line] |
- | |
86 | mov edx, 0x21 |
- | |
87 | cmp ebx, 8 |
- | |
88 | jb @F |
- | |
89 | mov edx, 0xA1 |
- | |
90 | sub ebx,8 |
- | |
91 | @@: |
- | |
92 | in al,dx |
- | |
93 | btr eax, ebx |
- | |
94 | out dx, al |
- | |
Line 95... | Line 82... | ||
95 | ret |
82 | endp |
96 | endp |
83 | |
Line 97... | Line 84... | ||
97 | 84 | ||
Line 98... | Line 85... | ||
98 | align 16 |
85 | align 16 |
99 | ;; proc irq_serv |
86 | ;; proc irq_serv |
100 | - | ||
101 | irq_serv: |
- | |
102 | - | ||
103 | .irq_1: |
- | |
104 | push 1 |
- | |
105 | jmp .main |
- | |
106 | align 4 |
- | |
107 | .irq_2: |
- | |
108 | push 2 |
- | |
109 | jmp .main |
- | |
110 | align 4 |
- | |
111 | .irq_3: |
- | |
112 | push 3 |
- | |
113 | jmp .main |
- | |
114 | align 4 |
- | |
115 | .irq_4: |
- | |
116 | push 4 |
- | |
117 | jmp .main |
- | |
118 | align 4 |
- | |
119 | .irq_5: |
- | |
120 | push 5 |
87 | |
- | 88 | irq_serv: |
|
- | 89 | ||
- | 90 | ; .irq_1: |
|
- | 91 | ; push 1 |
|
121 | jmp .main |
92 | ; jmp .main |
122 | ; align 4 |
- | |
123 | ; .irq_6: |
- | |
124 | ; push 6 |
- | |
125 | ; jmp .main |
- | |
126 | align 4 |
- | |
127 | .irq_7: |
- | |
128 | push 7 |
- | |
129 | jmp .main |
- | |
130 | align 4 |
- | |
131 | .irq_8: |
- | |
132 | push 8 |
- | |
133 | jmp .main |
- | |
134 | align 4 |
- | |
135 | .irq_9: |
- | |
136 | push 9 |
- | |
137 | jmp .main |
- | |
138 | align 4 |
93 | ; etc... |
139 | .irq_10: |
- | |
140 | push 10 |
- | |
141 | jmp .main |
- | |
142 | align 4 |
- | |
143 | .irq_11: |
94 | |
144 | push 11 |
95 | macro irq_serv_h [num] { |
145 | jmp .main |
96 | forward |
146 | align 4 |
97 | align 4 |
147 | .irq_12: |
- | |
148 | push 12 |
98 | .irq_#num : |
149 | jmp .main |
99 | push num |
150 | ; align 4 |
100 | jmp .main |
151 | ; .irq_13: |
101 | } |
152 | ; push 13 |
102 | |
153 | ; jmp .main |
103 | irq_serv_h 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12 |
154 | ; align 4 |
- | |
155 | ; .irq_14: |
- | |
156 | ; push 14 |
- | |
Line 157... | Line 104... | ||
157 | ; jmp .main |
104 | |
158 | ; align 4 |
105 | ; I don`t known how to use IRQ_RESERVE |
159 | ; .irq_15: |
106 | if IRQ_RESERVE > 16 |
160 | ; push 15 |
107 | irq_serv_h 16, 17, 18, 19, 20, 21, 22, 23 |
Line 176... | Line 123... | ||
176 | jz .exit |
123 | jz .exit |
Line 177... | Line 124... | ||
177 | 124 | ||
178 | call ebx |
125 | call ebx |
Line 179... | Line -... | ||
179 | mov [check_idle_semaphore],5 |
- | |
180 | - | ||
181 | .exit: |
126 | mov [check_idle_semaphore],5 |
182 | - | ||
183 | cmp dword [esp + 32], 8 |
- | |
184 | mov al, 0x20 |
- | |
185 | jb @f |
- | |
186 | out 0xa0, al |
127 | |
187 | @@: |
- | |
188 | out 0x20, al |
128 | .exit: mov eax, [esp + 32] |
189 | 129 | call IRQ_EOI |
|
Line 190... | Line 130... | ||
190 | restore_ring3_context |
130 | restore_ring3_context |
Line 1618... | Line 1558... | ||
1618 | mov [eax+12], edx |
1558 | mov [eax+12], edx |
1619 | mov [eax+16], edx |
1559 | mov [eax+16], edx |
Line 1620... | Line 1560... | ||
1620 | 1560 | ||
1621 | call free ;release object memory |
1561 | call free ;release object memory |
1622 | ret |
- | |
1623 | - | ||
1624 | - | ||
1625 | - | ||
1626 | if 0 |
- | |
1627 | - | ||
1628 | irq: |
- | |
1629 | - | ||
1630 | .irq0: |
- | |
1631 | pusfd |
- | |
1632 | pushad |
- | |
1633 | push IRQ_0 |
- | |
1634 | jmp .master |
- | |
1635 | .irq_1: |
- | |
1636 | pusfd |
- | |
1637 | pushad |
- | |
1638 | push IRQ_1 |
- | |
1639 | jmp .master |
- | |
1640 | - | ||
1641 | .master: |
- | |
1642 | mov ax, app_data |
- | |
1643 | mov ds, eax |
- | |
1644 | mov es, eax |
- | |
1645 | mov ebx, [esp+4] ;IRQ_xx |
- | |
1646 | mov eax, [irq_handlers+ebx+4] |
- | |
1647 | call intr_handler |
- | |
1648 | mov ecx, [esp+4] |
- | |
1649 | cmp [irq_actids+ecx*4], 0 |
- | |
1650 | je @F |
- | |
1651 | in al, 0x21 |
- | |
1652 | bts eax, ecx |
- | |
1653 | out 0x21, al |
- | |
1654 | mov al, 0x20 |
- | |
1655 | out 0x20, al |
- | |
1656 | jmp .restart |
- | |
1657 | - | ||
1658 | .slave: |
- | |
1659 | mov ax, app_data |
- | |
1660 | mov ds, eax |
- | |
1661 | mov es, eax |
- | |
1662 | mov ebx, [esp+4] ;IRQ_xx |
- | |
1663 | mov eax, [irq_handlers+ebx+4] |
- | |
1664 | call intr_handler |
- | |
1665 | mov ecx, [esp+4] |
- | |
1666 | sub ecx, 8 |
- | |
1667 | cmp [irq_actids+ecx*4], 0 |
- | |
1668 | je @F |
- | |
1669 | in al, 0xA1 |
- | |
1670 | bts eax, ecx |
- | |
1671 | out 0xA1, al |
- | |
1672 | mov al, 0x20 |
- | |
1673 | out 0xA0, al |
- | |
1674 | out 0x20, al |
- | |
1675 | .restart: |
- | |
1676 | mov ebx, [next_slot] |
- | |
1677 | test ebx, ebx |
- | |
1678 | jz @F |
- | |
1679 | mov [next_task],0 |
- | |
1680 | mov esi, [prev_slot] |
- | |
1681 | call do_change_task |
- | |
1682 | add esp, 4 |
- | |
1683 | iretd |
- | |
1684 | - | ||
1685 | end if |
- | |
1686 | - | ||
1687 | - | ||
1688 | - |