1 /*
2 * This header was generated from the Linux kernel headers by update_headers.py,
3 * to provide necessary information from kernel to userspace, such as constants,
4 * structures, and macros, and thus, contains no copyrightable information.
5 */
6 #ifndef MAP_TO_7SEGMENT_H
7 #define MAP_TO_7SEGMENT_H
8 #include <linux/errno.h>
9 #define BIT_SEG7_A 0
10 #define BIT_SEG7_B 1
11 #define BIT_SEG7_C 2
12 #define BIT_SEG7_D 3
13 #define BIT_SEG7_E 4
14 #define BIT_SEG7_F 5
15 #define BIT_SEG7_G 6
16 #define BIT_SEG7_RESERVED 7
17 struct seg7_conversion_map {
18 unsigned char table[128];
19 };
map_to_seg7(struct seg7_conversion_map * map,int c)20 static __inline__ int map_to_seg7(struct seg7_conversion_map *map, int c)
21 {
22 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL;
23 }
24 #define SEG7_CONVERSION_MAP(_name, _map) \
25 struct seg7_conversion_map _name = { .table = { _map } }
26 #define MAP_TO_SEG7_SYSFS_FILE "map_seg7"
27 #define _SEG7(l,a,b,c,d,e,f,g) \
28 ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \
29 e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G )
30 #define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
31 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
32 #define _MAP_33_47_ASCII_SEG7_SYMBOL \
33 _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\
34 _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\
35 _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\
36 _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\
37 _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1),
38 #define _MAP_48_57_ASCII_SEG7_NUMERIC \
39 _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\
40 _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\
41 _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\
42 _SEG7('9',1,1,1,1,0,1,1),
43 #define _MAP_58_64_ASCII_SEG7_SYMBOL \
44 _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\
45 _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\
46 _SEG7('@',1,1,0,1,1,1,1),
47 #define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
48 _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\
49 _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
50 _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\
51 _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
52 _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\
53 _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\
54 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\
55 _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
56 _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
57 #define _MAP_91_96_ASCII_SEG7_SYMBOL \
58 _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\
59 _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0),
60 #define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
61 _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\
62 _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
63 _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\
64 _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
65 _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\
66 _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\
67 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\
68 _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
69 _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
70 #define _MAP_123_126_ASCII_SEG7_SYMBOL \
71 _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\
72 _SEG7('~',1,0,0,0,0,0,0),
73 #define MAP_ASCII7SEG_ALPHANUM \
74 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
75 _MAP_33_47_ASCII_SEG7_SYMBOL \
76 _MAP_48_57_ASCII_SEG7_NUMERIC \
77 _MAP_58_64_ASCII_SEG7_SYMBOL \
78 _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
79 _MAP_91_96_ASCII_SEG7_SYMBOL \
80 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
81 _MAP_123_126_ASCII_SEG7_SYMBOL
82 #define MAP_ASCII7SEG_ALPHANUM_LC \
83 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
84 _MAP_33_47_ASCII_SEG7_SYMBOL \
85 _MAP_48_57_ASCII_SEG7_NUMERIC \
86 _MAP_58_64_ASCII_SEG7_SYMBOL \
87 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
88 _MAP_91_96_ASCII_SEG7_SYMBOL \
89 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
90 _MAP_123_126_ASCII_SEG7_SYMBOL
91 #define SEG7_DEFAULT_MAP(_name) \
92 SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM)
93 #endif
94