1 /*
2 ** =============================================================================
3 ** Copyright (c) 2016 Texas Instruments Inc.
4 **
5 ** This program is free software; you can redistribute it and/or modify it under
6 ** the terms of the GNU General Public License as published by the Free Software
7 ** Foundation; version 2.
8 **
9 ** This program is distributed in the hope that it will be useful, but WITHOUT
10 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 ** FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 **
13 ** File:
14 ** tiload.h
15 **
16 ** Description:
17 ** header file for tiload.c
18 **
19 ** =============================================================================
20 */
22 #ifndef _TILOAD_H
23 #define _TILOAD_H
25 #ifdef CONFIG_COMPAT
26 #include <linux/compat.h>
27 #endif
29 #include "tas2557.h"
31 #define BPR_REG(book, page, reg) (((book * 256 * 128) + \
32 (page * 128)) + reg)
34 /* typedefs required for the included header files */
35 struct BPR {
36 unsigned char nBook;
37 unsigned char nPage;
38 unsigned char nRegister;
39 };
41 /* defines */
42 #define DEVICE_NAME "tiload_node"
44 #define TILOAD_IOC_MAGIC 0xE0
45 #define TILOAD_IOMAGICNUM_GET _IOR(TILOAD_IOC_MAGIC, 1, int)
46 #define TILOAD_IOMAGICNUM_SET _IOW(TILOAD_IOC_MAGIC, 2, int)
47 #define TILOAD_BPR_READ _IOR(TILOAD_IOC_MAGIC, 3, struct BPR)
48 #define TILOAD_BPR_WRITE _IOW(TILOAD_IOC_MAGIC, 4, struct BPR)
49 #define TILOAD_IOCTL_SET_CHL _IOW(TILOAD_IOC_MAGIC, 5, int)
50 #define TILOAD_IOCTL_SET_CONFIG _IOW(TILOAD_IOC_MAGIC, 6, int)
51 #define TILOAD_IOCTL_SET_CALIBRATION _IOW(TILOAD_IOC_MAGIC, 7, int)
53 #ifdef CONFIG_COMPAT
54 #define TILOAD_COMPAT_IOMAGICNUM_GET _IOR(TILOAD_IOC_MAGIC, 1, compat_int_t)
55 #define TILOAD_COMPAT_IOMAGICNUM_SET _IOW(TILOAD_IOC_MAGIC, 2, compat_int_t)
56 #define TILOAD_COMPAT_BPR_READ _IOR(TILOAD_IOC_MAGIC, 3, struct BPR)
57 #define TILOAD_COMPAT_BPR_WRITE _IOW(TILOAD_IOC_MAGIC, 4, struct BPR)
58 #define TILOAD_COMPAT_IOCTL_SET_CHL _IOW(TILOAD_IOC_MAGIC, 5, compat_int_t)
59 #define TILOAD_COMPAT_IOCTL_SET_CONFIG _IOW(TILOAD_IOC_MAGIC, 6, compat_int_t)
60 #define TILOAD_COMPAT_IOCTL_SET_CALIBRATION _IOW(TILOAD_IOC_MAGIC, 7, compat_int_t)
61 #endif
63 int tiload_driver_init(struct tas2557_priv *pTAS2557);
65 #endif