Tom Wai-Hong Tam | 4173876 | 2012-10-29 14:32:39 +0800 | [diff] [blame] | 1 | # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | class FAFTDelayConstants(object): |
| 6 | """Class that contains the delay constants for FAFT.""" |
| 7 | version = 1 |
| 8 | |
| 9 | DEFAULT_DELAY = { |
| 10 | # Delay between power-on and firmware screen |
| 11 | 'firmware_screen': 10, |
| 12 | # Delay between passing firmware screen and text mode warning screen |
| 13 | 'legacy_text_screen': 20, |
| 14 | # The developer screen timeouts fit our spec |
| 15 | 'dev_screen_timeout': 30, |
| 16 | # Delay for waiting beep done |
| 17 | 'beep': 1, |
| 18 | # Delay of loading the USB kernel |
| 19 | 'load_usb': 10, |
| 20 | # Delay between USB plug-out and plug-in |
| 21 | 'between_usb_plug': 10, |
| 22 | # Delay after running the 'sync' command |
| 23 | 'sync': 5, |
| 24 | # Delay for waiting client to shutdown |
| 25 | 'shutdown': 30, |
| 26 | # Delay for waiting client to return before sending EC reboot command |
| 27 | 'ec_reboot_cmd': 1, |
| 28 | # Delay between EC boot and ChromeEC console functional |
| 29 | 'ec_boot_to_console': 0.5, |
| 30 | # Delay between EC boot and pressing power button |
| 31 | 'ec_boot_to_pwr_button': 0.5, |
| 32 | # Delay of EC software sync hash calculating time |
| 33 | 'software_sync': 6, |
| 34 | # Duration of holding cold_reset to reset device |
| 35 | 'hold_cold_reset': 0.1, |
| 36 | # devserver startup time |
| 37 | 'devserver': 10, |
| 38 | # Delay of waiting factory install shim to reset TPM |
| 39 | 'install_shim_done': 120, |
| 40 | } |
| 41 | |
| 42 | def __init__(self, platform=None): |
| 43 | """Initialized. |
| 44 | |
| 45 | Args: |
| 46 | platform: Optional, platform name returned by FAFT client. If not |
| 47 | given, use the default delay values. |
| 48 | """ |
| 49 | self.__dict__.update(self.DEFAULT_DELAY) |
| 50 | if platform: |
| 51 | self.__dict__.update(self._get_platform_delay(platform)) |
| 52 | |
| 53 | |
| 54 | def _get_platform_delay(self, platform): |
| 55 | """Return platform-specific delay values.""" |
| 56 | setting = dict() |
| 57 | |
| 58 | # Add the platform-specific delay values here. |
| 59 | |
| 60 | return setting |