apb_ctrl_struct.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef _SOC_APB_CTRL_STRUCT_H_
  15. #define _SOC_APB_CTRL_STRUCT_H_
  16. #include <stdint.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef struct apb_ctrl_dev_s {
  21. union {
  22. struct {
  23. volatile uint32_t pre_div: 10;
  24. volatile uint32_t clk_320m_en: 1;
  25. volatile uint32_t clk_en: 1;
  26. volatile uint32_t rst_tick: 1;
  27. volatile uint32_t quick_clk_chng: 1;
  28. volatile uint32_t reserved14: 18;
  29. };
  30. volatile uint32_t val;
  31. }clk_conf;
  32. union {
  33. struct {
  34. volatile uint32_t xtal_tick: 8;
  35. volatile uint32_t reserved8: 24;
  36. };
  37. volatile uint32_t val;
  38. }xtal_tick_conf;
  39. union {
  40. struct {
  41. volatile uint32_t pll_tick: 8;
  42. volatile uint32_t reserved8: 24;
  43. };
  44. volatile uint32_t val;
  45. }pll_tick_conf;
  46. union {
  47. struct {
  48. volatile uint32_t ck8m_tick: 8;
  49. volatile uint32_t reserved8: 24;
  50. };
  51. volatile uint32_t val;
  52. }ck8m_tick_conf;
  53. union {
  54. struct {
  55. volatile uint32_t start_force: 1;
  56. volatile uint32_t start: 1;
  57. volatile uint32_t sar2_mux: 1; /*1: SAR ADC2 is controlled by DIG ADC2 CTRL 0: SAR ADC2 is controlled by PWDET CTRL*/
  58. volatile uint32_t work_mode: 2; /*0: single mode 1: double mode 2: alternate mode*/
  59. volatile uint32_t sar_sel: 1; /*0: SAR1 1: SAR2 only work for single SAR mode*/
  60. volatile uint32_t sar_clk_gated: 1;
  61. volatile uint32_t sar_clk_div: 8; /*SAR clock divider*/
  62. volatile uint32_t sar1_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/
  63. volatile uint32_t sar2_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/
  64. volatile uint32_t sar1_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC1 CTRL*/
  65. volatile uint32_t sar2_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC2 CTRL*/
  66. volatile uint32_t data_sar_sel: 1; /*1: sar_sel will be coded by the MSB of the 16-bit output data in this case the resolution should not be larger than 11 bits.*/
  67. volatile uint32_t data_to_i2s: 1; /*1: I2S input data is from SAR ADC (for DMA) 0: I2S input data is from GPIO matrix*/
  68. volatile uint32_t reserved27: 5;
  69. };
  70. volatile uint32_t val;
  71. }saradc_ctrl;
  72. union {
  73. struct {
  74. volatile uint32_t meas_num_limit: 1;
  75. volatile uint32_t max_meas_num: 8; /*max conversion number*/
  76. volatile uint32_t sar1_inv: 1; /*1: data to DIG ADC1 CTRL is inverted otherwise not*/
  77. volatile uint32_t sar2_inv: 1; /*1: data to DIG ADC2 CTRL is inverted otherwise not*/
  78. volatile uint32_t reserved11: 21;
  79. };
  80. volatile uint32_t val;
  81. }saradc_ctrl2;
  82. union {
  83. struct {
  84. volatile uint32_t rstb_wait: 8;
  85. volatile uint32_t standby_wait: 8;
  86. volatile uint32_t start_wait: 8;
  87. volatile uint32_t sample_cycle: 8; /*sample cycles*/
  88. };
  89. volatile uint32_t val;
  90. }saradc_fsm;
  91. volatile uint32_t saradc_sar1_patt_tab1; /*item 0 ~ 3 for pattern table 1 (each item one byte)*/
  92. volatile uint32_t saradc_sar1_patt_tab2; /*Item 4 ~ 7 for pattern table 1 (each item one byte)*/
  93. volatile uint32_t saradc_sar1_patt_tab3; /*Item 8 ~ 11 for pattern table 1 (each item one byte)*/
  94. volatile uint32_t saradc_sar1_patt_tab4; /*Item 12 ~ 15 for pattern table 1 (each item one byte)*/
  95. volatile uint32_t saradc_sar2_patt_tab1; /*item 0 ~ 3 for pattern table 2 (each item one byte)*/
  96. volatile uint32_t saradc_sar2_patt_tab2; /*Item 4 ~ 7 for pattern table 2 (each item one byte)*/
  97. volatile uint32_t saradc_sar2_patt_tab3; /*Item 8 ~ 11 for pattern table 2 (each item one byte)*/
  98. volatile uint32_t saradc_sar2_patt_tab4; /*Item 12 ~ 15 for pattern table 2 (each item one byte)*/
  99. union {
  100. struct {
  101. volatile uint32_t apll_tick: 8;
  102. volatile uint32_t reserved8: 24;
  103. };
  104. volatile uint32_t val;
  105. }apll_tick_conf;
  106. volatile uint32_t reserved_40;
  107. volatile uint32_t reserved_44;
  108. volatile uint32_t reserved_48;
  109. volatile uint32_t reserved_4c;
  110. volatile uint32_t reserved_50;
  111. volatile uint32_t reserved_54;
  112. volatile uint32_t reserved_58;
  113. volatile uint32_t reserved_5c;
  114. volatile uint32_t reserved_60;
  115. volatile uint32_t reserved_64;
  116. volatile uint32_t reserved_68;
  117. volatile uint32_t reserved_6c;
  118. volatile uint32_t reserved_70;
  119. volatile uint32_t reserved_74;
  120. volatile uint32_t reserved_78;
  121. volatile uint32_t date; /**/
  122. } apb_ctrl_dev_t;
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126. #endif /* _SOC_APB_CTRL_STRUCT_H_ */