Browse Source

gc3355: Use lowl-vcom cts/rts functions

Luke Dashjr 12 years ago
parent
commit
d29c220284
2 changed files with 2 additions and 44 deletions
  1. 0 39
      gc3355.c
  2. 2 5
      gc3355.h

+ 0 - 39
gc3355.c

@@ -396,45 +396,6 @@ void gc3355_opt_scrypt_init(int fd)
 	gc3355_send_cmds(fd, initscrypt_ob);
 }
 
-int gc3355_get_cts_status(int fd)
-{
-	int ret;
-	int status = 0;
-#ifdef WIN32
-	GetCommModemStatus(_get_osfhandle(fd), &status);
-	applog(LOG_DEBUG, "Get CTS Status is : %d [Windows: 0 is 1.2; 16 is 0.9]\n", status);
-	ret = (status == 0) ? 1 : 0;
-	return ret;
-#else
-	ioctl(fd, TIOCMGET, &status);
-	ret = (status & 0x20) ? 0 : 1;
-	applog(LOG_DEBUG, "Get CTS Status is : %d [Linux: 1 is 1.2; 0 is 0.9]\n", ret);
-	return ret;
-#endif
-}
-
-void gc3355_set_rts_status(int fd, unsigned int value)
-{
-#ifdef WIN32
-	DCB dcb;
-	memset(&dcb, 0, sizeof(DCB));
-	GetCommState(_get_osfhandle(fd), &dcb);
-	if (value != 0)
-		dcb.fRtsControl = RTS_CONTROL_ENABLE;
-	else
-		dcb.fRtsControl = RTS_CONTROL_DISABLE;
-	SetCommState(_get_osfhandle(fd), &dcb);
-#else
-	int rts_flag = 0;
-	ioctl(fd, TIOCMGET, &rts_flag);
-	if (value != 0)
-		rts_flag |= TIOCM_RTS;
-	else
-		rts_flag &= ~TIOCM_RTS;
-	ioctl(fd, TIOCMSET, &rts_flag);
-#endif
-}
-
 static
 void gc3355_pll_freq_init2(int fd, int pll_freq)
 {

+ 2 - 5
gc3355.h

@@ -57,10 +57,7 @@ void gc3355_open_sha2_unit(int fd, char *opt_sha2_gating);
 extern
 void gc3355_open_scrypt_unit(int fd, int status);
 
-extern
-int gc3355_get_cts_status(int fd);
-
-extern
-void gc3355_set_rts_status(int fd, unsigned int value);
+#define gc3355_get_cts_status(fd)  (get_serial_cts(fd) ? 0 : 1)
+#define gc3355_set_rts_status(fd, val)  set_serial_rts(fd, val)
 
 #endif