X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Fstm8.c;h=6b03bb5a4ecd187cf19bc8b3273bd4b25a3ee3ce;hb=9ee9bdd2f9e69df816d313d23b50a563c0869428;hp=fcfc1707e0e7a4592c610e797f4fc9fb48054d28;hpb=6cb5ba6f1136df2986850f5c176cb38e34ca1795;p=openocd.git diff --git a/src/target/stm8.c b/src/target/stm8.c index fcfc1707e0..6b03bb5a4e 100644 --- a/src/target/stm8.c +++ b/src/target/stm8.c @@ -1,20 +1,20 @@ /* - OpenOCD STM8 target driver - Copyright (C) 2017 Ake Rehnman - ake.rehnman(at)gmail.com - - 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 3 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, see . +* OpenOCD STM8 target driver +* Copyright (C) 2017 Ake Rehnman +* ake.rehnman(at)gmail.com +* +* 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, see . */ #ifdef HAVE_CONFIG_H @@ -25,6 +25,7 @@ #include "target.h" #include "target_type.h" #include "hello.h" +#include "jtag/interface.h" #include "jtag/jtag.h" #include "jtag/hla/hla_transport.h" #include "jtag/hla/hla_interface.h" @@ -355,7 +356,7 @@ static int stm8_set_hwbreak(struct target *target, if ((comparator_list[0].type != HWBRK_EXEC) && (comparator_list[1].type != HWBRK_EXEC)) { - if ((comparator_list[0].type != comparator_list[1].type)) { + if (comparator_list[0].type != comparator_list[1].type) { LOG_ERROR("data hw breakpoints must be of same type"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } @@ -930,9 +931,7 @@ static int stm8_reset_assert(struct target *target) enum reset_types jtag_reset_config = jtag_get_reset_config(); if (jtag_reset_config & RESET_HAS_SRST) { - jtag_add_reset(0, 1); - res = adapter->layout->api->assert_srst(adapter->handle, 0); - + res = adapter_assert_reset(); if (res == ERROR_OK) /* hardware srst supported */ use_srst_fallback = false; @@ -966,21 +965,14 @@ static int stm8_reset_assert(struct target *target) static int stm8_reset_deassert(struct target *target) { int res; - struct hl_interface_s *adapter = target_to_adapter(target); - enum reset_types jtag_reset_config = jtag_get_reset_config(); if (jtag_reset_config & RESET_HAS_SRST) { - res = adapter->layout->api->assert_srst(adapter->handle, 1); + res = adapter_deassert_reset(); if ((res != ERROR_OK) && (res != ERROR_COMMAND_NOTFOUND)) return res; } - /* virtual deassert reset, we need it for the internal - * jtag state machine - */ - jtag_add_reset(0, 0); - /* The cpu should now be stalled. If halt was requested let poll detect the stall */ if (target->reset_halt)