From 8e02955c3dce4b512b83ef2fda989577fb8abfad Mon Sep 17 00:00:00 2001 From: Cristiano De Alti Date: Wed, 3 Dec 2014 00:12:43 +0100 Subject: [PATCH] Fix menu. How could it worked before? Also added a macro to disable JTAG using inline assembly --- platform/avr-ravenlcd/menu.c | 38 +++++++++++++++++++++---------- platform/avr-ravenlcd/raven3290.c | 8 +++---- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/platform/avr-ravenlcd/menu.c b/platform/avr-ravenlcd/menu.c index a5cda40a9..3069d7825 100644 --- a/platform/avr-ravenlcd/menu.c +++ b/platform/avr-ravenlcd/menu.c @@ -66,6 +66,27 @@ bool auto_temp=true; /*---------------------------------------------------------------------------*/ +/** + * \brief This will reliably set or clear the JTD bit of the MCUCR register. + * + * \param x True to set the JTD bit disabling JTAG. +*/ +#define jtd_set(x)\ +{\ + __asm__ __volatile__ (\ + "in __tmp_reg__,__SREG__" "\n\t"\ + "cli" "\n\t"\ + "out %1, %0" "\n\t"\ + "out __SREG__, __tmp_reg__" "\n\t"\ + "out %1, %0" "\n\t"\ + : /* no outputs */\ + : "r" ((uint8_t)(x ? (1<