xref: /linux-6.15/include/linux/consolemap.h (revision d9ebb906)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * consolemap.h
4  *
5  * Interface between console.c, selection.c  and consolemap.c
6  */
7 #ifndef __LINUX_CONSOLEMAP_H__
8 #define __LINUX_CONSOLEMAP_H__
9 
10 #define LAT1_MAP 0
11 #define GRAF_MAP 1
12 #define IBMPC_MAP 2
13 #define USER_MAP 3
14 
15 #include <linux/types.h>
16 
17 struct vc_data;
18 
19 #ifdef CONFIG_CONSOLE_TRANSLATIONS
20 u16 inverse_translate(const struct vc_data *conp, u16 glyph, bool use_unicode);
21 unsigned short *set_translate(int m, struct vc_data *vc);
22 int conv_uni_to_pc(struct vc_data *conp, long ucs);
23 u32 conv_8bit_to_uni(unsigned char c);
24 int conv_uni_to_8bit(u32 uni);
25 void console_map_init(void);
26 #else
27 static inline u16 inverse_translate(const struct vc_data *conp, u16 glyph,
28 		bool use_unicode)
29 {
30 	return glyph;
31 }
32 
33 static inline unsigned short *set_translate(int m, struct vc_data *vc)
34 {
35 	return NULL;
36 }
37 
38 static inline int conv_uni_to_pc(struct vc_data *conp, long ucs)
39 {
40 	return ucs > 0xff ? -1 : ucs;
41 }
42 
43 static inline u32 conv_8bit_to_uni(unsigned char c)
44 {
45 	return c;
46 }
47 
48 static inline int conv_uni_to_8bit(u32 uni)
49 {
50 	return uni & 0xff;
51 }
52 
53 static inline void console_map_init(void) { }
54 #endif /* CONFIG_CONSOLE_TRANSLATIONS */
55 
56 #endif /* __LINUX_CONSOLEMAP_H__ */
57