File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed
Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 22
33[ ![ Build Status] ( https://github.com/rust-osdev/uart_16550/workflows/Build/badge.svg )] ( https://github.com/rust-osdev/uart_16550/actions?query=workflow%3ABuild ) [ ![ Docs.rs Badge] ( https://docs.rs/uart_16550/badge.svg )] ( https://docs.rs/uart_16550/ )
44
5- Minimal support for uart_16550 serial I/O.
5+ Minimal support for uart_16550 serial and memory mapped I/O.
66
77## Usage
88
9+ ### With ` port_{stable, nightly} ` feature
10+
911``` rust
1012use uart_16550 :: SerialPort ;
1113
@@ -21,14 +23,33 @@ serial_port.send(42);
2123let data = serial_port . receive ();
2224```
2325
26+ ### With ` mmio_{stable, nightly} ` feature
27+
28+ ``` rust
29+ use uart_16550 :: SerialPort ;
30+
31+ const SERIAL_IO_PORT : usize = 0x1000_0000 ;
32+
33+ let mut serial_port = unsafe { SerialPort :: new (SERIAL_IO_PORT ) };
34+ serial_port . init ();
35+
36+ // Now the serial port is ready to be used. To send a byte:
37+ serial_port . send (42 );
38+
39+ // To receive a byte:
40+ let data = serial_port . receive ();
41+ ```
42+
2443## License
2544
2645Licensed under the MIT license ([ LICENSE] ( LICENSE ) or < http://opensource.org/licenses/MIT > ).
2746
2847## Crate Feature Flags
2948
30- * ` nightly ` : This is the default.
31- * ` stable ` : Use this to build with non-nightly rust. Needs ` default-features = false ` .
49+ * ` port_nightly ` : This is the default.
50+ * ` port_stable ` : Use this to build with non-nightly rust. Needs ` default-features = false ` .
51+ * ` mmio_nightly ` : Use this to initialize serial port through memory mapped I/O.
52+ * ` mmio_stable ` : Use this to build with non-nightly rust. Needs ` default-features = false ` .
3253
3354## Building with stable rust
3455
You can’t perform that action at this time.
0 commit comments