![]() |
no-OS
|
Timer control module source for Lattice RISC-V RX. More...
#include <errno.h>#include <stdint.h>#include <stdlib.h>#include "no_os_alloc.h"#include "no_os_error.h"#include "riscvrx_timer.h"#include "hal.h"#include "parameters.h"Functions | |
| int32_t | lattice_timer_set_callback (struct no_os_timer_desc *desc, void(*handler)(void *), void *ctx) |
| Register timer callback and context. | |
| int32_t | lattice_timer_start (struct no_os_timer_desc *desc) |
| Start timer counting. | |
| int32_t | lattice_timer_stop (struct no_os_timer_desc *desc) |
| Stop timer counting. | |
| int32_t | lattice_timer_counter_get (struct no_os_timer_desc *desc, uint32_t *counter) |
| Read current timer counter. | |
| int32_t | lattice_timer_counter_set (struct no_os_timer_desc *desc, uint32_t new_val) |
| Set timer counter reload value. | |
| int32_t | lattice_timer_count_clk_get (struct no_os_timer_desc *desc, uint32_t *freq_hz) |
| Get timer input clock frequency. | |
| int32_t | lattice_timer_count_clk_set (struct no_os_timer_desc *desc, uint32_t freq_hz) |
| Set timer input clock frequency. | |
| int32_t | lattice_timer_get_elapsed_time_nsec (struct no_os_timer_desc *desc, uint64_t *elapsed_time) |
| Get elapsed time in nanoseconds from MTIME. | |
| int32_t | lattice_timer_init (struct no_os_timer_desc **desc, const struct no_os_timer_init_param *param) |
| Initialize Lattice timer descriptor. | |
| int32_t | lattice_timer_remove (struct no_os_timer_desc *desc) |
| Remove timer instance and free resources. | |
Variables | |
| const struct no_os_timer_platform_ops | latt_timer_ops |
| Lattice platform specific timer platform ops structure. | |
Timer control module source for Lattice RISC-V RX.
Copyright 2025-2026(c) Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| int32_t lattice_timer_count_clk_get | ( | struct no_os_timer_desc * | desc, |
| uint32_t * | freq_hz ) |
Get timer input clock frequency.
| desc | - no-OS timer descriptor. |
| freq_hz | - Pointer to returned frequency. |
| int32_t lattice_timer_count_clk_set | ( | struct no_os_timer_desc * | desc, |
| uint32_t | freq_hz ) |
Set timer input clock frequency.
| desc | - no-OS timer descriptor. |
| freq_hz | - Requested frequency. |
| int32_t lattice_timer_counter_get | ( | struct no_os_timer_desc * | desc, |
| uint32_t * | counter ) |
Read current timer counter.
| desc | - no-OS timer descriptor. |
| counter | - Pointer to returned counter value. |
| int32_t lattice_timer_counter_set | ( | struct no_os_timer_desc * | desc, |
| uint32_t | new_val ) |
Set timer counter reload value.
| desc | - no-OS timer descriptor. |
| new_val | - New tick count value. |
| int32_t lattice_timer_get_elapsed_time_nsec | ( | struct no_os_timer_desc * | desc, |
| uint64_t * | elapsed_time ) |
Get elapsed time in nanoseconds from MTIME.
| desc | - no-OS timer descriptor. |
| elapsed_time | - Pointer to returned elapsed nanoseconds. |
| int32_t lattice_timer_init | ( | struct no_os_timer_desc ** | desc, |
| const struct no_os_timer_init_param * | param ) |
Initialize Lattice timer descriptor.
| desc | - Pointer to no-OS timer descriptor. |
| param | - no-OS timer init parameters. |
| int32_t lattice_timer_remove | ( | struct no_os_timer_desc * | desc | ) |
Remove timer instance and free resources.
| desc | - no-OS timer descriptor. |
| int32_t lattice_timer_set_callback | ( | struct no_os_timer_desc * | desc, |
| void(* | handler )(void *), | ||
| void * | ctx ) |
Register timer callback and context.
Register timer callback and context for Lattice timer backend.
| desc | - no-OS timer descriptor. |
| handler | - User callback function. |
| ctx | - User callback context. |
| int32_t lattice_timer_start | ( | struct no_os_timer_desc * | desc | ) |
Start timer counting.
| desc | - no-OS timer descriptor. |
| int32_t lattice_timer_stop | ( | struct no_os_timer_desc * | desc | ) |
Stop timer counting.
| desc | - no-OS timer descriptor. |
| const struct no_os_timer_platform_ops latt_timer_ops |
Lattice platform specific timer platform ops structure.