po_hi_common.h 7.06 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
   #define CONFIGURE_MAXIMUM_SEMAPHORES 20 // GRSPW1 IRQ layer needs one semaphore
   #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 20
53
54
   #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
   #define CONFIGURE_MAXIMUM_DRIVERS 32
55
   #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
78
79
80
81
82
83

#ifdef __PO_HI_NEED_DRIVER_ETH_LEON
   #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH   /* GRETH Driver enabled*/
#endif

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

yoogx's avatar
yoogx committed
84
85
86
87
88
89
90
91
92
93
94
95
96
/* 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

97
98
 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_SPW_ROUTER /* SpaceWire Router  */
 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW2     /* SpaceWire Packet driver */
99

100
101
102
103
104
 #ifdef __PO_HI_NEED_DRIVER_GRETH
  #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH      /* GRETH Driver enabled*/
  #define CONFIGURE_DRIVER_PCI_GR_LEON4_N2X          /* GR-CPCI-LEON4-N2X has two GRETH network MACs */
  #define ENABLE_NETWORK
 #endif
105

106
107
108
#endif /* defined(RTEMS_DRVMGR_STARTUP) && defined(LEON3) */

void *POSIX_Init (void);
yoogx's avatar
yoogx committed
109

110
#endif  /*GRLEON3 && RTEMS412*/
yoogx's avatar
yoogx committed
111
112

#include <rtems/confdefs.h>
113
114

#if defined(RTEMS_DRVMGR_STARTUP) && defined(LEON3)
yoogx's avatar
yoogx committed
115
116
#include <drvmgr/drvmgr_confdefs.h>

117
118
119
120
/* config.c is directly provided by RCC1.3 and initialized drivers per
 * drvmgr convention for RASTA (LEON3), N2X and GR740 boards
 */

121
#include "../src/config.c"
122
#endif /* defined(RTEMS_DRVMGR_STARTUP) && defined(LEON3) */
123

124
125
#endif  /* RTEMS_POSIX */

126
/******************************************************************************/
127
#if defined(__PO_HI_RTEMS_CLASSIC_API)
jdelange's avatar
jdelange committed
128
129
   #include <rtems.h>
   #include <inttypes.h>
jdelange's avatar
jdelange committed
130
   #define CONFIGURE_INIT
yoogx's avatar
yoogx committed
131
132
133
134
135
   #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
136
137
   #include <bsp.h>

138
139
140
   #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
   #define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
141
// #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
jdelange's avatar
jdelange committed
142
   #define CONFIGURE_MAXIMUM_DRIVERS                     10
143
   #define CONFIGURE_MAXIMUM_TIMERS                   40
jdelange's avatar
jdelange committed
144

145
#ifndef XM3_RTEMS_MODE
yoogx's avatar
yoogx committed
146
   #define CONFIGURE_EXECUTIVE_RAM_SIZE               (512*1024) //either RAM SIZE or Stack_extras Macro should be present Rtems4.12
147
#endif
jdelange's avatar
jdelange committed
148
   /*
149
   #define CONFIGURE_MAXIMUM_SEMAPHORES               __PO_HI_NB_TASKS + (__PO_HI_NB_PORTS + 1) * 2 + __PO_HI_NB_PROTECTED + 1
jdelange's avatar
jdelange committed
150
151
   */
   #define CONFIGURE_MAXIMUM_SEMAPHORES               20
jdelange's avatar
jdelange committed
152
   #define CONFIGURE_MAXIMUM_TASKS                    __PO_HI_NB_TASKS + 5
153
   #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS   20
jdelange's avatar
jdelange committed
154
155
156
   #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
157
158
159
160
    * 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
161
    */
162

jdelange's avatar
jdelange committed
163
#ifndef RTEMS411
164
   rtems_task Init (rtems_task_argument no_argument);
jdelange's avatar
jdelange committed
165
#endif
yoogx's avatar
yoogx committed
166
   #define CONFIGURE_STACK_CHECKER_ENABLED
167
168
   #define CONFIGURE_EXTRA_TASK_STACKS                __PO_HI_TASKS_STACK

169
170
   #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
   #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
171
   #define CONFIGURE_MAXIMUM_BARRIERS                 1 + __PO_HI_NB_PORTS + 1
jdelange's avatar
jdelange committed
172
173

   #include <rtems/confdefs.h>
174
#endif  /* __PO_HI_RTEMS_CLASSIC_API */
175

176
#if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1
177
178
#include <rtems/rtems_bsdnet.h>
#include <bsp.h>
yoogx's avatar
yoogx committed
179

yoogx's avatar
yoogx committed
180
181

/*
182
183
int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig*, int);

julien.delange's avatar
julien.delange committed
184
185
static struct rtems_bsdnet_ifconfig loopback_config =
   {"lo0", rtems_bsdnet_loopattach,	NULL, "127.0.0.1", "255.0.0.0", };
186
#undef RTEMS_BSP_NETWORK_DRIVER_NAME
julien.delange's avatar
julien.delange committed
187
#undef RTEMS_BSP_NETWORK_DRIVER_ATTACH
188
189
190
#define RTEMS_BSP_NETWORK_DRIVER_NAME    "ne1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH  rtems_ne_driver_attach

191
struct rtems_bsdnet_ifconfig netdriver_config =
julien.delange's avatar
julien.delange committed
192
   {RTEMS_BSP_NETWORK_DRIVER_NAME,RTEMS_BSP_NETWORK_DRIVER_ATTACH,
yoogx's avatar
yoogx committed
193
        &loopback_config,"192.168.0.1","255.255.255.0",
julien.delange's avatar
julien.delange committed
194
   (char[]){ 0x00, 0x1F, 0xC6, 0xBF, 0x74, 0x06},
yoogx's avatar
yoogx committed
195
        0,0,0,0,0,9};
196

197
struct rtems_bsdnet_config rtems_bsdnet_config =
julien.delange's avatar
julien.delange committed
198
   {&netdriver_config,NULL,0,256 * 1024,256 * 1024,};
yoogx's avatar
yoogx committed
199
200
*/

201

julien.delange's avatar
julien.delange committed
202
#endif /*(defined (X86_RTEMS) */
203
204

#endif /* __COMMON_H__ */