Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:58

0001 /*
0002  * Copyright (c) 2015, Freescale Semiconductor, Inc.
0003  * Copyright 2016-2019 NXP
0004  * All rights reserved.
0005  *
0006  * SPDX-License-Identifier: BSD-3-Clause
0007  */
0008 #ifndef _FSL_AOI_H_
0009 #define _FSL_AOI_H_
0010 
0011 #include "fsl_common.h"
0012 
0013 /*!
0014  * @addtogroup aoi
0015  * @{
0016  */
0017 
0018 /*******************************************************************************
0019  * Definitions
0020  ******************************************************************************/
0021 #ifndef AOI
0022 #define AOI AOI0 /*!< AOI peripheral address */
0023 #endif
0024 
0025 /*! @name Driver version */
0026 /*@{*/
0027 #define FSL_AOI_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) /*!< Version 2.0.1. */
0028 /*@}*/
0029 
0030 /*!
0031  * @brief AOI input configurations.
0032  *
0033  * The selection item represents the Boolean evaluations.
0034  */
0035 typedef enum _aoi_input_config
0036 {
0037     kAOI_LogicZero      = 0x0U, /*!< Forces the input to logical zero. */
0038     kAOI_InputSignal    = 0x1U, /*!< Passes the input signal. */
0039     kAOI_InvInputSignal = 0x2U, /*!< Inverts the input signal. */
0040     kAOI_LogicOne       = 0x3U  /*!< Forces the input to logical one. */
0041 } aoi_input_config_t;
0042 
0043 /*!
0044  * @brief AOI event indexes, where an event is the collection of the four product
0045  *        terms (0, 1, 2, and 3) and the four signal inputs (A, B, C, and D).
0046  */
0047 typedef enum _aoi_event
0048 {
0049     kAOI_Event0 = 0x0U, /*!< Event 0 index */
0050     kAOI_Event1 = 0x1U, /*!< Event 1 index */
0051     kAOI_Event2 = 0x2U, /*!< Event 2 index */
0052     kAOI_Event3 = 0x3U  /*!< Event 3 index */
0053 } aoi_event_t;
0054 
0055 /*!
0056  * @brief AOI event configuration structure
0057  *
0058  * Defines structure _aoi_event_config and use the AOI_SetEventLogicConfig() function to make
0059  * whole event configuration.
0060  */
0061 typedef struct _aoi_event_config
0062 {
0063     aoi_input_config_t PT0AC; /*!< Product term 0 input A */
0064     aoi_input_config_t PT0BC; /*!< Product term 0 input B */
0065     aoi_input_config_t PT0CC; /*!< Product term 0 input C */
0066     aoi_input_config_t PT0DC; /*!< Product term 0 input D */
0067     aoi_input_config_t PT1AC; /*!< Product term 1 input A */
0068     aoi_input_config_t PT1BC; /*!< Product term 1 input B */
0069     aoi_input_config_t PT1CC; /*!< Product term 1 input C */
0070     aoi_input_config_t PT1DC; /*!< Product term 1 input D */
0071     aoi_input_config_t PT2AC; /*!< Product term 2 input A */
0072     aoi_input_config_t PT2BC; /*!< Product term 2 input B */
0073     aoi_input_config_t PT2CC; /*!< Product term 2 input C */
0074     aoi_input_config_t PT2DC; /*!< Product term 2 input D */
0075     aoi_input_config_t PT3AC; /*!< Product term 3 input A */
0076     aoi_input_config_t PT3BC; /*!< Product term 3 input B */
0077     aoi_input_config_t PT3CC; /*!< Product term 3 input C */
0078     aoi_input_config_t PT3DC; /*!< Product term 3 input D */
0079 } aoi_event_config_t;
0080 
0081 /*******************************************************************************
0082  * API
0083  ******************************************************************************/
0084 
0085 #if defined(__cplusplus)
0086 extern "C" {
0087 #endif /* __cplusplus*/
0088 
0089 /*!
0090  * @name  AOI Initialization
0091  * @{
0092  */
0093 
0094 /*!
0095  * @brief Initializes an AOI instance for operation.
0096  *
0097  * This function un-gates the AOI clock.
0098  *
0099  * @param base AOI peripheral address.
0100  */
0101 void AOI_Init(AOI_Type *base);
0102 
0103 /*!
0104  * @brief Deinitializes an AOI instance for operation.
0105  *
0106  * This function shutdowns AOI module.
0107  *
0108  * @param  base AOI peripheral address.
0109  */
0110 void AOI_Deinit(AOI_Type *base);
0111 
0112 /*@}*/
0113 
0114 /*!
0115  * @name  AOI Get Set Operation
0116  * @{
0117  */
0118 
0119 /*!
0120  * @brief Gets the Boolean evaluation associated.
0121  *
0122  * This function returns the Boolean evaluation associated.
0123  *
0124  * Example:
0125   @code
0126     aoi_event_config_t demoEventLogicStruct;
0127 
0128     AOI_GetEventLogicConfig(AOI, kAOI_Event0, &demoEventLogicStruct);
0129   @endcode
0130  *
0131  * @param  base AOI peripheral address.
0132  * @param  event Index of the event which will be set of type aoi_event_t.
0133  * @param  config Selected input configuration .
0134  */
0135 void AOI_GetEventLogicConfig(AOI_Type *base, aoi_event_t event, aoi_event_config_t *config);
0136 
0137 /*!
0138  * @brief Configures an AOI event.
0139  *
0140  * This function configures an AOI event according
0141  * to the aoiEventConfig structure. This function configures all  inputs (A, B, C, and D)
0142  * of all  product terms (0, 1, 2, and 3) of a desired event.
0143  *
0144  * Example:
0145   @code
0146     aoi_event_config_t demoEventLogicStruct;
0147 
0148     demoEventLogicStruct.PT0AC = kAOI_InvInputSignal;
0149     demoEventLogicStruct.PT0BC = kAOI_InputSignal;
0150     demoEventLogicStruct.PT0CC = kAOI_LogicOne;
0151     demoEventLogicStruct.PT0DC = kAOI_LogicOne;
0152 
0153     demoEventLogicStruct.PT1AC = kAOI_LogicZero;
0154     demoEventLogicStruct.PT1BC = kAOI_LogicOne;
0155     demoEventLogicStruct.PT1CC = kAOI_LogicOne;
0156     demoEventLogicStruct.PT1DC = kAOI_LogicOne;
0157 
0158     demoEventLogicStruct.PT2AC = kAOI_LogicZero;
0159     demoEventLogicStruct.PT2BC = kAOI_LogicOne;
0160     demoEventLogicStruct.PT2CC = kAOI_LogicOne;
0161     demoEventLogicStruct.PT2DC = kAOI_LogicOne;
0162 
0163     demoEventLogicStruct.PT3AC = kAOI_LogicZero;
0164     demoEventLogicStruct.PT3BC = kAOI_LogicOne;
0165     demoEventLogicStruct.PT3CC = kAOI_LogicOne;
0166     demoEventLogicStruct.PT3DC = kAOI_LogicOne;
0167 
0168     AOI_SetEventLogicConfig(AOI, kAOI_Event0, demoEventLogicStruct);
0169   @endcode
0170  *
0171  * @param  base AOI peripheral address.
0172  * @param  event Event which will be configured of type aoi_event_t.
0173  * @param  eventConfig Pointer to type aoi_event_config_t structure. The user is responsible for
0174  * filling out the members of this structure and passing the pointer to this function.
0175  */
0176 void AOI_SetEventLogicConfig(AOI_Type *base, aoi_event_t event, const aoi_event_config_t *eventConfig);
0177 
0178 #if defined(__cplusplus)
0179 }
0180 #endif /* __cplusplus*/
0181 
0182 /*@}*/
0183 
0184 /*!* @} */
0185 
0186 #endif /* _FSL_AOI_H_*/