xref: /plan9-contrib/sys/src/cmd/jtagfs/jtag.h (revision dedb130315e7b691e306ee069395ee1f0b18e4d4)
1 typedef struct JMedium JMedium;
2 typedef struct ShiftTDesc ShiftTDesc;
3 typedef struct ShiftRDesc ShiftRDesc;
4 
5 
6 /* descriptor for a shift if not there are too many parameters */
7 struct ShiftTDesc {
8 	int		reg;
9 	uchar	*buf;
10 	int		nbits;
11 	int		op;
12 };
13 
14 /* descriptor for a reply to do async replies, timing agh... */
15 struct ShiftRDesc{
16 	int	nbyread;	/* total bytes */
17 	int	nbiprelast;	/* bits of next to last */
18 	int	nbilast;	/* bits of last */
19 };
20 
21 /* this is the interface for the medium */
22 struct JMedium {
23 	TapSm;				/* of the tap I am currently addressing */
24 	int		motherb;
25 	int		tapcpu;
26 	Tap		taps[16];
27 	int		ntaps;
28 	uchar	currentch;	/* BUG: in tap[tapcpu]->private */
29 	void		*mdata;
30 	int		(*regshift)(JMedium *jmed, ShiftTDesc *req, ShiftRDesc *rep);
31 	int		(*flush)(void *mdata);
32 	int		(*term)(void *mdata);
33 	int		(*resets)(void *mdata, int trst, int srst);
34 	int		(*rdshiftrep)(JMedium *jmed, uchar *buf, ShiftRDesc *rep);
35 };
36 
37 enum{
38 	ShiftMarg		= 4,		/* Max number of extra bytes in response */
39 
40 	ShiftIn		= 1,
41 	ShiftOut		= 2,
42 	ShiftNoCommit	= 4,		/* Normally you want to commit... */
43 	ShiftPauseOut	= 8,		/* go through pause on the way out */
44 	ShiftPauseIn	= 16,		/* go through pause on the way in */
45 	ShiftAsync	= 32,		/* do not read reply synch */
46 };
47 extern int	tapshift(JMedium *jmed, ShiftTDesc *req, ShiftRDesc *rep, int tapidx);
48