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 2
2
3
3
[ ![ 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/ )
4
4
5
- Minimal support for uart_16550 serial I/O.
5
+ Minimal support for uart_16550 serial and memory mapped I/O.
6
6
7
7
## Usage
8
8
9
+ ### With ` port_{stable, nightly} ` feature
10
+
9
11
``` rust
10
12
use uart_16550 :: SerialPort ;
11
13
@@ -21,14 +23,33 @@ serial_port.send(42);
21
23
let data = serial_port . receive ();
22
24
```
23
25
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
+
24
43
## License
25
44
26
45
Licensed under the MIT license ([ LICENSE] ( LICENSE ) or < http://opensource.org/licenses/MIT > ).
27
46
28
47
## Crate Feature Flags
29
48
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 ` .
32
53
33
54
## Building with stable rust
34
55
You can’t perform that action at this time.
0 commit comments