OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [doc/] [openbsd.sgml] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
2
 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
30
31
 
32
33
OpenBSD TCP/IP Stack port for eCos
34
35
          TCP/IP Networking for eCos
36
          now provides a complete
37
          TCP/IP networking stack, which is derived from a recent
38
          stable release of OpenBSD. The networking support is
39
          fully featured and well tested within the eCos environment.
40
        
41
42
 
43
44
Networking Stack Features
45
Since this networking package is based on BSD code, it is
46
very complete and robust.  The eCos implementation includes support
47
for the following protocols:   
48
49
IPv4
50
UDP
51
TCP
52
ICMP
53
raw packet interface
54
55
These additional features are also present in the package,
56
        but are not supported:
57
58
Berkeley Packet Filter   
59
Multi-cast and uni-cast support, including multi-casting
60
routing   
61
IPv6 
62
      
63
64
65
OpenBSD TCP/IP stack port
66
This document describes how to get started with the OpenBSD
67
TCP/IP network stack. 
68
69
Targets
70
A number of ethernet devices may be supported. The default configuration
71
supports two instances of the interface by default,
72
and you will need to write your own driver instantiation code,
73
and supplemental startup and initialization code,
74
if you should add additional ones.
75
The target for your board will normally be supplied with an
76
ethernet driver, in which case including the network stack and
77
generic ethernet driver package to your build will automatically
78
enable usage of the ethernet device driver.
79
If your target is not supplied with an ethernet
80
driver, you will need to use loopback (see
81
).
82
83
84
<!--<conditionaltext>-->Building the Network Stack
85
Using the Build->Packages dialog,
86
add the packages “Networking”,
87
“OpenBSD TCP/IP Stack”
88
and “Common Ethernet Support”
89
to your configuration.  Their package names
90
are CYGPKG_NET, CYGPKG_NET_OPENBSD_STACK and CYGPKG_NET_ETH_DRIVERS
91
respectively.
92
A short-cut way to do this is by
93
using the “net” template
94
if it is available for your platform.
95
The platform-specific ethernet device driver for your platform
96
will be added as part of the target selection (in the
97
Build->Templates “Hardware” item),
98
along with the
99
PCI I/O subsystem (if relevent) and the appropriate serial device driver.
100
101
For example, the PowerPC MBX target selection adds the package
102
PKG_NET_QUICC_ETH_DRIVERS,
103
and the Cirrus Logic EDB7xxx target selection adds the package
104
CYGPKG_NET_EDB7XXX_ETH_DRIVERS.
105
After this, eCos and its tests can be built exactly as usual.
106
107
By default, most of the network tests are not built.  This
108
is because some of them require manual intervention, i.e. they are
109
to be run “by hand”, and are not suitable for
110
automated testing.  To build the full set of network tests, set
111
the configuration option CYGPKG_NET_BUILD_TESTS “Build
112
networking tests (demo programs)” within “Networking
113
support build options”.
114
115
116
117
118
APIs
119
120
Standard networking
121
The APIs for the standard networking calls such as
122
socket(), recv() and so on, are
123
in header files relative to the top-level
124
include directory, within the standard subdirectories as conventionally
125
found in /usr/include.  For example:
126
127
 install/include/arpa/tftp.h
128
 install/include/netinet/tcpip.h
129
 install/include/sys/socket.h
130
 install/include/sys/socketvar.h
131
 install/include/sys/sockio.h
132
133
134
network.h at the top level
135
defines various extensions, for example the API
136
init_all_network_interfaces(void)
137
described
138
above.  We advise including network.h whether
139
you use these features or not.
140
In general, using the networking code may require definition
141
of two symbols: _KERNEL and __ECOS.  _KERNEL
142
is not normally required; __ECOS is normally required.
143
So add this to your compile lines for files which use the network
144
stack:
145
        -D__ECOS
146
To expand a little, it’s like this because this is
147
a port of a standard distribution external to Red Hat.  One goal
148
is to perturb the sources as little as possible, so that upgrading
149
and maintenance from the external distribution is simplified.  The __ECOS
150
symbol marks out Red Hat’s additions in making the port.
151
The _KERNEL symbol is traditional UNIX practice: it distinguishes
152
a compilation which is to be linked into the kernel from one which
153
is part of an application.  eCos applications are fully linked,
154
so this distinction does not apply.  _KERNEL can however
155
be used to control the visibility of the internals of the stack,
156
so depending on what features your application uses, it may or may
157
not be necessary.
158
The include file network.h undefines _KERNEL
159
unconditionally, to provide an application-like compilation environment.
160
If you were writing code which, for example,
161
enumerates the stack’s internal
162
structures, that is a kernel-like compilation environment, so you
163
would need to define _KERNEL (in addition to __ECOS)
164
and avoid including network.h.
165
166
167
Enhanced Select()
168
The network stack supports an extension to the standard select
169
semantics which allows all threads that are waiting to be restarted
170
even if the select conditions are not satisfied.
171
The standard select() API:  
172
int
173
select(int nfd,
174
       fd_set *in, fd_set *out, fd_set *ex,
175
       struct timeval *tv); 
176
does not support the restart.
177
The additional API:  
178
int
179
cyg_select_with_abort(int nfd,
180
       fd_set *in, fd_set *out, fd_set *ex,
181
       struct timeval *tv)
182
183
behaves exactly as select() with the additional feature that
184
a call to
185
186
void cyg_select_abort(void)
187
188
will cause all threads waiting in any
189
cyg_select_with_abort() call
190
to cease waiting and continue execution.
191
192
193

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.