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_PT_PT_REVA_H_ 22 #define LIBRARIES_PERIPHDRIVERS_SOURCE_PT_PT_REVA_H_ 23 24 #include <stdio.h> 25 #include "pt.h" 26 #include "gcr_regs.h" 27 #include "pt_reva_regs.h" 28 #include "ptg_reva_regs.h" 29 #include "mxc_device.h" 30 #include "mxc_errors.h" 31 #include "mxc_assert.h" 32 #include "mxc_sys.h" 33 34 void MXC_PT_RevA_Init(mxc_ptg_reva_regs_t *ptg, mxc_clk_scale_t clk_scale); 35 int MXC_PT_RevA_Shutdown(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 36 int MXC_PT_RevA_Config(mxc_ptg_reva_regs_t *ptg, mxc_pt_cfg_t *cfg); 37 int MXC_PT_RevA_SqrWaveConfig(mxc_ptg_reva_regs_t *ptg, mxc_pt_cfg_t *sqwcfg, unsigned channel, 38 uint32_t freq); 39 void MXC_PT_RevA_Start(mxc_ptg_reva_regs_t *ptg, unsigned pts); 40 void MXC_PT_RevA_Stop(mxc_ptg_reva_regs_t *ptg, unsigned pts); 41 uint32_t MXC_PT_RevA_IsActive(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 42 void MXC_PT_RevA_SetPattern(unsigned pts, uint32_t pattern); 43 void MXC_PT_RevA_EnableInt(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 44 void MXC_PT_RevA_DisableInt(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 45 uint32_t MXC_PT_RevA_GetFlags(mxc_ptg_reva_regs_t *ptg); 46 void MXC_PT_RevA_ClearFlags(mxc_ptg_reva_regs_t *ptg, uint32_t flags); 47 void MXC_PT_RevA_EnableStopInt(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 48 void MXC_PT_RevA_DisableStopInt(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 49 uint32_t MXC_PT_RevA_GetStopFlags(mxc_ptg_reva_regs_t *ptg); 50 void MXC_PT_RevA_ClearStopFlags(mxc_ptg_reva_regs_t *ptg, uint32_t flags); 51 void MXC_PT_RevA_EnableRestart(unsigned start, unsigned stop, uint8_t restartIndex); 52 void MXC_PT_RevA_DisableRestart(unsigned channel, uint8_t restartIndex); 53 void MXC_PT_RevA_Resync(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 54 void MXC_PT_RevA_EnableReadyInt(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 55 void MXC_PT_RevA_DisableReadyInt(mxc_ptg_reva_regs_t *ptg, uint32_t pts); 56 uint32_t MXC_PT_RevA_GetReadyFlags(mxc_ptg_reva_regs_t *ptg); 57 void MXC_PT_RevA_ClearReadyFlags(mxc_ptg_reva_regs_t *ptg, uint32_t flags); 58 59 #endif // LIBRARIES_PERIPHDRIVERS_SOURCE_PT_PT_REVA_H_ 60