fsl_aipstz.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * The Clear BSD License
  3. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  4. * Copyright 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_AIPSTZ_H_
  35. #define _FSL_AIPSTZ_H_
  36. #include "fsl_common.h"
  37. /*!
  38. * @addtogroup aipstz
  39. * @{
  40. */
  41. /*******************************************************************************
  42. * Definitions
  43. ******************************************************************************/
  44. /*! @name Driver version */
  45. /*@{*/
  46. #define FSL_AIPSTZ_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0 */
  47. /*@}*/
  48. /*! @brief List of AIPSTZ privilege configuration.*/
  49. typedef enum _aipstz_master_privilege_level {
  50. kAIPSTZ_MasterBufferedWriteEnable = (1U << 3), /*!< Write accesses from this master are allowed to be buffered. */
  51. kAIPSTZ_MasterTrustedForReadEnable = (1U << 2), /*!< This master is trusted for read accesses. */
  52. kAIPSTZ_MasterTrustedForWriteEnable = (1U << 1), /*!< This master is trusted for write accesses. */
  53. kAIPSTZ_MasterForceUserModeEnable = 1U /*!< Accesses from this master are forced to user-mode. */
  54. } aipstz_master_privilege_level_t;
  55. /*! @brief List of AIPSTZ masters. Organized by width for the 8-15 bits and shift for lower 8 bits.*/
  56. typedef enum _aipstz_master {
  57. kAIPSTZ_Master0 = (0x400U | 28U),
  58. kAIPSTZ_Master1 = (0x400U | 24U),
  59. kAIPSTZ_Master2 = (0x400U | 20U),
  60. kAIPSTZ_Master3 = (0x400U | 16U),
  61. kAIPSTZ_Master5 = (0x400U | 8U)
  62. } aipstz_master_t;
  63. /*! @brief List of AIPSTZ peripheral access control configuration.*/
  64. typedef enum _aipstz_peripheral_access_control {
  65. kAIPSTZ_PeripheralAllowUntrustedMaster = 1U,
  66. kAIPSTZ_PeripheralWriteProtected = (1U << 1),
  67. kAIPSTZ_PeripheralRequireSupervisor = (1U << 2),
  68. kAIPSTZ_PeripheralAllowBufferedWrite = (1U << 3)
  69. } aipstz_peripheral_access_control_t;
  70. /*! @brief List of AIPSTZ peripherals. Organized by register offset for higher 32 bits, width for the 8-15 bits and shift for lower 8 bits.*/
  71. typedef enum _aipstz_peripheral {
  72. kAIPSTZ_Peripheral0 = ((0x40 << 16) | (4 << 8) | 28),
  73. kAIPSTZ_Peripheral1 = ((0x40 << 16) | (4 << 8) | 24),
  74. kAIPSTZ_Peripheral2 = ((0x40 << 16) | (4 << 8) | 20),
  75. kAIPSTZ_Peripheral3 = ((0x40 << 16) | (4 << 8) | 16),
  76. kAIPSTZ_Peripheral4 = ((0x40 << 16) | (4 << 8) | 12),
  77. kAIPSTZ_Peripheral5 = ((0x40 << 16) | (4 << 8) | 8),
  78. kAIPSTZ_Peripheral6 = ((0x40 << 16) | (4 << 8) | 4),
  79. kAIPSTZ_Peripheral7 = ((0x40 << 16) | (4 << 8) | 0),
  80. kAIPSTZ_Peripheral8 = ((0x44 << 16) | (4 << 8) | 28),
  81. kAIPSTZ_Peripheral9 = ((0x44 << 16) | (4 << 8) | 24),
  82. kAIPSTZ_Peripheral10 = ((0x44 << 16) | (4 << 8) | 20),
  83. kAIPSTZ_Peripheral11 = ((0x44 << 16) | (4 << 8) | 16),
  84. kAIPSTZ_Peripheral12 = ((0x44 << 16) | (4 << 8) | 12),
  85. kAIPSTZ_Peripheral13 = ((0x44 << 16) | (4 << 8) | 8),
  86. kAIPSTZ_Peripheral14 = ((0x44 << 16) | (4 << 8) | 4),
  87. kAIPSTZ_Peripheral15 = ((0x44 << 16) | (4 << 8) | 0),
  88. kAIPSTZ_Peripheral16 = ((0x48 << 16) | (4 << 8) | 28),
  89. kAIPSTZ_Peripheral17 = ((0x48 << 16) | (4 << 8) | 24),
  90. kAIPSTZ_Peripheral18 = ((0x48 << 16) | (4 << 8) | 20),
  91. kAIPSTZ_Peripheral19 = ((0x48 << 16) | (4 << 8) | 16),
  92. kAIPSTZ_Peripheral20 = ((0x48 << 16) | (4 << 8) | 12),
  93. kAIPSTZ_Peripheral21 = ((0x48 << 16) | (4 << 8) | 8),
  94. kAIPSTZ_Peripheral22 = ((0x48 << 16) | (4 << 8) | 4),
  95. kAIPSTZ_Peripheral23 = ((0x48 << 16) | (4 << 8) | 0),
  96. kAIPSTZ_Peripheral24 = ((0x4C << 16) | (4 << 8) | 28),
  97. kAIPSTZ_Peripheral25 = ((0x4C << 16) | (4 << 8) | 24),
  98. kAIPSTZ_Peripheral26 = ((0x4C << 16) | (4 << 8) | 20),
  99. kAIPSTZ_Peripheral27 = ((0x4C << 16) | (4 << 8) | 16),
  100. kAIPSTZ_Peripheral28 = ((0x4C << 16) | (4 << 8) | 12),
  101. kAIPSTZ_Peripheral29 = ((0x4C << 16) | (4 << 8) | 8),
  102. kAIPSTZ_Peripheral30 = ((0x4C << 16) | (4 << 8) | 4),
  103. kAIPSTZ_Peripheral31 = ((0x4C << 16) | (4 << 8) | 0),
  104. kAIPSTZ_Peripheral32 = ((0x50 << 16) | (4 << 8) | 28),
  105. kAIPSTZ_Peripheral33 = ((0x50 << 16) | (4 << 8) | 24)
  106. } aipstz_peripheral_t;
  107. /*******************************************************************************
  108. * API
  109. ******************************************************************************/
  110. #if defined(__cplusplus)
  111. extern "C" {
  112. #endif
  113. /*!
  114. * @name Initialization and deinitialization
  115. * @{
  116. */
  117. /*!
  118. * @brief Configure the privilege level for master.
  119. *
  120. * @param base AIPSTZ peripheral base pointer
  121. * @param master Masters for AIPSTZ.
  122. * @param privilegeConfig Configuration is ORed from @aipstz_master_privilege_level_t.
  123. */
  124. void AIPSTZ_SetMasterPriviledgeLevel(AIPSTZ_Type *base, aipstz_master_t master, uint32_t privilegeConfig);
  125. /*!
  126. * @brief Configure the access for peripheral.
  127. *
  128. * @param base AIPSTZ peripheral base pointer
  129. * @param master Peripheral for AIPSTZ.
  130. * @param accessControl Configuration is ORed from @aipstz_peripheral_access_control_t.
  131. */
  132. void AIPSTZ_SetPeripheralAccessControl(AIPSTZ_Type *base, aipstz_peripheral_t peripheral, uint32_t accessControl);
  133. /*! @}*/
  134. #if defined(__cplusplus)
  135. }
  136. #endif
  137. /*! @}*/
  138. #endif /* _FSL_AIPSTZ_H_ */