From 4583da1ad81b59b2a8cd2ae51c32b1bc8d32f1c4 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 15 Jun 2010 19:40:34 +0200 Subject: refactor: Generate code for ABS_MT mapping Use the kernel-provided list MT_SLOT_ABS_EVENTS to generate code mappings between ABS_MT space and MT space. This patch adds the program mapgen that does the mapping, and adds two include files generated with it. Signed-off-by: Henrik Rydberg --- include/abs2mt.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/abs2mt.h (limited to 'include/abs2mt.h') diff --git a/include/abs2mt.h b/include/abs2mt.h new file mode 100644 index 0000000..6021d8d --- /dev/null +++ b/include/abs2mt.h @@ -0,0 +1,39 @@ +/* generated by mapgen - do not edit */ + +#ifndef ABS2MT_H +#define ABS2MT_H + +#include "common.h" + +static const unsigned int map_abs2mt[ABS_CNT] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0x0009, 0x000a, 0x000b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; + +static const unsigned int map_mt2abs[MT_ABS_SIZE] = { + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, +}; + +static inline int has_abs2mt(unsigned int code) +{ + return map_abs2mt[code]; +} + +static inline unsigned int abs2mt(unsigned int code) +{ + return map_abs2mt[code] - 1; +} + +static inline unsigned int mt2abs(unsigned int mtcode) +{ + return map_mt2abs[mtcode]; +} + +#endif -- cgit v1.2.3