Sending SRBs to ATAPI devices from user mode

I’m developing an small RTOS to run on custom hardware which needs to read
FAT volumes on ATAPI devices. I’d like to be able to prototype and debug
the filesystem part of it on Windows first. Does anybody know of an easy
way I can send raw CDBs or SRBs straight to the ATAPI hardware from user
mode? For example, can I CreateFile on ??\IdePort0 or something and then
WriteFile SRBs to it? Something similar?

I’ve done this on past versions of Windows using ASPI but it seems ASPI no
longer supports ATAPI devices on Windows 2000/XP.

I know its a little of-topic but any advice would be greatly appreciated.
Thanks.

Hi!

You can still do it with ASPI,

depending on your installed ASPI Layer and settings.

If you are using Adaptec?s ASPI Layer you may have to

set in the registry “ExcludeMiniports”=“” at

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32\Parameters

to get the ATAPI devices visible.

On the other hand you can use SPTI to send SRBs

like you described.

The only disadvantage of SPTI from user mode is that

your program need Administrator privileges to do it.

Maybe someone else here knows an easy way to

circumvent this necessity

Best regards

Nik

At 25.06.2003 05:52, you wrote:

I’m developing an small RTOS to run
on custom hardware which needs to read

FAT volumes on ATAPI devices. I’d like to be able to prototype and
debug

the filesystem part of it on Windows first. Does anybody know of an
easy

way I can send raw CDBs or SRBs straight to the ATAPI hardware from
user

mode? For example, can I CreateFile on ??\IdePort0 or something and
then

WriteFile SRBs to it? Something similar?

I’ve done this on past versions of Windows using ASPI but it seems ASPI
no

longer supports ATAPI devices on Windows 2000/XP.

I know its a little of-topic but any advice would be greatly
appreciated.

Thanks.



You are currently subscribed to ntfsd as: nw@ra-wiesel.de

To unsubscribe send a blank email to xxxxx@lists.osr.com

I read about this ExcludeMiniports business but it doesn't seem to make any
difference with the latest ASPI on Windows XP. What's the latest combination
of ASPI and Windows you've had this working with?

Looks like the src\storage\class\spti branch of the DDK has what I need. I
just didn't know that SPTI was the term for it.

Thanks for your help.
Richard
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Nikolaus Wiesel
Sent: Wednesday, 25 June 2003 6:46 PM
To: File Systems Developers
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode

Hi!

You can still do it with ASPI,
depending on your installed ASPI Layer and settings.
If you are using Adaptec?s ASPI Layer you may have to
set in the registry "ExcludeMiniports"="" at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32\Parameters
to get the ATAPI devices visible.

On the other hand you can use SPTI to send SRBs
like you described.

The only disadvantage of SPTI from user mode is that
your program need Administrator privileges to do it.
Maybe someone else here knows an easy way to
circumvent this necessity

Best regards

Nik

At 25.06.2003 05:52, you wrote:

I'm developing an small RTOS to run on custom hardware which needs to
read
FAT volumes on ATAPI devices. I'd like to be able to prototype and debug
the filesystem part of it on Windows first. Does anybody know of an easy
way I can send raw CDBs or SRBs straight to the ATAPI hardware from user
mode? For example, can I CreateFile on ??\IdePort0 or something and then
WriteFile SRBs to it? Something similar?

I've done this on past versions of Windows using ASPI but it seems ASPI
no
longer supports ATAPI devices on Windows 2000/XP.

I know its a little of-topic but any advice would be greatly
appreciated.
Thanks.


You are currently subscribed to ntfsd as: nw@ra-wiesel.de
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
To unsubscribe send a blank email to xxxxx@lists.osr.com

This works properly with Adaptec?s ASPI Layer

version 4.57 or Version 4.60 with any Windows Version

ranging from Windows 95 to Windows XP.

The only disadvantage I detected (especially with 4.60)

under XP is that calling the ASPI function to get the

hostadapter info may deliver the hostadapter name without

a terminating zero. This is obviously a bug that happens

on XP quite often with the 4.60 and seldomly with the

4.57. (For me the 4.57 looks best)

I can not advice you to use the XP version of adaptec?s

ASPI Layer because it seems to support only a subset of

the functions of the 4.57 and 4.6.

Ragarding SPTI I would like to ask the others here

to describe an easy way to circumvent the necessity

for having administrator privilege at execution time.

Best regards

Nik

At 25.06.2003 11:00, you wrote:

I
read about this ExcludeMiniports business but it doesn’t seem to make any
difference with the latest ASPI on Windows XP. What’s the latest
combination of ASPI and Windows you’ve had this working
with?



Looks like the
src\storage\class\spti branch of the DDK has what I need. I just didn’t
know that SPTI was the term for it.



Thanks for your
help.

Richard


-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On
Behalf Of Nikolaus Wiesel
Sent: Wednesday, 25 June 2003 6:46 PM
To: File Systems Developers
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user
mode


Hi!

You can still do it with ASPI,
depending on your installed ASPI Layer and settings.
If you are using Adaptec?s ASPI Layer you may have to
set in the registry "ExcludeMiniports"="" at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32\Parameters
to get the ATAPI devices visible.

On the other hand you can use SPTI to send SRBs
like you described.

The only disadvantage of SPTI from user mode is that
your program need Administrator privileges to do it.
Maybe someone else here knows an easy way to
circumvent this necessity

Best regards

Nik

At 25.06.2003 05:52, you
wrote:

I'm developing an small RTOS to run on custom hardware which needs to
read
FAT volumes on ATAPI devices. I'd like to be able to prototype and
debug
the filesystem part of it on Windows first. Does anybody know of an
easy
way I can send raw CDBs or SRBs straight to the ATAPI hardware from
user
mode? For example, can I CreateFile on ??\IdePort0 or something and
then
WriteFile SRBs to it? Something similar?

I've done this on past versions of Windows using ASPI but it seems
ASPI no
longer supports ATAPI devices on Windows 2000/XP.

I know its a little of-topic but any advice would be greatly
appreciated.
Thanks.

---
You are currently subscribed to ntfsd as: nw@ra-wiesel.de
To unsubscribe send a blank email to xxxxx@lists.osr.com

---
You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
To unsubscribe send a blank email to xxxxx@lists.osr.com

---

You are currently subscribed to ntfsd as: nw@ra-wiesel.de

To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,

Depending on what you are trying to do, but there are many IOCTL's which will enable you to do what you require like IOCTL_CDROM_RAW_READ to read raw sectors of a CD for instance. If they are custom devices with unknown SRB's then you could write a service or a driver which runs under administrative privileges which will forward request from a user mode app.

Ceri

-----Original Message-----
From: Nikolaus Wiesel [mailto:nw@ra-wiesel.de]
Sent: 25 June 2003 10:34
To: File Systems Developers
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode

This works properly with Adaptec?s ASPI Layer
version 4.57 or Version 4.60 with any Windows Version
ranging from Windows 95 to Windows XP.

The only disadvantage I detected (especially with 4.60)
under XP is that calling the ASPI function to get the
hostadapter info may deliver the hostadapter name without
a terminating zero. This is obviously a bug that happens
on XP quite often with the 4.60 and seldomly with the
4.57. (For me the 4.57 looks best)

I can not advice you to use the XP version of adaptec?s
ASPI Layer because it seems to support only a subset of
the functions of the 4.57 and 4.6.

Ragarding SPTI I would like to ask the others here
to describe an easy way to circumvent the necessity
for having administrator privilege at execution time.

Best regards
Nik

At 25.06.2003 11:00, you wrote:

I read about this ExcludeMiniports business but it doesn't seem to make any difference with the latest ASPI on Windows XP. What's the latest combination of ASPI and Windows you've had this working with?

Looks like the src\storage\class\spti branch of the DDK has what I need. I just didn't know that SPTI was the term for it.

Thanks for your help.
Richard
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]On Behalf Of Nikolaus Wiesel
Sent: Wednesday, 25 June 2003 6:46 PM
To: File Systems Developers
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode
Hi!
You can still do it with ASPI,
depending on your installed ASPI Layer and settings.
If you are using Adaptec?s ASPI Layer you may have to
set in the registry "ExcludeMiniports"="" at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32\Parameters
to get the ATAPI devices visible.
On the other hand you can use SPTI to send SRBs
like you described.
The only disadvantage of SPTI from user mode is that
your program need Administrator privileges to do it.
Maybe someone else here knows an easy way to
circumvent this necessity
Best regards
Nik
At 25.06.2003 05:52, you wrote:
I'm developing an small RTOS to run on custom hardware which needs to read
FAT volumes on ATAPI devices. I'd like to be able to prototype and debug
the filesystem part of it on Windows first. Does anybody know of an easy
way I can send raw CDBs or SRBs straight to the ATAPI hardware from user
mode? For example, can I CreateFile on ??\IdePort0 or something and then
WriteFile SRBs to it? Something similar?
I've done this on past versions of Windows using ASPI but it seems ASPI no
longer supports ATAPI devices on Windows 2000/XP.
I know its a little of-topic but any advice would be greatly appreciated.
Thanks.

You are currently subscribed to ntfsd as: nw@ra-wiesel.de
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are currently subscribed to ntfsd as: nw@ra-wiesel.de
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@first4internet.co.uk
To unsubscribe send a blank email to xxxxx@lists.osr.com


This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com http:



This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________ </http:>

“Richard Cartwright” wrote in message
news:xxxxx@ntfsd…
>
> I’m developing an small RTOS to run on custom hardware which needs to read
> FAT volumes on ATAPI devices. I’d like to be able to prototype and debug
> the filesystem part of it on Windows first. Does anybody know of an easy
> way I can send raw CDBs or SRBs straight to the ATAPI hardware from user
> mode? For example, can I CreateFile on ??\IdePort0 or something and then
> WriteFile SRBs to it? Something similar?

OK, maybe there’s a terminology problem here, or maybe you are doing
something a bit different. “ATAPI device” normally describes a device which
attaches to an ATA (IDE) HBA, but uses data structures identical to SCSI
CDBs in a hybrid ATA/SCSI interface. Normally, that’s everything except
disks. The most common being CD/DVD & tape. It is possible to have a FAT
on a CD, but it’s more common to have CDFS or UDFS. So do you have a CD/DVD
(or other ATAPI device) with a FAT FS on it, or do you have an ATA disk with
a FAT formatted partition on it? If you have an ATAPI device, then you need
to know how to write the ATA task file as well as the CDB. If you have an
ATA disk, you only need to write the task file, there’s no CDB involved.

As others have mentioned in this thread, you can use SPTI, but SPTI through
ATAPI has some significant limitations. It should support the various
READ/WRITE CDBs, though I’ve not tested that specifically. If you have the
Windows IFS kit, it has the source to the FAT FS driver. Between that and
the disk driver source in both the IFS kit and DDK, you can see how a
ReadFile() call from user mode is translated to a CDB. You could use that
to learn some things to simplify a lot of your work. Alternatively, you
could use the source from one of the BSDs or from Linux to do the same
thing.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.

Thanks Phil, Ceri, Nikolaus and Maxim for your great advice on this issue.
Sounds like making a user mode service which uses SPTI is a good way to get
around the priviledge issue. However, since I’m mainly interested in
prototyping at this stage, the priviledge restriction is no big issue.

I understand the difference between standard ATA devices which use only the
AT task file and the ATAPI devices which you send SCSI-like CDBs to through
the ATA PACKET command. One of the main media I want to support are FAT
formatted ZIP disks, which I understand do everything using ATAPI packets.
(Or have I misunderstood? Do they use ATAPI packets only for media eject
commands or something?)

So now I know how to talk to ATAPI devices, is there perhaps also a way to
directly read/write non-packet mode ATA devices from user mode at the
Cylinder/Head/Sector level? Is there, for example, a device I can open from
user mode which will give me access to ATA devices near the AT task file
level? If so, can I do it safely without upsetting the drivers sitting above
too much?

Thanks,
Richard Cartwright

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Phil Barila
Sent: Thursday, 26 June 2003 1:49 AM
To: File Systems Developers
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode

“Richard Cartwright” wrote in message
> news:xxxxx@ntfsd…
> >
> > I’m developing an small RTOS to run on custom hardware which
> needs to read
> > FAT volumes on ATAPI devices. I’d like to be able to prototype and debug
> > the filesystem part of it on Windows first. Does anybody know of an easy
> > way I can send raw CDBs or SRBs straight to the ATAPI hardware from user
> > mode? For example, can I CreateFile on ??\IdePort0 or something and then
> > WriteFile SRBs to it? Something similar?
>
> OK, maybe there’s a terminology problem here, or maybe you are doing
> something a bit different. “ATAPI device” normally describes a
> device which
> attaches to an ATA (IDE) HBA, but uses data structures identical to SCSI
> CDBs in a hybrid ATA/SCSI interface. Normally, that’s everything except
> disks. The most common being CD/DVD & tape. It is possible to have a FAT
> on a CD, but it’s more common to have CDFS or UDFS. So do you
> have a CD/DVD
> (or other ATAPI device) with a FAT FS on it, or do you have an
> ATA disk with
> a FAT formatted partition on it? If you have an ATAPI device,
> then you need
> to know how to write the ATA task file as well as the CDB. If you have an
> ATA disk, you only need to write the task file, there’s no CDB involved.
>
> As others have mentioned in this thread, you can use SPTI, but
> SPTI through
> ATAPI has some significant limitations. It should support the various
> READ/WRITE CDBs, though I’ve not tested that specifically. If
> you have the
> Windows IFS kit, it has the source to the FAT FS driver. Between that and
> the disk driver source in both the IFS kit and DDK, you can see how a
> ReadFile() call from user mode is translated to a CDB. You could use that
> to learn some things to simplify a lot of your work. Alternatively, you
> could use the source from one of the BSDs or from Linux to do the same
> thing.
>
> Phil
> –
> Philip D. Barila
> Seagate Technology, LLC
> (720) 684-1842
> As if I need to say it: Not speaking for Seagate.
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

“Richard Cartwright” wrote in message
news:xxxxx@ntfsd…
>
> I understand the difference between standard ATA devices which use only
the
> AT task file and the ATAPI devices which you send SCSI-like CDBs to
through
> the ATA PACKET command. One of the main media I want to support are FAT
> formatted ZIP disks, which I understand do everything using ATAPI packets.
> (Or have I misunderstood? Do they use ATAPI packets only for media eject
> commands or something?)

Is this Zip drive attached to ATA, or to USB? I assume ATA for the rest of
this message, but it’s a legitimate question, and most of what I’m going to
say doesn’t apply to USB. As far as whether the Zip is ATA or ATAPI, I
don’t know. I’ve always assumed it’s ATAPI, but I don’t have one available
to test that assumption. There aren’t any hybrid devices, they’re either
ATA or ATAPI. If it’s ATAPI, everything execpt IDENTIFY (and a few others)
is a packet command. If I were you, I’d get myself a bus analyzer, such as
a Bus Doctor. You can determine which it is in less than a minute with one
of those. More importantly, the analyzer will be immeasurably valuable in
debugging your code that twiddles the registers on the device.

> So now I know how to talk to ATAPI devices, is there perhaps also a way to
> directly read/write non-packet mode ATA devices from user mode at the
> Cylinder/Head/Sector level? Is there, for example, a device I can open
from
> user mode which will give me access to ATA devices near the AT task file
> level? If so, can I do it safely without upsetting the drivers sitting
above
> too much?

Nope. Unless you can use Windows Server 2003, you don’t have a way to
directly access the registers. Ask Microsoft to port the ATA_PASS_THROUGH
interface to XP & 2000. Until then, you can use Read/WriteFile to do direct
sector access, so you can write some wrappers to isolate your FS code from
the underlying OS implementation. Program your FS to that wrapper
interface, then implement that interface in your RTOS. Then you don’t care
whether you are talking to an ATA or ATAPI device, you solve that problem in
your interface layer. The normal modes of ATAPI are pretty easy to deal
with, it’s the exceptional stuff that’s messier. Just like every other
programming problem, I suppose. :slight_smile:

You might be able to forget CHS, it’s a fictional abstraction in today’s
drives. If you really think you need it, the standard way of contriving a
geometry is to take the maximum sectors/track value & multiply by the
maximum number of heads, and divide the maximum LBA by that number. That
gives you the number of virtual cylinders. FAT & NTFS do this, but I don’t
think they need to, I think it’s a legacy thing. Then again, there might be
some useful function to it that I haven’t imagined.

Again, study the disk sources in the DDK, and if you are intending to access
a FAT partition, use the FAT source from somewhere, such as the IFS Kit, or
one of the open source OSes, to make sure you understand what you need to
do. FAT’s pretty well documented, so that part shouldn’t be too hard.

You are actually making it harder to do your prototype by trying to use
Windows as it’s available today, unless you use Server 2K3. Either use a
BSD or Linux (retch) and you can lift the FAT code directly from them and
use it, more or less, as is.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.

For a prototype, why lock the FS and then use ReadFile from “C:”? By
far simpler then SPTI.

Max

----- Original Message -----
From: “Richard Cartwright”
To: “File Systems Developers”
Sent: Thursday, June 26, 2003 6:38 AM
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode

> Thanks Phil, Ceri, Nikolaus and Maxim for your great advice on this
issue.
> Sounds like making a user mode service which uses SPTI is a good way
to get
> around the priviledge issue. However, since I’m mainly interested in
> prototyping at this stage, the priviledge restriction is no big
issue.
>
> I understand the difference between standard ATA devices which use
only the
> AT task file and the ATAPI devices which you send SCSI-like CDBs to
through
> the ATA PACKET command. One of the main media I want to support are
FAT
> formatted ZIP disks, which I understand do everything using ATAPI
packets.
> (Or have I misunderstood? Do they use ATAPI packets only for media
eject
> commands or something?)
>
> So now I know how to talk to ATAPI devices, is there perhaps also a
way to
> directly read/write non-packet mode ATA devices from user mode at
the
> Cylinder/Head/Sector level? Is there, for example, a device I can
open from
> user mode which will give me access to ATA devices near the AT task
file
> level? If so, can I do it safely without upsetting the drivers
sitting above
> too much?
>
> Thanks,
> Richard Cartwright
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Phil Barila
> > Sent: Thursday, 26 June 2003 1:49 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode
> >
> >
> > “Richard Cartwright” wrote in message
> > news:xxxxx@ntfsd…
> > >
> > > I’m developing an small RTOS to run on custom hardware which
> > needs to read
> > > FAT volumes on ATAPI devices. I’d like to be able to prototype
and debug
> > > the filesystem part of it on Windows first. Does anybody know of
an easy
> > > way I can send raw CDBs or SRBs straight to the ATAPI hardware
from user
> > > mode? For example, can I CreateFile on ??\IdePort0 or something
and then
> > > WriteFile SRBs to it? Something similar?
> >
> > OK, maybe there’s a terminology problem here, or maybe you are
doing
> > something a bit different. “ATAPI device” normally describes a
> > device which
> > attaches to an ATA (IDE) HBA, but uses data structures identical
to SCSI
> > CDBs in a hybrid ATA/SCSI interface. Normally, that’s everything
except
> > disks. The most common being CD/DVD & tape. It is possible to
have a FAT
> > on a CD, but it’s more common to have CDFS or UDFS. So do you
> > have a CD/DVD
> > (or other ATAPI device) with a FAT FS on it, or do you have an
> > ATA disk with
> > a FAT formatted partition on it? If you have an ATAPI device,
> > then you need
> > to know how to write the ATA task file as well as the CDB. If you
have an
> > ATA disk, you only need to write the task file, there’s no CDB
involved.
> >
> > As others have mentioned in this thread, you can use SPTI, but
> > SPTI through
> > ATAPI has some significant limitations. It should support the
various
> > READ/WRITE CDBs, though I’ve not tested that specifically. If
> > you have the
> > Windows IFS kit, it has the source to the FAT FS driver. Between
that and
> > the disk driver source in both the IFS kit and DDK, you can see
how a
> > ReadFile() call from user mode is translated to a CDB. You could
use that
> > to learn some things to simplify a lot of your work.
Alternatively, you
> > could use the source from one of the BSDs or from Linux to do the
same
> > thing.
> >
> > Phil
> > –
> > Philip D. Barila
> > Seagate Technology, LLC
> > (720) 684-1842
> > As if I need to say it: Not speaking for Seagate.
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
> > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks again Phil for your advice. My RTOS needs to support floppies (using
a standard UPD765-like controller) and hard disks/CDROMs/Zip disks/CFMs etc
over both SCSI and ATAPI and hard disks using the ATA task file. In other
words, as you assumed I’m not interested in USB.

I assume if Windows has no passthrough interface for the ATA task file it
also has no passthrough interface to send UPD765 commands direct to the
floppy controller? Nothing obvious jumped out at me looking at the DDK’s
source code for the floppy driver, so I’m assuming no. After all, under
normal circumstances none of these things are really safe to do in a
multitasking OS.

I was originally planning to prototype as you suggest (ie CreateFile on the
drive letter and let Windows handle the raw sector reads) but if I can debug
it at the CDB level before I move to the target hardware I’ll be one level
better of. Then I only have to debug the task file “twiddling” on the target
hardware.

I might also look at prototyping on Linux or BSD as you suggest.

Thanks again,
Richard

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Phil Barila
Sent: Friday, 27 June 2003 2:00 AM
To: File Systems Developers
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode

“Richard Cartwright” wrote in message
> news:xxxxx@ntfsd…
> >
> > I understand the difference between standard ATA devices which use only
> the
> > AT task file and the ATAPI devices which you send SCSI-like CDBs to
> through
> > the ATA PACKET command. One of the main media I want to support are FAT
> > formatted ZIP disks, which I understand do everything using
> ATAPI packets.
> > (Or have I misunderstood? Do they use ATAPI packets only for media eject
> > commands or something?)
>
> Is this Zip drive attached to ATA, or to USB? I assume ATA for
> the rest of
> this message, but it’s a legitimate question, and most of what
> I’m going to
> say doesn’t apply to USB. As far as whether the Zip is ATA or ATAPI, I
> don’t know. I’ve always assumed it’s ATAPI, but I don’t have one
> available
> to test that assumption. There aren’t any hybrid devices, they’re either
> ATA or ATAPI. If it’s ATAPI, everything execpt IDENTIFY (and a
> few others)
> is a packet command. If I were you, I’d get myself a bus
> analyzer, such as
> a Bus Doctor. You can determine which it is in less than a
> minute with one
> of those. More importantly, the analyzer will be immeasurably valuable in
> debugging your code that twiddles the registers on the device.
>
> > So now I know how to talk to ATAPI devices, is there perhaps
> also a way to
> > directly read/write non-packet mode ATA devices from user mode at the
> > Cylinder/Head/Sector level? Is there, for example, a device I can open
> from
> > user mode which will give me access to ATA devices near the AT task file
> > level? If so, can I do it safely without upsetting the drivers sitting
> above
> > too much?
>
> Nope. Unless you can use Windows Server 2003, you don’t have a way to
> directly access the registers. Ask Microsoft to port the ATA_PASS_THROUGH
> interface to XP & 2000. Until then, you can use Read/WriteFile
> to do direct
> sector access, so you can write some wrappers to isolate your FS code from
> the underlying OS implementation. Program your FS to that wrapper
> interface, then implement that interface in your RTOS. Then you
> don’t care
> whether you are talking to an ATA or ATAPI device, you solve that
> problem in
> your interface layer. The normal modes of ATAPI are pretty easy to deal
> with, it’s the exceptional stuff that’s messier. Just like every other
> programming problem, I suppose. :slight_smile:
>
> You might be able to forget CHS, it’s a fictional abstraction in today’s
> drives. If you really think you need it, the standard way of contriving a
> geometry is to take the maximum sectors/track value & multiply by the
> maximum number of heads, and divide the maximum LBA by that number. That
> gives you the number of virtual cylinders. FAT & NTFS do this,
> but I don’t
> think they need to, I think it’s a legacy thing. Then again,
> there might be
> some useful function to it that I haven’t imagined.
>
> Again, study the disk sources in the DDK, and if you are
> intending to access
> a FAT partition, use the FAT source from somewhere, such as the
> IFS Kit, or
> one of the open source OSes, to make sure you understand what you need to
> do. FAT’s pretty well documented, so that part shouldn’t be too hard.
>
> You are actually making it harder to do your prototype by trying to use
> Windows as it’s available today, unless you use Server 2K3. Either use a
> BSD or Linux (retch) and you can lift the FAT code directly from them and
> use it, more or less, as is.
>
> Phil
> –
> Philip D. Barila
> Seagate Technology, LLC
> (720) 684-1842
> As if I need to say it: Not speaking for Seagate.
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

You haven’t looked at the source code for the floppy driver that comes with
2000/XP/2003 very much. You can do anything with the FDC’s NEC PD765A
controller using the FDC driver.

“Richard Cartwright” wrote in message
news:xxxxx@ntfsd…
>
> Thanks again Phil for your advice. My RTOS needs to support floppies
(using
> a standard UPD765-like controller) and hard disks/CDROMs/Zip disks/CFMs
etc
> over both SCSI and ATAPI and hard disks using the ATA task file. In other
> words, as you assumed I’m not interested in USB.
>
> I assume if Windows has no passthrough interface for the ATA task file it
> also has no passthrough interface to send UPD765 commands direct to the
> floppy controller? Nothing obvious jumped out at me looking at the DDK’s
> source code for the floppy driver, so I’m assuming no. After all, under
> normal circumstances none of these things are really safe to do in a
> multitasking OS.
>
> I was originally planning to prototype as you suggest (ie CreateFile on
the
> drive letter and let Windows handle the raw sector reads) but if I can
debug
> it at the CDB level before I move to the target hardware I’ll be one level
> better of. Then I only have to debug the task file “twiddling” on the
target
> hardware.
>
> I might also look at prototyping on Linux or BSD as you suggest.
>
> Thanks again,
> Richard
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Phil Barila
> > Sent: Friday, 27 June 2003 2:00 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode
> >
> >
> > “Richard Cartwright” wrote in message
> > news:xxxxx@ntfsd…
> > >
> > > I understand the difference between standard ATA devices which use
only
> > the
> > > AT task file and the ATAPI devices which you send SCSI-like CDBs to
> > through
> > > the ATA PACKET command. One of the main media I want to support are
FAT
> > > formatted ZIP disks, which I understand do everything using
> > ATAPI packets.
> > > (Or have I misunderstood? Do they use ATAPI packets only for media
eject
> > > commands or something?)
> >
> > Is this Zip drive attached to ATA, or to USB? I assume ATA for
> > the rest of
> > this message, but it’s a legitimate question, and most of what
> > I’m going to
> > say doesn’t apply to USB. As far as whether the Zip is ATA or ATAPI, I
> > don’t know. I’ve always assumed it’s ATAPI, but I don’t have one
> > available
> > to test that assumption. There aren’t any hybrid devices, they’re
either
> > ATA or ATAPI. If it’s ATAPI, everything execpt IDENTIFY (and a
> > few others)
> > is a packet command. If I were you, I’d get myself a bus
> > analyzer, such as
> > a Bus Doctor. You can determine which it is in less than a
> > minute with one
> > of those. More importantly, the analyzer will be immeasurably valuable
in
> > debugging your code that twiddles the registers on the device.
> >
> > > So now I know how to talk to ATAPI devices, is there perhaps
> > also a way to
> > > directly read/write non-packet mode ATA devices from user mode at the
> > > Cylinder/Head/Sector level? Is there, for example, a device I can open
> > from
> > > user mode which will give me access to ATA devices near the AT task
file
> > > level? If so, can I do it safely without upsetting the drivers sitting
> > above
> > > too much?
> >
> > Nope. Unless you can use Windows Server 2003, you don’t have a way to
> > directly access the registers. Ask Microsoft to port the
ATA_PASS_THROUGH
> > interface to XP & 2000. Until then, you can use Read/WriteFile
> > to do direct
> > sector access, so you can write some wrappers to isolate your FS code
from
> > the underlying OS implementation. Program your FS to that wrapper
> > interface, then implement that interface in your RTOS. Then you
> > don’t care
> > whether you are talking to an ATA or ATAPI device, you solve that
> > problem in
> > your interface layer. The normal modes of ATAPI are pretty easy to deal
> > with, it’s the exceptional stuff that’s messier. Just like every other
> > programming problem, I suppose. :slight_smile:
> >
> > You might be able to forget CHS, it’s a fictional abstraction in today’s
> > drives. If you really think you need it, the standard way of contriving
a
> > geometry is to take the maximum sectors/track value & multiply by the
> > maximum number of heads, and divide the maximum LBA by that number.
That
> > gives you the number of virtual cylinders. FAT & NTFS do this,
> > but I don’t
> > think they need to, I think it’s a legacy thing. Then again,
> > there might be
> > some useful function to it that I haven’t imagined.
> >
> > Again, study the disk sources in the DDK, and if you are
> > intending to access
> > a FAT partition, use the FAT source from somewhere, such as the
> > IFS Kit, or
> > one of the open source OSes, to make sure you understand what you need
to
> > do. FAT’s pretty well documented, so that part shouldn’t be too hard.
> >
> > You are actually making it harder to do your prototype by trying to use
> > Windows as it’s available today, unless you use Server 2K3. Either use
a
> > BSD or Linux (retch) and you can lift the FAT code directly from them
and
> > use it, more or less, as is.
> >
> > Phil
> > –
> > Philip D. Barila
> > Seagate Technology, LLC
> > (720) 684-1842
> > As if I need to say it: Not speaking for Seagate.
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
>
>

Thanks for the heads-up, I’ll take a closer look.

Richard

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of David J. Craig
Sent: Friday, 27 June 2003 12:06 PM
To: File Systems Developers
Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode

You haven’t looked at the source code for the floppy driver that
comes with
2000/XP/2003 very much. You can do anything with the FDC’s NEC PD765A
controller using the FDC driver.

“Richard Cartwright” wrote in message
> news:xxxxx@ntfsd…
> >
> > Thanks again Phil for your advice. My RTOS needs to support floppies
> (using
> > a standard UPD765-like controller) and hard disks/CDROMs/Zip disks/CFMs
> etc
> > over both SCSI and ATAPI and hard disks using the ATA task
> file. In other
> > words, as you assumed I’m not interested in USB.
> >
> > I assume if Windows has no passthrough interface for the ATA
> task file it
> > also has no passthrough interface to send UPD765 commands direct to the
> > floppy controller? Nothing obvious jumped out at me looking at the DDK’s
> > source code for the floppy driver, so I’m assuming no. After all, under
> > normal circumstances none of these things are really safe to do in a
> > multitasking OS.
> >
> > I was originally planning to prototype as you suggest (ie CreateFile on
> the
> > drive letter and let Windows handle the raw sector reads) but if I can
> debug
> > it at the CDB level before I move to the target hardware I’ll
> be one level
> > better of. Then I only have to debug the task file “twiddling” on the
> target
> > hardware.
> >
> > I might also look at prototyping on Linux or BSD as you suggest.
> >
> > Thanks again,
> > Richard
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com]On Behalf Of Phil Barila
> > > Sent: Friday, 27 June 2003 2:00 AM
> > > To: File Systems Developers
> > > Subject: [ntfsd] Re: Sending SRBs to ATAPI devices from user mode
> > >
> > >
> > > “Richard Cartwright” wrote in message
> > > news:xxxxx@ntfsd…
> > > >
> > > > I understand the difference between standard ATA devices which use
> only
> > > the
> > > > AT task file and the ATAPI devices which you send SCSI-like CDBs to
> > > through
> > > > the ATA PACKET command. One of the main media I want to support are
> FAT
> > > > formatted ZIP disks, which I understand do everything using
> > > ATAPI packets.
> > > > (Or have I misunderstood? Do they use ATAPI packets only for media
> eject
> > > > commands or something?)
> > >
> > > Is this Zip drive attached to ATA, or to USB? I assume ATA for
> > > the rest of
> > > this message, but it’s a legitimate question, and most of what
> > > I’m going to
> > > say doesn’t apply to USB. As far as whether the Zip is ATA
> or ATAPI, I
> > > don’t know. I’ve always assumed it’s ATAPI, but I don’t have one
> > > available
> > > to test that assumption. There aren’t any hybrid devices, they’re
> either
> > > ATA or ATAPI. If it’s ATAPI, everything execpt IDENTIFY (and a
> > > few others)
> > > is a packet command. If I were you, I’d get myself a bus
> > > analyzer, such as
> > > a Bus Doctor. You can determine which it is in less than a
> > > minute with one
> > > of those. More importantly, the analyzer will be
> immeasurably valuable
> in
> > > debugging your code that twiddles the registers on the device.
> > >
> > > > So now I know how to talk to ATAPI devices, is there perhaps
> > > also a way to
> > > > directly read/write non-packet mode ATA devices from user
> mode at the
> > > > Cylinder/Head/Sector level? Is there, for example, a device
> I can open
> > > from
> > > > user mode which will give me access to ATA devices near the AT task
> file
> > > > level? If so, can I do it safely without upsetting the
> drivers sitting
> > > above
> > > > too much?
> > >
> > > Nope. Unless you can use Windows Server 2003, you don’t have a way to
> > > directly access the registers. Ask Microsoft to port the
> ATA_PASS_THROUGH
> > > interface to XP & 2000. Until then, you can use Read/WriteFile
> > > to do direct
> > > sector access, so you can write some wrappers to isolate your FS code
> from
> > > the underlying OS implementation. Program your FS to that wrapper
> > > interface, then implement that interface in your RTOS. Then you
> > > don’t care
> > > whether you are talking to an ATA or ATAPI device, you solve that
> > > problem in
> > > your interface layer. The normal modes of ATAPI are pretty
> easy to deal
> > > with, it’s the exceptional stuff that’s messier. Just like
> every other
> > > programming problem, I suppose. :slight_smile:
> > >
> > > You might be able to forget CHS, it’s a fictional abstraction
> in today’s
> > > drives. If you really think you need it, the standard way of
> contriving
> a
> > > geometry is to take the maximum sectors/track value & multiply by the
> > > maximum number of heads, and divide the maximum LBA by that number.
> That
> > > gives you the number of virtual cylinders. FAT & NTFS do this,
> > > but I don’t
> > > think they need to, I think it’s a legacy thing. Then again,
> > > there might be
> > > some useful function to it that I haven’t imagined.
> > >
> > > Again, study the disk sources in the DDK, and if you are
> > > intending to access
> > > a FAT partition, use the FAT source from somewhere, such as the
> > > IFS Kit, or
> > > one of the open source OSes, to make sure you understand what you need
> to
> > > do. FAT’s pretty well documented, so that part shouldn’t be too hard.
> > >
> > > You are actually making it harder to do your prototype by
> trying to use
> > > Windows as it’s available today, unless you use Server 2K3.
> Either use
> a
> > > BSD or Linux (retch) and you can lift the FAT code directly from them
> and
> > > use it, more or less, as is.
> > >
> > > Phil
> > > –
> > > Philip D. Barila
> > > Seagate Technology, LLC
> > > (720) 684-1842
> > > As if I need to say it: Not speaking for Seagate.
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> >
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@spherical.com.au
> To unsubscribe send a blank email to xxxxx@lists.osr.com