1 /* $NetBSD: w100var.h,v 1.1 2012/01/29 10:12:42 tsutsui Exp $ */
2 
3 #ifndef _ZAURUS_DEV_W100VAR_H_
4 #define _ZAURUS_DEV_W100VAR_H_
5 
6 #include <dev/rasops/rasops.h>
7 #include <sys/bus.h>
8 
9 struct w100_screen {
10           LIST_ENTRY(w100_screen) link;
11 
12           /* Frame buffer */
13           void      *buf_va;
14           int     depth;
15 
16           /* rasterop */
17           struct rasops_info rinfo;
18 };
19 
20 struct w100_softc {
21           device_t  dev;
22           /* control register */
23           bus_space_tag_t     iot;
24           bus_space_handle_t  ioh_cfg; /* config */
25           bus_space_handle_t  ioh_reg; /* register */
26           bus_space_handle_t      ioh_vram; /* video memory */
27 
28           const struct w100_panel_geometry *geometry;
29 
30           short display_width;
31           short display_height;
32 
33           int n_screens;
34           LIST_HEAD(, w100_screen) screens;
35           struct w100_screen *active;
36 };
37 
38 struct w100_panel_geometry {
39           short panel_width;
40           short panel_height;
41 
42           short rotate;
43 #define W100_PANEL_ROTATE_CW  1         /* quarter clockwise */
44 #define W100_PANEL_ROTATE_CCW 2         /* quarter counter-clockwise */
45 #define W100_PANEL_ROTATE_UD  3         /* upside-down */
46 };
47 
48 struct w100_wsscreen_descr {
49           struct wsscreen_descr  c;     /* standard descriptor */
50           int depth;                              /* bits per pixel */
51           int flags;                              /* rasops flags */
52 };
53 
54 #define W100_CFG_OFFSET     (0x00000000)
55 #define W100_REG_OFFSET     (0x00010000)
56 #define W100_INTMEM_OFFSET  (0x00100000)
57 #define W100_EXTMEM_OFFSET  (0x00800000)
58 
59 #define W100_BASE_ADDRESS   (0x08000000)
60 #define W100_CFG_ADDRESS    (W100_BASE_ADDRESS + W100_CFG_OFFSET)
61 #define W100_REG_ADDRESS    (W100_BASE_ADDRESS + W100_REG_OFFSET)
62 #define W100_INTMEM_ADDRESS (W100_BASE_ADDRESS + W100_INTMEM_OFFSET)
63 #define W100_EXTMEM_ADDRESS (W100_BASE_ADDRESS + W100_EXTMEM_OFFSET)
64 
65 #define W100_CFG_SIZE       (0x00000010)
66 #define W100_REG_SIZE       (0x00002000)
67 #define W100_INTMEM_SIZE    (0x00060000)
68 #define W100_EXTMEM_SIZE    (0x00160000)
69 
70 void    w100_attach_subr(struct w100_softc *, bus_space_tag_t,
71              const struct w100_panel_geometry *);
72 int     w100_cnattach(struct w100_wsscreen_descr *,
73              const struct w100_panel_geometry *);
74 void    w100_suspend(struct w100_softc *);
75 void    w100_resume(struct w100_softc *);
76 void    w100_power(int, void *);
77 int     w100_show_screen(void *, void *, int, void (*)(void *, int, int),
78              void *);
79 int     w100_alloc_screen(void *, const struct wsscreen_descr *, void **,
80              int *, int *, long *);
81 void    w100_free_screen(void *, void *);
82 int     w100_ioctl(void *, void *, u_long, void *, int, struct lwp *);
83 paddr_t w100_mmap(void *, void *, off_t, int);
84 
85 extern const struct wsdisplay_emulops w100_emulops;
86 
87 
88 #endif /* _ZAURUS_DEV_W100VAR_H_ */
89