I/O Memory Access

User-space I/O memory access declarations.

User-space applications may use this API to read from (or write to) a peripheral’s hardware registers in a platform-independent manner.

This part of the API is only applicable to user-space code.

type cuddl_iomem_t

I/O memory accessor for user space.

Description

Data type used to access user-space memory-mapped I/O regions.

Pointers of type cuddl_iomem_t * are typically obtained from the addr field of a cuddl_memregion struct returned by cuddl_memregion_map() or cuddl_memregion_claim_and_map(). These pointers can then be used with cuddl_ioread32(), cuddl_iowrite16(), etc.

uint8_t cuddl_ioread8(cuddl_iomem_t *addr)

Read an 8-bit value from device I/O memory.

Parameters

cuddl_iomem_t *addr

I/O memory address for reading.

Return

Value that results from reading the specified memory address.

uint16_t cuddl_ioread16(cuddl_iomem_t *addr)

Read a 16-bit value from device I/O memory.

Parameters

cuddl_iomem_t *addr

I/O memory address for reading.

Return

Value that results from reading the specified memory address.

uint32_t cuddl_ioread32(cuddl_iomem_t *addr)

Read a 32-bit value from device I/O memory.

Parameters

cuddl_iomem_t *addr

I/O memory address for reading.

Return

Value that results from reading the specified memory address.

void cuddl_iowrite8(uint8_t value, cuddl_iomem_t *addr)

Write an 8-bit value to device I/O memory.

Parameters

uint8_t value

Value to be written.

cuddl_iomem_t *addr

I/O memory address for writing.

void cuddl_iowrite16(uint16_t value, cuddl_iomem_t *addr)

Write a 16-bit value to device I/O memory.

Parameters

uint16_t value

Value to be written.

cuddl_iomem_t *addr

I/O memory address for writing.

void cuddl_iowrite32(uint32_t value, cuddl_iomem_t *addr)

Write a 32-bit value to device I/O memory.

Parameters

uint32_t value

Value to be written.

cuddl_iomem_t *addr

I/O memory address for writing.