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