====================================================== Kernel module (device driver) for dt3155 frame grabber ====================================================== This driver is completely rewritten (almost from scratch). Initially I used the linux version found on Internet and it worked well for kernels 2.4.xx. But in the times I had to switch to 2.6.17 because got a new motherboard with Promise PDC20378 disk controller that was not supported in 2.4.xx. As far as I had 2GB of RAM the driver was unstable due to probable interference between the allocator an HIGHMEM, thus I decided to rewrite and adapt it to act as a true PCI compliant character device driver The first thing to do was to design a new allocator based on allocating a configurable number of 4MB chunks of memory, that latter are broken into frame buffers of 768x576 bytes kept in different FIFOs. As far as the driver autoloads as a kernel module during kernel boot, the allocation of 4MB chunks succeeds. Since then the driver is used in the lab and adapted to the changes in the driver interface up to the current kernel (2.6.39). The driver keeps two FIFOs: one for free buffers and one for buffers containing image data. When one start the acquisition (via dedicated ioctl) a buffer is taken from the free fifo and the DMA machine is programed to load image data to it and started. Under completion (during the interrupt), another free buffer is programed into the DMA and the filled in buffer is pushed onto the image data FIFO. The user land is reading image data via regular read system calls from the image data FIFO (in the order of the acquisition). When finishing another ioctl stops the DMA machine and moves all not read image data buffers to the free FIFO. This double buffering permit us to acquire data send them to the application window and write them on HDD in real time (without lost frames on the disk). Sure, there are problems: 1. The device can be opened only once. 2. Reading from the device is not POSIX compliant. If a small user land buffer is used copy_to_user() fills it and the rest of the kernel buffer data is disregarded (and lost). 3. How to mmap the buffer (without faulting for each page). For now all buffer pages are marked as reserved to make remap_pfn_range() happy. I know this is not good. 4. Not tested on a BIG ENDIAN architecture. 5. Many others.... :-)