Comprehensive guide to writing device drivers under the VxWorks operating system, it is very detailed, the file is small, but very clear, making it a good reference book for driver developers.
Click “Read the original text” to download this e-book, sourced from the internet, for learning purposes only.
VxWorks is a commonly used embedded hard real-time operating system, which has applications in many fields. However, since the source code of the VxWorks operating system is not publicly available, although the documentation explains various driver designs, many practical problems still arise. This book is written based on the author’s driver experience, combined with some official documents and source code provided by Wind River, providing a detailed introduction and analysis of various types of device drivers under VxWorks, serving as a guide for device driver design under VxWorks. Additionally, it provides a detailed analysis of various types of VxWorks boot methods and image file composition, clarifying many doubts that VxWorks BSP developers may have.
Contents of the Book
The book is divided into 11 chapters, with the following content:
Chapter 1 briefly introduces embedded systems and provides a brief explanation of the characteristics of the VxWorks operating system.
Chapter 2 provides a detailed introduction to several main components of the VxWorks operating system, including tasks, task scheduling, inter-task communication, memory management, and interrupt handling. We do not translate official documents, but share insights based on the author’s experience.
Chapter 3 analyzes the types of VxWorks kernel images and boot methods in detail and provides an in-depth analysis and introduction to the bootrom used in the download method, followed by a review of the VxWorks operating system startup process. This chapter will clarify many questions readers have regarding VxWorks startup.
Chapter 4 discusses the basic functions and structure of driver programs, introducing some common strategies and considerations in driver programming.
Chapter 5 introduces the kernel structure hierarchy of VxWorks device drivers, focusing on the IO subsystem and its maintenance of three system tables, and introduces the usage of several commonly used drivers under VxWorks with code examples.
Chapter 6 begins the design of specific device drivers, starting with the simplest ordinary character device driver, using an SPI interface driver code as an example, focusing on the structure, design method, and specific implementation of ordinary character device drivers.
Chapter 7 provides a detailed analysis of serial port driver design and implementation. Serial ports are also a type of character device, and due to their commonality, the VxWorks kernel provides a TTY intermediate layer to improve the efficiency of serial port driver design and reduce its complexity.
Chapter 8 enters into the design and implementation analysis of the second major category of devices – block device drivers. We will analyze the basic structure of block device drivers starting from data structures, and discuss their specific implementation. Block device drivers under VxWorks operate in a special way, using blocking read and write methods, unlike the interrupt read and write methods found in general operating systems, which is related to the unique working environment of VxWorks.
Chapter 9 provides a detailed introduction to FLASH device drivers. Flash devices are the most common and widely used devices on embedded platforms for storing operating system kernel images and user data. This chapter will explore the aspects involved in Flash device drivers using the TrueFFS intermediate layer provided by the VxWorks kernel.
Chapter 10 enters the design and implementation of the third major category of devices – network device drivers. Due to their unique working methods, the kernel driver hierarchy of network devices is different from the other two categories (character and block devices); they do not belong to the IO subsystem management but work directly under the kernel network stack. To simplify the complexity of network device driver design, VxWorks provides the MUX intermediate layer. The drivers implemented at this level are usually referred to as enhanced network drivers. This chapter also starts from data structures, using the network port driver code from an actual project as an example to gradually complete the design and implementation of network device drivers.
Chapter 11 analyzes the design and implementation of USB device drivers. This chapter first provides a detailed introduction to USB itself, and then clarifies the objects we want to drive. Generally speaking, USB device drivers refer to the drivers for USB host or target machine controllers. Because these drivers are closely coupled with the kernel USB stack, a clear understanding of the kernel USB stack implementation is necessary to successfully complete USB host controller driver development. This chapter first follows a USB class driver layer to track data request paths in the kernel USB stack, analyzing and introducing the key functions called along the path and the data structures used, followed by an introduction to the initialization process of class drivers using Mass Storage class drivers as an example, and the initialization process of host controller drivers using UHCI controller drivers as an example, summarizing the structure of USB host controller drivers and providing the implementation framework of two central functions in the drivers.
Click “Read the original text” to access more VxWorks resources