include/linux/litex.h
Source file repositories/reference/linux-study-clean/include/linux/litex.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/litex.h- Extension
.h- Size
- 2107 bytes
- Lines
- 84
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
Dependency Surface
linux/io.h
Detected Declarations
function Copyrightfunction _read_litex_subregisterfunction CSRfunction litex_write16function litex_write32function litex_write64function litex_read8function litex_read16function litex_read32function litex_read64
Annotated Snippet
#ifndef _LINUX_LITEX_H
#define _LINUX_LITEX_H
#include <linux/io.h>
static inline void _write_litex_subregister(u32 val, void __iomem *addr)
{
writel((u32 __force)cpu_to_le32(val), addr);
}
static inline u32 _read_litex_subregister(void __iomem *addr)
{
return le32_to_cpu((__le32 __force)readl(addr));
}
/*
* LiteX SoC Generator, depending on the configuration, can split a single
* logical CSR (Control&Status Register) into a series of consecutive physical
* registers.
*
* For example, in the configuration with 8-bit CSR Bus, a 32-bit aligned,
* 32-bit wide logical CSR will be laid out as four 32-bit physical
* subregisters, each one containing one byte of meaningful data.
*
* For Linux support, upstream LiteX enforces a 32-bit wide CSR bus, which
* means that only larger-than-32-bit CSRs will be split across multiple
* subregisters (e.g., a 64-bit CSR will be spread across two consecutive
* 32-bit subregisters).
*
* For details see: https://github.com/enjoy-digital/litex/wiki/CSR-Bus
*/
static inline void litex_write8(void __iomem *reg, u8 val)
{
_write_litex_subregister(val, reg);
}
static inline void litex_write16(void __iomem *reg, u16 val)
{
_write_litex_subregister(val, reg);
}
static inline void litex_write32(void __iomem *reg, u32 val)
{
_write_litex_subregister(val, reg);
}
static inline void litex_write64(void __iomem *reg, u64 val)
{
_write_litex_subregister(val >> 32, reg);
_write_litex_subregister(val, reg + 4);
}
static inline u8 litex_read8(void __iomem *reg)
{
return _read_litex_subregister(reg);
}
static inline u16 litex_read16(void __iomem *reg)
{
return _read_litex_subregister(reg);
}
static inline u32 litex_read32(void __iomem *reg)
{
return _read_litex_subregister(reg);
}
static inline u64 litex_read64(void __iomem *reg)
{
return ((u64)_read_litex_subregister(reg) << 32) |
_read_litex_subregister(reg + 4);
}
#endif /* _LINUX_LITEX_H */
Annotation
- Immediate include surface: `linux/io.h`.
- Detected declarations: `function Copyright`, `function _read_litex_subregister`, `function CSR`, `function litex_write16`, `function litex_write32`, `function litex_write64`, `function litex_read8`, `function litex_read16`, `function litex_read32`, `function litex_read64`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.