mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-18 16:06:30 +08:00
mirny: add to manual
This commit is contained in:
parent
da531404e8
commit
9368c26d1c
@ -1,5 +1,5 @@
|
|||||||
""""RTIO driver for the Analog Devices ADF[45]35[56] family of GHz PLLs
|
"""RTIO driver for the Analog Devices ADF[45]35[56] family of GHz PLLs
|
||||||
on Mirny-style prefixed SPI buses
|
on Mirny-style prefixed SPI buses.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# https://github.com/analogdevicesinc/linux/blob/master/Documentation/devicetree/bindings/iio/frequency/adf5355.txt
|
# https://github.com/analogdevicesinc/linux/blob/master/Documentation/devicetree/bindings/iio/frequency/adf5355.txt
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
"""RTIO driver for Mirny (4 channel GHz PLLs)
|
||||||
|
"""
|
||||||
|
|
||||||
from artiq.language.core import kernel, delay
|
from artiq.language.core import kernel, delay
|
||||||
from artiq.language.units import us
|
from artiq.language.units import us
|
||||||
|
|
||||||
@ -17,9 +20,16 @@ SPIT_RD = 16
|
|||||||
|
|
||||||
SPI_CS = 1
|
SPI_CS = 1
|
||||||
|
|
||||||
|
WE = 1 << 24
|
||||||
|
|
||||||
|
|
||||||
class Mirny:
|
class Mirny:
|
||||||
WE = 1 << 24
|
"""Mirny PLL-based RF generator.
|
||||||
kernel_invariants = {"bus", "core", "WE"}
|
|
||||||
|
:param spi_device: SPI bus device
|
||||||
|
:param core_device: Core device name (default: "core")
|
||||||
|
"""
|
||||||
|
kernel_invariants = {"bus", "core"}
|
||||||
|
|
||||||
def __init__(self, dmgr, spi_device, core_device="core"):
|
def __init__(self, dmgr, spi_device, core_device="core"):
|
||||||
self.core = dmgr.get(core_device)
|
self.core = dmgr.get(core_device)
|
||||||
@ -27,6 +37,7 @@ class Mirny:
|
|||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def read_reg(self, addr):
|
def read_reg(self, addr):
|
||||||
|
"""Read a register"""
|
||||||
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_INPUT | spi.SPI_END, 24,
|
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_INPUT | spi.SPI_END, 24,
|
||||||
SPIT_RD, SPI_CS)
|
SPIT_RD, SPI_CS)
|
||||||
self.bus.write((addr << 25))
|
self.bus.write((addr << 25))
|
||||||
@ -34,11 +45,14 @@ class Mirny:
|
|||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def write_reg(self, addr, data):
|
def write_reg(self, addr, data):
|
||||||
|
"""Write a register"""
|
||||||
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END, 24, SPIT_WR, SPI_CS)
|
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END, 24, SPIT_WR, SPI_CS)
|
||||||
self.bus.write((addr << 25) | self.WE | ((data & 0xffff) << 8))
|
self.bus.write((addr << 25) | WE | ((data & 0xffff) << 8))
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def init(self):
|
def init(self):
|
||||||
|
"""Initialize Mirny by reading the status register and verifying
|
||||||
|
compatible hardware and protocol revisions"""
|
||||||
reg0 = self.read_reg(0)
|
reg0 = self.read_reg(0)
|
||||||
if reg0 & 0b11 != 0b11:
|
if reg0 & 0b11 != 0b11:
|
||||||
raise ValueError("Mirny HW_REV mismatch")
|
raise ValueError("Mirny HW_REV mismatch")
|
||||||
@ -57,6 +71,7 @@ class Mirny:
|
|||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def write_ext(self, addr, length, data):
|
def write_ext(self, addr, length, data):
|
||||||
|
"""Perform SPI write to a prefixed address"""
|
||||||
self.bus.set_config_mu(SPI_CONFIG, 8, SPIT_WR, SPI_CS)
|
self.bus.set_config_mu(SPI_CONFIG, 8, SPIT_WR, SPI_CS)
|
||||||
self.bus.write(addr << 25)
|
self.bus.write(addr << 25)
|
||||||
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END, length,
|
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END, length,
|
||||||
|
@ -99,6 +99,18 @@ RF generation drivers
|
|||||||
.. automodule:: artiq.coredevice.ad9914
|
.. automodule:: artiq.coredevice.ad9914
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
:mod:`artiq.coredevice.mirny` module
|
||||||
|
+++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
.. automodule:: artiq.coredevice.mirny
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:mod:`artiq.coredevice.adf5355` module
|
||||||
|
+++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
.. automodule:: artiq.coredevice.adf5355
|
||||||
|
:members:
|
||||||
|
|
||||||
:mod:`artiq.coredevice.spline` module
|
:mod:`artiq.coredevice.spline` module
|
||||||
+++++++++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user