stm32f2/include/periph_cpu.h File Reference

CPU specific definitions for internal peripheral handling. More...

Detailed Description

CPU specific definitions for internal peripheral handling.

Author
Nick v. IJzendoorn nijze.nosp@m.ndoo.nosp@m.rn@en.nosp@m.gine.nosp@m.ering.nosp@m.-spi.nosp@m.rit.n.nosp@m.l
Aurelien Gonce aurel.nosp@m.ien..nosp@m.gonce.nosp@m.@alt.nosp@m.ran.f.nosp@m.r

Definition in file stm32f2/include/periph_cpu.h.

#include "periph_cpu_common.h"
+ Include dependency graph for stm32f2/include/periph_cpu.h:

Go to the source code of this file.

Data Structures

struct  adc_conf_t
 ADC device configuration. More...
 

Functions

static void dma_poweron (int stream)
 Power on the DMA device the given stream belongs to. More...
 
static DMA_TypeDef * dma_base (int stream)
 Get DMA base register. More...
 
static DMA_Stream_TypeDef * dma_stream (int stream)
 Get the DMA stream base address. More...
 
static int dma_hl (int stream)
 Select high or low DMA interrupt register based on stream number. More...
 
static uint32_t dma_ifc (int stream)
 Get the interrupt flag clear bit position in the DMA LIFCR register. More...
 
static void dma_isr_enable (int stream)
 Enable DMA interrupts. More...
 
#define CPUID_ADDR   (0x1fff7a10)
 Starting address of the CPU ID.
 
#define ADC_DEVS   (2U)
 Available number of ADC devices.
 
#define HAVE_ADC_RES_T
 Override the ADC resolution configuration.
 
enum  {
  PORT_A = 0, PORT_B = 1, PORT_C = 2, PORT_D = 3,
  PORT_E = 4, PORT_F = 5, PORT_G = 6, PORT_H = 7,
  PORT_I = 8
}
 Available ports on the STM32F2 family. More...
 
enum  adc_res_t {
  ADC_RES_6BIT = (0xa00), ADC_RES_7BIT = (0 << 4), ADC_RES_8BIT = (0xb00), ADC_RES_9BIT = (1 << 4),
  ADC_RES_10BIT = (2 << 4), ADC_RES_12BIT = (3 << 4), ADC_RES_14BIT = (0xc00), ADC_RES_16BIT = (0xd00),
  ADC_RES_6BIT = 0xf0, ADC_RES_8BIT = 0x00, ADC_RES_10BIT = 0x02, ADC_RES_12BIT = 0xf1,
  ADC_RES_14BIT = 0xf2, ADC_RES_16BIT = 0xf3, ADC_RES_6BIT = 0xf0, ADC_RES_8BIT = 0x00,
  ADC_RES_10BIT = 0x01, ADC_RES_12BIT = 0x02, ADC_RES_14BIT = 0xf1, ADC_RES_16BIT = 0xf2,
  ADC_RES_6BIT = 0x1, ADC_RES_8BIT = 0x2, ADC_RES_10BIT = ADC_MR_LOWRES_BITS_10, ADC_RES_12BIT = ADC_MR_LOWRES_BITS_12,
  ADC_RES_14BIT = 0x4, ADC_RES_16BIT = 0x8, ADC_RES_6BIT = 0xff, ADC_RES_8BIT = ADC_CTRLB_RESSEL_8BIT,
  ADC_RES_10BIT = ADC_CTRLB_RESSEL_10BIT, ADC_RES_12BIT = ADC_CTRLB_RESSEL_12BIT, ADC_RES_14BIT = 0xfe, ADC_RES_16BIT = 0xfd,
  ADC_RES_6BIT = 0xff, ADC_RES_8BIT = ADC_CTRLC_RESSEL_8BIT, ADC_RES_10BIT = ADC_CTRLC_RESSEL_10BIT, ADC_RES_12BIT = ADC_CTRLC_RESSEL_12BIT,
  ADC_RES_14BIT = 0xfe, ADC_RES_16BIT = 0xfd, ADC_RES_6BIT = 0x03000000, ADC_RES_8BIT = 0x02000000,
  ADC_RES_10BIT = 0x01000000, ADC_RES_12BIT = 0x00000000, ADC_RES_14BIT = 1, ADC_RES_16BIT = 2,
  ADC_RES_6BIT = (0x3 << 3), ADC_RES_8BIT = (0x2 << 3), ADC_RES_10BIT = (0x1 << 3), ADC_RES_12BIT = (0x0 << 3),
  ADC_RES_14BIT = (0xfe), ADC_RES_16BIT = (0xff), ADC_RES_6BIT = 0, ADC_RES_8BIT,
  ADC_RES_10BIT, ADC_RES_12BIT, ADC_RES_14BIT, ADC_RES_16BIT
}
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Available ports on the STM32F2 family.

Enumerator
PORT_A 

port A

PORT_B 

port B

PORT_C 

port C

PORT_D 

port D

PORT_E 

port E

PORT_F 

port F

PORT_G 

port G

PORT_H 

port H

PORT_I 

port I

Definition at line 38 of file stm32f2/include/periph_cpu.h.

◆ adc_res_t

enum adc_res_t
Enumerator
ADC_RES_6BIT 

not supported by hardware

ADC_RES_7BIT 

ADC resolution: 7 bit.

ADC_RES_8BIT 

not supported by hardware

ADC_RES_9BIT 

ADC resolution: 9 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

not supported by hardware

ADC_RES_16BIT 

not supported by hardware

ADC_RES_6BIT 

ADC resolution: 6 bit (not supported)

ADC_RES_8BIT 

ADC resolution: 8 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit (not supported)

ADC_RES_14BIT 

ADC resolution: 14 bit (not supported)

ADC_RES_16BIT 

ADC resolution: 16 bit (not supported)

ADC_RES_6BIT 

not supported by hardware

ADC_RES_8BIT 

ADC resolution: 8 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

supported with oversampling, not implemented

ADC_RES_16BIT 

not supported by hardware

ADC_RES_6BIT 

not applicable

ADC_RES_8BIT 

not applicable

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

not applicable

ADC_RES_16BIT 

not applicable

ADC_RES_6BIT 

not supported

ADC_RES_8BIT 

ADC resolution: 8 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

not supported

ADC_RES_16BIT 

not supported

ADC_RES_6BIT 

not supported

ADC_RES_8BIT 

ADC resolution: 8 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

not supported

ADC_RES_16BIT 

not supported

ADC_RES_6BIT 

ADC resolution: 6 bit.

ADC_RES_8BIT 

ADC resolution: 8 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

ADC resolution: 14 bit (not supported)

ADC_RES_16BIT 

ADC resolution: 16 bit (not supported)

ADC_RES_6BIT 

ADC resolution: 6 bit.

ADC_RES_8BIT 

ADC resolution: 8 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

not applicable

ADC_RES_16BIT 

not applicable

ADC_RES_6BIT 

ADC resolution: 6 bit.

ADC_RES_8BIT 

ADC resolution: 8 bit.

ADC_RES_10BIT 

ADC resolution: 10 bit.

ADC_RES_12BIT 

ADC resolution: 12 bit.

ADC_RES_14BIT 

ADC resolution: 14 bit.

ADC_RES_16BIT 

ADC resolution: 16 bit.

Definition at line 69 of file stm32f2/include/periph_cpu.h.

Function Documentation

◆ dma_base()

static DMA_TypeDef* dma_base ( int  stream)
inlinestatic

Get DMA base register.

For simplifying DMA stream handling, we map the DMA channels transparently to one integer number, such that DMA1 stream0 equals 0, DMA2 stream0 equals 8, DMA2 stream 7 equals 15 and so on.

Parameters
[in]streamlogical DMA stream

Definition at line 102 of file stm32f2/include/periph_cpu.h.

◆ dma_hl()

static int dma_hl ( int  stream)
inlinestatic

Select high or low DMA interrupt register based on stream number.

Parameters
[in]streamlogical DMA stream
Returns
0 for streams 0-3, 1 for streams 3-7

Definition at line 127 of file stm32f2/include/periph_cpu.h.

◆ dma_ifc()

static uint32_t dma_ifc ( int  stream)
inlinestatic

Get the interrupt flag clear bit position in the DMA LIFCR register.

Parameters
[in]streamlogical DMA stream

Definition at line 137 of file stm32f2/include/periph_cpu.h.

◆ dma_isr_enable()

static void dma_isr_enable ( int  stream)
inlinestatic

Enable DMA interrupts.

Parameters
[in]streamlogical DMA stream

Definition at line 158 of file stm32f2/include/periph_cpu.h.

◆ dma_poweron()

static void dma_poweron ( int  stream)
inlinestatic

Power on the DMA device the given stream belongs to.

Parameters
[in]streamlogical DMA stream

Definition at line 84 of file stm32f2/include/periph_cpu.h.

◆ dma_stream()

static DMA_Stream_TypeDef* dma_stream ( int  stream)
inlinestatic

Get the DMA stream base address.

Parameters
[in]streamlogical DMA stream
Returns
base address for the selected DMA stream

Definition at line 114 of file stm32f2/include/periph_cpu.h.