TAILIEUCHUNG - Linux Device Drivers-Chapter 3: Char Drivers

Tham khảo tài liệu 'linux device drivers-chapter 3: char drivers', công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 3 Char Drivers The goal of this chapter is to write a complete char device driver. We ll develop a character driver because this class is suitable for most simple hardware devices. Char drivers are also easier to understand than for example block drivers or network drivers. Our ultimate aim is to write a modularized char driver but we won t talk about modularization issues in this chapter. Throughout the chapter we ll present code fragments extracted from a real device driver scull short for Simple Character Utility for Loading Localities. scull is a char driver that acts on a memory area as though it were a device. A side effect of this behavior is that as far as scull is concerned the word device can be used interchangeably with the memory area used by scull. The advantage of scull is that it isn t hardware dependent since every computer has memory. scull just acts on some memory allocated using kmalloc. Anyone can compile and run scull and scull is portable across the computer architectures on which Linux runs. On the other hand the device doesn t do anything useful other than demonstrating the interface between the kernel and char drivers and allowing the user to run some tests. The Design of scull The first step of driver writing is defining the capabilities the mechanism the driver will offer to user programs. Since our device is part of the computer s memory we re free to do what we want with it. It can be a sequential or random-access device one device or many and so on. To make scull be useful as a template for writing real drivers for real devices we ll show you how to implement several device abstractions on top of the computer memory each with a different personality. The scull source implements the following devices. Each kind of device implemented by the module is referred to as a type scullO to scull3 Four devices each consisting of a memory area that is both global and persistent. Global means that if the device is opened multiple times the

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
10    171    3    26-11-2024
28    152    1    26-11-2024
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.