Class UnimplementedBMPTransceiver
java.lang.Object
uk.ac.manchester.spinnaker.transceiver.UnimplementedBMPTransceiver
- All Implemented Interfaces:
AutoCloseable
,BMPTransceiverInterface
public abstract class UnimplementedBMPTransceiver extends Object implements BMPTransceiverInterface
A transceiver where every operation (except the few mandatory ones) fails
with
UnsupportedOperationException
. A suitable base for partial
implementations.- Author:
- Donal Fellows
-
Nested Class Summary
Nested classes/interfaces inherited from interface uk.ac.manchester.spinnaker.transceiver.BMPTransceiverInterface
BMPTransceiverInterface.FPGAResetType
-
Constructor Summary
Constructors Constructor Description UnimplementedBMPTransceiver()
-
Method Summary
Modifier and Type Method Description MappableIterable<BMPBoard>
availableBoards(BMPCoords bmp)
List which boards are actually available to be manipulated by a particular BMP.void
bind(BMPCoords bmp)
Set the default BMP coordinates, at least for cabinet and frame.void
close()
BMPCoords
getBoundBMP()
boolean
getResetStatus(BMPCoords bmp, BMPBoard board)
Get the FPGA reset status.MemoryLocation
getSerialFlashBuffer(BMPCoords bmp, BMPBoard board)
Get the address of the serial flash buffer.void
power(PowerCommand powerCommand, BMPCoords bmp, Collection<BMPBoard> boards)
Send a power request to the machine.void
powerOffMachine()
Power off the whole machine.void
powerOnMachine()
Power on the whole machine.ADCInfo
readADCData(BMPCoords bmp, BMPBoard board)
Read the ADC data.ByteBuffer
readBMPMemory(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int length)
Read BMP memory.VersionInfo
readBMPVersion(BMPCoords bmp, BMPBoard board)
Read the BMP version.String
readBoardSerialNumber(BMPCoords bmp, BMPBoard board)
Read the BMP serial number from a board.int
readFPGARegister(FPGA fpga, MemoryLocation register, BMPCoords bmp, BMPBoard board)
Read a register on a FPGA of a board.ByteBuffer
readSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int length)
Read BMP serial flash memory.int
readSerialFlashCRC(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int length)
Read the CRC32 checksum of BMP serial flash memory.void
resetFPGA(BMPCoords bmp, BMPBoard board, BMPTransceiverInterface.FPGAResetType resetType)
Reset the FPGAs on a board.void
setLED(Collection<Integer> leds, LEDAction action, BMPCoords bmp, Collection<BMPBoard> board)
Set the LED state of a board in the machine.void
writeBMPFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress)
Write a fixed size chunk to flash memory of a BMP with erase.void
writeBMPMemory(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, File file)
Write BMP memory from a file.void
writeBMPMemory(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, ByteBuffer data)
Write BMP memory.void
writeFlash(@Valid BMPCoords bmp, @Valid BMPBoard board, @NotNull MemoryLocation baseAddress, @NotNull ByteBuffer data)
Write a buffer to flash memory on the BMP.void
writeFPGARegister(FPGA fpga, MemoryLocation register, int value, BMPCoords bmp, BMPBoard board)
Write a register on a FPGA of a board.void
writeSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int size, InputStream stream)
Write BMP serial flash memory from a stream.void
writeSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, File file)
Write BMP serial flash memory from a file.void
writeSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, ByteBuffer data)
Write BMP serial flash memory.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface uk.ac.manchester.spinnaker.transceiver.BMPTransceiverInterface
availableBoards, getResetStatus, getSerialFlashBuffer, powerOff, powerOff, powerOn, powerOn, readADCData, readBlacklist, readBlacklist, readBMPFirmwareDescriptor, readBMPFirmwareDescriptor, readBMPMemory, readBMPMemoryWord, readBMPMemoryWord, readBMPVersion, readBMPVersion, readBMPVersion, readBoardSerialNumber, readFPGALinkCounter, readFPGALinkCounter, readFPGALinkCounter, readFPGALinkCounter, readFPGARegister, readFPGARegister, readFPGARegister, readFPGARegister, readFPGARegister, readSerialFlash, readSerialFlashCRC, resetFPGA, setLED, writeBlacklist, writeBlacklist, writeBMPFlash, writeBMPMemory, writeBMPMemory, writeBMPMemory, writeBMPMemory, writeFlash, writeFPGARegister, writeFPGARegister, writeFPGARegister, writeFPGARegister, writeFPGARegister, writeSerialFlash, writeSerialFlash, writeSerialFlash
-
Constructor Details
-
UnimplementedBMPTransceiver
public UnimplementedBMPTransceiver()
-
-
Method Details
-
powerOnMachine
Description copied from interface:BMPTransceiverInterface
Power on the whole machine.WARNING! This operation is unsafe in a multi-threaded context.
- Specified by:
powerOnMachine
in interfaceBMPTransceiverInterface
- Throws:
InterruptedException
- If the thread is interrupted while waiting.IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
powerOffMachine
Description copied from interface:BMPTransceiverInterface
Power off the whole machine.WARNING! This operation is unsafe in a multi-threaded context.
- Specified by:
powerOffMachine
in interfaceBMPTransceiverInterface
- Throws:
InterruptedException
- If the thread is interrupted while waiting.IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
power
public void power(PowerCommand powerCommand, BMPCoords bmp, Collection<BMPBoard> boards) throws InterruptedException, IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Send a power request to the machine.WARNING! This operation is unsafe in a multi-threaded context.
- Specified by:
power
in interfaceBMPTransceiverInterface
- Parameters:
powerCommand
- The power command to sendbmp
- the coordinates of the BMP; components are zero for a board not in a frame of a cabinetboards
- The boards to send the command to- Throws:
InterruptedException
- If the thread is interrupted while waiting.IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
setLED
public void setLED(Collection<Integer> leds, LEDAction action, BMPCoords bmp, Collection<BMPBoard> board) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Set the LED state of a board in the machine.- Specified by:
setLED
in interfaceBMPTransceiverInterface
- Parameters:
leds
- Collection of LED numbers to set the state of (0-7)action
- State to set the LED to, either on, off or togglebmp
- the coordinates of the BMP this is targetingboard
- Specifies the board to control the LEDs of. The command will actually be sent to the first board in the collection.- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
readFPGARegister
public int readFPGARegister(FPGA fpga, MemoryLocation register, BMPCoords bmp, BMPBoard board) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Read a register on a FPGA of a board. The meaning of the register's contents will depend on the FPGA's configuration.- Specified by:
readFPGARegister
in interfaceBMPTransceiverInterface
- Parameters:
fpga
- FPGA (0, 1 or 2) to communicate with.register
- Register address to read to (will be rounded down to the nearest 32-bit word boundary).bmp
- the coordinates of the BMP this is targetingboard
- which board to request the FPGA register from- Returns:
- the register data
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
writeFPGARegister
public void writeFPGARegister(FPGA fpga, MemoryLocation register, int value, BMPCoords bmp, BMPBoard board) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Write a register on a FPGA of a board. The meaning of setting the register's contents will depend on the FPGA's configuration.- Specified by:
writeFPGARegister
in interfaceBMPTransceiverInterface
- Parameters:
fpga
- FPGA (0, 1 or 2) to communicate with.register
- Register address to read to (will be rounded down to the nearest 32-bit word boundary).value
- the value to write into the FPGA registerbmp
- the coordinates of the BMP this is targetingboard
- which board to write the FPGA register to- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
readADCData
Description copied from interface:BMPTransceiverInterface
Read the ADC data.- Specified by:
readADCData
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- the coordinates of the BMP this is targetingboard
- which board to request the ADC data from- Returns:
- the FPGA's ADC data object
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
readBMPVersion
public VersionInfo readBMPVersion(BMPCoords bmp, BMPBoard board) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Read the BMP version.- Specified by:
readBMPVersion
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- the coordinates of the BMP this is targetingboard
- which board to request the data from- Returns:
- the parsed SVER from the BMP
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
getResetStatus
Description copied from interface:BMPTransceiverInterface
Get the FPGA reset status.- Specified by:
getResetStatus
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board are the FPGAs on?- Returns:
- What the state of the reset line is.
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
resetFPGA
public void resetFPGA(BMPCoords bmp, BMPBoard board, BMPTransceiverInterface.FPGAResetType resetType) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Reset the FPGAs on a board.- Specified by:
resetFPGA
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board are the FPGAs on?resetType
- What kind of reset to perform.- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
readBMPMemory
public ByteBuffer readBMPMemory(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int length) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Read BMP memory.- Specified by:
readBMPMemory
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we reading?baseAddress
- The address in the BMP's memory where the region of memory to be read startslength
- The length of the data to be read in bytes- Returns:
- A little-endian buffer of data read, positioned at the start of the data. The buffer will be writable, but writes will not be automatically reflected anywhere.
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
writeBMPMemory
public void writeBMPMemory(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, ByteBuffer data) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Write BMP memory.- Specified by:
writeBMPMemory
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we writing?baseAddress
- The address in the BMP's memory where the region of memory to be written startsdata
- The data to be written, extending from the position to the limit. The contents of this buffer will be unchanged.- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
writeBMPMemory
public void writeBMPMemory(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, File file) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Write BMP memory from a file.- Specified by:
writeBMPMemory
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we writing?baseAddress
- The address in the BMP's memory where the region of memory to be written startsfile
- The file containing the data to be written.- Throws:
IOException
- If anything goes wrong with networking or file I/O.ProcessException
- If SpiNNaker rejects a message.
-
readSerialFlash
public ByteBuffer readSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int length) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Read BMP serial flash memory.- Specified by:
readSerialFlash
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we reading?baseAddress
- The address in the BMP's serial flash where the region of memory to be read startslength
- The length of the data to be read in bytes- Returns:
- A little-endian buffer of data read, positioned at the start of the data. The buffer will be writable, but writes will not be automatically reflected anywhere.
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
readSerialFlashCRC
public int readSerialFlashCRC(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int length) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Read the CRC32 checksum of BMP serial flash memory.- Specified by:
readSerialFlashCRC
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we reading?baseAddress
- The address in the BMP's serial flash where the region of memory to be checksummed startslength
- The length of the data to be checksummed in bytes- Returns:
- The CRC32 checksum
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
writeSerialFlash
public void writeSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, File file) throws ProcessException, IOExceptionDescription copied from interface:BMPTransceiverInterface
Write BMP serial flash memory from a file.- Specified by:
writeSerialFlash
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we writing?baseAddress
- The address in the BMP's serial flash where the region of memory to be written startsfile
- The file containing the data to be written- Throws:
ProcessException
- If SpiNNaker rejects a message.IOException
- If anything goes wrong with networking.
-
writeSerialFlash
public void writeSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, ByteBuffer data) throws ProcessException, IOExceptionDescription copied from interface:BMPTransceiverInterface
Write BMP serial flash memory.- Specified by:
writeSerialFlash
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we writing?baseAddress
- The address in the BMP's serial flash where the region of memory to be written startsdata
- The raw data to be written- Throws:
ProcessException
- If SpiNNaker rejects a message.IOException
- If anything goes wrong with networking.
-
writeFlash
public void writeFlash(@Valid @Valid BMPCoords bmp, @Valid @Valid BMPBoard board, @NotNull @NotNull MemoryLocation baseAddress, @NotNull @NotNull ByteBuffer data) throws ProcessException, IOException, InterruptedExceptionDescription copied from interface:BMPTransceiverInterface
Write a buffer to flash memory on the BMP. This is a composite operation.- Specified by:
writeFlash
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we writing to?baseAddress
- Where in flash will we write?data
- What data will we write?- Throws:
ProcessException
- If SpiNNaker rejects a message.IOException
- If anything goes wrong with networking.InterruptedException
- If the communications were interrupted.
-
getSerialFlashBuffer
public MemoryLocation getSerialFlashBuffer(BMPCoords bmp, BMPBoard board) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Get the address of the serial flash buffer.- Specified by:
getSerialFlashBuffer
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which BMP's buffer do we want the address of?- Returns:
- The adress of the serial flash buffer.
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
writeSerialFlash
public void writeSerialFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress, int size, InputStream stream) throws ProcessException, IOExceptionDescription copied from interface:BMPTransceiverInterface
Write BMP serial flash memory from a stream.- Specified by:
writeSerialFlash
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we writing?baseAddress
- The address in the BMP's serial flash where the region of memory to be written startssize
- How many bytes to write from the streamstream
- The file containing the data to be written- Throws:
ProcessException
- If SpiNNaker rejects a message.IOException
- If anything goes wrong with networking.
-
writeBMPFlash
public void writeBMPFlash(BMPCoords bmp, BMPBoard board, MemoryLocation baseAddress) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Write a fixed size chunk to flash memory of a BMP with erase. The data must have already been written to the flash buffer.- Specified by:
writeBMPFlash
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we talking to?board
- Which board's BMP are we writing to?baseAddress
- Where in flash will we write?- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.- See Also:
BMPTransceiverInterface.writeFlash(BMPCoords,BMPBoard,MemoryLocation,ByteBuffer)
-
availableBoards
public MappableIterable<BMPBoard> availableBoards(BMPCoords bmp) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
List which boards are actually available to be manipulated by a particular BMP.- Specified by:
availableBoards
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we asking?- Returns:
- Ordered list of board identifiers.
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
readBoardSerialNumber
public String readBoardSerialNumber(BMPCoords bmp, BMPBoard board) throws IOException, ProcessExceptionDescription copied from interface:BMPTransceiverInterface
Read the BMP serial number from a board.- Specified by:
readBoardSerialNumber
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- Which BMP are we sending messages to directly?board
- Which board's BMP (of those managed by the BMP we send the message to) are we getting the serial number from?- Returns:
- The LPC1768 serial number.
- Throws:
IOException
- If anything goes wrong with networking.ProcessException
- If SpiNNaker rejects a message.
-
bind
Description copied from interface:BMPTransceiverInterface
Set the default BMP coordinates, at least for cabinet and frame.- Specified by:
bind
in interfaceBMPTransceiverInterface
- Parameters:
bmp
- The new default coordinates.
-
getBoundBMP
- Specified by:
getBoundBMP
in interfaceBMPTransceiverInterface
- Returns:
- The currently bound BMP coordinates. Defaults to 0,0 if not set
by
BMPTransceiverInterface.bind(BMPCoords)
.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBMPTransceiverInterface
- Throws:
IOException
-