BoardEcLib.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /** @file
  2. Board-specific EC library
  3. Copyright (c) 2021, Baruch Binyamin Doron
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _BOARD_EC_LIB_H_
  7. #define _BOARD_EC_LIB_H_
  8. /**
  9. Reads a byte of EC RAM.
  10. @param[in] Address Address to read
  11. @param[out] Data Data received
  12. @retval EFI_SUCCESS Command success
  13. @retval EFI_INVALID_PARAMETER Data is NULL
  14. @retval EFI_DEVICE_ERROR Command error
  15. @retval EFI_TIMEOUT Command timeout
  16. **/
  17. EFI_STATUS
  18. EcCmd90Read (
  19. IN UINT8 Address,
  20. OUT UINT8 *Data
  21. );
  22. /**
  23. Writes a byte of EC RAM.
  24. @param[in] Address Address to write
  25. @param[in] Data Data to write
  26. @retval EFI_SUCCESS Command success
  27. @retval EFI_DEVICE_ERROR Command error
  28. @retval EFI_TIMEOUT Command timeout
  29. **/
  30. EFI_STATUS
  31. EcCmd91Write (
  32. IN UINT8 Address,
  33. IN UINT8 Data
  34. );
  35. /**
  36. Query the EC status.
  37. @param[out] Status EC status byte
  38. @retval EFI_SUCCESS Command success
  39. @retval EFI_INVALID_PARAMETER Data is NULL
  40. @retval EFI_DEVICE_ERROR Command error
  41. @retval EFI_TIMEOUT Command timeout
  42. **/
  43. EFI_STATUS
  44. EcCmd94Query (
  45. OUT UINT8 *Data
  46. );
  47. /**
  48. Reads a byte of EC (index) RAM.
  49. @param[in] Address Address to read
  50. @param[out] Data Data received
  51. **/
  52. VOID
  53. EcIdxRead (
  54. IN UINT16 Address,
  55. OUT UINT8 *Data
  56. );
  57. /**
  58. Writes a byte of EC (index) RAM.
  59. @param[in] Address Address to read
  60. @param[in] Data Data received
  61. **/
  62. VOID
  63. EcIdxWrite (
  64. IN UINT16 Address,
  65. IN UINT8 Data
  66. );
  67. /**
  68. Read EC analog-digital converter.
  69. TODO: Check if ADC is valid.
  70. @param[in] Adc
  71. @param[out] DataBuffer
  72. **/
  73. VOID
  74. ReadEcAdcConverter (
  75. IN UINT8 Adc,
  76. OUT UINT16 *DataBuffer
  77. );
  78. #endif