© 2000 Ubicom, Inc. All rights reserved. - 20 - www.ubicom.com AN16 SX IrDA Virtual Peripheral Implementation 3.5.3  UI Transport The   unnumbered-information   (UI)   service   provides   a
broadcast unreliable connectionless data service for the
application layer..
The reception of a UI data frame works in the same way
as for IrComm data. The LAP layer will call the applica-
tion  layer’s  lap2appRxUIData  event  handler  with  the
data byte in the w register. The application is free to pro-
cess the byte however it must return when it has finished
processing the data and cannot hold up the CPU waiting
for   something   to   happen.   This   event   handler   will   be
called for every data byte in the incoming frame (up to 64
times) before the LAP layer calls lap2appRxUIValid to
validate  the  data  or  lap2appRxUIError  to  reject  the
data.
For transmission the application layer must call the LAP
layer’s app2lapTxUIStart function to request that a UI
frame be sent. The LAP layer can only send a UI com-
mand frame outside of a connection and only if no IR has
been  detected  in  the  past  500ms.  The  LAP  layer  will
return z false if it will send the frame or z true if it refuses
the request.
If  the  frame  can  be  sent  the  LAP  layer  will  request  the
data  as  it  can  send  it  by  calling  the  application  layer’s
lap2appTxUIData  event  handler.  This  function  return
with w containing the data byte to be sent and z indicat-
ing if there is more data to be sent. If z is true then this is
the   last   byte   to   be   sent   and   no   more   data   will   be
requested.   If   z   is   false   then   another   byte   will   be
requested when the LAP layer is ready to accept it. When
the frame has been completely sent by the physical layer
the   LAP   layer   will   call   the   lap2appTxUIComplete
event handler to indication completion. Note that the LAP
layer does not enforce the 64 byte limit on the length of
the data within a UI frame and so it is up to the applica-
tion layer to limit the data to 64 bytes if it wants to main-
tain IrDA compliance.
The application should call the lap layer in the following
way:
...
page
app2lapTxUIStart;Set page bits for call call app2lapTxUIStart;call lap layer bank ApplicationBank ;change to correct local bank ... lap2appRxUIData (w=data) Incoming UI data frame. lap2appRxUIValid () Frame was validated. lap2appRxUIError () Frame was invalid. app2lapTxUIStart (ret z=busy) Request that a frame be sent. lap2appTxUIData (ret w=data, z=last) A request for UI data to be transmitted. lap2appTxUIComplete () The UI frame has been completely transmitted. Figure 3-11.  UI Transport API