IRUSER Shared Memory: Difference between revisions

Wwylele (talk | contribs)
mNo edit summary
Wwylele (talk | contribs)
 
(8 intermediate revisions by 2 users not shown)
Line 57: Line 57:
|-
|-
| 0xC
| 0xC
| 0x1
| Unknown. Value 1 is observed after connection
|-
| 0xD
| 0x1
| Network ID? Seems like a randomly distributed number after connection
|-
| 0xE
| 0x1
| Unknown. Value 1 is observed after initialization
|-
| 0xF
| 0x1
| Unknown
|}
=ReceiveBufferInfo/SendBufferInfo=
The BufferInfo sections store data validity information for the two buffers
{| class="wikitable" border="1"
|-
!  Relative offset
!  Size
!  Description
|-
| 0x0
| 0x4
| Start index of valid packets
|-
| 0x4
| 0x4
| End index of valid packets
|-
| 0x8
| 0x4
| 0x4
| Unknown
| Number of valid packets
|-
| 0xC
| 0x4
| Unknown/Unused?
|}
 
=ReceiveBuffer/SendBuffer=
 
{| class="wikitable" border="1"
|-
!  Relative offset
!  Size
!  Description
|-
| 0x0
| 0x8 * packet_count (specified in Init parameter)
| PacketInfo{u32 offset_to_data_buffer, u32 data_length}
|-
| 0x8 * packet_count
| buffer_size - 0x8 * packet_count
| Data buffer
|}
 
The buffers are two circular buffers. A new packet is added to the end of previous packet in the data buffer, with packet info added to PacketInfo[end_index++]. Note that if an added packet exceeds the end of the buffer, the exceeding data will be wrapped around to the beginning of the data buffer.
 
 
==Packet structure==
A packet in the data buffer consists of a header, payload and a crc8 checksum
{| class="wikitable" border="1"
|-
!  Relative offset
!  Size
!  Description
|-
| 0x0
| 0x1
| Fixed value 0xA5?
|-
| 0x1
| 0x1
| Destination network ID?
|-
| 0x2
| 0x1
| The highest bit is unknown.
When second highest bit is clear, the rest bit[0:5] of this byte is the payload length; otherwise bit[0:5] is the higher byte of the payload length
|-
| 0x3
| 0x1
| When bit[6] of previous byte is set, this byte is the lower byte of the payload length; other wise this byte doesn't present
|-
| 0x3 or 0x4
| payload length
| payload
|-
| 0x3 or 0x4 +payload_length
| 0x1
| [[CRC-8-CCITT]] over data above (header + payload)
|-
|}
|}