source: mainline/kernel/arch/arm32/src/machine_func.c@ c520034

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since c520034 was 2686705, checked in by Jakub Jermar <jakub@…>, 14 years ago

Use frame_adjust_zone_bounds() on arm32.

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[6ac14a70]1/*
2 * Copyright (c) 2009 Vineeth Pillai
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
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
15 * derived from this software without specific prior written permission.
16 *
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
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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
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
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup arm32
30 * @{
31 */
32/** @file
33 * @brief Definitions of machine specific functions.
34 *
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
37 * level.
38 */
39
40#include <arch/machine_func.h>
[7c866dc]41#include <arch/mach/gta02/gta02.h>
[66fcba2]42#include <arch/mach/integratorcp/integratorcp.h>
43#include <arch/mach/testarm/testarm.h>
[6ac14a70]44
[66fcba2]45/** Pointer to machine_ops structure being used. */
46struct arm_machine_ops *machine_ops;
47
48/** Initialize machine_ops pointer. */
49void machine_ops_init(void)
50{
[7c866dc]51#if defined(MACHINE_gta02)
52 machine_ops = &gta02_machine_ops;
53#elif defined(MACHINE_testarm)
[66fcba2]54 machine_ops = &gxemul_machine_ops;
55#elif defined(MACHINE_integratorcp)
56 machine_ops = &icp_machine_ops;
57#else
58#error Machine type not defined.
59#endif
60}
[6ac14a70]61
62/** Maps HW devices to the kernel address space using #hw_map. */
63void machine_init(void)
64{
[66fcba2]65 (machine_ops->machine_init)();
[6ac14a70]66}
67
68
69/** Starts timer. */
70void machine_timer_irq_start(void)
71{
[66fcba2]72 (machine_ops->machine_timer_irq_start)();
[6ac14a70]73}
74
75
76/** Halts CPU. */
77void machine_cpu_halt(void)
78{
[66fcba2]79 (machine_ops->machine_cpu_halt)();
[6ac14a70]80}
81
[d7ef14b]82/** Get extents of available memory.
[6ac14a70]83 *
[d7ef14b]84 * @param start Place to store memory start address.
85 * @param size Place to store memory size.
[6ac14a70]86 */
[2686705]87void machine_get_memory_extents(uintptr_t *start, size_t *size)
[6ac14a70]88{
[d7ef14b]89 (machine_ops->machine_get_memory_extents)(start, size);
[6ac14a70]90}
91
92/** Interrupt exception handler.
93 *
94 * @param exc_no Interrupt exception number.
95 * @param istate Saved processor state.
96 */
[214ec25c]97void machine_irq_exception(unsigned int exc_no, istate_t *istate)
[6ac14a70]98{
[66fcba2]99 (machine_ops->machine_irq_exception)(exc_no, istate);
[6ac14a70]100}
101
102
103/*
104 * Machine specific frame initialization
105 */
106void machine_frame_init(void)
107{
[66fcba2]108 (machine_ops->machine_frame_init)();
[6ac14a70]109}
110
111/*
112 * configure the output device.
113 */
114void machine_output_init(void)
115{
[66fcba2]116 (machine_ops->machine_output_init)();
[6ac14a70]117}
118
119/*
120 * configure the input device.
121 */
122void machine_input_init(void)
123{
[66fcba2]124 (machine_ops->machine_input_init)();
[6ac14a70]125}
126
[0e796cc]127/** Get IRQ number range used by machine. */
128size_t machine_get_irq_count(void)
129{
[ecf083dd]130 return (machine_ops->machine_get_irq_count)();
[0e796cc]131}
132
[6ac14a70]133/** @}
134 */
Note: See TracBrowser for help on using the repository browser.