diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/eoption.c | 41 | ||||
-rw-r--r-- | common/memory_commands.c | 2 | ||||
-rw-r--r-- | common/port80.c | 8 |
3 files changed, 25 insertions, 26 deletions
diff --git a/common/eoption.c b/common/eoption.c index b4ecb457e2..38c329342e 100644 --- a/common/eoption.c +++ b/common/eoption.c @@ -27,16 +27,18 @@ enum block_offsets { OFFSET_BOOL0, }; - -/* Boolean options. Must be in the same order as enum eoption_bool, and must - * be terminated by an entry with a NULL name. */ +/* + * Boolean options. Must be in the same order as enum eoption_bool, and must + * be terminated by an entry with a NULL name. + */ static const struct eoption_bool_data bool_opts[] = { {OFFSET_BOOL0, (1 << 0), "bool_test"}, {0, 0, NULL}, }; - -/* Read a uint32_t from the specified EEPROM *word* offset. */ +/** + * Read a uint32_t from the specified EEPROM word offset. + */ static int read32(int offset, uint32_t *dest) { return eeprom_read(EEPROM_BLOCK_EOPTION, offset * 4, sizeof(uint32_t), @@ -44,14 +46,15 @@ static int read32(int offset, uint32_t *dest) } -/* Write a uint32_t to the specified EEPROM *word* offset. */ +/** + * Write a uint32_t to the specified EEPROM word offset. + */ static int write32(int offset, uint32_t v) { return eeprom_write(EEPROM_BLOCK_EOPTION, offset * 4, sizeof(v), (char *)&v); } - int eoption_get_bool(enum eoption_bool opt) { const struct eoption_bool_data *d = bool_opts + opt; @@ -61,7 +64,6 @@ int eoption_get_bool(enum eoption_bool opt) return v & d->mask ? 1 : 0; } - int eoption_set_bool(enum eoption_bool opt, int value) { const struct eoption_bool_data *d = bool_opts + opt; @@ -80,8 +82,11 @@ int eoption_set_bool(enum eoption_bool opt, int value) return write32(d->offset, v); } - -/* Find an option by name. Returns the option index, or -1 if no match. */ +/** + * Find an option by name. + * + * @return The option index, or -1 if no match. + */ static int find_option_by_name(const char *name, const struct eoption_bool_data *d) { @@ -98,10 +103,7 @@ static int find_option_by_name(const char *name, return -1; } -/*****************************************************************************/ -/* Initialization */ - -int eoption_init(void) +void eoption_init(void) { uint32_t v; int version; @@ -115,10 +117,12 @@ int eoption_init(void) version = (v >> 8) & 0xff; if (version == EOPTION_VERSION_CURRENT) - return EC_SUCCESS; + return; - /* TODO: should have a CRC if we start using this for real - * (non-debugging) options. */ + /* + * TODO: should have a CRC if we start using this for real + * (non-debugging) options. + */ /* Initialize fields which weren't set in previous versions */ if (version < 1) @@ -126,7 +130,7 @@ int eoption_init(void) /* Update the header */ v = (v & ~0xff00) | (EOPTION_VERSION_CURRENT << 8); - return write32(OFFSET_HEADER, v); + write32(OFFSET_HEADER, v); } /*****************************************************************************/ @@ -162,7 +166,6 @@ DECLARE_CONSOLE_COMMAND(optget, command_eoption_get, "Print EC option(s)", NULL); - static int command_eoption_set(int argc, char **argv) { char *e; diff --git a/common/memory_commands.c b/common/memory_commands.c index 46df50e74d..dae18777fd 100644 --- a/common/memory_commands.c +++ b/common/memory_commands.c @@ -8,7 +8,6 @@ #include "console.h" #include "util.h" - static int command_write_word(int argc, char **argv) { volatile uint32_t *address; @@ -38,7 +37,6 @@ DECLARE_CONSOLE_COMMAND(ww, command_write_word, "Write a word to memory", NULL); - static int command_read_word(int argc, char **argv) { volatile uint32_t *address; diff --git a/common/port80.c b/common/port80.c index 72b8ccde11..c23dc419b3 100644 --- a/common/port80.c +++ b/common/port80.c @@ -5,7 +5,7 @@ /* Port 80 module for Chrome EC */ -#include "board.h" +#include "common.h" #include "console.h" #include "host_command.h" #include "port80.h" @@ -16,7 +16,7 @@ #define HISTORY_LEN 256 static uint16_t history[HISTORY_LEN]; -static int writes; /* Number of port 80 writes so far */ +static int writes; /* Number of port 80 writes so far */ static int last_boot; /* Last code from previous boot */ static int scroll; static int print_in_int = 1; @@ -25,9 +25,7 @@ void port_80_write(int data) { /* * Note that this currently prints from inside the LPC interrupt - * itself. Probably not worth the system overhead to buffer the data - * and print it from a task, because we're printing a small amount of - * data and cprintf() doesn't block. + * itself. If you're dropping events, turn print_in_int off. */ if (print_in_int) CPRINTF("%c[%T Port 80: 0x%02x]", scroll ? '\n' : '\r', data); |