]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/I2cEnumerate.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / I2cEnumerate.h
CommitLineData
4006b0b5
EL
1/** @file\r
2 I2C Device Enumerate Protocol as defined in the PI 1.3 specification.\r
3\r
4 This protocol supports the enumerations of device on the I2C bus.\r
5\r
9095d37b 6 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
4006b0b5
EL
8\r
9 @par Revision Reference:\r
10 This protocol is from PI Version 1.3.\r
11\r
12**/\r
13\r
14#ifndef __I2C_ENUMERATE_H__\r
15#define __I2C_ENUMERATE_H__\r
16\r
17#include <Pi/PiI2c.h>\r
18\r
19#define EFI_I2C_ENUMERATE_PROTOCOL_GUID { 0xda8cd7c4, 0x1c00, 0x49e2, { 0x80, 0x3e, 0x52, 0x14, 0xe7, 0x01, 0x89, 0x4c }}\r
20\r
21typedef struct _EFI_I2C_ENUMERATE_PROTOCOL EFI_I2C_ENUMERATE_PROTOCOL;\r
22\r
23/**\r
24 Enumerate the I2C devices\r
25\r
26 This function enables the caller to traverse the set of I2C devices\r
27 on an I2C bus.\r
28\r
29 @param[in] This The platform data for the next device on\r
30 the I2C bus was returned successfully.\r
31 @param[in, out] Device Pointer to a buffer containing an\r
32 EFI_I2C_DEVICE structure. Enumeration is\r
33 started by setting the initial EFI_I2C_DEVICE\r
34 structure pointer to NULL. The buffer\r
35 receives an EFI_I2C_DEVICE structure pointer\r
36 to the next I2C device.\r
37\r
38 @retval EFI_SUCCESS The platform data for the next device on\r
39 the I2C bus was returned successfully.\r
40 @retval EFI_INVALID_PARAMETER Device is NULL\r
41 @retval EFI_NO_MAPPING *Device does not point to a valid\r
42 EFI_I2C_DEVICE structure returned in a\r
43 previous call Enumerate().\r
44\r
45**/\r
46typedef\r
47EFI_STATUS\r
48(EFIAPI *EFI_I2C_ENUMERATE_PROTOCOL_ENUMERATE) (\r
49 IN CONST EFI_I2C_ENUMERATE_PROTOCOL *This,\r
50 IN OUT CONST EFI_I2C_DEVICE **Device\r
51 );\r
52\r
53/**\r
54 Get the requested I2C bus frequency for a specified bus configuration.\r
55\r
56 This function returns the requested I2C bus clock frequency for the\r
57 I2cBusConfiguration. This routine is provided for diagnostic purposes\r
58 and is meant to be called after calling Enumerate to get the\r
59 I2cBusConfiguration value.\r
60\r
61 @param[in] This Pointer to an EFI_I2C_ENUMERATE_PROTOCOL\r
62 structure.\r
63 @param[in] I2cBusConfiguration I2C bus configuration to access the I2C\r
64 device\r
65 @param[out] *BusClockHertz Pointer to a buffer to receive the I2C\r
66 bus clock frequency in Hertz\r
67\r
68 @retval EFI_SUCCESS The I2C bus frequency was returned\r
69 successfully.\r
70 @retval EFI_INVALID_PARAMETER BusClockHertz was NULL\r
71 @retval EFI_NO_MAPPING Invalid I2cBusConfiguration value\r
72\r
73**/\r
74typedef\r
75EFI_STATUS\r
76(EFIAPI *EFI_I2C_ENUMERATE_PROTOCOL_GET_BUS_FREQUENCY) (\r
77 IN CONST EFI_I2C_ENUMERATE_PROTOCOL *This,\r
78 IN UINTN I2cBusConfiguration,\r
79 OUT UINTN *BusClockHertz\r
80 );\r
81\r
82///\r
83/// I2C Enumerate protocol\r
84///\r
85struct _EFI_I2C_ENUMERATE_PROTOCOL {\r
86 ///\r
87 /// Traverse the set of I2C devices on an I2C bus. This routine\r
88 /// returns the next I2C device on an I2C bus.\r
89 ///\r
90 EFI_I2C_ENUMERATE_PROTOCOL_ENUMERATE Enumerate;\r
91\r
92 ///\r
93 /// Get the requested I2C bus frequency for a specified bus\r
94 /// configuration.\r
95 ///\r
96 EFI_I2C_ENUMERATE_PROTOCOL_GET_BUS_FREQUENCY GetBusFrequency;\r
97};\r
98\r
99///\r
100/// Reference to variable defined in the .DEC file\r
101///\r
102extern EFI_GUID gEfiI2cEnumerateProtocolGuid;\r
103\r
104#endif // __I2C_ENUMERATE_H__\r