-uint8_t
-ao_ee_read_config(uint8_t *buf, uint16_t len) __reentrant
-{
- ao_flash_setup();
- if (len > FLASH_BLOCK_SIZE)
- return 0;
- ao_mutex_get(&ao_flash_mutex); {
- ao_flash_fill(FLASH_CONFIG_BLOCK);
- memcpy(buf, ao_flash_data, len);
- } ao_mutex_put(&ao_flash_mutex);
- return 1;
-}
-
-static void
-flash_dump(void) __reentrant
-{
- uint8_t b;
- uint16_t block;
- uint8_t i;
-
- ao_cmd_hex();
- block = ao_cmd_lex_i;
- if (ao_cmd_status != ao_cmd_success)
- return;
- i = 0;
- do {
- if ((i & 7) == 0) {
- if (i)
- putchar('\n');
- ao_cmd_put16((uint16_t) i);
- }
- putchar(' ');
- ao_ee_read(((uint32_t) block << 8) | i, &b, 1);
- ao_cmd_put8(b);
- ++i;
- } while (i != 0);
- putchar('\n');
-}
-
-static void
-flash_store(void) __reentrant
-{
- uint16_t block;
- uint8_t i;
- uint16_t len;
- uint8_t b;
- uint32_t addr;
-
- ao_cmd_hex();
- block = ao_cmd_lex_i;
- ao_cmd_hex();
- i = ao_cmd_lex_i;
- addr = ((uint32_t) block << 8) | i;
- ao_cmd_hex();
- len = ao_cmd_lex_i;
- if (ao_cmd_status != ao_cmd_success)
- return;
- while (len--) {
- ao_cmd_hex();
- if (ao_cmd_status != ao_cmd_success)
- return;
- b = ao_cmd_lex_i;
- ao_ee_write(addr, &b, 1);
- addr++;
- }
- ao_ee_flush();
-}
-