1. Every device driver must have one main entry point, This entry point is called DriverEntry in Windows
2. In windows, it uses INF file to associate the device with the driver. "The
operating system recognizes the device, looks up in its database which INF file is associated with the device, and according to the INF file, calls the driver's entry point"
3. The applications communicate with the drivers using a file access API,Applications open a handle to the driver using CreateFile call (in Windows), with the name of the device as the file name.
In order to read from and write to the device, the application calls ReadFile and WriteFile (in Windows)
Sending requests is accomplished using an I/O control call, called DeviceIoControl (in Windows)
The data passed between the driver and the application is encapsulated into a structure. In Windows, this structure is called an I/O Request Packet (IRP), and is encapsulated by the I/O Manager.
Windriver Usage:
1. Logging the windriver API calls (check it later)
2. Code generated by Windriver(from post 1):
- siigx_lib.h (contains typedefinitions and functions declarations for the API created for you by the DriverWizard)
- siigx_lib.c (Contains the implementation of the functions used for accessing each of the resources defined in the Wizard)
- siigx_diag.c (includes a main function and implements a sample diagnostics application that utilizes the generated DriverWizard API to communicate with your device)
PCI Express:
- PCI Express consists of serial, point-to-point wired, individually clocked 'lanes', each lane consisting of two pairs of data lines that can carry data upstream and downstream simultaneously (full-duplex)
- The bus slots are connected to a switch that controls the data flow
on the bus. A connection between a PCI Express device and a PCI Express switch is called a 'link'. Each link is composed of one or more lanes. - The PCI Express architecture allows for a maximum bandwidth of approximately 500MB/s per lane
Advanced Issues:
- DMA is a capability provided by some computer bus architectures,which allows data to be sent directly from an attached device to the memory on the host, freeing the CPU from involvement with the data transfer and thus improving the host's performance.
- A DMA buffer can be allocated in two ways:
2. Scatter/Gather: The allocated buffer can be fragmented in the physical memory and does not need to be allocated contiguously. but mapped to a contiguous buffer in the calling process's virtual address space
- The programming of a device's DMA controller is hardware specific. Normally, you need to program your device with the local address (on your device), the host address (the physical memory address on your PC) and the transfer count (the size of the memory block to transfer), and then set the register that initiates the transfer
- Come back and check the DMA coding
Notes:
Check out the windriver's custom API that support for Altera chipset.
No comments:
Post a Comment