tmsgheaders.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. #ifndef DMADRIVER_TMSGHEADERS_H
  2. #define DMADRIVER_TMSGHEADERS_H
  3. #include <stdint.h>
  4. #include <unistd.h>
  5. #include <stdio.h>
  6. // Device address
  7. #define TMSG_BASE_ADDR 0x04
  8. // Device IDs
  9. #define DeviceIdLmx2594 0x0
  10. #define DeviceIdDDS 0x1
  11. #define DeviceIdPot 0x2
  12. #define DeviceIdDac 0x3
  13. #define DeviceIdAtt 0x4
  14. #define DeviceIdShReg 0x5
  15. #define DeviceIdMax2870 0x6
  16. #define DeviceIdGpio1 0x7
  17. #define DeviceIdTemp 0x8
  18. #define DeviceIdGpio2 0x9
  19. #define SB_HEADER_TERM_BIT_BITP 0
  20. #define SB_HEADER_1MOSI_WORD_NUM_BITP 1
  21. #define SB_HEADER_1MOSI_DEVICE_ID_BITP 18
  22. #define SB_HEADER_SPI_MODE_BITP 23
  23. #define SB_HEADER_TERM_BIT_0 (0x0 << SB_HEADER_TERM_BIT_BITP)
  24. #define SB_HEADER_TERM_BIT_1 (0x1 << SB_HEADER_TERM_BIT_BITP)
  25. #define SB_HEADER_SPI_MODE_1MOSI (0x0 << SB_HEADER_SPI_MODE_BITP)
  26. #define SB_HEADER_SPI_MODE_4MOSI (0x1 << SB_HEADER_SPI_MODE_BITP)
  27. // Init Word Numbers 1 MOSI
  28. #define Gpio1InitWordNum 2
  29. #define Gpio2InitWordNum 1
  30. #define PotWordInitNum 1
  31. #define DacWordInitNum 1
  32. #define AttWordInitNum 1
  33. #define ShRegWordInitNum 1
  34. #define Lmx2594InitWordNum 113
  35. #define DDSInitWordNum 37
  36. #define MaxInitWordNum 6
  37. #define TempSensWordNum 1
  38. // Bit Positions
  39. #define RF_SW1_BITP 0
  40. #define RF_SW2_BITP 1
  41. #define CTRL_AM_SW3_BITP 2
  42. #define DDS_SYNC_CTRL_FPGA_BITP 3
  43. #define DDS_RESET_FPGA_BITP 4
  44. #define DDS_SYNC_FPGA_BITP 5
  45. #define SW_CAP4_BITP 6
  46. #define AM_ALC_SW_BITP 7
  47. #define SW_CAP3_BITP 8
  48. #define SW_CAP2_BITP 9
  49. #define SW_CAP1_BITP 10
  50. #define AM_ALC_1_FIX_BITP 11
  51. #define PLL_VTUNE_CTRL_BITP 12
  52. #define PLL_SYNC_CTRL_BITP 13
  53. #define PLL_SYNC_BITP 14
  54. #define PLL_LOOP_CTRL_BITP 15
  55. #define DDS_X2_FPGA_BITP 16
  56. #define DDS_SAW2_FPGA_BITP 17
  57. #define REF_OFFSET_CTRL_FPGA_BITP 18
  58. #define GPIO_ADRF_V1_BITP 19
  59. #define GPIO_ADRF_V2_BITP 20
  60. #define DDS_SAW1_FPGA_BITP 21
  61. // Headers 1-MOSI
  62. #define LMX2594_RST_HEADER ((0 << 23) | (DeviceIdLmx2594 << 18) | (2 << 1) | 1)
  63. #define GPIO_INIT_HEADER ((0 << 23) | (DeviceIdGpio1 << 18) | (Gpio1InitWordNum << 1) | 1)
  64. #define InitGpio2Header ((0 << 23) | (DeviceIdGpio2 << 18) | (Gpio2InitWordNum << 1) | 1)
  65. #define TempSensHeader ((0 << 23) | (DeviceIdTemp << 18) | (TempSensWordNum << 1) | 1)
  66. #define InitLMX2594Header ((0 << 23) | (DeviceIdLmx2594 << 18) | (Lmx2594InitWordNum << 1) | 1)
  67. #define InitDDSHeader ((0 << 23) | (DeviceIdDDS << 18) | (DDSInitWordNum << 1) | 1)
  68. #define InitMAX2870Header ((0 << 23) | (DeviceIdMax2870 << 18) | (MaxInitWordNum << 1) | 1)
  69. #define InitPotHeader ((0 << 23) | (DeviceIdPot << 18) | (PotWordInitNum << 1) | 1)
  70. #define InitDacHeader ((0 << 23) | (DeviceIdDac << 18) | (DacWordInitNum << 1) | 1)
  71. #define InitAttHeader ((0 << 23) | (DeviceIdAtt << 18) | (AttWordInitNum << 1) | 1)
  72. #define InitShRegHeader ((0 << 23) | (DeviceIdShReg << 18) | (ShRegWordInitNum << 1) | 1)
  73. // Headers 4-Mosi
  74. #define BITP_LMX2594_4MOSI_HEADER 12
  75. //Bit mask [15:12]
  76. #define BITM_LMX2594_4MOSI_HEADER (0xF << BITP_LMX2594_4MOSI_HEADER)
  77. #define BITP_DDS_4MOSI_HEADER 19
  78. //Bit mask [21:19]
  79. #define BITM_DDS_4MOSI_HEADER (0x7 << BITP_DDS_4MOSI_HEADER)
  80. // MAX2870
  81. #define BITP_MAX2870_4MOSI_HEADER 9
  82. //Bit mask [10:9]
  83. #define BITM_MAX2870_4MOSI_HEADER (0x3 << BITP_MAX2870_4MOSI_HEADER)
  84. //Shift Reg
  85. #define BITP_SHIFT_REG_4MOSI_HEADER 6
  86. //Bit mask [7:6]
  87. #define BITM_SHIFT_REG_4MOSI_HEADER (0x3 << BITP_SHIFT_REG_4MOSI_HEADER)
  88. // GPIO
  89. #define BITP_GPIO_4MOSI_HEADER 16
  90. //Bit mask [17:16]
  91. #define BITM_GPIO_4MOSI_HEADER (0x3 << BITP_GPIO_4MOSI_HEADER)
  92. // POT
  93. #define BITP_POT_4MOSI_HEADER 3
  94. //Bit mask [4:3]
  95. #define BITM_POT_4MOSI_HEADER (0x3 << BITP_POT_4MOSI_HEADER)
  96. // DAC
  97. #define BITP_DAC_4MOSI_HEADER 2
  98. //Bit mask [2:2]
  99. #define BITM_DAC_4MOSI_HEADER (0x1 << BITP_DAC_4MOSI_HEADER)
  100. // ATT
  101. #define BITP_ATT_4MOSI_HEADER 1
  102. //Bit mask [1:1]
  103. #define BITM_ATT_4MOSI_HEADER (0x1 << BITP_ATT_4MOSI_HEADER)
  104. // SpiMode
  105. #define BITP_SPIMODE_4MOSI_HEADER 23
  106. //Bit mask [23:23]
  107. #define BITM_SPIMODE_4MOSI_HEADER (0x1 << BITP_SPIMODE_4MOSI_HEADER)
  108. // SpiMode 1MOSI
  109. #define ENUM_SPIMODE_1MOSI (0x0 << BITP_SPIMODE_4MOSI_HEADER)
  110. // SpiMode 4MOSI
  111. #define ENUM_SPIMODE_4MOSI (0x1 << BITP_SPIMODE_4MOSI_HEADER)
  112. // Term Bit
  113. #define BITP_TERM_BIT 0
  114. #define BITM_TERM_BIT (0x1 << BITP_TERM_BIT)
  115. #define TERM_BIT_0 (0x0 << BITP_TERM_BIT)
  116. #define TERM_BIT_1 (0x1 << BITP_TERM_BIT)
  117. // Word Numbers 4-MOSI
  118. #define LMXWordNum 14
  119. #define DDSWordNum 4
  120. #define POTWordNum 2
  121. #define DACWordNum 1
  122. #define ATTWordNum 1
  123. #define ShRegWordNum 1
  124. #define MaxWordNum 2
  125. #define GPIOWordNum 1
  126. // Define bit values for GPIO Reg
  127. #define RF_SW1 0x0
  128. #define RF_SW2 0x0
  129. #define CTRL_AM_SW3 0x0
  130. #define DDS_SYNC_CTRL_FPGA 0x0
  131. #define DDS_RESET_FPGA 0x0
  132. #define DDS_SYNC_FPGA 0x0
  133. #define SW_CAP4 0x0
  134. #define AM_ALC_SW 0x1
  135. #define SW_CAP3 0x0
  136. #define SW_CAP2 0x0
  137. #define SW_CAP1 0x0
  138. #define AM_ALC_1_FIX 0x1
  139. #define PLL_VTUNE_CTRL 0x1
  140. #define PLL_SYNC_CTRL 0x0
  141. #define PLL_SYNC 0x0
  142. #define PLL_LOOP_CTRL 0x1
  143. #define DDS_X2_FPGA 0x0
  144. #define DDS_SAW2_FPGA 0x0
  145. #define REF_OFFSET_CTRL_FPGA 0x1
  146. #define GPIO_ADRF_V1 0x0
  147. #define GPIO_ADRF_V2 0x0
  148. #define DDS_SAW1_FPGA 0x0
  149. #define FPGA_AM_CTRL 0x0
  150. #define RF_SW1_BITP 0
  151. #define RF_SW2_BITP 1
  152. #define CTRL_AM_SW3_BITP 2
  153. #define DDS_SYNC_CTRL_FPGA_BITP 3
  154. #define DDS_RESET_FPGA_BITP 4
  155. #define DDS_SYNC_FPGA_BITP 5
  156. #define SW_CAP4_BITP 6
  157. #define AM_ALC_SW_BITP 7
  158. #define SW_CAP3_BITP 8
  159. #define SW_CAP2_BITP 9
  160. #define SW_CAP1_BITP 10
  161. #define AM_ALC_1_FIX_BITP 11
  162. #define PLL_VTUNE_CTRL_BITP 12
  163. #define PLL_SYNC_CTRL_BITP 13
  164. #define PLL_SYNC_BITP 14
  165. #define PLL_LOOP_CTRL_BITP 15
  166. #define DDS_X2_FPGA_BITP 16
  167. #define DDS_SAW2_FPGA_BITP 17
  168. #define REF_OFFSET_CTRL_FPGA_BITP 18
  169. #define GPIO_ADRF_V1_BITP 19
  170. #define GPIO_ADRF_V2_BITP 20
  171. #define DDS_SAW1_FPGA_BITP 21
  172. #define FPGA_AM_CTRL_BITP 22
  173. #define RF_SW1_BITM (0x1 << RF_SW1_BITP )
  174. #define RF_SW2_BITM (0x1 << RF_SW2_BITP )
  175. #define CTRL_AM_SW3_BITM (0x1 << CTRL_AM_SW3_BITP )
  176. #define DDS_SYNC_CTRL_FPGA_BITM (0x1 << DDS_SYNC_CTRL_FPGA_BITP )
  177. #define DDS_RESET_FPGA_BITM (0x1 << DDS_RESET_FPGA_BITP )
  178. #define DDS_SYNC_FPGA_BITM (0x1 << DDS_SYNC_FPGA_BITP )
  179. #define SW_CAP4_BITM (0x1 << SW_CAP4_BITP )
  180. #define AM_ALC_SW_BITM (0x1 << AM_ALC_SW_BITP )
  181. #define SW_CAP3_BITM (0x1 << SW_CAP3_BITP )
  182. #define SW_CAP2_BITM (0x1 << SW_CAP2_BITP )
  183. #define SW_CAP1_BITM (0x1 << SW_CAP1_BITP )
  184. #define AM_ALC_1_FIX_BITM (0x1 << AM_ALC_1_FIX_BITP )
  185. #define PLL_VTUNE_CTRL_BITM (0x1 << PLL_VTUNE_CTRL_BITP )
  186. #define PLL_SYNC_CTRL_BITM (0x1 << PLL_SYNC_CTRL_BITP )
  187. #define PLL_SYNC_BITM (0x1 << PLL_SYNC_BITP )
  188. #define PLL_LOOP_CTRL_BITM (0x1 << PLL_LOOP_CTRL_BITP )
  189. #define DDS_X2_FPGA_BITM (0x1 << DDS_X2_FPGA_BITP )
  190. #define DDS_SAW2_FPGA_BITM (0x1 << DDS_SAW2_FPGA_BITP )
  191. #define REF_OFFSET_CTRL_FPGA_BITM (0x1 << REF_OFFSET_CTRL_FPGA_BITP )
  192. #define GPIO_ADRF_V1_BITM (0x1 << GPIO_ADRF_V1_BITP )
  193. #define GPIO_ADRF_V2_BITM (0x1 << GPIO_ADRF_V2_BITP )
  194. #define DDS_SAW1_FPGA_BITM (0x1 << DDS_SAW1_FPGA_BITP )
  195. #define FPGA_AM_CTRL_BITM (0x1 << FPGA_AM_CTRL_BITP )
  196. #define RF_SW1_0 (0x0 << RF_SW1_BITP)
  197. #define RF_SW1_1 (0x1 << RF_SW1_BITP)
  198. #define RF_SW2_0 (0x0 << RF_SW2_BITP)
  199. #define RF_SW2_1 (0x1 << RF_SW2_BITP)
  200. #define CTRL_AM_SW3_0 (0x0 << CTRL_AM_SW3_BITP)
  201. #define CTRL_AM_SW3_1 (0x1 << CTRL_AM_SW3_BITP)
  202. #define DDS_SYNC_CTRL_FPGA_0 (0x0 << DDS_SYNC_CTRL_FPGA_BITP)
  203. #define DDS_SYNC_CTRL_FPGA_1 (0x1 << DDS_SYNC_CTRL_FPGA_BITP)
  204. #define DDS_RESET_FPGA_0 (0x0 << DDS_RESET_FPGA_BITP)
  205. #define DDS_RESET_FPGA_1 (0x1 << DDS_RESET_FPGA_BITP)
  206. #define DDS_SYNC_FPGA_0 (0x0 << DDS_SYNC_FPGA_BITP)
  207. #define DDS_SYNC_FPGA_1 (0x1 << DDS_SYNC_FPGA_BITP)
  208. #define SW_CAP4_0 (0x0 << SW_CAP4_BITP)
  209. #define SW_CAP4_1 (0x1 << SW_CAP4_BITP)
  210. #define AM_ALC_SW_0 (0x0 << AM_ALC_SW_BITP)
  211. #define AM_ALC_SW_1 (0x1 << AM_ALC_SW_BITP)
  212. #define SW_CAP3_0 (0x0 << SW_CAP3_BITP)
  213. #define SW_CAP3_1 (0x1 << SW_CAP3_BITP)
  214. #define SW_CAP2_0 (0x0 << SW_CAP2_BITP)
  215. #define SW_CAP2_1 (0x1 << SW_CAP2_BITP)
  216. #define SW_CAP1_0 (0x0 << SW_CAP1_BITP)
  217. #define SW_CAP1_1 (0x1 << SW_CAP1_BITP)
  218. #define AM_ALC_1_FIX_0 (0x0 << AM_ALC_1_FIX_BITP)
  219. #define AM_ALC_1_FIX_1 (0x1 << AM_ALC_1_FIX_BITP)
  220. #define PLL_VTUNE_CTRL_0 (0x0 << PLL_VTUNE_CTRL_BITP)
  221. #define PLL_VTUNE_CTRL_1 (0x1 << PLL_VTUNE_CTRL_BITP)
  222. #define PLL_SYNC_CTRL_0 (0x0 << PLL_SYNC_CTRL_BITP)
  223. #define PLL_SYNC_CTRL_1 (0x1 << PLL_SYNC_CTRL_BITP)
  224. #define PLL_SYNC_0 (0x0 << PLL_SYNC_BITP)
  225. #define PLL_SYNC_1 (0x1 << PLL_SYNC_BITP)
  226. #define PLL_LOOP_CTRL_0 (0x0 << PLL_LOOP_CTRL_BITP)
  227. #define PLL_LOOP_CTRL_1 (0x1 << PLL_LOOP_CTRL_BITP)
  228. #define DDS_X2_FPGA_0 (0x0 << DDS_X2_FPGA_BITP)
  229. #define DDS_X2_FPGA_1 (0x1 << DDS_X2_FPGA_BITP)
  230. #define DDS_SAW2_FPGA_0 (0x0 << DDS_SAW2_FPGA_BITP)
  231. #define DDS_SAW2_FPGA_1 (0x1 << DDS_SAW2_FPGA_BITP)
  232. #define REF_OFFSET_CTRL_FPGA_0 (0x0 << REF_OFFSET_CTRL_FPGA_BITP)
  233. #define REF_OFFSET_CTRL_FPGA_1 (0x1 << REF_OFFSET_CTRL_FPGA_BITP)
  234. #define GPIO_ADRF_V1_0 (0x0 << GPIO_ADRF_V1_BITP)
  235. #define GPIO_ADRF_V1_1 (0x1 << GPIO_ADRF_V1_BITP)
  236. #define GPIO_ADRF_V2_0 (0x0 << GPIO_ADRF_V2_BITP)
  237. #define GPIO_ADRF_V2_1 (0x1 << GPIO_ADRF_V2_BITP)
  238. #define DDS_SAW1_FPGA_0 (0x0 << DDS_SAW1_FPGA_BITP)
  239. #define DDS_SAW1_FPGA_1 (0x1 << DDS_SAW1_FPGA_BITP)
  240. #define FPGA_AM_CTRL_0 (0x0 << FPGA_AM_CTRL_BITP)
  241. #define FPGA_AM_CTRL_1 (0x1 << FPGA_AM_CTRL_BITP)
  242. // Define values for Shift Reg
  243. #define SHIFT_REG_SW_RF 0x0
  244. #define SHIFT_REG_SW4_RF 0x0
  245. #define SHIFT_REG_GPIO_SW_015_RF 0x1
  246. #define SHIFT_REG_GPIO_SW_X2_RF 0x0
  247. #define SHIFT_REG_SW1_RF 0x1
  248. #define SHIFT_REG_SW_MIXER_RF 0x0
  249. #define SHIFT_REG_GPIO_SW_X2_RF_BITP 0
  250. #define SHIFT_REG_SW_RF_BITP 1
  251. #define SHIFT_REG_SW4_RF_BITP 2
  252. #define SHIFT_REG_GPIO_SW_015_RF_BITP 3
  253. #define SHIFT_REG_SW_MIXER_RF_BITP 4
  254. #define SHIFT_REG_SW1_RF_BITP 5
  255. #define SHIFT_REG_SW2_RF_BITP 6
  256. #define SHIFT_REG_SW3_RF_BITP 7
  257. // Bit masks
  258. #define SHIFT_REG_SW_RF_BITM (0x1 << SHIFT_REG_SW_RF_BITP)
  259. #define SHIFT_REG_SW4_RF_BITM (0x1 << SHIFT_REG_SW4_RF_BITP)
  260. #define SHIFT_REG_GPIO_SW_015_RF_BITM (0x1 << SHIFT_REG_GPIO_SW_015_RF_BITP)
  261. #define SHIFT_REG_GPIO_SW_X2_RF_BITM (0x1 << SHIFT_REG_GPIO_SW_X2_RF_BITP)
  262. #define SHIFT_REG_SW_MIXER_RF_BITM (0x1 << SHIFT_REG_SW_MIXER_RF_BITP)
  263. #define SHIFT_REG_SW1_RF_BITM (0x1 << SHIFT_REG_SW1_RF_BITP)
  264. #define SHIFT_REG_SW2_RF_BITM (0x1 << SHIFT_REG_SW2_RF_BITP)
  265. #define SHIFT_REG_SW3_RF_BITM (0x1 << SHIFT_REG_SW3_RF_BITP)
  266. #define SHIFT_REG_GPIO_SW_X2_RF_0 (0x0 << SHIFT_REG_GPIO_SW_X2_RF_BITP)
  267. #define SHIFT_REG_GPIO_SW_X2_RF_1 (0x1 << SHIFT_REG_GPIO_SW_X2_RF_BITP)
  268. #define SHIFT_REG_SW_RF_0 (0x0 << SHIFT_REG_SW_RF_BITP)
  269. #define SHIFT_REG_SW_RF_1 (0x1 << SHIFT_REG_SW_RF_BITP)
  270. #define SHIFT_REG_SW4_RF_0 (0x0 << SHIFT_REG_SW4_RF_BITP)
  271. #define SHIFT_REG_SW4_RF_1 (0x1 << SHIFT_REG_SW4_RF_BITP)
  272. #define SHIFT_REG_GPIO_SW_015_RF_0 (0x0 << SHIFT_REG_GPIO_SW_015_RF_BITP)
  273. #define SHIFT_REG_GPIO_SW_015_RF_1 (0x1 << SHIFT_REG_GPIO_SW_015_RF_BITP)
  274. #define SHIFT_REG_SW_MIXER_RF_0 (0x0 << SHIFT_REG_SW_MIXER_RF_BITP)
  275. #define SHIFT_REG_SW_MIXER_RF_1 (0x1 << SHIFT_REG_SW_MIXER_RF_BITP)
  276. #define SHIFT_REG_SW1_RF_0 (0x0 << SHIFT_REG_SW1_RF_BITP)
  277. #define SHIFT_REG_SW1_RF_1 (0x1 << SHIFT_REG_SW1_RF_BITP)
  278. #define SHIFT_REG_SW2_RF_0 (0x0 << SHIFT_REG_SW2_RF_BITP)
  279. #define SHIFT_REG_SW2_RF_1 (0x1 << SHIFT_REG_SW2_RF_BITP)
  280. #define SHIFT_REG_SW3_RF_0 (0x0 << SHIFT_REG_SW3_RF_BITP)
  281. #define SHIFT_REG_SW3_RF_1 (0x1 << SHIFT_REG_SW3_RF_BITP)
  282. #define SHIFT_REG ((SHIFT_REG_SW_RF << 1) | \
  283. (SHIFT_REG_SW4_RF<<2) | \
  284. (SHIFT_REG_GPIO_SW_015_RF<<3) | \
  285. (SHIFT_REG_GPIO_SW_X2_RF<<0) | \
  286. (SHIFT_REG_SW1_RF <<5) | \
  287. (SHIFT_REG_SW_MIXER_RF <<4))
  288. #define GPIO_REG ((FPGA_AM_CTRL << 22) | \
  289. (DDS_SAW1_FPGA << 21) | \
  290. (GPIO_ADRF_V2 << 20) | \
  291. (GPIO_ADRF_V1 << 19) | \
  292. (REF_OFFSET_CTRL_FPGA << 18) | \
  293. (DDS_SAW2_FPGA << 17) | \
  294. (DDS_X2_FPGA << 16) | \
  295. (PLL_LOOP_CTRL << 15) | \
  296. (PLL_SYNC << 14) | \
  297. (PLL_SYNC_CTRL << 13) | \
  298. (PLL_VTUNE_CTRL << 12) | \
  299. (AM_ALC_1_FIX << 11) | \
  300. (SW_CAP1 << 10) | \
  301. (SW_CAP2 << 9) | \
  302. (SW_CAP3 << 8) | \
  303. (AM_ALC_SW << 7) | \
  304. (SW_CAP4 << 6) | \
  305. (DDS_SYNC_FPGA << 5) | \
  306. (DDS_RESET_FPGA << 4) | \
  307. (DDS_SYNC_CTRL_FPGA << 3) | \
  308. (CTRL_AM_SW3 << 2) | \
  309. (RF_SW2 << 1) | \
  310. (RF_SW1 << 0))
  311. // Macros to set register parameter
  312. #define SET_REGISTER_PARAM( REGISTER, BITM, BITP, PARAMETER )\
  313. REGISTER &= ~BITM;\
  314. REGISTER |= PARAMETER;
  315. #define CFG_REG_ADDR 0x08
  316. // Command Register
  317. #define CFG_REG_RST_FOR_FPGA_BITP 0
  318. #define CFG_REG_WIDTH_SPI_TMSG_BITP 1
  319. #define CFG_REG_MOD_CMD_REG_BITP 2
  320. #define CFG_REG_LR_GPIO_BITP 3
  321. #define CFG_REG_HR_GPIO_BITP 4
  322. #define CFG_REG_SPI_MODE_BITP 5
  323. #define CFG_REG_RST_FOR_FPGA_BITM (0x1 << CFG_REG_RST_FOR_FPGA_BITP)
  324. #define CFG_REG_WIDTH_SPI_TMSG_BITM (0x1 << CFG_REG_WIDTH_SPI_TMSG_BITP)
  325. #define CFG_REG_MOD_CMD_REG_BITM (0x1 << CFG_REG_MOD_CMD_REG_BITP)
  326. #define CFG_REG_LR_GPIO_BITM (0x1 << CFG_REG_LR_GPIO_BITP)
  327. #define CFG_REG_HR_GPIO_BITM (0x1 << CFG_REG_HR_GPIO_BITP)
  328. #define CFG_REG_SPI_MODE_BITM (0x1 << CFG_REG_SPI_MODE_BITP)
  329. #define CFG_REG_RST_FOR_FPGA_ON 0x1
  330. #define CFG_REG_RST_FOR_FPGA_OFF 0x0
  331. #define CFG_REG_WIDTH_SPI_TMSG_24_BIT (0x0 << CFG_REG_WIDTH_SPI_TMSG_BITP)
  332. #define CFG_REG_WIDTH_SPI_TMSG_32_BIT (0x1 << CFG_REG_WIDTH_SPI_TMSG_BITP)
  333. #define CFG_REG_MOD_0 (0x0 << CFG_REG_MOD_CMD_REG_BITP)
  334. #define CFG_REG_MOD_1 (0x1 << CFG_REG_MOD_CMD_REG_BITP)
  335. #define CFG_REG_LR_GPIO_0 (0x0 << CFG_REG_LR_GPIO_BITP)
  336. #define CFG_REG_LR_GPIO_1 (0x1 << CFG_REG_LR_GPIO_BITP)
  337. #define CFG_REG_HR_GPIO_0 (0x0 << CFG_REG_HR_GPIO_BITP)
  338. #define CFG_REG_HR_GPIO_1 (0x1 << CFG_REG_HR_GPIO_BITP)
  339. #define CFG_REG_SPI_MODE_1MOSI (0x0 << CFG_REG_SPI_MODE_BITP)
  340. #define CFG_REG_SPI_MODE_4MOSI (0x1 << CFG_REG_SPI_MODE_BITP)
  341. #define LMX_BASE_ADDR 0x04
  342. void rst_for_fpga(void *bar1);
  343. void shift_reg (void *bar1);
  344. void key_switch (void *bar1, double freq,double lmx_freq);
  345. uint32_t get_cfg_reg();
  346. void set_cfg_reg(uint32_t cfgRegToSet);
  347. uint32_t get_tmsg_gpio_reg();
  348. void set_tmsg_gpio_reg(uint32_t tmsgGpioRegToSet);
  349. uint32_t get_tmsg_shift_reg();
  350. void set_tmsg_shift_reg(uint32_t tmsgShiftRegToSet);
  351. #endif //DMADRIVER_TMSGHEADERS_H