connectTheSignalSlot.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*
  2. * Blackfin core register bit & address definitions
  3. *
  4. * Copyright 2005-2008 Analog Devices Inc.
  5. *
  6. * Licensed under the Clear BSD license or GPL-2 (or later).
  7. */
  8. #ifndef _DEF_LPBLACKFIN_H
  9. #define _DEF_LPBLACKFIN_H
  10. #include <mach/anomaly.h>
  11. #define MK_BMSK_(x) (1<<x)
  12. #define BFIN_DEPOSIT(mask, x) (((x) << __ffs(mask)) & (mask))
  13. #define BFIN_EXTRACT(mask, x) (((x) & (mask)) >> __ffs(mask))
  14. #ifndef __ASSEMBLY__
  15. #include <linux/types.h>
  16. #if ANOMALY_05000198
  17. # define NOP_PAD_ANOMALY_05000198 "nop;"
  18. #else
  19. # define NOP_PAD_ANOMALY_05000198
  20. #endif
  21. #define _bfin_readX(addr, size, asm_size, asm_ext) ({ \
  22. u32 __v; \
  23. __asm__ __volatile__( \
  24. NOP_PAD_ANOMALY_05000198 \
  25. "%0 = " #asm_size "[%1]" #asm_ext ";" \
  26. : "=d" (__v) \
  27. : "a" (addr) \
  28. ); \
  29. __v; })
  30. #define _bfin_writeX(addr, val, size, asm_size) \
  31. __asm__ __volatile__( \
  32. NOP_PAD_ANOMALY_05000198 \
  33. #asm_size "[%0] = %1;" \
  34. : \
  35. : "a" (addr), "d" ((u##size)(val)) \
  36. : "memory" \
  37. )
  38. #define bfin_read8(addr) _bfin_readX(addr, 8, b, (z))
  39. #define bfin_read16(addr) _bfin_readX(addr, 16, w, (z))
  40. #define bfin_read32(addr) _bfin_readX(addr, 32, , )
  41. #define bfin_write8(addr, val) _bfin_writeX(addr, val, 8, b)
  42. #define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w)
  43. #define bfin_write32(addr, val) _bfin_writeX(addr, val, 32, )
  44. #define bfin_read(addr) \
  45. ({ \
  46. sizeof(*(addr)) == 1 ? bfin_read8(addr) : \
  47. sizeof(*(addr)) == 2 ? bfin_read16(addr) : \
  48. sizeof(*(addr)) == 4 ? bfin_read32(addr) : \
  49. ({ BUG(); 0; }); \
  50. })
  51. #define bfin_write(addr, val) \
  52. do { \
  53. switch (sizeof(*(addr))) { \
  54. case 1: bfin_write8(addr, val); break; \
  55. case 2: bfin_write16(addr, val); break; \
  56. case 4: bfin_write32(addr, val); break; \
  57. default: BUG(); \
  58. } \
  59. } while (0)
  60. #define bfin_write_or(addr, bits) \
  61. do { \
  62. typeof(addr) __addr = (addr); \
  63. bfin_write(__addr, bfin_read(__addr) | (bits)); \
  64. } while (0)
  65. #define bfin_write_and(addr, bits) \
  66. do { \
  67. typeof(addr) __addr = (addr); \
  68. bfin_write(__addr, bfin_read(__addr) & (bits)); \
  69. } while (0)
  70. #endif /* __ASSEMBLY__ */
  71. /**************************************************
  72. * System Register Bits
  73. **************************************************/
  74. /**************************************************
  75. * ASTAT register
  76. **************************************************/
  77. /* definitions of ASTAT bit positions*/
  78. /*Result of last ALU0 or shifter operation is zero*/
  79. #define ASTAT_AZ_P 0x00000000
  80. /*Result of last ALU0 or shifter operation is negative*/
  81. #define ASTAT_AN_P 0x00000001
  82. /*Condition Code, used for holding comparison results*/
  83. #define ASTAT_CC_P 0x00000005
  84. /*Quotient Bit*/
  85. #define ASTAT_AQ_P 0x00000006
  86. /*Rounding mode, set for biased, clear for unbiased*/
  87. #define ASTAT_RND_MOD_P 0x00000008
  88. /*Result of last ALU0 operation generated a carry*/
  89. #define ASTAT_AC0_P 0x0000000C
  90. /*Result of last ALU0 operation generated a carry*/
  91. #define ASTAT_AC0_COPY_P 0x00000002
  92. /*Result of last ALU1 operation generated a carry*/
  93. #define ASTAT_AC1_P 0x0000000D
  94. /*Result of last ALU0 or MAC0 operation overflowed, sticky for MAC*/
  95. #define ASTAT_AV0_P 0x00000010
  96. /*Sticky version of ASTAT_AV0 */
  97. #define ASTAT_AV0S_P 0x00000011
  98. /*Result of last MAC1 operation overflowed, sticky for MAC*/
  99. #define ASTAT_AV1_P 0x00000012
  100. /*Sticky version of ASTAT_AV1 */
  101. #define ASTAT_AV1S_P 0x00000013
  102. /*Result of last ALU0 or MAC0 operation overflowed*/
  103. #define ASTAT_V_P 0x00000018
  104. /*Result of last ALU0 or MAC0 operation overflowed*/
  105. #define ASTAT_V_COPY_P 0x00000003
  106. /*Sticky version of ASTAT_V*/
  107. #define ASTAT_VS_P 0x00000019
  108. /* Masks */
  109. /*Result of last ALU0 or shifter operation is zero*/
  110. #define ASTAT_AZ MK_BMSK_(ASTAT_AZ_P)
  111. /*Result of last ALU0 or shifter operation is negative*/
  112. #define ASTAT_AN MK_BMSK_(ASTAT_AN_P)
  113. /*Result of last ALU0 operation generated a carry*/
  114. #define ASTAT_AC0 MK_BMSK_(ASTAT_AC0_P)
  115. /*Result of last ALU0 operation generated a carry*/
  116. #define ASTAT_AC0_COPY MK_BMSK_(ASTAT_AC0_COPY_P)
  117. /*Result of last ALU0 operation generated a carry*/
  118. #define ASTAT_AC1 MK_BMSK_(ASTAT_AC1_P)
  119. /*Result of last ALU0 or MAC0 operation overflowed, sticky for MAC*/
  120. #define ASTAT_AV0 MK_BMSK_(ASTAT_AV0_P)
  121. /*Result of last MAC1 operation overflowed, sticky for MAC*/
  122. #define ASTAT_AV1 MK_BMSK_(ASTAT_AV1_P)
  123. /*Condition Code, used for holding comparison results*/
  124. #define ASTAT_CC MK_BMSK_(ASTAT_CC_P)
  125. /*Quotient Bit*/
  126. #define ASTAT_AQ MK_BMSK_(ASTAT_AQ_P)
  127. /*Rounding mode, set for biased, clear for unbiased*/
  128. #define ASTAT_RND_MOD MK_BMSK_(ASTAT_RND_MOD_P)
  129. /*Overflow Bit*/
  130. #define ASTAT_V MK_BMSK_(ASTAT_V_P)
  131. /*Overflow Bit*/
  132. #define ASTAT_V_COPY MK_BMSK_(ASTAT_V_COPY_P)
  133. /**************************************************
  134. * SEQSTAT register
  135. **************************************************/
  136. /* Bit Positions */
  137. #define SEQSTAT_EXCAUSE0_P 0x00000000 /* Last exception cause bit 0 */
  138. #define SEQSTAT_EXCAUSE1_P 0x00000001 /* Last exception cause bit 1 */
  139. #define SEQSTAT_EXCAUSE2_P 0x00000002 /* Last exception cause bit 2 */
  140. #define SEQSTAT_EXCAUSE3_P 0x00000003 /* Last exception cause bit 3 */
  141. #define SEQSTAT_EXCAUSE4_P 0x00000004 /* Last exception cause bit 4 */
  142. #define SEQSTAT_EXCAUSE5_P 0x00000005 /* Last exception cause bit 5 */
  143. #define SEQSTAT_IDLE_REQ_P 0x0000000C /* Pending idle mode request,
  144. * set by IDLE instruction.
  145. */
  146. #define SEQSTAT_SFTRESET_P 0x0000000D /* Indicates whether the last
  147. * reset was a software reset
  148. * (=1)
  149. */
  150. #define SEQSTAT_HWERRCAUSE0_P 0x0000000E /* Last hw error cause bit 0 */
  151. #define SEQSTAT_HWERRCAUSE1_P 0x0000000F /* Last hw error cause bit 1 */
  152. #define SEQSTAT_HWERRCAUSE2_P 0x00000010 /* Last hw error cause bit 2 */
  153. #define SEQSTAT_HWERRCAUSE3_P 0x00000011 /* Last hw error cause bit 3 */
  154. #define SEQSTAT_HWERRCAUSE4_P 0x00000012 /* Last hw error cause bit 4 */
  155. /* Masks */
  156. /* Exception cause */
  157. #define SEQSTAT_EXCAUSE (MK_BMSK_(SEQSTAT_EXCAUSE0_P) | \
  158. MK_BMSK_(SEQSTAT_EXCAUSE1_P) | \
  159. MK_BMSK_(SEQSTAT_EXCAUSE2_P) | \
  160. MK_BMSK_(SEQSTAT_EXCAUSE3_P) | \
  161. MK_BMSK_(SEQSTAT_EXCAUSE4_P) | \
  162. MK_BMSK_(SEQSTAT_EXCAUSE5_P) | \
  163. 0)
  164. /* Indicates whether the last reset was a software reset (=1) */
  165. #define SEQSTAT_SFTRESET (MK_BMSK_(SEQSTAT_SFTRESET_P))
  166. /* Last hw error cause */
  167. #define SEQSTAT_HWERRCAUSE (MK_BMSK_(SEQSTAT_HWERRCAUSE0_P) | \
  168. MK_BMSK_(SEQSTAT_HWERRCAUSE1_P) | \
  169. MK_BMSK_(SEQSTAT_HWERRCAUSE2_P) | \
  170. MK_BMSK_(SEQSTAT_HWERRCAUSE3_P) | \
  171. MK_BMSK_(SEQSTAT_HWERRCAUSE4_P) | \
  172. 0)
  173. /* Translate bits to something useful */
  174. /* Last hw error cause */
  175. #define SEQSTAT_HWERRCAUSE_SHIFT (14)
  176. #define SEQSTAT_HWERRCAUSE_SYSTEM_MMR (0x02 << SEQSTAT_HWERRCAUSE_SHIFT)
  177. #define SEQSTAT_HWERRCAUSE_EXTERN_ADDR (0x03 << SEQSTAT_HWERRCAUSE_SHIFT)
  178. #define SEQSTAT_HWERRCAUSE_PERF_FLOW (0x12 << SEQSTAT_HWERRCAUSE_SHIFT)
  179. #define SEQSTAT_HWERRCAUSE_RAISE_5 (0x18 << SEQSTAT_HWERRCAUSE_SHIFT)
  180. /**************************************************
  181. * SYSCFG register
  182. **************************************************/
  183. /* Bit Positions */
  184. #define SYSCFG_SSSTEP_P 0x00000000 /* Supervisor single step, when
  185. * set it forces an exception
  186. * for each instruction executed
  187. */
  188. #define SYSCFG_CCEN_P 0x00000001 /* Enable cycle counter (=1) */
  189. #define SYSCFG_SNEN_P 0x00000002 /* Self nesting Interrupt Enable */
  190. /* Masks */
  191. /* Supervisor single step, when set it forces an exception for each
  192. *instruction executed
  193. */
  194. #define SYSCFG_SSSTEP MK_BMSK_(SYSCFG_SSSTEP_P )
  195. /* Enable cycle counter (=1) */
  196. #define SYSCFG_CCEN MK_BMSK_(SYSCFG_CCEN_P )
  197. /* Self Nesting Interrupt Enable */
  198. #define SYSCFG_SNEN MK_BMSK_(SYSCFG_SNEN_P)
  199. /* Backward-compatibility for typos in prior releases */
  200. #define SYSCFG_SSSSTEP SYSCFG_SSSTEP
  201. #define SYSCFG_CCCEN SYSCFG_CCEN
  202. /****************************************************
  203. * Core MMR Register Map
  204. ****************************************************/
  205. /* Data Cache & SRAM Memory (0xFFE00000 - 0xFFE00404) */
  206. #define SRAM_BASE_ADDRESS 0xFFE00000 /* SRAM Base Address Register */
  207. #define DMEM_CONTROL 0xFFE00004 /* Data memory control */
  208. #define DCPLB_STATUS 0xFFE00008 /* Data Cache Programmable Look-Aside
  209. * Buffer Status
  210. */
  211. #define DCPLB_FAULT_STATUS 0xFFE00008 /* "" (older define) */
  212. #define DCPLB_FAULT_ADDR 0xFFE0000C /* Data Cache Programmable Look-Aside
  213. * Buffer Fault Address
  214. */
  215. #define DCPLB_ADDR0 0xFFE00100 /* Data Cache Protection Lookaside
  216. * Buffer 0
  217. */
  218. #define DCPLB_ADDR1 0xFFE00104 /* Data Cache Protection Lookaside
  219. * Buffer 1
  220. */
  221. #define DCPLB_ADDR2 0xFFE00108 /* Data Cache Protection Lookaside
  222. * Buffer 2
  223. */
  224. #define DCPLB_ADDR3 0xFFE0010C /* Data Cacheability Protection
  225. * Lookaside Buffer 3
  226. */
  227. #define DCPLB_ADDR4 0xFFE00110 /* Data Cacheability Protection
  228. * Lookaside Buffer 4
  229. */