blob: 5d6f01f8f5d2d4b82a25a2ad42366f7770ee48f9 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferrisa4792612022-01-10 13:51:15 -08007#ifndef _UAPI_COUNTER_H_
8#define _UAPI_COUNTER_H_
9#include <linux/ioctl.h>
10#include <linux/types.h>
11enum counter_component_type {
12 COUNTER_COMPONENT_NONE,
13 COUNTER_COMPONENT_SIGNAL,
14 COUNTER_COMPONENT_COUNT,
15 COUNTER_COMPONENT_FUNCTION,
16 COUNTER_COMPONENT_SYNAPSE_ACTION,
17 COUNTER_COMPONENT_EXTENSION,
18};
19enum counter_scope {
20 COUNTER_SCOPE_DEVICE,
21 COUNTER_SCOPE_SIGNAL,
22 COUNTER_SCOPE_COUNT,
23};
24struct counter_component {
25 __u8 type;
26 __u8 scope;
27 __u8 parent;
28 __u8 id;
29};
30enum counter_event_type {
31 COUNTER_EVENT_OVERFLOW,
32 COUNTER_EVENT_UNDERFLOW,
33 COUNTER_EVENT_OVERFLOW_UNDERFLOW,
34 COUNTER_EVENT_THRESHOLD,
35 COUNTER_EVENT_INDEX,
Christopher Ferris10a76e62022-06-08 13:31:52 -070036 COUNTER_EVENT_CHANGE_OF_STATE,
Christopher Ferris6cd53a52022-12-12 23:39:16 +000037 COUNTER_EVENT_CAPTURE,
Christopher Ferrisa4792612022-01-10 13:51:15 -080038};
39struct counter_watch {
40 struct counter_component component;
41 __u8 event;
42 __u8 channel;
43};
44#define COUNTER_ADD_WATCH_IOCTL _IOW(0x3E, 0x00, struct counter_watch)
45#define COUNTER_ENABLE_EVENTS_IOCTL _IO(0x3E, 0x01)
46#define COUNTER_DISABLE_EVENTS_IOCTL _IO(0x3E, 0x02)
47struct counter_event {
48 __aligned_u64 timestamp;
49 __aligned_u64 value;
50 struct counter_watch watch;
51 __u8 status;
52};
53enum counter_count_direction {
54 COUNTER_COUNT_DIRECTION_FORWARD,
55 COUNTER_COUNT_DIRECTION_BACKWARD,
56};
57enum counter_count_mode {
58 COUNTER_COUNT_MODE_NORMAL,
59 COUNTER_COUNT_MODE_RANGE_LIMIT,
60 COUNTER_COUNT_MODE_NON_RECYCLE,
61 COUNTER_COUNT_MODE_MODULO_N,
Christopher Ferris8666d042023-09-06 14:55:31 -070062 COUNTER_COUNT_MODE_INTERRUPT_ON_TERMINAL_COUNT,
63 COUNTER_COUNT_MODE_HARDWARE_RETRIGGERABLE_ONESHOT,
64 COUNTER_COUNT_MODE_RATE_GENERATOR,
65 COUNTER_COUNT_MODE_SQUARE_WAVE_MODE,
66 COUNTER_COUNT_MODE_SOFTWARE_TRIGGERED_STROBE,
67 COUNTER_COUNT_MODE_HARDWARE_TRIGGERED_STROBE,
Christopher Ferrisa4792612022-01-10 13:51:15 -080068};
69enum counter_function {
70 COUNTER_FUNCTION_INCREASE,
71 COUNTER_FUNCTION_DECREASE,
72 COUNTER_FUNCTION_PULSE_DIRECTION,
73 COUNTER_FUNCTION_QUADRATURE_X1_A,
74 COUNTER_FUNCTION_QUADRATURE_X1_B,
75 COUNTER_FUNCTION_QUADRATURE_X2_A,
76 COUNTER_FUNCTION_QUADRATURE_X2_B,
77 COUNTER_FUNCTION_QUADRATURE_X4,
78};
79enum counter_signal_level {
80 COUNTER_SIGNAL_LEVEL_LOW,
81 COUNTER_SIGNAL_LEVEL_HIGH,
82};
83enum counter_synapse_action {
84 COUNTER_SYNAPSE_ACTION_NONE,
85 COUNTER_SYNAPSE_ACTION_RISING_EDGE,
86 COUNTER_SYNAPSE_ACTION_FALLING_EDGE,
87 COUNTER_SYNAPSE_ACTION_BOTH_EDGES,
88};
Christopher Ferris6cd53a52022-12-12 23:39:16 +000089enum counter_signal_polarity {
90 COUNTER_SIGNAL_POLARITY_POSITIVE,
91 COUNTER_SIGNAL_POLARITY_NEGATIVE,
92};
Christopher Ferrisa4792612022-01-10 13:51:15 -080093#endif