English
Language : 

CD1284 Datasheet, PDF (98/176 Pages) Intel Corporation – IEEE 1284-Compatible Parallel Interface Controller with Two High-Speed Asynchronous Serial Ports
CD1284 — IEEE 1284-Compatible Parallel Interface Controller
6.4.2
char
int
serv_type, vector, channel, status, char;
char_count, i;
vector = inportb(SVCACKR);
/* gen. ack and get vector (read LIVR) */
channel = inportb(RICR) >> 2;
/* extract channel number from the RICR*/
serv_type = vector & 0x07;
/* mask RIVR to get type (good/
exception)*/
switch (serv_type) {
case 3:
/* good data service */
char_count = inportb(RDCR); /* get number of characters in FIFO
*/
for ( i = 1; i <= char_count; i++) {/* - read that number of
chars */
char = inportb(RDSR); /* read char from FIFO */
each
manipulate the
acknowledge. */
/* Code here would put the character in a buffer of some sort for
* channel. That code would be dependent on system software design
* so it won’t be shown here; this code just shows how to
* CD1284 registers to implement the poll mode service
}
break;
case 7:
/* exception data service request */
status = inportb(RDSR);/* by definition, only one char; get
status */
break;
}
outportb(EOSRR, 0x00);
/* write dummy value to EOSRR to terminate
*/
}
Serial Transmit Service
/* The transmit service acknowledge routine follows very nearly the same steps that
the receive service routine follows. The SVCACKT* input is activated to start the
service cycle, reading the contents of the TIVR, and the TICR is read to get the
channel number. */
service_txm( )
{
char
int
vector, channel;
char_count, i;
vector = inportb(SVCACKT);
value */
channel = inportb(TICR) >> 2;
/* retrieve and save transmit interrupt
/* extract channel number from the RICR*/
/* Buffer management code would set-up pointers to the next 12
* characters (maximum) to be sent on this channel. Again, buffer
* layout is system design dependent and won’t be shown here.
*/
for ( i = 0; i < char_count; i++) {/* transmit FIFO can take 12 characters
*/
outportb(TDR, *next_char++);
/* it is assumed that char_count and next_char is set up by buffer code
*/
}
outportb(EOSRR, 0x00);
*/
}
/* write dummy value to EOSRR to terminate
98
Datasheet