blob: d5bafd01e742ad5c6652acfdec37a428f8ed9b8e [file] [log] [blame]
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07001/*
2 * Copyright (c) 2008 Travis Geiselbrecht
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23#ifndef __ARCH_OPS_H
24#define __ARCH_OPS_H
25
26#ifndef ASSEMBLY
27
28#include <sys/types.h>
29#include <compiler.h>
30
31#if defined(__cplusplus)
32extern "C" {
33#endif
34
35void arch_enable_ints(void);
36void arch_disable_ints(void);
37
38int atomic_swap(volatile int *ptr, int val);
39int atomic_add(volatile int *ptr, int val);
40int atomic_and(volatile int *ptr, int val);
41int atomic_or(volatile int *ptr, int val);
42
43#endif // !ASSEMBLY
44#define ICACHE 1
45#define DCACHE 2
46#define UCACHE (ICACHE|DCACHE)
47#ifndef ASSEMBLY
48
49void arch_disable_cache(uint flags);
50void arch_enable_cache(uint flags);
51
52void arch_clean_cache_range(addr_t start, size_t len);
53void arch_clean_invalidate_cache_range(addr_t start, size_t len);
54
55void arch_idle(void);
56
57void arch_disable_mmu(void);
58
59void arch_switch_stacks_and_call(addr_t call, addr_t stack) __NO_RETURN;
60
61#if defined(__cplusplus)
62}
63#endif
64
65#endif // !ASSEMBLY
66
67#if ARCH_ARM
68#include <arch/arm/ops.h>
69#endif
70
71#endif