Specifications

Sample Driver Written in C
B.1 LRDRIVER Example
cram = cram->cram$l_flink;
cram->cram$v_der = 1;
ucb->ucb$ps_cram_lcw = cram;
ioc$cram_cmd (CRAMCMD$K_WTLONG32, LR_COMBO_LCW, adp, cram, 0);
} else { /* This unit is for VL82C106 on ISA bus */
/* Get and validate the ISA IRQ */
status = ioc$node_data (ucb->ucb$r_ucb.ucb$l_crb, IOC$K_EISA_IRQ,
&ucb->ucb$l_lr_isa_irq[0] );
if ( ! $VMS_STATUS_SUCCESS(status) ) return status;
if ( ucb->ucb$l_lr_isa_irq[0] != LR_LPT2_IRQ &&
ucb->ucb$l_lr_isa_irq[0] != LR_LPT3_IRQ &&
ucb->ucb$l_lr_isa_irq[1] != LR_LPT2_IRQ &&
ucb->ucb$l_lr_isa_irq[1] != LR_LPT3_IRQ ) {
return SS$_IVADDR;
}
/* Get and validate the ISA I/O address */
status = ioc$node_data (ucb->ucb$r_ucb.ucb$l_crb, IOC$K_EISA_IO_PORT,
&ucb->ucb$l_lr_isa_io_address[0] );
if ( ! $VMS_STATUS_SUCCESS(status) ) return status;
isa_io_addr = ucb->ucb$l_lr_isa_io_address[0];
if (isa_io_addr != LR_LPT2_PORT && isa_io_addr != LR_LPT3_PORT) {
isa_io_addr = ucb->ucb$l_lr_isa_io_address[1];
if (isa_io_addr != LR_LPT2_PORT && isa_io_addr != LR_LPT3_PORT) {
return SS$_IVADDR;
}
}
/* Initialize CRAM used to write the data register */
cram->cram$v_der = 1;
ucb->ucb$ps_cram_lwd = cram;
ioc$cram_cmd (CRAMCMD$K_WTBYTE32, isa_io_addr+LR_ISA_LWD, adp, cram, 0);
/* Initialize CRAM used to read the status register */
cram = cram->cram$l_flink;
cram->cram$v_der = 1;
ucb->ucb$ps_cram_lps = cram;
ioc$cram_cmd (CRAMCMD$K_RDBYTE32, isa_io_addr+LR_ISA_LPS, adp, cram, 0);
/* Initialize CRAM used to write the control register */
cram = cram->cram$l_flink;
cram->cram$v_der = 1;
ucb->ucb$ps_cram_lcw = cram;
ioc$cram_cmd (CRAMCMD$K_WTBYTE32, isa_io_addr+LR_ISA_LCW, adp, cram, 0);
}
/* Enable interrupts */
status = ioc$node_function (ucb->ucb$r_ucb.ucb$l_crb, IOC$K_ENABLE_INTR);
if ( ! $VMS_STATUS_SUCCESS(status) ) return status;
/* Set the INIT_OFF bit in the port control register. The INIT signal is
* asserted as long as INIT_OFF is clear. Note byte-lane shift if ISA
* option.
*/
if (ucb->ucb$l_lr_combo)
device_data = LPC_M_INIT_OFF;
else
device_data = LPC_M_INIT_OFF << 16;
ucb->ucb$ps_cram_lcw->cram$q_wdata = device_data;
ioc$cram_io (ucb->ucb$ps_cram_lcw);
B–10