© 2000 Ubicom, Inc. All rights reserved.
- 11 -
www.ubicom.com
SX IrDA Virtual Peripheral Implementation
AN16
3.3.7 Implementation - Payload Layer Receive
For incoming frames the payload layer tests the connec-
tion address, and if it is correct it will inform the LAP layer
of the type of the frame. The information field will be pro-
cessed or passed (in the case of a data frame) as appro-
priate for the type of frame, and a Valid/Error message
will be sent to the LAP layer when complete.
When the LAP layer is informed of the incoming frame
type it may choose to ignore the frame by calling
lap2plRxIgnore which will cause the payload layer to
ignore the frame.
Figure 3-5 shows the Payload Layer Receive API.
If the lap layer calls lap2plRxIgnore to ignore the frame
then the payload layer will inform the framing layer that
the frame should be ignored thus no more data will be
received from the framing layer and no Valid/Error indica-
tion will be given.
The command byte is recorded by the payload layer so
that the LAP layer can examine the it once a frame has
been completed. This allows the LAP layer to gain
access to the frame numbering bits encoded in the com-
mand byte.
For I (reliable data) and UI (unreliable data) frames all
data is passed to the LAP layer using pl2lapRxIData or
pl2lapRxUIData.
For XID frames the frame information field is internally
processed by the payload layer except for the XID dis-
covery information field which is passed to the LAP layer
using pl2lapRxXIDData. The received 32-bit source
address is stored so that it can be used in a reply if the
frame is an XID command frame and the LAP layer
requests that an XID response be sent. The received 32-
bit destination address is tested to ensure it is either
broadcast or specifically destined for the IrDA Virtual
Peripheral, and the XID flags and slot number are stored
for future reference by the LAP layer. If there is any error
in the frame such as a wrong destination address or an
unsupported version then the lap layer will receive a
pl2lapRxError message. Note that the payload layer only
keeps the current source address in memory and does
not generate a list of received source addresses.
For SNRM frames the information field is internally pro-
cessed by the payload layer. The received 32-bit source
address is stored so that it can be used in a reply if
requested by the LAP layer. The received 32-bit destina-
tion address is tested to ensure it is either broadcast or
specifically destined for the IrDA Virtual Peripheral, and if
not then the lap layer will receive a pl2lapRxError indica-
tion. The received connection address is stored but not
applied (it cannot be applied until the frame has been val-
idated and the LAP layer requests that the connection be
accepted). And finally the baud rate parameter is
extracted from the received supported connection
parameters and stored for future use. When the frame is
validated the LAP layer will accept the connection and
the stored data will be used to form the connection-
accept reply.
For all other frame types the information field is ignored.
3.3.8 Implementation - Payload Layer Transmit
The payload layer provides the LAP layer with the ability
to request that a frame of a given type be sent.
When the LAP layer requests that a frame be sent it will
be sent immediately and the receive state will be reset to
idle.
pl2lapRxFrame (w=Type)
A correctly addressed frame of the given type is being received.
pl2lapRxValid ()
The frame is complete and has been validated.
pl2lapRxError ()
The frame is invalid.
pl2lapRxXIDData (w=Data)
Data from the XID information field
pl2lapRxIData (w=Data)
Data from an I frame
pl2lapRxUIData (w=Data)
Data from an UI frame
lap2plRxIgnore ()
The lap layer has no interest in the frame.
Figure
3-5. Payload Layer Receive API