system.h 536 B

1234567891011121314151617181920212223242526
  1. /*
  2. * (C) Copyright 2011, Julius Baxter <julius@opencores.org>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __ASM_OPENRISC_SYSTEM_H
  7. #define __ASM_OPENRISC_SYSTEM_H
  8. #include <asm/spr-defs.h>
  9. static inline unsigned long mfspr(unsigned long add)
  10. {
  11. unsigned long ret;
  12. __asm__ __volatile__ ("l.mfspr %0,r0,%1" : "=r" (ret) : "K" (add));
  13. return ret;
  14. }
  15. static inline void mtspr(unsigned long add, unsigned long val)
  16. {
  17. __asm__ __volatile__ ("l.mtspr r0,%1,%0" : : "K" (add), "r" (val));
  18. }
  19. #endif /* __ASM_OPENRISC_SYSTEM_H */