[haiku-development] Re: S3 Virge video driver

  • From: Philippe Houdoin <philippe.houdoin@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 20 Jul 2007 14:36:34 +0200

Quoting Gerald Zajac <zajacg@xxxxxxxxxxxxx>:

> Since much of the code for the S3 Virge video driver is similar to the
> Savage video driver, I have decided to implement a driver for the Virge
> & Trio 3D video chips.  However, I'm having a problem enabling MMIO.  It
> appears that ISA I/O is needed to enable the MMIO.  I have looked at
> Syllable's Virge driver source file, and it has a "Be Sample Code"
> license;  however, I have not been able to find the original BeOS sample
> code on the web.  Does anyone have a copy of this code or know where I
> can obtain a copy?  It is not in the R5 sample code, and I believe that
> it is probably pre-R4.

It's from R3.
You will find its source code there:
http://public.www.planetmirror.com/pub/beos/samples/drivers/obsolete/VideoDriverKit.zip

Beware, this driver code was following the old app_server's graphics API which
was fully user-land based, the kernel exposing ISA and PCI functions at this
time.
With the R4 and sooner kernel + userland add-ons graphics API, it wont works
anymore...

> Since Syllable has different functions for ISA I/O, I want to see what
> functions were used to enable the MMIO under BeOS and how they were used.

As Jerome already said, you'll need to setup the device PCI configuration to
enable MMIO.
Otherwise, for old ISA I/O, just use the ISA module:

#include <ISA.h>

isa_module_info *isa = NULL;

if (get_module(B_ISA_MODULE_NAME, (module_info *) &isa) != B_OK)
  /* error, no ISA module available */
  return B_ERROR;

Then, to do I/O:

value = isa->read_io_8/16/32(ISA_PORT_ADDRESS);
isa->write_io_8/16/32(ISA_PORT_ADDRESS, value);

Last but not least, don't forget to release ISA module when not used anymore:

put_module(B_ISA_MODULE_NAME);

Hope this help.

- Philippe


Other related posts: