ops.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #ifndef ASSEMBLY
  26. #include <sys/types.h>
  27. #include <compiler.h>
  28. #if defined(__cplusplus)
  29. extern "C" {
  30. #endif
  31. void arch_enable_ints(void);
  32. void arch_disable_ints(void);
  33. int atomic_swap(volatile int *ptr, int val);
  34. int atomic_add(volatile int *ptr, int val);
  35. int atomic_and(volatile int *ptr, int val);
  36. int atomic_or(volatile int *ptr, int val);
  37. #endif // !ASSEMBLY
  38. #define ICACHE 1
  39. #define DCACHE 2
  40. #define UCACHE (ICACHE|DCACHE)
  41. #ifndef ASSEMBLY
  42. void arch_disable_cache(uint flags);
  43. void arch_enable_cache(uint flags);
  44. void arch_clean_cache_range(addr_t start, size_t len);
  45. void arch_clean_invalidate_cache_range(addr_t start, size_t len);
  46. void arch_invalidate_cache_range(addr_t start, size_t len);
  47. void arch_sync_cache_range(addr_t start, size_t len);
  48. void arch_idle(void);
  49. void arch_disable_mmu(void);
  50. void arch_enable_mmu(void);
  51. void arch_switch_stacks_and_call(addr_t call, addr_t stack) __NO_RETURN;
  52. uint32_t arch_cycle_count(void);
  53. #if defined(__cplusplus)
  54. }
  55. #endif
  56. #endif // !ASSEMBLY
  57. #if ARCH_ARM
  58. #include <arch/arm/ops.h>
  59. #endif
  60. #endif