summaryrefslogtreecommitdiff
path: root/include/usb_sm.h
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /include/usb_sm.h
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14396.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'include/usb_sm.h')
-rw-r--r--include/usb_sm.h113
1 files changed, 0 insertions, 113 deletions
diff --git a/include/usb_sm.h b/include/usb_sm.h
deleted file mode 100644
index 2b5939bc04..0000000000
--- a/include/usb_sm.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* USB State Machine Framework */
-
-#ifndef __CROS_EC_USB_SM_H
-#define __CROS_EC_USB_SM_H
-
-#include "compiler.h" /* for typeof() on Zephyr */
-
-/* Function pointer that implements a portion of a usb state */
-typedef void (*state_execution)(const int port);
-
-/*
- * General usb state that can be used in multiple state machines.
- *
- * entry - Optional method that will be run when this state is entered
- * run - Optional method that will be run repeatedly during state machine loop
- * exit - Optional method that will be run when this state exists
- * parent- Optional parent usb_state that contains common entry/run/exit
- * implementation among various child usb_states.
- * entry: Parent function executes BEFORE child function.
- * run: Parent function executes AFTER child function.
- * exit: Parent function executes AFTER child function.
- *
- * Note: When transitioning between two child states with a shared parent,
- * that parent's exit and entry functions do not execute.
- */
-struct usb_state {
- const state_execution entry;
- const state_execution run;
- const state_execution exit;
- const struct usb_state *parent;
-};
-
-typedef const struct usb_state *usb_state_ptr;
-
-/* Defines the current context of the usb statemachine. */
-struct sm_ctx {
- usb_state_ptr current;
- usb_state_ptr previous;
- /* We use intptr_t type to accommodate host tests ptr size variance */
- intptr_t internal[2];
-};
-
-/* Local state machine states */
-enum sm_local_state {
- SM_INIT = 0, /* Ensure static variables initialize to SM_INIT */
- SM_RUN,
- SM_PAUSED,
-};
-
-/*
- * A state machine can use these debug levels to regulate the amount of debug
- * information printed on the EC console
- *
- * The states currently defined are
- * Level 0: disabled
- * Level 1: state names
- *
- * Note that higher log level causes timing changes and thus may affect
- * performance.
- */
-enum debug_level {
- DEBUG_DISABLE,
- DEBUG_LEVEL_1,
- DEBUG_LEVEL_2,
- DEBUG_LEVEL_3,
- DEBUG_LEVEL_MAX = DEBUG_LEVEL_3
-};
-
-/**
- * Changes a state machines state. This handles exiting the previous state and
- * entering the target state. A common parent state will not exited nor be
- * re-entered.
- *
- * @param port USB-C port number
- * @param ctx State machine context
- * @param new_state State to transition to (NULL is valid and exits all states)
- */
-void set_state(int port, struct sm_ctx *ctx, usb_state_ptr new_state);
-
-/**
- * Runs one iteration of a state machine (including any parent states)
- *
- * @param port USB-C port number
- * @param ctx State machine context
- */
-void run_state(int port, struct sm_ctx *ctx);
-
-#ifdef TEST_BUILD
-/*
- * Struct for test builds that allow unit tests to easily iterate through
- * state machines
- */
-struct test_sm_data {
- /* Base pointer of the state machine array */
- const usb_state_ptr base;
- /* Size fo the state machine array above */
- const int size;
- /* The array of names for states, can be NULL */
- const char * const * const names;
- /* The size of the above names array */
- const int names_size;
-};
-#endif
-
-/* Creates a state machine state that will never link. Useful with IS_ENABLED */
-#define GEN_NOT_SUPPORTED(state) extern typeof(state) state ## _NOT_SUPPORTED
-
-#endif /* __CROS_EC_USB_SM_H */