blob: 26d0642d2e9a598d0978248721f0d0efd7aa02e8 [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);
Travis Geiselbrecht8b99c682010-06-16 00:37:13 -070054void arch_invalidate_cache_range(addr_t start, size_t len);
55void arch_sync_cache_range(addr_t start, size_t len);
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070056
57void arch_idle(void);
58
59void arch_disable_mmu(void);
60
61void arch_switch_stacks_and_call(addr_t call, addr_t stack) __NO_RETURN;
62
Ajay Dudanica0b6a22011-05-18 19:48:32 -070063uint32_t arch_cycle_count(void);
64
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070065#if defined(__cplusplus)
66}
67#endif
68
69#endif // !ASSEMBLY
70
71#if ARCH_ARM
72#include <arch/arm/ops.h>
73#endif
74
75#endif