mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
cores/spi: add CSR descriptions.
This commit is contained in:
parent
6d861c6e57
commit
77132a48b0
1 changed files with 12 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
# This file is Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr>
|
# This file is Copyright (c) 2019-2020 Florent Kermarrec <florent@enjoy-digital.fr>
|
||||||
# License: BSD
|
# License: BSD
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
@ -125,14 +125,18 @@ class SPIMaster(Module, AutoCSR):
|
||||||
|
|
||||||
def add_csr(self):
|
def add_csr(self):
|
||||||
self._control = CSRStorage(fields=[
|
self._control = CSRStorage(fields=[
|
||||||
CSRField("start", size=1, offset=0, pulse=True),
|
CSRField("start", size=1, offset=0, pulse=True, description="Write ``1`` to start SPI Xfer"),
|
||||||
CSRField("length", size=8, offset=8)])
|
CSRField("length", size=8, offset=8, description="SPI Xfer length (in bits).")
|
||||||
|
], description="SPI Control.")
|
||||||
self._status = CSRStatus(fields=[
|
self._status = CSRStatus(fields=[
|
||||||
CSRField("done", size=1, offset=0)])
|
CSRField("done", size=1, offset=0, description="SPI Xfer done when read as ``1``.")
|
||||||
self._mosi = CSRStorage(self.data_width)
|
], description="SPI Status.")
|
||||||
self._miso = CSRStatus(self.data_width)
|
self._mosi = CSRStorage(self.data_width, description="SPI MOSI data (MSB-first serialization).")
|
||||||
self._cs = CSRStorage(len(self.cs), reset=1)
|
self._miso = CSRStatus(self.data_width, description="SPI MISO data (MSB-first de-serialization).")
|
||||||
self._loopback = CSRStorage()
|
self._cs = CSRStorage(fields=[
|
||||||
|
CSRField("sel", len(self.cs), reset=1, description="Write ``1`` to corresponding bit to enable Xfer for chip.")
|
||||||
|
], description="SPI Chip Select.")
|
||||||
|
self._loopback = CSRStorage(description="SPI loopback mode.\n\n Write ``1`` to enable MOSI to MISO internal loopback.")
|
||||||
|
|
||||||
self.comb += [
|
self.comb += [
|
||||||
self.start.eq(self._control.fields.start),
|
self.start.eq(self._control.fields.start),
|
||||||
|
|
Loading…
Reference in a new issue