This source file includes following definitions.
- bt455_select_reg
- bt455_reset_reg
- bt455_read_cmap_next
- bt455_write_cmap_next
- bt455_write_ovly_next
- bt455_read_cmap_entry
- bt455_write_cmap_entry
- bt455_write_ovly_entry
1
2
3
4
5
6
7
8
9
10
11 #include <linux/types.h>
12
13
14
15
16 struct bt455_regs {
17 volatile u8 addr_cmap;
18 u8 pad0[3];
19 volatile u8 addr_cmap_data;
20 u8 pad1[3];
21 volatile u8 addr_clr;
22 u8 pad2[3];
23 volatile u8 addr_ovly;
24 u8 pad3[3];
25 };
26
27 static inline void bt455_select_reg(struct bt455_regs *regs, int ir)
28 {
29 mb();
30 regs->addr_cmap = ir & 0x0f;
31 }
32
33 static inline void bt455_reset_reg(struct bt455_regs *regs)
34 {
35 mb();
36 regs->addr_clr = 0;
37 }
38
39
40
41
42 static inline void bt455_read_cmap_next(struct bt455_regs *regs, u8 *grey)
43 {
44 mb();
45 regs->addr_cmap_data;
46 rmb();
47 *grey = regs->addr_cmap_data & 0xf;
48 rmb();
49 regs->addr_cmap_data;
50 }
51
52 static inline void bt455_write_cmap_next(struct bt455_regs *regs, u8 grey)
53 {
54 wmb();
55 regs->addr_cmap_data = 0x0;
56 wmb();
57 regs->addr_cmap_data = grey & 0xf;
58 wmb();
59 regs->addr_cmap_data = 0x0;
60 }
61
62 static inline void bt455_write_ovly_next(struct bt455_regs *regs, u8 grey)
63 {
64 wmb();
65 regs->addr_ovly = 0x0;
66 wmb();
67 regs->addr_ovly = grey & 0xf;
68 wmb();
69 regs->addr_ovly = 0x0;
70 }
71
72 static inline void bt455_read_cmap_entry(struct bt455_regs *regs,
73 int cr, u8 *grey)
74 {
75 bt455_select_reg(regs, cr);
76 bt455_read_cmap_next(regs, grey);
77 }
78
79 static inline void bt455_write_cmap_entry(struct bt455_regs *regs,
80 int cr, u8 grey)
81 {
82 bt455_select_reg(regs, cr);
83 bt455_write_cmap_next(regs, grey);
84 }
85
86 static inline void bt455_write_ovly_entry(struct bt455_regs *regs, u8 grey)
87 {
88 bt455_reset_reg(regs);
89 bt455_write_ovly_next(regs, grey);
90 }