diff options
Diffstat (limited to 'zephyr/test/drivers/host_cmd/src/pd_log.c')
-rw-r--r-- | zephyr/test/drivers/host_cmd/src/pd_log.c | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/zephyr/test/drivers/host_cmd/src/pd_log.c b/zephyr/test/drivers/host_cmd/src/pd_log.c index 819f020890..a6022d8bb1 100644 --- a/zephyr/test/drivers/host_cmd/src/pd_log.c +++ b/zephyr/test/drivers/host_cmd/src/pd_log.c @@ -3,14 +3,13 @@ * found in the LICENSE file. */ +#include <zephyr/kernel.h> +#include <zephyr/ztest.h> + #include "event_log.h" #include "host_command.h" #include "test/drivers/test_state.h" #include "usb_pd.h" -#include "util.h" - -#include <zephyr/kernel.h> -#include <zephyr/ztest.h> /** * @brief This is the maximum size of a single log entry. @@ -21,14 +20,6 @@ #define MAX_EVENT_LOG_ENTRY_SIZE (sizeof(struct event_log_entry) + 16) /** - * @brief This is the maximum size of a response pd log entry. - * - * Each entry must contain some common data + up to 16 bytes of additional type - * specific data. - */ -#define MAX_RESPONSE_PD_LOG_ENTRY_SIZE (sizeof(struct ec_response_pd_log) + 16) - -/** * @brief The size of the PD log entry data * * Logs from the PD include an additional 8 bytes of data to be sent to the AP. @@ -129,7 +120,7 @@ ZTEST_USER_F(pd_log, test_mcu_connect) ZTEST_USER_F(pd_log, test_read_log_entry) { - uint8_t response_buffer[MAX_RESPONSE_PD_LOG_ENTRY_SIZE]; + uint8_t response_buffer[sizeof(struct ec_response_pd_log) + 16]; struct ec_response_pd_log *response = (struct ec_response_pd_log *)response_buffer; struct host_cmd_handler_args args = @@ -142,25 +133,3 @@ ZTEST_USER_F(pd_log, test_read_log_entry) zassert_equal(sizeof(struct event_log_entry), args.response_size, NULL); zassert_equal(PD_EVENT_NO_ENTRY, response->type, NULL); } - -ZTEST_USER_F(pd_log, test_log_recv_vdm) -{ - uint8_t response_buffer[MAX_RESPONSE_PD_LOG_ENTRY_SIZE]; - uint32_t *payload = (uint32_t *)response_buffer; - struct ec_response_pd_log *response = - (struct ec_response_pd_log *)&payload[1]; - - memset(response_buffer, 0, sizeof(response_buffer)); - payload[0] |= VDO_SRC_RESPONDER; - response->type = PD_EVENT_MCU_CONNECT; - response->size_port = 8; - int cnt = DIV_ROUND_UP(response->size_port, sizeof(uint32_t)) + 2; - - pd_log_recv_vdm(0, cnt, payload); - - (void)log_dequeue_event(&fixture->log_entry); - - zassert_equal(response->type, fixture->log_entry.type, - "type=%d, received=%d", response->type, - fixture->log_entry.type); -} |