xref: /csrg-svn/sys/luna68k/stand/tape.c (revision 63199)
157105Sakito /*
257105Sakito  * Copyright (c) 1992 OMRON Corporation.
3*63199Sbostic  * Copyright (c) 1992, 1993
4*63199Sbostic  *	The Regents of the University of California.  All rights reserved.
557105Sakito  *
657105Sakito  * This code is derived from software contributed to Berkeley by
757105Sakito  * OMRON Corporation.
857105Sakito  *
957105Sakito  * %sccs.include.redist.c%
1057105Sakito  *
11*63199Sbostic  *	@(#)tape.c	8.1 (Berkeley) 06/10/93
1257105Sakito  */
1357105Sakito 
1457105Sakito /*
1557105Sakito  * tape.c -- operation commands for TAPE unit.
1657105Sakito  * by A.Fujita, APR-14-1992
1757105Sakito  */
1857105Sakito 
1957105Sakito #include <sys/param.h>
2057105Sakito #include <luna68k/stand/status.h>
2157105Sakito 
2257105Sakito dev_t  rst0 = 0x0000;
2357105Sakito dev_t nrst0 = 0x0004;
2457105Sakito 
2557105Sakito u_char buff[512];
2657105Sakito 
2757105Sakito int
tape(argc,argv)2857105Sakito tape(argc, argv)
2957105Sakito 	int   argc;
3057105Sakito 	char *argv[];
3157105Sakito {
3257105Sakito 	int size, count;
3357105Sakito 	u_long *p = (u_long *) buff;
3457105Sakito 
3557105Sakito 	if (!strcmp(argv[1], "read")) {
3657105Sakito 		count = 0;
3757105Sakito 		while ((size = stread(rst0, buff, 512)) == 512)
3857105Sakito 			count++;
3957105Sakito 		printf("tape: size  = %d\n", size);
4057105Sakito 		printf("tape: count = %d\n", count);
4157105Sakito 	} else if (!strcmp(argv[1], "write")) {
4257105Sakito 		for (count = 0; count < 500; count++) {
4357105Sakito 			if ((size = stwrite(rst0, buff, 512)) != 512)
4457105Sakito 				break;
4557105Sakito 		}
4657105Sakito 		printf("tape: size  = %d\n", size);
4757105Sakito 		printf("tape: count = %d\n", count);
4857105Sakito 	} else if (!strcmp(argv[1], "rewind")) {
4957105Sakito 		st_rewind(rst0);
5057105Sakito 	} else if (!strcmp(argv[1], "weof")) {
5157105Sakito 		st_write_EOF(rst0);
5257105Sakito 	} else if (!strcmp(argv[1], "skip")) {
5357105Sakito 		st_skip(rst0);
5457105Sakito 	} else {
5557105Sakito 		return(ST_ERROR);
5657105Sakito 	}
5757105Sakito 
5857105Sakito 	return(ST_NORMAL);
5957105Sakito }
60