aboutsummaryrefslogtreecommitdiff
path: root/include/odp/api/spec/timer.h
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2021-02-22 13:21:18 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2021-06-22 15:09:54 +0300
commit1797987cbada325bc7141cd225fa760cc5c11bae (patch)
tree01d24d0d76d26f4af06aaee64afa2cb2236e8620 /include/odp/api/spec/timer.h
parent9d370488150482a1965692e5c88d6a357c28c294 (diff)
api: timer: add tick info
Added timer tick info as part of odp_timer_pool_info_t. This allows timer implementation to specify very accurately tick frequency and duration. Some applications need high accuracy to calculate timeout periods (in timer ticks) that do not drift against the timer source clock time. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Diffstat (limited to 'include/odp/api/spec/timer.h')
-rw-r--r--include/odp/api/spec/timer.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index a90fb9b07..319f5e029 100644
--- a/include/odp/api/spec/timer.h
+++ b/include/odp/api/spec/timer.h
@@ -375,6 +375,54 @@ uint64_t odp_timer_ns_to_tick(odp_timer_pool_t timer_pool, uint64_t ns);
uint64_t odp_timer_current_tick(odp_timer_pool_t timer_pool);
/**
+ * Timer tick information
+ */
+typedef struct odp_timer_tick_info_t {
+ /**
+ * Timer tick frequency in hertz
+ *
+ * Timer tick frequency expressed as a fractional number. The integer part contains
+ * full hertz. The fraction part (numerator / denominator) contains parts of
+ * a hertz to be added with the integer.
+ *
+ * For example, a timer tick frequency of 333 333 and 1/3 Hz could be presented with
+ * these values: integer = 333 333, numer = 1, denom = 3. Implementation may choose numer
+ * and denom values freely.
+ */
+ odp_fract_u64_t freq;
+
+ /**
+ * One timer tick in nanoseconds
+ *
+ * Nanoseconds per tick is expressed as a fractional number. The integer part contains
+ * full nanoseconds. The fraction part (numerator / denominator) contains parts of
+ * a nanosecond to be added with the integer.
+ *
+ * For example, a timer tick period of 3.125 nanoseconds (320MHz) could be presented with
+ * these values: integer = 3, numer = 125 000 000, denom = 1 000 000 000. Implementation
+ * may choose numer and denom values freely.
+ */
+ odp_fract_u64_t nsec;
+
+ /**
+ * One timer tick in source clock cycles
+ *
+ * The clock cycle count is expressed as a fractional number. The integer part contains
+ * full clock cycles. The fraction part (numerator / denominator) contains parts of
+ * a clock cycle to be added with the integer.
+ *
+ * For example, a timer tick period of 42 and 1/3 source clock cycles could be presented
+ * with these values: integer = 42, numer = 1, denom = 3. Implementation may choose numer
+ * and denom values freely.
+ *
+ * The value is zero, when there is no direct connection between tick and the source
+ * clock signal.
+ */
+ odp_fract_u64_t clk_cycle;
+
+} odp_timer_tick_info_t;
+
+/**
* ODP timer pool information and configuration
*/
typedef struct {
@@ -390,6 +438,9 @@ typedef struct {
/** Name of timer pool */
const char *name;
+ /** Timer pool tick information */
+ odp_timer_tick_info_t tick_info;
+
} odp_timer_pool_info_t;
/**