Server IP : 13.213.54.232 / Your IP : 216.73.216.72 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ip-172-31-17-110 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.1.33-67+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/modules/6.8.0-1029-aws/build/include/linux/iio/common/ |
Upload File : |
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2020 Invensense, Inc. */ #ifndef INV_SENSORS_TIMESTAMP_H_ #define INV_SENSORS_TIMESTAMP_H_ /** * struct inv_sensors_timestamp_chip - chip internal properties * @clock_period: internal clock period in ns * @jitter: acceptable jitter in per-mille * @init_period: chip initial period at reset in ns */ struct inv_sensors_timestamp_chip { uint32_t clock_period; uint32_t jitter; uint32_t init_period; }; /** * struct inv_sensors_timestamp_interval - timestamps interval * @lo: interval lower bound * @up: interval upper bound */ struct inv_sensors_timestamp_interval { int64_t lo; int64_t up; }; /** * struct inv_sensors_timestamp_acc - accumulator for computing an estimation * @val: current estimation of the value, the mean of all values * @idx: current index of the next free place in values table * @values: table of all measured values, use for computing the mean */ struct inv_sensors_timestamp_acc { uint32_t val; size_t idx; uint32_t values[32]; }; /** * struct inv_sensors_timestamp - timestamp management states * @chip: chip internal characteristics * @min_period: minimal acceptable clock period * @max_period: maximal acceptable clock period * @it: interrupts interval timestamps * @timestamp: store last timestamp for computing next data timestamp * @mult: current internal period multiplier * @new_mult: new set internal period multiplier (not yet effective) * @period: measured current period of the sensor * @chip_period: accumulator for computing internal chip period */ struct inv_sensors_timestamp { struct inv_sensors_timestamp_chip chip; uint32_t min_period; uint32_t max_period; struct inv_sensors_timestamp_interval it; int64_t timestamp; uint32_t mult; uint32_t new_mult; uint32_t period; struct inv_sensors_timestamp_acc chip_period; }; void inv_sensors_timestamp_init(struct inv_sensors_timestamp *ts, const struct inv_sensors_timestamp_chip *chip); int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts, uint32_t period, bool fifo); void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts, uint32_t fifo_period, size_t fifo_nb, size_t sensor_nb, int64_t timestamp); static inline int64_t inv_sensors_timestamp_pop(struct inv_sensors_timestamp *ts) { ts->timestamp += ts->period; return ts->timestamp; } void inv_sensors_timestamp_apply_odr(struct inv_sensors_timestamp *ts, uint32_t fifo_period, size_t fifo_nb, unsigned int fifo_no); static inline void inv_sensors_timestamp_reset(struct inv_sensors_timestamp *ts) { const struct inv_sensors_timestamp_interval interval_init = {0LL, 0LL}; ts->it = interval_init; ts->timestamp = 0; } #endif