libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
hpm_gpio.hpp File Reference

HPM GPIO 驱动适配头文件 / Adapter header for the HPM GPIO driver. More...

#include "gpio.hpp"
#include "hpm_gpio_drv.h"
#include "hpm_plic_drv.h"
#include "hpm_soc.h"
Include dependency graph for hpm_gpio.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  LibXR::HPMGPIO
 HPM 平台 GPIO 驱动实现 / GPIO driver implementation for HPM platform. More...
 
struct  LibXR::HPMGPIO::PortIrqRouteState
 端口级 IRQ 路由状态 / Shared port-level IRQ routing state. More...
 

Namespaces

namespace  LibXR
 LibXR 命名空间
 

Functions

void libxr_hpm_gpio_check_interrupt (uint32_t port)
 GPIO 中断分发的 C 接口 / C entry for GPIO interrupt dispatch.
 

Detailed Description

HPM GPIO 驱动适配头文件 / Adapter header for the HPM GPIO driver.

本文件在 GPIO_Type 上实现 LibXR::GPIO,通过 HPM SDK hpm_gpio_drv 完成引脚读写、方向配置、中断触发模式配置和中断标志分发。当前实现使用同步 GPIO API;中断由板级 IRQ handler 调用 libxr_hpm_gpio_check_interrupt() 后按 port/pin 映射分发。HPM5301 的 GPIO0_A/B/X/Y IRQ 是端口级 PLIC 路由,因此同一 port 上多个 pin 会共享同一 IRQ enable/disable 计数。端口表大小 按当前 SDK 头文件暴露的 GPIO_DI_GPIO* 宏推导,避免为不同 HPM 系列复制驱动文件。

This file implements LibXR::GPIO on top of GPIO_Type using the HPM SDK hpm_gpio_drv APIs for pin read/write, direction setup, interrupt trigger setup, and interrupt-flag dispatch. The current implementation uses synchronous GPIO APIs; interrupts are dispatched after the board IRQ handler calls libxr_hpm_gpio_check_interrupt(). HPM5301 routes GPIO0_A/B/X/Y IRQs per port through PLIC, so multiple pins on the same port share one IRQ enable/disable reference count. The dispatch table size is derived from the GPIO_DI_GPIO* macros exposed by the active SDK headers to avoid per-series driver forks.

Definition in file hpm_gpio.hpp.

Function Documentation

◆ libxr_hpm_gpio_check_interrupt()

void libxr_hpm_gpio_check_interrupt ( uint32_t port)

GPIO 中断分发的 C 接口 / C entry for GPIO interrupt dispatch.

Parameters
portGPIO 端口号 / GPIO port index.

GPIO 中断分发的 C 接口 / C entry for GPIO interrupt dispatch.

Parameters
portGPIO 端口号 / GPIO port index.

Definition at line 464 of file hpm_gpio.cpp.

465{
467}
static void CheckInterrupt(uint32_t port)
分发某一端口的 GPIO 中断回调 / Dispatch GPIO interrupt callbacks for one port.
Definition hpm_gpio.cpp:393