SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Macros | Functions | Variables
io.h File Reference
#include <stdint.h>
Include dependency graph for io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BIT(x)   (1 << (x))
 Define a bit mask for the specified bit position.
 
#define clrsetbits_le32(addr, clear, set)   write32((addr), (read32(addr) & ~(clear)) | (set))
 Clear and set bits in a 32-bit address.
 
#define setbits_le32(addr, set)   write32((addr), read32(addr) | (set))
 Set bits in a 32-bit address.
 
#define clrbits_le32(addr, clear)   write32((addr), read32(addr) & ~(clear))
 Clear bits in a 32-bit address.
 
#define readb(addr)   read8(addr)
 Read a byte from the specified address.
 
#define writeb(val, addr)   write8((addr), (val))
 Write a byte value to the specified address.
 
#define readw(addr)   read16(addr)
 Read a 16-bit word from the specified address.
 
#define writew(val, addr)   write16((addr), (val))
 Write a 16-bit word value to the specified address.
 
#define readl(addr)   read32(addr)
 Read a 32-bit double word from the specified address.
 
#define writel(val, addr)   write32((addr), (val))
 Write a 32-bit double word value to the specified address.
 

Functions

static __attribute__ ((__always_inline__)) uint8_t read8(virtual_addr_t addr)
 Inline function to read an 8-bit value from the specified address.
 

Variables

static uint8_t value
 

Macro Definition Documentation

◆ BIT

#define BIT (   x)    (1 << (x))

Define a bit mask for the specified bit position.

Parameters
xThe bit position to generate the bit mask for.

◆ clrbits_le32

#define clrbits_le32 (   addr,
  clear 
)    write32((addr), read32(addr) & ~(clear))

Clear bits in a 32-bit address.

Parameters
addrThe address to perform the operation on.
clearThe bits to clear.

◆ clrsetbits_le32

#define clrsetbits_le32 (   addr,
  clear,
  set 
)    write32((addr), (read32(addr) & ~(clear)) | (set))

Clear and set bits in a 32-bit address.

Parameters
addrThe address to perform the operation on.
clearThe bits to clear.
setThe bits to set.

◆ readb

#define readb (   addr)    read8(addr)

Read a byte from the specified address.

Parameters
addrThe address to read from.

◆ readl

#define readl (   addr)    read32(addr)

Read a 32-bit double word from the specified address.

Parameters
addrThe address to read from.

◆ readw

#define readw (   addr)    read16(addr)

Read a 16-bit word from the specified address.

Parameters
addrThe address to read from.

◆ setbits_le32

#define setbits_le32 (   addr,
  set 
)    write32((addr), read32(addr) | (set))

Set bits in a 32-bit address.

Parameters
addrThe address to perform the operation on.
setThe bits to set.

◆ writeb

#define writeb (   val,
  addr 
)    write8((addr), (val))

Write a byte value to the specified address.

Parameters
valThe value to write.
addrThe address to write to.

◆ writel

#define writel (   val,
  addr 
)    write32((addr), (val))

Write a 32-bit double word value to the specified address.

Parameters
valThe value to write.
addrThe address to write to.

◆ writew

#define writew (   val,
  addr 
)    write16((addr), (val))

Write a 16-bit word value to the specified address.

Parameters
valThe value to write.
addrThe address to write to.

Function Documentation

◆ __attribute__()

static __attribute__ ( (__always_inline__)  )
inlinestatic

Inline function to read an 8-bit value from the specified address.

Inline function to write a 64-bit value to the specified address.

Inline function to write a 32-bit value to the specified address.

Inline function to write a 16-bit value to the specified address.

Inline function to write an 8-bit value to the specified address.

Inline function to read a 64-bit value from the specified address.

Inline function to read a 32-bit value from the specified address.

Inline function to read a 16-bit value from the specified address.

Parameters
addrThe address to read from.
Returns
The 8-bit value read from the address.
Parameters
addrThe address to read from.
Returns
The 16-bit value read from the address.
Parameters
addrThe address to read from.
Returns
The 32-bit value read from the address.
Parameters
addrThe address to read from.
Returns
The 64-bit value read from the address.
Parameters
addrThe address to write to.
valueThe 8-bit value to write.
addrThe address to write to.
valueThe 16-bit value to write.
addrThe address to write to.
valueThe 32-bit value to write.
addrThe address to write to.
valueThe 64-bit value to write.

Variable Documentation

◆ value

uint64_t value
Initial value:
{
asm volatile("sb %0, 0(%1)"
:
: "r"(value), "r"(addr))
static uint8_t value
Definition io.h:144