Skip to content

Commit d212f55

Browse files
committed
Add memory mapping documentation
1 parent bfe42dd commit d212f55

7 files changed

Lines changed: 241 additions & 0 deletions

File tree

docs/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ if(Sphinx_FOUND)
1313
"${CMAKE_CURRENT_LIST_DIR}/src/assets/wishbone-write.svg"
1414
"${CMAKE_CURRENT_LIST_DIR}/src/assets/traceability.svg"
1515
"${CMAKE_CURRENT_LIST_DIR}/src/index.rst"
16+
"${CMAKE_CURRENT_LIST_DIR}/src/guide/registers.rst"
17+
"${CMAKE_CURRENT_LIST_DIR}/src/spec/content/spi_cr.rst"
18+
"${CMAKE_CURRENT_LIST_DIR}/src/spec/content/spi_rxdr.rst"
19+
"${CMAKE_CURRENT_LIST_DIR}/src/spec/content/spi_sr.rst"
20+
"${CMAKE_CURRENT_LIST_DIR}/src/spec/content/spi_txdr.rst"
1621
"${CMAKE_CURRENT_LIST_DIR}/src/spec/index.rst"
1722
"${CMAKE_CURRENT_LIST_DIR}/src/spec/1_introduction.rst"
1823
"${CMAKE_CURRENT_LIST_DIR}/src/spec/2_overall-description.rst"

docs/src/guide/registers.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,40 @@ Memory Map and Registers
1414
- Reset value
1515
- Section/page
1616

17+
* - 0000_0000h
18+
- Status register (SPI_SR)
19+
- 32
20+
- R
21+
- 0000_0000h
22+
- :ref:`SPI_SR <GUIDE_SPI_SR>`
23+
* - 0000_0004h
24+
- Control register (SPI_CR)
25+
- 32
26+
- R/W
27+
- 0000_0000h
28+
- :ref:`SPI_CR <GUIDE_SPI_CR>`
29+
* - 0000_0008h
30+
- Receive Data register (SPI_RXDR)
31+
- 32
32+
- R
33+
- 0000_0000h
34+
- :ref:`SPI_RXDR <GUIDE_SPI_RXDR>`
35+
* - 0000_000Ch
36+
- Transmit Data register (SPI_TXDR)
37+
- 32
38+
- W
39+
- 0000_0000h
40+
- :ref:`SPI_TXDR <GUIDE_SPI_TXDR>`
41+
42+
.. _GUIDE_SPI_SR:
43+
.. include:: ../spec/content/spi_sr.rst
44+
45+
.. _GUIDE_SPI_CR:
46+
.. include:: ../spec/content/spi_cr.rst
47+
48+
.. _GUIDE_SPI_RXDR:
49+
.. include:: ../spec/content/spi_rxdr.rst
50+
51+
.. _GUIDE_SPI_TXDR:
52+
.. include:: ../spec/content/spi_txdr.rst
53+

docs/src/spec/3_requirements.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,55 @@ Memory-mapped registers
142142

143143
The following registers shall be implemented and accessible through the wishbone memory interface.
144144

145+
.. list-table::
146+
:header-rows: 1
147+
:widths: 1 94 1 1 1 1
148+
149+
* - Address Offset
150+
- Register name
151+
- Width (in bits)
152+
- Access
153+
- Reset value
154+
- Section/page
155+
156+
* - 0000_0000h
157+
- Status register (SPI_SR)
158+
- 32
159+
- R
160+
- 0000_0000h
161+
- :ref:`SPI_SR <GUIDE_SPI_SR>`
162+
* - 0000_0004h
163+
- Control register (SPI_CR)
164+
- 32
165+
- R/W
166+
- 0000_0000h
167+
- :ref:`SPI_CR <GUIDE_SPI_CR>`
168+
* - 0000_0008h
169+
- Receive Data register (SPI_RXDR)
170+
- 32
171+
- R
172+
- 0000_0000h
173+
- :ref:`SPI_RXDR <GUIDE_SPI_RXDR>`
174+
* - 0000_000Ch
175+
- Transmit Data register (SPI_TXDR)
176+
- 32
177+
- W
178+
- 0000_0000h
179+
- :ref:`SPI_TXDR <GUIDE_SPI_TXDR>`
180+
181+
.. _GUIDE_SPI_SR:
182+
.. include:: ../spec/content/spi_sr.rst
183+
184+
.. _GUIDE_SPI_CR:
185+
.. include:: ../spec/content/spi_cr.rst
186+
187+
.. _GUIDE_SPI_RXDR:
188+
.. include:: ../spec/content/spi_rxdr.rst
189+
190+
.. _GUIDE_SPI_TXDR:
191+
.. include:: ../spec/content/spi_txdr.rst
192+
193+
145194
Non-functional Requirements
146195
---------------------------
147196

docs/src/spec/content/spi_cr.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Control register (SPI_CR)
2+
""""""""""""""""""""""""""
3+
4+
SPI_CR contains the control for selecting the SPI frequency and controlling the chip select.
5+
6+
.. bitfield::
7+
:bits: 32
8+
:lanes: 2
9+
:vspace: 70
10+
:hspace: 700
11+
12+
[
13+
{ "name": "CS", "bits": 1},
14+
{ "name": "reserved", "bits": 15, "type": 1},
15+
{ "name": "PRESCALER", "bits": 16}
16+
]
17+
18+
|
19+
20+
.. list-table::
21+
:header-rows: 1
22+
:widths: 1 1 99
23+
24+
* - Position
25+
- Field
26+
- Description
27+
28+
* - 31-16
29+
- Prescaler
30+
- *SPI frequency selector*
31+
32+
The specified SPI frequency is f_spi = (f_sys / (2 * prescaler)).
33+
* - 15-1
34+
- reserved
35+
- *This field is reserved.*
36+
37+
This read-only field is reserved and always has the value 0.
38+
* - 0
39+
- CS
40+
- *Active-high Chip select*
41+
42+
0 |tab| Chip-select disabled
43+
44+
1 |tab| Chip-select enabled

docs/src/spec/content/spi_rxdr.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Receive Data register (SPI_RXDR)
2+
"""""""""""""""""""""""""""""""""
3+
4+
.. bitfield::
5+
:bits: 32
6+
:lanes: 2
7+
:vspace: 70
8+
:hspace: 700
9+
10+
[
11+
{ "name": "RXD", "bits": 8},
12+
{ "name": "reserved", "bits": 24, "type": 1}
13+
]
14+
15+
|
16+
17+
.. list-table::
18+
:header-rows: 1
19+
:widths: 1 1 99
20+
21+
* - Position
22+
- Field
23+
- Description
24+
25+
* - 31-8
26+
- reserved
27+
- *This field is reserved.*
28+
29+
This read-only field is reserved and always has the value 0.
30+
* - 7-0
31+
- RXD
32+
- *Receive Data*
33+
34+
The received data is written to this field.
35+
36+
The field is cleared by hardware after being read.

docs/src/spec/content/spi_sr.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Status register (SPI_SR)
2+
"""""""""""""""""""""""""
3+
4+
.. bitfield::
5+
:bits: 32
6+
:lanes: 2
7+
:vspace: 70
8+
:hspace: 700
9+
10+
[
11+
{ "name": "TXE", "bits": 1},
12+
{ "name": "reserved", "bits": 31, "type": 1}
13+
]
14+
15+
|
16+
17+
.. list-table::
18+
:header-rows: 1
19+
:widths: 1 1 99
20+
21+
* - Position
22+
- Field
23+
- Description
24+
25+
* - 31-1
26+
- Reserved
27+
- *This field is reserved.*
28+
29+
This read-only field is reserved and always has the value 0.
30+
* - 0
31+
- TXE
32+
- *Transmit register Empty*
33+
34+
0 |tab| The transmit register is full (being sent)
35+
36+
1 |tab| The transmit register is empty

docs/src/spec/content/spi_txdr.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Transmit Data register (SPI_TXDR)
2+
""""""""""""""""""""""""""""""""""
3+
4+
.. bitfield::
5+
:bits: 32
6+
:lanes: 2
7+
:vspace: 70
8+
:hspace: 700
9+
10+
[
11+
{ "name": "TXD", "bits": 8},
12+
{ "name": "reserved", "bits": 24, "type": 1}
13+
]
14+
15+
|
16+
17+
.. list-table::
18+
:header-rows: 1
19+
:widths: 1 1 99
20+
21+
* - Position
22+
- Field
23+
- Description
24+
25+
* - 31-8
26+
- reserved
27+
- *This field is reserved.*
28+
* - 7-0
29+
- TXD
30+
- *Transmit Data*
31+
32+
Data written to this field is sent through the serial link.
33+
34+
The TXE field of the SPI_SR shall be sample before writing again to this field to prevent data loss.

0 commit comments

Comments
 (0)