tari

Untitled

Aug 3rd, 2010
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.80 KB | None | 0 0
  1. Draft P. Marheine
  2. August 3, 2010
  3.  
  4.  
  5. TI Serial Data Interchange Protocol
  6.  
  7. Abstract
  8.  
  9. This RFC defines a simple protocol layer (the TI-SDIP) suitable for
  10. use as a data interchange among TI graphing calculators and
  11. associated devices in a link- and software-independent manner.
  12.  
  13.  
  14. Table of Contents
  15.  
  16. 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
  17. 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 2
  18. 1.2. Objectives . . . . . . . . . . . . . . . . . . . . . . . . 2
  19. 2. Data formatting . . . . . . . . . . . . . . . . . . . . . . . 3
  20. 2.1. Figures . . . . . . . . . . . . . . . . . . . . . . . . . 3
  21. 2.2. Byte and bit ordering . . . . . . . . . . . . . . . . . . 3
  22. 2.3. Reserved fields . . . . . . . . . . . . . . . . . . . . . 3
  23. 3. Protocol description . . . . . . . . . . . . . . . . . . . . . 4
  24. 3.1. Packet format . . . . . . . . . . . . . . . . . . . . . . 4
  25. 3.2. Conversation format . . . . . . . . . . . . . . . . . . . 5
  26. 4. Simple List . . . . . . . . . . . . . . . . . . . . . . . . . 6
  27. 5. Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
  28. 6. Subsections and Tables . . . . . . . . . . . . . . . . . . . . 6
  29. 6.1. A Subsection . . . . . . . . . . . . . . . . . . . . . . . 6
  30. 6.2. Tables . . . . . . . . . . . . . . . . . . . . . . . . . . 6
  31. 7. More about Lists . . . . . . . . . . . . . . . . . . . . . . . 7
  32. 7.1. Numbering Lists across Lists and Sections . . . . . . . . 7
  33. 7.2. Where the List Numbering Continues . . . . . . . . . . . . 8
  34. 8. Example of Code or MIB Module To Be Extracted . . . . . . . . 9
  35. 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 9
  36. 10. Security Considerations . . . . . . . . . . . . . . . . . . . 9
  37. 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 10
  38. 11.1. Normative References . . . . . . . . . . . . . . . . . . . 10
  39. 11.2. Informative References . . . . . . . . . . . . . . . . . . 10
  40. Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 10
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. Marheine [Page 1]
  53. TI Serial Data Interchange Protocol August 2010
  54.  
  55.  
  56. 1. Introduction
  57.  
  58. The graphing calculators produced by Texas Instruments (TI) are very
  59. flexible bits of commodity hardware, well-suited to customization.
  60. However, the proprietary serial link protocol used by the devices is
  61. needlessly complex for most purposes as well as being implemented in
  62. an incredubly arcane manner despite the valiant reverse-engineering
  63. efforts of several developers, resulting in such documents as the TI
  64. Link Protocol & File Format Guide [TILPFFG], which, while useful,
  65. remains a pain to implement.
  66.  
  67. For the sanity of developers targeting such platforms, this document
  68. specifies a data interchange protocol suitable for use on all TI
  69. calculators and associated peripherals or devices.
  70.  
  71. 1.1. Requirements Language
  72.  
  73. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  74. "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  75. document are to be interpreted as described in RFC 2119 [RFC2119].
  76.  
  77. 1.2. Objectives
  78.  
  79. The designer has sought to meet certain objectives in the design of
  80. the protocol, as outlined in this section.
  81.  
  82. Ease of implementation
  83. The proposal seeks to replace a proprietary and difficult-to-
  84. implement protocol, so ease of implementation is very much
  85. desirable.
  86.  
  87. Robustness
  88. Linking between devices is usually done across noisy links and
  89. in the presence of potentially careless users, so the protocol
  90. should be able to handle data errors and unexpected loss of
  91. connection.
  92.  
  93. Speed
  94. Data transfers are typically done in the presence of users and
  95. in an interactive manner, so a reasonably high effective data
  96. rate is desired in order to impose less upon the user's time.
  97. As this document makes no claims about the link layer in use,
  98. the specification should seek only to minimize protocol
  99. overhead.
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107. Marheine [Page 2]
  108. TI Serial Data Interchange Protocol August 2010
  109.  
  110.  
  111. 2. Data formatting
  112.  
  113. The TI-SDIP is byte-oriented, and expects to receive data from the
  114. link layer in 8-bit bytes. This section outlines the terminology
  115. used to refer to bytes and subdivisions thereof.
  116.  
  117. 2.1. Figures
  118.  
  119. In illustrations, a '+' is used to delimit individual bits of a
  120. field, while '|' delimits fields, and '][' denotes a byte boundary.
  121.  
  122. 2.2. Byte and bit ordering
  123.  
  124. Byte values are represented in this specification as groupings of 8
  125. bits, numbered right to left from 0 to 7. When bit groupings are
  126. used to represent integers, bit 0 is the least significant bit, with
  127. significance increasing in order with bit number.
  128.  
  129. Byte 1 Byte 2
  130. +-+-+-+-+-+-+-+-][-+-+-+-+-+-+-+-+
  131. |7 6 5 4 3 2 1 0][7 6 5 4 3 2 1 0|
  132. |_______________][_______________|
  133.  
  134. Figure 1: Bit numbering within bytes
  135.  
  136. When multi-byte integers are used, the value is transmitted LSB-
  137. first, followed by additional bytes in order of increasing
  138. significance.
  139.  
  140. Multi-byte integer transmission
  141.  
  142. Time -->
  143. +----+----+----+----+
  144. | 78 | 56 | 34 | 12 |
  145. |____|____|____|____|
  146.  
  147. Figure 2: Sending 0x12345678
  148.  
  149. 2.3. Reserved fields
  150.  
  151. Fields marked as reserved MUST be both read and written as zero (all
  152. bits reset). Reserved values MUST NOT be written to the
  153. corresponding field and packets containing such reserved values
  154. SHOULD be rejected by a receiver.
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162. Marheine [Page 3]
  163. TI Serial Data Interchange Protocol August 2010
  164.  
  165.  
  166. 3. Protocol description
  167.  
  168. The protocol is based on the concept of a 'conversation', with only
  169. one device transmitting at once. Each conversation consists of a
  170. packet transferred from the sender followed by a response from the
  171. receiver, repeating until an implicit end to the conversation.
  172.  
  173. 3.1. Packet format
  174.  
  175. Header Payload Checksum
  176. +-+-+-+-+-+-+-+-][-+-+-+-+-+-+-+-][- - - - - - - -][-+-+-+-+-+-+-+-+
  177. | P | R | ][ ][ ][ |
  178. | R | E | PID ][ PSIZE ][ DATA ][ CKSUM |
  179. | V | S | ][ ][ ][ |
  180. |___|___|_______][_______________][_ _ _ _ _ _ _ _][_______________|
  181.  
  182.  
  183. Figure 3: Packet format
  184.  
  185. Every packet consists of a short header, payload of up to 255 bytes,
  186. and checksum, as outlined in Figure 3, with the header containing
  187. several subfields. Each field is detailed below.
  188.  
  189. PSIZE
  190. 8-bit unsigned value giving the size of the packet's payload,
  191. in bytes, in the range of 0 to 255.
  192.  
  193. DATA
  194. PSIZE-byte block containing the payload. Meaning is context-
  195. specific for conversation and PID.
  196.  
  197. CKSUM
  198. Eight-bit modular checksum of the entire packet up to this
  199. point. An example checksum algorithm in Z80 assembly is
  200. provided in Figure 4.
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217. Marheine [Page 4]
  218. TI Serial Data Interchange Protocol August 2010
  219.  
  220.  
  221. 00 | cksum_verify:
  222. 01 | ld a,(hl) ;PRV, RES, PID
  223. 02 | inc hl
  224. 03 | add a,(hl) ;PSIZE
  225. 04 | ld b,(hl)
  226. 05 | inc b ;PSIZE+1 iterations
  227. 06 | cksum_verify_loop:
  228. 07 | inc hl
  229. 08 | add a,(hl) ;DATA, CKSUM last iteration
  230. 09 | djnz packet_cksum_loop
  231. 10 | cksum_verify_done:
  232.  
  233. HL points to a buffer containing a complete packet, returns A=0
  234. if checksum is valid. To calculate a checksum, write the two's
  235. complement of A to CKSUM at line 08 in the last iteration
  236. rather than adding CKSUM to A.
  237.  
  238. Figure 4: Packet checksum verification for Z80
  239.  
  240. PRV
  241. The PRV field indicates which protocol version is in use.
  242. Compliant implementations MUST write as 0 and reject any
  243. packets in which PRV is non-zero, as the meaning of this value
  244. will change in future protocol revisions.
  245.  
  246. RES
  247. Reserved. See Section 2.3 for details.
  248.  
  249. PID
  250. Packet ID, which identifies the message type contained in the
  251. packet. Legal PID symbols and the corresponding values are
  252. listed in Table 1 and symbol meanings are defined in
  253. Section 3.2.
  254.  
  255. +-------+------+-------+----------+
  256. | Value | Type | Value | Type |
  257. +-------+------+-------+----------+
  258. | 0000 | ACK | 0100 | Reserved |
  259. | 0001 | NAK | | | | |
  260. | 0010 | VTN | v | v |
  261. | 0011 | VTP | 1111 | Reserved |
  262. +-------+------+-------+----------+
  263.  
  264. Table 1: PID values
  265.  
  266. 3.2. Conversation format
  267.  
  268.  
  269.  
  270.  
  271.  
  272. Marheine [Page 5]
Add Comment
Please, Sign In to add comment