kernels/linux-2.4.0/drivers/s390/char/con3215.c
/*
 * Set up a write request with the information from the main structure.
 * A ccw chain is created that writes everything in the output buffer
 * to the 3215 device.
 */
Set up a write request with the information from the main structure.
A ccw chain is created that writes everything in the output buffer
to the 3215 device.
Set up a write request with the information from the main structure . A ccw chain is created that writes everything in the output buffer to the 3215 device .
static int raw3215_mk_write_ccw(raw3215_info *raw, raw3215_req *req)
{
	ccw1_t *ccw;
	int len, count, ix;
	ccw = req->ccws;
	req->end = (raw->head - 1) & (RAW3215_BUFFER_SIZE - 1);
	len = ((req->end - req->start) & (RAW3215_BUFFER_SIZE - 1)) + 1;
	ix = req->start;
	while (len > 0) {
		if (ccw > req->ccws)
			ccw[-1].flags |= 0x40; 
		ccw->cmd_code = 0x01; 
		ccw->flags = 0x20;    
		ccw->cda =
			(void *) virt_to_phys(raw->buffer + ix);
		count = (len > RAW3215_MAX_CCWLEN) ? 
			RAW3215_MAX_CCWLEN : len;
		if (ix + count > RAW3215_BUFFER_SIZE)
			count = RAW3215_BUFFER_SIZE-ix;
		ccw->count = count;
		len -= count;
		ix = (ix + count) & (RAW3215_BUFFER_SIZE - 1);
		ccw++;
	}
	return len;
}
static int raw3215_mk_write_ccw ( raw3215_info * raw , raw3215_req * req ) { ccw1_t * ccw ; int len , count , ix ; ccw = req -> ccws ; req -> end = ( raw -> head - 1 ) & ( RAW3215_BUFFER_SIZE - 1 ) ; len = ( ( req -> end - req -> start ) & ( RAW3215_BUFFER_SIZE - 1 ) ) + 1 ; ix = req -> start ; while ( len > 0 ) { if ( ccw > req -> ccws ) ccw [ -1 ] . flags |= 0x40 ; ccw -> cmd_code = 0x01 ; ccw -> flags = 0x20 ; ccw -> cda = ( void * ) virt_to_phys ( raw -> buffer + ix ) ; count = ( len > RAW3215_MAX_CCWLEN ) ? RAW3215_MAX_CCWLEN : len ; if ( ix + count > RAW3215_BUFFER_SIZE ) count = RAW3215_BUFFER_SIZE - ix ; ccw -> count = count ; len -= count ; ix = ( ix + count ) & ( RAW3215_BUFFER_SIZE - 1 ) ; ccw ++ ; } return len ; }
Set up a write request with the information from the main structure.
Set up a write request with the information from the main structure .
/* use command chaining */ /* write, auto carrier return */ /* ignore incorrect length ind.  */