I$Attach

From NitrOS-9
Jump to: navigation, search
Attach Device Attaches a device to the system or verifies device attachment.
OS9 I$Attach 103F 80

Entry Conditions

A access mode

X address of the device name string

Exit Conditions

X updated past device name

U address of the device table entry

Error Output

CC carry set on error

B error code, if any

Additional Information

  • Attach does not reserve the device. It only prepares the device for later use by any process.
  • NitrOS-9 installs most devices automatically on startup. Therefore, you need to use Attach only when installing a device dynamically or when verifying the existence of a device. You need not use the Attach system call to perform routing I/O.
  • The access mode parameter specifies the read and/or write operations to be allowed. These are:

0 = Use any special device capabilities

1 = Read only

2 = Write only

3 = Update (read and write)

  • Attach operates in this sequence:
    1. NitrOS-9 searches the system module to see if any memory contains a device descriptor that has the same name as the device.
    2. NitrOS-9’s next operation depends on whether or not the device is already attached. If NitrOS-9 finds the descriptor and if the device is not already attached, NitrOS-9 link the device’s file manager and device driver. It then places the address of the manager and the driver in a new device table entry. NitrOS-9 then allocates any memory needed by the device driver, and calls the driver’s initialization routine, which initializes the hardware.
    3. If NitrOS-9 finds the descriptor, and if the device is already attached, NitrOS-9 verifies the attachment.