po_hi_common.h 4.92 KB
Newer Older
1
2
3
4
5
/*
 * This is a part of PolyORB-HI-C distribution, a minimal
 * middleware written for generated code from AADL models.
 * You should use it with the Ocarina toolsuite.
 *
yoogx's avatar
yoogx committed
6
 * For more informations, please visit http://taste.tuxfamily.org/wiki
7
 *
yoogx's avatar
yoogx committed
8
 * Copyright (C) 2007-2009 Telecom ParisTech, 2010-2014 ESA & ISAE.
9
10
11
12
13
14
15
 */

#ifndef __PO_HI_COMMON_H__
#define __PO_HI_COMMON_H__

#include <deployment.h>

jdelange's avatar
jdelange committed
16
17
18
19
20
21
22
23
#if (defined (RTEMS_POSIX) || defined (RTEMS_PURE))
   #if defined (__PO_HI_NEED_DRIVER_ETH_LEON) || \
       defined (__PO_HI_NEED_DRIVER_ETH_LEON_SENDER) || \
       defined (__PO_HI_NEED_DRIVER_ETH_LEON_RECEIVER)
   #define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111
   #endif
#endif

24
25
26
27
28
29
30
31
/*
 * Configure RTEMS executive.
 * We have to define the number of tasks inside the executive,
 * we deduce it from generated statements.
 */
#if defined(RTEMS_POSIX)
   #include <rtems.h>
   #include <inttypes.h>
jdelange's avatar
jdelange committed
32

33
   #define CONFIGURE_INIT
34
   #include <bsp.h>
35
36
   #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
37
   #define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
38
//   #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
jdelange's avatar
jdelange committed
39
   #define CONFIGURE_MAXIMUM_DRIVERS                     10
40
41
42
43
44
45
   #define CONFIGURE_MAXIMUM_POSIX_TIMERS                40
   #define CONFIGURE_MAXIMUM_TIMERS                      40
   #define CONFIGURE_EXECUTIVE_RAM_SIZE                  (512*1024)
   #define CONFIGURE_MAXIMUM_SEMAPHORES                  20
   #define CONFIGURE_MAXIMUM_TASKS                       __PO_HI_NB_TASKS + 2
   #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS      20
46

47
48
   #define CONFIGURE_SMP_APPLICATION

49
   int POSIX_Init ();
50
   #define CONFIGURE_MAXIMUM_POSIX_THREADS               __PO_HI_NB_TASKS + 10
jdelange's avatar
jdelange committed
51
52
/*   #define CONFIGURE_EXTRA_TASK_STACKS                   (20 * RTEMS_MINIMUM_STACK_SIZE)
 */
53
#ifdef __PO_HI_NB_PORTS
54
55
   #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              __PO_HI_NB_TASKS + 10 + __PO_HI_NB_PORTS
   #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES  __PO_HI_NB_TASKS + 10 + __PO_HI_NB_PORTS
56
#else
57
58
   #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              __PO_HI_NB_TASKS + 10 + __PO_HI_NB_PORTS
   #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES  __PO_HI_NB_TASKS + 10 + __PO_HI_NB_PORTS
59
#endif
60
   #define CONFIGURE_POSIX_INIT_THREAD_TABLE
61
   #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
62
   #include <rtems/confdefs.h>
63
64
#endif  /* RTEMS_POSIX */

65
#if defined(RTEMS_PURE)
jdelange's avatar
jdelange committed
66
67
   #include <rtems.h>
   #include <inttypes.h>
jdelange's avatar
jdelange committed
68
   #define CONFIGURE_INIT
jdelange's avatar
jdelange committed
69
70
   #include <bsp.h>

71
72
73
   #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
74
// #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
jdelange's avatar
jdelange committed
75
   #define CONFIGURE_MAXIMUM_DRIVERS                     10
76
   #define CONFIGURE_MAXIMUM_TIMERS                   40
jdelange's avatar
jdelange committed
77

78
#ifndef XM3_RTEMS_MODE
79
   #define CONFIGURE_EXECUTIVE_RAM_SIZE               (512*1024)
80
#endif
jdelange's avatar
jdelange committed
81
   /*
82
   #define CONFIGURE_MAXIMUM_SEMAPHORES               __PO_HI_NB_TASKS + (__PO_HI_NB_PORTS + 1) * 2 + __PO_HI_NB_PROTECTED + 1
jdelange's avatar
jdelange committed
83
84
   */
   #define CONFIGURE_MAXIMUM_SEMAPHORES               20
jdelange's avatar
jdelange committed
85
   #define CONFIGURE_MAXIMUM_TASKS                    __PO_HI_NB_TASKS + 5
86
   #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS   20
jdelange's avatar
jdelange committed
87
88
89
90
91
92
93
94
   #define CONFIGURE_MAXIMUM_PERIODS                  __PO_HI_NB_TASKS + 5
   /*
    * We put __PO_HI_NB_TASKS + 5 because we may have additional tasks
    * from the driver. Originally, it was +2 fr th emain thread and a potential
    * network thread. Since, other drivers take additional tasks and so, we
    * increase it to 5. We would do a better integration by filtering
    * the use of each driver.
    */
95

jdelange's avatar
jdelange committed
96
#ifndef RTEMS411
97
   rtems_task Init (rtems_task_argument no_argument);
jdelange's avatar
jdelange committed
98
99
#endif

jdelange's avatar
jdelange committed
100
/*
101
   #define CONFIGURE_EXTRA_TASK_STACKS                (20 * RTEMS_MINIMUM_STACK_SIZE)
jdelange's avatar
jdelange committed
102
*/
103
104
   #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
   #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
105
   #define CONFIGURE_MAXIMUM_BARRIERS                 1 + __PO_HI_NB_PORTS + 1
jdelange's avatar
jdelange committed
106
107

   #include <rtems/confdefs.h>
108
#endif  /* RTEMS_PURE */
109

110
#if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1
111
112
113
114
#include <rtems/rtems_bsdnet.h>
#include <bsp.h>
int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig*, int);

julien.delange's avatar
julien.delange committed
115
116
117
118
static struct rtems_bsdnet_ifconfig loopback_config =
   {"lo0", rtems_bsdnet_loopattach,	NULL, "127.0.0.1", "255.0.0.0", };
#undef RTEMS_BSP_NETWORK_DRIVER_NAME 
#undef RTEMS_BSP_NETWORK_DRIVER_ATTACH
119
120
121
#define RTEMS_BSP_NETWORK_DRIVER_NAME    "ne1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH  rtems_ne_driver_attach

julien.delange's avatar
julien.delange committed
122
123
124
125
126
struct rtems_bsdnet_ifconfig netdriver_config = 
   {RTEMS_BSP_NETWORK_DRIVER_NAME,RTEMS_BSP_NETWORK_DRIVER_ATTACH,
	&loopback_config,"192.168.0.1","255.255.255.0",
   (char[]){ 0x00, 0x1F, 0xC6, 0xBF, 0x74, 0x06},
	0,0,0,0,0,9};
127

julien.delange's avatar
julien.delange committed
128
129
struct rtems_bsdnet_config rtems_bsdnet_config = 
   {&netdriver_config,NULL,0,256 * 1024,256 * 1024,};
130

julien.delange's avatar
julien.delange committed
131
#endif /*(defined (X86_RTEMS) */
132
133

#endif /* __COMMON_H__ */