diff --git a/firmware/libboard/owhw/include/board.h b/firmware/libboard/owhw/include/board.h index 44472d06..f9297719 100644 --- a/firmware/libboard/owhw/include/board.h +++ b/firmware/libboard/owhw/include/board.h @@ -46,6 +46,9 @@ /** index for green LED in LEDs pin definition array */ #define LED_NUM_GREEN 1 +/* pin connected to the SIMTRACE_BOOTLOADER signal. set high to force DFU bootloader start */ +#define PIN_BOOTLOADER {PIO_PA31, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} + /* USIM 2 interface (USART) */ #define PIN_USIM2_CLK {PIO_PA2, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} #define PIN_USIM2_IO {PIO_PA6, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} diff --git a/firmware/libboard/owhw/source/owhw.c b/firmware/libboard/owhw/source/owhw.c index 3bf51ec0..516d5923 100644 --- a/firmware/libboard/owhw/source/owhw.c +++ b/firmware/libboard/owhw/source/owhw.c @@ -1,7 +1,7 @@ /* Card simulator specific functions * * (C) 2015-2017 by Harald Welte - * (C) 2018, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon + * (C) 2018-2019, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon * * 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 @@ -65,3 +65,16 @@ void cardsim_gpio_init(void) { PIO_Configure(pins_cardsim, ARRAY_SIZE(pins_cardsim)); } + +int board_override_enter_dfu(void) +{ + const Pin bl_pin = PIN_BOOTLOADER; + + PIO_Configure(&bl_pin, 1); + + if (PIO_Get(&bl_pin) == 0) { // signal low + return 0; // do not override enter DFU + } else { + return 1; // override enter DFU + } +}