Main index | Section 9 | 日本語 | Options |
#include <sys/types.h>
#include <dev/ppbus/ppbconf.h>
#include <dev/ppbus/ppb_msq.h>
The purpose of this document is to encourage developers to use the microsequencer mechanism in order to have:
Before using microsequences, you are encouraged to look at ppc(4) microsequencer implementation and an example of how using it in vpo(4).
Mask macros are defined in the standard ppbus include files for each valid bit of parallel port registers.
Bit | Name | Description |
7 | nBUSY | inverted version of parallel port Busy signal |
6 | nACK | version of parallel port nAck signal |
5 | PERROR | version of parallel port PERROR signal |
4 | SELECT | version of parallel port Select signal |
3 | nFAULT | version of parallel port nFault signal |
Others are reserved and return undefined result when read.
Bit | Name | Description |
5 | PCD | direction bit in extended modes |
4 | IRQENABLE | 1 enables an interrupt on the rising edge of nAck |
3 | SELECTIN | inverted and driven as parallel port nSelectin signal |
2 | nINIT | driven as parallel port nInit signal |
1 | AUTOFEED | inverted and driven as parallel port nAutoFd signal |
0 | STROBE | inverted and driven as parallel port nStrobe signal |
Available microinstructions are:
#define MS_OP_GET 0 /* get <ptr>, <len> */ #define MS_OP_PUT 1 /* put <ptr>, <len> */ #define MS_OP_RFETCH 2 /* rfetch <reg>, <mask>, <ptr> */ #define MS_OP_RSET 3 /* rset <reg>, <mask>, <mask> */ #define MS_OP_RASSERT 4 /* rassert <reg>, <mask> */ #define MS_OP_DELAY 5 /* delay <val> */ #define MS_OP_SET 6 /* set <val> */ #define MS_OP_DBRA 7 /* dbra <offset> */ #define MS_OP_BRSET 8 /* brset <mask>, <offset> */ #define MS_OP_BRCLEAR 9 /* brclear <mask>, <offset> */ #define MS_OP_RET 10 /* ret <retcode> */ #define MS_OP_C_CALL 11 /* c_call <function>, <parameter> */ #define MS_OP_PTR 12 /* ptr <pointer> */ #define MS_OP_ADELAY 13 /* adelay <val> */ #define MS_OP_BRSTAT 14 /* brstat <mask>, <mask>, <offset> */ #define MS_OP_SUBRET 15 /* subret <code> */ #define MS_OP_CALL 16 /* call <microsequence> */ #define MS_OP_RASSERT_P 17 /* rassert_p <iter>, <reg> */ #define MS_OP_RFETCH_P 18 /* rfetch_p <iter>, <reg>, <mask> */ #define MS_OP_TRIG 19 /* trigger <reg>, <len>, <array> */
This data is modified by some of the microinstructions, not all.
Parameters:
Predefined macro: MS_RFETCH(reg,mask,ptr)
Parameters:
Predefined macro: MS_RSET(reg,assert,clear)
Parameters:
Predefined macro: MS_RASSERT(reg,byte)
Parameter:
Predefined macro: MS_DELAY(delay)
Parameter:
Predefined macro: MS_SET(accum)
Parameter:
Predefined macro: MS_DBRA(offset)
Parameter:
Predefined macro: MS_BRSET(mask,offset)
Parameter:
Predefined macro: MS_BRCLEAR(mask,offset)
Parameter:
Predefined macro: MS_RET(code)
Parameter:
The C function shall be declared as a int(*)(void *p, char *ptr). The ptr parameter is the current position in the buffer currently scanned.
Predefined macro: MS_C_CALL(func,param)
Parameter:
Predefined macro: MS_PTR(ptr)
Parameter:
Predefined macro: MS_ADELAY(delay)
Parameter:
Predefined macro: MS_BRSTAT(asserted_bits,clear_bits,offset)
No parameter.
Predefined macro: MS_SUBRET()
Predefined macro: MS_CALL(microseq)
Predefined macro: MS_RASSERT_P(iter,reg)
Predefined macro: MS_RFETCH_P(iter,reg,mask)
Predefined macro: MS_TRIG(reg,len,array)
union ppb_insarg { int i; char c; void *p; int (* f)(void *, char *); };struct ppb_microseq { int opcode; /* microins. opcode */ union ppb_insarg arg[PPB_MS_MAXARGS]; /* arguments */ };
struct ppb_microseq select_microseq[] = {/* parameter list */ #define SELECT_TARGET MS_PARAM(0, 1, MS_TYP_INT) #define SELECT_INITIATOR MS_PARAM(3, 1, MS_TYP_INT)
/* send the select command to the drive */ MS_DASS(MS_UNKNOWN), MS_CASS(H_nAUTO | H_nSELIN | H_INIT | H_STROBE), MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE), MS_DASS(MS_UNKNOWN), MS_CASS( H_AUTO | H_nSELIN | H_nINIT | H_STROBE),
/* now, wait until the drive is ready */ MS_SET(VP0_SELTMO), /* loop: */ MS_BRSET(H_ACK, 2 /* ready */), MS_DBRA(-2 /* loop */), /* error: */ MS_RET(1), /* ready: */ MS_RET(0) };
Here, some parameters are undefined and must be filled before executing the microsequence. In order to initialize each microsequence, one should use the ppb_MS_init_msq() function like this:
ppb_MS_init_msq(select_microseq, 2, SELECT_TARGET, 1 << target, SELECT_INITIATOR, 1 << initiator);
and then execute the microsequence.
When triggering the port, maximum delay allowed is 255 us.
MICROSEQ (9) | June 6, 1998 |
Main index | Section 9 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | The number of UNIX installations has grown to 10, with more expected. | ” |
— UNIX Programming Manual, 1972 |