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
|
#ifndef __MTK_IR_COMMON_H__
#define __MTK_IR_COMMON_H__
#include "mtk_ir_cus_define.h"
#ifdef __KERNEL__
#include <linux/ioctl.h>
#include <linux/kernel.h>
#else
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#endif
struct mtk_ir_msg {
u32 scancode; /* rc scan code */
u32 keycode; /* linux input code */
/* u32 rep; // repeat times ,driver not care repeat status to userspace */
};
#if MTK_IRRX_AS_MOUSE_INPUT
struct mtk_ir_mouse_code {
u32 scanleft;
u32 scanright;
u32 scanup;
u32 scandown;
u32 scanenter;
u32 scanswitch;
};
typedef enum {
MTK_IR_AS_IRRX = 0,
MTK_IR_AS_MOUSE,
} MTK_IR_DEVICE_MODE;
#endif
typedef enum {
MTK_IR_FACTORY = 0,
MTK_IR_NORMAL,
MTK_IR_MAX,
} MTK_IR_MODE;
#define BTN_NONE 0XFFFFFFFF
#define BTN_INVALID_KEY -1
#define MTK_IR_CHUNK_SIZE sizeof(struct mtk_ir_msg)
#define MTK_IR_DEVICE_NODE 1 /* whther has mtk_ir_dev.c */
#ifdef __KERNEL__
#define IRRX_TAG "[irrx_kernel]"
extern int ir_log_debug_on;
extern void mtk_ir_core_log_always(const char *fmt, ...);
#define IR_W_REGS_LOG(fmt, arg...) \
do { \
if (ir_log_debug_on) printk(IRRX_TAG"%s, line(%d)\n"fmt, __func__, __LINE__, ##arg); \
} while (0)
#define IR_LOG_DEBUG(fmt, arg...) \
do { \
if (ir_log_debug_on) mtk_ir_core_log_always(IRRX_TAG"%s, line(%d)\n"fmt, __func__, __LINE__, ##arg); \
} while (0)
#define IR_LOG_DEBUG_TO_KERNEL(fmt, arg...) \
do { \
if (ir_log_debug_on) printk(IRRX_TAG"%s, line(%d)\n"fmt, __func__, __LINE__, ##arg); \
} while (0)
#if 1
#define IR_LOG_ALWAYS(fmt, arg...) \
do { \
printk(IRRX_TAG"%s, line(%d)\n"fmt, __func__, __LINE__, ##arg); \
} while (0)
#endif
#if 1
#define IR_LOG_KEY(fmt, arg...) \
do { \
mtk_ir_core_log_always(""fmt, ##arg);\
} while (0)
#endif
#define IR_LOG_TO_KERNEL(fmt, arg...) \
do { \
printk(IRRX_TAG"%s, line =%d\n"fmt, __func__, __LINE__, ##arg); \
} while (0)
extern void AssertIR(const char *szExpress, const char *szFile, int i4Line);
#undef ASSERT
#define ASSERT(x) ((x) ? (void)0 : AssertIR(#x, __FILE__, __LINE__))
#else /* usr space use */
#define IRRX_TAG "[irrx_usr]"
#define IR_LOG_ALWAYS(fmt, arg...) \
printf(IRRX_TAG"%s,line(%d)\n"fmt, __func__, __LINE__, ##arg)
extern void Assert(const char *szExpress, const char *szFile, int i4Line);
#define ASSERT(x) ((x) ? (void)0 : Assert(#x, __FILE__, __LINE__))
#endif
#endif
|