sshmedia.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. /* sshmedia.h: Intrinsics corresponding to SHmedia instructions that
  19. may only be executed in privileged mode. */
  20. #ifndef _SSHMEDIA_H
  21. #define _SSHMEDIA_H
  22. #if __SHMEDIA__
  23. __inline__ static unsigned long long sh_media_GETCON (unsigned int k)
  24. __attribute__((always_inline));
  25. __inline__ static
  26. unsigned long long
  27. sh_media_GETCON (unsigned int k)
  28. {
  29. unsigned long long res;
  30. __asm__ __volatile__ ("getcon cr%1, %0" : "=r" (res) : "n" (k));
  31. return res;
  32. }
  33. __inline__ static void sh_media_PUTCON (unsigned long long mm, unsigned int k)
  34. __attribute__((always_inline));
  35. __inline__ static
  36. void
  37. sh_media_PUTCON (unsigned long long mm, unsigned int k)
  38. {
  39. __asm__ __volatile__ ("putcon %0, cr%1" : : "r" (mm), "n" (k));
  40. }
  41. __inline__ static
  42. unsigned long long
  43. sh_media_GETCFG (unsigned long long mm, int s)
  44. {
  45. unsigned long long res;
  46. __asm__ __volatile__ ("getcfg %1, %2, %0" : "=r" (res) : "r" (mm), "n" (s));
  47. return res;
  48. }
  49. __inline__ static
  50. void
  51. sh_media_PUTCFG (unsigned long long mm, int s, unsigned long long mw)
  52. {
  53. __asm__ __volatile__ ("putcfg %0, %1, %2" : : "r" (mm), "n" (s), "r" (mw));
  54. }
  55. __inline__ static
  56. void
  57. sh_media_SLEEP (void)
  58. {
  59. __asm__ __volatile__ ("sleep");
  60. }
  61. #endif
  62. #endif