io.h 740 B

12345678910111213141516171819202122
  1. /* Copyright 2018 SiFive, Inc */
  2. /* SPDX-License-Identifier: Apache-2.0 */
  3. #ifndef METAL__IO_H
  4. #define METAL__IO_H
  5. /* This macro enforces that the compiler will not elide the given access. */
  6. #define __METAL_ACCESS_ONCE(x) (*(__typeof__(*x) volatile *)(x))
  7. /* Allows users to specify arbitrary fences. */
  8. #define __METAL_IO_FENCE(pred, succ) __asm__ volatile ("fence " #pred "," #succ ::: "memory");
  9. /* Types that explicitly describe an address as being used for memory-mapped
  10. * IO. These should only be accessed via __METAL_ACCESS_ONCE. */
  11. typedef unsigned char __metal_io_u8;
  12. typedef unsigned short __metal_io_u16;
  13. typedef unsigned int __metal_io_u32;
  14. #if __riscv_xlen >= 64
  15. typedef unsigned long __metal_io_u64;
  16. #endif
  17. #endif