gnss_spi.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _GNSS_SPI_H_
  13. #define _GNSS_SPI_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_GNSS_SPI_SET_OFFSET (0x1000)
  17. #define REG_GNSS_SPI_CLR_OFFSET (0x2000)
  18. #define REG_GNSS_SPI_BASE (0x1c040000)
  19. typedef volatile struct
  20. {
  21. uint32_t spi_cfg; // 0x00000000
  22. uint32_t spi_rxdata; // 0x00000004
  23. uint32_t spi_immdata; // 0x00000008
  24. uint32_t __12[1]; // 0x0000000c
  25. uint32_t spi_status; // 0x00000010
  26. uint32_t __20[1019]; // 0x00000014
  27. uint32_t spi_cfg_set; // 0x00001000
  28. uint32_t __4100[1]; // 0x00001004
  29. uint32_t spi_immdata_set; // 0x00001008
  30. uint32_t __4108[1021]; // 0x0000100c
  31. uint32_t spi_cfg_clr; // 0x00002000
  32. uint32_t __8196[1]; // 0x00002004
  33. uint32_t spi_immdata_clr; // 0x00002008
  34. } HWP_GNSS_SPI_T;
  35. #define hwp_gnssSpi ((HWP_GNSS_SPI_T *)REG_ACCESS_ADDRESS(REG_GNSS_SPI_BASE))
  36. // spi_cfg
  37. typedef union {
  38. uint32_t v;
  39. struct
  40. {
  41. uint32_t tx_data_len : 5; // [4:0]
  42. uint32_t rx_data_len : 5; // [9:5]
  43. uint32_t spol : 1; // [10]
  44. uint32_t cpol : 1; // [11]
  45. uint32_t cpha : 1; // [12]
  46. uint32_t sec : 1; // [13]
  47. uint32_t rd_edge : 1; // [14]
  48. uint32_t rd_inter : 2; // [16:15]
  49. uint32_t ms : 1; // [17]
  50. uint32_t dux : 1; // [18]
  51. uint32_t cs_inv : 1; // [19]
  52. uint32_t frq_div_wr : 3; // [22:20]
  53. uint32_t frq_div_rd : 3; // [25:23]
  54. uint32_t distance : 4; // [29:26]
  55. uint32_t spi_rw : 1; // [30]
  56. uint32_t __31_31 : 1; // [31]
  57. } b;
  58. } REG_GNSS_SPI_SPI_CFG_T;
  59. // spi_status
  60. typedef union {
  61. uint32_t v;
  62. struct
  63. {
  64. uint32_t spi_status : 1; // [0], read only
  65. uint32_t __31_1 : 31; // [31:1]
  66. } b;
  67. } REG_GNSS_SPI_SPI_STATUS_T;
  68. // spi_cfg
  69. #define GNSS_SPI_TX_DATA_LEN(n) (((n)&0x1f) << 0)
  70. #define GNSS_SPI_RX_DATA_LEN(n) (((n)&0x1f) << 5)
  71. #define GNSS_SPI_SPOL (1 << 10)
  72. #define GNSS_SPI_CPOL (1 << 11)
  73. #define GNSS_SPI_CPHA (1 << 12)
  74. #define GNSS_SPI_SEC (1 << 13)
  75. #define GNSS_SPI_RD_EDGE (1 << 14)
  76. #define GNSS_SPI_RD_INTER(n) (((n)&0x3) << 15)
  77. #define GNSS_SPI_MS (1 << 17)
  78. #define GNSS_SPI_DUX (1 << 18)
  79. #define GNSS_SPI_CS_INV (1 << 19)
  80. #define GNSS_SPI_FRQ_DIV_WR(n) (((n)&0x7) << 20)
  81. #define GNSS_SPI_FRQ_DIV_RD(n) (((n)&0x7) << 23)
  82. #define GNSS_SPI_DISTANCE(n) (((n)&0xf) << 26)
  83. #define GNSS_SPI_SPI_RW (1 << 30)
  84. // spi_status
  85. #define GNSS_SPI_SPI_STATUS (1 << 0)
  86. #endif // _GNSS_SPI_H_