flash.h — Maple v0.0.12 Documentation

### Navigation

- next
- previous |
- LeafLabs |
- Index »
- `libmaple` »
- APIs »

# `flash.h`

Flash support.

Contents

- Types
- Functions
- Register Map Base Pointers
- Register Bit Definitions
  - Access control register
  - Status register
  - Control register
  - Option byte register

## Types

struct flash_reg_map

> Flash register map type.

> Public Members

> > __io uint32 ACR

> >   Access control register.

> > __io uint32 KEYR

> >   Key register.

> > __io uint32 OPTKEYR

> >   OPTKEY register.

> > __io uint32 SR

> >   Status register.

> > __io uint32 CR

> >   Control register.

> > __io uint32 AR

> >   Address register.

> > __io uint32 OBR

> >   Option byte register.

> > __io uint32 WRPR

> >   Write protection register.

## Functions

void flash_enable_prefetch(void)

  Turn on the hardware prefetcher.

void flash_set_latency(uint32 wait_states)

  Set flash wait states.

  See ST PM0042, section 3.1 for restrictions on the acceptable value of wait_states for a given SYSCLK configuration.

  Parameters: | `wait_states` - number of wait states (one of FLASH_WAIT_STATE_0, FLASH_WAIT_STATE_1, FLASH_WAIT_STATE_2).

## Register Map Base Pointers

FLASH_BASE

  Flash register map base pointer.

## Register Bit Definitions

### Access control register

FLASH_ACR_PRFTBS_BIT

FLASH_ACR_PRFTBE_BIT

FLASH_ACR_HLFCYA_BIT

FLASH_ACR_PRFTBS

FLASH_ACR_PRFTBE

FLASH_ACR_HLFCYA

FLASH_ACR_LATENCY

### Status register

FLASH_SR_EOP_BIT

FLASH_SR_WRPRTERR_BIT

FLASH_SR_PGERR_BIT

FLASH_SR_BSY_BIT

FLASH_SR_EOP

FLASH_SR_WRPRTERR

FLASH_SR_PGERR

FLASH_SR_BSY

### Control register

FLASH_CR_EOPIE_BIT

FLASH_CR_ERRIE_BIT

FLASH_CR_OPTWRE_BIT

FLASH_CR_LOCK_BIT

FLASH_CR_STRT_BIT

FLASH_CR_OPTER_BIT

FLASH_CR_OPTPG_BIT

FLASH_CR_MER_BIT

FLASH_CR_PER_BIT

FLASH_CR_PG_BIT

FLASH_CR_EOPIE

FLASH_CR_ERRIE

FLASH_CR_OPTWRE

FLASH_CR_LOCK

FLASH_CR_STRT

FLASH_CR_OPTER

FLASH_CR_OPTPG

FLASH_CR_MER

FLASH_CR_PER

FLASH_CR_PG

### Option byte register

FLASH_OBR_nRST_STDBY_BIT

FLASH_OBR_nRST_STOP_BIT

FLASH_OBR_WDG_SW_BIT

FLASH_OBR_RDPRT_BIT

FLASH_OBR_OPTERR_BIT

FLASH_OBR_DATA1

FLASH_OBR_DATA0

FLASH_OBR_USER

FLASH_OBR_nRST_STDBY

FLASH_OBR_nRST_STOP

FLASH_OBR_WDG_SW

FLASH_OBR_RDPRT

FLASH_OBR_OPTERR

### Navigation

- next
- previous |
- LeafLabs |
- Index »
- `libmaple` »
- APIs »