ad9912.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef DMADRIVER_AD9912_H
  2. #define DMADRIVER_AD9912_H
  3. #include "tmsgheaders.h"
  4. #define AD9912_COUNT 37
  5. #define AD9912_BASE_ADDR 0x04
  6. #define AD9912_RST_ON ((DDS_SAW1_FPGA << 21) | \
  7. (GPIO_ADRF_V2 << 20) | \
  8. (GPIO_ADRF_V1 << 19) | \
  9. (REF_OFFSET_CTRL_FPGA << 18) | \
  10. (DDS_SAW2_FPGA << 17) | \
  11. (DDS_X2_FPGA << 16) | \
  12. (PLL_LOOP_CTRL << 15) | \
  13. (PLL_SYNC << 14) | \
  14. (PLL_SYNC_CTRL << 13) | \
  15. (PLL_VTUNE_CTRL << 12) | \
  16. (AM_ALC_1_FIX << 11) | \
  17. (SW_CAP1 << 10) | \
  18. (SW_CAP2 << 9) | \
  19. (SW_CAP3 << 8) | \
  20. (AM_ALC_SW << 7) | \
  21. (SW_CAP4 << 6) | \
  22. (DDS_SYNC_FPGA << 5) | \
  23. (0x1 << 4) | \
  24. (DDS_SYNC_CTRL_FPGA << 3) | \
  25. (CTRL_AM_SW3 << 2) | \
  26. (RF_SW2 << 1) | \
  27. (RF_SW1 << 0))
  28. /**********************************************************************************
  29. * FTW0[7:0]
  30. *********************************************************************************/
  31. #define BITP_AD9912_FTW0_FREQ_WORD_7_0 0
  32. #define BITM_AD9912_FTW0_FREQ_WORD_7_0 (0xFF << BITP_AD9912_FTW0_FREQ_WORD_7_0)
  33. #define REGP_AD9912_FTW0_FREQ_WORD_7_0 0xE
  34. /**********************************************************************************
  35. * FTW0[15:8]
  36. *********************************************************************************/
  37. #define BITP_AD9912_FTW0_FREQ_WORD_15_8 0
  38. #define BITM_AD9912_FTW0_FREQ_WORD_15_8 (0xFF << BITP_AD9912_FTW0_FREQ_WORD_15_8)
  39. #define REGP_AD9912_FTW0_FREQ_WORD_15_8 0xF
  40. /**********************************************************************************
  41. * FTW0[23:16]
  42. *********************************************************************************/
  43. #define BITP_AD9912_FTW0_FREQ_WORD_23_16 0
  44. #define BITM_AD9912_FTW0_FREQ_WORD_23_16 (0xFF << BITP_AD9912_FTW0_FREQ_WORD_23_16)
  45. #define REGP_AD9912_FTW0_FREQ_WORD_23_16 0x10
  46. /**********************************************************************************
  47. * FTW0[31:24]
  48. *********************************************************************************/
  49. #define BITP_AD9912_FTW0_FREQ_WORD_31_24 0
  50. #define BITM_AD9912_FTW0_FREQ_WORD_31_24 (0xFF << BITP_AD9912_FTW0_FREQ_WORD_31_24)
  51. #define REGP_AD9912_FTW0_FREQ_WORD_31_24 0x11
  52. /**********************************************************************************
  53. * FTW0[39:32]
  54. *********************************************************************************/
  55. #define BITP_AD9912_FTW0_FREQ_WORD_39_24 0
  56. #define BITM_AD9912_FTW0_FREQ_WORD_39_24 (0xFF << BITP_AD9912_FTW1_FREQ_WORD_7_0)
  57. #define REGP_AD9912_FTW0_FREQ_WORD_39_24 0x12
  58. /**********************************************************************************
  59. * FTW0[47:40]
  60. *********************************************************************************/
  61. #define BITP_AD9912_FTW0_FREQ_WORD_47_40 0
  62. #define BITM_AD9912_FTW0_FREQ_WORD_47_40 (0xFF << BITP_AD9912_FTW1_FREQ_WORD_47_40)
  63. #define REGP_AD9912_FTW0_FREQ_WORD_47_40 0x13
  64. /*----------------------------------------------------------------------*/
  65. void ad9912_init(void *bar1);
  66. double ad9912_set(void *bar1, double freq);
  67. double ad9912_set_out_of_band(double freq, int lmx_n);
  68. double ad9912_set_main_band(double freq, int lmx_n);
  69. #endif //DMADRIVER_AD9912_H