arch/sim/src/: Simulator restore the console even error handler call host exit directly.
This commit is contained in:
parent
6c362c8521
commit
3a5e2b7ce7
@ -40,16 +40,13 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <nuttx/init.h>
|
#include <nuttx/init.h>
|
||||||
#include <nuttx/arch.h>
|
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
#include <nuttx/power/pm.h>
|
|
||||||
#include <nuttx/syslog/syslog_rpmsg.h>
|
#include <nuttx/syslog/syslog_rpmsg.h>
|
||||||
|
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
@ -104,12 +101,6 @@ int main(int argc, char **argv, char **envp)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_DEVCONSOLE
|
|
||||||
/* Restore the original terminal mode and return the exit code */
|
|
||||||
|
|
||||||
simuart_terminate();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return g_exitcode;
|
return g_exitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,6 @@ void simuart_start(void);
|
|||||||
int simuart_putc(int ch);
|
int simuart_putc(int ch);
|
||||||
int simuart_getc(bool block);
|
int simuart_getc(bool block);
|
||||||
bool simuart_checkc(void);
|
bool simuart_checkc(void);
|
||||||
void simuart_terminate(void);
|
|
||||||
|
|
||||||
/* up_uartwait.c **********************************************************/
|
/* up_uartwait.c **********************************************************/
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -113,6 +114,17 @@ static void setrawmode(void)
|
|||||||
(void)tcsetattr(0, TCSANOW, &raw);
|
(void)tcsetattr(0, TCSANOW, &raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: restoremode
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void restoremode(void)
|
||||||
|
{
|
||||||
|
/* Restore the original terminal mode */
|
||||||
|
|
||||||
|
(void)tcsetattr(0, TCSANOW, &g_cooked);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: simuart_thread
|
* Name: simuart_thread
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -212,6 +224,10 @@ void simuart_start(void)
|
|||||||
|
|
||||||
setrawmode();
|
setrawmode();
|
||||||
|
|
||||||
|
/* Restore the original terminal mode before exit */
|
||||||
|
|
||||||
|
atexit(restoremode);
|
||||||
|
|
||||||
/* Start the simulated UART thread -- all default settings; no error
|
/* Start the simulated UART thread -- all default settings; no error
|
||||||
* checking.
|
* checking.
|
||||||
*/
|
*/
|
||||||
@ -298,13 +314,3 @@ bool simuart_checkc(void)
|
|||||||
return g_uarthead != g_uarttail;
|
return g_uarthead != g_uarttail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: simuart_terminate
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void simuart_terminate(void)
|
|
||||||
{
|
|
||||||
/* Restore the original terminal mode */
|
|
||||||
|
|
||||||
(void)tcsetattr(0, TCSANOW, &g_cooked);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user