Exemplo n.º 1
0
int lpr_close(uint_fast8_t minor)
{
	uint8_t b = 0x46;
	if (minor == 0)
		dw_transaction(&b, 1, NULL, 0, 0);
	return 0;
}
Exemplo n.º 2
0
Arquivo: ttydw.c Projeto: 8l/FUZIX
/* Close a DriveWire port */
void dw_vclose( uint8_t minor){
	struct dw_in *p=dw_gettab( minor );
	unsigned char buf[3];
	buf[0]=DW_SETSTAT;
	buf[1]=dw_port( minor );
	buf[2]=DW_VCLOSE;
	if( p->flags & DW_FLG_OPEN ){
		dw_transaction( buf, 3, NULL, 0 );
	}
}
Exemplo n.º 3
0
Arquivo: ttydw.c Projeto: 8l/FUZIX
/* Open a DriveWire port */
void dw_vopen( uint8_t minor ){
	struct dw_in *p=dw_gettab( minor );
	unsigned char buf[3];
	buf[0]=DW_SETSTAT;
	buf[1]=dw_port( minor );
	buf[2]=DW_VOPEN;
	if( ! ( p->flags & DW_FLG_OPEN ) ){
		dw_transaction( buf, 3, NULL, 0 );
		open_ports++;
	}
	p->flags |= DW_FLG_OPEN;
}
Exemplo n.º 4
0
int lpr_write(uint_fast8_t minor, uint_fast8_t rawflag, uint_fast8_t flag)
{
	uint8_t *p = udata.u_base;
	uint8_t *pe = p + udata.u_count;
	int n;
	irqflags_t irq;
	uint8_t buf[2];

	buf[0]=0x50;
	if (minor == 0) {
		while (p < pe) {
			if ((n = iopoll(pe - p)) != 0)
				return n;
			buf[1] = ugetc(p++);
			dw_transaction(buf, 2, NULL, 0, 0);
		}
	} 
	return udata.u_count;
}
Exemplo n.º 5
0
Arquivo: ttydw.c Projeto: 8l/FUZIX
/* (re) Initializes DW */
void dw_init( ){
	unsigned char buf[2];
	buf[0]=DW_INIT;
	buf[1]=0x42;
	dw_transaction( buf,2,buf,1 );
}
Exemplo n.º 6
0
Arquivo: ttydw.c Projeto: 8l/FUZIX
/* Poll and add chars (if any) to input q
 */
void dw_vpoll( ){
	unsigned char buf[2];
	int i;
	/* don't waste time polling of no ports are open*/
	if( ! open_ports ) return ;
	/* check ticks - don't poll until our delay is done */
	if( --wait ) return;
	/* up to four transactions at a poll */
	for( i=0; i<4; i++){
		buf[0]=DW_SERREAD;
		dw_transaction( buf, 1, buf, 2 );
		/* nothing waiting ? */
		if( ! (buf[0] & 0x7f) ) {
			wait=MAX_WAIT;
			break;
		}
		/* VSER Channel single datum */
		if( buf[0]<16 ){
			int minor=dw_minor( buf[0] - 1 );
			tty_inproc( minor, buf[1] );
			continue;
		}
		/* VSER Channel closed? */
		if( buf[0] == 16 ){
			int minor=dw_minor( buf[1] );
			struct dw_in *p=dw_gettab( minor );
		       	if( p->flags & DW_FLG_OPEN ){
				p->flags &= ~DW_FLG_OPEN;
				open_ports--;
				if( ttydata[minor].users )
					tty_carrier_drop( minor);
			}
			continue;
		}
		/* VSER channel multiple data */
		if( buf[0] < 32 ){
			int i;
			unsigned char b[3];
			int min;
			int minor=dw_minor( buf[0]-17 );
			b[0]=DW_SERREADM;
			b[1]=buf[0]-17;
			min=mini( buf[1], qfree( minor ) );
			b[2]=min;
			if( !min ){
				wait=1;
				break;
			}
			dw_transaction( b,3,tbuf, min );
			for( i=0; i<min; i++){
				tty_inproc( minor, tbuf[i] );
			}
			wait=1;
			break;
		}
		/* VWIN channel single datum */
		if( buf[0] < 144 ){
			int minor=dw_minor( buf[0]-48 );
			tty_inproc( minor, buf[1] );
			continue;
		}
		/* something we don't handle? */
		kprintf("out of band data\n");
	}
}
Exemplo n.º 7
0
Arquivo: ttydw.c Projeto: 8l/FUZIX
/* Put a character to the DriveWire port */
void dw_putc( uint8_t minor, unsigned char c ){
	unsigned char buf[2];
	buf[0]=DW_FASTWRITE | dw_port( minor ) ;
	buf[1]=c;
	dw_transaction( buf, 2, NULL, 0 );
}