The section describes the programming interface of the AOI Peripheral driver.
Overview
The AOI peripheral driver configures the AOI (AND/OR/INVERT) module and handles the initialization and configuration of the AOI module.
Initialization
To initialize the AOI module, call the AOI_DRV_Init() function. After initialization, the AOI module is set to a reset state.
Event output configuration
The AOI module provides a universal boolean function generator using a four-term sum of products expression with each product term containing true or complement values of the four selected event inputs (A, B, C, D). The AOI is a highly programmable module for creating combinational boolean outputs for use as hardware triggers. Each selected input term in each product term can be configured to produce a logical 0 or 1 or pass the true or complement of the selected event input. To configure the selected AOI module event, call the API of the AOI_DRV_SetEventLogic() function. To configure only one product term logic, call the AOI_DRV_SetProductTermLogic() function. The AOI module does not support any special modes of operation.
Call diagram
- Call the AOI_DRV_Init() function to initialize AOI to a known state.
- Optionally, call the AOI_DRV_SetEventLogic() function to configure the Boolean evaluation in all product terms in one event. Use the configuration structure, aoi_event_config_t and number of the event, when calling this function.
- Optionally, call the AOI_DRV_SetProductTermLogic() function to configure the Boolean evaluation associated with all inputs in one product and in one event. Use the configuration structure, aoi_product_term_config_t and the product term and number of the event when calling this function.
- Finally, the AOI works properly.
If you want to stop the AOI module, call the void AOI_DRV_Deinit() function. This clears the AOI module configuration and disables the clock gate.
This is an example to initialize and configure the AOI driver for a possible use case. Because the AOI module function is directly connected with an XBAR (Inter-peripheral crossbar) module, other peripheral (PIT, CMP and XBAR) drivers are used to show full functionality of AOI module.
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "board.h"
#include "fsl_cmp_driver.h"
#include "fsl_device_registers.h"
#include "fsl_aoi_driver.h"
#include "fsl_pit_driver.h"
#include "fsl_xbar_driver.h"
#define DEMO_CMP0_INSTANCE (0U)
#define DEMO_PIT0_INSTANCE (0U)
/****************************************************************************** Definition
struct aoi_product_term_config_t |
struct aoi_event_config_t |
This function initializes AOI module. It configures all the AOI module inputs of all events to the reset state (kAoiLogicZero).
This is an example to initialize the AOI module:
- Parameters
-
instance | The instance number of the AOI peripheral |
- Returns
- kStatus_AOI_Success indicating successful initialization
This function clears all configurations and shuts down the AOI module clock to reduce the power consumption.
- Parameters
-
instance | The instance number of the AOI peripheral |
- Returns
- kStatus_AOI_Success indicating successful de-initialization
This function configures an AOI event according to the aoiEventConfig structure. This function configures all inputs (A, B, C, and D) of all product terms (0, 1, 2, and 3) of a desired event. This is an example to set up the AOI Event structure:
- Parameters
-
instance | The instance number of the AOI peripheral |
event | Event which will be configured of type aoi_event_index_t. |
eventConfigPtr | Pointer to type aoi_event_config_t structure. The user is responsible to fill out the members of this structure and pass the pointer to this function. |
- Returns
- An error code or kStatus_AOI_Success.
This function configures an AOI module product terms for a specific event. The user has to select the event and the product term which is configured and fill the AoiProductTermConfig configuration structure.
Example:
- Parameters
-
instance | The instance number of the AOI peripheral |
event | Event which will be configured of type aoi_event_index_t. |
productTerm | Product term which will be configured of type aoi_product_term_t. |
productTermConfigPtr | Pointer to type aoi_product_term_config_t structure. The user is responsible to fill out the members of this structure and pass the pointer to this function. |
- Returns
- An error code or kStatus_AOI_Success.
AOI_Type* const g_aoiBase[] |