SimpleKernel 1.17.0
Loading...
Searching...
No Matches
Gic Class Reference

GIC 中断控制器驱动 More...

#include <gic.h>

Collaboration diagram for Gic:
Collaboration graph

Classes

class  Gicd
 GIC Distributor 接口 More...
 
class  Gicr
 GIC Redistributor 接口 More...
 

Public Member Functions

auto SetUp () const -> void
 初始化当前 CPU 的 GIC 配置
 
auto Spi (uint32_t intid, uint32_t cpuid) const -> void
 配置共享外设中断 (SPI)
 
auto Ppi (uint32_t intid, uint32_t cpuid) const -> void
 配置私有外设中断 (PPI)
 
auto Sgi (uint32_t intid, uint32_t cpuid) const -> void
 配置软件生成中断 (SGI)
 
构造/析构函数
 Gic (uint64_t gicd_base_addr, uint64_t gicr_base_addr)
 构造函数
 
 Gic ()=default
 
 Gic (const Gic &)=delete
 
 Gic (Gic &&)=delete
 
auto operator= (const Gic &) -> Gic &=delete
 
auto operator= (Gic &&) -> Gic &=default
 
 ~Gic ()=default
 

Static Public Attributes

static constexpr const char * kCompatibleName = "arm,gic-v3"
 
static constexpr size_t kSgiBase = 0
 
static constexpr size_t kSgiCount = 16
 
static constexpr size_t kPpiBase = 16
 
static constexpr size_t kPpiCount = 16
 
static constexpr size_t kSpiBase = 32
 
static constexpr size_t kSpiCount = 988
 

Private Attributes

Gicd gicd_ {}
 Distributor 实例
 
Gicr gicr_ {}
 Redistributor 实例
 

Detailed Description

Constructor & Destructor Documentation

◆ Gic() [1/4]

Gic::Gic ( uint64_t  gicd_base_addr,
uint64_t  gicr_base_addr 
)
explicit

构造函数

Parameters
gicd_base_addrGIC Distributor 地址
gicr_base_addrGIC Redistributor 地址

Definition at line 13 of file gic.cpp.

14 : gicd_(gicd_base_addr), gicr_(gicr_base_addr) {
15 cpu_io::ICC_IGRPEN1_EL1::Enable::Clear();
16 cpu_io::ICC_PMR_EL1::Priority::Set();
17
19
20 klog::Info("Gic init.");
21}
auto EnableGrp1Ns() const -> void
允许 no-sec group1 中断
Definition gic.cpp:66
Gicd gicd_
Distributor 实例
Definition gic.h:678
Gicr gicr_
Redistributor 实例
Definition gic.h:680
auto Info(etl::format_string< Args... > fmt, Args &&... args) -> void
以 INFO 级别记录日志
Here is the call graph for this function:

◆ Gic() [2/4]

Gic::Gic ( )
default

◆ Gic() [3/4]

Gic::Gic ( const Gic )
delete

◆ Gic() [4/4]

Gic::Gic ( Gic &&  )
delete

◆ ~Gic()

Gic::~Gic ( )
default

Member Function Documentation

◆ operator=() [1/2]

auto Gic::operator= ( const Gic ) -> Gic &=delete
delete

◆ operator=() [2/2]

auto Gic::operator= ( Gic &&  ) -> Gic &=default
default

◆ Ppi()

auto Gic::Ppi ( uint32_t  intid,
uint32_t  cpuid 
) const -> void

配置私有外设中断 (PPI)

Parameters
intid中断号
cpuidCPU 编号

Definition at line 35 of file gic.cpp.

35 {
36 gicr_.SetupPpi(intid, cpuid);
37}
auto SetupPpi(uint32_t intid, uint32_t cpuid) const -> void
设置指定 PPI 中断 PPI: private peripheral interrupt, 私有外设中断,该中断来源于外设,但是该中断只对指定的 core 有效
Definition gic.cpp:206
Here is the caller graph for this function:

◆ SetUp()

auto Gic::SetUp ( ) const -> void

初始化当前 CPU 的 GIC 配置

Definition at line 23 of file gic.cpp.

23 {
24 cpu_io::ICC_IGRPEN1_EL1::Enable::Clear();
25 cpu_io::ICC_PMR_EL1::Priority::Set();
27
28 gicr_.SetUp();
29}
auto SetUp() const -> void
初始化 gicr,在多核场景使用
Definition gic.cpp:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sgi()

auto Gic::Sgi ( uint32_t  intid,
uint32_t  cpuid 
) const -> void

配置软件生成中断 (SGI)

Parameters
intid中断号
cpuidCPU 编号

Definition at line 39 of file gic.cpp.

39 {
40 gicr_.SetupSgi(intid, cpuid);
41}
auto SetupSgi(uint32_t intid, uint32_t cpuid) const -> void
设置指定 SGI 中断 SGI: Software Generated Interrupt, 软件生成中断,用于处理器间通信
Definition gic.cpp:212
Here is the caller graph for this function:

◆ Spi()

auto Gic::Spi ( uint32_t  intid,
uint32_t  cpuid 
) const -> void

配置共享外设中断 (SPI)

Parameters
intid中断号
cpuidCPU 编号

Definition at line 31 of file gic.cpp.

31 {
32 gicd_.SetupSpi(intid, cpuid);
33}
auto SetupSpi(uint32_t intid, uint32_t cpuid) const -> void
设置指定 SPI 中断 SPI: shared peripheral interrupt, 共享外设中断,该中断来源于外设,但是该中断可以对所有的 core 有效
Definition gic.cpp:137
Here is the caller graph for this function:

Member Data Documentation

◆ gicd_

Gicd Gic::gicd_ {}
private

Distributor 实例

Definition at line 678 of file gic.h.

678{};

◆ gicr_

Gicr Gic::gicr_ {}
private

Redistributor 实例

Definition at line 680 of file gic.h.

680{};

◆ kCompatibleName

constexpr const char* Gic::kCompatibleName = "arm,gic-v3"
staticconstexpr

Definition at line 19 of file gic.h.

◆ kPpiBase

constexpr size_t Gic::kPpiBase = 16
staticconstexpr

Definition at line 23 of file gic.h.

◆ kPpiCount

constexpr size_t Gic::kPpiCount = 16
staticconstexpr

Definition at line 24 of file gic.h.

◆ kSgiBase

constexpr size_t Gic::kSgiBase = 0
staticconstexpr

Definition at line 21 of file gic.h.

◆ kSgiCount

constexpr size_t Gic::kSgiCount = 16
staticconstexpr

Definition at line 22 of file gic.h.

◆ kSpiBase

constexpr size_t Gic::kSpiBase = 32
staticconstexpr

Definition at line 25 of file gic.h.

◆ kSpiCount

constexpr size_t Gic::kSpiCount = 988
staticconstexpr

Definition at line 26 of file gic.h.


The documentation for this class was generated from the following files: