blob: 4b86b28cb7c44547d161551570190dc85c67b4c6 [file] [log] [blame]
Colin Cross07a58322022-02-08 19:45:27 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_COUNTER_H_
20#define _UAPI_COUNTER_H_
21#include <linux/ioctl.h>
22#include <linux/types.h>
23enum counter_component_type {
24 COUNTER_COMPONENT_NONE,
25 COUNTER_COMPONENT_SIGNAL,
26 COUNTER_COMPONENT_COUNT,
27 COUNTER_COMPONENT_FUNCTION,
28 COUNTER_COMPONENT_SYNAPSE_ACTION,
29 COUNTER_COMPONENT_EXTENSION,
30};
31enum counter_scope {
32 COUNTER_SCOPE_DEVICE,
33 COUNTER_SCOPE_SIGNAL,
34 COUNTER_SCOPE_COUNT,
35};
36struct counter_component {
37 __u8 type;
38 __u8 scope;
39 __u8 parent;
40 __u8 id;
41};
42enum counter_event_type {
43 COUNTER_EVENT_OVERFLOW,
44 COUNTER_EVENT_UNDERFLOW,
45 COUNTER_EVENT_OVERFLOW_UNDERFLOW,
46 COUNTER_EVENT_THRESHOLD,
47 COUNTER_EVENT_INDEX,
Jordan Demeulenaere2d505822022-08-11 17:20:14 +020048 COUNTER_EVENT_CHANGE_OF_STATE,
Colin Cross07a58322022-02-08 19:45:27 -080049};
50struct counter_watch {
51 struct counter_component component;
52 __u8 event;
53 __u8 channel;
54};
55#define COUNTER_ADD_WATCH_IOCTL _IOW(0x3E, 0x00, struct counter_watch)
56#define COUNTER_ENABLE_EVENTS_IOCTL _IO(0x3E, 0x01)
57#define COUNTER_DISABLE_EVENTS_IOCTL _IO(0x3E, 0x02)
58struct counter_event {
59 __aligned_u64 timestamp;
60 __aligned_u64 value;
61 struct counter_watch watch;
62 __u8 status;
63};
64enum counter_count_direction {
65 COUNTER_COUNT_DIRECTION_FORWARD,
66 COUNTER_COUNT_DIRECTION_BACKWARD,
67};
68enum counter_count_mode {
69 COUNTER_COUNT_MODE_NORMAL,
70 COUNTER_COUNT_MODE_RANGE_LIMIT,
71 COUNTER_COUNT_MODE_NON_RECYCLE,
72 COUNTER_COUNT_MODE_MODULO_N,
73};
74enum counter_function {
75 COUNTER_FUNCTION_INCREASE,
76 COUNTER_FUNCTION_DECREASE,
77 COUNTER_FUNCTION_PULSE_DIRECTION,
78 COUNTER_FUNCTION_QUADRATURE_X1_A,
79 COUNTER_FUNCTION_QUADRATURE_X1_B,
80 COUNTER_FUNCTION_QUADRATURE_X2_A,
81 COUNTER_FUNCTION_QUADRATURE_X2_B,
82 COUNTER_FUNCTION_QUADRATURE_X4,
83};
84enum counter_signal_level {
85 COUNTER_SIGNAL_LEVEL_LOW,
86 COUNTER_SIGNAL_LEVEL_HIGH,
87};
88enum counter_synapse_action {
89 COUNTER_SYNAPSE_ACTION_NONE,
90 COUNTER_SYNAPSE_ACTION_RISING_EDGE,
91 COUNTER_SYNAPSE_ACTION_FALLING_EDGE,
92 COUNTER_SYNAPSE_ACTION_BOTH_EDGES,
93};
94#endif