Initial revision
[jog] / tx-serial-unix.h
1 /* -*-c-*-
2 *
3 * $Id: tx-serial-unix.h,v 1.1 2002/01/25 19:34:45 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 /*----- Revision history --------------------------------------------------*
30 *
31 * $Log: tx-serial-unix.h,v $
32 * Revision 1.1 2002/01/25 19:34:45 mdw
33 * Initial revision
34 *
35 */
36
37 #ifndef TX_SERIAL_UNIX_H
38 #define TX_SERIAL_UNIX_H
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*----- Header files ------------------------------------------------------*/
45
46 #ifdef HAVE_CONFIG_H
47 # include "config.h"
48 #endif
49
50 #ifndef TXPORT_H
51 # include "txport.h"
52 #endif
53
54 /*----- Functions provided ------------------------------------------------*/
55
56 /* --- @txsu_shutdown@ --- *
57 *
58 * Arguments: ---
59 *
60 * Returns: ---
61 *
62 * Use: Restores terminal settings on exit.
63 */
64
65 extern void txsu_shutdown(void);
66
67 extern txport *txsu_create(const char */*file*/, const char */*config*/);
68 extern void *txsu_fetch(void */*txv*/);
69 extern ssize_t txsu_write(txport */*txg*/,
70 const void */*p*/, size_t /*sz*/);
71 extern void txsu_destroy(txport */*txg*/);
72
73 #ifdef TX_LIST
74 static const struct txfile txsu_fv[] = {
75 { "JOGSERIAL", 0 },
76 { 0, "/dev/ttyS0" },
77 };
78
79 static txport_ops txsu_ops = {
80 TX_LIST, "serial-unix", txsu_fv, "9600:8-none-1",
81 txsu_create, txsu_fetch, txsu_write, txsu_destroy
82 };
83 # undef TX_LIST
84 # define TX_LIST &txsu_ops
85 #endif
86
87 /*----- That's all, folks -------------------------------------------------*/
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif