Sapphire SoC DS Sapphire SoC UG Sapphire HP SoC DS Sapphire HP SoC UG RISC-V Embedded IDE UG Board Support Package
Loading...
Searching...
No Matches
plic.h
Go to the documentation of this file.
1
2// Copyright (C) 2013-2026 Efinix Inc. All rights reserved.
3// Full license header bsp/efinix/EfxSapphireSocRV64/include/LICENSE.MD
5
6#ifndef PLIC_H
7#define PLIC_H
8
19
20#include "type.h"
21#include "soc.h"
22#include "riscv.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
37
38/* ========================================================================== */
39/* SUB-GROUP : DATA STRUCTS */
40/* ========================================================================== */
41
65
67 typedef struct {
68 volatile u32 PRIORITY[1024];
70
72 typedef struct {
73 volatile u32 PENDING[32];
75
77 typedef struct {
78 volatile u32 ENABLE[32];
80
82 typedef struct {
83 volatile u32 THRESHOLD;
84 volatile u32 CLAIM;
85 u32 RESERVED[1022];
87
101
119 // End of PLIC_Types group
121
122/* ========================================================================== */
123/* SUB-GROUP: FUNCTIONS */
124/* ========================================================================== */
125
149 void plic_releaseExtIRQ_m(u32 gateway);
150
167
169
189
191 // End of PLIC_Funcs group
193
194#ifdef __cplusplus
195}
196#endif
197 // End of MAIN PLIC Group
199
200#endif // PLIC_H
201
void plic_set_priority(plic_instance_t *inst)
Set priority value to PLIC register.
Definition plic.c:40
u32 plic_get_threshold(plic_instance_t *inst)
Read value from PLIC register.
Definition plic.c:68
void plic_releaseExtIRQ_m(u32 gateway)
Release ID source from external IRQ.
Definition plic.c:34
void plic_applyConfig(plic_instance_t *inst)
Apply stored PLIC configuration to hardware.
Definition plic.c:83
u32 plic_get_priority(plic_instance_t *inst)
Read value from PLIC register.
Definition plic.c:45
void plic_set_threshold(plic_instance_t *inst)
Set threshold value to PLIC register.
Definition plic.c:63
void plic_set_enable(plic_instance_t *inst)
Set enable value to PLIC register.
Definition plic.c:50
u32 plic_claimExtIRQ_m()
Claim ID source from external IRQ.
Definition plic.c:28
RISC-V related functions and definitions.
Context Block: Per Target (Hart). Stride is 0x1000 (4096) bytes (Offset 0x200000).
Definition plic.h:82
u32 RESERVED[1022]
< Addressing offset: 0x04
Definition plic.h:85
volatile u32 CLAIM
< Addressing offset: 0x00
Definition plic.h:84
volatile u32 THRESHOLD
Definition plic.h:83
Enable Block: Per Target (Hart). Stride is 0x80 bytes (Offset 0x002000).
Definition plic.h:77
volatile u32 ENABLE[32]
Enables the interrupt source of each context.
Definition plic.h:78
PLIC hardware register map.
Definition plic.h:93
u32 reserved1[(0x00200000 - 0x00002400)/4U]
Address Offset: 0x2020.
Definition plic.h:98
plic_enable_block_t regs_enable[8U]
Address Offset: 0x2000.
Definition plic.h:97
plic_context_block_t regs_context[8U]
Address Offset: 0x200000.
Definition plic.h:99
u32 reserved0[0x1000U/4U-0x20U]
Address Offset: 0x1080.
Definition plic.h:96
plic_priority_block_t regs_priority
Address Offset: 0x00.
Definition plic.h:94
plic_pending_block_t regs_pending
Address Offset: 0x1000.
Definition plic.h:95
PLIC instance. Holds the software registers and hardware pointer.
Definition plic.h:112
u32 gateway
Interrupt source ID.
Definition plic.h:114
u32 target
Set Target to handler external interrupt.
Definition plic.h:113
u32 priority
Priority Level: 0=Disable, 1=Low, 3=Highest.
Definition plic.h:115
u32 enable
Interrupt Enable Bit (1=Enable).
Definition plic.h:116
u32 threshold
CPU accepts any priority > 0.
Definition plic.h:117
Pending Block: 1024 sources / 32 bits = 32 words (Offset 0x001000).
Definition plic.h:72
volatile u32 PENDING[32]
The interrupt pending status of each interrupt source.
Definition plic.h:73
Priority Block: 1024 sources max (Offset 0x000000).
Definition plic.h:67
volatile u32 PRIORITY[1024]
The interrupt priority for each interrupt source.
Definition plic.h:68
uint32_t u32
Definition type.h:22