cyhal.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*******************************************************************************
  2. * File Name: cyhal.h
  3. *
  4. * Description:
  5. * Top-level HAL header file that can be referenced to pull in all relevant
  6. * drivers for the current device architecture. Not all of these may be
  7. * supported in the current target device. The implementation must provide a
  8. * cyhal_hw_types.h and a cyhal_drivers.h file in the include path for this
  9. * to depend on.
  10. * The cyhal_hw_types.h file must provide the following:
  11. * 1) definitions for each of the resource types consumed by the HAL driver
  12. * functions.
  13. * 2) A CYHAL_ISR_PRIORITY_DEFAULT define for the default interrupt priority
  14. * 3) A CYHAL_MAIN_FLASH_BASE define for the base address of flash memory
  15. * 4) OPTIONAL: Implementation specific header files can be used by creating
  16. * a #define in cyhal_hw_types.h with a name of CYHAL_<DRIVER>_IMPL_HEADER
  17. * and the value being the name of the header file. eg:
  18. * #define CYHAL_GPIO_IMPL_HEADER "cyhal_gpio_impl.h"
  19. * The cyhal_drivers.h file must simply be a list of include directives to pull
  20. * in the relevant driver header files.
  21. *
  22. ********************************************************************************
  23. * \copyright
  24. * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or
  25. * an affiliate of Cypress Semiconductor Corporation
  26. *
  27. * SPDX-License-Identifier: Apache-2.0
  28. *
  29. * Licensed under the Apache License, Version 2.0 (the "License");
  30. * you may not use this file except in compliance with the License.
  31. * You may obtain a copy of the License at
  32. *
  33. * http://www.apache.org/licenses/LICENSE-2.0
  34. *
  35. * Unless required by applicable law or agreed to in writing, software
  36. * distributed under the License is distributed on an "AS IS" BASIS,
  37. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  38. * See the License for the specific language governing permissions and
  39. * limitations under the License.
  40. *******************************************************************************/
  41. /**
  42. * \addtogroup group_hal_types HAL General Types/Macros
  43. * This section documents the basic types and macros that are used by multiple HAL drivers.
  44. */
  45. /**
  46. * \addtogroup group_result Result Type
  47. * \ingroup group_hal_types
  48. */
  49. /**
  50. * \addtogroup group_hal_availability HAL Driver Availability
  51. * This section documents the macros that can be used to check if a specific driver is available
  52. * for the current device. This includes macros for all HAL drivers that exist for any device, even
  53. * those that are not applicable (included) with this library. This is intended to help write code
  54. * that can port between device categories that might not have the same drivers available.
  55. */
  56. /**
  57. * \addtogroup group_hal HAL Drivers
  58. * This section documents the drivers which form the stable API of the ModusToolboxâ„¢ HAL.
  59. * In order to remain portable across platforms and HAL versions, applications should
  60. * rely only on functionality documented in this section.
  61. */
  62. /**
  63. * \addtogroup group_hal_impl
  64. */
  65. #pragma once
  66. #if defined(CY_USING_HAL)
  67. #include "cyhal_general_types.h"
  68. #include "cyhal_hw_types.h"
  69. #include "cyhal_drivers.h"
  70. #endif
  71. /** Macro specifying the major version number of the HAL API. Since there are multiple HAL library
  72. * implementations, this is not necessarily the same as the major version number of the library. It
  73. * is instead intended as a single version number that can be used across implementation libraries
  74. * to know what signatures to use in the case an API is updated in the future. Once an API is
  75. * available, its API will remain consistant across libraries sharing the same version here.
  76. * \note Support for new drivers/functionality may be added without changing the version number, to
  77. * check for whether a specific driver is available, the CYHAL_DRIVER_AVAILABLE_X macros defined in
  78. * \ref group_hal_availability should be used.
  79. * \def CYHAL_API_VERSION
  80. */
  81. /**
  82. * \ingroup group_hal_availability
  83. * \{
  84. */
  85. /** Macro specifying whether the ADC driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_ADC
  86. */
  87. /** Macro specifying whether the Clock driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_CLOCK
  88. */
  89. /** Macro specifying whether the COMP driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_COMP
  90. */
  91. /** Macro specifying whether the CRC driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_CRC
  92. */
  93. /** Macro specifying whether the DAC driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_DAC
  94. */
  95. /** Macro specifying whether the DMA driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_DMA
  96. */
  97. /** Macro specifying whether the EzI2C driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_EZI2C
  98. */
  99. /** Macro specifying whether the Flash driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_FLASH
  100. */
  101. /** Macro specifying whether the GPIO driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_GPIO
  102. */
  103. /** Macro specifying whether the HwMgr driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_HWMGR
  104. */
  105. /** Macro specifying whether the I2C driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_I2C
  106. */
  107. /** Macro specifying whether the I2S driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_I2S
  108. */
  109. /** Macro specifying whether the IPC driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_IPC
  110. */
  111. /** Macro specifying whether the TX functionality is available on the I2S driver for the current device \def CYHAL_DRIVER_AVAILABLE_I2S_TX
  112. */
  113. /** Macro specifying whether the RX functionality is available on the I2S driver for the current device \def CYHAL_DRIVER_AVAILABLE_I2S_RX
  114. */
  115. /** Macro specifying whether the Interconnect driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_INTERCONNECT
  116. */
  117. /** Macro specifying whether the KeyScan driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_KEYSCAN
  118. */
  119. /** Macro specifying whether the LPTimer driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_LPTIMER
  120. */
  121. /** Macro specifying whether the OpAmp driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_OPAMP
  122. */
  123. /** Macro specifying whether the PDM/PCM driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_PDMPCM
  124. */
  125. /** Macro specifying whether the PWM driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_PWM
  126. */
  127. /** Macro specifying whether the QSPI driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_QSPI
  128. */
  129. /** Macro specifying whether the QuadDec driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_QUADDEC
  130. */
  131. /** Macro specifying whether the RTC driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_RTC
  132. */
  133. /** Macro specifying whether the SDHC driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_SDHC
  134. */
  135. /** Macro specifying whether the SDIO driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_SDIO
  136. */
  137. /** Macro specifying whether the SPI driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_SPI
  138. */
  139. /** Macro specifying whether the SysPM driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_SYSPM
  140. */
  141. /** Macro specifying whether the System driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_SYSTEM
  142. */
  143. /** Macro specifying whether the TDM driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_TDM
  144. */
  145. /** Macro specifying whether the TX functionality is available on the TDM driver for the current device \def CYHAL_DRIVER_AVAILABLE_TDM_TX
  146. */
  147. /** Macro specifying whether the RX functionality is available on the TDM driver for the current device \def CYHAL_DRIVER_AVAILABLE_TDM_RX
  148. */
  149. /** Macro specifying whether the Timer driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_TIMER
  150. */
  151. /** Macro specifying whether the TRNG driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_TRNG
  152. */
  153. /** Macro specifying whether the UART driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_UART
  154. */
  155. /** Macro specifying whether the USB Dev driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_USB_DEV
  156. */
  157. /** Macro specifying whether the WDT driver is available for the current device \def CYHAL_DRIVER_AVAILABLE_WDT
  158. */
  159. /** \} group_hal_availability */