device/class/mem.h header reference
[Devices support library module]

The source code of this header can be browsed online.

Description [link] 

Members [link] 

Types [link] 

Functions [link] 

Constants [link] 

Macros [link] 

Members detail [link] 

#define DEV_MEM_INFO(n) [link] 

This macro is declared in device/class/mem.h source file, line 265.

See also dev_mem_info_t.

#define DEV_MEM_REQUEST(n) [link] 

This macro is declared in device/class/mem.h source file, line 287.

See also dev_mem_request_t.

#define DRIVER_MEM_METHODS(prefix) [link] 

This macro is declared in device/class/mem.h source file, line 319.

See also struct driver_mem_s.

#define __DEVICE_MEM_H__ [link] 

This macro is declared in device/class/mem.h source file, line 30.

const char dev_mem_flags_e[] [link] 

This constant is declared in ENUM_DESCRIPTOR function like macro expansion, line 1 in device/class/mem.h source file, line 65.

Alternate declarations with same identifier: [1], [2].

enum dev_mem_flags_e [link] 

This enum is declared in device/class/mem.h source file, line 68.

Alternate declarations with same identifier: [1], [2].

IdentifierDescription
DEV_MEM_MAPPED_READMemory is mapped in the processor address space and can be read by regular processor load instructions.
DEV_MEM_MAPPED_WRITEMemory is mapped in the processor address space and can be written by regular processor store instructions.
DEV_MEM_CACHED_READData are fetched through a non-consistent cache and may not match actual content of memory.
DEV_MEM_CACHED_WRITEData are stored in a write back cache and my not be written immediately to the memory.
DEV_MEM_PARTIAL_READSupport partial read of a page.
DEV_MEM_PARTIAL_WRITESupport partial write of a page.
DEV_MEM_CROSS_READPartial read can cross page boundary.
DEV_MEM_CROSS_WRITEPartial write can cross page boundary.
DEV_MEM_PAGE_READSupport page reading operations.
DEV_MEM_PAGE_WRITESupport page writing operations.
DEV_MEM_VOLATILEMemory content is lost when the device is stopped.
DEV_MEM_ERASE_ONEMemory needs an erase operation in order to switch bits from 0 to 1.
DEV_MEM_ERASE_ZEROMemory needs an erase operation in order to switch bits from 1 to 0.

struct dev_mem_flash_op_info_s [link] 

This struct is declared in device/class/mem.h source file, line 334.

FieldDescription
uintptr_t base;
uintptr_t end;
size_t page_log2;
reg_t (*page_erase)(uintptr_t page_addr) ;
reg_t (*write)(uintptr_t addr, const uint8_t *data, size_t size) ;

struct dev_mem_info_s [link] 

This struct is declared in device/class/mem.h source file, line 102.

FieldDescription
uint64_t size;size of memory in number of pages according to page_log2.
uintptr_t map_base;mapped address of memory, valid when DEV_MEM_MAPPED_READ or DEV_MEM_MAPPED_WRITE is set.
uint8_t read_cycles_p:5;number of allowed reads cycles between two erase operations. read_cycles_m*2^read_cycles_p. 0 means infinite.
uint8_t read_cycles_m:3;See read_cycles_p.
uint8_t erase_cycles_p:5;number of allowed erase cycles. erase_cycles_m*2^erase_cycles_p. 0 means infinite.
uint8_t erase_cycles_m:3;See erase_cycles_p.
uint8_t page_log2;log2 of default page size in bytes used for read and write operations.
uint8_t erase_log2;log2 of default page size in bytes used for erase operation, Only valid when either DEV_MEM_ERASE_ONE or DEV_MEM_ERASE_ZERO is set.
uint8_t partial_log2;log2 alignment of partial access.
uint8_t partial_write;number of allowed partial write between two erase operations. 0=infinite. Only valid when either DEV_MEM_ERASE_ONE or DEV_MEM_ERASE_ZERO is set.
enum dev_mem_type_e type:3;type of memory
enum dev_mem_flags_e flags:13;

typedef error_t (dev_mem_info_t)(const struct device_mem_s *accessor, struct dev_mem_info_s *info, uint8_t band_index) [link] 

This typedef is declared in device/class/mem.h source file, line 284.

This typedef fills a struct dev_mem_info_s object with information about a memory band of the device.

Bands are numbered from 0. The band 0 is always present. Additional bands may be present in order to handle out of band data, hardware ECC... This typedef function returns -ENOENT if the band index is not valid.

This function must check the number field of the device accessor and report the -ENOENT error for sub-devices which are not implemented..

This declaration involves expansion of the DEV_MEM_INFO macro.

See also DEV_MEM_INFO.

struct dev_mem_page_sc_s [link] 

This struct is declared in device/class/mem.h source file, line 214.

FieldDescription
uint64_t addr;Byte address of accessed page on the device. The address has to be aligned on the default page size as reported in struct dev_mem_info_s.
uint8_t * data;

typedef void (dev_mem_request_t)(const struct device_mem_s *accessor, struct dev_mem_rq_s *rq) [link] 

This typedef is declared in device/class/mem.h source file, line 311.

This typedef enqueues a memory device operation request.

The request kroutine is executed on completion. The err indicates the status of the request. Other fields of the request are not modified during processing. Here are possible error values:

  • 0 : Success

  • 1 : at least one corrected ECC error on read (not fatal)

  • -ERANGE : addres or size out of range or not properly aligned

  • -ENOTSUP : operation not supported on this device

  • -EIO : IO error

  • -EBADDATA : uncorrectable ECC error on read

The kroutine of the request may be executed from within this function. Please read Nested device request completion.

This declaration involves expansion of the DEV_MEM_REQUEST macro.

See also DEV_MEM_REQUEST.

void dev_mem_rq_done(struct dev_mem_rq_s *rq) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function invokes or schedules execution of the mem request callback associated to the request. For use in device drivers.

struct dev_mem_rq_s * dev_mem_rq_from_kr(struct kroutine_s *kr) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function retrieves a pointer to the request when in the request completion callback routine.

struct dev_mem_rq_s * dev_mem_rq_head(dev_request_queue_root_t *q) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function returns the oldest mem request in the given queue. A NULL pointer is returned if the queue is empty. For use in device drivers.

void dev_mem_rq_init(struct dev_mem_rq_s *rq, kroutine_exec_t *exec) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function initializes the given mem request callback. This must be used before submitting the request to a driver.

This is available when CONFIG_MUTEK_KROUTINE_SCHED is defined.

void dev_mem_rq_init_immediate(struct dev_mem_rq_s *rq, kroutine_exec_t *exec) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function initializes the given mem request callback. This must be used before submitting the request to a driver.

void dev_mem_rq_init_queue(struct dev_mem_rq_s *rq, kroutine_exec_t *exec, struct kroutine_queue_s *queue) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function initializes the given mem request callback. This must be used before submitting the request to a driver.

This is available when CONFIG_MUTEK_KROUTINE_QUEUE is defined.

void dev_mem_rq_init_seq(struct dev_mem_rq_s *rq, kroutine_exec_t *exec, struct kroutine_sequence_s *seq) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function initializes the given mem request callback. This must be used before submitting the request to a driver.

This is available when CONFIG_MUTEK_KROUTINE_SCHED is defined.

struct dev_mem_rq_s * dev_mem_rq_pop(dev_request_queue_root_t *q) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function removes and return the oldest mem request in the queue. A NULL pointer is returned if the queue is empty. For use in device drivers.

void dev_mem_rq_pushback(dev_request_queue_root_t *q, struct dev_mem_rq_s *rq) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function insert a new mem request at the end of the given queue. For use in device drivers.

void dev_mem_rq_remove(dev_request_queue_root_t *q, struct dev_mem_rq_s *rq) [link] 

This function is declared in device/class/mem.h source file, line 263.

This function removes the specified mem request from the queue. For use in device drivers.

struct dev_mem_rq_s [link] 

This struct is declared in device/class/mem.h source file, line 224.

FieldDescription
union <anonymous> {
struct dev_request_s base;
typeof(struct dev_request_s::error) error;
typeof(struct dev_request_s::pvdata) pvdata;
};
enum dev_mem_rq_type_e type:8;Requested operation
uint8_t band_mask;Mask of bands present in data
union <anonymous> {
struct <anonymous> {
uint64_t addr;Byte address of access
uint8_t * data;Buffers used to store accessed data
uint32_t size;Bytes count
} partial;
struct <anonymous> {
const struct dev_mem_page_sc_s * sc;Array of source and destination page addresses.
uint8_t sc_count:4;Number of entries in the the sc array.
uint8_t page_log2;Log2 of page size used for the access. It can not be less than the default page size reported in struct dev_mem_info_s.
} page;
};

struct dev_request_s * dev_mem_rq_s_base(struct dev_mem_rq_s *x) [link] 

This function is declared in device/class/mem.h source file, line 263.

struct dev_mem_rq_s * dev_mem_rq_s_cast(struct dev_request_s *x) [link] 

This function is declared in device/class/mem.h source file, line 263.

enum dev_mem_rq_type_e [link] 

This enum is declared in device/class/mem.h source file, line 171.

IdentifierDescription
DEV_MEM_OP_NOP
DEV_MEM_OP_PARTIAL_READPartial page read. All fields in dev_mem_rq_s::partial must be set. Read operations crossing page boundaries may not be supported.
DEV_MEM_OP_PARTIAL_READ_UNCACHEDSame as DEV_MEM_OP_PARTIAL_READ, do not rely on cache content.
DEV_MEM_OP_PARTIAL_WRITEPartial page write. All fields in dev_mem_rq_s::partial must be set. Write operations crossing page boundaries may not be supported.
DEV_MEM_OP_PARTIAL_WRITE_THROUGHSame as DEV_MEM_OP_PARTIAL_WRITE, do not keep data in the write cache.
DEV_MEM_OP_PAGE_READPages read with scattered data buffers. All fields in dev_mem_rq_s::page must be set.
DEV_MEM_OP_PAGE_READ_UNCACHEDSame as DEV_MEM_OP_PAGE_READ, do not rely on cache content.
DEV_MEM_OP_PAGE_WRITEPages write with scattered data buffers. All fields in dev_mem_rq_s::page must be set.
DEV_MEM_OP_PAGE_WRITE_THROUGHSame as DEV_MEM_OP_PAGE_WRITE, do not keep data in the write cache.
DEV_MEM_OP_PAGE_ERASEErase pages on a flash device or perform a TRIM on a disk device. All fields in dev_mem_rq_s::page must be set except sc_data.
DEV_MEM_OP_ERASEErase the whole device.
DEV_MEM_OP_CACHE_FLUSHFlush the whole write cache. Always succeed if there is no cache.
DEV_MEM_OP_CACHE_INVALIDATEInvalidate the whole read cache. Always succeed if there is no cache.
DEV_MEM_OP_CACHE_PARTIAL_FLUSHPartially flush the write cache. All fields in dev_mem_rq_s::partial must be set. Always succeed if there is no cache.
DEV_MEM_OP_CACHE_PARTIAL_INVALPartially invalidates the read cache. All fields in dev_mem_rq_s::partial must be set. Always succeed if there is no cache.

const char dev_mem_type_e[] [link] 

This constant is declared in ENUM_DESCRIPTOR function like macro expansion, line 1 in device/class/mem.h source file, line 47.

Alternate declarations with same identifier: [1], [2].

enum dev_mem_type_e [link] 

This enum is declared in device/class/mem.h source file, line 50.

Alternate declarations with same identifier: [1], [2].

IdentifierDescription
DEV_MEM_RAM
DEV_MEM_ROM
DEV_MEM_FLASH
DEV_MEM_DISK
DEV_MEM_OOB
DEV_MEM_ECC

error_t dev_mem_wait_rq(const struct device_mem_s *acc, struct dev_mem_rq_s *rq) [link] 

This function is declared in device/class/mem.h source file, line 350.

This function use the scheduler api to put current context in wait state during the request. This can only be called from a scheduler context.

This is available when CONFIG_MUTEK_CONTEXT_SCHED is defined.

struct device_mem_s [link] 

This struct is declared in DRIVER_CLASS_TYPES function like macro expansion, line 19 in device/class/mem.h source file, line 317.

This struct is the device accessor object type for the mem device class. This accessor must be initialized by calling the device_get_accessor function.

See also DRIVER_CLASS_MEM, struct device_accessor_s and Device accessor.

FieldDescription
union <anonymous> {
struct device_accessor_s base;
struct <anonymous> {
struct device_s * dev;
struct driver_mem_s * api;
uint_fast8_t number;
};
};

struct device_accessor_s * device_mem_s_base(struct device_mem_s *x) [link] 

This function is declared in DRIVER_CLASS_TYPES function like macro expansion, line 40 in device/class/mem.h source file, line 317.

This function casts a mem device accessor to a generic device accessor

struct device_mem_s * device_mem_s_cast(struct device_accessor_s *x) [link] 

This function is declared in DRIVER_CLASS_TYPES function like macro expansion, line 33 in device/class/mem.h source file, line 317.

This function casts a generic device accessor to a mem device accessor

struct driver_mem_s [link] 

This struct is declared in DRIVER_CLASS_TYPES function like macro expansion, line 5 in device/class/mem.h source file, line 317.

This struct is the driver API descriptor for the mem device class.

See also DRIVER_CLASS_MEM and struct driver_class_s.

#define _DEV_MEM_ALL [link] 

This macro is declared in device/class/mem.h source file, line 160.

This macro is for internal use only.

#define _DEV_MEM_CACHE [link] 

This macro is declared in device/class/mem.h source file, line 145.

This macro is for internal use only.

#define _DEV_MEM_ERASE [link] 

This macro is declared in device/class/mem.h source file, line 151.

This macro is for internal use only.

#define _DEV_MEM_FLUSH [link] 

This macro is declared in device/class/mem.h source file, line 163.

This macro is for internal use only.

#define _DEV_MEM_INVAL [link] 

This macro is declared in device/class/mem.h source file, line 165.

This macro is for internal use only.

#define _DEV_MEM_OP_MASK [link] 

This macro is declared in device/class/mem.h source file, line 153.

This macro is for internal use only.

#define _DEV_MEM_PAGE [link] 

This macro is declared in device/class/mem.h source file, line 156.

This macro is for internal use only.

#define _DEV_MEM_PARTIAL [link] 

This macro is declared in device/class/mem.h source file, line 158.

This macro is for internal use only.

#define _DEV_MEM_READ [link] 

This macro is declared in device/class/mem.h source file, line 147.

This macro is for internal use only.

#define _DEV_MEM_WRITE [link] 

This macro is declared in device/class/mem.h source file, line 149.

This macro is for internal use only.

error_t dev_mem_flash_op(const struct dev_mem_flash_op_info_s *info, struct dev_mem_rq_s *rq) [link] 

This function is declared in device/class/mem.h source file, line 348.

This function handles read/write operations to platform flash using the flash_erase and flash_write functions.

This is available when CONFIG_DEVICE_MEM is defined.

This function is for internal use only.

error_t dev_mem_mapped_op_helper(uintptr_t base, uintptr_t end, struct dev_mem_rq_s *rq) [link] 

This function is declared in device/class/mem.h source file, line 331.

This function handles read/write operations to mapped memories using the memcpy function. It can be used in device drivers.

This is available when CONFIG_DEVICE_MEM is defined.

This function is for internal use only.

Valid XHTML 1.0 StrictGenerated by diaxen on Thu Aug 4 15:44:05 2022 using MkDoc