comparison libpwon/duart28c.c @ 736:7d1df6d831e4

libpwon: added -Pdtr and -Prts support for DUART28C
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 16 Sep 2020 03:40:51 +0000
parents
children
comparison
equal deleted inserted replaced
735:5b8287c655cf 736:7d1df6d831e4
1 #include <sys/types.h>
2 #include <sys/ioctl.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <strings.h>
7 #include <unistd.h>
8
9 extern int target_fd;
10
11 int bootctrl_duart28c_mode;
12 static int mctl_arg;
13
14 bootctrl_check_duart28c(bc_name)
15 char *bc_name;
16 {
17 if (!strcmp(bc_name, "dtr")) {
18 bootctrl_duart28c_mode = 1;
19 mctl_arg = TIOCM_DTR;
20 return 1;
21 }
22 if (!strcmp(bc_name, "rts")) {
23 bootctrl_duart28c_mode = 1;
24 mctl_arg = TIOCM_RTS;
25 return 1;
26 }
27 return 0;
28 }
29
30 void
31 fork_duart28c_pulse()
32 {
33 int i;
34
35 i = fork();
36 if (i < 0) {
37 perror("fork");
38 exit(1);
39 }
40 if (i)
41 return;
42 ioctl(target_fd, TIOCMBIS, &mctl_arg);
43 usleep(50000);
44 ioctl(target_fd, TIOCMBIC, &mctl_arg);
45 exit(0);
46 }