X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fkernel%2Fao_storage.c;h=cfd116f9791bc536ae2e5709ddc066a3d84f3d8e;hb=188f9efadd480de872f86a8eb741e8738db84c6b;hp=5292e12095c2be18e3441b3caffe9c9e6310ce60;hpb=c6e57291d91f1f6c4de5c54a5cfd3eef66d9f830;p=fw%2Faltos diff --git a/src/kernel/ao_storage.c b/src/kernel/ao_storage.c index 5292e120..cfd116f9 100644 --- a/src/kernel/ao_storage.c +++ b/src/kernel/ao_storage.c @@ -20,11 +20,9 @@ #include uint8_t -ao_storage_read(ao_pos_t pos, void *buf, uint16_t len) +ao_storage_read(ao_pos_t pos, void *v_buf, uint16_t len) { -#ifdef CC1111 - return ao_storage_device_read(pos, buf, len); -#else + uint8_t *buf = v_buf; uint16_t this_len; uint16_t this_off; @@ -50,15 +48,12 @@ ao_storage_read(ao_pos_t pos, void *buf, uint16_t len) pos += this_len; } return 1; -#endif } uint8_t -ao_storage_write(ao_pos_t pos, void *buf, uint16_t len) +ao_storage_write(ao_pos_t pos, void *v_buf, uint16_t len) { -#ifdef CC1111 - return ao_storage_device_write(pos, buf, len); -#else + uint8_t *buf = v_buf; uint16_t this_len; uint16_t this_off; @@ -84,7 +79,6 @@ ao_storage_write(ao_pos_t pos, void *buf, uint16_t len) pos += this_len; } return 1; -#endif } static uint8_t storage_data[128]; @@ -92,15 +86,16 @@ static uint8_t storage_data[128]; static void ao_storage_dump(void) { + uint32_t block; uint8_t i, j; - ao_cmd_hex(); + block = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; for (i = 0; ; i += 8) { - if (ao_storage_read(((uint32_t) (ao_cmd_lex_i) << 8) + i, - storage_data, - 8)) { + if (ao_storage_read((block << 8) + i, + storage_data, + 8)) { ao_cmd_put16((uint16_t) i); for (j = 0; j < 8; j++) { putchar(' '); @@ -123,39 +118,35 @@ ao_storage_store(void) uint16_t block; uint8_t i; uint16_t len; - static uint8_t b; + uint8_t b; uint32_t addr; - ao_cmd_hex(); - block = ao_cmd_lex_i; - ao_cmd_hex(); - i = ao_cmd_lex_i; + block = ao_cmd_hex(); + i = ao_cmd_hex(); addr = ((uint32_t) block << 8) | i; - ao_cmd_hex(); - len = ao_cmd_lex_i; + len = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; while (len--) { - ao_cmd_hex(); + b = ao_cmd_hexbyte(); if (ao_cmd_status != ao_cmd_success) return; - b = ao_cmd_lex_i; ao_storage_write(addr, &b, 1); addr++; } } #endif -void +static void ao_storage_zap(void) { - ao_cmd_hex(); + uint32_t v = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - ao_storage_erase((uint32_t) ao_cmd_lex_i << 8); + ao_storage_erase((uint32_t) v << 8); } -void +static void ao_storage_zapall(void) { uint32_t pos; @@ -315,7 +306,7 @@ ao_storage_test(void) } #endif /* AO_STORAGE_TEST */ -void +static void ao_storage_info(void) { ao_storage_setup();