Interfaces for Memory Controllers (MEMC).
More...
|
| file | memc.h |
| | Main header file for Memory Controller (MEMC) driver API.
|
| |
Interfaces for Memory Controllers (MEMC).
- Since
- 4.5
- Version
- 0.1.0
◆ memc_get_mem_base()
| static 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
-
- 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()
#include <zephyr/drivers/memc.h>
Get the size of external memory.
- Parameters
-
| dev | MEMC device. |
| size | Pointer to variable to store size in bytes. |
- Returns
- 0 on success, negative errno code on failure.
- Return values
-
| -ENOTSUP | if the device does not implement the memc API or the optional callback. |
◆ memc_read()
#include <zephyr/drivers/memc.h>
Read data from external memory.
- Parameters
-
| dev | MEMC device. |
| addr | Byte offset from the base address to read from. |
| data | Buffer to store read data. |
| len | Number of bytes to read. |
- Returns
- 0 on success, negative errno code on failure.
- Return values
-
| -ENOTSUP | if 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
-
| dev | MEMC device. |
| id | Buffer to store ID (size depends on device, typically 2-4 bytes). |
| len | Number 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
-
| -ENOTSUP | if the device does not implement the memc API or the optional callback. |
◆ memc_write()
#include <zephyr/drivers/memc.h>
Write data to external memory.
- Parameters
-
| dev | MEMC device. |
| addr | Byte offset from the base address to write to. |
| data | Buffer containing data to write. |
| len | Number of bytes to write. |
- Returns
- 0 on success, negative errno code on failure.
- Return values
-
| -ENOTSUP | if the device does not implement the memc API, or if neither get_mem_base nor write is implemented. |