drivers/char/xilinx_hwicap/xilinx_hwicap.h
Source file repositories/reference/linux-study-clean/drivers/char/xilinx_hwicap/xilinx_hwicap.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/char/xilinx_hwicap/xilinx_hwicap.h- Extension
.h- Size
- 7358 bytes
- Lines
- 225
- Domain
- Driver Families
- Bucket
- drivers/char
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/cdev.hlinux/platform_device.hlinux/io.h
Detected Declarations
struct hwicap_drvdatastruct hwicap_driver_configstruct config_registersfunction hwicap_type_1_readfunction hwicap_type_1_write
Annotated Snippet
struct hwicap_drvdata {
u32 write_buffer_in_use; /* Always in [0,3] */
u8 write_buffer[4];
u32 read_buffer_in_use; /* Always in [0,3] */
u8 read_buffer[4];
resource_size_t mem_start;/* phys. address of the control registers */
resource_size_t mem_end; /* phys. address of the control registers */
resource_size_t mem_size;
void __iomem *base_address;/* virt. address of the control registers */
struct device *dev;
struct cdev cdev; /* Char device structure */
dev_t devt;
const struct hwicap_driver_config *config;
const struct config_registers *config_regs;
void *private_data;
bool is_open;
struct mutex sem;
};
struct hwicap_driver_config {
/* Read configuration data given by size into the data buffer.
* Return 0 if successful.
*/
int (*get_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
u32 size);
/* Write configuration data given by size from the data buffer.
* Return 0 if successful.
*/
int (*set_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
u32 size);
/* Get the status register, bit pattern given by:
* D8 - 0 = configuration error
* D7 - 1 = alignment found
* D6 - 1 = readback in progress
* D5 - 0 = abort in progress
* D4 - Always 1
* D3 - Always 1
* D2 - Always 1
* D1 - Always 1
* D0 - 1 = operation completed
*/
u32 (*get_status)(struct hwicap_drvdata *drvdata);
/* Reset the hw */
void (*reset)(struct hwicap_drvdata *drvdata);
};
/* Number of times to poll the done register. This has to be large
* enough to allow an entire configuration to complete. If an entire
* page (4kb) is configured at once, that could take up to 4k cycles
* with a byte-wide icap interface. In most cases, this driver is
* used with a much smaller fifo, but this should be sufficient in the
* worst case.
*/
#define XHI_MAX_RETRIES 5000
/************ Constant Definitions *************/
#define XHI_PAD_FRAMES 0x1
/* Mask for calculating configuration packet headers */
#define XHI_WORD_COUNT_MASK_TYPE_1 0x7FFUL
#define XHI_WORD_COUNT_MASK_TYPE_2 0x1FFFFFUL
#define XHI_TYPE_MASK 0x7
#define XHI_REGISTER_MASK 0xF
#define XHI_OP_MASK 0x3
#define XHI_TYPE_SHIFT 29
#define XHI_REGISTER_SHIFT 13
#define XHI_OP_SHIFT 27
#define XHI_TYPE_1 1
#define XHI_TYPE_2 2
#define XHI_OP_WRITE 2
#define XHI_OP_READ 1
/* Address Block Types */
#define XHI_FAR_CLB_BLOCK 0
#define XHI_FAR_BRAM_BLOCK 1
#define XHI_FAR_BRAM_INT_BLOCK 2
struct config_registers {
u32 CRC;
u32 FAR;
u32 FDRI;
u32 FDRO;
u32 CMD;
u32 CTL;
u32 MASK;
Annotation
- Immediate include surface: `linux/types.h`, `linux/cdev.h`, `linux/platform_device.h`, `linux/io.h`.
- Detected declarations: `struct hwicap_drvdata`, `struct hwicap_driver_config`, `struct config_registers`, `function hwicap_type_1_read`, `function hwicap_type_1_write`.
- Atlas domain: Driver Families / drivers/char.
- 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.