pcnt_struct.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _SOC_PCNT_STRUCT_H_
  14. #define _SOC_PCNT_STRUCT_H_
  15. typedef volatile struct {
  16. struct{
  17. union {
  18. struct {
  19. uint32_t filter_thres: 10; /*This register is used to filter pulse whose width is smaller than this value for unit0.*/
  20. uint32_t filter_en: 1; /*This is the enable bit for filtering input signals for unit0.*/
  21. uint32_t thr_zero_en: 1; /*This is the enable bit for comparing unit0's count with 0 value.*/
  22. uint32_t thr_h_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_h_lim value.*/
  23. uint32_t thr_l_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_l_lim value.*/
  24. uint32_t thr_thres0_en: 1; /*This is the enable bit for comparing unit0's count with thres0 value.*/
  25. uint32_t thr_thres1_en: 1; /*This is the enable bit for comparing unit0's count with thres1 value .*/
  26. uint32_t ch0_neg_mode: 2; /*This register is used to control the mode of channel0's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/
  27. uint32_t ch0_pos_mode: 2; /*This register is used to control the mode of channel0's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/
  28. uint32_t ch0_hctrl_mode: 2; /*This register is used to control the mode of channel0's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
  29. uint32_t ch0_lctrl_mode: 2; /*This register is used to control the mode of channel0's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
  30. uint32_t ch1_neg_mode: 2; /*This register is used to control the mode of channel1's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/
  31. uint32_t ch1_pos_mode: 2; /*This register is used to control the mode of channel1's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/
  32. uint32_t ch1_hctrl_mode: 2; /*This register is used to control the mode of channel1's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
  33. uint32_t ch1_lctrl_mode: 2; /*This register is used to control the mode of channel1's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
  34. };
  35. uint32_t val;
  36. } conf0;
  37. union {
  38. struct {
  39. uint32_t cnt_thres0:16; /*This register is used to configure thres0 value for unit0.*/
  40. uint32_t cnt_thres1:16; /*This register is used to configure thres1 value for unit0.*/
  41. };
  42. uint32_t val;
  43. } conf1;
  44. union {
  45. struct {
  46. uint32_t cnt_h_lim:16; /*This register is used to configure thr_h_lim value for unit0.*/
  47. uint32_t cnt_l_lim:16; /*This register is used to configure thr_l_lim value for unit0.*/
  48. };
  49. uint32_t val;
  50. } conf2;
  51. } conf_unit[8];
  52. union {
  53. struct {
  54. uint32_t cnt_val : 16; /*This register stores the current pulse count value for unit0.*/
  55. uint32_t reserved16: 16;
  56. };
  57. uint32_t val;
  58. } cnt_unit[8];
  59. union {
  60. struct {
  61. uint32_t cnt_thr_event_u0: 1; /*This is the interrupt raw bit for channel0 event.*/
  62. uint32_t cnt_thr_event_u1: 1; /*This is the interrupt raw bit for channel1 event.*/
  63. uint32_t cnt_thr_event_u2: 1; /*This is the interrupt raw bit for channel2 event.*/
  64. uint32_t cnt_thr_event_u3: 1; /*This is the interrupt raw bit for channel3 event.*/
  65. uint32_t cnt_thr_event_u4: 1; /*This is the interrupt raw bit for channel4 event.*/
  66. uint32_t cnt_thr_event_u5: 1; /*This is the interrupt raw bit for channel5 event.*/
  67. uint32_t cnt_thr_event_u6: 1; /*This is the interrupt raw bit for channel6 event.*/
  68. uint32_t cnt_thr_event_u7: 1; /*This is the interrupt raw bit for channel7 event.*/
  69. uint32_t reserved8: 24;
  70. };
  71. uint32_t val;
  72. } int_raw;
  73. union {
  74. struct {
  75. uint32_t cnt_thr_event_u0: 1; /*This is the interrupt status bit for channel0 event.*/
  76. uint32_t cnt_thr_event_u1: 1; /*This is the interrupt status bit for channel1 event.*/
  77. uint32_t cnt_thr_event_u2: 1; /*This is the interrupt status bit for channel2 event.*/
  78. uint32_t cnt_thr_event_u3: 1; /*This is the interrupt status bit for channel3 event.*/
  79. uint32_t cnt_thr_event_u4: 1; /*This is the interrupt status bit for channel4 event.*/
  80. uint32_t cnt_thr_event_u5: 1; /*This is the interrupt status bit for channel5 event.*/
  81. uint32_t cnt_thr_event_u6: 1; /*This is the interrupt status bit for channel6 event.*/
  82. uint32_t cnt_thr_event_u7: 1; /*This is the interrupt status bit for channel7 event.*/
  83. uint32_t reserved8: 24;
  84. };
  85. uint32_t val;
  86. } int_st;
  87. union {
  88. struct {
  89. uint32_t cnt_thr_event_u0: 1; /*This is the interrupt enable bit for channel0 event.*/
  90. uint32_t cnt_thr_event_u1: 1; /*This is the interrupt enable bit for channel1 event.*/
  91. uint32_t cnt_thr_event_u2: 1; /*This is the interrupt enable bit for channel2 event.*/
  92. uint32_t cnt_thr_event_u3: 1; /*This is the interrupt enable bit for channel3 event.*/
  93. uint32_t cnt_thr_event_u4: 1; /*This is the interrupt enable bit for channel4 event.*/
  94. uint32_t cnt_thr_event_u5: 1; /*This is the interrupt enable bit for channel5 event.*/
  95. uint32_t cnt_thr_event_u6: 1; /*This is the interrupt enable bit for channel6 event.*/
  96. uint32_t cnt_thr_event_u7: 1; /*This is the interrupt enable bit for channel7 event.*/
  97. uint32_t reserved8: 24;
  98. };
  99. uint32_t val;
  100. } int_ena;
  101. union {
  102. struct {
  103. uint32_t cnt_thr_event_u0: 1; /*Set this bit to clear channel0 event interrupt.*/
  104. uint32_t cnt_thr_event_u1: 1; /*Set this bit to clear channel1 event interrupt.*/
  105. uint32_t cnt_thr_event_u2: 1; /*Set this bit to clear channel2 event interrupt.*/
  106. uint32_t cnt_thr_event_u3: 1; /*Set this bit to clear channel3 event interrupt.*/
  107. uint32_t cnt_thr_event_u4: 1; /*Set this bit to clear channel4 event interrupt.*/
  108. uint32_t cnt_thr_event_u5: 1; /*Set this bit to clear channel5 event interrupt.*/
  109. uint32_t cnt_thr_event_u6: 1; /*Set this bit to clear channel6 event interrupt.*/
  110. uint32_t cnt_thr_event_u7: 1; /*Set this bit to clear channel7 event interrupt.*/
  111. uint32_t reserved8: 24;
  112. };
  113. uint32_t val;
  114. } int_clr;
  115. uint32_t status_unit[8];
  116. union {
  117. struct {
  118. uint32_t cnt_rst_u0: 1; /*Set this bit to clear unit0's counter.*/
  119. uint32_t cnt_pause_u0: 1; /*Set this bit to pause unit0's counter.*/
  120. uint32_t cnt_rst_u1: 1; /*Set this bit to clear unit1's counter.*/
  121. uint32_t cnt_pause_u1: 1; /*Set this bit to pause unit1's counter.*/
  122. uint32_t cnt_rst_u2: 1; /*Set this bit to clear unit2's counter.*/
  123. uint32_t cnt_pause_u2: 1; /*Set this bit to pause unit2's counter.*/
  124. uint32_t cnt_rst_u3: 1; /*Set this bit to clear unit3's counter.*/
  125. uint32_t cnt_pause_u3: 1; /*Set this bit to pause unit3's counter.*/
  126. uint32_t cnt_rst_u4: 1; /*Set this bit to clear unit4's counter.*/
  127. uint32_t cnt_pause_u4: 1; /*Set this bit to pause unit4's counter.*/
  128. uint32_t cnt_rst_u5: 1; /*Set this bit to clear unit5's counter.*/
  129. uint32_t cnt_pause_u5: 1; /*Set this bit to pause unit5's counter.*/
  130. uint32_t cnt_rst_u6: 1; /*Set this bit to clear unit6's counter.*/
  131. uint32_t cnt_pause_u6: 1; /*Set this bit to pause unit6's counter.*/
  132. uint32_t cnt_rst_u7: 1; /*Set this bit to clear unit7's counter.*/
  133. uint32_t cnt_pause_u7: 1; /*Set this bit to pause unit7's counter.*/
  134. uint32_t clk_en: 1;
  135. uint32_t reserved17: 15;
  136. };
  137. uint32_t val;
  138. } ctrl;
  139. uint32_t reserved_b4;
  140. uint32_t reserved_b8;
  141. uint32_t reserved_bc;
  142. uint32_t reserved_c0;
  143. uint32_t reserved_c4;
  144. uint32_t reserved_c8;
  145. uint32_t reserved_cc;
  146. uint32_t reserved_d0;
  147. uint32_t reserved_d4;
  148. uint32_t reserved_d8;
  149. uint32_t reserved_dc;
  150. uint32_t reserved_e0;
  151. uint32_t reserved_e4;
  152. uint32_t reserved_e8;
  153. uint32_t reserved_ec;
  154. uint32_t reserved_f0;
  155. uint32_t reserved_f4;
  156. uint32_t reserved_f8;
  157. uint32_t date; /**/
  158. } pcnt_dev_t;
  159. extern pcnt_dev_t PCNT;
  160. #endif /* _SOC_PCNT_STRUCT_H_ */