[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 3/4] clock: Add clock_ns_to_ticks() function
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v2 3/4] clock: Add clock_ns_to_ticks() function |
Date: |
Thu, 11 Feb 2021 00:44:04 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
On 2/9/21 2:20 PM, Peter Maydell wrote:
> Add a clock_ns_to_ticks() function which does the opposite of
> clock_ticks_to_ns(): given a duration in nanoseconds, it returns the
> number of clock ticks that would happen in that time. This is useful
> for devices that have a free running counter register whose value can
> be calculated when it is read.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I have made the overflow behaviour here be "wrap", with justification
> as per the comment; but I'm not 100% set on this.
> ---
> docs/devel/clocks.rst | 12 ++++++++++++
> include/hw/clock.h | 41 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 53 insertions(+)
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
- Re: [PATCH v2 2/4] clock: Add ClockPreUpdate callback event type, (continued)