chiark / gitweb /
infra: Clean up project setup
[jog] / tx-serial-unix.h
1 /* -*-c-*-
2  *
3  * $Id: tx-serial-unix.h,v 1.2 2002/01/30 09:25:15 mdw Exp $
4  *
5  * Unix/POSIX serial port transport
6  *
7  * (c) 2001 Mark Wooding
8  */
9
10 /*----- Licensing notice --------------------------------------------------* 
11  *
12  * This file is part of Jog: Programming for a jogging machine.
13  *
14  * Jog is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  * 
19  * Jog is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  * 
24  * You should have received a copy of the GNU General Public License
25  * along with Jog; if not, write to the Free Software Foundation,
26  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27  */
28
29 #ifndef TX_SERIAL_UNIX_H
30 #define TX_SERIAL_UNIX_H
31
32 #ifdef __cplusplus
33   extern "C" {
34 #endif
35
36 /*----- Header files ------------------------------------------------------*/
37
38 #ifdef HAVE_CONFIG_H
39 #  include "config.h"
40 #endif
41
42 #ifndef TXPORT_H
43 #  include "txport.h"
44 #endif
45
46 /*----- Functions provided ------------------------------------------------*/
47
48 /* --- @txsu_shutdown@ --- *
49  *
50  * Arguments:   ---
51  *
52  * Returns:     ---
53  *
54  * Use:         Restores terminal settings on exit.
55  */
56
57 extern void txsu_shutdown(void);
58
59 extern txport *txsu_create(const char */*file*/);
60 extern int txsu_configure(txport */*txg*/,
61                           const char */*k*/, const char */*v*/);
62 extern void *txsu_fetch(void */*txv*/);
63 extern ssize_t txsu_write(txport */*txg*/,
64                             const void */*p*/, size_t /*sz*/);
65 extern void txsu_destroy(txport */*txg*/);
66
67 #ifdef TX_LIST
68    static const struct txfile txsu_fv[] = {
69      { "JOGSERIAL", 0 },
70      { 0, "/dev/ttyS0" },
71    };
72
73    static txport_ops txsu_ops = {
74      TX_LIST, "serial-unix", txsu_fv,
75      "flow=none;baud=9600;format=8-odd-1;newline=cr",
76      txsu_create, txsu_configure, txsu_fetch, txsu_write, txsu_destroy
77    };
78 #  undef TX_LIST
79 #  define TX_LIST &txsu_ops
80 #endif
81
82 /*----- That's all, folks -------------------------------------------------*/
83
84 #ifdef __cplusplus
85   }
86 #endif
87
88 #endif