aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/bt455.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/video/bt455.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/video/bt455.h')
-rw-r--r--drivers/video/bt455.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/drivers/video/bt455.h b/drivers/video/bt455.h
new file mode 100644
index 000000000000..b7591fea7add
--- /dev/null
+++ b/drivers/video/bt455.h
@@ -0,0 +1,95 @@
1/*
2 * linux/drivers/video/bt455.h
3 *
4 * Copyright 2003 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
5 *
6 * This file is subject to the terms and conditions of the GNU General
7 * Public License. See the file COPYING in the main directory of this
8 * archive for more details.
9 */
10#include <linux/types.h>
11#include <asm/system.h>
12
13/*
14 * Bt455 byte-wide registers, 32-bit aligned.
15 */
16struct 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
27static inline void bt455_select_reg(struct bt455_regs *regs, int ir)
28{
29 mb();
30 regs->addr_cmap = ir & 0x0f;
31}
32
33/*
34 * Read/write to a Bt455 color map register.
35 */
36static inline void bt455_read_cmap_entry(struct bt455_regs *regs, int cr,
37 u8* red, u8* green, u8* blue)
38{
39 bt455_select_reg(regs, cr);
40 mb();
41 *red = regs->addr_cmap_data & 0x0f;
42 rmb();
43 *green = regs->addr_cmap_data & 0x0f;
44 rmb();
45 *blue = regs->addr_cmap_data & 0x0f;
46}
47
48static inline void bt455_write_cmap_entry(struct bt455_regs *regs, int cr,
49 u8 red, u8 green, u8 blue)
50{
51 bt455_select_reg(regs, cr);
52 wmb();
53 regs->addr_cmap_data = red & 0x0f;
54 wmb();
55 regs->addr_cmap_data = green & 0x0f;
56 wmb();
57 regs->addr_cmap_data = blue & 0x0f;
58}
59
60static inline void bt455_write_ovly_entry(struct bt455_regs *regs, int cr,
61 u8 red, u8 green, u8 blue)
62{
63 bt455_select_reg(regs, cr);
64 wmb();
65 regs->addr_ovly = red & 0x0f;
66 wmb();
67 regs->addr_ovly = green & 0x0f;
68 wmb();
69 regs->addr_ovly = blue & 0x0f;
70}
71
72static inline void bt455_set_cursor(struct bt455_regs *regs)
73{
74 mb();
75 regs->addr_ovly = 0x0f;
76 wmb();
77 regs->addr_ovly = 0x0f;
78 wmb();
79 regs->addr_ovly = 0x0f;
80}
81
82static inline void bt455_erase_cursor(struct bt455_regs *regs)
83{
84 /* bt455_write_cmap_entry(regs, 8, 0x00, 0x00, 0x00); */
85 /* bt455_write_cmap_entry(regs, 9, 0x00, 0x00, 0x00); */
86 bt455_write_ovly_entry(regs, 8, 0x03, 0x03, 0x03);
87 bt455_write_ovly_entry(regs, 9, 0x07, 0x07, 0x07);
88
89 wmb();
90 regs->addr_ovly = 0x09;
91 wmb();
92 regs->addr_ovly = 0x09;
93 wmb();
94 regs->addr_ovly = 0x09;
95}