Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions docs/env_setup/hpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ HPM 工程按以下顺序接入:
2. 再检查工程里是否已经能正常 `add_subdirectory(libxr)`。
3. 最后再按需要接入具体外设类,例如 `HPMGPIO`、`HPMI2C`、`HPMPWM`、`HPMTimebase`。

外设的引脚复用和时钟由工程在创建 LibXR 对象之前配置,例如调用 HPM Pinmux Tool 生成的引脚函数和时钟函数;LibXR 的 HPM 驱动只调用 SDK 驱动,不调用 `board.c` 中的板级函数:

```cpp
static LibXR::HPMI2C i2c3(HPM_I2C3, clock_i2c3, {100000});
static LibXR::HPMPWM pwm(HPM_PWM0, clock_mot0, 0, 0, LibXR::HPMPWM::Polarity::NORMAL);
```

## 当前 I2C 支持情况

`HPMI2C` 已不是简单的 blocking-only 包装,当前主线还覆盖了:
Expand All @@ -101,8 +108,8 @@ HPM 工程按以下顺序接入:
上述能力在具体工程中能否使用,取决于:

- HPM SDK 头文件是否完整;
- 是否存在对应 DMA / interrupt helper;
- 目标板级时钟、引脚和总线恢复路径是否已验证。
- 工程是否启用了 SDK 的 `dma_mgr` 组件(`CONFIG_DMA_MGR`),未启用时编译报错;
- 引脚和时钟是否已在创建对象前配置。总线恢复使用 I2C 控制器自身产生的复位信号(9 个 SCL 脉冲)。

## 当前 PWM 支持情况

Expand Down
11 changes: 9 additions & 2 deletions i18n/en/docusaurus-plugin-content-docs/current/env_setup/hpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ An HPM project integrates LibXR in this order:
2. verify that the project can already `add_subdirectory(libxr)` cleanly
3. then bring in concrete peripherals such as `HPMGPIO`, `HPMI2C`, `HPMPWM`, or `HPMTimebase`

The project sets up the pin mux and the clocks of a peripheral before it creates the LibXR object, for example by calling the pin and clock functions generated by the HPM Pinmux Tool; the LibXR HPM drivers call the SDK drivers only, not the board functions in `board.c`:

```cpp
static LibXR::HPMI2C i2c3(HPM_I2C3, clock_i2c3, {100000});
static LibXR::HPMPWM pwm(HPM_PWM0, clock_mot0, 0, 0, LibXR::HPMPWM::Polarity::NORMAL);
```

## Current Boundary of `I2C`

The current HPM `I2C` line is no longer just a simple blocking wrapper. According to the current headers, `HPMI2C` already covers:
Expand All @@ -101,8 +108,8 @@ The current HPM `I2C` line is no longer just a simple blocking wrapper. Accordin
Whether these capabilities can be used in a given project depends on:

- whether the HPM SDK headers are complete
- whether matching DMA / interrupt helpers are present
- whether the target board’s clocks, pin setup, and bus-recovery path have been validated
- whether the project enables the SDK `dma_mgr` component (`CONFIG_DMA_MGR`); the build stops with an error otherwise
- whether the pins and clocks are set up before the object is created. Bus recovery uses the reset signal of the I2C controller itself (9 SCL pulses).

## Current Boundary of `PWM`

Expand Down
Loading