Content Overview
This book provides an in-depth and systematic explanation of the key points and challenges in advanced programming with VxWorks, particularly focusing on POSIX programming, I/O systems, and network application programming, along with numerous practical programming tips. Additionally, it offers detailed insights into new technologies and excellent features that have emerged in VxWorks.
The book consists of 12 chapters covering topics such as the Wind kernel, inter-task communication, POSIX programming, signals, I/O systems, file systems, comprehensive analysis of VxWorks networking, network application programming, network drivers (END), an overview of BSP, VxWorks images, and the VxWorks boot process. The content is rich in detail, with abundant examples and strong readability, making it an invaluable reference for advanced developers working with VxWorks.
Chapter 1 Wind Kernel 1
1.1 Overview of the Kernel 1
1.1.1 Real-time Kernel 1
1.1.2 Microkernel 3
1.1.3 Task Scheduling 5
1.2 Task Attributes 8
1.2.1 Task Control Block (WIND_TCB) 9
1.2.2 Task Stack 10
1.2.3 Error States 12
1.2.4 Hook Functions 14
1.2.5 Task States 16
1.2.6 System Tasks 18
1.3 Kernel Function Interfaces 18
1.3.1 Activating the Kernel 18
1.3.2 Task Creation 19
1.3.3 Task Control 23
1.3.4 Task Termination 27
1.3.5 Task Restart 28
1.3.6 Scheduling Control 31
1.3.7 Other Auxiliary Functions 32
1.4 Multitasking and Function Reentrancy 32
Chapter 2 Inter-task Communication 36
2.1 Overview 36
2.2 Shared Memory 37
2.3 Semaphores 37
2.3.1 Overview 37
2.3.2 Binary Semaphores 42
2.3.3 Mutex Semaphores 42
2.3.4 Counting Semaphores 45
2.3.5 Shared Memory Semaphores 46
2.4 Message Queues 46
2.4.1 Overview 46
2.4.2 Regular Message Queues 51
2.4.3 Shared Memory Message Queues 53
2.4.4 Semaphore and Message Queue Experiments 53
2.5 Pipes 58
2.5.1 Overview 58
2.5.2 Using Pipes 60
2.5.3 Pipe I/O Control 62
2.5.4 Pipe Examples 63
2.6 Signals 67
2.7 Sockets 70
Chapter 3 POSIX Programming 71
3.1 Introduction to POSIX Standards 71
3.2 Clocks and Timers 72
3.2.1 Overview 72
3.2.2 Clocks 75
3.2.3 Timers 75
3.2.4 Watchdogs 78
3.2.5 Examples 79
3.3 Memory Locking 83
3.4 Threads 83
3.4.1 Thread Creation 85
3.4.2 Dynamic Library Initialization 88
3.4.3 Thread-Private Data 90
3.4.4 Thread Mutual Exclusion and Synchronization 94
3.4.5 Thread Termination 102
3.4.6 Thread Cancellation 105
3.5 Task Scheduling 109
3.5.1 Overview 109
3.5.2 Scheduling Policies 110
3.5.3 Scheduling Implementation 112
3.6 Semaphores 116
3.6.1 Overview 116
3.6.2 Initializing Semaphores 118
3.6.3 Basic Semaphore Operations 120
3.6.4 Deleting Semaphores 121
3.7 Message Queues 122
3.7.1 Overview 122
3.7.2 Opening Message Queues 126
3.7.3 Passing Messages 127
3.7.4 Message Arrival Notifications 129
3.7.5 Message Queue Examples 131
Chapter 4 Signals 136
4.1 Overview of Signals 136
4.2 Signal Handling Functions 140
4.3 BSD Signal Interface 141
4.4 POSIX Signal Interface 143
4.4.1 Blocking Signal Sets 144
4.4.2 Signal Handling Functions 145
4.4.3 Synchronous Handling 146
4.5 POSIX 1003.1b Extended Signal Interface 148
4.5.1 Extended Signal Handling Functions 148
4.5.2 Sending Queued Signals 150
4.5.3 Queued Signal Handling 151
4.6 Effects of Signals 153
4.6.1 Interrupts in System Calls 153
4.6.2 Effects on Function Reentrancy 155
Chapter 5 I/O Systems 156
5.1 Overview of I/O Systems 156
5.1.1 I/O System Hierarchy 156
5.1.2 Files, Devices, and Drivers 157
5.2 Basic I/O 159
5.2.1 Standard I/O 160
5.2.2 Opening and Closing 162
5.2.3 Creating and Deleting 163
5.2.4 Reading and Writing 164
5.2.5 File Truncation 165
5.2.6 I/O Control 166
5.3 I/O Multiplexing (Select) 166
5.4 Other I/O 170
5.4.1 Buffered I/O (ansiStdio) 170
5.4.2 Formatted I/O (fioLib) 172
5.4.3 Message Logging (IogLib) 173
5.5 Asynchronous I/O (AIO) 175
5.5.1 AIO Control Blocks 176
5.5.2 AIO Functions 177
5.5.3 Examples Using AIO 182
5.6 Common VxWorks Devices 189
5.6.1 Serial Terminal Devices 189
5.6.2 Pseudo Memory Devices 190
5.6.3 NFS Devices 195
5.6.4 Non-NFS Network File System Devices (netDrv Devices) 197
5.6.5 RAM Disks 198
5.7 Internal Structure of I/O Systems 201
5.7.1 Drivers 202
5.7.2 Devices 204
5.7.3 File Descriptors 206
5.7.4 Block Device Drivers 209
5.8 Serial tty Devices 212
5.8.1 Serial Layering 212
5.8.2 Serial Initialization Process 213
5.8.3 Creating tty Devices 213
5.8.4 tty Input and Output 216
5.8.5 Controlling tty 216
5.9 Writing SCC Drivers 219
5.9.1 tty Data Structures 220
5.9.2 xxDrv Data Structures 223
5.9.3 xxDrv Program Structures 225
5.9.4 Query Support 236
Chapter 6 File Systems 239
6.1 Overview of File Systems 239
6.2 CBIO 239
6.2.1 Basic CBIO 240
6.2.2 CBIO Disk Caching 241
6.2.3 CBIO Volume Devices 243
6.2.4 ioctl 247
6.3 dosFs File System 248
6.3.1 Volume Structure 248
6.3.2 Using dosFs 250
6.3.3 Mounting and Unmounting 255
6.3.4 Files and Directories 255
6.3.5 ioctl 259
6.3.6 Continuous Files 262
6.4 rawFs File System 262
Chapter 7 Comprehensive Analysis of VxWorks Networking 265
7.1 Overview 265
7.1.1 Introduction to TCP/IP Protocol 265
7.1.2 VxWorks Network Stack 266
7.2 Network Data Flow Analysis 269
7.2.1 Network Storage Organization 269
7.2.2 Data Organization 271
7.2.3 Receiving: Data Flow from Driver to Application 273
7.2.4 Sending: Data Flow from Application to Driver 274
7.2.5 Viewing Functions 275
7.3 Remote Access Services 276
7.3.1 Remote Login rlogin and TELNET 276
7.3.2 NFS Server 277
7.3.3 FTP Server 277
7.3.4 NFS Client 278
7.3.5 FTP Client and RSH 278
7.3.6 TFTP Client 278
Chapter 8 Network Application Programming 281
8.1 Overview of Sockets 281
8.2 Special Considerations in Network Programming 283
8.3 Socket Communication Properties 285
8.4 Socket Endpoint Addresses 287
8.4.1 Data Structure Representation 287
8.4.2 Protocol Port Numbers 289
8.4.3 Address Manipulation Functions 289
8.5 Socket Application Framework 290
8.6 Connection-Oriented Socket Applications 292
8.6.1 Creating Sockets 292
8.6.2 Binding Endpoint Addresses 294
8.6.3 Establishing Connections 295
8.6.4 Sending and Receiving on Connected Sockets 301
8.6.5 Closing Connections 303
8.6.6 Connection-Oriented Socket Examples 304
8.7 Connectionless Socket Applications 309
8.7.1 sendto and recvfrom 309
8.7.2 Connectionless Socket Examples 311
8.7.3 Connectionless Sockets and connect 315
8.7.4 Implementing Multicast 317
8.7.5 Implementing Broadcast 323
8.8 Raw Layer Sockets 326
8.8.1 Packet Formats 327
8.8.2 Sending and Receiving 331
8.8.3 Example: Traceroute 333
8.9 Advanced Topics in Socket Applications 340
8.9.1 I/O Control 340
8.9.2 Socket Options 340
8.9.3 I/O Multiplexing 347
8.9.4 Beyond I/O Multiplexing Limits 349
8.9.5 In-depth Low-level Processing 352
Chapter 9 Network Drivers (END) 354
9.1 Network Driver Hierarchy 354
9.1.1 MUX and Protocol Layer Interfaces 354
9.1.2 END Driver and MUX Interfaces 356
9.2 Loading END Drivers 357
Chapter 10 Overview of BSP 360
10.1 BSP Functions 360
10.2 BSP Standard Specifications 361
10.3 BSP Organizational Structure 362
10.4 BSP Support for Host/Target System Cross-Development Environments 363
10.5 BSP Allows Porting of Application Systems to Other Architectures 364
10.6 Templates and References 365
10.7 Considerations in Device Driver Development 365
Chapter 11 VxWorks Images 368
11.1 Symbol Tables 368
11.2 Object Module Format (OMF) 369
11.3 Image Types 370
11.3.1 BSP Boot Images 372
11.3.2 VxWorks System Images 375
Chapter 12 VxWorks Boot Process 377
12.1 Purpose, Strategy, and Process Overview 377
12.2 Boot Phase 379
12.2.1 romInit() 380
12.2.2 romStart() 382
12.2.3 sysInit() 386
12.3 Preparing to Activate the Kernel 387
12.3.1 usrInit() 387
12.3.2 sysHwInit() 388
12.4 Activating the Kernel kernelInit 394
12.5 Root Task: tUsrRoot 395
Click “Read the Original” to download the eBook