⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sony_motor.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
字号:
#ifndef lintstatic	char sccsid[] = "@(#)sony_motor.c 1.1 92/07/30 SMI";#endif not lint/* * Copyright (c) 1989 by Sun Microsystems, Inc. */#include <stdio.h>#include "sony_codes.h"#include <sys/termios.h>#define ON	1#define OFF	0unsigned charsony_motor_on(device)FILE *device;{	int rci;	unsigned char rc;	if((rci = sony_motor_stat(device)) == ON)		return(MOT_STAT);	/*	 * Motor on takes at least 20s set the serial port 	 * to do a blocking read to be on the safe side	 */	sony_blockingread(device);	putc(MOTOR_ON,device);	if((rc = sony_handshake(device,ACK)) != ACK)		return(rc);	rc = sony_handshake(device,ACK);	sony_settimeout(device, 5);	return(rc);}unsigned charsony_motor_off(device)FILE *device;{	int rci;	unsigned char rc;	if((rci = sony_motor_stat(device)) == OFF)		return(MOT_STAT);	/*	 * Motor off takes about 5s set the serial port 	 * to do a 10s time out 	 */	sony_settimeout(device, 10);	putc(MOTOR_OFF,device);	if((rc = sony_handshake(device,ACK)) != ACK)		return(rc);	rc = sony_handshake(device,ACK);	sony_settimeout(device, 5);	return(rc);}intsony_motor_stat(device)FILE *device;{	int rc;	unsigned char mot_stat[5];	sony_status_inq(device,mot_stat);	if(mot_stat[0]&MOT_STAT)		return(OFF);	else		return(ON);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -