fsl_flexcomm.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2016, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2017 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _FSL_FLEXCOMM_H_
  9. #define _FSL_FLEXCOMM_H_
  10. #include "fsl_common.h"
  11. /*!
  12. * @addtogroup flexcomm_driver
  13. * @{
  14. */
  15. /*! @name Driver version */
  16. /*@{*/
  17. /*! @brief FlexCOMM driver version 2.0.0. */
  18. #define FSL_FLEXCOMM_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
  19. /*@}*/
  20. /*! @brief FLEXCOMM peripheral modes. */
  21. typedef enum
  22. {
  23. FLEXCOMM_PERIPH_NONE, /*!< No peripheral */
  24. FLEXCOMM_PERIPH_USART, /*!< USART peripheral */
  25. FLEXCOMM_PERIPH_SPI, /*!< SPI Peripheral */
  26. FLEXCOMM_PERIPH_I2C, /*!< I2C Peripheral */
  27. FLEXCOMM_PERIPH_I2S_TX, /*!< I2S TX Peripheral */
  28. FLEXCOMM_PERIPH_I2S_RX, /*!< I2S RX Peripheral */
  29. } FLEXCOMM_PERIPH_T;
  30. /*! @brief Typedef for interrupt handler. */
  31. typedef void (*flexcomm_irq_handler_t)(void *base, void *handle);
  32. /*! @brief Array with IRQ number for each FLEXCOMM module. */
  33. extern IRQn_Type const kFlexcommIrqs[];
  34. /*! @brief Returns instance number for FLEXCOMM module with given base address. */
  35. uint32_t FLEXCOMM_GetInstance(void *base);
  36. /*! @brief Initializes FLEXCOMM and selects peripheral mode according to the second parameter. */
  37. status_t FLEXCOMM_Init(void *base, FLEXCOMM_PERIPH_T periph);
  38. /*! @brief Sets IRQ handler for given FLEXCOMM module. It is used by drivers register IRQ handler according to FLEXCOMM
  39. * mode */
  40. void FLEXCOMM_SetIRQHandler(void *base, flexcomm_irq_handler_t handler, void *handle);
  41. /*@}*/
  42. #endif /* _FSL_FLEXCOMM_H_*/