hw_host1x01_channel.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (c) 2012-2013, NVIDIA Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. /*
  18. * Function naming determines intended use:
  19. *
  20. * <x>_r(void) : Returns the offset for register <x>.
  21. *
  22. * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
  23. *
  24. * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
  25. *
  26. * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted
  27. * and masked to place it at field <y> of register <x>. This value
  28. * can be |'d with others to produce a full register value for
  29. * register <x>.
  30. *
  31. * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This
  32. * value can be ~'d and then &'d to clear the value of field <y> for
  33. * register <x>.
  34. *
  35. * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted
  36. * to place it at field <y> of register <x>. This value can be |'d
  37. * with others to produce a full register value for <x>.
  38. *
  39. * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register
  40. * <x> value 'r' after being shifted to place its LSB at bit 0.
  41. * This value is suitable for direct comparison with other unshifted
  42. * values appropriate for use in field <y> of register <x>.
  43. *
  44. * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for
  45. * field <y> of register <x>. This value is suitable for direct
  46. * comparison with unshifted values appropriate for use in field <y>
  47. * of register <x>.
  48. */
  49. #ifndef __hw_host1x_channel_host1x_h__
  50. #define __hw_host1x_channel_host1x_h__
  51. static inline u32 host1x_channel_fifostat_r(void)
  52. {
  53. return 0x0;
  54. }
  55. #define HOST1X_CHANNEL_FIFOSTAT \
  56. host1x_channel_fifostat_r()
  57. static inline u32 host1x_channel_fifostat_cfempty_v(u32 r)
  58. {
  59. return (r >> 10) & 0x1;
  60. }
  61. #define HOST1X_CHANNEL_FIFOSTAT_CFEMPTY_V(r) \
  62. host1x_channel_fifostat_cfempty_v(r)
  63. static inline u32 host1x_channel_dmastart_r(void)
  64. {
  65. return 0x14;
  66. }
  67. #define HOST1X_CHANNEL_DMASTART \
  68. host1x_channel_dmastart_r()
  69. static inline u32 host1x_channel_dmaput_r(void)
  70. {
  71. return 0x18;
  72. }
  73. #define HOST1X_CHANNEL_DMAPUT \
  74. host1x_channel_dmaput_r()
  75. static inline u32 host1x_channel_dmaget_r(void)
  76. {
  77. return 0x1c;
  78. }
  79. #define HOST1X_CHANNEL_DMAGET \
  80. host1x_channel_dmaget_r()
  81. static inline u32 host1x_channel_dmaend_r(void)
  82. {
  83. return 0x20;
  84. }
  85. #define HOST1X_CHANNEL_DMAEND \
  86. host1x_channel_dmaend_r()
  87. static inline u32 host1x_channel_dmactrl_r(void)
  88. {
  89. return 0x24;
  90. }
  91. #define HOST1X_CHANNEL_DMACTRL \
  92. host1x_channel_dmactrl_r()
  93. static inline u32 host1x_channel_dmactrl_dmastop(void)
  94. {
  95. return 1 << 0;
  96. }
  97. #define HOST1X_CHANNEL_DMACTRL_DMASTOP \
  98. host1x_channel_dmactrl_dmastop()
  99. static inline u32 host1x_channel_dmactrl_dmastop_v(u32 r)
  100. {
  101. return (r >> 0) & 0x1;
  102. }
  103. #define HOST1X_CHANNEL_DMACTRL_DMASTOP_V(r) \
  104. host1x_channel_dmactrl_dmastop_v(r)
  105. static inline u32 host1x_channel_dmactrl_dmagetrst(void)
  106. {
  107. return 1 << 1;
  108. }
  109. #define HOST1X_CHANNEL_DMACTRL_DMAGETRST \
  110. host1x_channel_dmactrl_dmagetrst()
  111. static inline u32 host1x_channel_dmactrl_dmainitget(void)
  112. {
  113. return 1 << 2;
  114. }
  115. #define HOST1X_CHANNEL_DMACTRL_DMAINITGET \
  116. host1x_channel_dmactrl_dmainitget()
  117. #endif