libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
opamp_common_all.h
Go to the documentation of this file.
1/** @addtogroup opamp_defines
2 *
3 * @date 10 Dec 2020
4 *
5 *LGPL License Terms @ref lgpl_license
6 */
7/*
8 * This file is part of the libopencm3 project.
9 *
10 * This library is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24/** @cond */
25#if defined(LIBOPENCM3_OPAMP_H)
26/** @endcond */
27#ifndef LIBOPENCM3_OPAMP_COMMON_ALL_H
28#define LIBOPENCM3_OPAMP_COMMON_ALL_H
29/**@{*/
30
31/* OpAmp registers */
32
33/* Control and status register (OPAMPx_CSR) */
34#define OPAMP_CSR(opamp_base) MMIO32((opamp_base) + 0x00)
35
36/* OPAMPx_CSR values */
37
38#define OPAMP_CSR_LOCK (0x1 << 31)
39
40#define OPAMP_CSR_TSTREF (0x1 << 29)
41
42#define OPAMP_CSR_TRIMOFFSETN_MASK (0x1f)
43#define OPAMP_CSR_TRIMOFFSETN_SHIFT (24)
44
45#define OPAMP_CSR_TRIMOFFSETP_MASK (0x1f)
46#define OPAMP_CSR_TRIMOFFSETP_SHIFT (19)
47
48#define OPAMP_CSR_CALSEL_MASK (0x3)
49#define OPAMP_CSR_CALSEL_SHIFT (12)
50#define OPAMP_CSR_CALSEL_3P3_PERCENT (0x0)
51#define OPAMP_CSR_CALSEL_10_PERCENT (0x1)
52#define OPAMP_CSR_CALSEL_50_PERCENT (0x2)
53#define OPAMP_CSR_CALSEL_90_PERCENT (0x3)
54
55#define OPAMP_CSR_CALON (0x1 << 11)
56
57#define OPAMP_CSR_VM_SEL_MASK (0x3)
58#define OPAMP_CSR_VM_SEL_SHIFT (5)
59
60#define OPAMP_CSR_VP_SEL_MASK (0x3)
61#define OPAMP_CSR_VP_SEL_SHIFT (2)
62
63#define OPAMP_CSR_FORCE_VP (0x1 << 1)
64#define OPAMP_CSR_EN (0x1 << 0)
65
66
68
69void opamp_enable(uint32_t base);
70void opamp_disable(uint32_t base);
71void opamp_lock(uint32_t base);
72
73void opamp_set_calsel(uint32_t base, uint32_t calsel);
74void opamp_tstref_enable(uint32_t base);
75void opamp_tstref_disable(uint32_t base);
76void opamp_force_vp_enable(uint32_t base);
77void opamp_force_vp_disable(uint32_t base);
78void opamp_cal_enable(uint32_t base);
79void opamp_cal_disable(uint32_t base);
80
81void opamp_trimoffsetn_set(uint32_t base, uint32_t trim);
82void opamp_trimoffsetp_set(uint32_t base, uint32_t trim);
83void opamp_user_trim_enable(uint32_t base);
84void opamp_user_trim_disable(uint32_t base);
85
86void opamp_pga_gain_select(uint32_t base, uint32_t gain);
87
88void opamp_vp_select(uint32_t base, uint32_t vp);
89void opamp_vm_select(uint32_t base, uint32_t vm);
90
92/**@}*/
93
94#endif
95/** @cond */
96#else
97#warning "opamp_common_all.h should not be included directly, only via opamp.h"
98#endif
99/** @endcond */
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void opamp_cal_enable(uint32_t base)
void opamp_set_calsel(uint32_t base, uint32_t calsel)
void opamp_enable(uint32_t base)
void opamp_disable(uint32_t base)
void opamp_tstref_enable(uint32_t base)
void opamp_tstref_disable(uint32_t base)
void opamp_cal_disable(uint32_t base)
void opamp_trimoffsetn_set(uint32_t base, uint32_t trim)
void opamp_trimoffsetp_set(uint32_t base, uint32_t trim)
void opamp_force_vp_enable(uint32_t base)
void opamp_user_trim_enable(uint32_t base)
void opamp_pga_gain_select(uint32_t base, uint32_t gain)
void opamp_vp_select(uint32_t base, uint32_t vp)
void opamp_force_vp_disable(uint32_t base)
void opamp_lock(uint32_t base)
void opamp_vm_select(uint32_t base, uint32_t vm)
void opamp_user_trim_disable(uint32_t base)