libmetal
|
Data Structures | |
struct | metal_io_ops |
struct | metal_io_region |
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. | |
static void | metal_io_finish (struct metal_io_region *io) |
Close a libmetal shared memory segment. | |
static size_t | metal_io_region_size (struct metal_io_region *io) |
Get size of I/O region. | |
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. | |
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. | |
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. | |
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. | |
static void * | metal_io_phys_to_virt (struct metal_io_region *io, metal_phys_addr_t phys) |
Convert a physical address to virtual address. | |
static metal_phys_addr_t | metal_io_virt_to_phys (struct metal_io_region *io, void *virt) |
Convert a virtual address to physical address. | |
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. | |
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. | |
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. | |
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. | |
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. | |
#define metal_io_read16 | ( | _io, | |
_ofs | |||
) | metal_io_read((_io), (_ofs), memory_order_seq_cst, 2) |
#define metal_io_read16_explicit | ( | _io, | |
_ofs, | |||
_order | |||
) | metal_io_read((_io), (_ofs), (_order), 2) |
#define metal_io_read32 | ( | _io, | |
_ofs | |||
) | metal_io_read((_io), (_ofs), memory_order_seq_cst, 4) |
#define metal_io_read32_explicit | ( | _io, | |
_ofs, | |||
_order | |||
) | metal_io_read((_io), (_ofs), (_order), 4) |
#define metal_io_read64 | ( | _io, | |
_ofs | |||
) | metal_io_read((_io), (_ofs), memory_order_seq_cst, 8) |
#define metal_io_read64_explicit | ( | _io, | |
_ofs, | |||
_order | |||
) | metal_io_read((_io), (_ofs), (_order), 8) |
#define metal_io_read8 | ( | _io, | |
_ofs | |||
) | metal_io_read((_io), (_ofs), memory_order_seq_cst, 1) |
#define metal_io_read8_explicit | ( | _io, | |
_ofs, | |||
_order | |||
) | metal_io_read((_io), (_ofs), (_order), 1) |
#define metal_io_write16 | ( | _io, | |
_ofs, | |||
_val | |||
) | metal_io_write((_io), (_ofs), (_val), 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_write32 | ( | _io, | |
_ofs, | |||
_val | |||
) | metal_io_write((_io), (_ofs), (_val), 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_write64 | ( | _io, | |
_ofs, | |||
_val | |||
) | metal_io_write((_io), (_ofs), (_val), 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_write8 | ( | _io, | |
_ofs, | |||
_val | |||
) | metal_io_write((_io), (_ofs), (_val), memory_order_seq_cst, 1) |
#define metal_io_write8_explicit | ( | _io, | |
_ofs, | |||
_val, | |||
_order | |||
) | metal_io_write((_io), (_ofs), (_val), (_order), 1) |
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.
[in] | io | I/O region handle. |
[in] | offset | Offset into I/O region. |
[in] | dst | destination to store the read data. |
[in] | len | length in bytes to read. |
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.
[in] | io | I/O region handle. |
[in] | offset | Offset into I/O region. |
[in] | value | value to fill into the block |
[in] | len | length in bytes to fill. |
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.
[in] | io | I/O region handle. |
[in] | offset | Offset into I/O region. |
[in] | src | source to write. |
[in] | len | length in bytes to write. |
|
inlinestatic |
Close a libmetal shared memory segment.
[in] | io | I/O region handle. |
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.
[in,out] | io | I/O region handle. |
[in] | virt | Virtual address of region. |
[in] | physmap | Array of physical addresses per page. |
[in] | size | Size of region. |
[in] | page_shift | Log2 of page size (-1 for single page). |
[in] | mem_flags | Memory flags |
[in] | ops | ops |
|
inlinestatic |
Get physical address for a given offset into the I/O region.
[in] | io | I/O region handle. |
[in] | offset | Offset into shared memory segment. |
|
inlinestatic |
Convert a physical address to offset within I/O region.
[in] | io | I/O region handle. |
[in] | phys | Physical address within segment. |
|
inlinestatic |
Convert a physical address to virtual address.
[in] | io | Shared memory segment handle. |
[in] | phys | Physical address within segment. |
|
inlinestatic |
Read a value from an I/O region.
[in] | io | I/O region handle. |
[in] | offset | Offset into I/O region. |
[in] | order | Memory ordering. |
[in] | width | Width in bytes of datatype to read. This must be 1, 2, 4, or 8, and a compile time constant for this function to inline cleanly. |
|
inlinestatic |
Get size of I/O region.
[in] | io | I/O region handle. |
|
inlinestatic |
Get virtual address for a given offset into the I/O region.
[in] | io | I/O region handle. |
[in] | offset | Offset into shared memory segment. |
|
inlinestatic |
Convert a virtual address to offset within I/O region.
[in] | io | I/O region handle. |
[in] | virt | Virtual address within segment. |
|
inlinestatic |
Convert a virtual address to physical address.
[in] | io | Shared memory segment handle. |
[in] | virt | Virtual address within segment. |
|
inlinestatic |
Write a value into an I/O region.
[in] | io | I/O region handle. |
[in] | offset | Offset into I/O region. |
[in] | value | Value to write. |
[in] | order | Memory ordering. |
[in] | width | Width in bytes of datatype to read. This must be 1, 2, 4, or 8, and a compile time constant for this function to inline cleanly. |