28 Value flowv = pop_value(vm);
37 fprintf(stderr,
"Runtime type error: serial_config expects (int fd, int data_bits, int parity, int stop_bits, int flow_control)\n");
40 int data_bits = (int)
datav.i;
42 int stop_bits = (int)
stopv.i;
43 int flow = (int)flowv.i;
45 struct termios options;
46 if (tcgetattr(
fd, &options) == 0) {
48 options.c_cflag &= ~CSIZE;
51 options.c_cflag |= CS5;
54 options.c_cflag |= CS6;
57 options.c_cflag |= CS7;
61 options.c_cflag |= CS8;
68 options.c_cflag &= ~PARENB;
71 options.c_cflag |= PARENB;
72 options.c_cflag |= PARODD;
75 options.c_cflag |= PARENB;
76 options.c_cflag &= ~PARODD;
82 options.c_cflag |= CSTOPB;
84 options.c_cflag &= ~CSTOPB;
90 options.c_cflag |= CRTSCTS;
92 options.c_cflag &= ~CRTSCTS;
96 if (tcsetattr(
fd, TCSANOW, &options) == 0) {
push_value(vm, make_int(ok))
Tagged union representing a Fun value.
Value make_int(int64_t v)
Construct a Value representing a 64-bit integer.