Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

187 rader
5.4 KiB

  1. /*
  2. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2019 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _FSL_AOI_H_
  9. #define _FSL_AOI_H_
  10. #include "fsl_common.h"
  11. /*!
  12. * @addtogroup aoi
  13. * @{
  14. */
  15. /*******************************************************************************
  16. * Definitions
  17. ******************************************************************************/
  18. #ifndef AOI
  19. #define AOI AOI0 /*!< AOI peripheral address */
  20. #endif
  21. /*! @name Driver version */
  22. /*@{*/
  23. #define FSL_AOI_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) /*!< Version 2.0.1. */
  24. /*@}*/
  25. /*!
  26. * @brief AOI input configurations.
  27. *
  28. * The selection item represents the Boolean evaluations.
  29. */
  30. typedef enum _aoi_input_config
  31. {
  32. kAOI_LogicZero = 0x0U, /*!< Forces the input to logical zero. */
  33. kAOI_InputSignal = 0x1U, /*!< Passes the input signal. */
  34. kAOI_InvInputSignal = 0x2U, /*!< Inverts the input signal. */
  35. kAOI_LogicOne = 0x3U /*!< Forces the input to logical one. */
  36. } aoi_input_config_t;
  37. /*!
  38. * @brief AOI event indexes, where an event is the collection of the four product
  39. * terms (0, 1, 2, and 3) and the four signal inputs (A, B, C, and D).
  40. */
  41. typedef enum _aoi_event
  42. {
  43. kAOI_Event0 = 0x0U, /*!< Event 0 index */
  44. kAOI_Event1 = 0x1U, /*!< Event 1 index */
  45. kAOI_Event2 = 0x2U, /*!< Event 2 index */
  46. kAOI_Event3 = 0x3U /*!< Event 3 index */
  47. } aoi_event_t;
  48. /*!
  49. * @brief AOI event configuration structure
  50. *
  51. * Defines structure _aoi_event_config and use the AOI_SetEventLogicConfig() function to make
  52. * whole event configuration.
  53. */
  54. typedef struct _aoi_event_config
  55. {
  56. aoi_input_config_t PT0AC; /*!< Product term 0 input A */
  57. aoi_input_config_t PT0BC; /*!< Product term 0 input B */
  58. aoi_input_config_t PT0CC; /*!< Product term 0 input C */
  59. aoi_input_config_t PT0DC; /*!< Product term 0 input D */
  60. aoi_input_config_t PT1AC; /*!< Product term 1 input A */
  61. aoi_input_config_t PT1BC; /*!< Product term 1 input B */
  62. aoi_input_config_t PT1CC; /*!< Product term 1 input C */
  63. aoi_input_config_t PT1DC; /*!< Product term 1 input D */
  64. aoi_input_config_t PT2AC; /*!< Product term 2 input A */
  65. aoi_input_config_t PT2BC; /*!< Product term 2 input B */
  66. aoi_input_config_t PT2CC; /*!< Product term 2 input C */
  67. aoi_input_config_t PT2DC; /*!< Product term 2 input D */
  68. aoi_input_config_t PT3AC; /*!< Product term 3 input A */
  69. aoi_input_config_t PT3BC; /*!< Product term 3 input B */
  70. aoi_input_config_t PT3CC; /*!< Product term 3 input C */
  71. aoi_input_config_t PT3DC; /*!< Product term 3 input D */
  72. } aoi_event_config_t;
  73. /*******************************************************************************
  74. * API
  75. ******************************************************************************/
  76. #if defined(__cplusplus)
  77. extern "C" {
  78. #endif /* __cplusplus*/
  79. /*!
  80. * @name AOI Initialization
  81. * @{
  82. */
  83. /*!
  84. * @brief Initializes an AOI instance for operation.
  85. *
  86. * This function un-gates the AOI clock.
  87. *
  88. * @param base AOI peripheral address.
  89. */
  90. void AOI_Init(AOI_Type *base);
  91. /*!
  92. * @brief Deinitializes an AOI instance for operation.
  93. *
  94. * This function shutdowns AOI module.
  95. *
  96. * @param base AOI peripheral address.
  97. */
  98. void AOI_Deinit(AOI_Type *base);
  99. /*@}*/
  100. /*!
  101. * @name AOI Get Set Operation
  102. * @{
  103. */
  104. /*!
  105. * @brief Gets the Boolean evaluation associated.
  106. *
  107. * This function returns the Boolean evaluation associated.
  108. *
  109. * Example:
  110. @code
  111. aoi_event_config_t demoEventLogicStruct;
  112. AOI_GetEventLogicConfig(AOI, kAOI_Event0, &demoEventLogicStruct);
  113. @endcode
  114. *
  115. * @param base AOI peripheral address.
  116. * @param event Index of the event which will be set of type aoi_event_t.
  117. * @param config Selected input configuration .
  118. */
  119. void AOI_GetEventLogicConfig(AOI_Type *base, aoi_event_t event, aoi_event_config_t *config);
  120. /*!
  121. * @brief Configures an AOI event.
  122. *
  123. * This function configures an AOI event according
  124. * to the aoiEventConfig structure. This function configures all inputs (A, B, C, and D)
  125. * of all product terms (0, 1, 2, and 3) of a desired event.
  126. *
  127. * Example:
  128. @code
  129. aoi_event_config_t demoEventLogicStruct;
  130. demoEventLogicStruct.PT0AC = kAOI_InvInputSignal;
  131. demoEventLogicStruct.PT0BC = kAOI_InputSignal;
  132. demoEventLogicStruct.PT0CC = kAOI_LogicOne;
  133. demoEventLogicStruct.PT0DC = kAOI_LogicOne;
  134. demoEventLogicStruct.PT1AC = kAOI_LogicZero;
  135. demoEventLogicStruct.PT1BC = kAOI_LogicOne;
  136. demoEventLogicStruct.PT1CC = kAOI_LogicOne;
  137. demoEventLogicStruct.PT1DC = kAOI_LogicOne;
  138. demoEventLogicStruct.PT2AC = kAOI_LogicZero;
  139. demoEventLogicStruct.PT2BC = kAOI_LogicOne;
  140. demoEventLogicStruct.PT2CC = kAOI_LogicOne;
  141. demoEventLogicStruct.PT2DC = kAOI_LogicOne;
  142. demoEventLogicStruct.PT3AC = kAOI_LogicZero;
  143. demoEventLogicStruct.PT3BC = kAOI_LogicOne;
  144. demoEventLogicStruct.PT3CC = kAOI_LogicOne;
  145. demoEventLogicStruct.PT3DC = kAOI_LogicOne;
  146. AOI_SetEventLogicConfig(AOI, kAOI_Event0, demoEventLogicStruct);
  147. @endcode
  148. *
  149. * @param base AOI peripheral address.
  150. * @param event Event which will be configured of type aoi_event_t.
  151. * @param eventConfig Pointer to type aoi_event_config_t structure. The user is responsible for
  152. * filling out the members of this structure and passing the pointer to this function.
  153. */
  154. void AOI_SetEventLogicConfig(AOI_Type *base, aoi_event_t event, const aoi_event_config_t *eventConfig);
  155. #if defined(__cplusplus)
  156. }
  157. #endif /* __cplusplus*/
  158. /*@}*/
  159. /*!* @} */
  160. #endif /* _FSL_AOI_H_*/