Services - tools - models - for embedded software development
Embecosm divider strip
Prev  Next

4.5.3.  Sending Packets

The packet writing function is put_packet (). It takes as argument a struct rsp_buf and creates a well formed packet, beginning with '$', with '#' at the end of data and a valid 2 byte checksum (see Figure 2.2 in Section 2.3 for packet representation details).

The acknowledgment character is read using get_rsp_char () (see Section 4.5.2.1). If successful ('+'), the function returns. Otherwise the packet is repeatedly resent until ('+') is received as a response.

Errors on writing are silently ignored. If the read of the acknowledgment returns -1 (indicating failure of the connection or end-of-file), put_packet () returns immediately.

4.5.3.1.  Character Output

The individual characters are written by put_packet () using put_rsp_char (). In the event of an error other than a retry request or interrupt a warning is printed and the connection closed.

Embecosm divider strip