[okl4-developer] V2 Framework
Nelson Tam
nelson at ok-labs.com
Wed Mar 12 17:21:25 EST 2008
Hi Ryan,
On 11/03/2008, at 1:45 PM, Ryan Heffernan wrote:
> I've been having some headaches trying to figure out how to use the V2
> framework and thought I'd see if you guys could help. Essentially my
> problem is that I'm porting a driver for the gumstix SMC chip that was
> written for an old Iguana with the original driver framework onto the
> new Iguana with V2 framework. <snip>
Just to clarify, are you writing the ethernet driver for the SMC 911x
chip?
> - Do I need to specify a .di interface for my device?
You only need to write a .di interface for device servers. If you're
writing a new class of device drivers, then you'll need to write a
device server also.
Currently in the 1.5.2 release, the following device servers are
available: timer, serial, LCD, and touch screen. If the driver you're
writing doesn't belong to any of these, you'll need to write a new
server _and_ a new driver.
> - the device_create_impl function from the old code returns an
> objref_t
> and does resource allocation (there is no device_add_resource
> function).
> Is this acceptable or do I have to change it to a cap_t and add the
> add_resource function?
You should implement the device_add_resource() function in every class
of device servers, even if it may not do anything useful. But most of
the time it should do something useful.
> - The device_ops structure for my device is quite different than the
> one
> specified in timer_if.h, and I currently just specify my own
> device_ops
> structure to keep it in line with the packet server code that
> initializes and uses the device. Is this ok?
I don't know enough context behind this question to completely
understand your question, but what you said sounds ok.
> - Should i add the device_create() call for the smc driver in the
> devicecore scan_devices function? Or is this only for virtual drivers?
You should add it to devicecore, since your SMC driver written for the
v2 framework will be used the same way as the v2 timer and serial
drivers are.
> - The bus_space_t type used to just be a char * typedef, so to bring
> my
> code up to speed can I just replace bus_space_t assignments with a x =
> make_bus_resource({old assignment value})?
It depends on how you implement the mechanism for writing to the bus,
which in turn depends on what bus you're writing for. If it is memory-
mapped, then setting bus_space_t.obj to the base address will do. If
you need to implement a separate device server to writing to the bus,
then you need to set the tid to the server tid.
I realise this could be a bit confusing and ambiguous for people
dealing with this the first time. We'll try our best to clarify any
questions people may have on this list.
--
(nt)
Nelson Tam
nelson at ok-labs.com
More information about the Developer
mailing list