Built-in PDL functions

Many protocols are similar in operation, and differ only in the delimiter characters that are used. To simplify handling of these common cases, built-in PDL functions are included that implement most of the definitions and Tcl code for the driver.

To use a function, define only those elements unique to your protocol needs. For example, data phrase definitions.

To specify a style to use in your driver, use the hci_pd_msg_style command.

For example:

hci_pd_msg_style style key:value ?...?

The system supply two message styles: basic and acknak.

The basic style sends and receives phrases.

This table shows the configuration keys and values:
Key Description
phrase: phrase-name Specifies the name of the phrase to use to encode and decode the message. This entry is required.
field: field-name Specifies the name of the field from the phrase into/from which the message data is placed/obtained. This entry is required.
dir: direction Indicates the direction in which the driver operates. Choices are bidir (bidirectional) and obonly (outbound only). This entry is optional and defaults to bidir.
resync: character Makes the driver use resynchronization logic if an error or time-out happens. To resynchronize, the driver scans the input buffer the next instance a character is read.

Not specifying this entry discards all data in the input buffer if an error or time-out happens. This entry is optional and defaults to 15040.

timeout: microseconds Specifies the general time-out. This is used for both read and write operations; it is expressed in microseconds. This entry is optional and defaults to 15040.
rtimeout: microseconds Specifies the read-specific time-out value. This entry is optional and defaults to 15040.
wtimeout: microseconds Specifies the write-specific time-out value. This entry is optional and defaults to 15040.
acknak This style uses all of the keys in the basic style, plus these:
  • ackphrase: phrase-name

    Specifies the name of the phrase that recognizes ACK messages. This entry is required.

  • nakphrase: phrase-name

    Specifies the name of the phrase that recognizes NAK messages. This entry is required.

  • naktries: count

    Specifies the number of NAK responses before giving up on writing a message. This entry is optional and defaults to zero (0).

  • tmotries: count

    Specifies the number of time-out events before giving up on writing a message. This entry is optional and defaults to zero (0).