I/O access primitives for libmetal. More...
#include <limits.h>#include <stdint.h>#include <string.h>#include <stdlib.h>#include <metal/assert.h>#include <metal/compiler.h>#include <metal/atomic.h>#include <metal/sys.h>#include <metal/cpu.h>#include <metal/system/@PROJECT_SYSTEM@/io.h>Go to the source code of this file.
Data Structures | |
| struct | metal_io_ops |
| Generic I/O operations. More... | |
| struct | metal_io_region |
| Libmetal I/O region structure. More... | |
Macros | |
| #define | metal_io_read8_explicit(_io, _ofs, _order) metal_io_read((_io), (_ofs), (_order), 1) |
| #define | metal_io_read8(_io, _ofs) metal_io_read((_io), (_ofs), memory_order_seq_cst, 1) |
| #define | metal_io_write8_explicit(_io, _ofs, _val, _order) metal_io_write((_io), (_ofs), (_val), (_order), 1) |
| #define | metal_io_write8(_io, _ofs, _val) metal_io_write((_io), (_ofs), (_val), memory_order_seq_cst, 1) |
| #define | metal_io_read16_explicit(_io, _ofs, _order) metal_io_read((_io), (_ofs), (_order), 2) |
| #define | metal_io_read16(_io, _ofs) metal_io_read((_io), (_ofs), memory_order_seq_cst, 2) |
| #define | metal_io_write16_explicit(_io, _ofs, _val, _order) metal_io_write((_io), (_ofs), (_val), (_order), 2) |
| #define | metal_io_write16(_io, _ofs, _val) metal_io_write((_io), (_ofs), (_val), memory_order_seq_cst, 2) |
| #define | metal_io_read32_explicit(_io, _ofs, _order) metal_io_read((_io), (_ofs), (_order), 4) |
| #define | metal_io_read32(_io, _ofs) metal_io_read((_io), (_ofs), memory_order_seq_cst, 4) |
| #define | metal_io_write32_explicit(_io, _ofs, _val, _order) metal_io_write((_io), (_ofs), (_val), (_order), 4) |
| #define | metal_io_write32(_io, _ofs, _val) metal_io_write((_io), (_ofs), (_val), memory_order_seq_cst, 4) |
| #define | metal_io_read64_explicit(_io, _ofs, _order) metal_io_read((_io), (_ofs), (_order), 8) |
| #define | metal_io_read64(_io, _ofs) metal_io_read((_io), (_ofs), memory_order_seq_cst, 8) |
| #define | metal_io_write64_explicit(_io, _ofs, _val, _order) metal_io_write((_io), (_ofs), (_val), (_order), 8) |
| #define | metal_io_write64(_io, _ofs, _val) metal_io_write((_io), (_ofs), (_val), memory_order_seq_cst, 8) |
Functions | |
| void | metal_io_init (struct metal_io_region *io, void *virt, const metal_phys_addr_t *physmap, size_t size, unsigned int page_shift, unsigned int mem_flags, const struct metal_io_ops *ops) |
| Open a libmetal I/O region. More... | |
| static void | metal_io_finish (struct metal_io_region *io) |
| Close a libmetal shared memory segment. More... | |
| static size_t | metal_io_region_size (struct metal_io_region *io) |
| Get size of I/O region. More... | |
| static void * | metal_io_virt (struct metal_io_region *io, unsigned long offset) |
| Get virtual address for a given offset into the I/O region. More... | |
| static unsigned long | metal_io_virt_to_offset (struct metal_io_region *io, void *virt) |
| Convert a virtual address to offset within I/O region. More... | |
| static metal_phys_addr_t | metal_io_phys (struct metal_io_region *io, unsigned long offset) |
| Get physical address for a given offset into the I/O region. More... | |
| static unsigned long | metal_io_phys_to_offset (struct metal_io_region *io, metal_phys_addr_t phys) |
| Convert a physical address to offset within I/O region. More... | |
| static void * | metal_io_phys_to_virt (struct metal_io_region *io, metal_phys_addr_t phys) |
| Convert a physical address to virtual address. More... | |
| static metal_phys_addr_t | metal_io_virt_to_phys (struct metal_io_region *io, void *virt) |
| Convert a virtual address to physical address. More... | |
| static uint64_t | metal_io_read (struct metal_io_region *io, unsigned long offset, memory_order order, int width) |
| Read a value from an I/O region. More... | |
| static void | metal_io_write (struct metal_io_region *io, unsigned long offset, uint64_t value, memory_order order, int width) |
| Write a value into an I/O region. More... | |
| int | metal_io_block_read (struct metal_io_region *io, unsigned long offset, void *restrict dst, int len) |
| Read a block from an I/O region. More... | |
| int | metal_io_block_write (struct metal_io_region *io, unsigned long offset, const void *restrict src, int len) |
| Write a block into an I/O region. More... | |
| int | metal_io_block_set (struct metal_io_region *io, unsigned long offset, unsigned char value, int len) |
| fill a block of an I/O region. More... | |
I/O access primitives for libmetal.