blob: 3a1a6c49ac64b00cacca7785978788ce3805da44 [file] [log] [blame]
Wyatt Heplerf9fb90f2020-09-30 18:59:33 -07001.. _module-pw_sys_io:
Armando Montanezd2e49032019-12-06 13:06:01 -08002
Armando Montanezf7a5a742020-03-02 14:58:59 -08003---------
4pw_sys_io
5---------
Armando Montanezd2e49032019-12-06 13:06:01 -08006This module defines a simple and unoptimized interface for byte-by-byte
7input/output. This can be done over a logging system, stdio, UART, via a
8photodiode and modulated kazoo, or basically any way to get data in and out
9of an application.
10
11This facade doesn't dictate any policies on input and output data encoding,
12format, or transmission protocol. It only requires that backends return a
Wyatt Hepler1b3da3a2021-01-07 13:26:57 -080013``OkStatus()`` if the operation succeeds. Backends may provide useful error
Armando Montanezd2e49032019-12-06 13:06:01 -080014Status types, but depending on the implementation-specific Status values is
15NOT recommended. Since this facade provides a very vague I/O interface, it
16does NOT provide tests. Backends are expected to provide their own testing to
17validate correctness.
18
19The intent of this module for simplifying bringup or otherwise getting data
20in/out of a CPU in a way that is platform-agnostic. The interface is designed
21to be easy to understand. There's no initialization as part of this
22interface, there's no configuration, and the interface is no-frills WYSIWYG
23byte-by-byte i/o.
24
25**It is strongly advised NOT to build projects on top of this interface.** There
26are many drawbacks to using this interface, so it's not generally suited for use
27in production.
28
29Setup
30=====
31This module requires relatively minimal setup:
32
Armando Montanezf7a5a742020-03-02 14:58:59 -080033 1. Chose a ``pw_sys_io`` backend, or write one yourself.
Armando Montaneza761e322020-06-15 16:30:40 -070034 2. If using GN build, Specify the ``pw_sys_io_BACKEND`` GN build arg to point
35 the library that provides a ``pw_sys_io`` backend.
Armando Montanezd2e49032019-12-06 13:06:01 -080036
37Module usage
38============
Armando Montanezf7a5a742020-03-02 14:58:59 -080039See backend docs for how to interact with the underlying system I/O
40implementation.
Armando Montanezd2e49032019-12-06 13:06:01 -080041
42Dependencies
43============
Armando Montanezf7a5a742020-03-02 14:58:59 -080044 * pw_sys_io_backend
Armando Montanezd2e49032019-12-06 13:06:01 -080045 * pw_span
46 * pw_status