Rev 120 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 120 | Rev 131 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?xml version="1.0" encoding="UTF-8"?> |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <chapter id="hardware"> |
2 | <chapter id="hardware"> |
3 | <?dbhtml filename="hardware.html"?> |
3 | <?dbhtml filename="hardware.html"?> |
4 | 4 | ||
5 | <title>Device drivers</title> |
5 | <title>Device Drivers</title> |
6 | 6 | ||
7 | <para>Since HelenOS is a microkernel, a framework for supporting userspace |
7 | <para>Since HelenOS is a microkernel, a framework for supporting userspace |
8 | device drivers has been implemented. A typical userspace task acting as a |
8 | device drivers has been implemented. A typical userspace task acting as a |
9 | device driver might need to: </para> |
9 | device driver might need to:</para> |
10 | 10 | ||
Line 25... | Line 25... | ||
25 | <para>control preemption.</para> |
25 | <para>control preemption.</para> |
26 | </listitem> |
26 | </listitem> |
27 | </itemizedlist> |
27 | </itemizedlist> |
28 | 28 | ||
29 | <section> |
29 | <section> |
30 | <title>Interrupt notifications</title> |
30 | <title>Interrupt Notifications</title> |
31 | 31 | ||
32 | <para>Userspace tasks that are in hold of the |
32 | <para>Userspace tasks that are in hold of the |
33 | <constant>CAP_IRQ_REG</constant> capability can register themselves via |
33 | <constant>CAP_IRQ_REG</constant> capability can register themselves via |
34 | the <code>ipc_register_irq()</code> to be notified about occurrences of a |
34 | the <code>ipc_register_irq()</code> to be notified about occurrences of a |
35 | given interrupt. The registration call takes two arguments. The first |
35 | given interrupt. The registration call takes two arguments. The first |
Line 51... | Line 51... | ||
51 | when the interrupt handler performs certain reads or writes of memory or |
51 | when the interrupt handler performs certain reads or writes of memory or |
52 | I/O space.</para> |
52 | I/O space.</para> |
53 | </section> |
53 | </section> |
54 | 54 | ||
55 | <section> |
55 | <section> |
56 | <title>Accessing memory and I/O space</title> |
56 | <title>Accessing Memory and I/O Space</title> |
57 | 57 | ||
58 | <para>When a task has the <constant>CAP_MEM_MANAGER</constant> capability, |
58 | <para>When a task has the <constant>CAP_MEM_MANAGER</constant> capability, |
59 | it can use the <constant>SYS_MAP_PHYSMEM</constant> to map regions of |
59 | it can use the <constant>SYS_MAP_PHYSMEM</constant> to map regions of |
60 | physical memory to its address space. When successful, the syscall creates |
60 | physical memory to its address space. When successful, the syscall creates |
61 | an address space area for the physical memory region. The address space |
61 | an address space area for the physical memory region. The address space |
Line 66... | Line 66... | ||
66 | only on architectures that have separate I/O space (e.g. amd64 and |
66 | only on architectures that have separate I/O space (e.g. amd64 and |
67 | ia32).</para> |
67 | ia32).</para> |
68 | </section> |
68 | </section> |
69 | 69 | ||
70 | <section> |
70 | <section> |
71 | <title>Disabling preemption</title> |
71 | <title>Disabling Preemption</title> |
72 | 72 | ||
73 | <para>It might be desirable for a device driver to temporarily disable |
73 | <para>It might be desirable for a device driver to temporarily disable |
74 | preemption. Tasks that can do this are required to have the |
74 | preemption. Tasks that can do this are required to have the |
75 | CAP_PREEMPT_CONTROL capability. Preemption could be theoretically disabled |
75 | CAP_PREEMPT_CONTROL capability. Preemption could be theoretically disabled |
76 | by disabling interrupts on the current processor, but disabling preemption |
76 | by disabling interrupts on the current processor, but disabling preemption |