linux/audit.h: move ptrace.h include to kernel header
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / video / bt455.h
blob80f61b03e9ae1cb6cad5d5b6fb7afac6f88d22b8
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>
13 * Bt455 byte-wide registers, 32-bit aligned.
15 struct bt455_regs {
16 volatile u8 addr_cmap;
17 u8 pad0[3];
18 volatile u8 addr_cmap_data;
19 u8 pad1[3];
20 volatile u8 addr_clr;
21 u8 pad2[3];
22 volatile u8 addr_ovly;
23 u8 pad3[3];
26 static inline void bt455_select_reg(struct bt455_regs *regs, int ir)
28 mb();
29 regs->addr_cmap = ir & 0x0f;
33 * Read/write to a Bt455 color map register.
35 static inline void bt455_read_cmap_entry(struct bt455_regs *regs, int cr,
36 u8* red, u8* green, u8* blue)
38 bt455_select_reg(regs, cr);
39 mb();
40 *red = regs->addr_cmap_data & 0x0f;
41 rmb();
42 *green = regs->addr_cmap_data & 0x0f;
43 rmb();
44 *blue = regs->addr_cmap_data & 0x0f;
47 static inline void bt455_write_cmap_entry(struct bt455_regs *regs, int cr,
48 u8 red, u8 green, u8 blue)
50 bt455_select_reg(regs, cr);
51 wmb();
52 regs->addr_cmap_data = red & 0x0f;
53 wmb();
54 regs->addr_cmap_data = green & 0x0f;
55 wmb();
56 regs->addr_cmap_data = blue & 0x0f;
59 static inline void bt455_write_ovly_entry(struct bt455_regs *regs, int cr,
60 u8 red, u8 green, u8 blue)
62 bt455_select_reg(regs, cr);
63 wmb();
64 regs->addr_ovly = red & 0x0f;
65 wmb();
66 regs->addr_ovly = green & 0x0f;
67 wmb();
68 regs->addr_ovly = blue & 0x0f;
71 static inline void bt455_set_cursor(struct bt455_regs *regs)
73 mb();
74 regs->addr_ovly = 0x0f;
75 wmb();
76 regs->addr_ovly = 0x0f;
77 wmb();
78 regs->addr_ovly = 0x0f;
81 static inline void bt455_erase_cursor(struct bt455_regs *regs)
83 /* bt455_write_cmap_entry(regs, 8, 0x00, 0x00, 0x00); */
84 /* bt455_write_cmap_entry(regs, 9, 0x00, 0x00, 0x00); */
85 bt455_write_ovly_entry(regs, 8, 0x03, 0x03, 0x03);
86 bt455_write_ovly_entry(regs, 9, 0x07, 0x07, 0x07);
88 wmb();
89 regs->addr_ovly = 0x09;
90 wmb();
91 regs->addr_ovly = 0x09;
92 wmb();
93 regs->addr_ovly = 0x09;