libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
#include <libopencm3/sam/memorymap.h>
Go to the source code of this file.
Data Structures | |
struct | adcife_lcv |
Functions | |
void | adcife_enable_sync (void) |
Enable ADC interface. More... | |
void | adcife_configure (enum adcife_refsel ref, enum adcife_speed speed, enum adcife_clk clk, enum adcife_prescal prescal) |
void | adcife_select_channel (enum adcife_channel ad) |
void | adcife_set_resolution (enum adcife_resolution res) |
void | adcife_select_trigger (enum adcife_trigger trig) |
void | adcife_set_gain (enum adcife_gain gain) |
void | adcife_set_bipolar (bool enable) |
void | adcife_set_left_adjust (bool enable) |
void | adcife_start_conversion (void) |
void | adcife_wait_conversion (void) |
struct adcife_lcv | adcife_get_lcv (void) |
void | adcife_enable_interrupts (uint32_t imask) |
void | adcife_disable_interrupts (uint32_t imask) |
void | adcife_timer_start (void) |
void | adcife_timer_stop (void) |
void | adcife_timer_set_timeout (uint16_t timeout) |
#define _MASKED_VALUE | ( | V, | |
S, | |||
M | |||
) | (((V) << (S)) & (M)) |
Definition at line 90 of file 4l/adcife.h.
#define ADCIFE_CALIB MMIO32(ADCIFE_BASE + 0x003C) |
Definition at line 69 of file 4l/adcife.h.
#define ADCIFE_CDMA MMIO32(ADCIFE_BASE + 0x0018) |
Definition at line 42 of file 4l/adcife.h.
#define ADCIFE_CFG MMIO32(ADCIFE_BASE + 0x0004) |
Definition at line 30 of file 4l/adcife.h.
#define ADCIFE_CFG_CLKSEL (1 << 6) |
Definition at line 98 of file 4l/adcife.h.
#define ADCIFE_CFG_PRESCAL_MASK (3 << ADCIFE_CFG_PRESCAL_SHIFT) |
Definition at line 100 of file 4l/adcife.h.
#define ADCIFE_CFG_PRESCAL_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_CFG_PRESCAL_SHIFT, ADCIFE_CFG_PRESCAL_MASK) |
Definition at line 101 of file 4l/adcife.h.
#define ADCIFE_CFG_PRESCAL_SHIFT (8) |
Definition at line 99 of file 4l/adcife.h.
#define ADCIFE_CFG_REFSEL_MASK (7 << ADCIFE_CFG_REFSEL_SHIFT) |
Definition at line 93 of file 4l/adcife.h.
#define ADCIFE_CFG_REFSEL_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_CFG_REFSEL_SHIFT, ADCIFE_CFG_REFSEL_MASK) |
Definition at line 94 of file 4l/adcife.h.
#define ADCIFE_CFG_REFSEL_SHIFT (1) |
Definition at line 92 of file 4l/adcife.h.
#define ADCIFE_CFG_SPEED_MASK (3 << ADCIFE_CFG_SPEED_SHIFT) |
Definition at line 96 of file 4l/adcife.h.
#define ADCIFE_CFG_SPEED_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_CFG_SPEED_SHIFT, ADCIFE_CFG_SPEED_MASK) |
Definition at line 97 of file 4l/adcife.h.
#define ADCIFE_CFG_SPEED_SHIFT (4) |
Definition at line 95 of file 4l/adcife.h.
#define ADCIFE_CR MMIO32(ADCIFE_BASE + 0x0000) |
Definition at line 27 of file 4l/adcife.h.
#define ADCIFE_CR_BGREQDIS (1 << 11) |
Definition at line 88 of file 4l/adcife.h.
#define ADCIFE_CR_BGREQEN (1 << 10) |
Definition at line 87 of file 4l/adcife.h.
#define ADCIFE_CR_DIS (1 << 9) |
Definition at line 86 of file 4l/adcife.h.
#define ADCIFE_CR_EN (1 << 8) |
Definition at line 85 of file 4l/adcife.h.
#define ADCIFE_CR_REFBUFDIS (1 << 5) |
Definition at line 84 of file 4l/adcife.h.
#define ADCIFE_CR_REFBUFEN (1 << 4) |
Definition at line 83 of file 4l/adcife.h.
#define ADCIFE_CR_STRIG (1 << 3) |
Definition at line 82 of file 4l/adcife.h.
#define ADCIFE_CR_SWRST (1 << 0) |
Definition at line 79 of file 4l/adcife.h.
#define ADCIFE_CR_TSTART (1 << 2) |
Definition at line 81 of file 4l/adcife.h.
#define ADCIFE_CR_TSTOP (1 << 1) |
Definition at line 80 of file 4l/adcife.h.
#define ADCIFE_IDR MMIO32(ADCIFE_BASE + 0x0034) |
Definition at line 63 of file 4l/adcife.h.
#define ADCIFE_IER MMIO32(ADCIFE_BASE + 0x0030) |
Definition at line 60 of file 4l/adcife.h.
#define ADCIFE_IMR MMIO32(ADCIFE_BASE + 0x0038) |
Definition at line 66 of file 4l/adcife.h.
#define ADCIFE_IR_LOVR (1 << 1) |
Definition at line 116 of file 4l/adcife.h.
#define ADCIFE_IR_SEOC (1 << 0) |
Definition at line 115 of file 4l/adcife.h.
#define ADCIFE_IR_SMTRG (1 << 3) |
Definition at line 118 of file 4l/adcife.h.
#define ADCIFE_IR_TTO (1 << 5) |
Definition at line 119 of file 4l/adcife.h.
#define ADCIFE_IR_WM (1 << 2) |
Definition at line 117 of file 4l/adcife.h.
#define ADCIFE_ITIMER MMIO32(ADCIFE_BASE + 0x0020) |
Definition at line 48 of file 4l/adcife.h.
#define ADCIFE_LCV MMIO32(ADCIFE_BASE + 0x002C) |
Definition at line 57 of file 4l/adcife.h.
#define ADCIFE_PARAMETER MMIO32(ADCIFE_BASE + 0x0044) |
Definition at line 75 of file 4l/adcife.h.
#define ADCIFE_SCR MMIO32(ADCIFE_BASE + 0x000C) |
Definition at line 36 of file 4l/adcife.h.
#define ADCIFE_SEQCFG MMIO32(ADCIFE_BASE + 0x0014) |
Definition at line 39 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_BIPOLAR (1 << 2) |
Definition at line 122 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_GAIN_MASK (7 << ADCIFE_SEQCFG_GAIN_SHIFT) |
Definition at line 124 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_GAIN_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_SEQCFG_GAIN_SHIFT, ADCIFE_SEQCFG_GAIN_MASK) |
Definition at line 125 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_GAIN_SHIFT (4) |
Definition at line 123 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_GCOMP (1 << 7) |
Definition at line 126 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_HWLA (1 << 0) |
Definition at line 121 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_INTERNAL_MASK (3 << ADCIFE_SEQCFG_INTERNAL_SHIFT) |
Definition at line 132 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_INTERNAL_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_SEQCFG_INTERNAL_SHIFT, ADCIFE_SEQCFG_INTERNAL_MASK) |
Definition at line 133 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_INTERNAL_SHIFT (14) |
Definition at line 131 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_MUXNEG_MASK (7 << ADCIFE_SEQCFG_MUXNEG_SHIFT) |
Definition at line 138 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_MUXNEG_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_SEQCFG_MUXNEG_SHIFT, ADCIFE_SEQCFG_MUXNEG_MASK) |
Definition at line 139 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_MUXNEG_SHIFT (20) |
Definition at line 137 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_MUXPOS_MASK (0xf << ADCIFE_SEQCFG_MUXPOS_SHIFT) |
Definition at line 135 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_MUXPOS_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_SEQCFG_MUXPOS_SHIFT, ADCIFE_SEQCFG_MUXPOS_MASK) |
Definition at line 136 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_MUXPOS_SHIFT (16) |
Definition at line 134 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_RES (1 << 12) |
Definition at line 130 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_TRGSEL_MASK (7 << ADCIFE_SEQCFG_TRGSEL_SHIFT) |
Definition at line 128 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_TRGSEL_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_SEQCFG_TRGSEL_SHIFT, ADCIFE_SEQCFG_TRGSEL_MASK) |
Definition at line 129 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_TRGSEL_SHIFT (8) |
Definition at line 127 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_ZOOMRANGE_MASK (7 << ADCIFE_SEQCFG_ZOOMRANGE_SHIFT) |
Definition at line 141 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_ZOOMRANGE_MASKED | ( | V | ) | _MASKED_VALUE((V), ADCIFE_SEQCFG_ZOOMRANGE_SHIFT, ADCIFE_SEQCFG_ZOOMRANGE_MASK) |
Definition at line 142 of file 4l/adcife.h.
#define ADCIFE_SEQCFG_ZOOMRANGE_SHIFT (28) |
Definition at line 140 of file 4l/adcife.h.
#define ADCIFE_SR MMIO32(ADCIFE_BASE + 0x008) |
Definition at line 33 of file 4l/adcife.h.
#define ADCIFE_SR_BGREQ (1 << 30) |
Definition at line 113 of file 4l/adcife.h.
#define ADCIFE_SR_CBUSY (1 << 27) |
Definition at line 111 of file 4l/adcife.h.
#define ADCIFE_SR_EN (1 << 24) |
Definition at line 108 of file 4l/adcife.h.
#define ADCIFE_SR_LOVR (1 << 1) |
Definition at line 104 of file 4l/adcife.h.
#define ADCIFE_SR_REFBUF (1 << 28) |
Definition at line 112 of file 4l/adcife.h.
#define ADCIFE_SR_SBUSY (1 << 26) |
Definition at line 110 of file 4l/adcife.h.
#define ADCIFE_SR_SEOC (1 << 0) |
Definition at line 103 of file 4l/adcife.h.
#define ADCIFE_SR_SMTRG (1 << 3) |
Definition at line 106 of file 4l/adcife.h.
#define ADCIFE_SR_TBUSY (1 << 25) |
Definition at line 109 of file 4l/adcife.h.
#define ADCIFE_SR_TTO (1 << 5) |
Definition at line 107 of file 4l/adcife.h.
#define ADCIFE_SR_WM (1 << 2) |
Definition at line 105 of file 4l/adcife.h.
#define ADCIFE_TIM MMIO32(ADCIFE_BASE + 0x001C) |
Definition at line 45 of file 4l/adcife.h.
#define ADCIFE_VERSION MMIO32(ADCIFE_BASE + 0x0040) |
Definition at line 72 of file 4l/adcife.h.
#define ADCIFE_WCFG MMIO32(ADCIFE_BASE + 0x0024) |
Definition at line 51 of file 4l/adcife.h.
#define ADCIFE_WTH MMIO32(ADCIFE_BASE + 0x0028) |
Definition at line 54 of file 4l/adcife.h.
#define lc_channel _lc_u._lc_s.channel |
Definition at line 231 of file 4l/adcife.h.
#define lc_value _lc_u._lc_s.value |
Definition at line 232 of file 4l/adcife.h.
enum adcife_channel |
Definition at line 176 of file 4l/adcife.h.
enum adcife_clk |
Enumerator | |
---|---|
ADCIFE_CLK_GENERIC | |
ADCIFE_CLK_APB |
Definition at line 171 of file 4l/adcife.h.
enum adcife_gain |
Enumerator | |
---|---|
ADCIFE_GAIN_1X | |
ADCIFE_GAIN_2X | |
ADCIFE_GAIN_4X | |
ADCIFE_GAIN_8X | |
ADCIFE_GAIN_16X | |
ADCIFE_GAIN_32X | |
ADCIFE_GAIN_64X | |
ADCIFE_GAIN_0_5X |
Definition at line 209 of file 4l/adcife.h.
enum adcife_prescal |
Enumerator | |
---|---|
ADCIFE_PRESCAL_DIV4 | |
ADCIFE_PRESCAL_DIV8 | |
ADCIFE_PRESCAL_DIV16 | |
ADCIFE_PRESCAL_DIV32 | |
ADCIFE_PRESCAL_DIV64 | |
ADCIFE_PRESCAL_DIV128 | |
ADCIFE_PRESCAL_DIV256 | |
ADCIFE_PRESCAL_DIV512 |
Definition at line 145 of file 4l/adcife.h.
enum adcife_refsel |
Enumerator | |
---|---|
ADCIFE_REFSEL_INTERNAL1V | |
ADCIFE_REFSEL_0_625xVCC | |
ADCIFE_REFSEL_EXTERNAL1 | |
ADCIFE_REFSEL_EXTERNAL2 | |
ADCIFE_REFSEL_HALF_VCC |
Definition at line 163 of file 4l/adcife.h.
enum adcife_resolution |
Enumerator | |
---|---|
ADCIFE_RESOLUTION_12BITS | |
ADCIFE_RESOLUTION_8BITS |
Definition at line 194 of file 4l/adcife.h.
enum adcife_speed |
Enumerator | |
---|---|
ADCIFE_SPEED_300KSPS | |
ADCIFE_SPEED_225KSPS | |
ADCIFE_SPEED_150KSPS | |
ADCIFE_SPEED_75KSPS |
Definition at line 156 of file 4l/adcife.h.
enum adcife_trigger |
Enumerator | |
---|---|
ADCIFE_TRIGGER_SW | |
ADCIFE_TRIGGER_IADC_TMR | |
ADCIFE_TRIGGER_ITS | |
ADCIFE_TRIGGER_CONT | |
ADCIFE_TRIGGER_EXT_RIS | |
ADCIFE_TRIGGER_EXT_FALL | |
ADCIFE_TRIGGER_EXT_BOTH |
Definition at line 199 of file 4l/adcife.h.
void adcife_configure | ( | enum adcife_refsel | ref, |
enum adcife_speed | speed, | ||
enum adcife_clk | clk, | ||
enum adcife_prescal | prescal | ||
) |
Definition at line 24 of file adcife.c.
References ADCIFE_CFG, ADCIFE_CFG_PRESCAL_MASKED, ADCIFE_CFG_REFSEL_MASKED, and ADCIFE_CFG_SPEED_MASKED.
void adcife_disable_interrupts | ( | uint32_t | imask | ) |
Definition at line 103 of file adcife.c.
References ADCIFE_IDR.
void adcife_enable_interrupts | ( | uint32_t | imask | ) |
Definition at line 98 of file adcife.c.
References ADCIFE_IER.
void adcife_enable_sync | ( | void | ) |
Enable ADC interface.
Must be done before any other configuration.
This function does it synchronously and returns only when the interface is actually enabled.
Definition at line 18 of file adcife.c.
References ADCIFE_CR, ADCIFE_CR_EN, ADCIFE_SR, and ADCIFE_SR_EN.
struct adcife_lcv adcife_get_lcv | ( | void | ) |
Definition at line 91 of file adcife.c.
References adcife_lcv::_lc_u, ADCIFE_LCV, and adcife_lcv::lcv.
void adcife_select_channel | ( | enum adcife_channel | ad | ) |
Definition at line 36 of file adcife.c.
References ADCIFE_SEQCFG, and ADCIFE_SEQCFG_MUXPOS_MASKED.
void adcife_select_trigger | ( | enum adcife_trigger | trig | ) |
Definition at line 50 of file adcife.c.
References ADCIFE_SEQCFG, and ADCIFE_SEQCFG_TRGSEL_MASKED.
void adcife_set_bipolar | ( | bool | enable | ) |
Definition at line 62 of file adcife.c.
References ADCIFE_SEQCFG, and ADCIFE_SEQCFG_BIPOLAR.
void adcife_set_gain | ( | enum adcife_gain | gain | ) |
Definition at line 56 of file adcife.c.
References ADCIFE_SEQCFG, and ADCIFE_SEQCFG_GAIN_MASKED.
void adcife_set_left_adjust | ( | bool | enable | ) |
Definition at line 71 of file adcife.c.
References ADCIFE_SEQCFG, and ADCIFE_SEQCFG_HWLA.
void adcife_set_resolution | ( | enum adcife_resolution | res | ) |
Definition at line 41 of file adcife.c.
References ADCIFE_RESOLUTION_12BITS, ADCIFE_SEQCFG, and ADCIFE_SEQCFG_RES.
void adcife_start_conversion | ( | void | ) |
Definition at line 80 of file adcife.c.
References ADCIFE_CR, and ADCIFE_CR_STRIG.
void adcife_timer_set_timeout | ( | uint16_t | timeout | ) |
Definition at line 118 of file adcife.c.
References ADCIFE_TIM.
void adcife_timer_start | ( | void | ) |
Definition at line 108 of file adcife.c.
References ADCIFE_CR, and ADCIFE_CR_TSTART.
void adcife_timer_stop | ( | void | ) |
Definition at line 113 of file adcife.c.
References ADCIFE_CR, and ADCIFE_CR_TSTOP.
void adcife_wait_conversion | ( | void | ) |
Definition at line 85 of file adcife.c.
References ADCIFE_SCR, ADCIFE_SR, and ADCIFE_SR_SEOC.