flash/nor/nrf5: handle ERROR_WAIT during nRF91 flash erase
[openocd.git] / src / target / algorithm.c
blob64abffc7b661229cfe80d46fc874bb360ede14f9
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 /***************************************************************************
4 * Copyright (C) 2005 by Dominic Rath *
5 * Dominic.Rath@gmx.de *
6 ***************************************************************************/
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
12 #include "algorithm.h"
13 #include <helper/binarybuffer.h>
15 void init_mem_param(struct mem_param *param, uint32_t address, uint32_t size, enum param_direction direction)
17 param->address = address;
18 param->size = size;
19 param->value = malloc(size);
20 param->direction = direction;
23 void destroy_mem_param(struct mem_param *param)
25 free(param->value);
26 param->value = NULL;
29 void init_reg_param(struct reg_param *param, char *reg_name, uint32_t size, enum param_direction direction)
31 param->reg_name = reg_name;
32 param->size = size;
33 param->value = malloc(DIV_ROUND_UP(size, 8));
34 param->direction = direction;
37 void destroy_reg_param(struct reg_param *param)
39 free(param->value);
40 param->value = NULL;