source: mainline/kernel/arch/mips32/src/machine_func.c@ ae7ba7b6

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

Prepare infrastructure for mips32 machine ops.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 * Copyright (c) 2009 Vineeth Pillai
3 * Copyright (c) 2012 Jakub Jermar
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup mips32
31 * @{
32 */
33/** @file
34 * @brief Definitions of machine specific functions.
35 *
36 * These functions allow us to support various kinds of mips32 machines
37 * in a unified way.
38 */
39
40#include <arch/machine_func.h>
41#if defined(MACHINE_msim)
42#include <arch/mach/msim/msim.h>
43#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
44#include <arch/mach/malta/malta.h>
45#endif
46
47/** Pointer to machine_ops structure being used. */
48struct mips32_machine_ops *machine_ops;
49
50/** Initialize machine_ops pointer. */
51void machine_ops_init(void)
52{
53#if defined(MACHINE_msim)
54 machine_ops = &msim_machine_ops;
55#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
56 machine_ops = &malta_machine_ops;
57#else
58#error Machine type not defined.
59#endif
60}
61
62void machine_init(void)
63{
64 (machine_ops->machine_init)();
65}
66
67
68/** Halts CPU. */
69void machine_cpu_halt(void)
70{
71 (machine_ops->machine_cpu_halt)();
72}
73
74/** Get extents of available memory.
75 *
76 * @param start Place to store memory start address.
77 * @param size Place to store memory size.
78 */
79void machine_get_memory_extents(uintptr_t *start, size_t *size)
80{
81 (machine_ops->machine_get_memory_extents)(start, size);
82}
83
84/*
85 * Machine specific frame initialization
86 */
87void machine_frame_init(void)
88{
89 (machine_ops->machine_frame_init)();
90}
91
92/*
93 * configure the output device.
94 */
95void machine_output_init(void)
96{
97 (machine_ops->machine_output_init)();
98}
99
100/*
101 * configure the input device.
102 */
103void machine_input_init(void)
104{
105 (machine_ops->machine_input_init)();
106}
107
108const char *machine_get_platform_name(void)
109{
110 if (machine_ops->machine_get_platform_name)
111 return machine_ops->machine_get_platform_name();
112 return NULL;
113}
114
115/** @}
116 */
Note: See TracBrowser for help on using the repository browser.