config_leon3_drvmgr.c 3.15 KB
Newer Older
yoogx's avatar
yoogx committed
1 2 3 4
/* Note, this file is from RCC1.3rc4 sample directory.
 *
 * Any modification there should be carefully weighted.
 */
yoogx's avatar
yoogx committed
5 6 7 8 9 10 11 12 13

#include <drvmgr/ambapp_bus_grlib.h>
#include <drvmgr/ambapp_bus.h>
#include <ambapp_ids.h>

/* B1553RT driver configuration (optional) */
struct drvmgr_key grlib_drv_res_b1553rt0[] =
{
#ifdef SET_B1553RT_FREQ
yoogx's avatar
yoogx committed
14
        {"coreFreq", DRVMGR_KT_INT, {(unsigned int)SET_B1553RT_FREQ}},
yoogx's avatar
yoogx committed
15
#endif
yoogx's avatar
yoogx committed
16
        DRVMGR_KEY_EMPTY
yoogx's avatar
yoogx committed
17 18 19 20 21
};

/* GRPCI driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grpci0[] =
{
yoogx's avatar
yoogx committed
22 23
        {"byteTwisting", DRVMGR_KT_INT, {(unsigned int)1}},
        DRVMGR_KEY_EMPTY
yoogx's avatar
yoogx committed
24 25 26 27 28 29
};

/* GRPCI2 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grpci2_0[] =
{
#if 0
yoogx's avatar
yoogx committed
30 31 32 33
        {"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}},
yoogx's avatar
yoogx committed
34
#endif
yoogx's avatar
yoogx committed
35
        DRVMGR_KEY_EMPTY
yoogx's avatar
yoogx committed
36 37 38 39 40 41
};

/* GRGPIO0 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grgpio0[] =
{
#if 0
yoogx's avatar
yoogx committed
42
        {"nBits", DRVMGR_KT_INT, {(unsigned int)24}},
yoogx's avatar
yoogx committed
43
#endif
yoogx's avatar
yoogx committed
44 45 46 47
        {"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
yoogx's avatar
yoogx committed
48 49 50 51 52
};

/* GRGPIO1 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_grgpio1[] =
{
yoogx's avatar
yoogx committed
53 54
        {"nBits", DRVMGR_KT_INT, {(unsigned int)8}},
        DRVMGR_KEY_EMPTY
yoogx's avatar
yoogx committed
55 56 57 58 59 60
};

/* GRGPIO1 driver configuration (optional) */
struct drvmgr_key grlib_drv_res_spictrl0[] =
{
#ifdef SPICTRL_SLV_SEL_FUNC
yoogx's avatar
yoogx committed
61
        {"slvSelFunc", DRVMGR_KT_POINTER, {(unsigned int)SPICTRL_SLV_SEL_FUNC}},
yoogx's avatar
yoogx committed
62
#endif
yoogx's avatar
yoogx committed
63
        DRVMGR_KEY_EMPTY
yoogx's avatar
yoogx committed
64 65 66 67 68 69 70
};

/* 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
71 72 73
        .next = NULL,
        .resource = {
        {DRIVER_AMBAPP_GAISLER_GRPCI2_ID, 0, &grlib_drv_res_grpci2_0[0]},
yoogx's avatar
yoogx committed
74
#ifdef LITTLE_ENDIAN_PCI_SYSTEM
yoogx's avatar
yoogx committed
75 76 77 78 79
        /* 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]},
yoogx's avatar
yoogx committed
80 81
#endif
/*
yoogx's avatar
yoogx committed
82 83
        {DRIVER_AMBAPP_GAISLER_B1553RT_ID, 0, &grlib_drv_res_b1553rt0[0]},
        {DRIVER_AMBAPP_GAISLER_SPICTRL_ID, 0, &grlib_drv_res_spictrl0[0]},
yoogx's avatar
yoogx committed
84
*/
yoogx's avatar
yoogx committed
85
        {DRIVER_AMBAPP_GAISLER_GRGPIO_ID, 0, &grlib_drv_res_grgpio0[0]},
86 87 88 89 90
        {DRIVER_AMBAPP_GAISLER_GPTIMER_ID, 1, NULL},
        {DRIVER_AMBAPP_GAISLER_GPTIMER_ID, 2, NULL},
        {DRIVER_AMBAPP_GAISLER_GPTIMER_ID, 3, NULL},
        {DRIVER_AMBAPP_GAISLER_GPTIMER_ID, 4, NULL},
        {DRIVER_AMBAPP_GAISLER_GRETH_ID, 1, NULL},
yoogx's avatar
yoogx committed
91 92
        DRVMGR_RES_EMPTY
        }
yoogx's avatar
yoogx committed
93 94 95
};

#ifndef RTEMS_DRVMGR_STARTUP
yoogx's avatar
yoogx committed
96
struct grlib_config grlib_bus_config =
yoogx's avatar
yoogx committed
97
{
yoogx's avatar
yoogx committed
98 99
        &ambapp_plb,		/* AMBAPP bus setup */
        &grlib_drv_resources,	/* Driver configuration */
yoogx's avatar
yoogx committed
100 101 102 103 104 105 106
};
#endif

/* LEON3 specific system init */
void system_init2(void)
{
#ifndef RTEMS_DRVMGR_STARTUP
yoogx's avatar
yoogx committed
107 108
        /* Register GRLIB root bus */
        ambapp_grlib_root_register(&grlib_bus_config);
yoogx's avatar
yoogx committed
109 110
#endif
}