xref: /csrg-svn/sys/luna68k/stand/tape.c (revision 57105)
1*57105Sakito /*
2*57105Sakito  * Copyright (c) 1992 OMRON Corporation.
3*57105Sakito  * Copyright (c) 1992 The Regents of the University of California.
4*57105Sakito  * All rights reserved.
5*57105Sakito  *
6*57105Sakito  * This code is derived from software contributed to Berkeley by
7*57105Sakito  * OMRON Corporation.
8*57105Sakito  *
9*57105Sakito  * %sccs.include.redist.c%
10*57105Sakito  *
11*57105Sakito  *	@(#)tape.c	7.1 (Berkeley) 12/13/92
12*57105Sakito  */
13*57105Sakito 
14*57105Sakito /*
15*57105Sakito  * tape.c -- operation commands for TAPE unit.
16*57105Sakito  * by A.Fujita, APR-14-1992
17*57105Sakito  */
18*57105Sakito 
19*57105Sakito #include <sys/param.h>
20*57105Sakito #include <luna68k/stand/status.h>
21*57105Sakito 
22*57105Sakito dev_t  rst0 = 0x0000;
23*57105Sakito dev_t nrst0 = 0x0004;
24*57105Sakito 
25*57105Sakito u_char buff[512];
26*57105Sakito 
27*57105Sakito int
28*57105Sakito tape(argc, argv)
29*57105Sakito 	int   argc;
30*57105Sakito 	char *argv[];
31*57105Sakito {
32*57105Sakito 	int size, count;
33*57105Sakito 	u_long *p = (u_long *) buff;
34*57105Sakito 
35*57105Sakito 	if (!strcmp(argv[1], "read")) {
36*57105Sakito 		count = 0;
37*57105Sakito 		while ((size = stread(rst0, buff, 512)) == 512)
38*57105Sakito 			count++;
39*57105Sakito 		printf("tape: size  = %d\n", size);
40*57105Sakito 		printf("tape: count = %d\n", count);
41*57105Sakito 	} else if (!strcmp(argv[1], "write")) {
42*57105Sakito 		for (count = 0; count < 500; count++) {
43*57105Sakito 			if ((size = stwrite(rst0, buff, 512)) != 512)
44*57105Sakito 				break;
45*57105Sakito 		}
46*57105Sakito 		printf("tape: size  = %d\n", size);
47*57105Sakito 		printf("tape: count = %d\n", count);
48*57105Sakito 	} else if (!strcmp(argv[1], "rewind")) {
49*57105Sakito 		st_rewind(rst0);
50*57105Sakito 	} else if (!strcmp(argv[1], "weof")) {
51*57105Sakito 		st_write_EOF(rst0);
52*57105Sakito 	} else if (!strcmp(argv[1], "skip")) {
53*57105Sakito 		st_skip(rst0);
54*57105Sakito 	} else {
55*57105Sakito 		return(ST_ERROR);
56*57105Sakito 	}
57*57105Sakito 
58*57105Sakito 	return(ST_NORMAL);
59*57105Sakito }
60