libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::HPMTimebase Class Reference

HPM MCHTMR 时间基准实现 / HPM MCHTMR based timebase implementation. More...

#include <hpm_timebase.hpp>

Inheritance diagram for LibXR::HPMTimebase:
[legend]
Collaboration diagram for LibXR::HPMTimebase:
[legend]

Public Member Functions

 HPMTimebase (MCHTMR_Type *timer=HPM_MCHTMR, clock_name_t clock=clock_mchtmr0)
 构造 HPM 时间基对象 / Construct an HPM timebase object.
 
- Public Member Functions inherited from LibXR::Timebase
 Timebase ()=default
 默认构造函数。 Default constructor.
 
 Timebase (const Timebase &)=delete
 禁止拷贝构造。 Copy construction is disabled.
 
Timebaseoperator= (const Timebase &)=delete
 禁止拷贝赋值。 Copy assignment is disabled.
 

Additional Inherited Members

- Static Public Member Functions inherited from LibXR::Timebase
static MicrosecondTimestamp GetMicroseconds ()
 获取当前时间的微秒级时间戳。 Gets the current timestamp in microseconds.
 
static MillisecondTimestamp GetMilliseconds ()
 获取当前时间的毫秒级时间戳。 Gets the current timestamp in milliseconds.
 
static bool IsReady () noexcept
 检查时间基是否已经初始化。 Check whether the active timebase backend is initialized.
 
static void DelayMicroseconds (uint32_t us)
 微秒级延时 / Delay in microseconds
 
- Static Protected Member Functions inherited from LibXR::Timebase
static void SetReady (bool ready=true) noexcept
 设置时间基就绪状态。 Set the timebase ready flag.
 
static void ConfigureWrapRange (uint64_t max_valid_us, uint32_t max_valid_ms) noexcept
 配置时间戳回绕上界。 Configure the timestamp wraparound limits.
 
static uint64_t GetConfiguredWrapRangeUs () noexcept
 读取当前配置的微秒回绕上界。 Read the configured microsecond wraparound limit.
 
static uint32_t GetConfiguredWrapRangeMs () noexcept
 读取当前配置的毫秒回绕上界。 Read the configured millisecond wraparound limit.
 

Detailed Description

HPM MCHTMR 时间基准实现 / HPM MCHTMR based timebase implementation.

基于 MCHTMR 计数器提供微秒与毫秒时间戳。 Provides microsecond and millisecond timestamps using MCHTMR counter.

Definition at line 19 of file hpm_timebase.hpp.

Constructor & Destructor Documentation

◆ HPMTimebase()

HPMTimebase::HPMTimebase ( MCHTMR_Type * timer = HPM_MCHTMR,
clock_name_t clock = clock_mchtmr0 )

构造 HPM 时间基对象 / Construct an HPM timebase object.

Parameters
timerMCHTMR 外设基地址 / MCHTMR base address.
clock定时器时钟源 / Clock source used by the timer.

构造时选择计数器实例并缓存输入时钟频率。 Construction selects the counter instance and caches the input clock rate.

Definition at line 22 of file hpm_timebase.cpp.

23{
24 g_timer = timer;
25 g_clock_hz = clock_get_frequency(clock);
26 ConfigureWrapRange(static_cast<uint64_t>(UINT32_MAX) * 1000ULL + 999ULL, UINT32_MAX);
27 SetReady();
28}
static void ConfigureWrapRange(uint64_t max_valid_us, uint32_t max_valid_ms) noexcept
配置时间戳回绕上界。 Configure the timestamp wraparound limits.
Definition timebase.hpp:95
static void SetReady(bool ready=true) noexcept
设置时间基就绪状态。 Set the timebase ready flag.
Definition timebase.hpp:85

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