Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 1 | /* |
| 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) |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
| 35 | void arch_enable_ints(void); |
| 36 | void arch_disable_ints(void); |
| 37 | |
| 38 | int atomic_swap(volatile int *ptr, int val); |
| 39 | int atomic_add(volatile int *ptr, int val); |
| 40 | int atomic_and(volatile int *ptr, int val); |
| 41 | int 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 | |
| 49 | void arch_disable_cache(uint flags); |
| 50 | void arch_enable_cache(uint flags); |
| 51 | |
| 52 | void arch_clean_cache_range(addr_t start, size_t len); |
| 53 | void arch_clean_invalidate_cache_range(addr_t start, size_t len); |
Travis Geiselbrecht | 8b99c68 | 2010-06-16 00:37:13 -0700 | [diff] [blame] | 54 | void arch_invalidate_cache_range(addr_t start, size_t len); |
| 55 | void arch_sync_cache_range(addr_t start, size_t len); |
Deepa Dinamani | 65df150 | 2013-07-29 13:23:04 -0700 | [diff] [blame] | 56 | void cache_clean_invalidate_unaligned_start_addr(addr_t start, size_t size); |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 57 | |
| 58 | void arch_idle(void); |
| 59 | |
| 60 | void arch_disable_mmu(void); |
| 61 | |
| 62 | void arch_switch_stacks_and_call(addr_t call, addr_t stack) __NO_RETURN; |
| 63 | |
Ajay Dudani | ca0b6a2 | 2011-05-18 19:48:32 -0700 | [diff] [blame] | 64 | uint32_t arch_cycle_count(void); |
| 65 | |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 66 | #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 |