blob: 455958f664e93bacfeda466644449436b68b408c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/* Copyright 2023 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* @file
*
* @brief Backend API for ANX7452 retimer emulator
*/
#ifndef __EMUL_ANX7452_H
#define __EMUL_ANX7452_H
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
/** Types of "hidden" I2C devices */
enum anx7452_emul_port {
TOP_EMUL_PORT,
CTLTOP_EMUL_PORT,
};
/**
* @brief ANX7452 retimer emulator backend API
* @defgroup anx7452_emul ANX7452 retimer emulator
* @{
*
* ANX7452 retimer emulator supports access to all its registers using I2C
* messages. Application may alter emulator state:
*
* - call @ref anx7452_emul_set_reg and @ref anx7452_emul_get_reg to set and get
* value of ANX7452 retimers registers
* - call anx7452_emul_set_err_* to change emulator behaviour on inadvisable
* driver behaviour
* - call functions from emul_common_i2c.h to setup custom handlers for I2C
* messages
*/
/**
* @brief Set value of given register of ANX7452 retimer
*
* @param emul Pointer to ANX7452 retimer emulator
* @param reg Register address which value will be changed
* @param val New value of the register
*/
void anx7452_emul_set_reg(const struct emul *emul, int reg, uint8_t val);
/**
* @brief Get value of given register of ANX7452 retimer
*
* @param emul Pointer to ANX7452 retimer emulator
* @param reg Register address
*
* @return Value of the register
*/
uint8_t anx7452_emul_get_reg(const struct emul *emul, int reg);
/**
* @brief Reset the anx7452 emulator
*
* @param emul The emulator to reset
*/
void anx7452_emul_reset(const struct emul *emul);
/**
* @brief Returns pointer to i2c_common_emul_data for given emul
*
* @param emul Pointer to anx7452 retimer emulator
* @return Pointer to i2c_common_emul_data for emul argument
*/
struct i2c_common_emul_data *
emul_anx7452_get_i2c_common_data(const struct emul *emul,
enum anx7452_emul_port port);
/**
* @}
*/
#endif /* __EMUL_ANX7452 */
|