xref: /plan9/sys/src/9/pc/devlml.h (revision 41dd6b4775bcffc7275c15aee7294944759a2ea7)
1 /* Lml 22 driver */
2 
3 #define MJPG_VERSION "LML33 v0.2"
4 #define NLML 2
5 
6 /*
7  * The following values can be modified to tune/set default behaviour of the
8  * driver.
9  */
10 
11 /* The number of uS delay in I2C state transitions (probably >= 10) */
12 #define I2C_DELAY 50
13 
14 /* The amount of spinning to do before the I2C bus is timed out */
15 #define I2C_TIMEOUT 10000000
16 
17 /* The amount of spinning to do before the guest bus is timed out */
18 #define GUEST_TIMEOUT 10000000
19 
20 /*
21  * The amount of spinning to do before the polling of the still
22  * transfer port is aborted.
23  */
24 #define STILL_TIMEOUT 1000000
25 
26 /*
27  * The following number is the maximum number of cards permited. Each
28  * card found is mapped to a device minor number starting from 0.
29  */
30 #define MAX_CARDS 1
31 
32 /* The following are the datastructures needed by the device. */
33 #define I2C_BUS		0x044
34 /* which bit of I2C_BUS is which */
35 #define I2C_SCL		1
36 #define I2C_SDA		2
37 #define INTR_JPEGREP	0x08000000
38 #define INTR_GIRQ0	0x20000000
39 #define INTR_STAT	0x03c
40 
41 /* A Device records the properties of the various card types supported. */
42 typedef struct {
43 	int	number;		/* The H33_CARDTYPE_ assigned */
44 	char	*card_name;	/* A string name */
45 	int	zr060addr;	/* Which guest bus address for the ZR36060 */
46 } Device;
47 
48 /*
49  * The remainder of the #defs are constants which should not need changing.
50  *
51  * The PCI vendor and device ids of the zoran chipset on the dc30.
52  * these really belong in pci.h.
53  */
54 #define VENDOR_ZORAN		0x11de
55 #define ZORAN_36057		0x6057
56 #define ZORAN_36067		ZORAN_36057
57 
58 #define BT819Addr 0x8a
59 #define BT856Addr 0x88
60 
61 #define NBUF 4
62 
63 #define FRAGM_FINAL_B 1
64 #define STAT_BIT 1
65 
66 typedef struct	HdrFragment		HdrFragment;
67 typedef struct	FrameHeader		FrameHeader;
68 typedef union	Fragment		Fragment;
69 typedef struct	FragmentTable		FragmentTable;
70 typedef struct	CodeData		CodeData;
71 
72 /* If we're on a little endian architecture, then 0xFF, 0xD8 byte sequence is */
73 #define MRK_SOI		0xD8FF
74 #define MRK_APP3	0xE3FF
75 #define APP_NAME	"LML"
76 
77 struct FrameHeader {		/* Don't modify this struct, used by h/w */
78 	ushort	mrkSOI;
79 	ushort	mrkAPP3;
80 	ushort	lenAPP3;
81 	char	nm[4];
82 	ushort	frameNo;
83 	vlong	ftime;
84 	ulong	frameSize;
85 	ushort	frameSeqNo;
86 	ushort	SOIfiller;
87 };
88 
89 #define FRAGSIZE (128*1024)
90 
91 union Fragment {
92 	FrameHeader fh;
93 	char	fb[FRAGSIZE];
94 };
95 
96 struct HdrFragment {
97 	uchar	hdr[sizeof(FrameHeader)];
98 	Fragment;
99 };
100 
101 struct FragmentTable {		/* Don't modify this struct, used by h/w */
102 	ulong	addr;		/* Physical address */
103 	ulong	leng;
104 };
105 
106 struct CodeData {		/* Don't modify this struct, used by h/w */
107 	ulong	pamjpg;		/* Physical addr of statCom[0] */
108 	ulong	pagrab;		/* Physical addr of grab buffer */
109 	ulong	statCom[4];	/* Physical addresses of fragdescs */
110 	FragmentTable fragdesc[4];
111 	HdrFragment frag[4];
112 };
113 
114 enum{
115 	Codedatasize = (sizeof(CodeData) + BY2PG - 1) & ~(BY2PG - 1),
116 	Grabdatasize = (730 * 568 * 2 * 2 + BY2PG - 1) & ~(BY2PG - 1),
117 };
118 
119 #define POST_OFFICE		0x200
120 #define POST_PEND		0x02000000
121 #define POST_TIME		0x01000000
122 #define POST_DIR		0x00800000
123 
124 #define GID060	0
125