Difference between revisions of "Async kb"
(→S) |
(→Session Granted) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 24: | Line 24: | ||
.data[1] = priority (always 1) | .data[1] = priority (always 1) | ||
− | .data[2] , .data[3] -- | + | .data[2] , .data[3] -- data frame payload max size (16 bit, big endian) (excluding frame id and total frame count) |
− | |||
− | |||
== Session Granted == | == Session Granted == | ||
Line 40: | Line 38: | ||
.data[3] = priority acknowledge (should reply with the same priority requested) | .data[3] = priority acknowledge (should reply with the same priority requested) | ||
− | .data[4] .data[5] = bytes per frame (maximum allowed bytes per frame, 16bit, bigendian) | + | .data[4] .data[5] = bytes per data frame (maximum allowed bytes per frame, 16bit, bigendian), excluding frameid and frame total count |
+ | |||
+ | .data[6] .data[7] = number of microseconds between messages -- don't bother about it | ||
== Starting Transfer == | == Starting Transfer == | ||
Line 96: | Line 96: | ||
.data[1] .... .data[msg.length-1] == id's of requested frames | .data[1] .... .data[msg.length-1] == id's of requested frames | ||
+ | |||
+ | == End of transfer == | ||
+ | |||
+ | .data[0] = 0xf3 | ||
+ | |||
+ | .data[1] = 0x00 | ||
+ | |||
+ | parameters: | ||
+ | |||
+ | .data[2] = result -- 0x00 -- everything was ok, 0xff -- something went BAD | ||
+ | |||
+ | == Abort connection == | ||
+ | |||
+ | .data[0] = 0xfc | ||
+ | |||
+ | .data[1] = 0x00 | ||
+ | |||
+ | .data[2] = 0xff | ||
+ | |||
+ | send by receiver to abort connection. | ||
+ | |||
+ | == Adjust framerate == | ||
+ | |||
+ | .data[0] = 0xf0 | ||
+ | |||
+ | |||
+ | don't bother about this command :) | ||
+ | |||
+ | == Suspend transfer == | ||
+ | |||
+ | .data[0] = 0xfe | ||
+ | |||
+ | .data[1] = 0x00 | ||
+ | |||
+ | parameters: | ||
+ | |||
+ | .data[2] = event. | ||
+ | |||
+ | |||
+ | Events: | ||
+ | |||
+ | *0x00-0x01 -- Reserved (not used) | ||
+ | *0x02-0x7f -- Priority info (when requested priority is less than current available) | ||
+ | *0x80 - Reserved (not used) | ||
+ | *0x81 - '''0-Frame''' received, but the receiver is busy with another connection | ||
+ | *0x82 - '''0-Frame''' received, but the receiver don't have free buffer at the moment | ||
+ | *0x83-0xff -- Reserved (not used) | ||
+ | |||
+ | == Keep Session Alive == | ||
+ | |||
+ | .data[0] = 0xf1 | ||
+ | |||
+ | .data[1] = 0x00 | ||
+ | |||
+ | parameters: | ||
+ | |||
+ | .data[2] = Event | ||
+ | |||
+ | Events: | ||
+ | *0x00-0x01 Reserved (not used) | ||
+ | *0x02-0x7f Priority (this session has less priority than available) | ||
+ | *0x80-0x82 Reserved (not used) | ||
+ | *0x83 - Data has been transmitted successfully, keep session alive, but no new data is ready yet | ||
+ | *0x84 - Transmitter is busy with another session. | ||
+ | *0x85-0xff Reserved (not used) | ||
== Data Frame == | == Data Frame == | ||
Line 122: | Line 187: | ||
.data[4]=total block count | .data[4]=total block count | ||
− | == | + | == Communication Protocols == |
+ | Sender (TX) | ||
+ | |||
+ | Receiver (RX) | ||
+ | |||
+ | Simple transfer with block ack: | ||
+ | |||
+ | TX:Request Session | ||
+ | RX:Session Granted | ||
+ | TX:Starting Transfer | ||
+ | TX:0-Frame (one block, 4 frames, ack after block) | ||
+ | TX:Frame #1 | ||
+ | TX:Frame #2 | ||
+ | TX:Frame #3 | ||
+ | TX:Frame #4 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer | ||
+ | |||
+ | Simple transfer with frame ack: | ||
+ | |||
+ | TX:Request Session | ||
+ | RX:Session Granted | ||
+ | TX:Starting Transfer | ||
+ | TX:0-Frame (one block, 4 frames, ack after every frame) | ||
+ | TX:Frame #1 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:Frame #2 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:Frame #3 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:Frame #4 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer | ||
+ | |||
+ | Transfer with Suspend Transfer | ||
+ | |||
+ | TX:Request Session | ||
+ | RX:Session Granted | ||
+ | TX:Starting Transfer | ||
+ | TX:0-Frame (one block, 4 frames, ack after block) | ||
+ | RX:Suspend Transfer (event = busy with another transfer) | ||
+ | RX:Frame Acknowledge(frame id 0, block id= current block) | ||
+ | TX:Frame #1 | ||
+ | TX:Frame #2 | ||
+ | TX:Frame #3 | ||
+ | TX:Frame #4 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer | ||
+ | |||
+ | Transfer with Keep Session Alive | ||
+ | |||
+ | TX:Request Session | ||
+ | RX:Session Granted | ||
+ | TX:Starting Transfer | ||
+ | TX:0-Frame (one block, 4 frames, ack after block) | ||
+ | TX:Frame #1 | ||
+ | TX:Frame #2 | ||
+ | TX:Frame #3 | ||
+ | TX:Frame #4 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:Keep Session Alive (event = waiting for more data) | ||
+ | TX:0-Frame (one block, 4 frames, ack after block) | ||
+ | TX:Frame #1 | ||
+ | TX:Frame #2 | ||
+ | TX:Frame #3 | ||
+ | TX:Frame #4 | ||
+ | RX:Frame Acknowledge | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer | ||
+ | TX:End of tranfer |
Latest revision as of 13:46, 15 March 2007
Terms:
connection: data transfer session, highest in hierarchy
block: data transfer unit, consists of several frames
frame: lowest data transfer unit. basically -- one network message
Message type ==
- 0x80 = data
- 0x90 = command
commands:
Contents
- 1 Request Session
- 2 Session Granted
- 3 Starting Transfer
- 4 Frame Acknowledge
- 5 Frame Not Acknowledged
- 6 Single Frame Request
- 7 Current block request
- 8 Multiple Frame Request
- 9 End of transfer
- 10 Abort connection
- 11 Adjust framerate
- 12 Suspend transfer
- 13 Keep Session Alive
- 14 Data Frame
- 15 Communication Protocols
Request Session
.data[0] = 0xca -- request session
parameters:
.data[1] = priority (always 1)
.data[2] , .data[3] -- data frame payload max size (16 bit, big endian) (excluding frame id and total frame count)
Session Granted
.data[0] = 0xf2 -- session granted
parameters:
.data[1] = number of frames per block
.data[2] = revision (always 0x01)
.data[3] = priority acknowledge (should reply with the same priority requested)
.data[4] .data[5] = bytes per data frame (maximum allowed bytes per frame, 16bit, bigendian), excluding frameid and frame total count
.data[6] .data[7] = number of microseconds between messages -- don't bother about it
Starting Transfer
.data[0] = 0xfd
no parameters
Frame Acknowledge
.data[0] = 0xfa (frame acknowledge)
parameters
.data[1]= total number of frames in this block
.data[2]= id of received message
.data[3]= id of current block
Frame Not Acknowledged
.data[0] = 0xfa
.data[1] = 0x00
.data[2] = 0x00
params :
.data[3] = id of current block
Single Frame Request
.data[0] = 0xfb
.data[1] = 0x00
parameters:
.data[2] = id of requested frame in current block
Current block request
.data[0] = 0xfb
.data[1] = 0x00
.data[2] = 0x00
Multiple Frame Request
.data[0] = 0xff
.data[1] .... .data[msg.length-1] == id's of requested frames
End of transfer
.data[0] = 0xf3
.data[1] = 0x00
parameters:
.data[2] = result -- 0x00 -- everything was ok, 0xff -- something went BAD
Abort connection
.data[0] = 0xfc
.data[1] = 0x00
.data[2] = 0xff
send by receiver to abort connection.
Adjust framerate
.data[0] = 0xf0
don't bother about this command :)
Suspend transfer
.data[0] = 0xfe
.data[1] = 0x00
parameters:
.data[2] = event.
Events:
- 0x00-0x01 -- Reserved (not used)
- 0x02-0x7f -- Priority info (when requested priority is less than current available)
- 0x80 - Reserved (not used)
- 0x81 - 0-Frame received, but the receiver is busy with another connection
- 0x82 - 0-Frame received, but the receiver don't have free buffer at the moment
- 0x83-0xff -- Reserved (not used)
Keep Session Alive
.data[0] = 0xf1
.data[1] = 0x00
parameters:
.data[2] = Event
Events:
- 0x00-0x01 Reserved (not used)
- 0x02-0x7f Priority (this session has less priority than available)
- 0x80-0x82 Reserved (not used)
- 0x83 - Data has been transmitted successfully, keep session alive, but no new data is ready yet
- 0x84 - Transmitter is busy with another session.
- 0x85-0xff Reserved (not used)
Data Frame
.data[0] = frame id
.data[1] = number of frames in current block (not including 0-Frame)
.data[2] .... .data[N] == user data
There are 2 different frame types --- "0-Frame" and Regular Frame
0-Frame is the first frame to be send out -- it has description of current block transfer.
0-Frame has following structure:
.data[0]=0x00
.data[1]=number of frames in current block (not including 0-Frame)
.data[2]=0x00
.data[3]=Flags ( 0x01 == acknowledge after the entire block, 0x02 = acknowledge every frame)
.data[4]=total block count
Communication Protocols
Sender (TX)
Receiver (RX)
Simple transfer with block ack:
TX:Request Session RX:Session Granted TX:Starting Transfer TX:0-Frame (one block, 4 frames, ack after block) TX:Frame #1 TX:Frame #2 TX:Frame #3 TX:Frame #4 RX:Frame Acknowledge TX:End of tranfer TX:End of tranfer TX:End of tranfer
Simple transfer with frame ack:
TX:Request Session RX:Session Granted TX:Starting Transfer TX:0-Frame (one block, 4 frames, ack after every frame) TX:Frame #1 RX:Frame Acknowledge TX:Frame #2 RX:Frame Acknowledge TX:Frame #3 RX:Frame Acknowledge TX:Frame #4 RX:Frame Acknowledge TX:End of tranfer TX:End of tranfer TX:End of tranfer
Transfer with Suspend Transfer
TX:Request Session RX:Session Granted TX:Starting Transfer TX:0-Frame (one block, 4 frames, ack after block) RX:Suspend Transfer (event = busy with another transfer) RX:Frame Acknowledge(frame id 0, block id= current block) TX:Frame #1 TX:Frame #2 TX:Frame #3 TX:Frame #4 RX:Frame Acknowledge TX:End of tranfer TX:End of tranfer TX:End of tranfer
Transfer with Keep Session Alive
TX:Request Session RX:Session Granted TX:Starting Transfer TX:0-Frame (one block, 4 frames, ack after block) TX:Frame #1 TX:Frame #2 TX:Frame #3 TX:Frame #4 RX:Frame Acknowledge TX:Keep Session Alive (event = waiting for more data) TX:0-Frame (one block, 4 frames, ack after block) TX:Frame #1 TX:Frame #2 TX:Frame #3 TX:Frame #4 RX:Frame Acknowledge TX:End of tranfer TX:End of tranfer TX:End of tranfer