Skip to content

Commit

Permalink
board speficic boot values trom Transciever
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Aug 4, 2023
1 parent 9571a89 commit 3fb73de
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 31 deletions.
7 changes: 2 additions & 5 deletions spinnman/messages/spinnaker_boot/spinnaker_boot_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
SystemVariableBootValues, SystemVariableDefinition)
from .spinnaker_boot_message import SpinnakerBootMessage
from .spinnaker_boot_op_code import SpinnakerBootOpCode
from spinnman.exceptions import (
SpinnmanInvalidParameterException, SpinnmanIOException)
from spinnman.exceptions import SpinnmanIOException

_BOOT_MESSAGE_DATA_WORDS = 256
_BOOT_MESSAGE_DATA_BYTES = _BOOT_MESSAGE_DATA_WORDS * 4
Expand All @@ -44,11 +43,11 @@ class SpinnakerBootMessages(object):

def __init__(self, led_0, extra_boot_values=None):
"""
:param int led_0: The balue for the led_0 field
:param extra_boot_values:
Any additional or overwrite values to set during boot.
This should only be used for values which are not standard
based on the board version.
for example this may include an Led_0 value.
:type extra_boot_values: dict(SystemVariableDefinition, object)
:raise SpinnmanInvalidParameterException:
If the board version is not supported
Expand All @@ -62,8 +61,6 @@ def __init__(self, led_0, extra_boot_values=None):

spinnaker_boot_value.set_value(
SystemVariableDefinition.hardware_version, version.number)
spinnaker_boot_value.set_value(
SystemVariableDefinition.led_0, led_0)

current_time = int(time.time())
spinnaker_boot_value.set_value(
Expand Down
15 changes: 5 additions & 10 deletions spinnman/messages/spinnaker_boot/system_variable_boot_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ class SystemVariableDefinition(Enum):
led_0 = _Definition(
_DataType.INT, offset=0x30, default=0x1,
doc="The first part of the LED definitions")
# hardware_version=1, led_0=0x00076104),
# hardware_version=2, led_0=0x00006103),
# hardware_version=3, led_0=0x00000502),
# hardware_version=4, led_0=0x00000001),
# hardware_version=5, led_0=0x00000001)}
led_1 = _Definition(
_DataType.INT, offset=0x34,
doc="The last part of the LED definitions")
Expand Down Expand Up @@ -362,7 +367,6 @@ def __init__(self):
for variable in SystemVariableDefinition:
self._values[variable] = variable.default


def set_value(self, system_variable_definition, value):
self._values[system_variable_definition] = value

Expand All @@ -373,12 +377,3 @@ def bytestring(self):
data += struct.pack(sys_var.data_type.struct_code,
self._values[sys_var])
return data


"""
hardware_version=1, led_0=0x00076104),
hardware_version=2, led_0=0x00006103),
hardware_version=3, led_0=0x00000502),
hardware_version=4, led_0=0x00000001),
hardware_version=5, led_0=0x00000001)}
"""
8 changes: 0 additions & 8 deletions spinnman/transceiver/abstract_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,11 +876,3 @@ def update_provenance_and_exit(self, x, y, p):
:param int p:
The processor on the core
"""

@abstractproperty
def boot_led_0_value(self):
"""
The Values to be set in SpinnakerBootMessages for led_0
:rtype int:
"""
18 changes: 15 additions & 3 deletions spinnman/transceiver/base_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
import logging
import socket
import time
from spinn_utilities.abstract_base import (
AbstractBase, abstractproperty)
from spinn_utilities.config_holder import get_config_bool
from spinn_utilities.abstract_context_manager import AbstractContextManager
from spinn_utilities.log import FormatAdapter
from spinn_machine import CoreSubsets
from spinnman.constants import (
Expand Down Expand Up @@ -88,7 +89,7 @@
_EXECUTABLE_ADDRESS = 0x67800000


class BaseTransceiver(AbstractTransceiver):
class BaseTransceiver(AbstractTransceiver, metaclass=AbstractBase):
"""
An encapsulation of various communications with the SpiNNaker board.
Expand Down Expand Up @@ -525,6 +526,14 @@ def _get_scamp_version(
process = GetVersionProcess(connection_selector, n_retries)
return process.get_version(x=chip_x, y=chip_y, p=0)

@abstractproperty
def boot_led_0_value(self):
"""
The Values to be set in SpinnakerBootMessages for led_0
:rtype int:
"""

def _boot_board(self, extra_boot_values=None):
"""
Attempt to boot the board. No check is performed to see if the
Expand All @@ -543,8 +552,11 @@ def _boot_board(self, extra_boot_values=None):
if not self._boot_send_connection:
# No can do. Can't boot without a boot connection.
raise SpinnmanIOException("no boot connection available")
if SystemVariableDefinition.led_0 not in extra_boot_values:
extra_boot_values.set_value(
SystemVariableDefinition.led_0, self.boot_led_0_valu)
boot_messages = SpinnakerBootMessages(
led_0=self.boot_led_0_value, extra_boot_values=extra_boot_values)
extra_boot_values=extra_boot_values)
for boot_message in boot_messages.messages:
self._boot_send_connection.send_boot_message(boot_message)
time.sleep(2.0)
Expand Down
5 changes: 0 additions & 5 deletions spinnman/transceiver/mockable_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,3 @@ def control_sync(self, do_sync):
@overrides(AbstractTransceiver.update_provenance_and_exit)
def update_provenance_and_exit(self, x, y, p):
pass

@property
@overrides(AbstractTransceiver.boot_led_0_value)
def boot_led_0_value(self):
return 0

0 comments on commit 3fb73de

Please sign in to comment.