
IEEE 1284-Compatible Parallel Interface Controller
—
CD1284
Datasheet
101
The routine below shows one way of implementing the poll-mode service activation using the first
method.
service_par( )
{
char
save_pir, save_car, livr_val;
save_pir = inportb(PIR);
value */
save_car = inportb(CAR);
outportb(CAR, save_pir);
*/
livr_val = inportb(LIVR) & 0x07;
switch (livr_val) {
case 4:
request is active */
service_par_chan();
break;
case 5:
active */
service_pipeline();
break;
case 6:
service_par_chan();
service_pipeline();
break;
default:
break;
}
outportb(PIR, save_pir & 0x00);
clearing bit 7 */
outportb(CAR, save_car);
return(0);
}
/* retrieve and save parallel interrupt
/* save CAR for restore */
/* switch CD1284 to service ack. context
/* just the parallel channel state-machine
/* just the data path pipeline request is
/* both requests are active */
/* terminate service ack. sequence by
/* restore original CAR*/
It is not necessary for the CPU on the parallel channel to actually copy the contents of the PIR into
the CAR. Since it is known that the parallel channel is always channel 0, the CPU may switch the
context by simply writing a x
’
00 into the CAR after first saving the previous state of the CAR, if
desired. At the end of the service, the interrupt context can be returned by toggling the IntEn bit in
the PFCR within the data pipeline. Hardware in that block of logic detects the toggle operation and
clears the PPireq bit itself. The CPU can restore the CAR, if desired, and exit the routine. Just as it
would in the other poll-mode case, once the MPU has detected the clearing of the parallel interrupt
source bits (PPort and Pipeline) and the PPIreq bit. It cleans up the PIR and LIVR.
service_par( )
{
char
save_car, livr_val;
save_car = inportb(CAR);
outportb(CAR, 0x00);
/* save CAR for restore (if desired) */
/* switch CD1284 to service ack. context
*/
livr_val = inportb(LIVR) & 0x07;
switch (livr_val) {
case 4:
request is active */
service_par_chan();
break;
case 5:
active */
service_pipeline();
break;
case 6:
service_par_chan();
service_pipeline();
break;
default:
/* get the vector (Not from the PIVR) */
/* just the parallel channel state-machine
/* just the data path pipeline request is
/* both requests are active */