Table of Contents
Be Developer Classifieds: Be Developer Classified are an opportunity for Be developers to tell each other about projects they're working on, are thinking about working on, or would like to work on. Here's your chance to request assistance on a project, or make your talents known to other projects. For more information, check out the Classified Ads section in the Registered Be Developer area. Hardware Wanted -- BeBox Looking for original configuration BeBox. Used OK. Please contact robinwho@penn.com
BE ENGINEERING INSIGHTS: An Introduction to the Input Server By Hiroshi Lockheimer hiroshi@be.com One of the many upcoming changes in the BeOS is in the world of input devices and events. The Input Server, slated to debut in R4, is a server that deals with all things "input." Specifically, it serves three functions: manages input devices such as keyboards and mice; hosts a stream of events that those devices generate; and dispatches those events that make it through the stream. Managing Input Devices The Input Server is a pretty dumb piece of software. (Cue to
Alex: roll your eyes and say, "What do you expect Hiroshi,
you wrote it.") On its own, the server doesn't know how a
keyboard or a mouse works; it relies on
Generating Input Events Once a There is nothing that prevents an input device from putting
arbitrary data in any of the When an event is ready to be shipped off, an input device
enqueues it into the Input Server's event stream. Some
The Input Event Stream The Input Server's event stream is open for inspection and
alteration by anyone in the system. This is achieved through
another set of add-ons called An input filter add-on is privy to all the events that pass
through the Input Server's event stream. A filter may
inspect, alter, generate, or completely drop input events.
It's similar in some ways to the Interface Kit's
Conclusion With the introduction of loadable input device objects, the Input Server enables the BeOS to be used with a wide variety of input devices (and more than one of them at once too). And with the advent of input filters, the Input Server opens the door to a new class of tricks, hacks, and (gulp) pranks for the creative developer. It's going to be fun.
BE ENGINEERING INSIGHTS: Kernel Driver Tips and Traps By Trey Boudreau trey@be.com This is my first Newsletter article, so let me introduce myself. I'm Trey Boudreau, and I write graphics drivers at Be. Or not exactly "at" Be, since I'm one of a few Be employees not located in either Menlo Park or Paris. That's it for the introduction -- now some content... As anybody who's been around the BeOS awhile knows, graphics
drivers are I could talk about writing R4 graphics drivers, but since you don't have R4 yet that wouldn't be too useful. Instead, how about some handy tips for writing kernel drivers, since I've been doing a lot of that lately. I'll assume you've read the Be Book Device Drivers chapter - http://www.be.com/documentation/be_book/Device%20Drivers/index.html - even if you haven't written a device driver yet. Thread Safety and Such Even though we don't come right out and say it, the exported
entry points to your driver are guaranteed to be executed
sequentially. Said another way, the functions
Interrupt Handlers and Multiple Devices The PowerPC-based machines we support cannot chain (or share)
interrupts, but Intel-based machines can. The API for
installing and removing handlers in R3.x makes installing
interrupt handlers on Intel hardware in the presence of
multiple supported devices more complicated than it first
appears. Here's the API (from typedef bool (*interrupt_handler)(void *data); long install_io_interrupt_handler( long interrupt_number, interrupt_handler handler, void *data, ulong flags); long remove_io_interrupt_handler( long interrupt_number, interrupt_handler handler); And here's the scenario:
Notice that The basic solution is to write the interrupt handler to handle all your supported devices that have the same interrupt number with a single installation of the handler. The easiest way to do this is to install the interrupt handler at driver initialization time, and remove it at driver uninitialization. The more difficult way is to install it at device open and remove at device close, making sure you don't install it twice or remove it before it's finished. Now the good news. In R4, the prototype for the remove function will change to long remove_io_interrupt_handler( long interrupt_number, interrupt_handler handler, void *data); This change is not source compatible but is binary compatible. The remove function first walks the list trying to match handler *and* data (which should always work for drivers using the new API). If no match is found, it walks the list again attempting to match only the handler. Debugging Interrupt Handlers While we're on the subject of interrupt handlers, here are
some tips to help debug them. In his Developer's Workshop
article "Welcome to the Cow...Debugging Device Drivers"
(http://www.be.com/aboutbe/benewsletter/volume_II/Issue21.html#Workshop),
Victor Tsou talked about using kernel debugger commands to
help in the postmortem afterglow. He mentioned using
It's useful to note that In your kernel debugger command output, include the current values of the total trips and individual hits for each of your devices. Whenever you want to check the status of your driver, press Alt+SysReq on Intel machines (Command+PowerKey on Power Macs) to drop into the debugger. On a BeBox, just tap the debugger button on the front panel. write_pci_config() Bug on Intel Unfortunately, we introduced a bug in R3.1 for Intel
the bytes at offsets 0x40, 0x42, and 0x43 are zeroed. The work around for this problem is to do a read-modify-write on the 32-bit aligned word: uint32 val = something; uint32 tmp = read_pci_config(bus,dev,fun,0x40,4); tmp &= 0xffff00ff; tmp |= val << 8; write_pci_config(bus,dev,fun,0x40,4,tmp); This will be fixed in R4, but I don't know if we'll provide a fix for R3.2+ We'll post a notice about the update if we do. The Obligatory R4 Teaser No Newsletter article this close to the R4 release would be
complete without a teaser about new features. In addition to
the new module/bus-based drivers (described by Arve
Hjønnevåg in his Newsletter article "Splitting Device
Drivers and Bus Managers",
,
the driver API sports a few new hooks:
Thanks for Stopping By That about wraps up my premier Newsletter article. Let me remind you as one of the graphics driver guys, if you've got questions about writing graphics drivers for the BeOS, I'm your man. Drop me a note at trey@be.com.
DEVELOPERS' WORKSHOP: BeOS Programming Basics, Part 6 By Eric Shepherd sheppy@be.com "Developers' Workshop" is a weekly feature that provides
answers to our developers' questions, or topic requests.
To submit a question, visit
http://www.be.com/developers/suggestion_box.html.
This week, we're going to relax a little and put together a
nice, simple class for saving program settings to disk. You
can download the source code for this week's project from
the Be FTP site:
ftp://ftp/pub/samples/intro/prefs_article.zip
The The most obvious additions here, beyond the normal BMessage
functionality, are all the We'll be taking advantage of the fact that a Let's have a look at the constructor:
The constructor's primary responsibility here is to open the
preference file and read in the original settings. First,
If all is well, the preference file name is appended to the
path, and the The destructor's job is to save the preferences to disk:
This creates a BFile object, sets the path to the preference
file's pathname (which has been saved in the path field in
the The various Note that the That's the basics of implementing the The whole program (see This code instantiates our Then we call Finally, we update the preferences:
We call That's all there is to it. Since the That's a wrap for this time. We'll move on to our next
project in about six weeks.
The Future of the PC Architecture
Looking back to 1981, when the first IBM PC came out, it's
hard not to wonder how far its DNA will allow it to grow.
Today's dual-processor 450 MHz Pentium II system is a direct
descendant of its 8086-based Apple ][ competitor, down to
the cassette player interface.
The good news is the PC market grew out of a succession of
compatible developments, both hardware and software. The bad
news is today's PC carries with it a certain amount of
baggage. At each step along what now looks like a glorious
road, compromises were made. New technology had to be
grafted onto the existing frame; it had to keep running the
old software and keep supporting the previous generation of
hardware devices.
Look at the back of a PC today, or open the box, and you'll
see a few examples. USB ports must co-exist with serial and
parallel connectors, PCI and older ISA buses fight for space
on the motherboard, and these are but the most visible
examples. Other instances, perhaps more painful ones, are
buried in the chipset and the BIOS.
Today's high-end, yet highly affordable dual processor
system offers yesterday's supercomputer power. How much is
wasted because of the old compatibility layers? How fast
would this dual-processor system be if it were built from
the ground up with today's technology -- and only today's
technology? And how much less would it cost than the current
standard?
So far, the market has answered: the benefits of the
incremental approach outweigh its disadvantages. The PS/2
and ACE attempts to create a *better* PC architecture have
failed against the evolutionary approach. But, just as the
stock market does not go up forever, just as no tree reaches
the sky, the progressive approach is bound to reach its
limit someday.
And why should we care? Shouldn't we stick to our unfinished
knitting? Certainly, but we can't help lifting our gaze from
it and dreaming of even faster and cheaper hardware, even if
we're not really in a position to influence hardware
standards.
Following last week's OPOS argument
(http://www.be.com/aboutbe/benewsletter/volume_II/Issue34.html/#Gassee)
though, imagine a situation where Microsoft managed to
effectively dictate a new PC standard running Windows NT 5.0
at the next WinHEC (Windows Hardware Engineering Conference)
and have it embraced by enough vendors to give it critical
mass. Wouldn't everyone, including our little company,
benefit from such a liberating leap?
A truly perplexing perspective.
1997 Be Newsletters | 1995 & 1996 Be Newsletters Copyright ©1998 Be, Inc. Be is a registered trademark, and BeOS, BeBox, BeWare, GeekPort, the Be logo and the BeOS logo are trademarks of Be, Inc. All other trademarks mentioned are the property of their respective owners. Comments about this site? Please write us at webmaster@be.com. |