Page 1 of 1
Driver Implemention
Posted: Thu Feb 15, 2007 8:05 pm
by Tyler
When implementing drivers/specifications (ACPI/ATA/Serial UART etc), would it be best to create a single driver for each version of the specification or create one driver that supports common code and then has seperate portions for all the extras?
Posted: Sun Feb 18, 2007 9:30 am
by Tyler
I really hate to bring up my own topic again, and i apologise if it was simply read and thought too stupid to respond to. Yet, as it is pertenent to this very moment in my development it would be useful to know, before i go developing a single driver for every version of eery specification, if writing a signle driver to cover them all is easy without having to have lots of specialied ares of code in each driver.
Posted: Sun Feb 18, 2007 9:42 am
by Dex
I myself, i always try and keep drivers self contained, even if this means rewriting similar code, but then as i code 100% in asm, size is not a problem.
This to me makes them easier to understand and debug, + makes mod just one part easier etc.
Posted: Sun Feb 18, 2007 10:07 am
by Candy
I would judge it on a per-driver basis, preferring the code to be tailored toward the newest version. I would group revisions that didn't change much and make a split when the interface changed substantially or when the code doesn't end up being portable (or has a design flaw).
In general, group them unless there's a fairly clear reason why the code bases should be separate.
I vouch for designing stuff up front and keeping code bases shared as far as is reasonably possible to do so. When you then do figure out a flaw, you only need to fix it once, instead of in all the code bases. You also strongly reduce the chance that you forget some change.