1 /****************************************************************************** 2 * 3 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by 4 * Analog Devices, Inc.), 5 * Copyright (C) 2023-2024 Analog Devices, Inc. 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 ******************************************************************************/ 20 21 #ifndef LIBRARIES_PERIPHDRIVERS_SOURCE_ADC_ADC_REVB_H_ 22 #define LIBRARIES_PERIPHDRIVERS_SOURCE_ADC_ADC_REVB_H_ 23 24 #include <stdio.h> 25 #include "adc.h" 26 #include "adc_revb_regs.h" 27 28 #include "mxc_device.h" 29 #include "mxc_errors.h" 30 #include "mxc_assert.h" 31 #include "mxc_sys.h" 32 #include "mcr_regs.h" 33 #include "mxc_lock.h" 34 35 int MXC_ADC_RevB_Init(mxc_adc_revb_regs_t *adc, mxc_adc_req_t *req); 36 37 int MXC_ADC_RevB_Shutdown(mxc_adc_revb_regs_t *adc); 38 39 void MXC_ADC_RevB_EnableInt(mxc_adc_revb_regs_t *adc, uint32_t flags); 40 41 void MXC_ADC_RevB_DisableInt(mxc_adc_revb_regs_t *adc, uint32_t flags); 42 43 int MXC_ADC_RevB_GetFlags(mxc_adc_revb_regs_t *adc); 44 45 void MXC_ADC_RevB_ClearFlags(mxc_adc_revb_regs_t *adc, uint32_t flags); 46 47 void MXC_ADC_RevB_ClockSelect(mxc_adc_revb_regs_t *adc, mxc_adc_clock_t clock); 48 49 int MXC_ADC_RevB_StartConversion(mxc_adc_revb_regs_t *adcq); 50 51 int MXC_ADC_RevB_StartConversionAsync(mxc_adc_revb_regs_t *adc, mxc_adc_complete_cb_t callback); 52 53 int MXC_ADC_RevB_StartConversionDMA(mxc_adc_revb_regs_t *adc, mxc_adc_conversion_req_t *req, 54 int *data, void (*callback)(int, int)); 55 56 int MXC_ADC_RevB_Handler(mxc_adc_revb_regs_t *adc); 57 58 void MXC_ADC_RevB_EnableConversion(mxc_adc_revb_regs_t *adc); 59 60 void MXC_ADC_RevB_DisableConversion(mxc_adc_revb_regs_t *adc); 61 62 void MXC_ADC_RevB_TS_SelectEnable(mxc_adc_revb_regs_t *adc); 63 64 void MXC_ADC_RevB_TS_SelectDisable(mxc_adc_revb_regs_t *adc); 65 66 int MXC_ADC_RevB_GetData(mxc_adc_revb_regs_t *adc, int *outdata); 67 68 uint16_t MXC_ADC_RevB_FIFO_Level(mxc_adc_revb_regs_t *adc); 69 70 int MXC_ADC_RevB_FIFO_Threshold_Config(mxc_adc_revb_regs_t *adc, uint32_t fifo_threshold); 71 72 int MXC_ADC_RevB_AverageConfig(mxc_adc_revb_regs_t *adc, mxc_adc_avg_t avg_number); 73 74 void MXC_ADC_RevB_Clear_ChannelSelect(mxc_adc_revb_regs_t *adc); 75 76 void MXC_ADC_RevB_TriggerConfig(mxc_adc_revb_regs_t *adc, mxc_adc_conversion_req_t *req); 77 78 void MXC_ADC_RevB_ConversionModeConfig(mxc_adc_revb_regs_t *adc, mxc_adc_conversion_req_t *req); 79 80 int MXC_ADC_RevB_SetConversionDelay(mxc_adc_revb_regs_t *adc, int delay); 81 82 int MXC_ADC_RevB_SlotsConfig(mxc_adc_revb_regs_t *adc, mxc_adc_conversion_req_t *req); 83 84 int MXC_ADC_RevB_ChSelectConfig(mxc_adc_revb_regs_t *adc, mxc_adc_chsel_t ch, uint32_t slot_num); 85 86 #endif // LIBRARIES_PERIPHDRIVERS_SOURCE_ADC_ADC_REVB_H_ 87