diff options
Diffstat (limited to 'zephyr/include/emul')
-rw-r--r-- | zephyr/include/emul/emul_isl923x.h | 2 | ||||
-rw-r--r-- | zephyr/include/emul/emul_kb_raw.h | 2 | ||||
-rw-r--r-- | zephyr/include/emul/emul_ln9310.h | 4 | ||||
-rw-r--r-- | zephyr/include/emul/emul_pct2075.h | 32 | ||||
-rw-r--r-- | zephyr/include/emul/emul_power_signals.h | 49 | ||||
-rw-r--r-- | zephyr/include/emul/emul_smart_battery.h | 7 | ||||
-rw-r--r-- | zephyr/include/emul/emul_syv682x.h | 3 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci.h | 5 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_common.h | 21 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h | 3 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h | 3 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h | 5 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_src.h | 5 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h | 49 |
14 files changed, 21 insertions, 169 deletions
diff --git a/zephyr/include/emul/emul_isl923x.h b/zephyr/include/emul/emul_isl923x.h index 7d085658cf..e41cf26f87 100644 --- a/zephyr/include/emul/emul_isl923x.h +++ b/zephyr/include/emul/emul_isl923x.h @@ -7,8 +7,8 @@ #define ZEPHYR_INCLUDE_EMUL_EMUL_ISL923X_H_ #include <zephyr/device.h> -#include <zephyr/drivers/emul.h> #include <zephyr/drivers/i2c_emul.h> +#include <zephyr/drivers/emul.h> /** * @brief Get the emulator's parent bus device diff --git a/zephyr/include/emul/emul_kb_raw.h b/zephyr/include/emul/emul_kb_raw.h index 0598eda7ab..1660ccefd4 100644 --- a/zephyr/include/emul/emul_kb_raw.h +++ b/zephyr/include/emul/emul_kb_raw.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The ChromiumOS Authors +/* Copyright 2022 The ChromiumOS Authors. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/include/emul/emul_ln9310.h b/zephyr/include/emul/emul_ln9310.h index 5d0cab9c20..0c0e61003e 100644 --- a/zephyr/include/emul/emul_ln9310.h +++ b/zephyr/include/emul/emul_ln9310.h @@ -12,12 +12,10 @@ #ifndef ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_ #define ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_ +#include <zephyr/drivers/emul.h> #include "driver/ln9310.h" - #include <stdbool.h> -#include <zephyr/drivers/emul.h> - /** * @brief Select the current emulator to use. * diff --git a/zephyr/include/emul/emul_pct2075.h b/zephyr/include/emul/emul_pct2075.h deleted file mode 100644 index f9e1ef60b2..0000000000 --- a/zephyr/include/emul/emul_pct2075.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef EMUL_PCT2075_H -#define EMUL_PCT2075_H - -#include "emul/emul_common_i2c.h" - -#include <zephyr/drivers/emul.h> - -#define PCT2075_REG_NUMBER 5 - -struct pct2075_data { - struct i2c_common_emul_data common; - uint16_t regs[PCT2075_REG_NUMBER]; -}; - -/** - * @brief Set the temperature measurement for the sensor. - * - * @param emul Pointer to emulator - * @param mk Temperature to set in mili-kalvin. The temperature - * should me in range of 328150 to 400150, with 150 resolution. - * - * @return 0 on success - * @return negative on error - */ -int pct2075_emul_set_temp(const struct emul *emul, int mk); - -#endif diff --git a/zephyr/include/emul/emul_power_signals.h b/zephyr/include/emul/emul_power_signals.h deleted file mode 100644 index 7dea6079f0..0000000000 --- a/zephyr/include/emul/emul_power_signals.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef EMUL_POWER_SIGNALS_H_ -#define EMUL_POWER_SIGNALS_H_ - -/** - * @brief Test platform definition, - * This structure contains all power signal nodes associated to one - * test. - */ -struct power_signal_emul_test_platform { - char *name_id; - int nodes_count; - struct power_signal_emul_node **nodes; -}; - -#define EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL(inst) \ - extern const struct power_signal_emul_test_platform inst; - -#define EMUL_POWER_SIGNAL_TEST_PLATFORM(inst) (&DT_CAT(DT_N_S_, inst)) - -DT_FOREACH_STATUS_OKAY(intel_ap_pwr_test_platform, - EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL) -/** - * @brief Load test platform. - * - * This initializes each of the test platform nodes. - * - * @param test_platform Pointer to test platform structure. - * - * @return 0 indicating success. - * @return -EINVAL `test_id` parameter is invalid. - * @return -EBUSY `test_id` One test platform is currently loaded. - */ -int power_signal_emul_load( - const struct power_signal_emul_test_platform *test_platform); - -/** - * @brief Unload test platform. - * - * @return 0 indicating success. - * @return -EINVAL no test platform has been loaded. - */ -int power_signal_emul_unload(void); - -#endif /* EMUL_POWER_SIGNALS_H_ */ diff --git a/zephyr/include/emul/emul_smart_battery.h b/zephyr/include/emul/emul_smart_battery.h index 35018f37f7..826e817992 100644 --- a/zephyr/include/emul/emul_smart_battery.h +++ b/zephyr/include/emul/emul_smart_battery.h @@ -12,13 +12,12 @@ #ifndef __EMUL_SMART_BATTERY_H #define __EMUL_SMART_BATTERY_H -#include "emul/emul_common_i2c.h" - -#include <stdint.h> - #include <zephyr/drivers/emul.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/i2c_emul.h> +#include <stdint.h> + +#include "emul/emul_common_i2c.h" /** * @brief Smart Battery emulator backend API diff --git a/zephyr/include/emul/emul_syv682x.h b/zephyr/include/emul/emul_syv682x.h index 3e4328323e..78ee2406eb 100644 --- a/zephyr/include/emul/emul_syv682x.h +++ b/zephyr/include/emul/emul_syv682x.h @@ -11,9 +11,8 @@ #ifndef __EMUL_SYV682X_H #define __EMUL_SYV682X_H -#include <stdint.h> - #include <zephyr/drivers/i2c_emul.h> +#include <stdint.h> /* Register info copied from syv682.h */ diff --git a/zephyr/include/emul/tcpc/emul_tcpci.h b/zephyr/include/emul/tcpc/emul_tcpci.h index 8badf7dbc4..8175b9ce96 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci.h +++ b/zephyr/include/emul/tcpc/emul_tcpci.h @@ -12,14 +12,13 @@ #ifndef __EMUL_TCPCI_H #define __EMUL_TCPCI_H -#include "emul/emul_common_i2c.h" - #include <zephyr/drivers/emul.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/i2c_emul.h> - #include <usb_pd_tcpm.h> +#include "emul/emul_common_i2c.h" + /** * Number of emulated register. This include vendor registers defined in TCPCI * specification diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h index dd8909c2ca..f232724ece 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h @@ -12,16 +12,15 @@ #ifndef __EMUL_TCPCI_PARTNER_COMMON_H #define __EMUL_TCPCI_PARTNER_COMMON_H -#include "ec_commands.h" -#include "emul/tcpc/emul_tcpci.h" -#include "usb_pd.h" - -#include <stdbool.h> -#include <stdint.h> - #include <zephyr/drivers/emul.h> #include <zephyr/kernel.h> #include <zephyr/sys/atomic.h> +#include <stdbool.h> +#include <stdint.h> + +#include "ec_commands.h" +#include "emul/tcpc/emul_tcpci.h" +#include "usb_pd.h" /** * @brief Common code used by TCPCI partner device emulators @@ -148,9 +147,6 @@ struct tcpci_partner_data { /* SVID of entered mode (0 if no mode is entered) */ uint16_t entered_svid; - enum tcpc_cc_voltage_status tcpm_cc1; - enum tcpc_cc_voltage_status tcpm_cc2; - /* VDMs with which the partner responds to discovery REQs. The VDM * buffers include the VDM header, and the VDO counts include 1 for the * VDM header. This structure has space for the mode response for a @@ -187,8 +183,6 @@ struct tcpci_partner_data { */ bool have_response[PD_BATT_MAX]; } battery_capabilities; - /* Used to control accept/reject for partner port of Enter_USB msg */ - bool enter_usb_accept; /* * Cable which is "plugged in" to this port partner @@ -317,9 +311,6 @@ struct tcpci_partner_extension_ops { void (*soft_reset)(struct tcpci_partner_extension *ext, struct tcpci_partner_data *common_data); - void (*control_change)(struct tcpci_partner_extension *ext, - struct tcpci_partner_data *common_data); - /** * @brief Function called when partner emulator is disconnected from * TCPM diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h index cacb4e6270..e4f58fcd37 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h @@ -12,14 +12,13 @@ #ifndef __EMUL_TCPCI_PARTNER_DRP_H #define __EMUL_TCPCI_PARTNER_DRP_H +#include <zephyr/drivers/emul.h> #include "emul/tcpc/emul_tcpci.h" #include "emul/tcpc/emul_tcpci_partner_common.h" #include "emul/tcpc/emul_tcpci_partner_snk.h" #include "emul/tcpc/emul_tcpci_partner_src.h" #include "usb_pd.h" -#include <zephyr/drivers/emul.h> - /** * @brief USB-C dual role device extension backend API * @defgroup tcpci_snk_emul USB-C dual role device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h index 317e9817d4..f0627c95bd 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h @@ -12,12 +12,11 @@ #ifndef __EMUL_TCPCI_PARTNER_FAULTY_EXT_H #define __EMUL_TCPCI_PARTNER_FAULTY_EXT_H +#include <zephyr/drivers/emul.h> #include "emul/tcpc/emul_tcpci.h" #include "emul/tcpc/emul_tcpci_partner_common.h" #include "usb_pd.h" -#include <zephyr/drivers/emul.h> - /** * @brief USB-C malfunctioning device extension backend API * @defgroup tcpci_faulty_ext USB-C malfunctioning device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h index edf09d25eb..584458942b 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h @@ -12,12 +12,11 @@ #ifndef __EMUL_TCPCI_PARTNER_SNK_H #define __EMUL_TCPCI_PARTNER_SNK_H -#include "emul/tcpc/emul_tcpci.h" +#include <zephyr/drivers/emul.h> #include "emul/tcpc/emul_tcpci_partner_common.h" +#include "emul/tcpc/emul_tcpci.h" #include "usb_pd.h" -#include <zephyr/drivers/emul.h> - /** * @brief USB-C sink device extension backend API * @defgroup tcpci_snk_emul USB-C sink device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h index 7ce14da82a..e72d0e4135 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h @@ -12,12 +12,11 @@ #ifndef __EMUL_TCPCI_PARTNER_SRC_H #define __EMUL_TCPCI_PARTNER_SRC_H -#include "emul/tcpc/emul_tcpci.h" +#include <zephyr/drivers/emul.h> #include "emul/tcpc/emul_tcpci_partner_common.h" +#include "emul/tcpc/emul_tcpci.h" #include "usb_pd.h" -#include <zephyr/drivers/emul.h> - /** * @brief USB-C source device extension backend API * @defgroup tcpci_src_emul USB-C source device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h deleted file mode 100644 index 6de0452b05..0000000000 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2022 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 USB-C VCONN-powered device emulator - */ - -#ifndef __EMUL_TCPCI_PARTNER_VPD_H -#define __EMUL_TCPCI_PARTNER_VPD_H - -#include "emul/tcpc/emul_tcpci_partner_common.h" -#include "emul/tcpc/emul_tcpci_partner_faulty_ext.h" -#include "emul/tcpc/emul_tcpci_partner_snk.h" -#include "emul/tcpc/emul_tcpci_partner_src.h" - -#include <zephyr/drivers/emul.h> - -/** - * @brief USB-C VCONN-powered device extension backend API - * @defgroup tcpci_src_emul USB-C source device extension - * @{ - */ - -struct tcpci_vpd_emul_data { - /** Common extension structure */ - struct tcpci_partner_extension ext; - /** Pointer to common TCPCI partner data */ - struct tcpci_partner_data *common_data; - struct tcpci_faulty_ext_data fault_ext; - struct tcpci_faulty_ext_action fault_actions[1]; - struct tcpci_snk_emul_data snk_ext; - struct tcpci_src_emul_data src_ext; - bool charge_through_connected; -}; - -struct tcpci_partner_extension * -tcpci_vpd_emul_init(struct tcpci_vpd_emul_data *data, - struct tcpci_partner_data *common_data, - struct tcpci_partner_extension *ext); - -/** - * @} - */ - -#endif /* __EMUL_TCPCI_PARTNER_VPD_H */ |