(dnsDeviceAdd card_id DeviceMacId [OutputSize InputSize
[OutputOfs InputOfs [MsgSize [ConnectionType]]]])
![]() | If OutputSize is not specified or is negative, the driver will automatically probe the specified device and determine the size required for a polled connection type. |
![]() | Since the device data blocks must be aligned on 16-bit word boundaries, both the output and input offsets (OutputOfs and InputOfs) must be even-valued numbers, and will be incremented to the next word boundary if they are not. If either one of the offsets are not specified, both of them will be automatically calculated (see Description), based on the offsets and sizes of the data blocks of the previously allocated device (if any). And if, in that case, the resulting offsets are not even-valued, then they are incremented to the next word boundary. |
If the device is successfully added to the device list, then:
(dnsDeviceAdd card_id DeviceMacId)
or, if an error is detected, then one of:
(error "dnsDeviceAdd DR_ERR_CARD_INVALID (time) invalid card: card_id") (error "dnsDeviceAdd DR_ERR_NO_CARD (time) card not available") (error "dnsDeviceAdd DVN_ERR_CMD_ERR_DUPMAC (time) Cmd: Duplicate MAC ID") (error "dnsDeviceAdd DVN_ERR_CMD_ERR_CONNECTION_FLAG (time) Cmd: Invalid connection flags") (error "dnsDeviceAdd DVN_ERR_CMD_TIMEOUT (time) Cmd failed (timeout)")
This command adds a device configuration to the device list. If scanning is active, or when it becomes active, connections to the client are created and the device is scanned. The input and output data (connection) sizes must correspond to that defined by the device. The connection type must also be supported by the device.
The card transfers the device data to/from internal card buffers. The driver transfers data between the card and its own internal buffers, specifically the DEV_BUF_INPUT and DEV_BUF_OUTPUT buffers.
The optional parameters OutputOfs and InputOfs define the starting offset of the corresponding block of device data within these buffers. If not specified or 0, the driver will automatically calculate offsets, sequentially locating the blocks of device data (of size OutputSize or InputSize, respectively). This automatic allocation has the drawback that the offsets will change whenever the size of field devices are changed, making it necessary to change accordingly the address of the field data points. The OutputOfs and InputOfs parameters can be used to eliminate this problem, allowing you to specify the location of blocks of device data within the input or output data buffers, effectively 'reserving' space between devices. Note that the offsets are relative to the driver's data buffer, and are not the internal card memory offsets actually used. The assigned offsets can be determined with the dnsDeviceGet command.
(dnsDeviceAdd 0 2)
(dnsDeviceAdd 0 2 -1 0 0x100 0x100)
(dnsDeviceAdd 0 2 -1 0 0 0 0 (bor CONN_FLAG_EX CONN_FLAG_P))
Copyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.