# HG changeset patch # User sergeig # Date 1332788748 0 # Node ID bc61a99a74fee833e3f1ac401dfa3e84361ab108 # Parent ccd24398a051f8bc99ce181e5c069b4ed1dbfab9 * examples/*: Removed an odd skeleton of PDcurses application. NOTE: PDCurses is not thread-safe. [ Bugilla 1001544 ] diff --git a/packages/services/curses/pdcurses/current/ChangeLog b/packages/services/curses/pdcurses/current/ChangeLog --- a/packages/services/curses/pdcurses/current/ChangeLog +++ b/packages/services/curses/pdcurses/current/ChangeLog @@ -1,3 +1,8 @@ +2012-03-26 Sergei Gavrikov + + * examples/*: Removed an odd skeleton of PDcurses application. + NOTE: PDCurses is not thread-safe. [ Bugilla 1001544 ] + 2012-03-24 Sergei Gavrikov * src/drivers/serial.c (PDC_check_key): Refactored to fix new compiler diff --git a/packages/services/curses/pdcurses/current/examples/Makefile b/packages/services/curses/pdcurses/current/examples/Makefile deleted file mode 100644 --- a/packages/services/curses/pdcurses/current/examples/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# Makefile for PDCurses eCos Application -# - -.PHONY: all clean - -# Platform specific setups -include Make.params - -# Simple build rules - -%.o: %.c - $(CC) -c $*.c $(ACTUAL_CFLAGS) -I$(PREFIX)/include -o $@ - -# PDCurses CFLAGS -ACTUAL_CFLAGS := $(subst , -D__ECOS__,$(ACTUAL_CFLAGS)) -ACTUAL_CFLAGS := $(subst , -D_LP64=0,$(ACTUAL_CFLAGS)) - -OBJS = pdcecos_app.o pdcecos_init.o pdcecos_thread.o -DST = pdcecos_app - -all: ${DST} - -clean: - -rm -f ${DST} ${OBJS} - -${DST}: ${OBJS} - $(CC) $(ACTUAL_LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $^ - diff --git a/packages/services/curses/pdcurses/current/examples/README b/packages/services/curses/pdcurses/current/examples/README deleted file mode 100644 --- a/packages/services/curses/pdcurses/current/examples/README +++ /dev/null @@ -1,65 +0,0 @@ -* PDCurses + eCos Application - --------------------------- - -It is possible to run a curses program in a separate eCos thread. Look -at the pdcecos_app.h, pdcecos_app.c, pdcecos_init.c, pdcecos_thread.c -sources for details. - -As you can see you should put own curses code inside a pdcecos_main() -function instead of traditional main() entry. In such a build you have -to link your executable with a pdcecos_app.o object file, and a curses -program must look as - - #include - ... - - int - pdcecos_main(int argc, char *argv[]) - { - initscr(); - ... - } - -The pdcecos_app.c has cyg_user_start() entry where a startup_thread() -creates and resumes itself there. The startup_tread() creates and -invokes a set of threads are defined in a __PDC_APP_TAB__. By default -only alone thread is registered in the table, it is pdcecos_thread(), -but you can expand the table. When the pdcecos_thread() is started, it -invokes the pdcecos_main() function -- your curses program. - -The "PDCECOS" thread uses a separate stack as well, you can change its -size by default is ( CYGNUM_HAL_STACK_SIZE_TYPICAL * 2 ). - -To build a PDCurses+eCos demo application, first generate a Make.params -file using the build_Make.params script which is placed under the eCos -`examples' directory and then just type 'make'. - -There is an example of running the pdcecos_app demo in GDB the below. As -you can see the "PDCECOS" thread starts and invokes pdcecos_main() then. - - (gdb) break pdcecos_main - Breakpoint 1 at 0x100111b: pdcecos_thread.c, line 93. - (gdb) continue - Starting program: pdcecos_app - SYSTEM INITIALIZATION in progress - data index = 4 - Creating system threads - Creating PDCECOS thread - Starting threads - Starting PDCECOS - SYSTEM THREADS STARTED! - - Breakpoint 1, pdcecos_main (argc=0, argv=0x0) - at pdcecos_thread.c:93 - 88 initscr(); - Current language: auto; currently c - (gdb) continue - -Then you should see a message - - Hello PDCurses+eCos World! - -in a terminal program (minicom, hyperterm, etc.). - - ------------------------------------------------------------------------- diff --git a/packages/services/curses/pdcurses/current/examples/pdcecos_app.c b/packages/services/curses/pdcurses/current/examples/pdcecos_app.c deleted file mode 100644 --- a/packages/services/curses/pdcurses/current/examples/pdcecos_app.c +++ /dev/null @@ -1,170 +0,0 @@ -// ========================================================================== -// -// pdcecos_app.c -// -// Public Domain Curses for eCos -// -// =========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -// =========================================================================== -// =========================================================================== -// #####DESCRIPTIONBEGIN#### -// -// Author(s): Sergei Gavrikov -// Contributors: Sergei Gavrikov -// Date: 2009-03-26 -// Purpose: Early startup for PDCurses stuff -// Description: -// -// ####DESCRIPTIONEND#### -// -// ========================================================================*/ - -// --------------------------------------------------------------------------- -// CONFIGURATION CHECKS -// - -#include // which packages are enabled/disabled -#ifdef CYGPKG_KERNEL -# include -#endif -#ifdef CYGPKG_LIBC -# include -#endif -#ifdef CYGPKG_IO_SERIAL -# include -#endif -#ifdef CYGPKG_FS_JFFS2 -# include -#define USE_JFFS2 -#endif - -#ifndef CYGFUN_KERNEL_API_C -# error Kernel API must be enabled to build this application -#endif - -#ifndef CYGPKG_LIBC_STDIO -# error C library standard I/O must be enabled to build this application -#endif - -#ifndef CYGPKG_IO_SERIAL_HALDIAG -# error I/O HALDIAG pseudo-device driver must be enabled to build this application -#endif - -#include - -// --------------------------------------------------------------------------- -// INCLUDES -// - -#include // printf -#include // printf - -#include // All the kernel specific stuff -#include // CYGNUM_HAL_STACK_SIZE_TYPICAL - -#include "pdcecos_app.h" - -// Define table boundaries -CYG_HAL_TABLE_BEGIN(__PDC_APP_TAB__, _pdc_apps); -CYG_HAL_TABLE_END(__PDC_APP_TAB_END__, _pdc_apps); -extern struct _pdc_app_entry __PDC_APP_TAB__[], - __PDC_APP_TAB_END__; - -// --------------------------------------------------------------------------- -// PDCurses startup thread. -// -static char startup_stack[STACKSIZE]; -cyg_handle_t startup_thread; -cyg_thread startup_thread_obj; - -static void -startup(CYG_ADDRESS data) -{ - cyg_ucount32 pdc_data_index; - struct _pdc_app_entry *pdc; - - printf("SYSTEM INITIALIZATION in progress\n"); - -#ifdef USE_JFFS2 - { - int res; - printf("... Mounting JFFS2 on \"/\"\n"); - res = mount(CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1, "/", "jffs2"); - if (res < 0) { - printf("Mount \"/\" failed - res: %d\n", res); - } - chdir("/"); - } -#endif - - pdc_data_index = cyg_thread_new_data_index(); - printf("data index = %d\n", pdc_data_index); - - printf("Creating system threads\n"); - for (pdc = __PDC_APP_TAB__; pdc != &__PDC_APP_TAB_END__; pdc++) { - printf("Creating %s thread\n", pdc->name); - cyg_thread_create(pdc->prio, - pdc->entry, - (cyg_addrword_t) pdc_data_index, - pdc->name, - (void *) pdc->stack, STACKSIZE, - &pdc->t, &pdc->t_obj); - } - printf("Starting threads\n"); - for (pdc = __PDC_APP_TAB__; pdc != &__PDC_APP_TAB_END__; pdc++) { - printf("Starting %s\n", pdc->name); - cyg_thread_resume(pdc->t); - if (pdc->init) { - (pdc->init) (pdc_data_index); - } - } - - printf("SYSTEM THREADS STARTED!\n"); -} - -void -cyg_user_start(void) -{ - // Create the initial thread and start it up - cyg_thread_create(PDC_ECOS_STARTUP_PRIORITY, - startup, - (cyg_addrword_t) 0, - "System startup", - (void *) startup_stack, STACKSIZE, - &startup_thread, &startup_thread_obj); - cyg_thread_resume(startup_thread); -} - -// --------------------------------------------------------------------------- -// EOF pdcecos_app.c diff --git a/packages/services/curses/pdcurses/current/examples/pdcecos_app.h b/packages/services/curses/pdcurses/current/examples/pdcecos_app.h deleted file mode 100644 --- a/packages/services/curses/pdcurses/current/examples/pdcecos_app.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef CYGONCE_PDCECOS_APP_H -#define CYGONCE_PDCECOS_APP_H -// ========================================================================== -// -// pdcecos_app.h -// -// Public Domain Curses for eCos -// -// =========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -// =========================================================================== -// =========================================================================== -// #####DESCRIPTIONBEGIN#### -// -// Author(s): Sergei Gavrikov -// Contributors: Sergei Gavrikov -// Date: 2009-03-26 -// Purpose: Definitions for PDCECOS thread -// Description: -// Usage: #include "pdcecos_app.h" -// -// ####DESCRIPTIONEND#### -// -// ========================================================================*/ - -#include -#include -#include -#include // CYGNUM_HAL_STACK_SIZE_TYPICAL - -#include - -#define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL * 2 ) - -typedef void fun(CYG_ADDRWORD); -struct _pdc_app_entry { - char *name; - fun *entry; - int prio; - fun *init; - cyg_handle_t t; - cyg_thread t_obj; - char stack[STACKSIZE]; -} CYG_HAL_TABLE_TYPE; - -#define _pdc_app(_name_,_id_,_pri_,_init_) \ -externC void _id_##_thread(CYG_ADDRWORD data); \ -struct _pdc_app_entry _pdc_app_##_pri_##_##_id_ \ - CYG_HAL_TABLE_QUALIFIED_ENTRY(_pdc_apps,_pri_) = \ - { _name_, _id_##_thread, _pri_, _init_}; - - -#define INIT_PER_THREAD_DATA() - -#define PDC_ECOS_STARTUP_PRIORITY 11 -#define PDC_ECOS_CORE_PRIORITY (PDC_ECOS_STARTUP_PRIORITY+3) - -int -pdcecos_main(int argc, char **argv) - CYGBLD_ATTRIB_WEAK; -#endif - -// --------------------------------------------------------------------- -// EOF pdcecos_app.h diff --git a/packages/services/curses/pdcurses/current/examples/pdcecos_init.c b/packages/services/curses/pdcurses/current/examples/pdcecos_init.c deleted file mode 100644 --- a/packages/services/curses/pdcurses/current/examples/pdcecos_init.c +++ /dev/null @@ -1,66 +0,0 @@ -// ========================================================================== -// -// pdcecos_init.c -// -// Public Domain Curses for eCos -// -// =========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -// =========================================================================== -// =========================================================================== -// #####DESCRIPTIONBEGIN#### -// -// Author(s): Sergei Gavrikov -// Contributors: Sergei Gavrikov -// Date: 2009-03-26 -// Purpose: -// Description: -// -// ####DESCRIPTIONEND#### -// -// ========================================================================*/ - -#include - -// --------------------------------------------------------------------------- -// pdcecos_init -- -// -void -pdcecos_init(CYG_ADDRWORD data) -{ - // Currently, it does nothing. - CYG_UNUSED_PARAM(CYG_ADDRWORD, data); -} - -// --------------------------------------------------------------------------- -// EOF pdcecos_init.c diff --git a/packages/services/curses/pdcurses/current/examples/pdcecos_thread.c b/packages/services/curses/pdcurses/current/examples/pdcecos_thread.c deleted file mode 100644 --- a/packages/services/curses/pdcurses/current/examples/pdcecos_thread.c +++ /dev/null @@ -1,129 +0,0 @@ -// ========================================================================== -// -// pdcecos_thread.c -// -// Public Domain Curses for eCos -// -// =========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -// =========================================================================== -// =========================================================================== -// #####DESCRIPTIONBEGIN#### -// -// Author(s): Sergei Gavrikov -// Contributors: Sergei Gavrikov -// Date: 2009-03-26 -// Purpose: Used to run PDCurses program as eCos thread. -// Description: -// -// ####DESCRIPTIONEND#### -// -// ========================================================================*/ - -#include // which packages are enabled/disabled -#ifdef CYGPKG_KERNEL -# include -#endif -#ifdef CYGPKG_LIBC -# include -#endif -#ifdef CYGPKG_IO_SERIAL -# include -#endif - -#ifndef CYGFUN_KERNEL_API_C -# error Kernel API must be enabled to build this application -#endif - -#ifndef CYGPKG_LIBC_STDIO -# error C library standard I/O must be enabled to build this application -#endif - -#ifndef CYGPKG_IO_SERIAL_HALDIAG -# error I/O HALDIAG pseudo-device driver must be enabled to build this application -#endif - -// -------------------------------------------------------------------------- -// INCLUDES -// - -#include // All the kernel specific stuff -#include - -#include -#include - -#include "pdcecos_app.h" - -extern void pdcecos_init(CYG_ADDRWORD data); -_pdc_app("PDCECOS", pdcecos, PDC_ECOS_CORE_PRIORITY, pdcecos_init); - -// -------------------------------------------------------------------------- -// Component interfaces -// - -// -------------------------------------------------------------------------- -// pdcecos_main -- -// -// Note: the pdcecos_main() is declared as a weaked function, Look at the -// "pdcecos_app.h". So, you can have own one in a user space. -int -pdcecos_main(int argc, char **argv) -{ - initscr(); - printw("Hello PDCurses+eCos World!"); - refresh(); - getch(); - endwin(); - - return 0; -} - -// -------------------------------------------------------------------------- -// pdcecos_thread -- -// -void -pdcecos_thread(CYG_ADDRWORD data) -{ - int argc = 0; - char **argv = NULL; - - CYG_UNUSED_PARAM(CYG_ADDRWORD, data); - - INIT_PER_THREAD_DATA(); - - pdcecos_main(argc, argv); -} - -// --------------------------------------------------------------------------- -// EOF pdcecos_thread.c