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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 002fd5f was e29e44bf, checked in by Jiri Svoboda <jiri@…>, 8 years ago

Kernel should have stddef.h

  • 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 <stddef.h>
41#include <arch/machine_func.h>
42#if defined(MACHINE_msim)
43#include <arch/mach/msim/msim.h>
44#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
45#include <arch/mach/malta/malta.h>
46#endif
47
48/** Pointer to machine_ops structure being used. */
49struct mips32_machine_ops *machine_ops;
50
51/** Initialize machine_ops pointer. */
52void machine_ops_init(void)
53{
54#if defined(MACHINE_msim)
55 machine_ops = &msim_machine_ops;
56#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
57 machine_ops = &malta_machine_ops;
58#else
59#error Machine type not defined.
60#endif
61}
62
63void machine_init(void)
64{
65 (machine_ops->machine_init)();
66}
67
68
69/** Halts CPU. */
70void machine_cpu_halt(void)
71{
72 (machine_ops->machine_cpu_halt)();
73}
74
75/** Get extents of available memory.
76 *
77 * @param start Place to store memory start address.
78 * @param size Place to store memory size.
79 */
80void machine_get_memory_extents(uintptr_t *start, size_t *size)
81{
82 (machine_ops->machine_get_memory_extents)(start, size);
83}
84
85/*
86 * Machine specific frame initialization
87 */
88void machine_frame_init(void)
89{
90 (machine_ops->machine_frame_init)();
91}
92
93/*
94 * configure the output device.
95 */
96void machine_output_init(void)
97{
98 (machine_ops->machine_output_init)();
99}
100
101/*
102 * configure the input device.
103 */
104void machine_input_init(void)
105{
106 (machine_ops->machine_input_init)();
107}
108
109const char *machine_get_platform_name(void)
110{
111 if (machine_ops->machine_get_platform_name)
112 return machine_ops->machine_get_platform_name();
113 return NULL;
114}
115
116/** @}
117 */
Note: See TracBrowser for help on using the repository browser.