diff options
author | Jett Rink <jettrink@chromium.org> | 2019-08-02 16:20:50 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-20 15:53:16 +0000 |
commit | 2a7996a3caf25d358164a48e80723758e8be1fd1 (patch) | |
tree | a6dd0682b7ab1c3cc408450137e5f10988cf9da7 /test/test_config.h | |
parent | a1aea89ae15c85d56f52976289a329e7c58bc8f6 (diff) | |
download | chrome-ec-2a7996a3caf25d358164a48e80723758e8be1fd1.tar.gz |
usb: update state machine framework
- OBJ is renamed to context (CTX) for current and last state
- State definition now includes its parent (no need for the boiler
plate function that takes in a signal)
- The init_state, set_state, and exe_state have been re-written to take
advantages of new state machine definition. I had to add more logic to
handle hierarchical states fully.
- Explicitly create the USB states at the bottom of the file with all
of the statics. Don't need to use macros (even though I did suggest them)
- Use NULL when we do_nothing instead of calling into a function
- Created a "private" enum in the C file that lists all of the states
in the file, that we can use to refer to a state (it is also the
index into the states array for that state).
- Changed prototype of state function to return void, since we aren't
really using the return value and it cleans up a lot of return 0 that
aren't needed.
- Add const to int port since we can and should
- Moves struct definition to implementation file only to keep
implementation details private. We can access data through accessor if
needed.
BRANCH=none
BUG=none
TEST=all unit tests passes
Change-Id: I482a63e08f7d63022d5102b891a2fac0b0faa46f
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733744
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'test/test_config.h')
-rw-r--r-- | test/test_config.h | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/test/test_config.h b/test/test_config.h index 942c8c8501..1ca557bbef 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -236,8 +236,6 @@ int ncp15wb_calculate_temp(uint16_t adc); #undef CONFIG_USB_PRL_SM #undef CONFIG_USB_PE_SM #undef CONFIG_USB_TYPEC_SM -#undef CONFIG_SM_NESTING_NUM -#define CONFIG_SM_NESTING_NUM 3 #define CONFIG_USB_SM_FRAMEWORK #endif @@ -246,8 +244,6 @@ int ncp15wb_calculate_temp(uint16_t adc); #undef CONFIG_USB_PRL_SM #undef CONFIG_USB_PE_SM #undef CONFIG_USB_TYPEC_SM -#undef CONFIG_SM_NESTING_NUM -#define CONFIG_SM_NESTING_NUM 2 #define CONFIG_USB_SM_FRAMEWORK #endif @@ -256,8 +252,6 @@ int ncp15wb_calculate_temp(uint16_t adc); #undef CONFIG_USB_PRL_SM #undef CONFIG_USB_PE_SM #undef CONFIG_USB_TYPEC_SM -#undef CONFIG_SM_NESTING_NUM -#define CONFIG_SM_NESTING_NUM 1 #define CONFIG_USB_SM_FRAMEWORK #endif @@ -266,14 +260,10 @@ int ncp15wb_calculate_temp(uint16_t adc); #undef CONFIG_USB_PRL_SM #undef CONFIG_USB_PE_SM #undef CONFIG_USB_TYPEC_SM -#undef CONFIG_SM_NESTING_NUM -#define CONFIG_SM_NESTING_NUM 0 #define CONFIG_USB_SM_FRAMEWORK #endif #if defined(TEST_USB_PRL) -#undef CONFIG_SM_NESTING_NUM -#define CONFIG_SM_NESTING_NUM 3 #define CONFIG_USB_PD_PORT_COUNT 2 #define CONFIG_USB_SM_FRAMEWORK #undef CONFIG_USB_PE_SM @@ -292,8 +282,6 @@ int ncp15wb_calculate_temp(uint16_t adc); #else #define CONFIG_USB_TYPEC_CTVPD #endif -#undef CONFIG_SM_NESTING_NUM -#define CONFIG_SM_NESTING_NUM 3 #define CONFIG_USB_PID 0x5036 #define VPD_HW_VERSION 0x0001 |