Add basic support for mini2440 board to barebox.
[barebox-mini2440.git] / include / fb.h
blob379f931e9cc356ba7557de64b20eef9d699e94b0
1 #ifndef __FB_H
2 #define __FB_H
4 #include <ioctl.h>
5 #include <param.h>
7 #define FB_VISUAL_TRUECOLOR 2 /* True color */
8 #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
9 #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
10 #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
12 #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
13 #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
14 #define FB_SYNC_EXT 4 /* external sync */
15 #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
16 #define FB_SYNC_BROADCAST 16 /* broadcast video timings */
17 /* vtotal = 144d/288n/576i => PAL */
18 /* vtotal = 121d/242n/484i => NTSC */
19 #define FB_SYNC_ON_GREEN 32 /* sync on green */
21 #define FB_VMODE_NONINTERLACED 0 /* non interlaced */
22 #define FB_VMODE_INTERLACED 1 /* interlaced */
23 #define FB_VMODE_DOUBLE 2 /* double scan */
24 #define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */
25 #define FB_VMODE_MASK 255
27 #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */
28 #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
29 #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
31 #define PICOS2KHZ(a) (1000000000UL/(a))
32 #define KHZ2PICOS(a) (1000000000UL/(a))
34 struct fb_videomode {
35 const char *name; /* optional */
36 u32 refresh; /* optional */
37 u32 xres;
38 u32 yres;
39 u32 pixclock;
40 u32 left_margin;
41 u32 right_margin;
42 u32 upper_margin;
43 u32 lower_margin;
44 u32 hsync_len;
45 u32 vsync_len;
46 u32 sync;
47 u32 vmode;
48 u32 flag;
51 /* Interpretation of offset for color fields: All offsets are from the right,
52 * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
53 * can use the offset as right argument to <<). A pixel afterwards is a bit
54 * stream and is written to video memory as that unmodified.
56 * For pseudocolor: offset and length should be the same for all color
57 * components. Offset specifies the position of the least significant bit
58 * of the pallette index in a pixel value. Length indicates the number
59 * of available palette entries (i.e. # of entries = 1 << length).
61 struct fb_bitfield {
62 u32 offset; /* beginning of bitfield */
63 u32 length; /* length of bitfield */
64 u32 msb_right; /* != 0 : Most significant bit is */
65 /* right */
68 struct fb_info;
70 struct fb_ops {
71 /* set color register */
72 int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
73 unsigned blue, unsigned transp, struct fb_info *info);
74 void (*fb_enable)(struct fb_info *info);
75 void (*fb_disable)(struct fb_info *info);
78 struct fb_info {
79 struct fb_videomode *mode;
81 struct fb_ops *fbops;
82 struct device_d dev; /* This is this fb device */
84 void *screen_base;
86 void *priv;
88 struct cdev cdev;
90 u32 xres; /* visible resolution */
91 u32 yres;
92 u32 bits_per_pixel; /* guess what */
94 u32 grayscale; /* != 0 Graylevels instead of colors */
96 struct fb_bitfield red; /* bitfield in fb mem if true color, */
97 struct fb_bitfield green; /* else only length is significant */
98 struct fb_bitfield blue;
99 struct fb_bitfield transp; /* transparency */
101 int enabled;
104 int register_framebuffer(struct fb_info *info);
106 #define FBIOGET_SCREENINFO _IOR('F', 1, loff_t)
107 #define FBIO_ENABLE _IO('F', 2)
108 #define FBIO_DISABLE _IO('F', 3)
110 #endif /* __FB_H */