• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / JavaSpiNNaker / 6233274834

19 Sep 2023 08:46AM UTC coverage: 36.409% (-0.6%) from 36.982%
6233274834

Pull #658

github

dkfellows
Merge branch 'master' into java-17
Pull Request #658: Update Java version to 17

1656 of 1656 new or added lines in 260 files covered. (100.0%)

8373 of 22997 relevant lines covered (36.41%)

0.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.33
/SpiNNaker-comms/src/main/java/uk/ac/manchester/spinnaker/messages/bmp/ReadSerialVector.java
1
/*
2
 * Copyright (c) 2022 The University of Manchester
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package uk.ac.manchester.spinnaker.messages.bmp;
17

18
import static uk.ac.manchester.spinnaker.messages.bmp.BMPInfo.SERIAL;
19
import static uk.ac.manchester.spinnaker.messages.model.SerialVector.SERIAL_LENGTH;
20
import static uk.ac.manchester.spinnaker.messages.scp.SCPCommand.CMD_BMP_INFO;
21

22
import java.nio.ByteBuffer;
23
import java.nio.IntBuffer;
24

25
import uk.ac.manchester.spinnaker.machine.MemoryLocation;
26
import uk.ac.manchester.spinnaker.machine.board.BMPBoard;
27
import uk.ac.manchester.spinnaker.messages.model.SerialVector;
28
import uk.ac.manchester.spinnaker.messages.model.UnexpectedResponseCodeException;
29

30
/**
31
 * A request for the serial data vector from the BMP. The response payload is
32
 * the {@linkplain SerialVector serial vector} from the BMP.
33
 * <p>
34
 * Handled by {@code cmd_bmp_info()} in {@code bmp_cmd.c}.
35
 */
36
public final class ReadSerialVector
37
                extends BMPRequest<ReadSerialVector.Response> {
38
        /**
39
         * @param board
40
         *            which board to request the serial data from
41
         */
42
        public ReadSerialVector(BMPBoard board) {
43
                super(board, CMD_BMP_INFO, SERIAL.value);
1✔
44
        }
1✔
45

46
        @Override
47
        public Response getSCPResponse(ByteBuffer buffer) throws Exception {
48
                return new Response(buffer);
×
49
        }
50

51
        /** An SCP response to a request for serial data. */
52
        protected final class Response
53
                        extends BMPRequest.PayloadedResponse<SerialVector> {
54
                private Response(ByteBuffer buffer)
55
                                throws UnexpectedResponseCodeException {
×
56
                        super("Read serial data vector", CMD_BMP_INFO, buffer);
×
57
                }
×
58

59
                /** @return The serial data. */
60
                @Override
61
                protected SerialVector parse(ByteBuffer buffer) {
62
                        var b = buffer.asIntBuffer();
×
63
                        var hardwareVersion = b.get();
×
64
                        var sn = new int[SERIAL_LENGTH];
×
65
                        b.get(sn);
×
66
                        var serialNumber = IntBuffer.wrap(sn);
×
67
                        var flashBuffer = new MemoryLocation(b.get());
×
68
                        var boardStat = new MemoryLocation(b.get());
×
69
                        var cortexBoot = new MemoryLocation(b.get());
×
70
                        return new SerialVector(hardwareVersion, serialNumber, flashBuffer,
×
71
                                        boardStat, cortexBoot);
72
                }
73
        }
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc