3.4. Data Highway Access

Once a task has opened a handle to a Direct-Link card, it may request sdadmin to read or write messages on the Data Highway. The task must identify both the card number and the handle granted by the SD_OPEN request. The task should also indicate whether to wait on the request or return immediately.

As well, a task may request a copy of the active node list through the SD_GET_DHP_STAT request (Data Highway Plus only).

3.4.1. SD_READ

When a task requires data to be read from the Data Highway, it performs an SD_READ. The task must provide a valid handle and an indication whether to wait. If wait is set true, the administrator does not reply until either data has been received or a timeout has occurred. If wait is false, the administrator replies immediately with either data or SD_R_NO_DATA.

If a message is returned, the reply contains the following fields:

len

The length of the message received (6 bytes of message header + data, with a maximum total of 251 bytes).

dst

The destination station on the Data Highway.

src

The source station on the Data Highway.

cmd

The command (or reply) received.

sts

The status as received or reported by the card.

tns_lsb

The transaction number received, least significant byte.

tns_msb

The most significant byte of the transaction number.

data

The data received from the Data Highway. Up to 245 bytes.

If a message is received from the card, it is buffered in one of the administrator message buffers. If it is not read by a task within twice the card timeout period, it is discarded, making the buffer available.

Similarly, if a task performs a read and no data is available, the read returns after a delay of twice the card timeout period.

3.4.2. SD_WRITE

When a task requires data to be written to the Data Highway, it performs an SD_WRITE. The task must provide a valid handle and an indication whether to wait. If wait is set true, the administrator does not reply until the data has been sent to the card or a timeout has occurred. If wait is false, the administrator replies immediately with either SD_R_OK if there was a message buffer available or SD_R_WRITE_FAILED.

The structure passed to represent the message contains the following fields:

len

The length of the message to transmit (6 bytes of message header + data, with a maximum length of 251 bytes).

dst

The destination station on the Data Highway.

src

This field is set by the administrator to be the local station number.

cmd

The command (or reply) to transmit.

sts

The status to report to the receiving end.

tns_lsb

The least significant byte of the transaction number. If the message is a reply, the transaction number should match the value received with the command. If the message is a command, the administrator fills in the transaction number before transmitting. The transaction number supplied is returned through SD_READ if a reply is received.

tns_msb

The most significant byte of the transaction number.

data

Up to 245 bytes of data to transmit to the Data Highway.

If the SD card doesn't have room to store a write request, the write fails (SD_R_WRITE_FAILED is returned) after one card timeout period.

3.4.3. SD_GET_DHP_STAT

The SD_GET_DHP_STAT function allows a task to interrogate the Data Highway Plus status maintained by each card. This function does not apply for Data Highway.

If the function call is successful, the administrator returns to the requesting task 8 bytes of data. Each bit represents the status of a station on the Data Highway Plus. If a bit is set to 1, the station is present, otherwise the station is not present. The active node list is arranged as follows:

 Bit Number
Byte#01234567
0#00#10#20#30#40#50#60#70
1#01#11#21#31#41#51#61#71
2#02#12#22#32#42#52#62#72
3#03#13#23#33#43#53#63#73
4#04#14#24#34#44#54#64#74
5#05#15#25#35#45#55#65#75
6#06#16#26#36#46#56#66#76
7#07#17#27#37#47#57#67#77