etm_dummy.c 3.16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/***************************************************************************
 *   Copyright (C) 2007 by Dominic Rath                                    *
 *   Dominic.Rath@gmx.de                                                   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "etm_dummy.h"
#include "arm7_9_common.h"


28
static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
29
30
{
	target_t *target;
David Brownell's avatar
David Brownell committed
31
	struct arm *arm;
32

33
	target = get_target(args[0]);
34

35
36
	if (!target)
	{
37
		LOG_ERROR("target '%s' not defined", args[0]);
38
		return ERROR_FAIL;
39
	}
40

David Brownell's avatar
David Brownell committed
41
42
	arm = target_to_arm(target);
	if (!is_arm(arm))
43
	{
David Brownell's avatar
David Brownell committed
44
		command_print(cmd_ctx, "target '%s' isn't an ARM", args[0]);
45
		return ERROR_FAIL;
46
	}
47

David Brownell's avatar
David Brownell committed
48
	if (arm->etm)
49
	{
David Brownell's avatar
David Brownell committed
50
		arm->etm->capture_driver_priv = NULL;
51
52
53
	}
	else
	{
54
		LOG_ERROR("target has no ETM defined, ETM dummy left unconfigured");
55
		return ERROR_FAIL;
56
57
58
59
60
	}

	return ERROR_OK;
}

61
static int etm_dummy_register_commands(struct command_context_s *cmd_ctx)
62
63
{
	command_t *etm_dummy_cmd;
64

65
	etm_dummy_cmd = register_command(cmd_ctx, NULL, "etm_dummy", NULL, COMMAND_ANY, "Dummy ETM capture driver");
66

67
68
69
70
71
	register_command(cmd_ctx, etm_dummy_cmd, "config", handle_etm_dummy_config_command, COMMAND_CONFIG, NULL);

	return ERROR_OK;
}

72
static int etm_dummy_init(etm_context_t *etm_ctx)
73
74
75
76
{
	return ERROR_OK;
}

77
static trace_status_t etm_dummy_status(etm_context_t *etm_ctx)
78
79
80
81
{
	return TRACE_IDLE;
}

82
static int etm_dummy_read_trace(etm_context_t *etm_ctx)
83
84
85
86
{
	return ERROR_OK;
}

87
static int etm_dummy_start_capture(etm_context_t *etm_ctx)
88
89
90
91
{
	return ERROR_ETM_PORTMODE_NOT_SUPPORTED;
}

92
static int etm_dummy_stop_capture(etm_context_t *etm_ctx)
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
	return ERROR_OK;
}

etm_capture_driver_t etm_dummy_capture_driver =
{
	.name = "dummy",
	.register_commands = etm_dummy_register_commands,
	.init = etm_dummy_init,
	.status = etm_dummy_status,
	.start_capture = etm_dummy_start_capture,
	.stop_capture = etm_dummy_stop_capture,
	.read_trace = etm_dummy_read_trace,
};