home *** CD-ROM | disk | FTP | other *** search
-
- $Id: CommandHandling,v 1.2 1996/07/15 18:40:09 heinz Exp $
-
- Command Sets for Devices
- ========================
-
- There has always been the problem that people made incompatible
- extensions to the device command set. Doing a low level format on a
- TD_GETGEOMETRY trackdisk command is probably the worst example for
- this that anyone can think of.
-
- Amiga Technologies intends to solve this problem now by specifing
- new rules that EVERY device has to adhere if it wants to be
- compatible to any OS release beyond OS 3.1 (V40).
-
- WARNING!
- ========
-
- If you don't follow these rules when writing or updating a device
- driver, we will have to list your device publically as violating the
- Amiga Technologies programming standards! And it will most likely
- cause a system crash, which most likely isn't satisfactory for your
- customers!
-
-
- The four golden Rules for Device development
- ============================================
-
- Rule #1: Support IOERR_NOCMD
- ----------------------------
-
- In 1991, Commodore specified publically and in writing that any
- Exec style device must return IOERR_NOCMD on any unknown command
- value [RKM Libraries, 3rd Edition, page 924]. Note that this
- specification was for compatibility to OS 2.0 and that five years
- have gone by in the meantime. There was enough time to adapt.
-
- Returning IOERR_NOCMD on any unknown command value is a *MUST*!
- If you don't do this, you break things!
-
- Remember, this is an old rule. We can no longer tolerate violations
- of this rule!
-
-
- Rule #2: Don't modify Reserved Command Semantics
- ------------------------------------------------
-
- Up to and including OS 3.1 (V40), custom device commands usually
- started at CMD_NONSTD. Each developer added commands for custom
- device features at will. This lead to messy and incompatible
- devices and strange compatibility tricks to identify device
- capabilities.
-
- As of January 1st, 1996, Amiga Technologies reserves two ranges in
- the set of command values for future enhancements. Only commands as
- specified by Amiga Technologies may be used here. It is illegal for
- a device developer to randomly "add" custom commands or
- command features within these reserved areas!
-
- There are 65536 command values posisble with io_Command:
-
- $0000 - $3fff old style and 3rd party commands
- $4000 - $7fff RESERVED AREA!
- $8000 - $bfff old style and 3rd party commands
- $c000 - $ffff RESERVED AREA!
-
- To say it again: Commands in the reserved areas may only be
- assigned and specified by Amiga Technologies. Any "custom"
- implementation of these commands or other commands in these
- reserved areas is illegal and violates programming standards!
-
- As of this writing, not that many new style commands have been
- defined. The interface to new style commands is described in a
- separate document "NewStyleCommands".
-
-
- Rule #3: Check for new style commands before using them
- -------------------------------------------------------
-
- Have you read "NewStyleCommands" yet? Yes? Then you know that you
- may only use new style commands after checking the device type and
- capabilities via the new style NSCMD_DEVICEQUERY.
-
-
- Rule #4: Check the IORequest you get in OpenDevice
- --------------------------------------------------
-
- Some devices like SANA-II devices need an IORequest that is larger
- than a minium IORequest or a standard IOStdReq. All devices should
- check in their OpenDevice code if the mn_Length field of the passed
- in request structure is of at least the needed minimum size before
- accepting it. A good device will fail to open if the request is
- "too short". Do not check for an exact size as the caller might
- have added some private extensions for convenience. This check need
- not and should not be present in the BeginIO code, just in the
- OpenDevice code of the device. You can't safely handle commands for
- the wrong type of request structure!
-
- Heinz Wrobel
- <heinz@amiga.de>
-