Performs data structure allocation and initialization for a communications physical device handler (PDH).
#include <sys/device.h> #include <sys/comio.h>
int ddopen (devno, devflag, chan, extptr)
dev_t devno;
ulong devflag;
int chan;
struct kopen_ext * extptr;
devno | Specifies major and minor device numbers. |
devflag | Specifies the flag word with the following definitions: |
chan | Specifies the channel number assigned by the device handler's ddmpx entry point. |
extptr | Points to the kopen_ext structure. |
The ddopen entry point performs data structure allocation and initialization. Hardware initialization and other time-consuming activities, such as call initialization, are not performed. This call is synchronous, which means it does not return until the ddopen entry point is complete.
For a kernel-mode process, the extptr parameter points to a kopen_ext structure. This structure contains the following fields:
Field | Description |
---|---|
status | The status field may contain additional information about the completion of an open. Besides the status code listed here, the following device-dependent codes can also be returned: |
rx_fn | Specifies the address of a kernel procedure. The PDH calls this procedure
whenever there is a receive frame to be processed. The rx_fn procedure must have the following syntax:
#include </usr/include/sys/comio.h> void rx_fn (open_id, rd_ext_p, mbufptr) ulong open_id; struct read_extension *rd_ext_p; struct mbuf *mbufptr;
The kernel procedure calling the ddopen entry point is responsible for pinning the rx_fn kernel procedure before making the open call. It is the responsibility of code scheduled by the rx_fn procedure to free the mbuf chain. |
tx_fn | Specifies the address of a kernel procedure. The PDH calls this procedure
when the following sequence of events occurs:
The tx_fn procedure must have the following syntax: #include </usr/include/sys/comio.h> void tx_fn (open_id) ulong open_id; The kernel procedure calling the ddopen entry point is responsible for pinning the tx_fn kernel procedure before making the call. |
stat_fn | Specifies the address of a kernel procedure to be called by the PDH
whenever a status block becomes available. This procedure must have the following
syntax:
#include </usr/include/usr/comio.h> void stat_fn (open_id, sblk_ptr); ulong open_id; struct status_block *sblk_ptr
The kernel procedure calling the ddopen entry point is responsible for pinning the stat_fn kernel procedure before making the open call. The rx_fn, tx_fn, and stat_fn procedures are made synchronously from the off-level portion of the PDH at high priority from the PDH. Therefore, the called kernel procedure must return quickly. Parameter blocks are passed by reference and are valid only for the call's duration. After a return from this call, the parameter block should not be accessed. |
A ddopen (kernel mode) entry point can be called from the process environment only.
In general, communication device handlers use the common codes defined for an entry point. However, device handlers for specific communication devices may return device-specific codes. The common return codes for the ddopen entry point are the following:
Return Code | Description |
---|---|
EINVAL | Indicates a parameter is not valid. |
EIO | Indicates an error has occurred. The status field contains the relevant exception code. |
ENODEV | Indicates there is no such device. |
EBUSY | Indicates the maximum number of opens was exceeded, or the device was opened in exclusive-use mode. |
ENOMEM | Indicates the PDH was unable to allocate the space that it needed. |
ENXIO | Indicates an attempt was made to open the PDH before it was configured. |
ENOTREADY | Indicates the PDH is in the process of shutting down the adapter. |
The CIO_GET_FASTWRT ddioctl Communications PDH Operation, ddclose entry point, ddopen entry point for user-mode processes, ddwrite entry point.
The ddmpx entry point.
Status Blocks for Communication Device Handlers Overview in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.
Communications Physical Device Handler Model Overview in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.