NxWidgets server initialization must be performed in the kernel when NxWdigets is built in kernel mode
This commit is contained in:
parent
0a37711b40
commit
da660d1c6c
@ -411,3 +411,9 @@
|
||||
the one-time, start-up initialization logic (2013-10-30).
|
||||
|
||||
1.11 2014-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* NxWidgets/Kconfig and NxWidgets::CNxServer: Server initialization can
|
||||
now be disabled in the configuration (in fact, it is disabled by default).
|
||||
This is because in the kernel build mode, the NX server must be initialized
|
||||
in kernel mode by the RTOS before applications using the server run in
|
||||
user mode.
|
||||
|
31
Kconfig
31
Kconfig
@ -26,9 +26,17 @@ config NXWIDGETS_FLICKERFREE
|
||||
lower-performance flicker-reductions measures where-ever thay may
|
||||
be available.
|
||||
|
||||
config NXWIDGETS_EXTERNINIT
|
||||
bool "External display Initialization"
|
||||
default 0
|
||||
depends on NXWIDGET_SERVERINIT
|
||||
---help---
|
||||
Define to support external display initialization.
|
||||
|
||||
config NXWIDGETS_DEVNO
|
||||
int "LCD Device Number"
|
||||
default 0
|
||||
depends on NXWIDGETS_EXTERNINIT || NX_LCDDRIVER
|
||||
---help---
|
||||
LCD device number (in case there are more than one LCDs connected).
|
||||
Default: 0
|
||||
@ -39,6 +47,22 @@ config NXWIDGETS_VPLANE
|
||||
---help---
|
||||
Only a single video plane is supported. Default: 0
|
||||
|
||||
if NX_MULTIUSER
|
||||
|
||||
config NXWIDGET_SERVERINIT
|
||||
bool "Start server"
|
||||
default y
|
||||
depends on !NUTTX_KERNEL
|
||||
---help---
|
||||
If this option is selected, then the NxWidgets::CNxServer class will
|
||||
bring up the NX server when it is initialized. If this option is
|
||||
not selected then the NxWidgets::CNxServer constructor
|
||||
initialization logic will assume that the NX server has been started
|
||||
by other, external logic and will simply attempt to connect to the
|
||||
server.
|
||||
|
||||
if NXWIDGET_SERVERINIT
|
||||
|
||||
config NXWIDGETS_SERVERPRIO
|
||||
int "NX Server priority"
|
||||
default 110
|
||||
@ -57,6 +81,8 @@ config NXWIDGETS_SERVERSTACK
|
||||
---help---
|
||||
NX server thread stack size (in multi-user mode). Default 2048
|
||||
|
||||
endif # NXWIDGET_SERVERINIT
|
||||
|
||||
config NXWIDGETS_CLIENTPRIO
|
||||
int "NX Client Priority"
|
||||
default 100
|
||||
@ -78,10 +104,7 @@ config NXWIDGETS_LISTENERSTACK
|
||||
---help---
|
||||
NX listener thread stack size (in multi-user mode). Default 2048
|
||||
|
||||
config NXWIDGETS_EXTERNINIT
|
||||
bool "Extern LCD Initialization"
|
||||
---help---
|
||||
Define to support external display initialization.
|
||||
endif # NX_MULTIUSER
|
||||
|
||||
config NXWIDGET_EVENTWAIT
|
||||
bool "Event Waiting"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* NxWidgets/libnxwidgets/src/cnxserver.cxx
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -156,7 +156,8 @@ bool CNxServer::connect(void)
|
||||
// Turn the LCD on at 75% power
|
||||
|
||||
(void)m_hDevice->setpower(m_hDevice, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||
#else
|
||||
|
||||
#else // CONFIG_NX_LCDDRIVER
|
||||
int ret;
|
||||
|
||||
// Initialize the frame buffer device
|
||||
@ -175,7 +176,8 @@ bool CNxServer::connect(void)
|
||||
CONFIG_NXWIDGETS_VPLANE);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_NX_LCDDRIVER
|
||||
|
||||
// Then open NX
|
||||
|
||||
@ -188,7 +190,7 @@ bool CNxServer::connect(void)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_NX_MULTIUSER
|
||||
|
||||
/**
|
||||
* Connect to the NX Server -- Multi user version
|
||||
@ -212,6 +214,7 @@ bool CNxServer::connect(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NXWIDGET_SERVERINIT
|
||||
// Start the server task
|
||||
|
||||
gvdbg("CNxServer::connect: Starting server task\n");
|
||||
@ -227,6 +230,8 @@ bool CNxServer::connect(void)
|
||||
|
||||
usleep(50*1000);
|
||||
|
||||
#endif // CONFIG_NXWIDGET_SERVERINIT
|
||||
|
||||
// Connect to the server
|
||||
|
||||
m_hNxServer = nx_connect();
|
||||
@ -286,7 +291,7 @@ bool CNxServer::connect(void)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_NX_MULTIUSER
|
||||
|
||||
/**
|
||||
* Disconnect to the NX Server -- Single user version
|
||||
@ -303,7 +308,7 @@ void CNxServer::disconnect(void)
|
||||
m_hNxServer = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_NX_MULTIUSER
|
||||
|
||||
/**
|
||||
* Disconnect to the NX Server -- Single user version
|
||||
@ -336,14 +341,14 @@ void CNxServer::disconnect(void)
|
||||
m_hNxServer = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_NX_MULTIUSER
|
||||
|
||||
/**
|
||||
* NX server thread. This is the entry point into the server thread that
|
||||
* serializes the multi-threaded accesses to the display.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
#if defined(CONFIG_NX_MULTIUSER) && defined(CONFIG_NXWIDGET_SERVERINIT)
|
||||
int CNxServer::server(int argc, char *argv[])
|
||||
{
|
||||
FAR NX_DRIVERTYPE *dev;
|
||||
@ -381,7 +386,8 @@ int CNxServer::server(int argc, char *argv[])
|
||||
// Turn the LCD on at 75% power
|
||||
|
||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||
#else
|
||||
|
||||
#else // CONFIG_NX_LCDDRIVER
|
||||
// Initialize the frame buffer device
|
||||
|
||||
ret = up_fbinitialize();
|
||||
@ -397,7 +403,8 @@ int CNxServer::server(int argc, char *argv[])
|
||||
gdbg("up_fbgetvplane failed, vplane=%d\n", CONFIG_NXWIDGETS_VPLANE);
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_NX_LCDDRIVER
|
||||
|
||||
// Then start the server
|
||||
|
||||
@ -405,7 +412,7 @@ int CNxServer::server(int argc, char *argv[])
|
||||
gvdbg("nx_run returned: %d\n", errno);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_NX_MULTIUSER && CONFIG_NXWIDGET_SERVERINIT
|
||||
|
||||
/**
|
||||
* This is the entry point of a thread that listeners for and dispatches
|
||||
@ -458,4 +465,4 @@ FAR void *CNxServer::listener(FAR void *arg)
|
||||
sem_post(&This->m_connsem);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_NX_MULTIUSER
|
||||
|
Loading…
x
Reference in New Issue
Block a user