Sahara Protocol

The protocol minimizes packet processing by relying on the physical transport 

layer to provide reliable transfer of data. No framing, HDLC (High-level Data 

Link Control) encoding, or CRC (Cyclic Redundancy Check) is applied to the 

packets at the protocol level. Each command packet type has a well-defined 

structure which minimally contains a command ID and packet length. Using this 

information, the length of each command packet can be validated by comparing the 

length of the command packet received to either of two values:


1. The expected packet length for the given command ID

2. The length field contained in the packet itself


Sahara can easily be extended to support command packet validation by adding a 

CRC field to the end of each packet. Data packets can also be validated for data 

integrity using various authentication methods; however, this is beyond the 

scope of the protocol.



Synchronous communication


The protocol assumes that all communication between the host and the target is 

completely synchronous. Each command packet sent from the target to the host is 

acknowledged with a command or data packet sent from the host back to the 

target. Similarly, each command packet sent from the host to the target is 

acknowledged with a command or data packet.


Although the link between the host and the target is expected to be reliable, if 

an error occurs during the transmission of a command packet from the host to the 

target, and as a result the target receives an erroneous packet, then the target 

will send the host an error response and exit gracefully.


Timer mechanisms can be implemented on both the host and the target to support 

the retransmission of packets in case of transmission failures. However, the 

implementation of such mechanisms is outside the scope of the protocol – it 

specifies only what happens when unexpected or erroneous packets are received on 

the target side.


Extensibility The protocol defines a fixed set of command structures and packet 

flows. However, it can easily be extended to support additional command 

structures and state transitions (as described later in this document).

The 3 Sahara protocol defines two types of packets:

1. Command packets

2. Data packets


Code:

 Command Packet:                                                      

+------------------+-----------------+------------+------------------+

| COMMAND LENGTH   |  PACKET LENGTH  |  OPTIONAL  |   OPTIONAL       |

+------------------+-----------------+------------+------------------+

                                                                      

 Data Packet:                                                         

+--------------------------------------------------------------------+

|                   RAW DATA (arbitrary number of bytes)             |


The Sahara Commands:

Code:


-----------------------------------------------------------

ID      Command                         Description

-----------------------------------------------------------

0x00    -                               Invalid

0x01    Hello                           Initialize connection and protocol

0x02    Hello Response                  Acknowledge connection/protocol, mode of operation

0x03    Read Data                       Read specified number of bytes from host

0x04    End of Image Transfer           image transfer end / target transfer failure

0x05    Done                            Acknowledgement: image transfer is complete

0x06    Done Response                   Target is exiting protocol

0x07    Reset                           Instruct target to perform a reset

0x08    Reset Response                  Indicate to host that target is about to reset

0x09    Memory Debug                    Indicate to host: target debug mode & ready to transfer memory content

0x0A    Memory Read                     Read number of bytes, starting from a specified address

0x0B    Command Ready                   Indicate to host: target ready to receive client commands

0x0C    Command Switch Mode             [1]

0x0D    Command Execute                 Indicate to host: to execute a given client command

0x0E    Command Execute Response        Indicate to host: target command execution status

0x0F    Command Execute Data            Indicate to target that host is ready to receive (more) data

all     -                               Invalid

-----------------------------------------------------------

0x0-0x8 Protocol Version 1.0 and above

0x9-0xA Protocol Version 2.0 and above

0xB-0xF Protocol Version 2.1 and above

-----------------------------------------------------------

[1] Indicate to target to switch modes:

- Image Transfer Pending mode

- Image Transfer Complete mode

- Memory Debug mode

- Command mode


文章标签:

本文链接: http://lmroot.com/blog/?id=1,尊重共享,欢迎转载,请自觉添加本文链接,谢谢!

版权声明: 本文除特别说明外均由原创

分享本文:
呃 本文暂时没人评论 来添加一个吧

分享:

支付宝

微信

歌曲 - 歌手
0:00