public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Creative 4-speed CDROM driver
  2001-05-29  4:22 Creative 4-speed CDROM driver james
@ 2001-05-28 21:22 ` Alan Cox
  2001-05-29  7:20   ` james
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Cox @ 2001-05-28 21:22 UTC (permalink / raw)
  To: james; +Cc: linux-kernel

> If anyone on the kernel list has written a driver for a CDROM please send me
> mail about how you went about it, did you approach the manufacturer for the
> documentation on the device, if I made a mistake could I ruin my hardware?
> and stuff like that.

For IDE CD-ROM there is a standard. Its about 600 pages long but the best
model is probably to implement scsi over atapi since Minix has some basic scsi
code. Then you can drive all but very old ide cdrom devices as scsi


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Creative 4-speed CDROM driver
  2001-05-29  7:20   ` james
@ 2001-05-28 22:21     ` Alan Cox
  2001-05-29  7:35       ` james
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Cox @ 2001-05-28 22:21 UTC (permalink / raw)
  To: james; +Cc: Alan Cox, linux-kernel

> Unfortunately, I simply do not understand the code for device drivers that
> hackers have written. I don't know where to start and how to make sense of
> the code, to read it line by line and understand what it is doing.

I think the minix book would be a good starting point. From the questions you
are asking you are rather out of your depth. Also some basic info on ATAPI
which is the protocol the CD-ROM devices use.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Creative 4-speed CDROM driver
@ 2001-05-29  4:22 james
  2001-05-28 21:22 ` Alan Cox
  0 siblings, 1 reply; 8+ messages in thread
From: james @ 2001-05-29  4:22 UTC (permalink / raw)
  To: linux-kernel

Hello Kernel Hackers,

Bloody Minix doesn't have a CDROM driver for my CDROM, a Creative Quad
speed. I'm dual booting between Linux and Minix. Linux uses my CDROM no
problems. I am thinking a "generic" CDROM driver might fit the bill for this
CDROM (the system is an old 486DX2/66, 20MB RAM, 500MB HDD + 300MB HDD, 1MB
Diamond Stealth Pro Video card).

Either I can port the Linux CDROM driver to Minix or I have to write my own
device driver. Can anyone help, point me to a place where hackers get the
stuff they need to write device drivers? They obviously know all the
details, like status codes, I/O regions etc. I am not sure if I would use
DMA, but I suppose it doesn't matter all that much.

If anyone on the kernel list has written a driver for a CDROM please send me
mail about how you went about it, did you approach the manufacturer for the
documentation on the device, if I made a mistake could I ruin my hardware?
and stuff like that.

Thanks heaps.
James Buchanan
james@spunkysoftware.com



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Creative 4-speed CDROM driver
  2001-05-28 21:22 ` Alan Cox
@ 2001-05-29  7:20   ` james
  2001-05-28 22:21     ` Alan Cox
  0 siblings, 1 reply; 8+ messages in thread
From: james @ 2001-05-29  7:20 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Can you explain what this meas? Fake an SCSI device and use the SCSI driver
to drive my CDROM? But what about the I/O port regions of memory, and the
IRQ? Aren't they different?

I am new to device drivers, I don't understand what I have to do. I know
that I need to provide a service so I can mount my cdrom and use it, and
that applications can read data from the /dev/cd0/whatever.file file on
Minix.

I need to know what the I/O hex memory area is, what IRQ to use, etc. I also
need to know what functions I have to provide, like:

open(filename, mode)
read(fd, buffer, buffersize, flags) -- how to specify number of byts to
read??

In the device driver code, I need to know what commands are for the ATAPI
CDROM, or how I can do it as an SCSI like you say, like 0x30 put in I/O
address whatever might be to query to see if there is a CD in the drive etc
etc.

This is very confusing. Would I benefit from reading the standards document
you speak of? Where can I download a copy?

How do I handle asynchronous I/O with a driver for a CDROM? Do I identify
each user by the file descriptor when they issue a open() call, like in
subsequent calls to read() they will pass the file descriptor, and I would
have say a list of structures holding the file descriptor, offset where the
last read() was, and so on, if so, what fields do I put in my structures and
so on?

As you can see, I am a newbie to device driver writing. ;) I am trying to
learn by doing.

Unfortunately, I simply do not understand the code for device drivers that
hackers have written. I don't know where to start and how to make sense of
the code, to read it line by line and understand what it is doing.

I am going to take a look at the IDE CDROM driver code in Linux and see if I
can modify the code to work as a device driver for Minix.

Hope you can help me here, I'm really stuck!

:-) Thanks Alan. I see that you are a prominent Linux developer and you know
Linus. What device drivers have you written, or do you concentrate on the
kernel proper?

Cheers mate!
James


----- Original Message -----
From: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
To: <james@spunkysoftware.com>
Cc: <linux-kernel@vger.kernel.org>
Sent: Monday, May 28, 2001 10:22 PM
Subject: Re: Creative 4-speed CDROM driver


> > If anyone on the kernel list has written a driver for a CDROM please
send me
> > mail about how you went about it, did you approach the manufacturer for
the
> > documentation on the device, if I made a mistake could I ruin my
hardware?
> > and stuff like that.
>
> For IDE CD-ROM there is a standard. Its about 600 pages long but the best
> model is probably to implement scsi over atapi since Minix has some basic
scsi
> code. Then you can drive all but very old ide cdrom devices as scsi
>
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Creative 4-speed CDROM driver
  2001-05-28 22:21     ` Alan Cox
@ 2001-05-29  7:35       ` james
  2001-05-29 10:21         ` Francois Romieu
  0 siblings, 1 reply; 8+ messages in thread
From: james @ 2001-05-29  7:35 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Where do I get this basic info on ATAPI? Will I benefit from the IDE
standards document? Where can I get that?

Thanks for your help


----- Original Message -----
From: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
To: <james@spunkysoftware.com>
Cc: "Alan Cox" <alan@lxorguk.ukuu.org.uk>; <linux-kernel@vger.kernel.org>
Sent: Monday, May 28, 2001 11:21 PM
Subject: Re: Creative 4-speed CDROM driver


> > Unfortunately, I simply do not understand the code for device drivers
that
> > hackers have written. I don't know where to start and how to make sense
of
> > the code, to read it line by line and understand what it is doing.
>
> I think the minix book would be a good starting point. From the questions
you
> are asking you are rather out of your depth. Also some basic info on ATAPI
> which is the protocol the CD-ROM devices use.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Creative 4-speed CDROM driver
  2001-05-29  7:35       ` james
@ 2001-05-29 10:21         ` Francois Romieu
       [not found]           ` <015601c0e8de$0e936ba0$c1a5fea9@spunky>
  0 siblings, 1 reply; 8+ messages in thread
From: Francois Romieu @ 2001-05-29 10:21 UTC (permalink / raw)
  To: james; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 401 bytes --]

james@spunkysoftware.com <james@spunkysoftware.com> écrit :
> Where do I get this basic info on ATAPI? Will I benefit from the IDE
> standards document? Where can I get that?

www.t13.org
ww.google.com

It's time consuming but you may see something emerging from your
work in a few monthes if you sacrifice your spare time.

Some of your questions are answered at http://www.tux.org/lkml/

-- 
Ueimor

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Creative 4-speed CDROM driver
  2001-05-30 17:21               ` james
@ 2001-05-30 15:12                 ` Masoud Sharbiani
  0 siblings, 0 replies; 8+ messages in thread
From: Masoud Sharbiani @ 2001-05-30 15:12 UTC (permalink / raw)
  To: james; +Cc: linux-kernel

james@spunkysoftware.com wrote:

> You see, I can't even begin to write one line of code, because I know
> nothing about what I am supposed to do. Sure, I know the basics, I have
> written toy device drivers for Linux, I know how to implement a driver for
> Minix, understand the main loop, handling messages from the Minix kernel,
> how to fill in a device structure correctly with pointers to functions that
> implement the device independant interface, etc. I know this stuff, that's
> not a problem. My problem is what is the I/O address range? Can I access it
> in C? Do I use DMA? When there are commands that can be implemented (set A,
> I'll call them) and another set of functions when the device uses the ATA
> Packet Interface (I'll call them set B) then which set? And the standard of
> ATAPI makes it clear that the Packet Interface is elsewhere, not defined in
> the ATAPI document.


I've got some suggestions for you.
First: be humble (sorry, I don't want to offend you at all) read the 
LKML FAQ. the address is at the very end of this email. it would give 
you the pointers you want. (including books/web pages).

second: bear in mind that Linux driver structure is not like minix. 
minix is Micro kernel, Linux is not. therefore, there is no main loop 
here. you just register the required device specific operations and you 
will receive all open/read/write/ioctl/close requests. (pls. See the 
design of Unix operating system for more information).

third: look for a similar device driver implementation in kernel (well, 
it is learning in the hard way :-) ) .

Good luck,

Masoud


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Creative 4-speed CDROM driver
       [not found]             ` <20010530094004.A14129@se1.cogenit.fr>
@ 2001-05-30 17:21               ` james
  2001-05-30 15:12                 ` Masoud Sharbiani
  0 siblings, 1 reply; 8+ messages in thread
From: james @ 2001-05-30 17:21 UTC (permalink / raw)
  To: Francois Romieu; +Cc: linux-kernel

I think you've mistaken my tone  :-)

I wasn't asking anyone to write the driver for me. But, I am at such a
beginning position that I could pull my hair out for a year just trying to
get an idea where to start, or I can ask someone. I am absolutely prepared
to do the work, however I am not prepared to waste my time looking at
irrelevant things or doing something that results in nothing.

What I am after is for someone to spell it out plain and clear: do this,
then this, then this, whatever these things might be. (Get a book on IBM PC
architecture, contact the manufacturer for a document which is called blah
blah, or whatever these things are). I have all the standards documents now,
and which parts to implement? You can see my problem. I am a beginner, and I
am asking (I hope) fairly simple questions on where I should start, so I can
cut some code and do some learning, get my device working and send the
driver for everyone to download at comp.os.minix.

You see, I can't even begin to write one line of code, because I know
nothing about what I am supposed to do. Sure, I know the basics, I have
written toy device drivers for Linux, I know how to implement a driver for
Minix, understand the main loop, handling messages from the Minix kernel,
how to fill in a device structure correctly with pointers to functions that
implement the device independant interface, etc. I know this stuff, that's
not a problem. My problem is what is the I/O address range? Can I access it
in C? Do I use DMA? When there are commands that can be implemented (set A,
I'll call them) and another set of functions when the device uses the ATA
Packet Interface (I'll call them set B) then which set? And the standard of
ATAPI makes it clear that the Packet Interface is elsewhere, not defined in
the ATAPI document.

I could go around and around in ever decreasing circles until I disappear up
my own arse looking in all the wrong places and pulling my hair out. I am
absolutely determined to write this driver. I will spend a year on it. Big
deal. I have plenty of time. But I need someone who has done this or who
knows how to do it to point me in the right direction so I can do it for
myself. I am no dummy, just the URL to a document will do, I will do the
actual reading and digesting the document.

Problem so far is that I didn't spell it out clearly enough that I am a
beginner, and I had vague and incomprehensible emails from those who know
what they are doing, assuming they are speaking to someone of equal
knowledge. This I am not (although I plan to be, and can be when someone
points me in the right direction.)

Thanks for writing to me. I appreciate your time very much.

James


----- Original Message -----
From: "Francois Romieu" <romieu@cogenit.fr>
To: <james@spunkysoftware.com>
Sent: Wednesday, May 30, 2001 8:40 AM
Subject: Re: Creative 4-speed CDROM driver


james@spunkysoftware.com <james@spunkysoftware.com> écrit :
> How do you think I should go about writing this driver? So the standards
> documents are not the best way to go? What else is there for me to write

I've never said that. They are. I was simply outlining that drivers are
written by people with *some* background in the specific field. If they
don't have it, it takes them time to get it and have a satisfying driver.

It's not a 5 minutes/hours hack except maybe for someone that knows how
Linux/Minix/Atapi/your specific cdrom work. IMHO such a person will be
too busy now for others reasons. Thus, if you want it working, you have
to invest your own time and walk the learning curve. It takes time
however. See ?

--
Ueimor




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-05-30 15:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-29  4:22 Creative 4-speed CDROM driver james
2001-05-28 21:22 ` Alan Cox
2001-05-29  7:20   ` james
2001-05-28 22:21     ` Alan Cox
2001-05-29  7:35       ` james
2001-05-29 10:21         ` Francois Romieu
     [not found]           ` <015601c0e8de$0e936ba0$c1a5fea9@spunky>
     [not found]             ` <20010530094004.A14129@se1.cogenit.fr>
2001-05-30 17:21               ` james
2001-05-30 15:12                 ` Masoud Sharbiani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox