Memory-mapped RAM outside the SoC's own, only powered while it has users.
More...
|
| | HyperRAM |
| | RAM driver for HyperRAM, PSRAM with a HyperBus interface.
|
| |
Memory-mapped RAM outside the SoC's own, only powered while it has users.
A device maps its memory at an address its driver finds out at init, see pbl_ram_get_region(). Its contents are only there between pbl_ram_get() and the matching pbl_ram_put(): the first user powers the memory on, and once the last one is gone, the next deep sleep powers it off. While it has users, deep sleep keeps its contents. What goes where in the memory is up to its user, the kernel scratch heap (see Scratch heap).
◆ pbl_ram
| Data Fields |
|
struct pbl_device |
dev |
Device. |
|
const struct pbl_ram_ops * |
ops |
Driver operations. |
|
struct pbl_ram_state * |
state |
Runtime state. |
◆ PBL_RAM_INIT
| #define PBL_RAM_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_deps, |
|
|
|
_ops |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_ram_state, \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _deps, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:145
int pbl_ram_dev_init(const struct pbl_device *dev)
const struct pbl_device_class pbl_ram_class
◆ PBL_RAM_STATE_DEFINE
| #define PBL_RAM_STATE_DEFINE |
( |
|
sym | ) |
|
Value:
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:131
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50
◆ pbl_ram_dev_init()
| int pbl_ram_dev_init |
( |
const struct pbl_device * |
dev | ) |
|
◆ pbl_ram_get()
| int pbl_ram_get |
( |
const struct pbl_ram * |
ram | ) |
|
Start using the memory, powering it on if it is off.
Its contents are undefined if it had no user. Not callable from interrupts.
- Parameters
-
- Returns
- 0,
-ENODEV if the device is not ready, or the error powering it on.
◆ pbl_ram_get_region()
| void pbl_ram_get_region |
( |
const struct pbl_ram * |
ram, |
|
|
uintptr_t * |
base, |
|
|
size_t * |
size |
|
) |
| |
Get where the memory is mapped, and its size.
- Parameters
-
| ram | Device. |
| [out] | base | CPU address of the memory. |
| [out] | size | Size of the memory, in bytes; 0 if the device is not ready. |
◆ pbl_ram_put()
| void pbl_ram_put |
( |
const struct pbl_ram * |
ram | ) |
|
Stop using the memory.
Without users, the next deep sleep powers it off.
- Parameters
-
◆ pbl_ram_quiesce()
| void pbl_ram_quiesce |
( |
const struct pbl_ram * |
ram | ) |
|
Let the memory settle before the CPU stops its clocks.
Called by the SoC before a clock-stopping idle state other than deep sleep, with interrupts disabled.
- Parameters
-
◆ pbl_ram_resume()
| void pbl_ram_resume |
( |
const struct pbl_ram * |
ram | ) |
|
Bring the memory back after deep sleep.
Called by the SoC on deep sleep exit, with interrupts disabled.
- Parameters
-
◆ pbl_ram_suspend()
| void pbl_ram_suspend |
( |
const struct pbl_ram * |
ram | ) |
|
Prepare the memory for deep sleep.
Called by the SoC on deep sleep entry, with interrupts disabled: the memory is retained if it has users, and powered off otherwise.
- Parameters
-
◆ EXTRAM
External RAM, behind the kernel scratch heap.
◆ pbl_ram_class