config_leon3_drvmgr.c 3.65 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/*
 * 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.
 *
 * For more informations, please visit http://taste.tuxfamily.org/wiki
 *
 * Copyright (C) 2020 ESA & ISAE.
 */

yoogx's avatar
yoogx committed
11
12
13
14
/* Note, this file is from RCC1.3rc4 sample directory.
 *
 * Any modification there should be carefully weighted.
 */
15

16
17
18
19
20
21
22
23
24
25
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/ambapp_bus_grlib.h>
#include <grlib/ambapp_bus.h>
#include <grlib/ambapp_ids.h>
#else
26
27
28
#include <drvmgr/ambapp_bus_grlib.h>
#include <drvmgr/ambapp_bus.h>
#include <ambapp_ids.h>
29
#endif
30
31
32
33
34

/* B1553RT driver configuration (optional) */
struct drvmgr_key grlib_drv_res_b1553rt0[] =
{
#ifdef SET_B1553RT_FREQ
yoogx's avatar
yoogx committed
35
        {"coreFreq", DRVMGR_KT_INT, {(unsigned int)SET_B1553RT_FREQ}},
36
#endif
yoogx's avatar
yoogx committed
37
        DRVMGR_KEY_EMPTY
38
39
40
41
42
};

/* GRPCI driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grpci0[] =
{
yoogx's avatar
yoogx committed
43
44
        {"byteTwisting", DRVMGR_KT_INT, {(unsigned int)1}},
        DRVMGR_KEY_EMPTY
45
46
47
48
49
50
};

/* GRPCI2 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grpci2_0[] =
{
#if 0
yoogx's avatar
yoogx committed
51
52
53
54
        {"INTA#", DRVMGR_KT_INT, {(unsigned int)3}},
        {"INTB#", DRVMGR_KT_INT, {(unsigned int)3}},
        {"INTC#", DRVMGR_KT_INT, {(unsigned int)3}},
        {"INTD#", DRVMGR_KT_INT, {(unsigned int)3}},
55
#endif
yoogx's avatar
yoogx committed
56
        DRVMGR_KEY_EMPTY
57
58
59
60
61
62
};

/* GRGPIO0 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grgpio0[] =
{
#if 0
yoogx's avatar
yoogx committed
63
        {"nBits", DRVMGR_KT_INT, {(unsigned int)24}},
64
#endif
yoogx's avatar
yoogx committed
65
66
67
68
        {"int1", DRVMGR_KT_INT,  {(unsigned int)1}},
        {"ptr2", DRVMGR_KT_POINTER,  {(unsigned int)0x23334445}},
        {"str3", DRVMGR_KT_STRING,  {(unsigned int)"STRING_ValUe"}},
        DRVMGR_KEY_EMPTY
69
70
71
72
73
};

/* GRGPIO1 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grgpio1[] =
{
yoogx's avatar
yoogx committed
74
75
        {"nBits", DRVMGR_KT_INT, {(unsigned int)8}},
        DRVMGR_KEY_EMPTY
76
77
78
79
80
81
};

/* GRGPIO1 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_spictrl0[] =
{
#ifdef SPICTRL_SLV_SEL_FUNC
yoogx's avatar
yoogx committed
82
        {"slvSelFunc", DRVMGR_KT_POINTER, {(unsigned int)SPICTRL_SLV_SEL_FUNC}},
83
#endif
yoogx's avatar
yoogx committed
84
        DRVMGR_KEY_EMPTY
85
86
87
88
89
90
91
};

/* If RTEMS_DRVMGR_STARTUP is defined we override the "weak defaults" that
 * is defined by the LEON3 BSP.
 */
struct drvmgr_bus_res grlib_drv_resources =
{
yoogx's avatar
yoogx committed
92
93
94
        .next = NULL,
        .resource = {
        {DRIVER_AMBAPP_GAISLER_GRPCI2_ID, 0, &grlib_drv_res_grpci2_0[0]},
95
#ifdef LITTLE_ENDIAN_PCI_SYSTEM
yoogx's avatar
yoogx committed
96
97
98
99
100
        /* this configuration option enables PCI byte-twisting which is
         * required for little-endian PCI systems such as for UT699 and
         * the GR-LEON4-ITX board.
         */
        {DRIVER_AMBAPP_GAISLER_GRPCI_ID, 0, &grlib_drv_res_grpci0[0]},
101
102
#endif
/*
yoogx's avatar
yoogx committed
103
104
        {DRIVER_AMBAPP_GAISLER_B1553RT_ID, 0, &grlib_drv_res_b1553rt0[0]},
        {DRIVER_AMBAPP_GAISLER_SPICTRL_ID, 0, &grlib_drv_res_spictrl0[0]},
105
*/
yoogx's avatar
yoogx committed
106
107
108
        {DRIVER_AMBAPP_GAISLER_GRGPIO_ID, 0, &grlib_drv_res_grgpio0[0]},
        DRVMGR_RES_EMPTY
        }
109
110
111
};

#ifndef RTEMS_DRVMGR_STARTUP
yoogx's avatar
yoogx committed
112
struct grlib_config grlib_bus_config =
113
{
yoogx's avatar
yoogx committed
114
115
        &ambapp_plb,		/* AMBAPP bus setup */
        &grlib_drv_resources,	/* Driver configuration */
116
117
118
119
120
121
122
};
#endif

/* LEON3 specific system init */
void system_init2(void)
{
#ifndef RTEMS_DRVMGR_STARTUP
yoogx's avatar
yoogx committed
123
124
        /* Register GRLIB root bus */
        ambapp_grlib_root_register(&grlib_bus_config);
125
126
#endif
}