target: split mem_map_free into ram_map_free and flash_map_free

Signed-off-by: Rafael Silva <rafaelsilva@ajtec.pt>
This commit is contained in:
Rafael Silva 2022-05-24 14:59:58 +01:00 committed by Rachel Mant
parent 8462f5e0d4
commit cf6ce32371
2 changed files with 13 additions and 2 deletions

View File

@ -84,13 +84,16 @@ int target_foreach(void (*cb)(int, target *t, void *context), void *context)
return i;
}
void target_mem_map_free(target *t)
{
void target_ram_map_free(target *t) {
while (t->ram) {
void * next = t->ram->next;
free(t->ram);
t->ram = next;
}
}
void target_flash_map_free(target *t) {
while (t->flash) {
void * next = t->flash->next;
if (t->flash->buf)
@ -100,6 +103,12 @@ void target_mem_map_free(target *t)
}
}
void target_mem_map_free(target *t)
{
target_ram_map_free(t);
target_flash_map_free(t);
}
void target_list_free(void)
{
struct target_command_s *tc;

View File

@ -136,6 +136,8 @@ struct target_s {
void (*priv_free)(void *);
};
void target_ram_map_free(target *t);
void target_flash_map_free(target *t);
void target_mem_map_free(target *t);
void target_add_commands(target *t, const struct command_s *cmds, const char *name);
void target_add_ram(target *t, target_addr start, uint32_t len);