File: dboard_iface.py

package info (click to toggle)
uhd 4.9.0.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184,180 kB
  • sloc: cpp: 262,887; python: 112,011; ansic: 102,670; vhdl: 57,031; tcl: 19,924; xml: 8,581; makefile: 3,028; sh: 2,812; pascal: 230; javascript: 120; csh: 94; asm: 20; perl: 11
file content (94 lines) | stat: -rw-r--r-- 3,571 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#
# Copyright 2019 Ettus Research, a National Instruments Brand
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

class DboardIface(object):
    """
    An interface through which Motherboard drivers can expose certain
    functionality to Daughterboard drivers within MPM.

    Each Motherboard should have its own instance of this interface,
    implementing the relevant methods.

    slot_idx - The numerical ID of the daughterboard slot using this
               interface (e.g. 0, 1)
    motherboard - The instance of the motherboard class which implements
                  these controls
    """
    # The device tree label for the bus to the DB's Management EEPROM
    MGMT_EEPROM_DEVICE_LABEL = None

    def __init__(self, slot_idx, motherboard):
        self.slot_idx = slot_idx
        self.mboard = motherboard
        self.db_name = "db_{}".format(self.slot_idx)

        if hasattr(self.mboard, 'log'):
            self.log = self.mboard.log.getChild("DboardIface")

    def tear_down(self):
        """
        Tear down all members that need to be specially handled before
        deconstruction.
        """
        # The mboard object is the periph_manager that has the dboard
        # that in turn has this DboardIface. Breaking the reference
        # cycle will make garbage collection easier.
        self.mboard = None

    ####################################################################
    # Power
    #   Enable and disable the DB's power rails
    ####################################################################
    def enable_daughterboard(self, enable = True):
        """
        Enable or disable the daughterboard.
        """
        raise NotImplementedError('DboardIface::enable_daughterboard() not supported!')

    def check_enable_daughterboard(self):
        """
        Return the enable state of the daughterboard.
        """
        raise NotImplementedError('DboardIface::check_enable_daughterboard() not supported!')

    ####################################################################
    # CTRL SPI
    #   CTRL SPI lines are connected to the CPLD of the DB if it exists
    ####################################################################
    def peek_db_cpld(self, addr):
        raise NotImplementedError('DboardIface::peek_db_cpld() not supported!')

    def poke_db_cpld(self, addr, val):
        raise NotImplementedError('DboardIface::poke_db_cpld() not supported!')

    def ctrl_spi_reset(self):
        raise NotImplementedError('DboardIface::ctrl_spi_reset() not supported!')

    ####################################################################
    # MB Control
    #   Some of the MB settings may be controlled from the DB Driver
    ####################################################################
    def set_reference_clock(self, freq):
        raise NotImplementedError('DboardIface::set_reference_clock() not supported!')

    def enable_iq_swap(self, enable, direction, channel):
        """
        Enable or disable swap of I and Q samples from the RFDCs.
        """
        raise NotImplementedError('DboardIface::enable_iq_swap() not supported!')

    def get_sample_rate(self):
        """
        Gets the sample rate of the RFDCs.
        """
        raise NotImplementedError('DboardIface::get_sample_rate() not supported!')

    def get_prc_rate(self):
        """
        Returns the rate of the PLL Reference Clock (PRC) which is
        routed to the daughterboard.
        """
        raise NotImplementedError('DboardIface::get_pll_ref_clock() not supported!')