Unformatted text preview:

Digression on r/w ‘/proc’ filesSuper VGASVGA ‘Start Address’ parameterHow Start Address worksThe CRT ControllerSVGA incompatibilitySVGA Memory Sequencerpci_find_device()Class DemoToday’s Class ExerciseDigression on r/w ‘/proc’ filesAn application of kernel module programming to Super VGA graphics device controlSuper VGA •Modern graphics cards have lots of vram•Our class machines show only part of it•Screen resolution is 1280 x 1024 ‘pixels’ •Each ‘pixel’ is 32-bits of video memory•Total vram for one full screen: 1280 x 1024 x 4 bytes = 5 megabytes•Our class machines have 32 megabytesSVGA ‘Start Address’ parameter•Our machines use the SiS 315 svga chip•Its ‘Start Address’ governs what we see•It’s a 24-bit value, held in 3 byte-registers•Registers accessible through i/o ports•Kernel code can reprogram these registers•Module-inferface gives application-accessHow Start Address worksVRAMvisibleStart_address = 0VRAMvisibleStart_address = 2048The CRT Controller•Display monitor uses Cathode Ray Tube•It’s operated by SVGA’s CRT Controller •Old design: It has lots of 8-bit registers•Two i/o port-addresses are ‘multiplrexed’•ADDRESS_PORT: 0x03D4•DATA_PORT: 0x03D5•CRTC register 13: start_address[ 7..0 ]•CRTC register 12: start_address[ 15..8 ]SVGA incompatibility•Many features of SVGA are now standard•But vendors add their own ‘extras’•These are NOT programmed identically!•You usually need manufacturer’s manual•But not always easy to get (proprietary)•(We found SiS information in a web email)•Software for SiS chip ‘extras’ non-portableSVGA Memory Sequencer•Sequencer also has lots of 8-bit registers•They’re also accessed via two i/o ports•ADDRESS_PORT: 0x03C4•DATA_PORT: 0x03C5•Seq register 13: start_address[ 23..16 ]•SiS chip uses Seq register 5 as a ‘lock’•Write 0x86 to ‘unlock’ sequencer registerspci_find_device()•Driver must ‘detect’ the SiS SVGA device•SiS chip’s VENDOR_ID is 0x1039•SiS chip’s DEVICE_ID is 0x6325•#include <linux/pci.h>struct pci_dev *devp = NULL;devp = pci_find_device( VENDOR, DEVICE, devp );Class Demo•Module name is ‘sischip.c’•Creates a pseudo-file: ‘proc/sischip’•It’s a binary file (don’t use ‘cat’ command)•File is both readable and writable•Lets application get or set ‘start_address’•Our demo-program is ‘vgascroll.cpp’•It lets us see 16 megabytes of video ramToday’s Class Exercise•Use your knowledge of ‘ioremap()’•Draw an image in the offscreen vram•Run ‘vgascroll’ to see what you’ve


View Full Document

USF CS 635 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?