periph_ctrl.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 _DRIVER_PERIPH_CTRL_H_
  14. #define _DRIVER_PERIPH_CTRL_H_
  15. #include "esp_err.h"
  16. #include "soc/soc.h"
  17. #include "soc/dport_reg.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. typedef enum {
  22. PERIPH_LEDC_MODULE = 0,
  23. PERIPH_UART0_MODULE,
  24. PERIPH_UART1_MODULE,
  25. PERIPH_UART2_MODULE,
  26. PERIPH_I2C0_MODULE,
  27. PERIPH_I2C1_MODULE,
  28. PERIPH_I2S0_MODULE,
  29. PERIPH_I2S1_MODULE,
  30. PERIPH_TIMG0_MODULE,
  31. PERIPH_TIMG1_MODULE,
  32. PERIPH_PWM0_MODULE,
  33. PERIPH_PWM1_MODULE,
  34. PERIPH_PWM2_MODULE,
  35. PERIPH_PWM3_MODULE,
  36. PERIPH_UHCI0_MODULE,
  37. PERIPH_UHCI1_MODULE,
  38. PERIPH_RMT_MODULE,
  39. PERIPH_PCNT_MODULE,
  40. PERIPH_SPI_MODULE,
  41. PERIPH_HSPI_MODULE,
  42. PERIPH_VSPI_MODULE,
  43. PERIPH_SPI_DMA_MODULE,
  44. PERIPH_SDMMC_MODULE,
  45. PERIPH_SDIO_SLAVE_MODULE,
  46. PERIPH_CAN_MODULE,
  47. PERIPH_EMAC_MODULE,
  48. PERIPH_RNG_MODULE,
  49. PERIPH_WIFI_MODULE,
  50. PERIPH_BT_MODULE,
  51. PERIPH_WIFI_BT_COMMON_MODULE,
  52. } periph_module_t;
  53. /**
  54. * @brief enable peripheral module
  55. *
  56. * @param[in] periph : Peripheral module name
  57. *
  58. * Clock for the module will be ungated, and reset de-asserted.
  59. *
  60. * @return NULL
  61. *
  62. */
  63. void periph_module_enable(periph_module_t periph);
  64. /**
  65. * @brief disable peripheral module
  66. *
  67. * @param[in] periph : Peripheral module name
  68. *
  69. * Clock for the module will be gated, reset asserted.
  70. *
  71. * @return NULL
  72. *
  73. */
  74. void periph_module_disable(periph_module_t periph);
  75. /**
  76. * @brief reset peripheral module
  77. *
  78. * @param[in] periph : Peripheral module name
  79. *
  80. * Reset will asserted then de-assrted for the peripheral.
  81. *
  82. * Calling this function does not enable or disable the clock for the module.
  83. *
  84. * @return NULL
  85. *
  86. */
  87. void periph_module_reset(periph_module_t periph);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* _DRIVER_PERIPH_CTRL_H_ */