TAILIEUCHUNG - Embedded FreeBSD Cookbook phần 4

Cơ cấu sysent Mỗi hệ thống gọi trong hạt nhân FreeBSD có một cấu trúc sysent, quy định trong / usr / include / sys / . Cơ cấu sysent có hai yếu tố, số lượng các thông số, mà là hai theo quy định của cấu trúc dumpmem_args, và tên của các chức năng cuộc gọi hệ thống. Ví dụ 3-7 xác định sysent copymem. | 61 Chapter Four Device Driver The sample DIO device driver source contains a shell implementation of both ISA and PCI device drivers. Because the PCI-DIO24 is a PCI card the first modification I made to the DIO source code was to remove all references to the ISA callback functions. Once this was complete I performed a complete build to make sure the remaining code was still correct. DIO Driver Functions The dio_pci_probe Function The first task of the device driver is to detect if its hardware is present. This is called probing the device. Device probing is performed by the probe device method. contains a function for probing a PCI device implemented in the function dio_pci_probe. dio_pci_probe calls the kernel function pci_get_devid to return the Vendor ID and Device ID for this device. pci_get_dev returns a 32-bit long-word of which the upper 16 bits contain the PCI Device ID and the lower 16 bits contains the PCI vendor ID for this card. The following code shows the modifications to the pci_ids structure for the PCI-DIO24. static struct pcsid u int32 t type const char desc pci ids 0x00281307 Measurement Computing PCI-DIO24 Digital I O Card 0x00000000 NULL The DIO device driver can now be built and loaded and it successfully recognizes the PCI-DIO24 card. The complete dio_pci_probe function is listed below. static int dio_pci_probe device_t device u_int32_t type pci_get_devid device struct pcsid ep pci ids while ep- type ep- type type 62 Embedded FreeBSD Cookbook ep if ep- desc device set desc device ep- desc return 0 If there might be a better driver return -2 else return ENXIO dio_pci_probe scans the pci_ids structure in an attempt to match the vendor and device IDs. When a match is found the verbal description of the device is updated using the kernel function device_set_desc. TIP FreeBSD has a utility that dumps information about PCI devices called pciconf. Utilities such as pciconf are used for debugging and verifying your hardware is working correctly

TỪ KHÓA LIÊN QUAN
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.