Rev 4669 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4669 | Rev 4678 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (c) 2009 Vineeth Pillai |
2 | * Copyright (c) 2009 Vineeth Pillai |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup arm32 |
29 | /** @addtogroup arm32 |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | * @brief Definitions of machine specific functions. |
33 | * @brief Definitions of machine specific functions. |
34 | * |
34 | * |
35 | * These functions enable to differentiate more kinds of ARM emulators |
35 | * These functions enable to differentiate more kinds of ARM emulators |
36 | * or CPUs. It's the same concept as "arch" functions on the architecture |
36 | * or CPUs. It's the same concept as "arch" functions on the architecture |
37 | * level. |
37 | * level. |
38 | */ |
38 | */ |
39 | 39 | ||
40 | #include <arch/machine_func.h> |
40 | #include <arch/machine_func.h> |
41 | 41 | ||
42 | 42 | ||
43 | /** Acquire console back for kernel. */ |
43 | /** Acquire console back for kernel. */ |
44 | void machine_grab_console(void) |
44 | void machine_grab_console(void) |
45 | { |
45 | { |
46 | (machine_ops.machine_grab_console)(); |
46 | (machine_ops.machine_grab_console)(); |
47 | } |
47 | } |
48 | 48 | ||
49 | /** Return console to userspace. */ |
49 | /** Return console to userspace. */ |
50 | void machine_release_console(void) |
50 | void machine_release_console(void) |
51 | { |
51 | { |
52 | (machine_ops.machine_release_console)(); |
52 | (machine_ops.machine_release_console)(); |
53 | } |
53 | } |
54 | 54 | ||
55 | 55 | ||
56 | /** Maps HW devices to the kernel address space using #hw_map. */ |
56 | /** Maps HW devices to the kernel address space using #hw_map. */ |
57 | void machine_init(void) |
57 | void machine_init(void) |
58 | { |
58 | { |
59 | (machine_ops.machine_init)(); |
59 | (machine_ops.machine_init)(); |
60 | } |
60 | } |
61 | 61 | ||
62 | 62 | ||
63 | /** Starts timer. */ |
63 | /** Starts timer. */ |
64 | void machine_timer_irq_start(void) |
64 | void machine_timer_irq_start(void) |
65 | { |
65 | { |
66 | (machine_ops.machine_timer_irq_start)(); |
66 | (machine_ops.machine_timer_irq_start)(); |
67 | } |
67 | } |
68 | 68 | ||
69 | 69 | ||
70 | /** Halts CPU. */ |
70 | /** Halts CPU. */ |
71 | void machine_cpu_halt(void) |
71 | void machine_cpu_halt(void) |
72 | { |
72 | { |
73 | (machine_ops.machine_cpu_halt)(); |
73 | (machine_ops.machine_cpu_halt)(); |
74 | } |
74 | } |
75 | 75 | ||
76 | 76 | ||
77 | /** Returns size of available memory. |
77 | /** Returns size of available memory. |
78 | * |
78 | * |
79 | * @return Size of available memory. |
79 | * @return Size of available memory. |
80 | */ |
80 | */ |
81 | uintptr_t machine_get_memory_size(void) |
81 | uintptr_t machine_get_memory_size(void) |
82 | { |
82 | { |
83 | return (machine_ops.machine_get_memory_size)(); |
83 | return (machine_ops.machine_get_memory_size)(); |
84 | } |
84 | } |
85 | 85 | ||
86 | /** Initializes the Frame Buffer |
86 | /** Initializes the Frame Buffer |
87 | * |
87 | * |
88 | */ |
88 | */ |
89 | void machine_fb_init(void) |
89 | void machine_fb_init(void) |
90 | { |
90 | { |
91 | (machine_ops.machine_fb_init)(); |
91 | (machine_ops.machine_fb_init)(); |
92 | } |
92 | } |
93 | 93 | ||
94 | 94 | ||
95 | /** Interrupt exception handler. |
95 | /** Interrupt exception handler. |
96 | * |
96 | * |
97 | * @param exc_no Interrupt exception number. |
97 | * @param exc_no Interrupt exception number. |
98 | * @param istate Saved processor state. |
98 | * @param istate Saved processor state. |
99 | */ |
99 | */ |
100 | void machine_irq_exception(int exc_no, istate_t *istate) |
100 | void machine_irq_exception(int exc_no, istate_t *istate) |
101 | { |
101 | { |
102 | (machine_ops.machine_irq_exception)(exc_no, istate); |
102 | (machine_ops.machine_irq_exception)(exc_no, istate); |
103 | } |
103 | } |
104 | 104 | ||
105 | 105 | ||
106 | /** Returns address of framebuffer device. |
106 | /** Returns address of framebuffer device. |
107 | * |
107 | * |
108 | * @return Address of framebuffer device. |
108 | * @return Address of framebuffer device. |
109 | */ |
109 | */ |
110 | uintptr_t machine_get_fb_address(void) |
110 | uintptr_t machine_get_fb_address(void) |
111 | { |
111 | { |
112 | return (machine_ops.machine_get_fb_address)(); |
112 | return (machine_ops.machine_get_fb_address)(); |
113 | } |
113 | } |
114 | 114 | ||
115 | /* |
115 | /* |
116 | * Machine specific frame initialization |
116 | * Machine specific frame initialization |
117 | */ |
117 | */ |
118 | void machine_frame_init(void) |
118 | void machine_frame_init(void) |
119 | { |
119 | { |
120 | (machine_ops.machine_frame_init)(); |
120 | (machine_ops.machine_frame_init)(); |
121 | } |
121 | } |
122 | 122 | ||
123 | /* |
123 | /* |
124 | * configure the output device. |
124 | * configure the output device. |
125 | */ |
125 | */ |
126 | void machine_output_init(void) |
126 | void machine_output_init(void) |
127 | { |
127 | { |
128 | (machine_ops.machine_output_init)(); |
128 | (machine_ops.machine_output_init)(); |
129 | } |
129 | } |
130 | 130 | ||
131 | /* |
131 | /* |
132 | * configure the input device. |
132 | * configure the input device. |
133 | */ |
133 | */ |
134 | void machine_input_init(void) |
134 | void machine_input_init(void) |
135 | { |
135 | { |
136 | (machine_ops.machine_input_init)(); |
136 | (machine_ops.machine_input_init)(); |
137 | } |
137 | } |
138 | 138 | ||
139 | /* |
139 | /* |
140 | * Generic function to use, if sepcific function doesn't define any of the above functions. |
140 | * Generic function to use, if sepcific function doesn't define any of the above functions. |
141 | */ |
141 | */ |
142 | void machine_genfunc() |
142 | void machine_genfunc() |
143 | { |
143 | { |
144 | } |
144 | } |
145 | 145 | ||
146 | /** @} |
146 | /** @} |
147 | */ |
147 | */ |
148 | 148 |