コード例 #1
0
    def __init__(self, fpga_num, addr, value, board):
        """ Write the value of an FPGA (SPI) register.

        See the SpI/O project's spinnaker_fpga design's `README`_ for a listing
        of FPGA registers. The SpI/O project can be found on GitHub at:
        https://github.com/SpiNNakerManchester/spio/

        .. _README: https://github.com/SpiNNakerManchester/spio/\
                    blob/master/designs/spinnaker_fpgas/README.md#spi-interface

        :param fpga_num: FPGA number (0, 1 or 2) to communicate with.
        :type fpga_num: int
        :param addr: Register address to read or write to (will be rounded
                    down to the nearest 32-bit word boundary).
        :type addr: int
        :param value: A 32-bit int value to write to the register
        :type value: int
        :return:
        """

        AbstractSCPBMPRequest.__init__(
            self,
            board,
            SCPRequestHeader(command=SCPCommand.CMD_LINK_WRITE),
            argument_1=addr & (~0x3),
            argument_2=4,
            argument_3=fpga_num,
            data=struct.pack("<I", value))
コード例 #2
0
    def __init__(self, led, action, boards):
        """

        :param led: Number of the LED or an iterable of LEDs to set the\
                state of (0-7)
        :type led: int or iterable of int
        :param action: State to set the LED to, either on, off or toggle
        :type action:\
                :py:class:`spinnman.messages.scp.scp_led_action.SCPLEDAction`
        :param boards: Specifies the board to control the LEDs of. This may\
                also be an iterable of multiple boards (in the same frame).
        :type board: int or iterable of int
        :return: None
        """

        # set up the led entry for arg1
        if isinstance(led, int):
            leds = [led]
        else:
            leds = led

        # LED setting actions
        arg1 = sum(action.value << (led * 2) for led in leds)

        # Bitmask of boards to control
        arg2 = self.get_board_mask(boards)

        # initilise the request now
        AbstractSCPBMPRequest.__init__(
            self, boards,
            SCPRequestHeader(command=SCPCommand.CMD_LED),
            argument_1=arg1, argument_2=arg2)
コード例 #3
0
    def __init__(self, led, action, boards):
        """

        :param led: Number of the LED or an iterable of LEDs to set the\
                state of (0-7)
        :type led: int or iterable of int
        :param action: State to set the LED to, either on, off or toggle
        :type action:\
                :py:class:`spinnman.messages.scp.scp_led_action.SCPLEDAction`
        :param boards: Specifies the board to control the LEDs of. This may\
                also be an iterable of multiple boards (in the same frame).
        :type board: int or iterable of int
        :return: None
        """

        # set up the led entry for arg1
        if isinstance(led, int):
            leds = [led]
        else:
            leds = led

        # LED setting actions
        arg1 = sum(action.value << (led * 2) for led in leds)

        # Bitmask of boards to control
        arg2 = self.get_board_mask(boards)

        # initilise the request now
        AbstractSCPBMPRequest.__init__(
            self,
            boards,
            SCPRequestHeader(command=SCPCommand.CMD_LED),
            argument_1=arg1,
            argument_2=arg2)
コード例 #4
0
    def __init__(self, fpga_num, addr, value, board):
        """ Write the value of an FPGA (SPI) register.

        See the SpI/O project's spinnaker_fpga design's `README`_ for a listing
        of FPGA registers. The SpI/O project can be found on GitHub at:
        https://github.com/SpiNNakerManchester/spio/

        .. _README: https://github.com/SpiNNakerManchester/spio/\
                    blob/master/designs/spinnaker_fpgas/README.md#spi-interface

        :param fpga_num: FPGA number (0, 1 or 2) to communicate with.
        :type fpga_num: int
        :param addr: Register address to read or write to (will be rounded
                    down to the nearest 32-bit word boundary).
        :type addr: int
        :param value: A 32-bit int value to write to the register
        :type value: int
        :return:
        """

        AbstractSCPBMPRequest.__init__(
            self, board,
            SCPRequestHeader(command=SCPCommand.CMD_LINK_WRITE),
            argument_1=addr & (~0x3), argument_2=4, argument_3=fpga_num,
            data=struct.pack("<I", value))
コード例 #5
0
    def __init__(self, board):
        """

        :param board: which board to request the adc register from
        :return:
        """
        AbstractSCPBMPRequest.__init__(
            self, board,
            SCPRequestHeader(command=SCPCommand.CMD_BMP_INFO),
            argument_1=SCPBMPInfoType.ADC)
コード例 #6
0
 def __init__(self, board):
     """
     :param board: The board to get the version from
     :type board: int
     :raise spinnman.exceptions.SpinnmanInvalidParameterException:
                 * If the chip coordinates are out of range
                 * If the processor is out of range
     """
     AbstractSCPBMPRequest.__init__(
         self, board, SCPRequestHeader(command=SCPCommand.CMD_VER))
コード例 #7
0
    def __init__(self, board):
        """

        :param board: which board to request the adc register from
        :return:
        """
        AbstractSCPBMPRequest.__init__(
            self,
            board,
            SCPRequestHeader(command=SCPCommand.CMD_BMP_INFO),
            argument_1=SCPBMPInfoType.ADC)
コード例 #8
0
 def __init__(self, board):
     """
     :param board: The board to get the version from
     :type board: int
     :raise spinnman.exceptions.SpinnmanInvalidParameterException:
                 * If the chip coordinates are out of range
                 * If the processor is out of range
     """
     AbstractSCPBMPRequest.__init__(
         self, board,
         SCPRequestHeader(command=SCPCommand.CMD_VER))
コード例 #9
0
    def __init__(self, fpga_num, register, board):
        """
        sets up a read fpga register request
        :param fpga_num: FPGA number (0, 1 or 2) to communicate with.
        :param register: Register address to read to (will be rounded down to
                the nearest 32-bit word boundary).
        :param board: which board to request the fpga register from
        :return: None
        """

        # check to stop people asking for none word aligned memory addresses
        # inverses all bits of a value, so is basically a inverse mask for the
        # value entered.
        arg1 = register & (~0x3)
        AbstractSCPBMPRequest.__init__(
            self, board,
            SCPRequestHeader(
                command=SCPCommand.CMD_LINK_READ),
            argument_1=arg1, argument_2=4, argument_3=fpga_num)
コード例 #10
0
ファイル: scp_power_request.py プロジェクト: Scaatis/SpiNNMan
    def __init__(self, power_command, boards, delay=0.0):
        """
        :param power_command: The power command being sent
        :type power_command:\
                :py:class:`spinnman.messages.scp.scp_power_command.SCPPowerCommand`
        :param boards: The boards on the same backplane to power on or off
        :type board: int or iterable of int
        :param delay: Number of seconds delay between power state changes of\
                the different boards.
        :type delay: int
        :return:
        """

        arg1 = (int(delay * 1000) << 16) | power_command.value
        arg2 = self.get_board_mask(boards)

        AbstractSCPBMPRequest.__init__(
            self, boards,
            SCPRequestHeader(command=SCPCommand.CMD_BMP_POWER),
            argument_1=arg1, argument_2=arg2)
コード例 #11
0
    def __init__(self, power_command, boards, delay=0.0):
        """
        :param power_command: The power command being sent
        :type power_command:\
                :py:class:`spinnman.messages.scp.scp_power_command.SCPPowerCommand`
        :param boards: The boards on the same backplane to power on or off
        :type board: int or iterable of int
        :param delay: Number of seconds delay between power state changes of\
                the different boards.
        :type delay: int
        :return:
        """

        arg1 = (int(delay * 1000) << 16) | power_command.value
        arg2 = self.get_board_mask(boards)

        AbstractSCPBMPRequest.__init__(
            self,
            boards,
            SCPRequestHeader(command=SCPCommand.CMD_BMP_POWER),
            argument_1=arg1,
            argument_2=arg2)