1 |
786 |
skrzyp |
// ==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// pdcecos_thread.c
|
4 |
|
|
//
|
5 |
|
|
// Public Domain Curses for eCos
|
6 |
|
|
//
|
7 |
|
|
// ===========================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 2009 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
// ===========================================================================
|
40 |
|
|
// ===========================================================================
|
41 |
|
|
// #####DESCRIPTIONBEGIN####
|
42 |
|
|
//
|
43 |
|
|
// Author(s): Sergei Gavrikov
|
44 |
|
|
// Contributors: Sergei Gavrikov
|
45 |
|
|
// Date: 2009-03-26
|
46 |
|
|
// Purpose: Used to run PDCurses program as eCos thread.
|
47 |
|
|
// Description:
|
48 |
|
|
//
|
49 |
|
|
// ####DESCRIPTIONEND####
|
50 |
|
|
//
|
51 |
|
|
// ========================================================================*/
|
52 |
|
|
|
53 |
|
|
#include <pkgconf/system.h> // which packages are enabled/disabled
|
54 |
|
|
#ifdef CYGPKG_KERNEL
|
55 |
|
|
# include <pkgconf/kernel.h>
|
56 |
|
|
#endif
|
57 |
|
|
#ifdef CYGPKG_LIBC
|
58 |
|
|
# include <pkgconf/libc.h>
|
59 |
|
|
#endif
|
60 |
|
|
#ifdef CYGPKG_IO_SERIAL
|
61 |
|
|
# include <pkgconf/io_serial.h>
|
62 |
|
|
#endif
|
63 |
|
|
|
64 |
|
|
#ifndef CYGFUN_KERNEL_API_C
|
65 |
|
|
# error Kernel API must be enabled to build this application
|
66 |
|
|
#endif
|
67 |
|
|
|
68 |
|
|
#ifndef CYGPKG_LIBC_STDIO
|
69 |
|
|
# error C library standard I/O must be enabled to build this application
|
70 |
|
|
#endif
|
71 |
|
|
|
72 |
|
|
#ifndef CYGPKG_IO_SERIAL_HALDIAG
|
73 |
|
|
# error I/O HALDIAG pseudo-device driver must be enabled to build this application
|
74 |
|
|
#endif
|
75 |
|
|
|
76 |
|
|
// --------------------------------------------------------------------------
|
77 |
|
|
// INCLUDES
|
78 |
|
|
//
|
79 |
|
|
|
80 |
|
|
#include <cyg/kernel/kapi.h> // All the kernel specific stuff
|
81 |
|
|
#include <cyg/infra/diag.h>
|
82 |
|
|
|
83 |
|
|
#include <pkgconf/pdcurses.h>
|
84 |
|
|
#include <curses.h>
|
85 |
|
|
|
86 |
|
|
#include "pdcecos_app.h"
|
87 |
|
|
|
88 |
|
|
extern void pdcecos_init(CYG_ADDRWORD data);
|
89 |
|
|
_pdc_app("PDCECOS", pdcecos, PDC_ECOS_CORE_PRIORITY, pdcecos_init);
|
90 |
|
|
|
91 |
|
|
// --------------------------------------------------------------------------
|
92 |
|
|
// Component interfaces
|
93 |
|
|
//
|
94 |
|
|
|
95 |
|
|
// --------------------------------------------------------------------------
|
96 |
|
|
// pdcecos_main --
|
97 |
|
|
//
|
98 |
|
|
// Note: the pdcecos_main() is declared as a weaked function, Look at the
|
99 |
|
|
// "pdcecos_app.h". So, you can have own one in a user space.
|
100 |
|
|
int
|
101 |
|
|
pdcecos_main(int argc, char **argv)
|
102 |
|
|
{
|
103 |
|
|
initscr();
|
104 |
|
|
printw("Hello PDCurses+eCos World!");
|
105 |
|
|
refresh();
|
106 |
|
|
getch();
|
107 |
|
|
endwin();
|
108 |
|
|
|
109 |
|
|
return 0;
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
// --------------------------------------------------------------------------
|
113 |
|
|
// pdcecos_thread --
|
114 |
|
|
//
|
115 |
|
|
void
|
116 |
|
|
pdcecos_thread(CYG_ADDRWORD data)
|
117 |
|
|
{
|
118 |
|
|
int argc = 0;
|
119 |
|
|
char **argv = NULL;
|
120 |
|
|
|
121 |
|
|
CYG_UNUSED_PARAM(CYG_ADDRWORD, data);
|
122 |
|
|
|
123 |
|
|
INIT_PER_THREAD_DATA();
|
124 |
|
|
|
125 |
|
|
pdcecos_main(argc, argv);
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
// ---------------------------------------------------------------------------
|
129 |
|
|
// EOF pdcecos_thread.c
|