Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Interfaces for Memory Controllers (MEMC). More...

Topics

 MEMC Driver Backend API

Files

file  memc.h
 Main header file for Memory Controller (MEMC) driver API.

Functions

int memc_read (const struct device *dev, uint32_t addr, uint8_t *data, size_t len)
 Read data from external memory.
int memc_write (const struct device *dev, uint32_t addr, const uint8_t *data, size_t len)
 Write data to external memory.
static void * memc_get_mem_base (const struct device *dev)
 Get the memory-mapped base address of a MEMC device.
int memc_get_size (const struct device *dev, uint64_t *size)
 Get the size of external memory.
int memc_read_id (const struct device *dev, uint8_t *id, size_t len)
 Read the ID of external memory.

Detailed Description

Interfaces for Memory Controllers (MEMC).

Since
4.5
Version
0.1.0

Function Documentation

◆ memc_get_mem_base()

void * memc_get_mem_base ( const struct device * dev)
inlinestatic

#include <zephyr/drivers/memc.h>

Get the memory-mapped base address of a MEMC device.

Note
This function is available in kernel mode only (not a syscall). The returned pointer is a kernel-space address and cannot be used from userspace directly. Use memc_read() / memc_write() for portable access.
Parameters
devMEMC device.
Returns
Pointer to the mapped base address, or NULL if not memory-mapped or if the device does not implement the memc API

◆ memc_get_size()

int memc_get_size ( const struct device * dev,
uint64_t * size )

#include <zephyr/drivers/memc.h>

Get the size of external memory.

Parameters
devMEMC device.
sizePointer to variable to store size in bytes.
Returns
0 on success, negative errno code on failure.
Return values
-ENOTSUPif the device does not implement the memc API or the optional callback.

◆ memc_read()

int memc_read ( const struct device * dev,
uint32_t addr,
uint8_t * data,
size_t len )

#include <zephyr/drivers/memc.h>

Read data from external memory.

Parameters
devMEMC device.
addrByte offset from the base address to read from.
dataBuffer to store read data.
lenNumber of bytes to read.
Returns
0 on success, negative errno code on failure.
Return values
-ENOTSUPif the device does not implement the memc API, or if neither get_mem_base nor read is implemented.

◆ memc_read_id()

int memc_read_id ( const struct device * dev,
uint8_t * id,
size_t len )

#include <zephyr/drivers/memc.h>

Read the ID of external memory.

Parameters
devMEMC device.
idBuffer to store ID (size depends on device, typically 2-4 bytes).
lenNumber of bytes to read. Drivers may return fewer bytes than requested if the device ID is shorter.
Returns
0 on success, negative errno code on failure.
Return values
-ENOTSUPif the device does not implement the memc API or the optional callback.

◆ memc_write()

int memc_write ( const struct device * dev,
uint32_t addr,
const uint8_t * data,
size_t len )

#include <zephyr/drivers/memc.h>

Write data to external memory.

Parameters
devMEMC device.
addrByte offset from the base address to write to.
dataBuffer containing data to write.
lenNumber of bytes to write.
Returns
0 on success, negative errno code on failure.
Return values
-ENOTSUPif the device does not implement the memc API, or if neither get_mem_base nor write is implemented.