target/armv7m_trace: Use prefix for enums

Change-Id: I3f199e6053146a1094d96b98ea174b41bb021599
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/3905
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
This commit is contained in:
Marc Schink 2016-12-10 12:59:27 +01:00 committed by Paul Fertser
parent 55abb63752
commit 9f93cca427
5 changed files with 20 additions and 19 deletions

View File

@ -1275,7 +1275,7 @@ static int config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol,
return ERROR_FAIL; return ERROR_FAIL;
} }
if (pin_protocol != ASYNC_UART) { if (pin_protocol != TPIU_PIN_PROTOCOL_ASYNC_UART) {
LOG_ERROR("Selected pin protocol is not supported."); LOG_ERROR("Selected pin protocol is not supported.");
return ERROR_FAIL; return ERROR_FAIL;
} }

View File

@ -2199,7 +2199,8 @@ int stlink_config_trace(void *handle, bool enabled, enum tpiu_pin_protocol pin_p
{ {
struct stlink_usb_handle_s *h = handle; struct stlink_usb_handle_s *h = handle;
if (enabled && (h->jtag_api < 2 || pin_protocol != ASYNC_UART)) { if (enabled && (h->jtag_api < 2 ||
pin_protocol != TPIU_PIN_PROTOCOL_ASYNC_UART)) {
LOG_ERROR("The attached ST-LINK version doesn't support this trace mode"); LOG_ERROR("The attached ST-LINK version doesn't support this trace mode");
return ERROR_FAIL; return ERROR_FAIL;
} }

View File

@ -62,7 +62,7 @@ int armv7m_trace_tpiu_config(struct target *target)
target_unregister_timer_callback(armv7m_poll_trace, target); target_unregister_timer_callback(armv7m_poll_trace, target);
retval = adapter_config_trace(trace_config->config_type == INTERNAL, retval = adapter_config_trace(trace_config->config_type == TRACE_CONFIG_TYPE_INTERNAL,
trace_config->pin_protocol, trace_config->pin_protocol,
trace_config->port_size, trace_config->port_size,
&trace_config->trace_freq); &trace_config->trace_freq);
@ -83,7 +83,7 @@ int armv7m_trace_tpiu_config(struct target *target)
trace_config->trace_freq, trace_config->traceclkin_freq, trace_config->trace_freq, trace_config->traceclkin_freq,
trace_freq); trace_freq);
trace_config->trace_freq = trace_freq; trace_config->trace_freq = trace_freq;
retval = adapter_config_trace(trace_config->config_type == INTERNAL, retval = adapter_config_trace(trace_config->config_type == TRACE_CONFIG_TYPE_INTERNAL,
trace_config->pin_protocol, trace_config->pin_protocol,
trace_config->port_size, trace_config->port_size,
&trace_config->trace_freq); &trace_config->trace_freq);
@ -115,7 +115,7 @@ int armv7m_trace_tpiu_config(struct target *target)
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
if (trace_config->config_type == INTERNAL) if (trace_config->config_type == TRACE_CONFIG_TYPE_INTERNAL)
target_register_timer_callback(armv7m_poll_trace, 1, 1, target); target_register_timer_callback(armv7m_poll_trace, 1, 1, target);
target_call_event_callbacks(target, TARGET_EVENT_TRACE_CONFIG); target_call_event_callbacks(target, TARGET_EVENT_TRACE_CONFIG);
@ -173,7 +173,7 @@ COMMAND_HANDLER(handle_tpiu_config_command)
if (CMD_ARGC == cmd_idx + 1) { if (CMD_ARGC == cmd_idx + 1) {
close_trace_file(armv7m); close_trace_file(armv7m);
armv7m->trace_config.config_type = DISABLED; armv7m->trace_config.config_type = TRACE_CONFIG_TYPE_DISABLED;
if (CMD_CTX->mode == COMMAND_EXEC) if (CMD_CTX->mode == COMMAND_EXEC)
return armv7m_trace_tpiu_config(target); return armv7m_trace_tpiu_config(target);
else else
@ -183,13 +183,13 @@ COMMAND_HANDLER(handle_tpiu_config_command)
!strcmp(CMD_ARGV[cmd_idx], "internal")) { !strcmp(CMD_ARGV[cmd_idx], "internal")) {
close_trace_file(armv7m); close_trace_file(armv7m);
armv7m->trace_config.config_type = EXTERNAL; armv7m->trace_config.config_type = TRACE_CONFIG_TYPE_EXTERNAL;
if (!strcmp(CMD_ARGV[cmd_idx], "internal")) { if (!strcmp(CMD_ARGV[cmd_idx], "internal")) {
cmd_idx++; cmd_idx++;
if (CMD_ARGC == cmd_idx) if (CMD_ARGC == cmd_idx)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
armv7m->trace_config.config_type = INTERNAL; armv7m->trace_config.config_type = TRACE_CONFIG_TYPE_INTERNAL;
if (strcmp(CMD_ARGV[cmd_idx], "-") != 0) { if (strcmp(CMD_ARGV[cmd_idx], "-") != 0) {
armv7m->trace_config.trace_file = fopen(CMD_ARGV[cmd_idx], "ab"); armv7m->trace_config.trace_file = fopen(CMD_ARGV[cmd_idx], "ab");
@ -204,7 +204,7 @@ COMMAND_HANDLER(handle_tpiu_config_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
if (!strcmp(CMD_ARGV[cmd_idx], "sync")) { if (!strcmp(CMD_ARGV[cmd_idx], "sync")) {
armv7m->trace_config.pin_protocol = SYNC; armv7m->trace_config.pin_protocol = TPIU_PIN_PROTOCOL_SYNC;
cmd_idx++; cmd_idx++;
if (CMD_ARGC == cmd_idx) if (CMD_ARGC == cmd_idx)
@ -213,9 +213,9 @@ COMMAND_HANDLER(handle_tpiu_config_command)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[cmd_idx], armv7m->trace_config.port_size); COMMAND_PARSE_NUMBER(u32, CMD_ARGV[cmd_idx], armv7m->trace_config.port_size);
} else { } else {
if (!strcmp(CMD_ARGV[cmd_idx], "manchester")) if (!strcmp(CMD_ARGV[cmd_idx], "manchester"))
armv7m->trace_config.pin_protocol = ASYNC_MANCHESTER; armv7m->trace_config.pin_protocol = TPIU_PIN_PROTOCOL_ASYNC_MANCHESTER;
else if (!strcmp(CMD_ARGV[cmd_idx], "uart")) else if (!strcmp(CMD_ARGV[cmd_idx], "uart"))
armv7m->trace_config.pin_protocol = ASYNC_UART; armv7m->trace_config.pin_protocol = TPIU_PIN_PROTOCOL_ASYNC_UART;
else else
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -237,7 +237,7 @@ COMMAND_HANDLER(handle_tpiu_config_command)
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[cmd_idx], armv7m->trace_config.trace_freq); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[cmd_idx], armv7m->trace_config.trace_freq);
cmd_idx++; cmd_idx++;
} else { } else {
if (armv7m->trace_config.config_type != INTERNAL) { if (armv7m->trace_config.config_type != TRACE_CONFIG_TYPE_INTERNAL) {
LOG_ERROR("Trace port frequency can't be omitted in external capture mode"); LOG_ERROR("Trace port frequency can't be omitted in external capture mode");
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }

View File

@ -27,15 +27,15 @@
*/ */
enum trace_config_type { enum trace_config_type {
DISABLED, /**< tracing is disabled */ TRACE_CONFIG_TYPE_DISABLED, /**< tracing is disabled */
EXTERNAL, /**< trace output is captured externally */ TRACE_CONFIG_TYPE_EXTERNAL, /**< trace output is captured externally */
INTERNAL /**< trace output is handled by OpenOCD adapter driver */ TRACE_CONFIG_TYPE_INTERNAL /**< trace output is handled by OpenOCD adapter driver */
}; };
enum tpiu_pin_protocol { enum tpiu_pin_protocol {
SYNC, /**< synchronous trace output */ TPIU_PIN_PROTOCOL_SYNC, /**< synchronous trace output */
ASYNC_MANCHESTER, /**< asynchronous output with Manchester coding */ TPIU_PIN_PROTOCOL_ASYNC_MANCHESTER, /**< asynchronous output with Manchester coding */
ASYNC_UART /**< asynchronous output with NRZ coding */ TPIU_PIN_PROTOCOL_ASYNC_UART /**< asynchronous output with NRZ coding */
}; };
enum itm_ts_prescaler { enum itm_ts_prescaler {

View File

@ -2080,7 +2080,7 @@ int cortex_m_examine(struct target *target)
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
if (armv7m->trace_config.config_type != DISABLED) { if (armv7m->trace_config.config_type != TRACE_CONFIG_TYPE_DISABLED) {
armv7m_trace_tpiu_config(target); armv7m_trace_tpiu_config(target);
armv7m_trace_itm_config(target); armv7m_trace_itm_config(target);
} }