xref: /freebsd/share/man/man9/microseq.9 (revision 0640d357f29fb1c0daaaffadd0416c5981413afd)
1.\" Copyright (c) 1998, Nicolas Souchu
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\"
26.Dd June 6, 1998
27.Dt MICROSEQ 9
28.Os FreeBSD
29.Sh NAME
30.Nm microseq
31.Nd
32ppbus microseqencer developer's guide
33.Sh SYNOPSIS
34.Fd "#include <dev/ppbus/ppb_msq.h>"
35.Sh DESCRIPTION
36See
37.Xr ppbus 4
38for ppbus description and general info about the microsequencer.
39.Pp
40The purpose of this document is to encourage developers to use the
41microsequencer mechanism in order to have:
42.Bl -enum -offset indent
43.It
44a uniform programming model
45.It
46efficient code
47.El
48.Sh INTERFACE
49.Ss C structures
50.Bd -literal
51union ppb_insarg {
52	int	i;
53	char	c;
54	void	*p;
55	int	(* f)(void *, char *);
56};
57.Ed
58.Bd -literal
59struct ppb_microseq {
60	int			opcode;		/* microins. opcode */
61	union ppb_insarg	arg[PPB_MS_MAXARGS];	/* arguments */
62};
63.Ed
64.Ss Using microsequences
65.Pp
66To instanciate a microsequence, just declare an array of ppb_microseq
67structures and initialize it as needed. You may either use defined macros
68or code directly your microinstructions according to the ppb_microseq
69definition. For example,
70.Bd -literal
71	struct ppb_microseq select_microseq[] = {
72
73		/* parameter list
74		 */
75		#define SELECT_TARGET    MS_PARAM(0, 1, MS_TYP_INT)
76		#define SELECT_INITIATOR MS_PARAM(3, 1, MS_TYP_INT)
77
78		/* send the select command to the drive */
79		MS_DASS(MS_UNKNOWN),
80		MS_CASS(H_nAUTO | H_nSELIN |  H_INIT | H_STROBE),
81		MS_CASS( H_AUTO | H_nSELIN |  H_INIT | H_STROBE),
82		MS_DASS(MS_UNKNOWN),
83		MS_CASS( H_AUTO | H_nSELIN | H_nINIT | H_STROBE),
84
85		/* now, wait until the drive is ready */
86		MS_SET(VP0_SELTMO),
87/* loop: */	MS_BRSET(H_ACK, 3 /* ready */),
88		MS_DBRA(-1 /* loop */),
89/* error: */	MS_RET(1),
90/* ready: */	MS_RET(0)
91	};
92.Ed
93.Pp
94Here, some parameters are undefined and must be filled before executing
95the microsequence. In order to initialize seach a microsequence, one should
96use the ppb_MS_init_msq() function like this:
97.Bd -literal
98	ppb_MS_init_msq(select_microseq, 2,
99			SELECT_TARGET, 1 << target,
100			SELECT_INITIATOR, 1 << initiator);
101.Ed
102.Pp
103and then execute the microsequence.
104.Ss The microsequencer
105The microsequencer is executed either at ppbus or adapter level (see
106.Xr ppbus 4
107for info about ppbus system layers).
108.Sh SEE ALSO
109.Xr ppbus 4
110.Sh HISTORY
111The
112.Nm
113manual page first appeared in
114.Fx 3.0 .
115.Sh AUTHOR
116This
117manual page was written by
118.An Nicolas Souchu .
119