source: mainline/kernel/arch/abs32le/include/arch/asm.h@ 011c79a

ticket/834-toolchain-update topic/fix-logger-deadlock topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 011c79a was 8addb24a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Turn spin look hint into a function

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*
2 * Copyright (c) 2010 Martin Decky
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 kernel_abs32le
30 * @{
31 */
32/** @file
33 */
34
35#ifndef KERN_abs32le_ASM_H_
36#define KERN_abs32le_ASM_H_
37
38#include <typedefs.h>
39#include <config.h>
40#include <trace.h>
41
42_NO_TRACE static inline void asm_delay_loop(uint32_t usec)
43{
44}
45
46_NO_TRACE static inline __attribute__((noreturn)) void cpu_halt(void)
47{
48 /*
49 * On real hardware this should stop processing further
50 * instructions on the CPU (and possibly putting it into
51 * low-power mode) without any possibility of exitting
52 * this function.
53 */
54
55 while (true)
56 ;
57}
58
59_NO_TRACE static inline void cpu_sleep(void)
60{
61 /*
62 * On real hardware this should put the CPU into low-power
63 * mode. However, the CPU is free to continue processing
64 * futher instructions any time. The CPU also wakes up
65 * upon an interrupt.
66 */
67}
68
69_NO_TRACE static inline void cpu_spin_hint(void)
70{
71 /*
72 * Some ISAs have a special instruction for the body of a busy wait loop,
73 * such as in spinlock and the like. Using it allows the CPU to optimize
74 * its operation. For an example, see the "pause" instruction on x86.
75 */
76}
77
78_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
79{
80}
81
82/** Word to port
83 *
84 * Output word to port
85 *
86 * @param port Port to write to
87 * @param val Value to write
88 *
89 */
90_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
91{
92}
93
94/** Double word to port
95 *
96 * Output double word to port
97 *
98 * @param port Port to write to
99 * @param val Value to write
100 *
101 */
102_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
103{
104}
105
106/** Byte from port
107 *
108 * Get byte from port
109 *
110 * @param port Port to read from
111 * @return Value read
112 *
113 */
114_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
115{
116 return 0;
117}
118
119/** Word from port
120 *
121 * Get word from port
122 *
123 * @param port Port to read from
124 * @return Value read
125 *
126 */
127_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
128{
129 return 0;
130}
131
132/** Double word from port
133 *
134 * Get double word from port
135 *
136 * @param port Port to read from
137 * @return Value read
138 *
139 */
140_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
141{
142 return 0;
143}
144
145_NO_TRACE static inline ipl_t interrupts_enable(void)
146{
147 /*
148 * On real hardware this unconditionally enables preemption
149 * by internal and external interrupts.
150 *
151 * The return value stores the previous interrupt level.
152 */
153
154 return 0;
155}
156
157_NO_TRACE static inline ipl_t interrupts_disable(void)
158{
159 /*
160 * On real hardware this disables preemption by the usual
161 * set of internal and external interrupts. This does not
162 * apply to special non-maskable interrupts and sychronous
163 * CPU exceptions.
164 *
165 * The return value stores the previous interrupt level.
166 */
167
168 return 0;
169}
170
171_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
172{
173 /*
174 * On real hardware this either enables or disables preemption
175 * according to the interrupt level value from the argument.
176 */
177}
178
179_NO_TRACE static inline ipl_t interrupts_read(void)
180{
181 /*
182 * On real hardware the return value stores the current interrupt
183 * level.
184 */
185
186 return 0;
187}
188
189_NO_TRACE static inline bool interrupts_disabled(void)
190{
191 /*
192 * On real hardware the return value is true iff interrupts are
193 * disabled.
194 */
195
196 return false;
197}
198
199#endif
200
201/** @}
202 */
Note: See TracBrowser for help on using the repository browser.