mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-02 05:02:38 +00:00
Adds native_posix hw counter model and the counter driver. Functionality is needed by software which is tested on native_posix and has dependency on counter. Hardware model was developed similarly to HW timer model. The counter driver wraps HW counter functions and exposes basic functionalities: starting, stopping, setting and cancelling single channel alarms. Code was tested against: tests/drivers/counter/counter_basic_api. Signed-off-by: Filip Zajdel <filip.zajdel@nordicsemi.no>
30 lines
553 B
C
30 lines
553 B
C
/*
|
|
* Copyright (c) 2020 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef _NATIVE_POSIX_HW_COUNTER_H
|
|
#define _NATIVE_POSIX_HW_COUNTER_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void hw_counter_init(void);
|
|
void hw_counter_triggered(void);
|
|
|
|
void hw_counter_set_period(uint64_t period);
|
|
void hw_counter_set_target(uint64_t counter_target);
|
|
void hw_counter_start(void);
|
|
void hw_counter_stop(void);
|
|
uint64_t hw_counter_get_value(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _NATIVE_POSIX_HW_COUNTER_H */
|