summaryrefslogtreecommitdiff
path: root/doc/mmio.txt
blob: b4c384bfba3c091c336ed3a565129875b00ba616 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
RVController Memory-Mapped I/O
==============================

Base address is configurable, see csr.txt.

Base + 0: Mesecons I/O Direction

 31                     4   3    2    1    0
+---------------------------------------------+
|        Reserved         |MDRD|MDRC|MDRB|MDRA|
+---------------------------------------------+

MDRA: Mesecons I/O Direction, pin A
MDRB: Mesecons I/O Direction, pin B
MDRC: Mesecons I/O Direction, pin C
MDRD: Mesecons I/O Direction, pin D

When a bit in this register is set to 0, the corresponding pin is an input.
When set to 1, the corresponding pin is an output.
Changing a pin from output to input while the output is active may cause unusual behavior due to Luacontroller limitations.

Base + 1: Mesecons I/O Data

 31                     4   3    2    1    0
+---------------------------------------------+
|        Reserved         |MDTD|MDTC|MDTB|MDTA|
+---------------------------------------------+

MDTA: Mesecons I/O Data, pin A
MDTB: Mesecons I/O Data, pin B
MDTC: Mesecons I/O Data, pin C
MDTD: Mesecons I/O Data, pin D
For inputs: Each bit contains the state of the corresponding input. Writes are ignored.
For outputs: Each bit contains the state of the corresponding output. Writing to these bits turns the output on/off.
Fields are read-only for inputs and read/write for outputs.

Base + 2: mtime (see RISC-V Machine Level ISA specification)

Base + 10: mtimecmp (see RISC-V Machine Level ISA specification)

Base + 18 - Base + 255: Reserved