API GUIDE / TPC / LL

G32S10 TPC LL 接口

LL 层接口:本文档描述 G32S10 SDK 的 TPC(热敏打印头控制器)HAL 与 LL 接口。

1. 文档范围

本文档描述 G32S10 SDK 的 TPC(热敏打印头控制器)HAL 与 LL 接口。TPC 同时驱动打印头 移位、锁存、加热、步进电机和内部 WDT;一次完整打印通常由这些子模块按确定顺序协同完成。

2. LL 接口规范

本章按 ADC LL 章的书写方式,为 ll_tpc.h 中全部 130 个公开接口分别列出函数原型、 功能、参数和返回值,并按公共控制、Shift、Latch、Heat、Motor、WDT、中断与 FIFO 分组。

2.1 LL 层实现边界

LL 都是 static inline 函数且不做参数校验:必须保证实例指针是 TPC、索引在范围 内、字段值不超过寄存器位宽。HAL 已覆盖常规配置路径,LL 主要用于调试、特殊时序实验, 或在 HAL 之上补充个别寄存器设置。

  • void 接口只执行寄存器写或触发操作,不返回错误码。

  • uint32_t 接口返回寄存器或字段原始值;除非接口说明另有约定,调用方应按第 8 章 mask 解释结果。

  • LL 不清除旧状态、不等待硬件完成,也不维护模块忙状态。

2.2 公共访问、使能与启动停止

本节所有接口的参数方向均为输入,返回值类型由原型给出。

2.2.1 ll_tpc_is_instance

static inline bool ll_tpc_is_instance(const tpc_regs_t *tpcx);

功能说明: 判断寄存器块指针是否为当前 SDK 支持的 TPC 实例。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为待检查的 TPC 寄存器块指针

返回值表:

返回值说明
truetrue 表示匹配
false否则

补充说明:

  • 接口只比较实例地址,不解引用 tpcx。

2.2.2 ll_tpc_reg_write

static inline void ll_tpc_reg_write(tpc_regs_t *tpcx, uint32_t offset, uint32_t value);

功能说明: 按相对 tpcx 的字节偏移写入一个 32 位寄存器。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
offsetuint32_t输入offset 为 32 位对齐偏移
valueuint32_t输入value 为写入值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.3 ll_tpc_reg_read

static inline uint32_t ll_tpc_reg_read(tpc_regs_t *tpcx, uint32_t offset);

功能说明: 按相对 tpcx 的字节偏移读取一个 32 位寄存器。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
offsetuint32_t输入offset 为 32 位对齐偏移

返回值表:

返回值说明
uint32_t当前寄存器原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.4 ll_tpc_auto_control_enable

static inline void ll_tpc_auto_control_enable(tpc_regs_t *tpcx);

功能说明: 使能自动对齐流程控制。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.5 ll_tpc_auto_control_disable

static inline void ll_tpc_auto_control_disable(tpc_regs_t *tpcx);

功能说明: 关闭自动对齐流程控制。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.6 ll_tpc_auto_control_enable_status_get

static inline uint32_t ll_tpc_auto_control_enable_status_get(const tpc_regs_t *tpcx);

功能说明: 读取自动对齐流程控制使能状态。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPFCEN 寄存器原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.7 ll_tpc_print_head_enable

static inline void ll_tpc_print_head_enable(tpc_regs_t *tpcx, uint32_t enable_mask);

功能说明: 使能指定的打印头功能。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
enable_maskuint32_t输入enable_mask 使用 TPC_PRINT_HEAD_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.8 ll_tpc_print_head_disable

static inline void ll_tpc_print_head_disable(tpc_regs_t *tpcx, uint32_t disable_mask);

功能说明: 关闭指定的打印头功能。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
disable_maskuint32_t输入disable_mask 使用 TPC_PRINT_HEAD_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.9 ll_tpc_print_head_enable_status_get

static inline uint32_t ll_tpc_print_head_enable_status_get(const tpc_regs_t *tpcx);

功能说明: 读取打印头功能使能状态。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPDEN 寄存器原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.10 ll_tpc_motor_enable

static inline void ll_tpc_motor_enable(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t enable_mask);

功能说明: 使能指定电机的功能位。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
enable_maskuint32_t输入enable_mask 使用 TPC_MOTOR_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.11 ll_tpc_motor_disable

static inline void ll_tpc_motor_disable(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t disable_mask);

功能说明: 关闭指定电机的功能位。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
disable_maskuint32_t输入disable_mask 使用 TPC_MOTOR_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.12 ll_tpc_motor_enable_status_get

static inline uint32_t ll_tpc_motor_enable_status_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取指定电机的使能状态。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t对应 PMnEN 寄存器原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.13 ll_tpc_auto_align_start

static inline void ll_tpc_auto_align_start(tpc_regs_t *tpcx);

功能说明: 向 PAFC 写入开始命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.14 ll_tpc_auto_align_quick_stop

static inline void ll_tpc_auto_align_quick_stop(tpc_regs_t *tpcx);

功能说明: 向 PAFC 写入急停命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.15 ll_tpc_shift_start

static inline void ll_tpc_shift_start(tpc_regs_t *tpcx);

功能说明: 向 PDSMC 写入手动移位开始命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.16 ll_tpc_shift_quick_stop

static inline void ll_tpc_shift_quick_stop(tpc_regs_t *tpcx);

功能说明: 向 PDSMC 写入手动移位急停命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.17 ll_tpc_latch_start

static inline void ll_tpc_latch_start(tpc_regs_t *tpcx);

功能说明: 向 PDLMC 写入锁存开始命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.18 ll_tpc_latch_quick_stop

static inline void ll_tpc_latch_quick_stop(tpc_regs_t *tpcx);

功能说明: 向 PDLMC 写入锁存急停命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.19 ll_tpc_heat_start

static inline void ll_tpc_heat_start(tpc_regs_t *tpcx);

功能说明: 向 PDDMC 写入手动加热或打印头自动模式开始命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.20 ll_tpc_heat_quick_stop

static inline void ll_tpc_heat_quick_stop(tpc_regs_t *tpcx);

功能说明: 向 PDDMC 写入加热急停命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.21 ll_tpc_motor_start

static inline void ll_tpc_motor_start(tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 向指定电机的 PMnMC 写入开始命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.22 ll_tpc_motor_quick_stop

static inline void ll_tpc_motor_quick_stop(tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 向指定电机的 PMnMC 写入急停命令。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.23 ll_tpc_fsm_status_get

static inline uint32_t ll_tpc_fsm_status_get(const tpc_regs_t *tpcx);

功能说明: 读取完整 PFSM 状态寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPFSM 原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.24 ll_tpc_fsm_auto_flow_status_get

static inline uint32_t ll_tpc_fsm_auto_flow_status_get(const tpc_regs_t *tpcx);

功能说明: 读取自动对齐流程状态字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t自动流程 FSM 字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.25 ll_tpc_fsm_shift_status_get

static inline uint32_t ll_tpc_fsm_shift_status_get(const tpc_regs_t *tpcx);

功能说明: 读取移位状态字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tShift FSM 字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.26 ll_tpc_fsm_latch_status_get

static inline uint32_t ll_tpc_fsm_latch_status_get(const tpc_regs_t *tpcx);

功能说明: 读取锁存状态字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tLatch FSM 字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.27 ll_tpc_fsm_heat_status_get

static inline uint32_t ll_tpc_fsm_heat_status_get(const tpc_regs_t *tpcx);

功能说明: 读取加热状态字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tHeat FSM 字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.28 ll_tpc_fsm_print_head_status_get

static inline uint32_t ll_tpc_fsm_print_head_status_get(const tpc_regs_t *tpcx);

功能说明: 读取打印头状态字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t打印头 FSM 字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.29 ll_tpc_fsm_motor0_status_get

static inline uint32_t ll_tpc_fsm_motor0_status_get(const tpc_regs_t *tpcx);

功能说明: 读取 Motor0 状态字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tMotor0 FSM 字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.2.30 ll_tpc_fsm_motor1_status_get

static inline uint32_t ll_tpc_fsm_motor1_status_get(const tpc_regs_t *tpcx);

功能说明: 读取 Motor1 状态字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tMotor1 FSM 字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3 Shift

2.3.1 ll_tpc_shift_clock_div_set

static inline void ll_tpc_shift_clock_div_set(tpc_regs_t *tpcx, uint8_t div);

功能说明: 设置 PDSCD.PRESCALE 移位时钟分频字段。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
divuint8_t输入div 为 0 ~ 255 的原始字段值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.2 ll_tpc_shift_clock_div_get

static inline uint32_t ll_tpc_shift_clock_div_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDSCD.PRESCALE 移位时钟分频字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t移位时钟分频原始字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.3 ll_tpc_shift_base_set

static inline void ll_tpc_shift_base_set(tpc_regs_t *tpcx, uint32_t base);

功能说明: 整体写入 PDSBC 移位基配置寄存器。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
baseuint32_t输入base 为寄存器原始值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.4 ll_tpc_shift_base_get

static inline uint32_t ll_tpc_shift_base_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDSBC 移位基配置寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPDSBC 原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.5 ll_tpc_shift_idle_level_set

static inline void ll_tpc_shift_idle_level_set(tpc_regs_t *tpcx, uint8_t level);

功能说明: 设置移位数据线空闲电平。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
leveluint8_t输入level 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.6 ll_tpc_shift_endian_set

static inline void ll_tpc_shift_endian_set(tpc_regs_t *tpcx, uint8_t endian);

功能说明: 设置移位数据位序。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
endianuint8_t输入endian 使用 TPC_SHIFT_ENDIAN_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.7 ll_tpc_shift_spi_phase_set

static inline void ll_tpc_shift_spi_phase_set(tpc_regs_t *tpcx, uint8_t phase);

功能说明: 设置 SPI 采样相位。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
phaseuint8_t输入phase 使用 TPC_SHIFT_SPI_PHASE_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.8 ll_tpc_shift_spi_polarity_set

static inline void ll_tpc_shift_spi_polarity_set(tpc_regs_t *tpcx, uint8_t polarity);

功能说明: 设置 SPI 空闲极性。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
polarityuint8_t输入polarity 使用 TPC_SHIFT_SPI_POLARITY_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.9 ll_tpc_shift_setup_cycle_set

static inline void ll_tpc_shift_setup_cycle_set(tpc_regs_t *tpcx, uint8_t cycle);

功能说明: 设置移位 setup 周期字段。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
cycleuint8_t输入cycle 为 0 ~ 3

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.10 ll_tpc_shift_hold_cycle_set

static inline void ll_tpc_shift_hold_cycle_set(tpc_regs_t *tpcx, uint8_t cycle);

功能说明: 设置移位 hold 周期字段。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
cycleuint8_t输入cycle 为 0 ~ 3

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.11 ll_tpc_shift_channel_count_set

static inline void ll_tpc_shift_channel_count_set(tpc_regs_t *tpcx, uint8_t channel_count);

功能说明: 设置移位通道数。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
channel_countuint8_t输入channel_count 为 1 ~ 16

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.12 ll_tpc_shift_data_invert_set

static inline void ll_tpc_shift_data_invert_set(tpc_regs_t *tpcx, uint8_t invert);

功能说明: 设置移位数据是否反相。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
invertuint8_t输入invert 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.13 ll_tpc_shift_byte_length_set

static inline void ll_tpc_shift_byte_length_set(tpc_regs_t *tpcx, uint16_t byte_length);

功能说明: 设置每通道字节数字段。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
byte_lengthuint16_t输入byte_length 为每通道字节数,通常为 1 ~ 256,通道数大于 4 时为 1 ~ 128

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.14 ll_tpc_shift_wait_cycle_set

static inline void ll_tpc_shift_wait_cycle_set(tpc_regs_t *tpcx, uint32_t wait_cycle);

功能说明: 设置 PDSWC 移位等待周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
wait_cycleuint32_t输入wait_cycle 为 0 ~ 0x00FFFFFF

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.15 ll_tpc_shift_wait_cycle_get

static inline uint32_t ll_tpc_shift_wait_cycle_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDSWC 移位等待周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t移位等待周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.16 ll_tpc_shift_fifo_write

static inline void ll_tpc_shift_fifo_write(tpc_regs_t *tpcx, uint32_t data);

功能说明: 向移位数据 FIFO PDSDF 写入一个字。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
datauint32_t输入data 为 32 位数据字

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.17 ll_tpc_shift_fifo_flush

static inline void ll_tpc_shift_fifo_flush(tpc_regs_t *tpcx);

功能说明: 启动移位 FIFO Flush。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.18 ll_tpc_shift_fifo_flush_busy_get

static inline uint32_t ll_tpc_shift_fifo_flush_busy_get(const tpc_regs_t *tpcx);

功能说明: 读取移位 FIFO Flush 是否仍在进行。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tFlush 忙状态位。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.19 ll_tpc_shift_fifo_threshold_set

static inline void ll_tpc_shift_fifo_threshold_set(tpc_regs_t *tpcx, uint8_t threshold);

功能说明: 设置移位 FIFO DMA 阈值。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
thresholduint8_t输入threshold 为阈值字段值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.3.20 ll_tpc_shift_fifo_threshold_get

static inline uint32_t ll_tpc_shift_fifo_threshold_get(const tpc_regs_t *tpcx);

功能说明: 读取移位 FIFO DMA 阈值。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t移位 FIFO 阈值字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.4 Latch

2.4.1 ll_tpc_latch_base_set

static inline void ll_tpc_latch_base_set(tpc_regs_t *tpcx, uint32_t base);

功能说明: 整体写入 PDLBC 锁存基配置寄存器。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
baseuint32_t输入base 为寄存器原始值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.4.2 ll_tpc_latch_base_get

static inline uint32_t ll_tpc_latch_base_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDLBC 锁存基配置寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPDLBC 原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.4.3 ll_tpc_latch_idle_level_set

static inline void ll_tpc_latch_idle_level_set(tpc_regs_t *tpcx, uint8_t level);

功能说明: 设置锁存线空闲电平。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
leveluint8_t输入level 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.4.4 ll_tpc_latch_wait_cycle_set

static inline void ll_tpc_latch_wait_cycle_set(tpc_regs_t *tpcx, uint32_t wait_cycle);

功能说明: 设置 PDLWC 锁存输出前等待周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
wait_cycleuint32_t输入wait_cycle 为 0 ~ 0x00FFFFFF

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.4.5 ll_tpc_latch_wait_cycle_get

static inline uint32_t ll_tpc_latch_wait_cycle_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDLWC 锁存等待周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t锁存等待周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.4.6 ll_tpc_latch_active_cycle_set

static inline void ll_tpc_latch_active_cycle_set(tpc_regs_t *tpcx, uint32_t active_cycle);

功能说明: 设置 PDLAC 锁存有效周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
active_cycleuint32_t输入active_cycle 为 0 ~ 0x00FFFFFF

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.4.7 ll_tpc_latch_active_cycle_get

static inline uint32_t ll_tpc_latch_active_cycle_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDLAC 锁存有效周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t锁存有效周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5 Heat

2.5.1 ll_tpc_heat_base_set

static inline void ll_tpc_heat_base_set(tpc_regs_t *tpcx, uint32_t base);

功能说明: 整体写入 PDDBC 加热基配置寄存器。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
baseuint32_t输入base 为寄存器原始值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.2 ll_tpc_heat_base_get

static inline uint32_t ll_tpc_heat_base_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDDBC 加热基配置寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPDDBC 原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.3 ll_tpc_heat_idle_level_set

static inline void ll_tpc_heat_idle_level_set(tpc_regs_t *tpcx, uint8_t level);

功能说明: 设置加热线空闲电平。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
leveluint8_t输入level 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.4 ll_tpc_heat_channel_count_set

static inline void ll_tpc_heat_channel_count_set(tpc_regs_t *tpcx, uint8_t channel_count);

功能说明: 设置加热通道数。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
channel_countuint8_t输入channel_count 为 1 ~ 4

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.5 ll_tpc_heat_wait_cycle_set

static inline void ll_tpc_heat_wait_cycle_set(tpc_regs_t *tpcx, uint32_t wait_cycle);

功能说明: 设置 PDDWC 加热输出前等待周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
wait_cycleuint32_t输入wait_cycle 为 0 ~ 0x00FFFFFF

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.6 ll_tpc_heat_wait_cycle_get

static inline uint32_t ll_tpc_heat_wait_cycle_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDDWC 加热等待周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t加热等待周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.7 ll_tpc_heat_max_cycle_set

static inline void ll_tpc_heat_max_cycle_set(tpc_regs_t *tpcx, uint32_t max_cycle);

功能说明: 设置 PDDMAC 最大加热周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
max_cycleuint32_t输入max_cycle 为 0 ~ 0x00FFFFFF

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.8 ll_tpc_heat_max_cycle_get

static inline uint32_t ll_tpc_heat_max_cycle_get(const tpc_regs_t *tpcx);

功能说明: 读取 PDDMAC 最大加热周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t最大加热周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.9 ll_tpc_heat_fifo_write

static inline void ll_tpc_heat_fifo_write(tpc_regs_t *tpcx, uint32_t data);

功能说明: 向加热定时 FIFO PDDTF 写入一个字。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
datauint32_t输入data 为 32 位 FIFO 数据字

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.10 ll_tpc_heat_fifo_flush

static inline void ll_tpc_heat_fifo_flush(tpc_regs_t *tpcx);

功能说明: 启动加热 FIFO Flush。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.11 ll_tpc_heat_fifo_flush_busy_get

static inline uint32_t ll_tpc_heat_fifo_flush_busy_get(const tpc_regs_t *tpcx);

功能说明: 读取加热 FIFO Flush 是否仍在进行。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tFlush 忙状态位。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.12 ll_tpc_heat_fifo_threshold_set

static inline void ll_tpc_heat_fifo_threshold_set(tpc_regs_t *tpcx, uint8_t threshold);

功能说明: 设置加热 FIFO DMA 阈值。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
thresholduint8_t输入threshold 为阈值字段值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.5.13 ll_tpc_heat_fifo_threshold_get

static inline uint32_t ll_tpc_heat_fifo_threshold_get(const tpc_regs_t *tpcx);

功能说明: 读取加热 FIFO DMA 阈值。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t加热 FIFO 阈值字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6 Motor

2.6.1 ll_tpc_motor_base_set

static inline void ll_tpc_motor_base_set(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t base);

功能说明: 整体写入指定电机的 PMnBC 基配置寄存器。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
baseuint32_t输入base 为原始值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.2 ll_tpc_motor_base_get

static inline uint32_t ll_tpc_motor_base_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取指定电机的 PMnBC 基配置寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_tPMnBC 原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.3 ll_tpc_motor_repeat_step_count_set

static inline void ll_tpc_motor_repeat_step_count_set(tpc_regs_t *tpcx, uint8_t motor_id, uint8_t repeat_step_count);

功能说明: 设置电机重复步数。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
repeat_step_countuint8_t输入repeat_step_count 为 1 ~ 64

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.4 ll_tpc_motor_align_step_index_set

static inline void ll_tpc_motor_align_step_index_set(tpc_regs_t *tpcx, uint8_t motor_id, uint8_t align_step_index);

功能说明: 设置电机自动对齐步索引。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
align_step_indexuint8_t输入align_step_index 从 1 开始

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.5 ll_tpc_motor_start_step_cycle_set

static inline void ll_tpc_motor_start_step_cycle_set(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t cycle);

功能说明: 设置电机开始步周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
cycleuint32_t输入cycle 为周期字段值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.6 ll_tpc_motor_start_step_cycle_get

static inline uint32_t ll_tpc_motor_start_step_cycle_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取电机开始步周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t开始步周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.7 ll_tpc_motor_end_step_cycle_set

static inline void ll_tpc_motor_end_step_cycle_set(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t cycle);

功能说明: 设置电机结束步周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
cycleuint32_t输入cycle 为周期字段值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.8 ll_tpc_motor_end_step_cycle_get

static inline uint32_t ll_tpc_motor_end_step_cycle_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取电机结束步周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t结束步周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.9 ll_tpc_motor_max_step_cycle_set

static inline void ll_tpc_motor_max_step_cycle_set(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t cycle);

功能说明: 设置电机单步最大周期。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
cycleuint32_t输入cycle 为周期字段值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.10 ll_tpc_motor_max_step_cycle_get

static inline uint32_t ll_tpc_motor_max_step_cycle_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取电机单步最大周期。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t最大步周期字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.11 ll_tpc_motor_fifo_write

static inline void ll_tpc_motor_fifo_write(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t data);

功能说明: 向指定电机的 PMnTF 写入一个周期字。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
datauint32_t输入data 为 32 位写入值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.12 ll_tpc_motor_fifo_flush

static inline void ll_tpc_motor_fifo_flush(tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 启动指定电机的 FIFO Flush。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.13 ll_tpc_motor_fifo_flush_busy_get

static inline uint32_t ll_tpc_motor_fifo_flush_busy_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取指定电机 FIFO Flush 忙状态。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_tFlush 忙状态位。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.14 ll_tpc_motor_fifo_threshold_set

static inline void ll_tpc_motor_fifo_threshold_set(tpc_regs_t *tpcx, uint8_t motor_id, uint8_t threshold);

功能说明: 设置指定电机 FIFO DMA 阈值。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
thresholduint8_t输入threshold 为字段值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.15 ll_tpc_motor_fifo_threshold_get

static inline uint32_t ll_tpc_motor_fifo_threshold_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取指定电机 FIFO DMA 阈值。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t阈值字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.16 ll_tpc_motor_repeat_irq_mask_set

static inline void ll_tpc_motor_repeat_irq_mask_set(tpc_regs_t *tpcx, uint8_t motor_id, uint32_t mask_low, uint32_t mask_high);

功能说明: 设置 64 个重复步中断的屏蔽 mask。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
mask_lowuint32_t输入mask_low/mask_high 为低/高 32 位原始值
mask_highuint32_t输入mask_low/mask_high 为低/高 32 位原始值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.17 ll_tpc_motor_repeat_irq_mask_get

static inline void ll_tpc_motor_repeat_irq_mask_get(const tpc_regs_t *tpcx, uint8_t motor_id, uint32_t *mask_low_out, uint32_t *mask_high_out);

功能说明: 一次读取重复步中断 mask 的低/高 32 位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1
mask_low_outuint32_t *输出PMnRIM0 低 32 位 mask,不能为 NULL
mask_high_outuint32_t *输出PMnRIM1 高 32 位 mask,不能为 NULL

返回值表:

返回值说明
无无返回值;结果写入 mask_low_out 和 mask_high_out。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.18 ll_tpc_motor_repeat_irq_mask_low_get

static inline uint32_t ll_tpc_motor_repeat_irq_mask_low_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取重复步中断 mask 低 32 位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t低 32 位 mask。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.19 ll_tpc_motor_repeat_irq_mask_high_get

static inline uint32_t ll_tpc_motor_repeat_irq_mask_high_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取重复步中断 mask 高 32 位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t高 32 位 mask。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.20 ll_tpc_motor_channel_mode_set

static inline void ll_tpc_motor_channel_mode_set(tpc_regs_t *tpcx, uint8_t mode);

功能说明: 设置 Motor0 八通道或 Motor0/Motor1 4+4 分离模式。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
modeuint8_t输入mode 使用 TPC_MOTOR_CHANNEL_MODE_*

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.21 ll_tpc_motor_channel_mode_get

static inline uint32_t ll_tpc_motor_channel_mode_get(const tpc_regs_t *tpcx);

功能说明: 读取电机通道模式。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPMCMS 模式字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.22 ll_tpc_motor_idle_level_set

static inline void ll_tpc_motor_idle_level_set(tpc_regs_t *tpcx, uint8_t channel, uint8_t level);

功能说明: 设置电机通道空闲电平。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7
leveluint8_t输入level 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.23 ll_tpc_motor_idle_level_get

static inline uint32_t ll_tpc_motor_idle_level_get(const tpc_regs_t *tpcx, uint8_t channel);

功能说明: 读取电机通道空闲电平。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7

返回值表:

返回值说明
uint32_t该通道空闲电平。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.24 ll_tpc_motor_start_level_set

static inline void ll_tpc_motor_start_level_set(tpc_regs_t *tpcx, uint8_t channel, uint8_t level);

功能说明: 设置电机通道开始步电平。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7
leveluint8_t输入level 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.25 ll_tpc_motor_start_level_get

static inline uint32_t ll_tpc_motor_start_level_get(const tpc_regs_t *tpcx, uint8_t channel);

功能说明: 读取电机通道开始步电平。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7

返回值表:

返回值说明
uint32_t该通道开始步电平。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.26 ll_tpc_motor_end_level_set

static inline void ll_tpc_motor_end_level_set(tpc_regs_t *tpcx, uint8_t channel, uint8_t level);

功能说明: 设置电机通道结束步电平。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7
leveluint8_t输入level 为 0/1

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.27 ll_tpc_motor_end_level_get

static inline uint32_t ll_tpc_motor_end_level_get(const tpc_regs_t *tpcx, uint8_t channel);

功能说明: 读取电机通道结束步电平。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7

返回值表:

返回值说明
uint32_t该通道结束步电平。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.28 ll_tpc_motor_repeat_level_set

static inline void ll_tpc_motor_repeat_level_set(tpc_regs_t *tpcx, uint8_t channel, uint32_t level_low, uint32_t level_high);

功能说明: 设置一个电机通道 64 个重复步的输出电平。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7
level_lowuint32_t输入level_low/level_high 为原始值
level_highuint32_t输入level_low/level_high 为原始值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.29 ll_tpc_motor_repeat_level_get

static inline void ll_tpc_motor_repeat_level_get(const tpc_regs_t *tpcx, uint8_t channel, uint32_t *level_low_out, uint32_t *level_high_out);

功能说明: 一次读取一个通道 64 个重复步的输出电平。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7
level_low_outuint32_t *输出PMCnRLC0 低 32 位电平 mask,不能为 NULL
level_high_outuint32_t *输出PMCnRLC1 高 32 位电平 mask,不能为 NULL

返回值表:

返回值说明
无无返回值;结果写入输出指针。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.30 ll_tpc_motor_repeat_level_low_get

static inline uint32_t ll_tpc_motor_repeat_level_low_get(const tpc_regs_t *tpcx, uint8_t channel);

功能说明: 读取通道重复步输出电平低 32 位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7

返回值表:

返回值说明
uint32_t低 32 位电平 mask。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.6.31 ll_tpc_motor_repeat_level_high_get

static inline uint32_t ll_tpc_motor_repeat_level_high_get(const tpc_regs_t *tpcx, uint8_t channel);

功能说明: 读取通道重复步输出电平高 32 位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
channeluint8_t输入channel 为 0 ~ 7

返回值表:

返回值说明
uint32_t高 32 位电平 mask。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7 WDT

2.7.1 ll_tpc_wdt_threshold_set

static inline void ll_tpc_wdt_threshold_set(tpc_regs_t *tpcx, uint32_t threshold);

功能说明: 整体写入 PWDTF 半/满阈值寄存器。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
thresholduint32_t输入threshold 为 32 位原始值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.2 ll_tpc_wdt_threshold_get

static inline uint32_t ll_tpc_wdt_threshold_get(const tpc_regs_t *tpcx);

功能说明: 读取 PWDTF 半/满阈值寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPWDTF 原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.3 ll_tpc_wdt_full_threshold_set

static inline void ll_tpc_wdt_full_threshold_set(tpc_regs_t *tpcx, uint16_t threshold);

功能说明: 设置 WDT 满阈值字段。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
thresholduint16_t输入threshold 为 16 位阈值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.4 ll_tpc_wdt_full_threshold_get

static inline uint32_t ll_tpc_wdt_full_threshold_get(const tpc_regs_t *tpcx);

功能说明: 读取 WDT 满阈值字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t16 位满阈值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.5 ll_tpc_wdt_half_threshold_set

static inline void ll_tpc_wdt_half_threshold_set(tpc_regs_t *tpcx, uint16_t threshold);

功能说明: 设置 WDT 半阈值字段。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
thresholduint16_t输入threshold 为 16 位阈值

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.6 ll_tpc_wdt_half_threshold_get

static inline uint32_t ll_tpc_wdt_half_threshold_get(const tpc_regs_t *tpcx);

功能说明: 读取 WDT 半阈值字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t16 位半阈值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.7 ll_tpc_wdt_enable

static inline void ll_tpc_wdt_enable(tpc_regs_t *tpcx);

功能说明: 启动 WDT 计数。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.8 ll_tpc_wdt_disable

static inline void ll_tpc_wdt_disable(tpc_regs_t *tpcx);

功能说明: 停止 WDT 计数。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.9 ll_tpc_wdt_enable_get

static inline uint32_t ll_tpc_wdt_enable_get(const tpc_regs_t *tpcx);

功能说明: 读取 WDT 计数使能状态。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tWDT 使能状态位。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.10 ll_tpc_wdt_counter_get

static inline uint32_t ll_tpc_wdt_counter_get(const tpc_regs_t *tpcx);

功能说明: 读取 PWDTV 当前计数值。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tWDT 当前计数。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.11 ll_tpc_wdt_rtc_clock_enable

static inline void ll_tpc_wdt_rtc_clock_enable(tpc_regs_t *tpcx);

功能说明: 选择 RTC 时钟作为 WDT 时钟源。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.12 ll_tpc_wdt_rtc_clock_disable

static inline void ll_tpc_wdt_rtc_clock_disable(tpc_regs_t *tpcx);

功能说明: 关闭 RTC 时钟输入,使用模块时钟作为 WDT 时钟源。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.13 ll_tpc_wdt_clock_div_set

static inline void ll_tpc_wdt_clock_div_set(tpc_regs_t *tpcx, uint8_t div);

功能说明: 设置 WDT 时钟分频字段。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
divuint8_t输入div 有效值为 0 ~ 5

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.14 ll_tpc_wdt_clock_div_get

static inline uint32_t ll_tpc_wdt_clock_div_get(const tpc_regs_t *tpcx);

功能说明: 读取 WDT 时钟分频字段。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tWDT 时钟分频字段值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.15 ll_tpc_wdt_counter_clear

static inline void ll_tpc_wdt_counter_clear(tpc_regs_t *tpcx);

功能说明: 发出 WDT 计数清零请求。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.7.16 ll_tpc_wdt_counter_clear_busy_get

static inline uint32_t ll_tpc_wdt_counter_clear_busy_get(const tpc_regs_t *tpcx);

功能说明: 读取 WDT 自清零位是否仍为忙状态。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t清零忙状态位。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8 中断与 FIFO 状态

2.8.1 ll_tpc_interrupt_status_get

static inline uint32_t ll_tpc_interrupt_status_get(const tpc_regs_t *tpcx);

功能说明: 读取 PINTS 中断状态寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t所有中断状态位的原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.2 ll_tpc_interrupt_status_clear

static inline void ll_tpc_interrupt_status_clear(tpc_regs_t *tpcx, uint32_t interrupt_mask);

功能说明: 向 PINTS 中指定位写 1 清除中断状态。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
interrupt_maskuint32_t输入interrupt_mask 为待清除位

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.3 ll_tpc_interrupt_mask_get

static inline uint32_t ll_tpc_interrupt_mask_get(const tpc_regs_t *tpcx);

功能说明: 读取 PINTM0 中断屏蔽寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t中断屏蔽原始值,1 表示屏蔽。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.4 ll_tpc_interrupt_enable

static inline void ll_tpc_interrupt_enable(tpc_regs_t *tpcx, uint32_t interrupt_mask);

功能说明: 清除 PINTM0 中对应位,使指定中断源通过 PLIC 上报。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
interrupt_maskuint32_t输入interrupt_mask 为待放行中断位

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.5 ll_tpc_interrupt_disable

static inline void ll_tpc_interrupt_disable(tpc_regs_t *tpcx, uint32_t interrupt_mask);

功能说明: 置位 PINTM0 中对应位,屏蔽指定中断源。

参数表:

参数类型方向说明
tpcxtpc_regs_t *输入tpcx 为 TPC 实例
interrupt_maskuint32_t输入interrupt_mask 为待屏蔽中断位

返回值表:

返回值说明
无无返回值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.6 ll_tpc_interrupt_pending_get

static inline uint32_t ll_tpc_interrupt_pending_get(const tpc_regs_t *tpcx);

功能说明: 读取已放行且挂起的中断位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPINTS & ~PINTM0。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.7 ll_tpc_fifo_status_get

static inline uint32_t ll_tpc_fifo_status_get(const tpc_regs_t *tpcx);

功能说明: 读取完整 PFFS FIFO 状态寄存器。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_tPFFS 原始值。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.8 ll_tpc_shift_fifo_empty_get

static inline uint32_t ll_tpc_shift_fifo_empty_get(const tpc_regs_t *tpcx);

功能说明: 读取移位 FIFO 空状态位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t非 0 表示空,0 表示非空。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.9 ll_tpc_shift_fifo_full_get

static inline uint32_t ll_tpc_shift_fifo_full_get(const tpc_regs_t *tpcx);

功能说明: 读取移位 FIFO 满状态位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t非 0 表示满,0 表示未满。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.10 ll_tpc_heat_fifo_empty_get

static inline uint32_t ll_tpc_heat_fifo_empty_get(const tpc_regs_t *tpcx);

功能说明: 读取加热 FIFO 空状态位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t非 0 表示空,0 表示非空。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.11 ll_tpc_heat_fifo_full_get

static inline uint32_t ll_tpc_heat_fifo_full_get(const tpc_regs_t *tpcx);

功能说明: 读取加热 FIFO 满状态位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例

返回值表:

返回值说明
uint32_t非 0 表示满,0 表示未满。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.12 ll_tpc_motor_fifo_empty_get

static inline uint32_t ll_tpc_motor_fifo_empty_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取指定电机 FIFO 空状态位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t非 0 表示空,0 表示非空。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.8.13 ll_tpc_motor_fifo_full_get

static inline uint32_t ll_tpc_motor_fifo_full_get(const tpc_regs_t *tpcx, uint8_t motor_id);

功能说明: 读取指定电机 FIFO 满状态位。

参数表:

参数类型方向说明
tpcxconst tpc_regs_t *输入tpcx 为 TPC 实例
motor_iduint8_t输入motor_id 为 0/1

返回值表:

返回值说明
uint32_t非 0 表示满,0 表示未满。

补充说明:

  • LL 层不校验参数;调用方必须保证实例、索引、指针和字段值合法。

2.9 常见易错点

  • ll_tpc_interrupt_enable() / ll_tpc_interrupt_disable() 按中断源命名,但写入PINTM0 的值分别为 0 和 1(寄存器采用屏蔽语义)。

  • ll_tpc_interrupt_pending_get() 返回 PINTS & ~PINTM0,即“已放行且挂起”的位。

  • ll_tpc_motor_repeat_irq_mask_* 与 ll_tpc_motor_repeat_level_* 的 get/set 接口使用 低/高 32 位原始寄存器值。

  • 电机重复步计数和对齐步索引均从 1 开始。

  • shift_clock_div_* 操作的是 PDSCD.PRESCALE 原始字段,不进行 Hz 换算。

3. 寄存器与位域约定

3.1 TPC 寄存器块布局

同一 tpc_regs_t 内,n 为电机索引 0/1,c 为电机输出通道 0 ~ 7:

偏移名称说明
0x000 / 0x004 / 0x008PFCENS / PFCENC / PFCEN自动对齐流程控制使能:置位 / 清除 / 状态
0x00C / 0x010 / 0x014PDENS / PDENC / PDEN打印头功能使能:置位 / 清除 / 状态
0x018 + 0x0C*nPMnENS电机使能置位
0x01C + 0x0C*nPMnENC电机使能清除
0x020 + 0x0C*nPMnEN电机使能状态
0x030PDSCD移位时钟分频(PRESCALE)
0x040PAFC自动对齐流程启动 / 急停
0x044PDSMC手动移位启动 / 急停
0x048PDLMC手动锁存启动 / 急停
0x04CPDDMC手动加热(打印头自动模式)启动 / 急停
0x050 + 0x04*nPMnMC电机启动 / 急停
0x058PFSM各子模块有限状态机状态
0x060PDSBC移位基配置(空闲电平、位序、SPI、通道数、行字节数)
0x064PDSWC移位等待周期
0x068PDSDF移位数据 FIFO
0x06CPDSDFC移位 FIFO 控制(Flush、DMA 阈值)
0x070PDLBC锁存基配置(空闲电平)
0x074 / 0x078PDLWC / PDLAC锁存等待周期 / 有效周期
0x07CPDDBC加热基配置(空闲电平、通道数)
0x080 / 0x084PDDWC / PDDMAC加热等待周期 / 最大加热周期
0x088 / 0x08CPDDTF / PDDTFC加热定时 FIFO / 其控制
0x090 + 0x20*nPMnBC电机基配置(重复步数、对齐步索引)
0x094 + 0x20*nPMnSSC开始步周期
0x098 + 0x20*nPMnESC结束步周期
0x09C + 0x20*nPMnMSC最大步周期
0x0A0 + 0x20*nPMnTF电机定时 FIFO
0x0A4 + 0x20*nPMnTFC电机 FIFO 控制
0x0A8 + 0x20*n / 0x0AC + 0x20*nPMnRIM0 / PMnRIM1重复步中断屏蔽低 32 步 / 高 32 步
0x0D0PMCMS电机通道模式(Motor0 8 通道 / 4+4 分离)
0x0D4PMCILC电机空闲电平
0x0D8 / 0x0DCPMCSLC / PMCELC电机开始步 / 结束步电平
0x0E0 + 0x08*c / 0x0E4 + 0x08*cPMCcRLC0 / PMCcRLC1该通道 64 个重复步的输出电平低 / 高位
0x120PWDTFWDT 半阈值(高 16 位)/ 满阈值(低 16 位)
0x124PWDTFEWDT 计数使能
0x128PWDTVWDT 当前计数值
0x12CPWDTCWDT 时钟源 / 分频 / 计数清零
0x130PINTS中断状态,写 1 清除
0x134PINTM0CPU 中断屏蔽,1 = 屏蔽,0 = 放行
0x13CPFFS移位 / 加热 / 电机 FIFO 空满状态

3.2 寄存器访问约定

以下约定对 HAL 和 LL 都成立,直接操作寄存器时必须遵守。

约定说明
使能类寄存器置位寄存器(*ENS)写 1 使能对应位且不影响其它位;清除寄存器(*ENC)写 1 关闭;状态寄存器(*EN)只读回当前状态
启动/急停寄存器PAFC、PDSMC、PDLMC、PDDMC、PMnMC 为写 1 触发:bit0 启动、bit1 急停(TPC_CONTROL_START / TPC_CONTROL_QUICK_STOP)
PINTS写 1 清除(RW1C),写 0 无效
PINTM0屏蔽语义:1 屏蔽、0 放行。已放行且置位的 PINTS 位会向 PLIC 产生 IRQ_TPC 请求
周期字段PDSWC、PDLWC、PDLAC、PDDWC、PDDMAC、PMnSSC/ESC/MSC 和热 FIFO 时间字段均为 24 位,上限 0x00FF_FFFF 个功能时钟周期
电机重复步/对齐步PMnBC.PMRSN 为 7 位(1 ~ 64),PMnBC.PMASI 为 7 位(1 ~ 64)。1 表示第 1 步,不需要再减 1
电机重复步中断PMnRIM0/1 覆盖 64 个重复步,同为屏蔽语义(1 = 屏蔽)。HAL 默认只放行 align_step_index 对应的那一步
移位基配置PDSBC:bit[0] 空闲电平、bit[1] 位序、bit[2] SPI 相位、bit[3] SPI 极性、bit[5:4] setup、bit[7:6] hold、bit[13:8] 通道数、bit[15] 数据反转、bit[24:16] 每通道字节数
每通道字节数PDSBC 字段为 line_bytes / channel_count:通道数 ≤ 4 时允许 1 ~ 256 字节,通道数 > 4 时允许 1 ~ 128 字节
加热 FIFO 数据字每个数据单元 = 1 个“下一单元触发/等待”字 + 每通道 1 个字;bit[23:0] 为时间,bit[24] 在首字表示“下一单元由锁存触发”、在通道字表示“该通道输出使能”
电机定时 FIFO每个数据单元 = repeat_step_count 个 32 位字,每字为该拍的周期数;该拍的输出电平来自 PMCcRLC0/1