-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbtintel_test_userspace.h
More file actions
154 lines (133 loc) · 4.04 KB
/
btintel_test_userspace.h
File metadata and controls
154 lines (133 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Intel Bluetooth Test Generic Driver - Userspace Header
*
* Copyright (C) 2026 Your Company/Name
*
* Userspace-compatible header with ioctl definitions and data structures
*/
#ifndef __BTINTEL_TEST_GENERIC_DRIVER_USERSPACE_H
#define __BTINTEL_TEST_GENERIC_DRIVER_USERSPACE_H
#include <sys/ioctl.h>
#include <stdint.h>
#include <stddef.h>
/* ============================================================================
* CONSTANTS
* ============================================================================ */
/* Device configuration */
#define BTINTEL_TEST_DEFAULT_BUFFER_SIZE 4096
#define BTINTEL_TEST_MAX_BUFFER_SIZE (16 * 1024 * 1024) /* 16MB */
/* Version code (major.minor.patch -> 0x010000 = 1.0.0) */
#define BTINTEL_TEST_VERSION_CODE 0x010000
/* Magic number for ioctl - use a unique value (ASCII character) */
#define BTINTEL_TEST_IOC_MAGIC 'B'
/* ============================================================================
* DATA STRUCTURES FOR IOCTL
* ============================================================================ */
/**
* struct btintel_test_dev_info - Device information
* @version: Driver version code
* @buffer_size: Size of internal device buffer
* @active: Device active status
* @refcount: Number of open file descriptors
*/
struct btintel_test_dev_info {
uint32_t version;
size_t buffer_size;
uint8_t active;
uint32_t refcount;
};
/**
* struct btintel_test_stats - Device statistics
* @read_count: Total number of read operations
* @write_count: Total number of write operations
* @ioctl_count: Total number of ioctl operations
* @errors: Total number of errors
*/
struct btintel_test_stats {
uint64_t read_count;
uint64_t write_count;
uint64_t ioctl_count;
uint64_t errors;
};
/**
* struct btintel_test_buffer_data - Buffer size configuration
* @size: New buffer size
* @reserved: Padding for future use
*/
struct btintel_test_buffer_data {
size_t size;
uint64_t reserved;
};
/**
* struct btintel_test_status - Device status
* @state: Device state flags
* @error_code: Last error code
* @reserved: Padding for future use
*/
struct btintel_test_status {
uint32_t state;
uint32_t error_code;
uint64_t reserved;
};
/* ============================================================================
* IOCTL COMMAND DEFINITIONS
* ============================================================================ */
/**
* BTINTEL_TEST_IOC_GET_INFO - Get device information
* Type: Read (IOR)
* Argument: pointer to struct btintel_test_dev_info
*/
#define BTINTEL_TEST_IOC_GET_INFO \
_IOR(BTINTEL_TEST_IOC_MAGIC, 0, struct btintel_test_dev_info)
/**
* BTINTEL_TEST_IOC_GET_STATS - Get device statistics
* Type: Read (IOR)
* Argument: pointer to struct btintel_test_stats
*/
#define BTINTEL_TEST_IOC_GET_STATS \
_IOR(BTINTEL_TEST_IOC_MAGIC, 1, struct btintel_test_stats)
/**
* BTINTEL_TEST_IOC_RESET_STATS - Reset device statistics
* Type: None (IO)
* Argument: none
*/
#define BTINTEL_TEST_IOC_RESET_STATS \
_IO(BTINTEL_TEST_IOC_MAGIC, 2)
/**
* BTINTEL_TEST_IOC_CLEAR_BUFFER - Clear internal device buffer
* Type: None (IO)
* Argument: none
*/
#define BTINTEL_TEST_IOC_CLEAR_BUFFER \
_IO(BTINTEL_TEST_IOC_MAGIC, 3)
/**
* BTINTEL_TEST_IOC_SET_BUFFER_SIZE - Set device buffer size
* Type: Write (IOW)
* Argument: pointer to struct btintel_test_buffer_data
*/
#define BTINTEL_TEST_IOC_SET_BUFFER_SIZE \
_IOW(BTINTEL_TEST_IOC_MAGIC, 4, struct btintel_test_buffer_data)
/**
* BTINTEL_TEST_IOC_GET_STATUS - Get device status
* Type: Read (IOR)
* Argument: pointer to struct btintel_test_status
*/
#define BTINTEL_TEST_IOC_GET_STATUS \
_IOR(BTINTEL_TEST_IOC_MAGIC, 5, struct btintel_test_status)
/**
* BTINTEL_TEST_IOC_ENABLE - Enable device
* Type: None (IO)
* Argument: none
*/
#define BTINTEL_TEST_IOC_ENABLE \
_IO(BTINTEL_TEST_IOC_MAGIC, 6)
/**
* BTINTEL_TEST_IOC_DISABLE - Disable device
* Type: None (IO)
* Argument: none
*/
#define BTINTEL_TEST_IOC_DISABLE \
_IO(BTINTEL_TEST_IOC_MAGIC, 7)
#endif /* __BTINTEL_TEST_GENERIC_DRIVER_USERSPACE_H */