COIL: Use inclusive language for EC-EC communication code

Replace with server/client nomenclature

BUG=none
TEST=build and run on volteer
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: I23fe7de9228a9611b49eef1362bf15159b25aab7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586038
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
Dossym Nurmukhanov 2020-12-11 11:17:39 -08:00 committed by Commit Bot
parent a86aecb2de
commit 61022575d3
7 changed files with 67 additions and 67 deletions

View File

@ -145,15 +145,15 @@ struct keyboard_scan_config keyscan_config = {
struct consumer const ec_ec_usart_consumer;
static struct usart_config const ec_ec_usart;
struct queue const ec_ec_comm_slave_input = QUEUE_DIRECT(64, uint8_t,
struct queue const ec_ec_comm_server_input = QUEUE_DIRECT(64, uint8_t,
ec_ec_usart.producer, ec_ec_usart_consumer);
struct queue const ec_ec_comm_slave_output = QUEUE_DIRECT(64, uint8_t,
struct queue const ec_ec_comm_server_output = QUEUE_DIRECT(64, uint8_t,
null_producer, ec_ec_usart.consumer);
struct consumer const ec_ec_usart_consumer = {
.queue = &ec_ec_comm_slave_input,
.queue = &ec_ec_comm_server_input,
.ops = &((struct consumer_ops const) {
.written = ec_ec_comm_slave_written,
.written = ec_ec_comm_server_written,
}),
};
@ -163,8 +163,8 @@ static struct usart_config const ec_ec_usart =
usart_tx_interrupt,
115200,
USART_CONFIG_FLAG_HDSEL,
ec_ec_comm_slave_input,
ec_ec_comm_slave_output);
ec_ec_comm_server_input,
ec_ec_comm_server_output);
#endif /* BOARD_WAND && SECTION_IS_RW */
/******************************************************************************
@ -184,8 +184,8 @@ static void board_init(void)
#ifdef BOARD_WAND
/* USB to serial queues */
queue_init(&ec_ec_comm_slave_input);
queue_init(&ec_ec_comm_slave_output);
queue_init(&ec_ec_comm_server_input);
queue_init(&ec_ec_comm_server_output);
/* UART init */
usart_init(&ec_ec_usart);

View File

@ -13,7 +13,7 @@
TASK_ALWAYS_RW(TOUCHPAD, touchpad_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS_RW(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS (CONSOLE, console_task, NULL, 1024) \
TASK_ALWAYS_RW(ECCOMM, ec_ec_comm_slave_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS_RW(ECCOMM, ec_ec_comm_server_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST_RW(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
#elif defined(CONFIG_USB_ISOCHRONOUS)
#define CONFIG_TASK_LIST \

View File

@ -306,11 +306,11 @@ static void update_base_battery_info(void)
int flags_changed;
int old_full_capacity = bd->full_capacity;
ec_ec_master_base_get_dynamic_info();
ec_ec_client_base_get_dynamic_info();
flags_changed = (old_flags != bd->flags);
/* Fetch static information when flags change. */
if (flags_changed)
ec_ec_master_base_get_static_info();
ec_ec_client_base_get_static_info();
battery_memmap_refresh(BATT_IDX_BASE);
@ -350,7 +350,7 @@ static int set_base_current(int current_base, int allow_charge_base)
const int otg_voltage = db_policy.otg_voltage;
int ret;
ret = ec_ec_master_base_charge_control(current_base,
ret = ec_ec_client_base_charge_control(current_base,
otg_voltage, allow_charge_base);
if (ret) {
/* Ignore errors until the base is responsive. */
@ -560,7 +560,7 @@ static void charge_allocate_input_current_limit(void)
if (base_responsive) {
/* Base still responsive, put it to sleep. */
CPRINTF("Hibernating base\n");
ec_ec_master_hibernate();
ec_ec_client_hibernate();
base_responsive = 0;
board_enable_base_power(0);
}
@ -2088,7 +2088,7 @@ wait_for_it:
#endif
#ifdef CONFIG_EC_EC_COMM_BATTERY_SLAVE
/*
* On EC-EC slave, do not charge if curr.ac is 0: there
* On EC-EC server, do not charge if curr.ac is 0: there
* might still be some external power available but we
* do not want to use it for charging.
*/

View File

@ -2,7 +2,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* EC-EC communication, functions and definitions for master.
* EC-EC communication, functions and definitions for client.
*/
#include "battery.h"
@ -22,11 +22,11 @@
* TODO(b:65697962): The packed structures below do not play well if we force EC
* host commands structures to be aligned on 32-bit boundary. There are ways to
* fix that, possibly requiring copying data around, or modifying
* uart_alt_pad_write_read API to write the actual slave response to a separate
* uart_alt_pad_write_read API to write the actual server response to a separate
* buffer.
*/
#ifdef CONFIG_HOSTCMD_ALIGNED
#error "Cannot define CONFIG_HOSTCMD_ALIGNED with EC-EC communication master."
#error "Cannot define CONFIG_HOSTCMD_ALIGNED with EC-EC communication client."
#endif
#define EC_EC_HOSTCMD_VERSION 4
@ -78,7 +78,7 @@ struct {
* crc8 are verified by this function).
*
* This format is required as the EC-EC UART is half-duplex, and all the
* transmitted data is received back, i.e. the master writes req, then reads
* transmitted data is received back, i.e. the client writes req, then reads
* req, followed by resp.
*
* When a command does not take parameters, param/crc8 must be omitted in
@ -113,12 +113,12 @@ static int write_command(uint16_t command,
struct ec_host_response4 *response_header =
(void *)&data[tx_length];
/* RX length is TX length + response from slave. */
/* RX length is TX length + response from server. */
int rx_length = tx_length +
sizeof(*request_header) + ((resp_len > 0) ? (resp_len + 1) : 0);
/*
* Make sure there is a gap between each command, so that the slave
* Make sure there is a gap between each command, so that the server
* can recover its state machine after each command.
*
* TODO(b:65697962): We can be much smarter than this, and record the
@ -241,7 +241,7 @@ static int handle_error(const char *func, int ret, int request_result)
}
#ifdef CONFIG_EC_EC_COMM_BATTERY
int ec_ec_master_base_get_dynamic_info(void)
int ec_ec_client_base_get_dynamic_info(void)
{
int ret;
struct {
@ -281,7 +281,7 @@ int ec_ec_master_base_get_dynamic_info(void)
return EC_RES_SUCCESS;
}
int ec_ec_master_base_get_static_info(void)
int ec_ec_client_base_get_static_info(void)
{
int ret;
struct {
@ -321,7 +321,7 @@ int ec_ec_master_base_get_static_info(void)
return EC_RES_SUCCESS;
}
int ec_ec_master_base_charge_control(int max_current,
int ec_ec_client_base_charge_control(int max_current,
int otg_voltage,
int allow_charging)
{
@ -347,7 +347,7 @@ int ec_ec_master_base_charge_control(int max_current,
return handle_error(__func__, ret, data.resp.head.result);
}
int ec_ec_master_hibernate(void)
int ec_ec_client_hibernate(void)
{
int ret;
struct {

View File

@ -2,7 +2,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* EC-EC communication, task and functions for slave.
* EC-EC communication, task and functions for server.
*/
#include "common.h"
@ -27,7 +27,7 @@
/* Print extra debugging information */
#undef EXTRA_DEBUG
/* Set if the master allows the slave to charge the battery. */
/* Set if the client allows the server to charge the battery. */
static int charging_allowed;
/*
@ -52,7 +52,7 @@ BUILD_ASSERT(LARGEST_PARAMS_SIZE >=
#define COMMAND_TIMEOUT_US (5 * MSEC)
void ec_ec_comm_slave_written(struct consumer const *consumer, size_t count)
void ec_ec_comm_server_written(struct consumer const *consumer, size_t count)
{
task_wake(TASK_ID_ECCOMM);
}
@ -66,13 +66,13 @@ void ec_ec_comm_slave_written(struct consumer const *consumer, size_t count)
static void discard_queue(void)
{
do {
queue_advance_head(&ec_ec_comm_slave_input,
queue_count(&ec_ec_comm_slave_input));
queue_advance_head(&ec_ec_comm_server_input,
queue_count(&ec_ec_comm_server_input));
usleep(1 * MSEC);
} while (queue_count(&ec_ec_comm_slave_input) > 0);
} while (queue_count(&ec_ec_comm_server_input) > 0);
}
/* Write response to master. */
/* Write response to client. */
static void write_response(uint16_t res, int seq, const void *data, int len)
{
struct ec_host_response4 header;
@ -89,13 +89,13 @@ static void write_response(uint16_t res, int seq, const void *data, int len)
header.reserved = 0;
header.header_crc =
cros_crc8((uint8_t *)&header, sizeof(header)-1);
QUEUE_ADD_UNITS(&ec_ec_comm_slave_output,
QUEUE_ADD_UNITS(&ec_ec_comm_server_output,
(uint8_t *)&header, sizeof(header));
if (len > 0) {
QUEUE_ADD_UNITS(&ec_ec_comm_slave_output, data, len);
QUEUE_ADD_UNITS(&ec_ec_comm_server_output, data, len);
crc = cros_crc8(data, len);
QUEUE_ADD_UNITS(&ec_ec_comm_slave_output, &crc, sizeof(crc));
QUEUE_ADD_UNITS(&ec_ec_comm_server_output, &crc, sizeof(crc));
}
}
@ -108,7 +108,7 @@ static int read_data(void *buffer, size_t len, uint32_t start)
{
uint32_t delta;
while (queue_count(&ec_ec_comm_slave_input) < len) {
while (queue_count(&ec_ec_comm_server_input) < len) {
delta = __hw_clock_source_read() - start;
if (delta >= COMMAND_TIMEOUT_US)
return EC_ERROR_TIMEOUT;
@ -118,7 +118,7 @@ static int read_data(void *buffer, size_t len, uint32_t start)
}
/* Fetch header */
QUEUE_REMOVE_UNITS(&ec_ec_comm_slave_input, buffer, len);
QUEUE_REMOVE_UNITS(&ec_ec_comm_server_input, buffer, len);
return EC_SUCCESS;
}
@ -191,13 +191,13 @@ out:
}
/*
* On dual-battery slave, we use the charging allowed signal from master to
* On dual-battery server, we use the charging allowed signal from client to
* indicate whether external power is present.
*
* In most cases, this actually matches the external power status of the master
* (slave battery charging when AC is connected, or discharging when slave
* battery still has enough capacity), with one exception: when we do master to
* slave battery charging (in this case the "external" power is the master).
* In most cases, this actually matches the external power status of the client
* (server battery charging when AC is connected, or discharging when server
* battery still has enough capacity), with one exception: when we do client to
* server battery charging (in this case the "external" power is the client).
*/
int extpower_is_present(void)
{
@ -205,7 +205,7 @@ int extpower_is_present(void)
}
#endif
void ec_ec_comm_slave_task(void *u)
void ec_ec_comm_server_task(void *u)
{
struct ec_host_request4 header;
/*
@ -219,7 +219,7 @@ void ec_ec_comm_slave_task(void *u)
while (1) {
task_wait_event(-1);
if (queue_count(&ec_ec_comm_slave_input) == 0)
if (queue_count(&ec_ec_comm_server_input) == 0)
continue;
/* We got some data, start timeout counter. */

View File

@ -2,57 +2,57 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* EC-EC communication, functions for master.
* EC-EC communication, functions for client.
*/
#ifndef EC_EC_COMM_MASTER_H_
#define EC_EC_COMM_MASTER_H_
#ifndef EC_EC_COMM_CLIENT_H_
#define EC_EC_COMM_CLIENT_H_
#include <stdint.h>
#include "config.h"
/**
* Sends EC_CMD_BATTERY_GET_DYNAMIC command to slave, and writes the
* Sends EC_CMD_BATTERY_GET_DYNAMIC command to server, and writes the
* battery dynamic information into battery_dynamic[BATT_IDX_BASE].
*
* Leaves battery_dynamic[BATT_IDX_BASE] intact on error: it is the callers
* responsibility to clear the data or ignore it.
* @return EC_RES_SUCCESS on success, EC_RES_ERROR on communication error,
* else forwards the error code from the slave.
* else forwards the error code from the server.
*/
int ec_ec_master_base_get_dynamic_info(void);
int ec_ec_client_base_get_dynamic_info(void);
/**
* Sends EC_CMD_BATTERY_GET_STATIC command to slave, and writes the
* Sends EC_CMD_BATTERY_GET_STATIC command to server, and writes the
* battery static information into battery_static[BATT_IDX_BASE].
*
* Leaves battery_static[BATT_IDX_BASE] intact on error: it is the callers
* responsibility to clear the data or ignore it.
*
* @return EC_RES_SUCCESS on success, EC_RES_ERROR on communication error,
* else forwards the error code from the slave.
* else forwards the error code from the server.
*/
int ec_ec_master_base_get_static_info(void);
int ec_ec_client_base_get_static_info(void);
/**
* Sends EC_CMD_CHARGER_CONTROL command to slave, with the given parameters
* Sends EC_CMD_CHARGER_CONTROL command to server, with the given parameters
* (see ec_commands.h/ec_params_charger_control for description).
*
* @return EC_RES_SUCCESS on success, EC_RES_ERROR on communication error,
* else forwards the error code from the slave.
* else forwards the error code from the server.
*/
int ec_ec_master_base_charge_control(int max_current,
int ec_ec_client_base_charge_control(int max_current,
int otg_voltage,
int allow_charging);
/**
* Sends EC_CMD_REBOOT_EC command to slave, with EC_REBOOT_HIBERNATE parameter.
* Sends EC_CMD_REBOOT_EC command to server, with EC_REBOOT_HIBERNATE parameter.
*
* @return EC_RES_ERROR on communication error (should always be the case if the
* slave successfully hibernates, as it will not be able to write back the
* response, else forwards the error code from the slave.
* server successfully hibernates, as it will not be able to write back the
* response, else forwards the error code from the server.
*/
int ec_ec_master_hibernate(void);
int ec_ec_client_hibernate(void);
#endif /* EC_EC_COMM_MASTER_H_ */
#endif /* EC_EC_COMM_CLIENT_H_ */

View File

@ -2,19 +2,19 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* EC-EC communication, functions and definition for slave.
* EC-EC communication, functions and definition for server.
*/
#ifndef EC_EC_COMM_SLAVE_H_
#define EC_EC_COMM_SLAVE_H_
#ifndef EC_EC_COMM_SERVER_H_
#define EC_EC_COMM_SERVER_H_
#include <stdint.h>
#include "consumer.h"
#include "queue.h"
extern struct queue const ec_ec_comm_slave_input;
extern struct queue const ec_ec_comm_slave_output;
extern struct queue const ec_ec_comm_server_input;
extern struct queue const ec_ec_comm_server_output;
void ec_ec_comm_slave_written(struct consumer const *consumer, size_t count);
void ec_ec_comm_server_written(struct consumer const *consumer, size_t count);
#endif /* EC_EC_COMM_SLAVE_H_ */
#endif /* EC_EC_COMM_SERVER_H_ */