PDA

View Full Version : Which is the best frame work to wirte device Drivers for mac(carbon or cocoa)


varmag
2006-04-25, 06:12
Hi All,
I am new to Mac.
I am going to write Drivers for the an instrument.
After writing the driver I want to call the driver API through JNI (java antive interface).
So please suggest me which frame work I can choose Carbon or Cocoa so that I can easyly invoke the the drivers from JNI.

Thanking You all
varmag

scratt
2006-04-25, 06:17
Wecome to AN..

Can you give me some tips on writing drivers please?

By the way...
A good source is here...

http://www.idevgames.com

..if you are new to Mac, but know something about programming generally.

And maybe here.. http://www.gamedev.net

chucker
2006-04-25, 06:18
Why would you use something so high-level to write a device driver? Don't get me wrong, I'm sure it's possible (I'd recommend Carbon in that case), but I just wouldn't do it at all. I'd write it in C, as purely as humanly possible. Avoids many problems.

Barto
2006-04-25, 06:46
chucker: Carbon and Cocoa can't be used for writing (regular) device drivers - they are GUI frameworks after all. I/O Kit is the framework/service/hack for device drivers on Mac OS X. From what I can tell, varmag is asking whether to access the device using Carbon or Cocoa (through the JNI).

Um, I don't know enough about this area of programming to know. But good luck varmag. ;)

ghoti
2006-04-25, 06:55
JNI doesnt' have anything to do with the framework. There are two sides here, the JNI side, where the functions are called from Java, and the hardware side, where the functions access the hardware. You will need some low-level framework like I/O Kit for the latter, and the former is simply JNI, just like on any other OS.

chucker
2006-04-25, 07:15
chucker: Carbon and Cocoa can't be used for writing (regular) device drivers - they are GUI frameworks after all.

That's not entirely true. I'm not sure about Carbon and too lazy to check, but it's definitely possible to write CLI apps with Cocoa. If you have Xcode Tools installed, running "strings /Developer/Tools/WSMakeStubs" will show you that. CoreFoundation calls, NS* calls, and so on.

I/O Kit is the framework/service/hack for device drivers on Mac OS X.

In most cases, yes, you'll want to use IOKit.

Mr Beardsley
2006-04-25, 10:24
Yes, use IOKit which uses embedded C++. I don't doubt that you'll be able to call your driver from any language you choose, after you've written the actual driver.

Here is some reading to get you started.

http://developer.apple.com/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/index.html

varmag
2006-04-27, 00:32
Hi all, thank u for your quick replies. I hava written the Carbon framework to interact with the device and i am able to control the device.
But i want to invoke the carbon framework from JAVA i.e i want to write a java wrapper for may carbon frame work.
It gives me the flexiblity to invoke the OS specific Driver functions, that is when I am in Windows platfornm Java wrapper that have written will call the windows specific Driver function and when i am in the Mac enviranment it will call the carbon Framwork.

please suggest how to call the carbon frame work functions through JAVA.
Is it possible to write OS independent code from COCOA/Java.

varmag
2006-04-27, 00:37
i have written the driver API in Carbon by including the IOKit frame work.