OpenOCD
algorithm.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2005 by Dominic Rath *
5  * Dominic.Rath@gmx.de *
6  ***************************************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11 
12 #include "algorithm.h"
13 #include <helper/binarybuffer.h>
14 
15 void init_mem_param(struct mem_param *param, uint32_t address, uint32_t size, enum param_direction direction)
16 {
17  param->address = address;
18  param->size = size;
19  param->value = malloc(size);
20  param->direction = direction;
21 }
22 
24 {
25  free(param->value);
26  param->value = NULL;
27 }
28 
29 void init_reg_param(struct reg_param *param, char *reg_name, uint32_t size, enum param_direction direction)
30 {
31  param->reg_name = reg_name;
32  param->size = size;
33  param->value = malloc(DIV_ROUND_UP(size, 8));
34  param->direction = direction;
35 }
36 
38 {
39  free(param->value);
40  param->value = NULL;
41 }
static struct aice_port_param_s param
void init_reg_param(struct reg_param *param, char *reg_name, uint32_t size, enum param_direction direction)
Definition: algorithm.c:29
void destroy_mem_param(struct mem_param *param)
Definition: algorithm.c:23
void destroy_reg_param(struct reg_param *param)
Definition: algorithm.c:37
void init_mem_param(struct mem_param *param, uint32_t address, uint32_t size, enum param_direction direction)
Definition: algorithm.c:15
param_direction
Definition: algorithm.h:14
Support functions to access arbitrary bits in a byte array.
static uint16_t direction
Definition: ftdi.c:119
size_t size
Size of the control block search area.
Definition: rtt/rtt.c:30
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.
Definition: types.h:79
#define NULL
Definition: usb.h:16