PebbleOS v4.47.0-1075-g013613c8a
Loading...
Searching...
No Matches
STM32H7 FMC SDRAM

RAM driver for an SDRAM on the STM32H7 FMC. More...

Data Structures

struct  pbl_ram_sdram_cas_latency
 A CAS latency of an SDRAM and the highest clock it allows. More...
 
struct  pbl_ram_sdram
 A JEDEC SDR SDRAM. More...
 
struct  pbl_ram_stm32_fmc
 SDRAM on the FMC. More...
 

Macros

#define PBL_RAM_STM32_FMC_DEFINE(sym, _name, _base, _clk, _pinctrl, _addr, _size, _width, _banks, _row_bits, _col_bits, _t_rc_ps, _t_ras_ps, _t_rp_ps, _t_rcd_ps, _t_wr_ps, _t_mrd_ps, _t_xsr_ps, _t_ref_ms, ...)
 Define an SDRAM on the FMC.
 

Detailed Description

RAM driver for an SDRAM on the STM32H7 FMC.

The device brings the SDRAM up when it comes up and keeps it powered and refreshed. Its address gives the FMC bank and the mapping: bank 1 at 0xc0000000 or, swapped, 0x60000000, bank 2 at 0xd0000000 or 0x70000000. The swapped addresses are normal memory, cached and executable by default. The SDRAM clock is the FMC kernel clock divided by 2 or 3, whichever first stays within 100 MHz. The timings and the lowest CAS latency allowed at that clock come from the SDRAM.


Data Structure Documentation

◆ pbl_ram_sdram_cas_latency

struct pbl_ram_sdram_cas_latency

A CAS latency of an SDRAM and the highest clock it allows.

Data Fields
uint8_t cycles CAS latency, in clock cycles, 1 to 3.
uint32_t max_hz Highest clock, in Hz.

◆ pbl_ram_sdram

struct pbl_ram_sdram

A JEDEC SDR SDRAM.

Data Fields
uint8_t banks Internal banks, 2 or 4.
const struct pbl_ram_sdram_cas_latency * cas_latencies CAS latencies of the speed grade.
uint8_t col_bits Column address bits, 8 to 11.
uint8_t num_cas_latencies Number of CAS latencies.
uint8_t row_bits Row address bits, 11 to 13.
uint32_t t_mrd_ps Load mode register to the next command, in picoseconds.
uint32_t t_ras_ps Active to precharge, in picoseconds.
uint32_t t_rc_ps Active to active of a bank, in picoseconds.
uint32_t t_rcd_ps Active to read or write, in picoseconds.
uint16_t t_ref_ms Time in which every row is refreshed, in milliseconds.
uint32_t t_rp_ps Precharge to active, in picoseconds.
uint32_t t_wr_ps Write recovery, in picoseconds.
uint32_t t_xsr_ps Exit self-refresh to active, in picoseconds.
uint8_t width Data bus width, 8, 16 or 32 bits.

◆ pbl_ram_stm32_fmc

struct pbl_ram_stm32_fmc

SDRAM on the FMC.

Data Fields
uintptr_t addr CPU address of the SDRAM.
uintptr_t base FMC registers.
struct pbl_clk clk FMC kernel clock.
struct pbl_pinctrl pinctrl Pins.
struct pbl_ram ram RAM device.
struct pbl_ram_sdram sdram SDRAM.
size_t size Size of the SDRAM, in bytes.

Macro Definition Documentation

◆ PBL_RAM_STM32_FMC_DEFINE

#define PBL_RAM_STM32_FMC_DEFINE (   sym,
  _name,
  _base,
  _clk,
  _pinctrl,
  _addr,
  _size,
  _width,
  _banks,
  _row_bits,
  _col_bits,
  _t_rc_ps,
  _t_ras_ps,
  _t_rp_ps,
  _t_rcd_ps,
  _t_wr_ps,
  _t_mrd_ps,
  _t_xsr_ps,
  _t_ref_ms,
  ... 
)
Value:
static const struct pbl_ram_sdram_cas_latency sym##_cas_latencies[] = {__VA_ARGS__}; \
PBL_RAM_STATE_DEFINE(sym); \
PBL_DEVICE_INSTANCE(sym, struct pbl_ram_stm32_fmc, struct pbl_ram, ram) { \
.ram = PBL_RAM_INIT(sym, _name, nullptr, &pbl_ram_stm32_fmc_ops), .base = (_base), \
.clk = _clk, .pinctrl = PBL_PINCTRL(_pinctrl, nullptr, 0), .addr = (_addr), .size = (_size), \
.sdram = { \
.width = (_width), \
.banks = (_banks), \
.row_bits = (_row_bits), \
.col_bits = (_col_bits), \
.t_rc_ps = (_t_rc_ps), \
.t_ras_ps = (_t_ras_ps), \
.t_rp_ps = (_t_rp_ps), \
.t_rcd_ps = (_t_rcd_ps), \
.t_wr_ps = (_t_wr_ps), \
.t_mrd_ps = (_t_mrd_ps), \
.t_xsr_ps = (_t_xsr_ps), \
.t_ref_ms = (_t_ref_ms), \
.cas_latencies = sym##_cas_latencies, \
.num_cas_latencies = PBL_ARRAY_SIZE(sym##_cas_latencies), \
}, \
}
#define PBL_PINCTRL(_default, _sleep, _reg)
Initializer for a struct pbl_pinctrl.
Definition pinctrl.h:132
SDRAM on the FMC.
Definition stm32_fmc.h:69
A CAS latency of an SDRAM and the highest clock it allows.
Definition stm32_fmc.h:29
RAM device.
Definition ram.h:71
#define PBL_RAM_INIT(sym, _name, _parent, _ops)
Definition ram.h:90
#define PBL_ARRAY_SIZE(array)
Get the number of elements of an array.
Definition size.h:40

Define an SDRAM on the FMC.

Parameters
symSymbol of the device.
_nameName.
_baseFMC registers.
_clkFMC kernel clock, from PBL_CLK().
_pinctrlDefault pin control state.
_addrCPU address of the SDRAM.
_sizeSize of the SDRAM, in bytes.
_widthData bus width, in bits.
_banksInternal banks.
_row_bitsRow address bits.
_col_bitsColumn address bits.
_t_rc_psActive to active of a bank, in picoseconds.
_t_ras_psActive to precharge, in picoseconds.
_t_rp_psPrecharge to active, in picoseconds.
_t_rcd_psActive to read or write, in picoseconds.
_t_wr_psWrite recovery, in picoseconds.
_t_mrd_psLoad mode register to the next command, in picoseconds.
_t_xsr_psExit self-refresh to active, in picoseconds.
_t_ref_msRefresh period, in milliseconds.
...CAS latencies, each a pbl_ram_sdram_cas_latency initializer.