fsl_xbarb.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * The Clear BSD License
  3. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  4. * Copyright 2016-2017 NXP
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without modification,
  8. * are permitted (subject to the limitations in the disclaimer below) provided
  9. * that the following conditions are met:
  10. *
  11. * o Redistributions of source code must retain the above copyright notice, this list
  12. * of conditions and the following disclaimer.
  13. *
  14. * o Redistributions in binary form must reproduce the above copyright notice, this
  15. * list of conditions and the following disclaimer in the documentation and/or
  16. * other materials provided with the distribution.
  17. *
  18. * o Neither the name of the copyright holder nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  25. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  27. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  29. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  30. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #ifndef _FSL_XBARB_H_
  35. #define _FSL_XBARB_H_
  36. #include "fsl_common.h"
  37. /*!
  38. * @addtogroup xbarb
  39. * @{
  40. */
  41. /*******************************************************************************
  42. * Definitions
  43. ******************************************************************************/
  44. #define FSL_XBARB_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) /*!< Version 2.0.1. */
  45. /* Macros for entire XBARB_SELx register. */
  46. #define XBARB_SELx(base, output) (*(volatile uint16_t *)((uintptr_t) & (base->SEL0) + ((output) / 2U) * 2U))
  47. /* Set the SELx field to a new value. */
  48. #define XBARB_WR_SELx_SELx(base, input, output) \
  49. (XBARB_SELx((base), (output)) = \
  50. ((XBARB_SELx((base), (output)) & ~(0xFFU << (XBARB_SEL0_SEL1_SHIFT * ((output) % 2U)))) | \
  51. ((input) << (XBARB_SEL0_SEL1_SHIFT * ((output) % 2U)))))
  52. /*******************************************************************************
  53. * API
  54. ******************************************************************************/
  55. #if defined(__cplusplus)
  56. extern "C" {
  57. #endif /* __cplusplus */
  58. /*!
  59. * @name XBARB functional Operation.
  60. * @{
  61. */
  62. /*!
  63. * @brief Initializes the XBARB module.
  64. *
  65. * This function un-gates the XBARB clock.
  66. *
  67. * @param base XBARB peripheral address.
  68. */
  69. void XBARB_Init(XBARB_Type *base);
  70. /*!
  71. * @brief Shuts down the XBARB module.
  72. *
  73. * This function disables XBARB clock.
  74. *
  75. * @param base XBARB peripheral address.
  76. */
  77. void XBARB_Deinit(XBARB_Type *base);
  78. /*!
  79. * @brief Configures a connection between the selected XBARB_IN[*] input and the XBARB_OUT[*] output signal.
  80. *
  81. * This function configures which XBARB input is connected to the selected XBARB output.
  82. * If more than one XBARB module is available, only the inputs and outputs from the same module
  83. * can be connected.
  84. *
  85. * @param base XBARB peripheral address.
  86. * @param input XBARB input signal.
  87. * @param output XBARB output signal.
  88. */
  89. void XBARB_SetSignalsConnection(XBARB_Type *base, xbar_input_signal_t input, xbar_output_signal_t output);
  90. #if defined(__cplusplus)
  91. }
  92. #endif /* __cplusplus */
  93. /*! @}*/
  94. /*!* @} */
  95. #endif /* _FSL_XBARB_H_ */