blob: afb294eeaf5a02bdfc3e51444a4abee633435720 [file] [log] [blame]
LameMonster82314cbd52020-06-04 13:31:12 +02001/*
2** =========================================================================
3** File:
4** tspdrv.h
5**
6** Description:
7** Constants and type definitions for the TouchSense Kernel Module.
8**
9** Portions Copyright (c) 2008-2017 Immersion Corporation. All Rights Reserved.
10**
11** This file contains Original Code and/or Modifications of Original Code
12** as defined in and that are subject to the GNU Public License v2 -
13** (the 'License'). You may not use this file except in compliance with the
14** License. You should have received a copy of the GNU General Public License
15** along with this program; if not, write to the Free Software Foundation, Inc.,
16** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or contact
17** TouchSenseSales@immersion.com.
18**
19** The Original Code and all software distributed under the License are
20** distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
21** EXPRESS OR IMPLIED, AND IMMERSION HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22** INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
23** FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see
24** the License for the specific language governing rights and limitations
25** under the License.
26** =========================================================================
27*/
28
29#ifndef _TSPDRV_H
30#define _TSPDRV_H
31
32/* Constants */
33#define MODULE_NAME "tspdrv"
34#define TSPDRV "/dev/tspdrv"
35#define TSPDRV_MAGIC_NUMBER 0x494D4D52
36#define TSPDRV_IOCTL_GROUP 0x52
37#define TSPDRV_STOP_KERNEL_TIMER _IO(TSPDRV_IOCTL_GROUP, 1) /* obsolete, may be removed in future */
38#define TSPDRV_SET_MAGIC_NUMBER _IO(TSPDRV_IOCTL_GROUP, 2)
39#define TSPDRV_ENABLE_AMP _IO(TSPDRV_IOCTL_GROUP, 3)
40#define TSPDRV_DISABLE_AMP _IO(TSPDRV_IOCTL_GROUP, 4)
41#define TSPDRV_GET_NUM_ACTUATORS _IO(TSPDRV_IOCTL_GROUP, 5)
42#define TSPDRV_SET_DEVICE_PARAMETER _IO(TSPDRV_IOCTL_GROUP, 6)
43#define TSPDRV_SET_DBG_LEVEL _IO(TSPDRV_IOCTL_GROUP, 7)
44#define TSPDRV_GET_DBG_LEVEL _IO(TSPDRV_IOCTL_GROUP, 8)
45#define TSPDRV_SET_RUNTIME_RECORD_FLAG _IO(TSPDRV_IOCTL_GROUP, 9)
46#define TSPDRV_GET_RUNTIME_RECORD_FLAG _IO(TSPDRV_IOCTL_GROUP, 10)
47#define TSPDRV_SET_RUNTIME_RECORD_BUF_SIZE _IO(TSPDRV_IOCTL_GROUP, 11)
48#define TSPDRV_GET_RUNTIME_RECORD_BUF_SIZE _IO(TSPDRV_IOCTL_GROUP, 12)
49#define TSPDRV_GET_PARAM_FILE_ID _IO(TSPDRV_IOCTL_GROUP, 13)
50#define TSPDRV_GET_DEVICE_STATUS _IO(TSPDRV_IOCTL_GROUP, 14)
51/*
52** Frequency constant parameters to control force output values and signals.
53*/
54#define VIBE_KP_CFG_FREQUENCY_PARAM1 85
55#define VIBE_KP_CFG_FREQUENCY_PARAM2 86
56#define VIBE_KP_CFG_FREQUENCY_PARAM3 87
57#define VIBE_KP_CFG_FREQUENCY_PARAM4 88
58#define VIBE_KP_CFG_FREQUENCY_PARAM5 89
59#define VIBE_KP_CFG_FREQUENCY_PARAM6 90
60
61/*
62** Force update rate in milliseconds.
63*/
64#define VIBE_KP_CFG_UPDATE_RATE_MS 95
65
66#define VIBE_MAX_DEVICE_NAME_LENGTH 64
67#define SPI_HEADER_SIZE 3 /* DO NOT CHANGE - SPI buffer header size */
68#define VIBE_OUTPUT_SAMPLE_SIZE 50 /* DO NOT CHANGE - maximum number of samples */
69#define MAX_DEBUG_BUFFER_LENGTH 1024
70
71typedef int8_t VibeInt8;
72typedef u_int8_t VibeUInt8;
73typedef int16_t VibeInt16;
74typedef u_int16_t VibeUInt16;
75typedef int32_t VibeInt32;
76typedef u_int32_t VibeUInt32;
77typedef u_int8_t VibeBool;
78typedef VibeInt32 VibeStatus;
79
80/* Device parameters sent to the kernel module, tspdrv.ko */
81typedef struct
82{
83 VibeInt32 nDeviceIndex;
84 VibeInt32 nDeviceParamID;
85 VibeInt32 nDeviceParamValue;
86} device_parameter;
87
88typedef struct
89{
90 VibeUInt8 nActuatorIndex; /* 1st byte is actuator index */
91 VibeUInt8 nBitDepth; /* 2nd byte is bit depth */
92 VibeUInt8 nBufferSize; /* 3rd byte is data size */
93 VibeUInt8 dataBuffer[40];
94} actuator_samples_buffer;
95
96/* Error and Return value codes */
97#define VIBE_S_SUCCESS 0 /* Success */
98#define VIBE_E_FAIL -4 /* Generic error */
99
100#endif /* _TSPDRV_H */