po_hi_common.h 6.77 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-2018 ESA & ISAE.
9
10
11
12
13
14
 */

#ifndef __PO_HI_COMMON_H__
#define __PO_HI_COMMON_H__

#include <deployment.h>
yoogx's avatar
yoogx committed
15
16
/* deployment.h sets macro on required drivers, this file is generated
   by Ocarina */
17

18
#if (defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API))
jdelange's avatar
jdelange committed
19
20
21
22
23
24
25
   #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

26
27
28
/******************************************************************************/
/* Configure RTEMS/POSIX executive. */

29
#if defined(RTEMS_POSIX)
30

31
32
   #include <rtems.h>
   #include <inttypes.h>
jdelange's avatar
jdelange committed
33

yoogx's avatar
yoogx committed
34
35
36
37
38
39
#if defined GRLEON3 && defined RTEMS412
   #include <drvmgr/drvmgr.h>
   #include <amba.h>
   #include <bsp/grspw.h>
   #include <drvmgr/ambapp_bus.h>
#endif
yoogx's avatar
yoogx committed
40

41
42
   #define CONFIGURE_INIT

43
   #include <bsp.h>
44

45
46
   #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
47

48
   #define CONFIGURE_MAXIMUM_TASKS 20
49
   #define CONFIGURE_MAXIMUM_POSIX_THREADS               __PO_HI_NB_TASKS + 10
yoogx's avatar
yoogx committed
50

51
52
53
54
55
   #define CONFIGURE_MAXIMUM_SEMAPHORES    20 // IRQ layer needs one semaphore
   #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES    20
   #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
   #define CONFIGURE_MAXIMUM_DRIVERS 32
   #define CONFIGURE_MAXIMUM_PERIODS             1
56

57
   #define CONFIGURE_POSIX_INIT_THREAD_TABLE
yoogx's avatar
yoogx committed
58

59
60
61
   #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT
   #define CONFIGURE_EXTRA_TASK_STACKS         (40 * RTEMS_MINIMUM_STACK_SIZE)
   #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (40 * RTEMS_MINIMUM_STACK_SIZE)
yoogx's avatar
yoogx committed
62

63
   #define CONFIGURE_MICROSECONDS_PER_TICK     RTEMS_MILLISECONDS_TO_MICROSECONDS(2)
64

yoogx's avatar
yoogx committed
65
/*****************************************************************************/
66
/* Driver Manager configuration for RTEMS 5                                  */
yoogx's avatar
yoogx committed
67
68
69
70
71
72
73
74

/* Important note: some RTEMS CONFIGURE macros above must be completed
 * with specific driver configuration, otherwise some features will
 * not work, e.g. CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER requires
 * CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
 */

#if defined GRLEON3 && defined RTEMS412
yoogx's avatar
yoogx committed
75
76
77

#ifdef __PO_HI_NEED_DRIVER_ETH_LEON
   #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH   /* GRETH Driver enabled*/
78
79
80
#else
   #undef ENABLE_NETWORK
   #undef ENABLE_NETWORK_SMC_LEON3
yoogx's avatar
yoogx committed
81
82
83
84
85
86
#endif

#ifdef __PO_HI_NEED_DRIVER_SPACEWIRE_RASTA
   #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW   /* GRSPW Driver enabled*/
#endif

yoogx's avatar
yoogx committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* Configure Driver manager */
#if defined(RTEMS_DRVMGR_STARTUP) && defined(LEON3)
/* if --drvmgr was given to RTEMS configure */

 /* Clock driver */
 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
  #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
 #endif

 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
  #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
 #endif
#endif

101
102
103
104
void *POSIX_Init (void);

#define CONFIGURE_DRIVER_AMBAPP_GAISLER_SPW_ROUTER /* SpaceWire Router  */
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW2     /* SpaceWire Packet driver */
yoogx's avatar
yoogx committed
105

106
#endif  /*GRLEON3 && RTEMS412*/
yoogx's avatar
yoogx committed
107
108
109
110

#include <rtems/confdefs.h>
#include <drvmgr/drvmgr_confdefs.h>

111
112
113
114
115
116
117
118
/* config.c is directly provided by RCC1.3 and initialized drivers per
 * drvmgr convention for RASTA (LEON3), N2X and GR740 boards
 */
#undef ENABLE_NETWORK
#undef ENABLE_NETWORK_SMC_LEON3

#include "config.c"

119
120
#endif  /* RTEMS_POSIX */

121
/******************************************************************************/
122
#if defined(__PO_HI_RTEMS_CLASSIC_API)
jdelange's avatar
jdelange committed
123
124
   #include <rtems.h>
   #include <inttypes.h>
jdelange's avatar
jdelange committed
125
   #define CONFIGURE_INIT
yoogx's avatar
yoogx committed
126
127
128
129
130
   #define CONFIGURE_INIT_TASK_STACK_SIZE 2*RTEMS_MINIMUM_STACK_SIZE
   #define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
                                              RTEMS_NO_TIMESLICE | \
                                              RTEMS_NO_ASR | \
                                              RTEMS_INTERRUPT_LEVEL(0))
jdelange's avatar
jdelange committed
131
132
   #include <bsp.h>

133
134
135
   #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
136
// #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
jdelange's avatar
jdelange committed
137
   #define CONFIGURE_MAXIMUM_DRIVERS                     10
138
   #define CONFIGURE_MAXIMUM_TIMERS                   40
jdelange's avatar
jdelange committed
139

140
#ifndef XM3_RTEMS_MODE
yoogx's avatar
yoogx committed
141
   #define CONFIGURE_EXECUTIVE_RAM_SIZE               (512*1024) //either RAM SIZE or Stack_extras Macro should be present Rtems4.12
142
#endif
jdelange's avatar
jdelange committed
143
   /*
144
   #define CONFIGURE_MAXIMUM_SEMAPHORES               __PO_HI_NB_TASKS + (__PO_HI_NB_PORTS + 1) * 2 + __PO_HI_NB_PROTECTED + 1
jdelange's avatar
jdelange committed
145
146
   */
   #define CONFIGURE_MAXIMUM_SEMAPHORES               20
jdelange's avatar
jdelange committed
147
   #define CONFIGURE_MAXIMUM_TASKS                    __PO_HI_NB_TASKS + 5
148
   #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS   20
jdelange's avatar
jdelange committed
149
150
151
   #define CONFIGURE_MAXIMUM_PERIODS                  __PO_HI_NB_TASKS + 5
   /*
    * We put __PO_HI_NB_TASKS + 5 because we may have additional tasks
yoogx's avatar
yoogx committed
152
153
154
155
    * from the driver. Originally, it was +2 for the main 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.
jdelange's avatar
jdelange committed
156
    */
157

jdelange's avatar
jdelange committed
158
#ifndef RTEMS411
159
   rtems_task Init (rtems_task_argument no_argument);
jdelange's avatar
jdelange committed
160
#endif
yoogx's avatar
yoogx committed
161
   #define CONFIGURE_STACK_CHECKER_ENABLED
162
163
   #define CONFIGURE_EXTRA_TASK_STACKS                __PO_HI_TASKS_STACK

164
165
   #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
   #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
166
   #define CONFIGURE_MAXIMUM_BARRIERS                 1 + __PO_HI_NB_PORTS + 1
jdelange's avatar
jdelange committed
167
168

   #include <rtems/confdefs.h>
169
#endif  /* __PO_HI_RTEMS_CLASSIC_API */
170

171
#if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1
172
173
#include <rtems/rtems_bsdnet.h>
#include <bsp.h>
yoogx's avatar
yoogx committed
174

yoogx's avatar
yoogx committed
175
176

/*
177
178
int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig*, int);

julien.delange's avatar
julien.delange committed
179
180
static struct rtems_bsdnet_ifconfig loopback_config =
   {"lo0", rtems_bsdnet_loopattach,	NULL, "127.0.0.1", "255.0.0.0", };
181
#undef RTEMS_BSP_NETWORK_DRIVER_NAME
julien.delange's avatar
julien.delange committed
182
#undef RTEMS_BSP_NETWORK_DRIVER_ATTACH
183
184
185
#define RTEMS_BSP_NETWORK_DRIVER_NAME    "ne1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH  rtems_ne_driver_attach

186
struct rtems_bsdnet_ifconfig netdriver_config =
julien.delange's avatar
julien.delange committed
187
   {RTEMS_BSP_NETWORK_DRIVER_NAME,RTEMS_BSP_NETWORK_DRIVER_ATTACH,
yoogx's avatar
yoogx committed
188
        &loopback_config,"192.168.0.1","255.255.255.0",
julien.delange's avatar
julien.delange committed
189
   (char[]){ 0x00, 0x1F, 0xC6, 0xBF, 0x74, 0x06},
yoogx's avatar
yoogx committed
190
        0,0,0,0,0,9};
191

192
struct rtems_bsdnet_config rtems_bsdnet_config =
julien.delange's avatar
julien.delange committed
193
   {&netdriver_config,NULL,0,256 * 1024,256 * 1024,};
yoogx's avatar
yoogx committed
194
195
*/

196

julien.delange's avatar
julien.delange committed
197
#endif /*(defined (X86_RTEMS) */
198
199

#endif /* __COMMON_H__ */