Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / video / bt455.h
blobb7591fea7add36aeb73ee5623002cf50f4433582
1 /*
2 * linux/drivers/video/bt455.h
4 * Copyright 2003 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
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>
14 * Bt455 byte-wide registers, 32-bit aligned.
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];
27 static inline void bt455_select_reg(struct bt455_regs *regs, int ir)
29 mb();
30 regs->addr_cmap = ir & 0x0f;
34 * Read/write to a Bt455 color map register.
36 static inline void bt455_read_cmap_entry(struct bt455_regs *regs, int cr,
37 u8* red, u8* green, u8* blue)
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;
48 static inline void bt455_write_cmap_entry(struct bt455_regs *regs, int cr,
49 u8 red, u8 green, u8 blue)
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;
60 static inline void bt455_write_ovly_entry(struct bt455_regs *regs, int cr,
61 u8 red, u8 green, u8 blue)
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;
72 static inline void bt455_set_cursor(struct bt455_regs *regs)
74 mb();
75 regs->addr_ovly = 0x0f;
76 wmb();
77 regs->addr_ovly = 0x0f;
78 wmb();
79 regs->addr_ovly = 0x0f;
82 static inline void bt455_erase_cursor(struct bt455_regs *regs)
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);
89 wmb();
90 regs->addr_ovly = 0x09;
91 wmb();
92 regs->addr_ovly = 0x09;
93 wmb();
94 regs->addr_ovly = 0x09;