From bd0d4b4252c5254d826bbbcae87e644c5159f45d Mon Sep 17 00:00:00 2001 From: Eric Wild Date: Thu, 17 Oct 2019 19:52:25 +0200 Subject: debug error handling, sim-atr 0 vty command results in parity errors --- sysmoOCTSIM/main.c | 5 +++++ sysmoOCTSIM/talloc.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index 6381a80..db42240 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -75,6 +75,10 @@ static const double sercom_glck_freqs[] = {100E6 / CONF_GCLK_GEN_2_DIV, 100E6 / */ static const uint8_t SIM_peripheral_GCLK_ID[] = {SERCOM0_GCLK_ID_CORE, SERCOM1_GCLK_ID_CORE, SERCOM2_GCLK_ID_CORE, SERCOM3_GCLK_ID_CORE, SERCOM4_GCLK_ID_CORE, SERCOM5_GCLK_ID_CORE, SERCOM6_GCLK_ID_CORE, SERCOM7_GCLK_ID_CORE}; +static void _SIM_error_cb(const struct usart_async_descriptor *const descr){ + while(1){ asm("nop");} +} + static void board_init() { int i; @@ -99,6 +103,7 @@ static void board_init() } usart_async_register_callback(SIM_peripheral_descriptors[i], USART_ASYNC_RXC_CB, SIM_rx_cb); // required for RX to work, even if the callback does nothing usart_async_register_callback(SIM_peripheral_descriptors[i], USART_ASYNC_TXC_CB, SIM_tx_cb); // to count the number of bytes transmitted since we are using it asynchronously + usart_async_register_callback(SIM_peripheral_descriptors[i], USART_ASYNC_ERROR_CB, _SIM_error_cb); usart_async_enable(SIM_peripheral_descriptors[i]); } } diff --git a/sysmoOCTSIM/talloc.c b/sysmoOCTSIM/talloc.c index c5c9062..ed6ea0c 100644 --- a/sysmoOCTSIM/talloc.c +++ b/sysmoOCTSIM/talloc.c @@ -30,6 +30,7 @@ inspired by http://swapped.cc/halloc/ */ +#include #include "replace.h" #include "talloc.h" @@ -801,6 +802,8 @@ static inline void *__talloc(const void *context, size_t size, struct talloc_chunk **tc) { + if( SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) + while(1) { asm("nop");}; return __talloc_with_prefix(context, size, 0, tc); } -- cgit v1.2.3