libxr
Embedded C++ framework for bare-metal, RTOS and Linux
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.

Classes

class  LibXR::HPMGPIO
 HPM 平台 GPIO 驱动实现 / GPIO driver implementation for HPM platform. More...
 

Namespaces

namespace  LibXR
 LibXR 命名空间 / LibXR namespace.
 

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;驱动为每个 GPIO 端口 IRQ 定义中断入口,入口按 port/pin 映射分发, 应用无需声明这些 ISR。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; the driver defines the interrupt entry of every GPIO port IRQ, which dispatches by port/pin, so the application declares no ISR for these IRQs. 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.

Note
驱动已定义 GPIO 端口中断入口;保留此接口供 C 代码使用。 The driver already defines the GPIO port interrupt entries; this entry is kept for C code.
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