fsl_aoi.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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_AOI_H_
  35. #define _FSL_AOI_H_
  36. #include "fsl_common.h"
  37. /*!
  38. * @addtogroup aoi
  39. * @{
  40. */
  41. /*******************************************************************************
  42. * Definitions
  43. ******************************************************************************/
  44. #ifndef AOI
  45. #define AOI AOI0 /*!< AOI peripheral address */
  46. #endif
  47. /*! @name Driver version */
  48. /*@{*/
  49. #define FSL_AOI_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */
  50. /*@}*/
  51. /*!
  52. * @brief AOI input configurations.
  53. *
  54. * The selection item represents the Boolean evaluations.
  55. */
  56. typedef enum _aoi_input_config
  57. {
  58. kAOI_LogicZero = 0x0U, /*!< Forces the input to logical zero. */
  59. kAOI_InputSignal = 0x1U, /*!< Passes the input signal. */
  60. kAOI_InvInputSignal = 0x2U, /*!< Inverts the input signal. */
  61. kAOI_LogicOne = 0x3U /*!< Forces the input to logical one. */
  62. } aoi_input_config_t;
  63. /*!
  64. * @brief AOI event indexes, where an event is the collection of the four product
  65. * terms (0, 1, 2, and 3) and the four signal inputs (A, B, C, and D).
  66. */
  67. typedef enum _aoi_event
  68. {
  69. kAOI_Event0 = 0x0U, /*!< Event 0 index */
  70. kAOI_Event1 = 0x1U, /*!< Event 1 index */
  71. kAOI_Event2 = 0x2U, /*!< Event 2 index */
  72. kAOI_Event3 = 0x3U /*!< Event 3 index */
  73. } aoi_event_t;
  74. /*!
  75. * @brief AOI event configuration structure
  76. *
  77. * Defines structure _aoi_event_config and use the AOI_SetEventLogicConfig() function to make
  78. * whole event configuration.
  79. */
  80. typedef struct _aoi_event_config
  81. {
  82. aoi_input_config_t PT0AC; /*!< Product term 0 input A */
  83. aoi_input_config_t PT0BC; /*!< Product term 0 input B */
  84. aoi_input_config_t PT0CC; /*!< Product term 0 input C */
  85. aoi_input_config_t PT0DC; /*!< Product term 0 input D */
  86. aoi_input_config_t PT1AC; /*!< Product term 1 input A */
  87. aoi_input_config_t PT1BC; /*!< Product term 1 input B */
  88. aoi_input_config_t PT1CC; /*!< Product term 1 input C */
  89. aoi_input_config_t PT1DC; /*!< Product term 1 input D */
  90. aoi_input_config_t PT2AC; /*!< Product term 2 input A */
  91. aoi_input_config_t PT2BC; /*!< Product term 2 input B */
  92. aoi_input_config_t PT2CC; /*!< Product term 2 input C */
  93. aoi_input_config_t PT2DC; /*!< Product term 2 input D */
  94. aoi_input_config_t PT3AC; /*!< Product term 3 input A */
  95. aoi_input_config_t PT3BC; /*!< Product term 3 input B */
  96. aoi_input_config_t PT3CC; /*!< Product term 3 input C */
  97. aoi_input_config_t PT3DC; /*!< Product term 3 input D */
  98. } aoi_event_config_t;
  99. /*******************************************************************************
  100. * API
  101. ******************************************************************************/
  102. #if defined(__cplusplus)
  103. extern "C" {
  104. #endif /* __cplusplus*/
  105. /*!
  106. * @name AOI Initialization
  107. * @{
  108. */
  109. /*!
  110. * @brief Initializes an AOI instance for operation.
  111. *
  112. * This function un-gates the AOI clock.
  113. *
  114. * @param base AOI peripheral address.
  115. */
  116. void AOI_Init(AOI_Type *base);
  117. /*!
  118. * @brief Deinitializes an AOI instance for operation.
  119. *
  120. * This function shutdowns AOI module.
  121. *
  122. * @param base AOI peripheral address.
  123. */
  124. void AOI_Deinit(AOI_Type *base);
  125. /*@}*/
  126. /*!
  127. * @name AOI Get Set Operation
  128. * @{
  129. */
  130. /*!
  131. * @brief Gets the Boolean evaluation associated.
  132. *
  133. * This function returns the Boolean evaluation associated.
  134. *
  135. * Example:
  136. @code
  137. aoi_event_config_t demoEventLogicStruct;
  138. AOI_GetEventLogicConfig(AOI, kAOI_Event0, &demoEventLogicStruct);
  139. @endcode
  140. *
  141. * @param base AOI peripheral address.
  142. * @param event Index of the event which will be set of type aoi_event_t.
  143. * @param config Selected input configuration .
  144. */
  145. void AOI_GetEventLogicConfig(AOI_Type *base, aoi_event_t event, aoi_event_config_t *config);
  146. /*!
  147. * @brief Configures an AOI event.
  148. *
  149. * This function configures an AOI event according
  150. * to the aoiEventConfig structure. This function configures all inputs (A, B, C, and D)
  151. * of all product terms (0, 1, 2, and 3) of a desired event.
  152. *
  153. * Example:
  154. @code
  155. aoi_event_config_t demoEventLogicStruct;
  156. demoEventLogicStruct.PT0AC = kAOI_InvInputSignal;
  157. demoEventLogicStruct.PT0BC = kAOI_InputSignal;
  158. demoEventLogicStruct.PT0CC = kAOI_LogicOne;
  159. demoEventLogicStruct.PT0DC = kAOI_LogicOne;
  160. demoEventLogicStruct.PT1AC = kAOI_LogicZero;
  161. demoEventLogicStruct.PT1BC = kAOI_LogicOne;
  162. demoEventLogicStruct.PT1CC = kAOI_LogicOne;
  163. demoEventLogicStruct.PT1DC = kAOI_LogicOne;
  164. demoEventLogicStruct.PT2AC = kAOI_LogicZero;
  165. demoEventLogicStruct.PT2BC = kAOI_LogicOne;
  166. demoEventLogicStruct.PT2CC = kAOI_LogicOne;
  167. demoEventLogicStruct.PT2DC = kAOI_LogicOne;
  168. demoEventLogicStruct.PT3AC = kAOI_LogicZero;
  169. demoEventLogicStruct.PT3BC = kAOI_LogicOne;
  170. demoEventLogicStruct.PT3CC = kAOI_LogicOne;
  171. demoEventLogicStruct.PT3DC = kAOI_LogicOne;
  172. AOI_SetEventLogicConfig(AOI, kAOI_Event0, demoEventLogicStruct);
  173. @endcode
  174. *
  175. * @param base AOI peripheral address.
  176. * @param event Event which will be configured of type aoi_event_t.
  177. * @param eventConfig Pointer to type aoi_event_config_t structure. The user is responsible for
  178. * filling out the members of this structure and passing the pointer to this function.
  179. */
  180. void AOI_SetEventLogicConfig(AOI_Type *base, aoi_event_t event, const aoi_event_config_t *eventConfig);
  181. #if defined(__cplusplus)
  182. }
  183. #endif /* __cplusplus*/
  184. /*@}*/
  185. /*!* @} */
  186. #endif /* _FSL_AOI_H_*/