simulation: Add a simulatied UART input device. Also lots of misc clean-up for stylistic compatibility with other architectures
This commit is contained in:
parent
48f29ce348
commit
18ed0123a6
@ -44,9 +44,9 @@ CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_initialstate.c
|
||||
CSRCS += up_createstack.c up_usestack.c up_releasestack.c up_stackframe.c
|
||||
CSRCS += up_unblocktask.c up_blocktask.c up_releasepending.c
|
||||
CSRCS += up_reprioritizertr.c up_exit.c up_schedulesigaction.c up_spiflash.c
|
||||
CSRCS += up_allocateheap.c up_devconsole.c
|
||||
CSRCS += up_allocateheap.c up_devconsole.c up_uartwait.c
|
||||
|
||||
HOSTSRCS = up_stdio.c up_hostusleep.c
|
||||
HOSTSRCS = up_stdio.c up_hostusleep.c up_simuart.c
|
||||
|
||||
ifeq ($(CONFIG_SCHED_TICKLESS),y)
|
||||
CSRCS += up_tickless.c
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**************************************************************************
|
||||
* up_internal.h
|
||||
* sim.h
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -33,8 +33,8 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __ARCH_UP_INTERNAL_H
|
||||
#define __ARCH_UP_INTERNAL_H
|
||||
#ifndef __ARCH_SIM_SRC_SIM_H
|
||||
#define __ARCH_SIM_SRC_SIM_H
|
||||
|
||||
/**************************************************************************
|
||||
* Included Files
|
||||
@ -77,6 +77,12 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Simulated console UART input buffer size */
|
||||
|
||||
#ifndef CONFIG_SIM_UART_BUFSIZE
|
||||
# define CONFIG_SIM_UART_BUFSIZE 256
|
||||
#endif
|
||||
|
||||
/* Determine which device to use as the system logging device */
|
||||
|
||||
#ifndef CONFIG_SYSLOG
|
||||
@ -144,6 +150,12 @@ extern volatile int g_eventloop;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* up_simuart.c ***********************************************************/
|
||||
|
||||
extern char g_uartbuffer[CONFIG_SIM_UART_BUFSIZE];
|
||||
extern volatile int g_uarthead;
|
||||
extern volatile int g_uarttail;
|
||||
|
||||
/**************************************************************************
|
||||
* Public Function Prototypes
|
||||
**************************************************************************/
|
||||
@ -164,6 +176,16 @@ void up_timer_update(void);
|
||||
void up_devconsole(void);
|
||||
void up_registerblockdevice(void);
|
||||
|
||||
/* up_simuart.c ***********************************************************/
|
||||
|
||||
void *up_simuart(void *arg);
|
||||
|
||||
/* up_uartwait.c **********************************************************/
|
||||
|
||||
void uart_wait_initialize(void);
|
||||
void up_simuart_post(void);
|
||||
void up_simuart_wait(void);
|
||||
|
||||
/* up_deviceimage.c *******************************************************/
|
||||
|
||||
char *up_deviceimage(void);
|
||||
@ -241,4 +263,4 @@ struct spi_dev_s *up_spiflashinitialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_UP_INTERNAL_H */
|
||||
#endif /* __ARCH_SIM_SRC_SIM_H */
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_allocateheap.c
|
||||
* arch/sim/src/up_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -46,10 +46,10 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_blockdevice.c
|
||||
* arch/sim/src/up_blockdevice.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -46,10 +46,10 @@
|
||||
|
||||
#include <nuttx/fs/ramdisk.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define NSECTORS 2048
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_blocktask.c
|
||||
* arch/sim/src/up_blocktask.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -46,10 +46,10 @@
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -45,10 +45,10 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -44,10 +44,10 @@
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_deviceimage.c
|
||||
* arch/sim/src/up_deviceimage.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -50,11 +50,11 @@
|
||||
|
||||
# include <nuttx/kmalloc.h>
|
||||
|
||||
# include "up_internal.h"
|
||||
# include "sim.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef VFAT_STANDALONE
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_exit.c
|
||||
* arch/sim/src/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -46,10 +46,10 @@
|
||||
|
||||
#include "task/task.h"
|
||||
#include "sched/sched.h"
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -45,10 +45,10 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/video/fb.h>
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_SIM_FBWIDTH
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_head.c
|
||||
* arch/sim/src/up_head.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2113 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -44,10 +44,10 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/power/pm.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_initialize.c
|
||||
* arch/sim/src/up_initialize.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -47,10 +47,10 @@
|
||||
#include <nuttx/mtd/mtd.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_initialstate.c
|
||||
* arch/sim/src/up_initialstate.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -44,10 +44,10 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_interruptcontext.c
|
||||
* arch/sim/src/up_interruptcontext.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -41,10 +41,10 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <sys/time.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NULL
|
||||
|
@ -56,10 +56,10 @@
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/arp.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define BUF ((struct ether_header*)g_sim_dev.d_buf)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_releasepending.c
|
||||
* arch/sim/src/up_releasepending.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -44,10 +44,10 @@
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_releasestack.c
|
||||
* arch/sim/src/up_releasestack.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -44,10 +44,10 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_reprioritizertr.c
|
||||
* arch/sim/src/up_reprioritizertr.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -47,10 +47,10 @@
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -44,7 +44,7 @@
|
||||
#ifdef CONFIG_ARCH_ROMGETC
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_schedulesigaction.c
|
||||
* arch/sim/src/up_schedulesigaction.c
|
||||
*
|
||||
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -45,10 +45,10 @@
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**************************************************************************
|
||||
* up_setjmp.S
|
||||
* arch/sim/src/up_setjmp.S
|
||||
*
|
||||
* Copyright (C) 2007, 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -37,10 +37,10 @@
|
||||
* Included Files
|
||||
**************************************************************************/
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/**************************************************************************
|
||||
* Pr-processor Definitions
|
||||
* Pre-processor Definitions
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
|
153
arch/sim/src/up_simuart.c
Normal file
153
arch/sim/src/up_simuart.c
Normal file
@ -0,0 +1,153 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_hostusleep.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
char g_uartbuffer[CONFIG_SIM_UART_BUFSIZE];
|
||||
volatile int g_uarthead;
|
||||
volatile int g_uarttail;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: setrawmode
|
||||
****************************************************************************/
|
||||
|
||||
static void setrawmode(void)
|
||||
{
|
||||
struct termios term;
|
||||
|
||||
(void)tcgetattr(0, &term);
|
||||
|
||||
term.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
|
||||
term.c_oflag &= ~OPOST;
|
||||
term.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
|
||||
term.c_cflag &= ~(CSIZE | PARENB);
|
||||
term.c_cflag |= CS8;
|
||||
|
||||
(void)tcsetattr(0, TCSANOW, &term);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_simuart
|
||||
****************************************************************************/
|
||||
|
||||
void *up_simuart(void *arg)
|
||||
{
|
||||
unsigned char ch;
|
||||
ssize_t nread;
|
||||
|
||||
/* This thread runs in the host domain */
|
||||
/* Initialize the NuttX domain semaphore */
|
||||
|
||||
uart_wait_initialize();
|
||||
|
||||
/* Put stdin into raw mode */
|
||||
|
||||
setrawmode();
|
||||
|
||||
/* Now loop, collecting a buffering data from stdin forever */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Read one character from stdin */
|
||||
|
||||
nread = read(0, ch, 1);
|
||||
|
||||
/* Check for failures (but don't do anything) */
|
||||
|
||||
if (nread == 1)
|
||||
{
|
||||
/* Get the index to the next slot in the UART buffer */
|
||||
|
||||
int next = g_uarthead + 1;
|
||||
if (next >= CONFIG_SIM_UART_BUFSIZE)
|
||||
{
|
||||
next = 0;
|
||||
}
|
||||
|
||||
/* Would adding this character cause an overflow? */
|
||||
|
||||
if (next != g_uarttail)
|
||||
{
|
||||
/* No.. Add the character to the UART buffer */
|
||||
|
||||
g_uartbuffer[g_uarthead] = ch;
|
||||
|
||||
/* Was the buffer previously empty? */
|
||||
|
||||
if (g_uarthead == g_uarttail)
|
||||
{
|
||||
/* Yes.. signal any (NuttX) threads waiting for serial
|
||||
* input.
|
||||
*/
|
||||
|
||||
up_simuart_post();
|
||||
}
|
||||
|
||||
/* Update the head index */
|
||||
|
||||
g_uarthead = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@ -50,12 +50,12 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
#if defined(CONFIG_SIM_SPIFLASH)
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* Configuration ********************************************************************/
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Macros
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_stdio.c
|
||||
* arch/sim/src/up_stdio.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -40,7 +40,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_tapdev.c
|
||||
* arch/sim/src/up_tapdev.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -65,7 +65,7 @@ extern int syslog(const char *format, ...);
|
||||
extern int netdriver_setmacaddr(unsigned char *macaddr);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define TAPDEV_DEBUG 1
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
94
arch/sim/src/up_uartwait.c
Normal file
94
arch/sim/src/up_uartwait.c
Normal file
@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_uartwait.c
|
||||
*
|
||||
* Copyright (C) 20014Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <semaphore.h>
|
||||
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static sem_t g_uartavail;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: uart_wait_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void uart_wait_initialize(void)
|
||||
{
|
||||
sem_init(&g_uartavail, 0, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_simuart_post
|
||||
****************************************************************************/
|
||||
|
||||
void up_simuart_post(void)
|
||||
{
|
||||
sem_post(&g_uartavail);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_simuart_wait
|
||||
****************************************************************************/
|
||||
|
||||
void up_simuart_wait(void)
|
||||
{
|
||||
while (g_uarthead == g_uarttail)
|
||||
{
|
||||
(void)sem_wait(&g_uartavail);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_unblocktask.c
|
||||
* arch/sim/src/up_unblocktask.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -45,10 +45,10 @@
|
||||
|
||||
#include "clock/clock.h"
|
||||
#include "sched/sched.h"
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -41,10 +41,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
#include "sim.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* up_wcap.c
|
||||
* arch/sim/src/up_wcap.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -52,7 +52,7 @@
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user