blob: 9f95e2b5cb25ed22d82f04616d031a35cc55ab93 [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);
Deepa Dinamani65df1502013-07-29 13:23:04 -070056void cache_clean_invalidate_unaligned_start_addr(addr_t start, size_t size);
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070057
58void arch_idle(void);
59
60void arch_disable_mmu(void);
61
62void arch_switch_stacks_and_call(addr_t call, addr_t stack) __NO_RETURN;
63
Ajay Dudanica0b6a22011-05-18 19:48:32 -070064uint32_t arch_cycle_count(void);
65
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070066#if defined(__cplusplus)
67}
68#endif
69
70#endif // !ASSEMBLY
71
72#if ARCH_ARM
73#include <arch/arm/ops.h>
74#endif
75
76#endif