Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,3 @@ genrule(
tools = [":print_version_header.sh"],
stamp = 1,
)

cc_library(
name = "libhoth",
srcs = ["libhoth.c"],
hdrs = ["libhoth.h"],
deps = [
"//transports:libhoth_device",
],
)
17 changes: 4 additions & 13 deletions examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ cc_library(
"host_commands.h",
"authorization_record.h",
],
deps = [
"//protocol:host_cmd",
],
)

cc_library(
Expand All @@ -23,15 +26,6 @@ cc_library(
],
)

cc_library(
name = "ec_util",
srcs = [
"ec_util.c",
],
hdrs = ["ec_util.h"],
deps = [":host_commands"],
)

config_setting(
name = "dbus_backend",
define_values = {
Expand All @@ -44,8 +38,6 @@ cc_binary(
srcs = [
"authorization_record.h",
"authorization_record.c",
"ec_util.c",
"ec_util.h",
"host_commands.h",
"htool.c",
"htool.h",
Expand Down Expand Up @@ -87,11 +79,10 @@ cc_binary(
],
deps = [
":authorization_record",
":ec_util",
":host_commands",
":srtm",
"//:git_version",
"//:libhoth",
"//protocol:host_cmd",
"//transports:libhoth_device",
"//transports:libhoth_mtd",
"//transports:libhoth_spi",
Expand Down
44 changes: 0 additions & 44 deletions examples/ec_util.h

This file was deleted.

69 changes: 1 addition & 68 deletions examples/host_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,79 +18,12 @@
#include <stdint.h>

#include "authorization_record.h"
#include "protocol/host_cmd.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __packed
#define __packed __attribute__((packed))
#endif
#ifndef __aligned
#define __aligned(x) __attribute__((aligned(x)))
#endif

#define __ec_align1 __packed
#define __ec_align2 __packed __aligned(2)
#define __ec_align4 __packed __aligned(4)

enum ec_status {
EC_RES_SUCCESS = 0,
EC_RES_INVALID_COMMAND = 1,
EC_RES_ERROR = 2,
EC_RES_INVALID_PARAM = 3,
EC_RES_ACCESS_DENIED = 4,
EC_RES_INVALID_RESPONSE = 5,
EC_RES_INVALID_VERSION = 6,
EC_RES_INVALID_CHECKSUM = 7,
EC_RES_IN_PROGRESS = 8,
EC_RES_UNAVAILABLE = 9,
EC_RES_TIMEOUT = 10,
EC_RES_OVERFLOW = 11,
EC_RES_INVALID_HEADER = 12,
EC_RES_REQUEST_TRUNCATED = 13,
EC_RES_RESPONSE_TOO_BIG = 14,
EC_RES_BUS_ERROR = 15,
EC_RES_BUSY = 16,
EC_RES_INVALID_HEADER_VERSION = 17,
EC_RES_INVALID_HEADER_CRC = 18,
EC_RES_INVALID_DATA_CRC = 19,
EC_RES_DUP_UNAVAILABLE = 20,
EC_RES_MAX = UINT16_MAX
} __packed;

#define EC_HOST_REQUEST_VERSION 3

struct ec_host_request {
// Should be EC_HOST_REQUEST_VERSION
uint8_t struct_version;
// Checksum of request and data; sum of all bytes including checksum should
// total to 0.
uint8_t checksum;
// Command to send (EC_CMD_...)
uint16_t command;
// Command version
uint8_t command_version;
uint8_t reserved;
// Length of data that follows this header
uint16_t data_len;
} __ec_align4;

#define EC_HOST_RESPONSE_VERSION 3

struct ec_host_response {
// Should be EC_HOST_RESPONSE_VERSION
uint8_t struct_version;
// Checksum of request and data; sum of all bytes including checksum should
// total to 0.
uint8_t checksum;
// One of the EC_RES_* status codes
uint16_t result;
// Length of data which follows this header.
uint16_t data_len;
uint16_t reserved;
} __ec_align4;

#define EC_CMD_GET_VERSION 0x0002

enum ec_image {
Expand Down
Loading