1 |
786 |
skrzyp |
#ifndef CYGONCE_PPP_PPP_IO_H
|
2 |
|
|
#define CYGONCE_PPP_PPP_IO_H
|
3 |
|
|
// ====================================================================
|
4 |
|
|
//
|
5 |
|
|
// ppp_io.h
|
6 |
|
|
//
|
7 |
|
|
// PPP IO interface
|
8 |
|
|
//
|
9 |
|
|
// ====================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
// ====================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): nickg
|
45 |
|
|
// Contributors: nickg
|
46 |
|
|
// Date: 2003-06-01
|
47 |
|
|
// Purpose: Internal PPP interfaces
|
48 |
|
|
// Description: This header describes the interfaces between
|
49 |
|
|
// the PPP daemon system dependent code in sys-ecos.c
|
50 |
|
|
// and the PPP line-discipline-derived code in ppp_io.c.
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
// ====================================================================
|
55 |
|
|
|
56 |
|
|
#include <pkgconf/system.h>
|
57 |
|
|
#include <pkgconf/net.h>
|
58 |
|
|
#include <pkgconf/io_fileio.h>
|
59 |
|
|
|
60 |
|
|
#include <sys/uio.h>
|
61 |
|
|
|
62 |
|
|
#include <cyg/io/io.h>
|
63 |
|
|
#include <cyg/io/serial.h>
|
64 |
|
|
#include <cyg/io/serial.h>
|
65 |
|
|
|
66 |
|
|
#include <cyg/kernel/kapi.h>
|
67 |
|
|
|
68 |
|
|
#include <cyg/ppp/names.h>
|
69 |
|
|
|
70 |
|
|
#include <cyg/ppp/ppp.h>
|
71 |
|
|
|
72 |
|
|
// ====================================================================
|
73 |
|
|
// Fake TTY structure
|
74 |
|
|
//
|
75 |
|
|
// This is passed into the line discipline code and pretends to be a
|
76 |
|
|
// tty device. In actual fact we use it to store all the state for the
|
77 |
|
|
// connection.
|
78 |
|
|
|
79 |
|
|
struct tty
|
80 |
|
|
{
|
81 |
|
|
// IO device handle.
|
82 |
|
|
cyg_io_handle_t t_handle;
|
83 |
|
|
|
84 |
|
|
// Pointer to softc structure. This is the only field that the
|
85 |
|
|
// ex-BSD code actually accesses.
|
86 |
|
|
void *t_sc;
|
87 |
|
|
|
88 |
|
|
// Pointer to user's options
|
89 |
|
|
const cyg_ppp_options_t *options;
|
90 |
|
|
|
91 |
|
|
// Parameters for PPPD thread
|
92 |
|
|
cyg_handle_t pppd_thread;
|
93 |
|
|
volatile int pppd_wakeup;
|
94 |
|
|
volatile cyg_bool_t pppd_thread_running;
|
95 |
|
|
|
96 |
|
|
// Parameters for transmit thread
|
97 |
|
|
cyg_sem_t tx_sem;
|
98 |
|
|
cyg_handle_t tx_thread;
|
99 |
|
|
volatile cyg_bool_t tx_thread_running;
|
100 |
|
|
|
101 |
|
|
#ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS
|
102 |
|
|
// Serial line control
|
103 |
|
|
cyg_serial_line_status_callback_t serial_callbacks;
|
104 |
|
|
volatile cyg_uint32 carrier_detected;
|
105 |
|
|
#endif
|
106 |
|
|
|
107 |
|
|
// Alarm for implementing wait_input() timeout.
|
108 |
|
|
cyg_handle_t alarm;
|
109 |
|
|
cyg_alarm alarm_obj;
|
110 |
|
|
|
111 |
|
|
};
|
112 |
|
|
|
113 |
|
|
externC struct tty ppp_tty;
|
114 |
|
|
|
115 |
|
|
// ====================================================================
|
116 |
|
|
// This is called at the correct time in the PPPD to set up the
|
117 |
|
|
// options from the user's request. This has to be done after the
|
118 |
|
|
// protocols etc. have intitialized.
|
119 |
|
|
|
120 |
|
|
externC void cyg_ppp_options_install( const cyg_ppp_options_t *options );
|
121 |
|
|
|
122 |
|
|
// ====================================================================
|
123 |
|
|
// Definition of serial callback function. Used for carrier detection
|
124 |
|
|
// etc.
|
125 |
|
|
|
126 |
|
|
#ifdef CYGOPT_IO_SERIAL_SUPPORT_LINE_STATUS
|
127 |
|
|
externC void cyg_ppp_serial_callback( cyg_serial_line_status_t *s,
|
128 |
|
|
CYG_ADDRWORD priv );
|
129 |
|
|
#endif
|
130 |
|
|
|
131 |
|
|
// ====================================================================
|
132 |
|
|
// These are all renamed versions of the PPP line discipline
|
133 |
|
|
// functions. The PPPD code calls these directly to control the PPP
|
134 |
|
|
// driver and to send and receive control packets.
|
135 |
|
|
|
136 |
|
|
extern int cyg_ppp_pppopen __P((struct tty *tp));
|
137 |
|
|
|
138 |
|
|
extern int cyg_ppp_ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, int flag));
|
139 |
|
|
|
140 |
|
|
extern int cyg_ppp_pppinput __P((int c, struct tty *tp));
|
141 |
|
|
|
142 |
|
|
extern int cyg_ppp_pppwrite __P((struct tty *tp, struct uio *uio, int flag));
|
143 |
|
|
|
144 |
|
|
extern int cyg_ppp_pppread __P((struct tty *tp, struct uio *uio, int flag));
|
145 |
|
|
|
146 |
|
|
extern int cyg_ppp_pppclose __P((struct tty *tp, int flag));
|
147 |
|
|
|
148 |
|
|
extern int cyg_ppp_pppcheck __P((struct tty *tp));
|
149 |
|
|
|
150 |
|
|
// ====================================================================
|
151 |
|
|
// Start PPP transmission. This is called from the TX thread to cause
|
152 |
|
|
// any pending packets to be sent.
|
153 |
|
|
|
154 |
|
|
extern int cyg_ppp_pppstart __P((struct tty *tp));
|
155 |
|
|
|
156 |
|
|
// ====================================================================
|
157 |
|
|
#endif // CYGONCE_PPP_PPP_IO_H
|