test.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Test-related constants for sandbox
  3. *
  4. * Copyright (c) 2014 Google, Inc
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef __ASM_TEST_H
  9. #define __ASM_TEST_H
  10. /* The sandbox driver always permits an I2C device with this address */
  11. #define SANDBOX_I2C_TEST_ADDR 0x59
  12. #define SANDBOX_PCI_VENDOR_ID 0x1234
  13. #define SANDBOX_PCI_DEVICE_ID 0x5678
  14. #define SANDBOX_PCI_CLASS_CODE PCI_CLASS_CODE_COMM
  15. #define SANDBOX_PCI_CLASS_SUB_CODE PCI_CLASS_SUB_CODE_COMM_SERIAL
  16. #define SANDBOX_CLK_RATE 32768
  17. /* System controller driver data */
  18. enum {
  19. SYSCON0 = 32,
  20. SYSCON1,
  21. SYSCON_COUNT
  22. };
  23. /**
  24. * sandbox_i2c_set_test_mode() - set test mode for running unit tests
  25. *
  26. * See sandbox_i2c_xfer() for the behaviour changes.
  27. *
  28. * @bus: sandbox I2C bus to adjust
  29. * @test_mode: true to select test mode, false to run normally
  30. */
  31. void sandbox_i2c_set_test_mode(struct udevice *bus, bool test_mode);
  32. enum sandbox_i2c_eeprom_test_mode {
  33. SIE_TEST_MODE_NONE,
  34. /* Permits read/write of only one byte per I2C transaction */
  35. SIE_TEST_MODE_SINGLE_BYTE,
  36. };
  37. void sandbox_i2c_eeprom_set_test_mode(struct udevice *dev,
  38. enum sandbox_i2c_eeprom_test_mode mode);
  39. void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, int offset_len);
  40. /*
  41. * sandbox_timer_add_offset()
  42. *
  43. * Allow tests to add to the time reported through lib/time.c functions
  44. * offset: number of milliseconds to advance the system time
  45. */
  46. void sandbox_timer_add_offset(unsigned long offset);
  47. /**
  48. * sandbox_i2c_rtc_set_offset() - set the time offset from system/base time
  49. *
  50. * @dev: RTC device to adjust
  51. * @use_system_time: true to use system time, false to use @base_time
  52. * @offset: RTC offset from current system/base time (-1 for no
  53. * change)
  54. * @return old value of RTC offset
  55. */
  56. long sandbox_i2c_rtc_set_offset(struct udevice *dev, bool use_system_time,
  57. int offset);
  58. /**
  59. * sandbox_i2c_rtc_get_set_base_time() - get and set the base time
  60. *
  61. * @dev: RTC device to adjust
  62. * @base_time: New base system time (set to -1 for no change)
  63. * @return old base time
  64. */
  65. long sandbox_i2c_rtc_get_set_base_time(struct udevice *dev, long base_time);
  66. int sandbox_usb_keyb_add_string(struct udevice *dev, const char *str);
  67. #endif