X-Git-Url: http://git.droids-corp.org/?p=protos%2Fimu.git;a=blobdiff_plain;f=eeprom_config.h;fp=eeprom_config.h;h=7aff8677d2a8a3babd76b093d8d2a7c8bed0e321;hp=0000000000000000000000000000000000000000;hb=84796cd7a01e949167a155ec21f55fd71e788015;hpb=883f5aae494ab066938b0cebb554a1ee13766713 diff --git a/eeprom_config.h b/eeprom_config.h new file mode 100644 index 0000000..7aff867 --- /dev/null +++ b/eeprom_config.h @@ -0,0 +1,48 @@ +/* + * Copyright 2013 Olivier Matz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _EEPROM_CONFIG_H_ +#define _EEPROM_CONFIG_H_ + +#define EEPROM_CONFIG_MAGIC 0x666bea57 +#define EEPROM_CMD_SIZE 64 +#define EEPROM_N_CMD_MAX 16 + +struct eeprom_cmd { + char buf[EEPROM_CMD_SIZE]; +}; + +struct eeprom_config +{ + uint32_t magic; + uint8_t ncmds; + struct eeprom_cmd cmds[EEPROM_N_CMD_MAX]; +}; + +int8_t eeprom_load_config(void); +uint8_t eeprom_get_ncmds(void); +void eeprom_set_ncmds(uint8_t ncmds); +void eeprom_get_cmd(struct eeprom_cmd *cmd, uint8_t n); +void eeprom_set_cmd(struct eeprom_cmd *cmd, uint8_t n); +void eeprom_dump_cmds(void); +int8_t eeprom_insert_cmd_before(const char *str, uint8_t n); +int8_t eeprom_append_cmd(const char *str); +int8_t eeprom_delete_cmd(uint8_t n); + +#endif