def __init__(self, x, y, p, packet_types):
        """
        :param x: The x-coordinate of a chip, between 0 and 255
        :type x: int
        :param y: The y-coordinate of a chip, between 0 and 255
        :type y: int
        :param p: The processor running the dropped packet reinjector, between\
                0 and 17
        :type p: int
        :param packet_types: The types of packet to reinject - if empty or\
                None reinjection is disabled
        :type packet_types: None or list of \
                `py:class:spinnman.messages.scp.scp_dpri_packet_type_flags.SCPDPRIPacketTypeFlags`
        """
        flags = 0
        if packet_types is not None:
            for packet_type in packet_types:
                flags |= packet_type.value

        AbstractSCPRequest.__init__(
            self,
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=p,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_DPRI),
            argument_1=SCPDPRICommand.SET_PACKET_TYPES.value,
            argument_2=flags)
    def __init__(self,
                 x,
                 y,
                 p,
                 run_time,
                 infinite_run,
                 destination_port,
                 expect_response=True):
        sdp_flags = SDPFlag.REPLY_NOT_EXPECTED
        arg3 = 0
        if expect_response:
            sdp_flags = SDPFlag.REPLY_EXPECTED
            arg3 = 1

        AbstractSCPRequest.__init__(
            self,
            SDPHeader(flags=sdp_flags,
                      destination_port=destination_port,
                      destination_cpu=p,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=(
                constants.SDP_RUNNING_MESSAGE_CODES.SDP_NEW_RUNTIME_ID_CODE)),
            argument_1=run_time,
            argument_2=infinite_run,
            argument_3=arg3)
 def __init__(self, x, y, p, timeout_mantissa, timeout_exponent):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     :param p: The processor running the dropped packet reinjector, between\
             0 and 17
     :type p: int
     :param timeout_mantissa: The mantissa of the timeout value, \
             between 0 and 15
     :type timeout_mantissa: int
     :param timeout_exponent: The exponent of the timeout value, \
             between 0 and 15
     """
     AbstractSCPRequest.__init__(
         self,
         SDPHeader(
             flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
             destination_cpu=p, destination_chip_x=x,
             destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_DPRI),
         argument_1=SCPDPRICommand.SET_ROUTER_TIMEOUT.value,
         argument_2=(timeout_mantissa & 0xF) |
                    ((timeout_exponent & 0xF) << 4))
    def __init__(self, x, y, p, packet_types):
        """
        :param x: The x-coordinate of a chip, between 0 and 255
        :type x: int
        :param y: The y-coordinate of a chip, between 0 and 255
        :type y: int
        :param p: The processor running the dropped packet reinjector, between\
                0 and 17
        :type p: int
        :param packet_types: The types of packet to reinject - if empty or\
                None reinjection is disabled
        :type packet_types: None or list of \
                `py:class:spinnman.messages.scp.scp_dpri_packet_type_flags.SCPDPRIPacketTypeFlags`
        """
        flags = 0
        if packet_types is not None:
            for packet_type in packet_types:
                flags |= packet_type.value

        AbstractSCPRequest.__init__(
            self,
            SDPHeader(
                flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
                destination_cpu=p, destination_chip_x=x,
                destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_DPRI),
            argument_1=SCPDPRICommand.SET_PACKET_TYPES.value,
            argument_2=flags)
示例#5
0
    def __init__(self,
                 boards,
                 scp_request_header,
                 argument_1=None,
                 argument_2=None,
                 argument_3=None,
                 data=None):
        """

        :param boards: The board or boards to be addressed by this request
        :type boards: int or iterable of int
        :param scp_request_header: The SCP request header
        :param argument_1: The optional first argument
        :param argument_2: The optional second argument
        :param argument_3: The optional third argument
        :param data: The optional data to be sent
        """

        sdp_header = SDPHeader(
            flags=SDPFlag.REPLY_EXPECTED,
            destination_port=0,
            destination_cpu=AbstractSCPBMPRequest.get_first_board(boards),
            destination_chip_x=0,
            destination_chip_y=0)
        AbstractSCPRequest.__init__(self, sdp_header, scp_request_header,
                                    argument_1, argument_2, argument_3, data)
示例#6
0
 def __init__(self, x, y, p, timeout_mantissa, timeout_exponent):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     :param p: The processor running the dropped packet reinjector, between\
             0 and 17
     :type p: int
     :param timeout_mantissa: The mantissa of the timeout value, \
             between 0 and 15
     :type timeout_mantissa: int
     :param timeout_exponent: The exponent of the timeout value, \
             between 0 and 15
     """
     AbstractSCPRequest.__init__(
         self,
         SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                   destination_port=0,
                   destination_cpu=p,
                   destination_chip_x=x,
                   destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_DPRI),
         argument_1=SCPDPRICommand.SET_ROUTER_TIMEOUT.value,
         argument_2=(timeout_mantissa & 0xF) |
         ((timeout_exponent & 0xF) << 4))
 def __init__(self, x, y, p):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     :param p: The processor running the dropped packet reinjector, between\
             0 and 17
     :type p: int
     """
     AbstractSCPRequest.__init__(
         self,
         SDPHeader(
             flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
             destination_cpu=p, destination_chip_x=x,
             destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_DPRI),
         argument_1=SCPDPRICommand.RESET_COUNTERS.value)
 def __init__(self, x, y, p):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     :param p: The processor running the dropped packet reinjector, between\
             0 and 17
     :type p: int
     """
     AbstractSCPRequest.__init__(
         self,
         SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                   destination_port=0,
                   destination_cpu=p,
                   destination_chip_x=x,
                   destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_DPRI),
         argument_1=SCPDPRICommand.RESET_COUNTERS.value)
    def __init__(self, boards, scp_request_header, argument_1=None,
                 argument_2=None, argument_3=None, data=None):
        """

        :param boards: The board or boards to be addressed by this request
        :type boards: int or iterable of int
        :param scp_request_header: The SCP request header
        :param argument_1: The optional first argument
        :param argument_2: The optional second argument
        :param argument_3: The optional third argument
        :param data: The optional data to be sent
        """

        sdp_header = SDPHeader(
            flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
            destination_cpu=AbstractSCPBMPRequest.get_first_board(boards),
            destination_chip_x=0, destination_chip_y=0)
        AbstractSCPRequest.__init__(self, sdp_header, scp_request_header,
                                    argument_1, argument_2, argument_3, data)
示例#10
0
    def __init__(self, x, y, app_id, base_address=None):
        """

        :param x: The x-coordinate of the chip to allocate on, between 0 and\
                    255
        :type x: int
        :param y: The y-coordinate of the chip to allocate on, between 0 and\
                    255
        :type y: int
        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param base_address: The start address in SDRAM to which the block\
                needs to be deallocated, or none if deallocating via app_id
        :type base_address: int or None
        """

        if base_address is not None:
            AbstractSCPRequest.__init__(
                self,
                SDPHeader(flags=SDPFlag.REPLY_NOT_EXPECTED,
                          destination_port=0,
                          destination_cpu=0,
                          destination_chip_x=x,
                          destination_chip_y=y),
                SCPRequestHeader(command=SCPCommand.CMD_ALLOC),
                argument_1=(app_id << 8
                            | SCPAllocFreeType.FREE_SDRAM_BY_POINTER.value
                            ),  # @UndefinedVariable
                argument_2=base_address)
        else:
            AbstractSCPRequest.__init__(
                self,
                SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                          destination_port=0,
                          destination_cpu=0,
                          destination_chip_x=x,
                          destination_chip_y=y),
                SCPRequestHeader(command=SCPCommand.CMD_ALLOC),
                argument_1=(app_id << 8
                            | SCPAllocFreeType.FREE_ROUTING_BY_APP_ID.value
                            ))  # @UndefinedVariable
    def __init__(self, x, y, app_id, size, tag=None):
        """

        :param x: The x-coordinate of the chip to allocate on, between 0 and\
                    255
        :type x: int
        :param y: The y-coordinate of the chip to allocate on, between 0 and\
                    255
        :type y: int
        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param size: The size in bytes of memory to be allocated
        :type size: int
        :param tag: the tag for the SDRAM, a 8-bit (chip-wide) tag that can be\
                looked up by a SpiNNaker application to discover the address\
                of the allocated block. If `0` then no tag is applied.
        :type tag: int
        """

        if tag is None:
            tag = 0
        elif not (0 <= tag < 256):
            raise exceptions.SpinnmanInvalidParameterException(
                "The tag param needs to be between 0 and 255, or None (in "
                "which case 0 will be used by default)")

        AbstractSCPRequest.__init__(
            self,
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=0,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_ALLOC),
            argument_1=(
                (app_id << 8)
                | SCPAllocFreeType.ALLOC_SDRAM.value),  # @UndefinedVariable
            argument_2=size,
            argument_3=tag)
        self._size = size