Changeset febb47e in rtems
- Timestamp:
- 11/19/98 16:59:38 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- df4eb76e
- Parents:
- 982e295e
- Location:
- doc
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/Make.config
r982e295e rfebb47e 5 5 # 6 6 7 RTEMS_VERSION= 4.0.07 RTEMS_VERSION=19981119 8 8 DOC_INSTALL_BASE=/usr1/tmp/rtemsdoc-$(RTEMS_VERSION) 9 9 -
doc/bsp_howto/network.t
r982e295e rfebb47e 1 @c 2 @c Written by Eric Norum 3 @c 4 @c COPYRIGHT (c) 1988-1998. 5 @c On-Line Applications Research Corporation (OAR). 6 @c All rights reserved. 7 @c 8 @c $Id$ 9 @c 10 11 @chapter Networking Driver 12 13 @section Introduction 14 15 This chapter is intended to provide an introduction to the 16 procedure for writing RTEMS network device drivers. 17 The example code is taken from the `Generic 68360' network device 18 driver. The source code for this driver is located in the 19 @code{c/src/lib/libbsp/m68k/gen68360/network} directory in the RTEMS 20 source code distribution. You should have a copy of this driver at 21 hand when reading the following notes. 22 23 @section Learn about the network device 24 25 Before starting to write the network driver you need to be completely 26 familiar with the programmer's view of the device. 27 The following points list some of the details of the 28 device that must be understood before a driver can be written. 29 30 @itemize @bullet 31 32 @item Does the device use DMA to transfer packets to and from 33 memory or does the processor have to 34 copy packets to and from memory on the device? 35 36 @item If the device uses DMA, is it capable of forming a single 37 outtoing packet from multiple fragments scattered in separate 38 memory buffers? 39 40 @item If the device uses DMA, is it capable of chaining multiple 41 outgoing packets, or does each outgoing packet require 42 intervention by the driver? 43 44 @item Does the device automatically pad short frames to the minimum 45 64 bytes or does the driver have to supply the padding? 46 47 @item Does the device automatically retry a transmission on detection 48 of a collision? 49 50 @item If the device uses DMA, is it capable of buffering multiple 51 packets to memory, or does the receiver have to be restarted 52 after the arrival of each packet? 53 54 @item How are packets that are too short, too long, or received with 55 CRC errors handled? Does the device automatically continue 56 reception or does the driver have to intervene? 57 58 @item How is the device Ethernet address set? How is the device 59 programmed to accept or reject broadcast and multicast packets? 60 61 @item What interrupts does the device generate? Does it generate an 62 interrupt for each incoming packet, or only for packets received 63 without error? Does it generate an interrupt for each packet 64 transmitted, or only when the transmit queue is empty? What 65 happens when a transmit error is detected? 66 67 @end itemize 68 69 In addition, some controllers have specific questions regarding 70 board specific configuration. For example, the SONIC Ethernet 71 controller has a very configurable data bus interface. It can 72 even be configured for sixteen and thirty-two bit data buses. This 73 type of information should be obtained from the board vendor. 74 75 @section Understand the network scheduling conventions 76 77 When writing code for your driver transmit and receive tasks you must 78 take care to follow the network scheduling conventions. All tasks 79 which are associated with networking share various 80 data structures and resources. To ensure the consistency 81 of these structures the tasks 82 execute only when they hold the network semaphore (@code{rtems_bsdnet_semaphore}). 83 Your transmit and receive tasks must abide by this protocol which means you must 84 be careful to avoid `deadly embraces' with the other network tasks. 85 A number of routines are provided to make it easier for your code 86 to conform to the network task scheduling conventions. 87 88 @itemize @bullet 89 90 @item @code{void rtems_bsdnet_semaphore_release(void)} 91 92 This function releases the network semaphore. 93 Your task must call this function immediately before 94 making any blocking RTEMS request. 95 96 @item @code{void rtems_bsdnet_semaphore_obtain(void)} 97 98 This function obtains the network semaphore. 99 If your task has released the network semaphore to allow other 100 network-related tasks to run while your task blocks you must call this 101 function to reobtain the semaphore immediately after the return from the 102 blocking RTEMS request. 103 104 @item @code{rtems_bsdnet_event_receive(rtems_event_set, rtems_option, rtems_interval, rtems_event_set *)} 105 Your task should call this function when it wishes to wait for an event. 106 This function releases the network semaphore, 107 calls @code{rtems_event_receive} to wait for the specified event 108 or events and reobtains the semaphore. 109 The value returned is the value returned by the @code{rtems_event_receive}. 110 111 @end itemize 112 113 @section Write your driver attach function 114 The driver attach function is responsible for configuring the driver 115 and making the connection between the network stack 116 and the driver. 117 118 Driver attach functions take a pointer to an 119 @code{rtems_bsdnet_ifconfig} structure as their only argument. 120 and set the driver parameters based on the 121 values in this structure. If an entry in the configuration 122 structure is zero the attach function chooses an 123 appropriate default value for that parameter. 124 125 126 The driver should then set up several fields in the ifnet structure 127 in the device-dependent data structure supplied and maintained by the driver: 128 129 @table @code 130 @item ifp->if_softc 131 Pointer to the device-dependent data. The first entry 132 in the device-dependent data structure must be an @code{arpcom} 133 structure. 134 135 @item ifp->if_name 136 The name of the device. The network stack uses this string 137 and the device number for device name lookups. The name should not 138 contain digits as these will be assumed to be part of the unit number 139 and not part of the device name. 140 141 142 @item ifp->if_unit 143 The device number. The network stack uses this number and the 144 device name for device name lookups. For example, if 145 @code{ifp->if_name} is @samp{scc}, and @code{ifp->if_unit} is @samp{1}, 146 the full device name would be @samp{scc1}. 147 148 @item ifp->if_mtu 149 The maximum transmission unit for the device. For Ethernet 150 devices this value should almost always be 1500. 151 152 @item ifp->if_flags 153 The device flags. Ethernet devices should set the flags 154 to @code{IFF_BROADCAST|IFF_SIMPLEX}, indicating that the 155 device can broadcast packets to multiple destinations 156 and does not receive and transmit at the same time. 157 158 @item ifp->if_snd.ifq_maxlen 159 The maximum length of the queue of packets waiting to be 160 sent to the driver. This is normally set to @code{ifqmaxlen}. 161 162 @item ifp->if_init 163 The address of the driver initialization function. 164 165 @item ifp->if_start 166 The address of the driver start function. 167 168 @item ifp->if_ioctl 169 The address of the driver ioctl function. 170 171 @item ifp->if_output 172 The address of the output function. Ethernet devices 173 should set this to @code{ether_output}. 174 @end table 175 176 Once the attach function has set up the above entries it must link the 177 driver data structure onto the list of devices by 178 calling @code{if_attach}. Ethernet devices should then 179 call @code{ether_ifattach}. Both functions take a pointer to the 180 device's @code{ifnet} structure as their only argument. 181 182 The attach function should return a non-zero value to indicate that 183 the driver has been successfully configured and attached. 184 185 186 187 188 @section Write your driver start function. 189 This function is called each time the network stack wants to start the 190 transmitter. This occures whenever the network stack adds a packet 191 to a device's send queue and the @code{IFF_OACTIVE} bit in the 192 device's @code{if_flags} is not set. 193 194 For many devices this function need only set the @code{IFF_OACTIVE} bit in the 195 @code{if_flags} and send an event to the transmit task 196 indicating that a packet is in the driver transmit queue. 197 198 199 @section Write your driver initialization function. 200 This function should initialize the device, attach to interrupt handler, 201 and start the driver transmit and receive tasks. The function 202 203 @example 204 rtems_id 205 rtems_bsdnet_newproc (char *name, 206 int stacksize, 207 void(*entry)(void *), 208 void *arg); 209 @end example 210 211 should be used to start the driver tasks. 212 213 Note that the network stack may call the driver initialization function more 214 than once. 215 Make sure you don't start multiple versions of the receive and transmit tasks. 216 217 218 219 @section Write your driver transmit task. 220 This task is reponsible for removing packets from the driver send queue and sending them to the device. The task should block waiting for an event from the 221 driver start function indicating that packets are waiting to be transmitted. 222 When the transmit task has drained the driver send queue the task should clear 223 the @code{IFF_OACTIVE} bit in @code{if_flags} and block until another outgoing 224 packet is queued. 225 226 227 @section Write your driver receive task. 228 This task should block until a packet arrives from the device. If the 229 device is an Ethernet interface the function @code{ether_input} should be called 230 to forward the packet to the network stack. The arguments to @code{ether_input} 231 are a pointer to the interface data structure, a pointer to the ethernet 232 header and a pointer to an mbuf containing the packet itself. 233 234 235 236 237 @section Write your driver interrupt handler. 238 A typical interrupt handler will do nothing more than the hardware 239 manipulation required to acknowledge the interrupt and send an RTEMS event 240 to wake up the driver receive or transmit task waiting for the event. 241 Network interface interrupt handlers must not make any calls to other 242 network routines. 243 244 245 246 @section Write your driver ioctl function. 247 This function handles ioctl requests directed at the device. The ioctl 248 commands which must be handled are: 249 250 @table @code 251 @item SIOCGIFADDR 252 @item SIOCSIFADDR 253 If the device is an Ethernet interface these 254 commands should be passed on to @code{ether_ioctl}. 255 256 @item SIOCSIFFLAGS 257 This command should be used to start or stop the device, 258 depending on the state of the interface @code{IFF_UP} and 259 @code{IFF_RUNNING} bits in @code{if_flags}: 260 @table @code 261 @item IFF_RUNNING 262 Stop the device. 263 264 @item IFF_UP 265 Start the device. 266 267 @item IFF_UP|IFF_RUNNING 268 Stop then start the device. 269 270 @item 0 271 Do nothing. 272 273 @end table 274 @end table 275 276 277 278 @section Write Your Driver Statistic-Printing Function 279 This function should print the values of any statistic/diagnostic 280 counters your driver may use. The driver ioctl function should call 281 the statistic-printing function when the ioctl command is 282 @code{SIO_RTEMS_SHOW_STATS}. 283 284 -
doc/common/setup.texi
r982e295e rfebb47e 11 11 @c 12 12 13 @set RTEMS-RELEASE 4.0.014 @set RTEMS-EDITION 4.0.015 @set RTEMS-VERSION 4.0.016 @set RTEMS-UPDATE-DATE October 27199817 @set RTEMS-UPDATE-MONTH October 199813 @set RTEMS-RELEASE 19981119 14 @set RTEMS-EDITION 19981119 15 @set RTEMS-VERSION 19981119 16 @set RTEMS-UPDATE-DATE November 19 1998 17 @set RTEMS-UPDATE-MONTH November 1998 18 18 19 19 @c -
doc/do_docs
r982e295e rfebb47e 14 14 # Division by access level 15 15 public_docs="user develenv networking posix_users started started_ada" 16 support_docs="${supplements} "16 support_docs="${supplements} bsp_howto" 17 17 partners_docs="posix1003.1 posix1003.1h" 18 18 oar_manuals="ada_user hwapi tools/texi2www \ 19 browseable_rtems posix_users_new bsp_howto"19 browseable_rtems new_chapters" 20 20 21 21 # relnotes is obsolete -
doc/networking/Makefile
r982e295e rfebb47e 50 50 $(BMENU) -p "Preface" \ 51 51 -u "Top" \ 52 -n " Writing RTEMS Network Device Drivers" ${*}.t52 -n "Networking Driver" ${*}.t 53 53 54 54 driver.texi: driver.t Makefile -
doc/networking/networking.texi
r982e295e rfebb47e 77 77 * Preface:: 78 78 * Network Task Structure and Data Flow:: 79 * Writing RTEMS Network Device Drivers::79 * Networking Driver:: 80 80 * Using Networking in an RTEMS Application:: 81 81 * Testing the Driver:: -
doc/posix_users/Makefile
r982e295e rfebb47e 7 7 # 8 8 9 PROJECT=posix_users 9 PROJECT=posix_users_new 10 10 DISTRIBUTION_LEVEL=public 11 11 … … 19 19 COMMON_FILES=../common/cpright.texi 20 20 21 FILES= clock.texi cond.texi key.texi mutex.texi $(PROJECT).texi preface.texi \ 22 sched.texi signal.texi thread.texi $(COMMON_FILES) 21 GENERATED_FILES= \ 22 cancel.texi clock.texi cond.texi \ 23 cspecific.texi device.texi files.texi \ 24 io.texi key.texi memorymgmt.texi message.texi mutex.texi procenv.texi \ 25 process.texi sched.texi semaphores.texi signal.texi systemdb.texi \ 26 thread.texi 27 28 FILES= posix_users.texi preface.texi \ 29 $(COMMON_FILES) $(GENERATED_FILES) 23 30 24 31 INFOFILES=$(wildcard $(PROJECT) $(PROJECT)-*) 25 32 26 info: dirs $( PROJECT)27 cp $(PROJECT) $(PROJECT)-* $(INFO_INSTALL)28 #cp $(PROJECT) $(INFO_INSTALL)33 info: dirs $(FILES) $(PROJECT) 34 # cp $(PROJECT) $(PROJECT)-* $(INFO_INSTALL) 35 cp $(PROJECT) $(INFO_INSTALL) 29 36 30 posix_users: $(FILES)31 $(MAKEINFO) $(PROJECT).texi37 $(PROJECT): $(FILES) 38 $(MAKEINFO) posix_users.texi 32 39 33 40 dvi: $(PROJECT).dvi … … 39 46 40 47 $(PROJECT).dvi: $(FILES) 41 $(TEXI2DVI) $(PROJECT).texi 48 $(TEXI2DVI) posix_users.texi 49 mv posix_users.dvi $(PROJECT).dvi 42 50 43 html: dirs 51 html: dirs $(FILES) 44 52 -mkdir -p $(WWW_INSTALL)/$(PROJECT) 45 53 -cd .. ; gmake headers 46 54 $(TEXI2WWW) $(TEXI2WWW_ARGS) -dir $(WWW_INSTALL)/$(PROJECT) \ 47 $(PROJECT).texi 48 55 posix_users.texi 49 56 50 57 clean: 51 58 rm -f *.o $(PROG) *.txt core *.html 52 59 rm -f *.dvi *.ps *.log *.aux *.cp *.fn *.ky *.pg *.toc *.tp *.vr $(BASE) 53 rm -f $(PROJECT) $(PROJECT)-* _* 60 rm -f $(PROJECT) $(PROJECT)-* _* $(GENERATED_FILES) 54 61 62 process.texi: process.t Makefile 63 $(BMENU) -p "" \ 64 -u "Top" \ 65 -n "" ${*}.t 66 67 procenv.texi: procenv.t Makefile 68 $(BMENU) -p "" \ 69 -u "Top" \ 70 -n "" ${*}.t 71 72 files.texi: files.t Makefile 73 $(BMENU) -p "" \ 74 -u "Top" \ 75 -n "" ${*}.t 76 77 thread.texi: thread.t Makefile 78 $(BMENU) -p "" \ 79 -u "Top" \ 80 -n "" ${*}.t 81 82 signal.texi: signal.t Makefile 83 $(BMENU) -p "" \ 84 -u "Top" \ 85 -n "" ${*}.t 86 87 mutex.texi: mutex.t Makefile 88 $(BMENU) -p "" \ 89 -u "Top" \ 90 -n "" ${*}.t 91 92 cond.texi: cond.t Makefile 93 $(BMENU) -p "" \ 94 -u "Top" \ 95 -n "" ${*}.t 96 97 key.texi: key.t Makefile 98 $(BMENU) -p "" \ 99 -u "Top" \ 100 -n "" ${*}.t 101 102 clock.texi: clock.t Makefile 103 $(BMENU) -p "" \ 104 -u "Top" \ 105 -n "" ${*}.t 106 107 sched.texi: sched.t Makefile 108 $(BMENU) -p "" \ 109 -u "Top" \ 110 -n "" ${*}.t 111 112 io.texi: io.t Makefile 113 $(BMENU) -p "" \ 114 -u "Top" \ 115 -n "" ${*}.t 116 117 device.texi: device.t Makefile 118 $(BMENU) -p "" \ 119 -u "Top" \ 120 -n "" ${*}.t 121 122 cspecific.texi: cspecific.t Makefile 123 $(BMENU) -p "" \ 124 -u "Top" \ 125 -n "" ${*}.t 126 127 semaphores.texi: semaphores.t Makefile 128 $(BMENU) -p "" \ 129 -u "Top" \ 130 -n "" ${*}.t 131 132 memorymgmt.texi: memorymgmt.t Makefile 133 $(BMENU) -p "" \ 134 -u "Top" \ 135 -n "" ${*}.t 136 137 message.texi: message.t Makefile 138 $(BMENU) -p "" \ 139 -u "Top" \ 140 -n "" ${*}.t 141 142 cancel.texi: cancel.t Makefile 143 $(BMENU) -p "" \ 144 -u "Top" \ 145 -n "" ${*}.t 146 147 systemdb.texi: systemdb.t Makefile 148 $(BMENU) -p "" \ 149 -u "Top" \ 150 -n "" ${*}.t 151 -
doc/posix_users/posix_users.texi
r982e295e rfebb47e 1 1 \input ../texinfo/texinfo @c -*-texinfo-*- 2 2 @c %**start of header 3 @setfilename posix_users 3 @setfilename posix_users_new 4 4 @syncodeindex vr fn 5 5 @synindex ky cp … … 40 40 @c variable substitution info: 41 41 @c 42 @c @set LANGUAGE C 42 @c Note: At the moment we do not document the Ada interface but by building 43 @c in the infrastructure Florist support should be simple to add. 44 @set is-C 45 @clear is-Ada 46 @set LANGUAGE C 47 @set STRUCTURE structure 48 @set ROUTINE function 49 @set OR | 50 @set RPREFIX RTEMS_ 51 @set DIRPREFIX rtems_ 43 52 @c the language is @value{LANGUAGE} 44 53 @c NOTE: don't use underscore in the name … … 77 86 78 87 @include preface.texi 79 @include thread.texi88 @include process.texi 80 89 @include signal.texi 90 @include procenv.texi 91 @include files.texi 92 @include io.texi 93 @include device.texi 94 @include cspecific.texi 95 @include systemdb.texi 96 @include semaphores.texi 81 97 @include mutex.texi 82 98 @include cond.texi 99 @include memorymgmt.texi 100 @include sched.texi 101 @include clock.texi 102 @include message.texi 103 @include thread.texi 83 104 @include key.texi 84 @include clock.texi 85 @include sched.texi 105 @include cancel.texi 86 106 @ifinfo 87 107 @node Top, Preface, (dir), (dir) 88 @top posix_users 108 @top posix_users_new 89 109 90 110 This is the online version of the RTEMS POSIX API User's Guide … … 92 112 @menu 93 113 * Preface:: 94 * ThreadManager::114 * Process Creation and Execution Manager:: 95 115 * Signal Manager:: 116 * Process Environment Manager:: 117 * Files and Directories Manager:: 118 * Input and Output Primitives Manager:: 119 * Device- and Class- Specific Functions Manager:: 120 * Language-Specific Services for the C Programming Language Manager:: 121 * System Databases Manager:: 122 * Semaphores Manager:: 96 123 * Mutex Manager:: 97 124 * Condition Variable Manager:: 125 * Memory Management Manager:: 126 * Scheduler Manager:: 127 * Clock Manager:: 128 * Message Passing Manager:: 129 * Thread Manager:: 98 130 * Key Manager:: 99 * Clock Manager:: 100 * Scheduler Manager:: 131 * Thread Cancellation Manager:: 101 132 * Command and Variable Index:: 102 133 * Concept Index:: … … 109 140 @c 110 141 111 @node Command and Variable Index, Concept Index, sched_yield, Top142 @node Command and Variable Index, Concept Index, , Top 112 143 @unnumbered Command and Variable Index 113 144 -
doc/rtems_support.html
r982e295e rfebb47e 20 20 <LI><A HREF="networking/index.html"> 21 21 RTEMS Network Supplement</A> 22 <LI><A HREF="bsp_howto/index.html"> 23 RTEMS BSP and Device Driver Development Guide</A> 22 24 23 25 <LI>CPU Supplements
Note: See TracChangeset
for help on using the changeset viewer.