2007-07-15 06:19:33 -05:00
|
|
|
/***************************************************************************
|
|
|
|
* 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
|
|
|
|
|
2009-12-07 16:54:13 -06:00
|
|
|
#include "arm.h"
|
2007-07-15 06:19:33 -05:00
|
|
|
#include "etm_dummy.h"
|
|
|
|
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(handle_etm_dummy_config_command)
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
2009-11-13 12:11:13 -06:00
|
|
|
struct target *target;
|
2009-11-11 23:52:02 -06:00
|
|
|
struct arm *arm;
|
2008-11-19 01:32:30 -06:00
|
|
|
|
2009-11-15 10:15:59 -06:00
|
|
|
target = get_target(CMD_ARGV[0]);
|
2008-11-19 01:32:30 -06:00
|
|
|
|
2007-07-15 06:19:33 -05:00
|
|
|
if (!target)
|
|
|
|
{
|
2009-11-15 10:15:59 -06:00
|
|
|
LOG_ERROR("target '%s' not defined", CMD_ARGV[0]);
|
2008-11-19 01:32:30 -06:00
|
|
|
return ERROR_FAIL;
|
2007-07-15 06:19:33 -05:00
|
|
|
}
|
2008-11-19 01:32:30 -06:00
|
|
|
|
2009-11-11 23:52:02 -06:00
|
|
|
arm = target_to_arm(target);
|
|
|
|
if (!is_arm(arm))
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
2009-11-15 07:57:37 -06:00
|
|
|
command_print(CMD_CTX, "target '%s' isn't an ARM", CMD_ARGV[0]);
|
2008-11-19 01:32:30 -06:00
|
|
|
return ERROR_FAIL;
|
2007-07-15 06:19:33 -05:00
|
|
|
}
|
2008-11-19 01:32:30 -06:00
|
|
|
|
2009-11-11 23:52:02 -06:00
|
|
|
if (arm->etm)
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
2009-11-11 23:52:02 -06:00
|
|
|
arm->etm->capture_driver_priv = NULL;
|
2007-07-15 06:19:33 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-25 10:45:17 -05:00
|
|
|
LOG_ERROR("target has no ETM defined, ETM dummy left unconfigured");
|
2008-11-19 01:32:30 -06:00
|
|
|
return ERROR_FAIL;
|
2007-07-15 06:19:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-23 09:43:06 -06:00
|
|
|
static const struct command_registration etm_dummy_config_command_handlers[] = {
|
|
|
|
{
|
|
|
|
.name = "config",
|
|
|
|
.handler = &handle_etm_dummy_config_command,
|
|
|
|
.mode = COMMAND_CONFIG,
|
|
|
|
.usage = "<target>",
|
|
|
|
},
|
|
|
|
COMMAND_REGISTRATION_DONE
|
|
|
|
};
|
|
|
|
static const struct command_registration etm_dummy_command_handlers[] = {
|
|
|
|
{
|
|
|
|
.name = "etm_dummy",
|
|
|
|
.mode = COMMAND_ANY,
|
|
|
|
.help = "Dummy ETM capture driver command group",
|
|
|
|
.chain = etm_dummy_config_command_handlers,
|
|
|
|
},
|
|
|
|
COMMAND_REGISTRATION_DONE
|
|
|
|
};
|
|
|
|
|
2009-11-13 11:35:48 -06:00
|
|
|
static int etm_dummy_init(struct etm_context *etm_ctx)
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-13 11:35:48 -06:00
|
|
|
static trace_status_t etm_dummy_status(struct etm_context *etm_ctx)
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
|
|
|
return TRACE_IDLE;
|
|
|
|
}
|
|
|
|
|
2009-11-13 11:35:48 -06:00
|
|
|
static int etm_dummy_read_trace(struct etm_context *etm_ctx)
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-13 11:35:48 -06:00
|
|
|
static int etm_dummy_start_capture(struct etm_context *etm_ctx)
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
|
|
|
return ERROR_ETM_PORTMODE_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
2009-11-13 11:35:48 -06:00
|
|
|
static int etm_dummy_stop_capture(struct etm_context *etm_ctx)
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-13 10:42:39 -06:00
|
|
|
struct etm_capture_driver etm_dummy_capture_driver =
|
2007-07-15 06:19:33 -05:00
|
|
|
{
|
|
|
|
.name = "dummy",
|
2009-11-23 10:24:02 -06:00
|
|
|
.commands = etm_dummy_command_handlers,
|
2007-07-15 06:19:33 -05:00
|
|
|
.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,
|
|
|
|
};
|