1*01869ca4Swiz.\" $NetBSD: microseq.9,v 1.6 2017/07/03 21:28:48 wiz Exp $ 273c4c2d6Swiz.\" 3e23cd1a7Sjdolecek.\" Copyright (c) 1998, 1999, Nicolas Souchu 4e23cd1a7Sjdolecek.\" All rights reserved. 5e23cd1a7Sjdolecek.\" 6e23cd1a7Sjdolecek.\" Redistribution and use in source and binary forms, with or without 7e23cd1a7Sjdolecek.\" modification, are permitted provided that the following conditions 8e23cd1a7Sjdolecek.\" are met: 9e23cd1a7Sjdolecek.\" 1. Redistributions of source code must retain the above copyright 10e23cd1a7Sjdolecek.\" notice, this list of conditions and the following disclaimer. 11e23cd1a7Sjdolecek.\" 2. Redistributions in binary form must reproduce the above copyright 12e23cd1a7Sjdolecek.\" notice, this list of conditions and the following disclaimer in the 13e23cd1a7Sjdolecek.\" documentation and/or other materials provided with the distribution. 14e23cd1a7Sjdolecek.\" 15e23cd1a7Sjdolecek.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16e23cd1a7Sjdolecek.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17e23cd1a7Sjdolecek.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18e23cd1a7Sjdolecek.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19e23cd1a7Sjdolecek.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20e23cd1a7Sjdolecek.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21e23cd1a7Sjdolecek.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22e23cd1a7Sjdolecek.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23e23cd1a7Sjdolecek.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24e23cd1a7Sjdolecek.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25e23cd1a7Sjdolecek.\" SUCH DAMAGE. 26e23cd1a7Sjdolecek.\" 27e23cd1a7Sjdolecek.\" $FreeBSD: src/share/man/man9/microseq.9,v 1.9.2.5 2001/12/17 11:30:18 ru Exp $ 28e23cd1a7Sjdolecek.\" 29e23cd1a7Sjdolecek.Dd December 29, 2003 30e23cd1a7Sjdolecek.Dt MICROSEQ 9 31e23cd1a7Sjdolecek.Os 32e23cd1a7Sjdolecek.Sh NAME 33e23cd1a7Sjdolecek.Nm microseq 34e23cd1a7Sjdolecek.Nd ppbus microseqencer developer's guide 35e23cd1a7Sjdolecek.Sh SYNOPSIS 36e23cd1a7Sjdolecek.In sys/types.h 37e23cd1a7Sjdolecek.In dev/ppbus/ppbus_conf.h 38e23cd1a7Sjdolecek.In dev/ppbus/ppbus_msq.h 39e23cd1a7Sjdolecek.Sh DESCRIPTION 40e23cd1a7SjdolecekSee 41e23cd1a7Sjdolecek.Xr ppbus 4 4273c4c2d6Swizfor 4373c4c2d6Swiz.Nm ppbus 4473c4c2d6Swizdescription and general info about the microsequencer. 45e23cd1a7Sjdolecek.Pp 46e23cd1a7SjdolecekThe purpose of this document is to encourage developers to use the 47e23cd1a7Sjdolecekmicrosequencer mechanism in order to have: 48e23cd1a7Sjdolecek.Bl -enum -offset indent 49e23cd1a7Sjdolecek.It 50e23cd1a7Sjdoleceka uniform programming model 51e23cd1a7Sjdolecek.It 52e23cd1a7Sjdolecekefficient code 53e23cd1a7Sjdolecek.El 54e23cd1a7Sjdolecek.Pp 5573c4c2d6SwizBefore using microsequences, you are encouraged to look at the 56e23cd1a7Sjdolecek.Xr atppc 4 57e23cd1a7Sjdolecekmicrosequencer implementation and an example of how using it in 58e23cd1a7Sjdolecek.Xr vpo 4 . 5973c4c2d6Swiz.Ss PPBUS register model 60e23cd1a7Sjdolecek.Ss Background 6173c4c2d6SwizThe parallel port model chosen for 6273c4c2d6Swiz.Xr ppbus 4 6373c4c2d6Swizis the PC parallel port model. 6473c4c2d6SwizThus, any register described later has the same semantic than its 6573c4c2d6Swizcounterpart in a PC parallel port. 66e23cd1a7SjdolecekFor more info about ISA/ECP programming, get the 6773c4c2d6SwizMicrosoft standard referenced 6873c4c2d6Swiz.Dq Tn "Extended Capabilities Port Protocol and ISA interface Standard" . 6973c4c2d6SwizRegisters described later are standard parallel port registers. 70e23cd1a7Sjdolecek.Pp 7173c4c2d6SwizMask macros are defined in the standard 7273c4c2d6Swiz.Xr ppbus 4 7373c4c2d6Swizinclude files for each valid bit of parallel port registers. 74e23cd1a7Sjdolecek.Ss Data register 7573c4c2d6SwizIn compatible or nibble mode, writing to this register will drive 7673c4c2d6Swizdata to the parallel port data lines. 7773c4c2d6SwizIn any other mode, drivers may be tri-stated by setting the direction 7873c4c2d6Swizbit (PCD) in the control register. 7973c4c2d6SwizReads to this register return the value on the data lines. 80e23cd1a7Sjdolecek.Ss Device status register 8173c4c2d6SwizThis read-only register reflects the inputs on the parallel port 8273c4c2d6Swizinterface. 83e23cd1a7Sjdolecek.Pp 84e23cd1a7Sjdolecek.Bl -column "Bit" "Name" "Description" -compact 85e23cd1a7Sjdolecek.It Em Bit Ta Em Name Ta Em Description 86e23cd1a7Sjdolecek.It 7 Ta nBUSY Ta "inverted version of parallel port Busy signal" 87e23cd1a7Sjdolecek.It 6 Ta nACK Ta "version of parallel port nAck signal" 88e23cd1a7Sjdolecek.It 5 Ta PERROR Ta "version of parallel port PERROR signal" 89e23cd1a7Sjdolecek.It 4 Ta SELECT Ta "version of parallel port Select signal" 90e23cd1a7Sjdolecek.It 3 Ta nFAULT Ta "version of parallel port nFault signal" 91e23cd1a7Sjdolecek.El 92e23cd1a7Sjdolecek.Pp 93e23cd1a7SjdolecekOthers are reserved and return undefined result when read. 94e23cd1a7Sjdolecek.Ss Device control register 9573c4c2d6SwizThis register directly controls several output signals as well as 9673c4c2d6Swizenabling some functions. 97e23cd1a7Sjdolecek.Pp 98e23cd1a7Sjdolecek.Bl -column "Bit" "Name " "Description" -compact 99e23cd1a7Sjdolecek.It Em Bit Ta Em Name Ta Em Description 100e23cd1a7Sjdolecek.It 5 Ta PCD Ta "direction bit in extended modes" 101e23cd1a7Sjdolecek.It 4 Ta IRQENABLE Ta "1 enables an interrupt on the rising edge of nAck" 102e23cd1a7Sjdolecek.It 3 Ta SELECTIN Ta "inverted and driven as parallel port nSelectin signal" 103e23cd1a7Sjdolecek.It 2 Ta nINIT Ta "driven as parallel port nInit signal" 104e23cd1a7Sjdolecek.It 1 Ta AUTOFEED Ta "inverted and driven as parallel port nAutoFd signal" 105e23cd1a7Sjdolecek.It 0 Ta STROBE Ta "inverted and driven as parallel port nStrobe signal" 106e23cd1a7Sjdolecek.El 107e23cd1a7Sjdolecek.Sh MICROINSTRUCTIONS 108e23cd1a7Sjdolecek.Ss Description 109e23cd1a7Sjdolecek.Em Microinstructions 11073c4c2d6Swizare either parallel port accesses, program iterations, submicrosequence 11173c4c2d6Swizor C calls. 112e23cd1a7SjdolecekThe parallel port must be considered as the logical model described in 113e23cd1a7Sjdolecek.Xr ppbus 4 . 114e23cd1a7Sjdolecek.Pp 115e23cd1a7SjdolecekAvailable microinstructions are: 116e23cd1a7Sjdolecek.Bd -literal 117*01869ca4Swiz#define MS_OP_GET 0 /* get <ptr>, <len> */ 118*01869ca4Swiz#define MS_OP_PUT 1 /* put <ptr>, <len> */ 119*01869ca4Swiz#define MS_OP_RFETCH 2 /* rfetch <reg>, <mask>, <ptr> */ 120*01869ca4Swiz#define MS_OP_RSET 3 /* rset <reg>, <mask>, <mask> */ 121*01869ca4Swiz#define MS_OP_RASSERT 4 /* rassert <reg>, <mask> */ 122*01869ca4Swiz#define MS_OP_DELAY 5 /* delay <val> */ 123*01869ca4Swiz#define MS_OP_SET 6 /* set <val> */ 124*01869ca4Swiz#define MS_OP_DBRA 7 /* dbra <offset> */ 125*01869ca4Swiz#define MS_OP_BRSET 8 /* brset <mask>, <offset> */ 126*01869ca4Swiz#define MS_OP_BRCLEAR 9 /* brclear <mask>, <offset> */ 127*01869ca4Swiz#define MS_OP_RET 10 /* ret <retcode> */ 128*01869ca4Swiz#define MS_OP_C_CALL 11 /* c_call <function>, <parameter> */ 129*01869ca4Swiz#define MS_OP_PTR 12 /* ptr <pointer> */ 130*01869ca4Swiz#define MS_OP_ADELAY 13 /* adelay <val> */ 131*01869ca4Swiz#define MS_OP_BRSTAT 14 /* brstat <mask>, <mask>, <offset> */ 132*01869ca4Swiz#define MS_OP_SUBRET 15 /* subret <code> */ 133*01869ca4Swiz#define MS_OP_CALL 16 /* call <microsequence> */ 134*01869ca4Swiz#define MS_OP_RASSERT_P 17 /* rassert_p <iter>, <reg> */ 135*01869ca4Swiz#define MS_OP_RFETCH_P 18 /* rfetch_p <iter>, <reg>, <mask> */ 136*01869ca4Swiz#define MS_OP_TRIG 19 /* trigger <reg>, <len>, <array> */ 137e23cd1a7Sjdolecek.Ed 138e23cd1a7Sjdolecek.Ss Execution context 139e23cd1a7SjdolecekThe 140e23cd1a7Sjdolecek.Em execution context 141e23cd1a7Sjdolecekof microinstructions is: 142e23cd1a7Sjdolecek.Bl -bullet -offset indent 143e23cd1a7Sjdolecek.It 144e23cd1a7Sjdolecekthe 145e23cd1a7Sjdolecek.Em program counter 14673c4c2d6Swizwhich points to the next microinstruction to execute either in the 14773c4c2d6Swizmain microsequence or in a subcall 148e23cd1a7Sjdolecek.It 149e23cd1a7Sjdolecekthe current value of 150e23cd1a7Sjdolecek.Em ptr 151e23cd1a7Sjdolecekwhich points to the next char to send/receive 152e23cd1a7Sjdolecek.It 153e23cd1a7Sjdolecekthe current value of the internal 154e23cd1a7Sjdolecek.Em branch register 155e23cd1a7Sjdolecek.El 156e23cd1a7Sjdolecek.Pp 157e23cd1a7SjdolecekThis data is modified by some of the microinstructions, not all. 158e23cd1a7Sjdolecek.Ss MS_OP_GET and MS_OP_PUT 15973c4c2d6Swizare microinstructions used to do either predefined standard 16073c4c2d6Swiz.Tn IEEE1284-1994 16173c4c2d6Swiztransfers or programmed non-standard I/O. 162e23cd1a7Sjdolecek.Ss MS_OP_RFETCH - Register FETCH 16373c4c2d6Swizis used to retrieve the current value of a parallel port register, 16473c4c2d6Swizapply a mask and save it in a buffer. 165e23cd1a7Sjdolecek.Pp 166e23cd1a7SjdolecekParameters: 167e23cd1a7Sjdolecek.Bl -enum -offset indent 168e23cd1a7Sjdolecek.It 169e23cd1a7Sjdolecekregister 170e23cd1a7Sjdolecek.It 171e23cd1a7Sjdolecekcharacter mask 172e23cd1a7Sjdolecek.It 173e23cd1a7Sjdolecekpointer to the buffer 174e23cd1a7Sjdolecek.El 175e23cd1a7Sjdolecek.Pp 176e23cd1a7SjdolecekPredefined macro: MS_RFETCH(reg,mask,ptr) 177e23cd1a7Sjdolecek.Ss MS_OP_RSET - Register SET 17873c4c2d6Swizis used to assert/clear some bits of a particular parallel port 17973c4c2d6Swizregister, two masks are applied. 180e23cd1a7Sjdolecek.Pp 181e23cd1a7SjdolecekParameters: 182e23cd1a7Sjdolecek.Bl -enum -offset indent 183e23cd1a7Sjdolecek.It 184e23cd1a7Sjdolecekregister 185e23cd1a7Sjdolecek.It 186e23cd1a7Sjdolecekmask of bits to assert 187e23cd1a7Sjdolecek.It 188e23cd1a7Sjdolecekmask of bits to clear 189e23cd1a7Sjdolecek.El 190e23cd1a7Sjdolecek.Pp 191e23cd1a7SjdolecekPredefined macro: MS_RSET(reg,assert,clear) 192e23cd1a7Sjdolecek.Ss MS_OP_RASSERT - Register ASSERT 193e23cd1a7Sjdolecekis used to assert all bits of a particular parallel port register. 194e23cd1a7Sjdolecek.Pp 195e23cd1a7SjdolecekParameters: 196e23cd1a7Sjdolecek.Bl -enum -offset indent 197e23cd1a7Sjdolecek.It 198e23cd1a7Sjdolecekregister 199e23cd1a7Sjdolecek.It 200e23cd1a7Sjdolecekbyte to assert 201e23cd1a7Sjdolecek.El 202e23cd1a7Sjdolecek.Pp 203e23cd1a7SjdolecekPredefined macro: MS_RASSERT(reg,byte) 204e23cd1a7Sjdolecek.Ss MS_OP_DELAY - microsecond DELAY 205e23cd1a7Sjdolecekis used to delay the execution of the microsequence. 206e23cd1a7Sjdolecek.Pp 207e23cd1a7SjdolecekParameter: 208e23cd1a7Sjdolecek.Bl -enum -offset indent 209e23cd1a7Sjdolecek.It 210e23cd1a7Sjdolecekdelay in microseconds 211e23cd1a7Sjdolecek.El 212e23cd1a7Sjdolecek.Pp 213e23cd1a7SjdolecekPredefined macro: MS_DELAY(delay) 214e23cd1a7Sjdolecek.Ss MS_OP_SET - SET internal branch register 215e23cd1a7Sjdolecekis used to set the value of the internal branch register. 216e23cd1a7Sjdolecek.Pp 217e23cd1a7SjdolecekParameter: 218e23cd1a7Sjdolecek.Bl -enum -offset indent 219e23cd1a7Sjdolecek.It 220e23cd1a7Sjdolecekinteger value 221e23cd1a7Sjdolecek.El 222e23cd1a7Sjdolecek.Pp 223e23cd1a7SjdolecekPredefined macro: MS_SET(accum) 224*01869ca4Swiz.Ss MS_OP_DBRA - \&Do BRAnch 225e23cd1a7Sjdolecekis used to branch if internal branch register decremented by one result value 226e23cd1a7Sjdolecekis positive. 227e23cd1a7Sjdolecek.Pp 228e23cd1a7SjdolecekParameter: 229e23cd1a7Sjdolecek.Bl -enum -offset indent 230e23cd1a7Sjdolecek.It 231e23cd1a7Sjdolecekinteger offset in the current executed (sub)microsequence. 232e23cd1a7SjdolecekOffset is added to 233e23cd1a7Sjdolecekthe index of the next microinstruction to execute. 234e23cd1a7Sjdolecek.El 235e23cd1a7Sjdolecek.Pp 236e23cd1a7SjdolecekPredefined macro: MS_DBRA(offset) 237e23cd1a7Sjdolecek.Ss MS_OP_BRSET - BRanch on SET 238e23cd1a7Sjdolecekis used to branch if some of the status register bits of the parallel port 239e23cd1a7Sjdolecekare set. 240e23cd1a7Sjdolecek.Pp 241e23cd1a7SjdolecekParameter: 242e23cd1a7Sjdolecek.Bl -enum -offset indent 243e23cd1a7Sjdolecek.It 244e23cd1a7Sjdolecekbits of the status register 245e23cd1a7Sjdolecek.It 246e23cd1a7Sjdolecekinteger offset in the current executed (sub)microsequence. 247e23cd1a7SjdolecekOffset is added to 248e23cd1a7Sjdolecekthe index of the next microinstruction to execute. 249e23cd1a7Sjdolecek.El 250e23cd1a7Sjdolecek.Pp 251e23cd1a7SjdolecekPredefined macro: MS_BRSET(mask,offset) 252e23cd1a7Sjdolecek.Ss MS_OP_BRCLEAR - BRanch on CLEAR 253e23cd1a7Sjdolecekis used to branch if some of the status register bits of the parallel port 254e23cd1a7Sjdolecekare cleared. 255e23cd1a7Sjdolecek.Pp 256e23cd1a7SjdolecekParameter: 257e23cd1a7Sjdolecek.Bl -enum -offset indent 258e23cd1a7Sjdolecek.It 259e23cd1a7Sjdolecekbits of the status register 260e23cd1a7Sjdolecek.It 261e23cd1a7Sjdolecekinteger offset in the current executed (sub)microsequence. 26273c4c2d6SwizOffset is added to the index of the next microinstruction to execute. 263e23cd1a7Sjdolecek.El 264e23cd1a7Sjdolecek.Pp 265e23cd1a7SjdolecekPredefined macro: MS_BRCLEAR(mask,offset) 266e23cd1a7Sjdolecek.Ss MS_OP_RET - RETurn 267e23cd1a7Sjdolecekis used to return from a microsequence. 268e23cd1a7SjdolecekThis instruction is mandatory. 26973c4c2d6SwizThis is the only way for the microsequencer to detect the end of 27073c4c2d6Swizthe microsequence. 27173c4c2d6SwizThe return code is returned in the integer pointed by the (int *) 27273c4c2d6Swizparameter of the ppb_MS_microseq(). 273e23cd1a7Sjdolecek.Pp 274e23cd1a7SjdolecekParameter: 275e23cd1a7Sjdolecek.Bl -enum -offset indent 276e23cd1a7Sjdolecek.It 277e23cd1a7Sjdolecekinteger return code 278e23cd1a7Sjdolecek.El 279e23cd1a7Sjdolecek.Pp 280e23cd1a7SjdolecekPredefined macro: MS_RET(code) 281e23cd1a7Sjdolecek.Ss MS_OP_C_CALL - C function CALL 282e23cd1a7Sjdolecekis used to call C functions from microsequence execution. 28373c4c2d6SwizThis may be useful when a non-standard I/O is performed to retrieve 28473c4c2d6Swiza data character from the parallel port. 285e23cd1a7Sjdolecek.Pp 286e23cd1a7SjdolecekParameter: 287e23cd1a7Sjdolecek.Bl -enum -offset indent 288e23cd1a7Sjdolecek.It 289e23cd1a7Sjdolecekthe C function to call 290e23cd1a7Sjdolecek.It 291e23cd1a7Sjdolecekthe parameter to pass to the function call 292e23cd1a7Sjdolecek.El 293e23cd1a7Sjdolecek.Pp 294e23cd1a7SjdolecekThe C function shall be declared as a 295e23cd1a7Sjdolecek.Ft int(*)(void *p, char *ptr) . 29673c4c2d6SwizThe ptr parameter is the current position in the buffer currently 29773c4c2d6Swizscanned. 298e23cd1a7Sjdolecek.Pp 299e23cd1a7SjdolecekPredefined macro: MS_C_CALL(func,param) 300e23cd1a7Sjdolecek.Ss MS_OP_PTR - initialize internal PTR 30173c4c2d6Swizis used to initialize the internal pointer to the currently scanned 30273c4c2d6Swizbuffer. 303e23cd1a7SjdolecekThis pointer is passed to any C call (see above). 304e23cd1a7Sjdolecek.Pp 305e23cd1a7SjdolecekParameter: 306e23cd1a7Sjdolecek.Bl -enum -offset indent 307e23cd1a7Sjdolecek.It 30873c4c2d6Swizpointer to the buffer that shall be accessed by 30973c4c2d6Swiz.Fn xxx_P 31073c4c2d6Swizmicrosequence calls. 31173c4c2d6SwizNote that this pointer is automatically incremented during 31273c4c2d6Swiz.Fn xxx_P 31373c4c2d6Swizcalls. 314e23cd1a7Sjdolecek.El 315e23cd1a7Sjdolecek.Pp 316e23cd1a7SjdolecekPredefined macro: MS_PTR(ptr) 317e23cd1a7Sjdolecek.Ss MS_OP_ADELAY - do an Asynchronous DELAY 31873c4c2d6Swizis used to make a 31953d643b5Sad.Xr cv_timedwait 9 32073c4c2d6Swizduring microsequence execution. 321e23cd1a7Sjdolecek.Pp 322e23cd1a7SjdolecekParameter: 323e23cd1a7Sjdolecek.Bl -enum -offset indent 324e23cd1a7Sjdolecek.It 325e23cd1a7Sjdolecekdelay in ms 326e23cd1a7Sjdolecek.El 327e23cd1a7Sjdolecek.Pp 328e23cd1a7SjdolecekPredefined macro: MS_ADELAY(delay) 329e23cd1a7Sjdolecek.Ss MS_OP_BRSTAT - BRanch on STATe 330e23cd1a7Sjdolecekis used to branch on status register state condition. 331e23cd1a7Sjdolecek.Pp 332e23cd1a7SjdolecekParameter: 333e23cd1a7Sjdolecek.Bl -enum -offset indent 334e23cd1a7Sjdolecek.It 335e23cd1a7Sjdolecekmask of asserted bits. 336e23cd1a7SjdolecekBits that shall be asserted in the status register 337e23cd1a7Sjdolecekare set in the mask 338e23cd1a7Sjdolecek.It 339e23cd1a7Sjdolecekmask of cleared bits. 340e23cd1a7SjdolecekBits that shall be cleared in the status register 341e23cd1a7Sjdolecekare set in the mask 342e23cd1a7Sjdolecek.It 343e23cd1a7Sjdolecekinteger offset in the current executed (sub)microsequence. 344e23cd1a7SjdolecekOffset is added 345e23cd1a7Sjdolecekto the index of the next microinstruction to execute. 346e23cd1a7Sjdolecek.El 347e23cd1a7Sjdolecek.Pp 348e23cd1a7SjdolecekPredefined macro: MS_BRSTAT(asserted_bits,clear_bits,offset) 349e23cd1a7Sjdolecek.Ss MS_OP_SUBRET - SUBmicrosequence RETurn 350e23cd1a7Sjdolecekis used to return from the submicrosequence call. 35173c4c2d6SwizThis action is mandatory before a RET call. 352e23cd1a7SjdolecekSome microinstructions (PUT, GET) may not be callable 353e23cd1a7Sjdolecekwithin a submicrosequence. 354e23cd1a7Sjdolecek.Pp 355e23cd1a7SjdolecekNo parameter. 356e23cd1a7Sjdolecek.Pp 357e23cd1a7SjdolecekPredefined macro: MS_SUBRET() 358e23cd1a7Sjdolecek.Ss MS_OP_CALL - submicrosequence CALL 359e23cd1a7Sjdolecekis used to call a submicrosequence. 36073c4c2d6SwizA submicrosequence is a microsequence with a SUBRET call. 361e23cd1a7SjdolecekParameter: 362e23cd1a7Sjdolecek.Bl -enum -offset indent 363e23cd1a7Sjdolecek.It 364e23cd1a7Sjdolecekthe submicrosequence to execute 365e23cd1a7Sjdolecek.El 366e23cd1a7Sjdolecek.Pp 367e23cd1a7SjdolecekPredefined macro: MS_CALL(microseq) 368e23cd1a7Sjdolecek.Ss MS_OP_RASSERT_P - Register ASSERT from internal PTR 36973c4c2d6Swizis used to assert a register with data currently pointed by the 37073c4c2d6Swizinternal PTR pointer. 371e23cd1a7SjdolecekParameter: 372e23cd1a7Sjdolecek.Bl -enum -offset indent 373e23cd1a7Sjdolecek.It 374e23cd1a7Sjdolecekamount of data to write to the register 375e23cd1a7Sjdolecek.It 376e23cd1a7Sjdolecekregister 377e23cd1a7Sjdolecek.El 378e23cd1a7Sjdolecek.Pp 379e23cd1a7SjdolecekPredefined macro: MS_RASSERT_P(iter,reg) 380e23cd1a7Sjdolecek.Ss MS_OP_RFETCH_P - Register FETCH to internal PTR 381e23cd1a7Sjdolecekis used to fetch data from a register. 38273c4c2d6SwizData is stored in the buffer currently pointed by the internal PTR 38373c4c2d6Swizpointer. 384e23cd1a7SjdolecekParameter: 385e23cd1a7Sjdolecek.Bl -enum -offset indent 386e23cd1a7Sjdolecek.It 387e23cd1a7Sjdolecekamount of data to read from the register 388e23cd1a7Sjdolecek.It 389e23cd1a7Sjdolecekregister 390e23cd1a7Sjdolecek.It 391e23cd1a7Sjdolecekmask applied to fetched data 392e23cd1a7Sjdolecek.El 393e23cd1a7Sjdolecek.Pp 394e23cd1a7SjdolecekPredefined macro: MS_RFETCH_P(iter,reg,mask) 395e23cd1a7Sjdolecek.Ss MS_OP_TRIG - TRIG register 396e23cd1a7Sjdolecekis used to trigger the parallel port. 39773c4c2d6SwizThis microinstruction is intended to provide a very efficient 39873c4c2d6Swizcontrol of the parallel port. 39973c4c2d6SwizTriggering a register is writing data, wait a while, write data, 40073c4c2d6Swizwait a while... 40173c4c2d6SwizThis allows to write magic sequences to the port. 402e23cd1a7SjdolecekParameter: 403e23cd1a7Sjdolecek.Bl -enum -offset indent 404e23cd1a7Sjdolecek.It 405e23cd1a7Sjdolecekamount of data to read from the register 406e23cd1a7Sjdolecek.It 407e23cd1a7Sjdolecekregister 408e23cd1a7Sjdolecek.It 409e23cd1a7Sjdoleceksize of the array 410e23cd1a7Sjdolecek.It 411e23cd1a7Sjdolecekarray of unsigned chars. 41273c4c2d6SwizEach couple of u_chars define the data to write to the register 41373c4c2d6Swizand the delay in us to wait. 41473c4c2d6SwizThe delay is limited to 255 us to simplify and reduce the size of 41573c4c2d6Swizthe array. 416e23cd1a7Sjdolecek.El 417e23cd1a7Sjdolecek.Pp 418e23cd1a7SjdolecekPredefined macro: MS_TRIG(reg,len,array) 419e23cd1a7Sjdolecek.Sh MICROSEQUENCES 420e23cd1a7Sjdolecek.Ss C structures 421e23cd1a7Sjdolecek.Bd -literal 422e23cd1a7Sjdolecekunion ppb_insarg { 423e23cd1a7Sjdolecek int i; 424e23cd1a7Sjdolecek char c; 425e23cd1a7Sjdolecek void *p; 426e23cd1a7Sjdolecek int (* f)(void *, char *); 427e23cd1a7Sjdolecek}; 428e23cd1a7Sjdolecek 429e23cd1a7Sjdolecekstruct ppb_microseq { 430e23cd1a7Sjdolecek int opcode; /* microins. opcode */ 431e23cd1a7Sjdolecek union ppb_insarg arg[PPB_MS_MAXARGS]; /* arguments */ 432e23cd1a7Sjdolecek}; 433e23cd1a7Sjdolecek.Ed 434e23cd1a7Sjdolecek.Ss Using microsequences 435e23cd1a7SjdolecekTo instantiate a microsequence, just declare an array of ppb_microseq 436e23cd1a7Sjdolecekstructures and initialize it as needed. 437e23cd1a7SjdolecekYou may either use predefined macros 438e23cd1a7Sjdolecekor code directly your microinstructions according to the ppb_microseq 439e23cd1a7Sjdolecekdefinition. 440e23cd1a7SjdolecekFor example, 441e23cd1a7Sjdolecek.Bd -literal 442e23cd1a7Sjdolecek struct ppb_microseq select_microseq[] = { 443e23cd1a7Sjdolecek 444e23cd1a7Sjdolecek /* parameter list 445e23cd1a7Sjdolecek */ 446e23cd1a7Sjdolecek #define SELECT_TARGET MS_PARAM(0, 1, MS_TYP_INT) 447e23cd1a7Sjdolecek #define SELECT_INITIATOR MS_PARAM(3, 1, MS_TYP_INT) 448e23cd1a7Sjdolecek 449e23cd1a7Sjdolecek /* send the select command to the drive */ 450e23cd1a7Sjdolecek MS_DASS(MS_UNKNOWN), 451e23cd1a7Sjdolecek MS_CASS(H_nAUTO | H_nSELIN | H_INIT | H_STROBE), 452e23cd1a7Sjdolecek MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE), 453e23cd1a7Sjdolecek MS_DASS(MS_UNKNOWN), 454e23cd1a7Sjdolecek MS_CASS( H_AUTO | H_nSELIN | H_nINIT | H_STROBE), 455e23cd1a7Sjdolecek 456e23cd1a7Sjdolecek /* now, wait until the drive is ready */ 457e23cd1a7Sjdolecek MS_SET(VP0_SELTMO), 458e23cd1a7Sjdolecek/* loop: */ MS_BRSET(H_ACK, 2 /* ready */), 459e23cd1a7Sjdolecek MS_DBRA(-2 /* loop */), 460e23cd1a7Sjdolecek/* error: */ MS_RET(1), 461e23cd1a7Sjdolecek/* ready: */ MS_RET(0) 462e23cd1a7Sjdolecek }; 463e23cd1a7Sjdolecek.Ed 464e23cd1a7Sjdolecek.Pp 46573c4c2d6SwizHere, some parameters are undefined and must be filled before 46673c4c2d6Swizexecuting the microsequence. 467e23cd1a7SjdolecekIn order to initialize each microsequence, one 46873c4c2d6Swizshould use the 46973c4c2d6Swiz.Fn ppb_MS_init_msq 47073c4c2d6Swizfunction like this: 47173c4c2d6Swiz.Bd -literal -offset indent 472e23cd1a7Sjdolecekppb_MS_init_msq(select_microseq, 2, 473*01869ca4Swiz SELECT_TARGET, 1 << target, 474*01869ca4Swiz SELECT_INITIATOR, 1 << initiator); 475e23cd1a7Sjdolecek.Ed 476e23cd1a7Sjdolecek.Pp 477e23cd1a7Sjdolecekand then execute the microsequence. 478e23cd1a7Sjdolecek.Ss The microsequencer 47973c4c2d6SwizThe microsequencer is executed either at ppbus or adapter level 48073c4c2d6Swiz(see 481e23cd1a7Sjdolecek.Xr ppbus 4 48273c4c2d6Swizfor info about ppbus system layers). 48373c4c2d6SwizMost of the microsequencer is executed at 48473c4c2d6Swiz.Xr atppc 4 48573c4c2d6Swizlevel to avoid 48673c4c2d6Swiz.Xr ppbus 4 48773c4c2d6Swizto adapter function call overhead. 48873c4c2d6SwizBut some actions like deciding whereas the transfer is 48973c4c2d6Swiz.Tn IEEE1284-1994 49073c4c2d6Swizcompliant are executed at 49173c4c2d6Swiz.Xr ppbus 4 49273c4c2d6Swizlayer. 493e23cd1a7Sjdolecek.Sh SEE ALSO 494e23cd1a7Sjdolecek.Xr atppc 4 , 49573c4c2d6Swiz.Xr ppbus 4 , 496e23cd1a7Sjdolecek.Xr vpo 4 497e23cd1a7Sjdolecek.Sh HISTORY 498e23cd1a7SjdolecekThe 499e23cd1a7Sjdolecek.Nm 500e23cd1a7Sjdolecekmanual page first appeared in 501e23cd1a7Sjdolecek.Fx 3.0 . 502e23cd1a7Sjdolecek.Sh AUTHORS 503e23cd1a7SjdolecekThis 504e23cd1a7Sjdolecekmanual page is based on the 505e23cd1a7Sjdolecek.Fx 50673c4c2d6Swiz.Nm microseq 50773c4c2d6Swizmanual page and was update for the 50873c4c2d6Swiz.Nx 509aae59958Srumbleport by 510e23cd1a7Sjdolecek.An Gary Thorpe . 51173c4c2d6Swiz.Sh BUGS 51273c4c2d6SwizOnly one level of submicrosequences is allowed. 51373c4c2d6Swiz.Pp 51473c4c2d6SwizWhen triggering the port, maximum delay allowed is 255 us. 515