diff options
Diffstat (limited to 'include/host_command.h')
-rw-r--r-- | include/host_command.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/include/host_command.h b/include/host_command.h index 8a66776ce9..74f68f9891 100644 --- a/include/host_command.h +++ b/include/host_command.h @@ -358,13 +358,29 @@ stub_send_response_callback(struct host_cmd_handler_args *args) ARG_UNUSED(args); } -#define BUILD_HOST_COMMAND(CMD, VERSION, RESPONSE) \ - { \ - .command = (CMD), .version = (VERSION), \ - .send_response = stub_send_response_callback, \ - .response = &(RESPONSE), .response_max = sizeof(RESPONSE), \ - .response_size = sizeof(RESPONSE) \ +#define BUILD_HOST_COMMAND(CMD, VERSION, RESPONSE, PARAMS) \ + { \ + .command = (CMD), .version = (VERSION), \ + .send_response = stub_send_response_callback, \ + .response_size = 0, \ + COND_CODE_0(IS_EMPTY(RESPONSE), \ + (.response = &(RESPONSE), \ + .response_max = sizeof(RESPONSE)), \ + (.response = NULL, .response_max = 0)), \ + COND_CODE_0(IS_EMPTY(PARAMS), \ + (.params = &(PARAMS), \ + .params_size = sizeof(PARAMS)), \ + (.params = NULL, .params_size = 0)) \ } + +#define BUILD_HOST_COMMAND_RESPONSE(CMD, VERSION, RESPONSE) \ + BUILD_HOST_COMMAND(CMD, VERSION, RESPONSE, EMPTY) + +#define BUILD_HOST_COMMAND_PARAMS(CMD, VERSION, PARAMS) \ + BUILD_HOST_COMMAND(CMD, VERSION, EMPTY, PARAMS) + +#define BUILD_HOST_COMMAND_SIMPLE(CMD, VERSION) \ + BUILD_HOST_COMMAND(CMD, VERSION, EMPTY, EMPTY) #endif /* CONFIG_ZTEST */ #endif /* __CROS_EC_HOST_COMMAND_H */ |