• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3#   Copyright 2020 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17from acts.controllers.fuchsia_lib.base_lib import BaseLib
18
19
20class FuchsiaRamLib(BaseLib):
21    def __init__(self, addr, tc, client_id):
22        self.address = addr
23        self.test_counter = tc
24        self.client_id = client_id
25
26    def measureBandwidth(self, cycles_to_measure, channels):
27        """ Measures the DDR bandwidth on the specified channels.
28
29        Args:
30            cycles_to_measure: How many bus cycles to perform the measurement over.
31            channels: An array of 8 uint64, specifying which ports to aggregate
32                      for each channel.
33
34        Returns:
35            BandwidthInfo struct, prints an error message if error.
36        """
37        test_cmd = "ram_facade.MeasureBandwidth"
38        test_args = {
39            "values": {
40                "cycles_to_measure": cycles_to_measure,
41                "channels": channels
42            }
43        }
44        test_id = self.build_id(self.test_counter)
45        self.test_counter += 1
46
47        return self.send_command(test_id, test_cmd, test_args)
48
49    def getDdrWindowingResults(self):
50        """ Retrieves the results from the DDR Windowing tool, which runs in
51            the bootloader.
52
53        Returns:
54            The register value, prints an error message if error.
55        """
56        test_cmd = "ram_facade.GetDdrWindowingResults"
57        test_args = {}
58        test_id = self.build_id(self.test_counter)
59        self.test_counter += 1
60
61        return self.send_command(test_id, test_cmd, test_args)
62