--- .../libbsp/sparc/shared/include/gr_rasta_adcdac.h | 9 +++++-- .../lib/libbsp/sparc/shared/pci/gr_rasta_adcdac.c | 22 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/c/src/lib/libbsp/sparc/shared/include/gr_rasta_adcdac.h b/c/src/lib/libbsp/sparc/shared/include/gr_rasta_adcdac.h index 42c7c56..ea8d2f3 100644 --- a/c/src/lib/libbsp/sparc/shared/include/gr_rasta_adcdac.h +++ b/c/src/lib/libbsp/sparc/shared/include/gr_rasta_adcdac.h @@ -27,8 +27,8 @@ extern "C" { /* An array of pointers to GR-RASTA-ADCDAC resources. The resources will be * used by the drivers controlling the cores on the GR-RASTA-ADCDAC target AMBA bus. * - * The gr_rasta_io_resources is declared weak so that the user can override the - * default configuration. + * The gr_rasta_adcdac_resources is declared weak so that the user can override + * the default configuration. The array must be terminated with a NULL resource. */ extern struct drvmgr_bus_res *gr_rasta_adcdac_resources[]; @@ -36,9 +36,12 @@ extern struct drvmgr_bus_res *gr_rasta_adcdac_resources[]; #define RASTA_ADCDAC_OPTIONS_AMBA 0x01 /* Print AMBA bus devices */ #define RASTA_ADCDAC_OPTIONS_IRQ 0x02 /* Print current IRQ setup */ -/* Print information about GR-RASTA-IO PCI board */ +/* Print information about all GR-RASTA-IO PCI boards */ void gr_rasta_adcdac_print(int options); +/* Print information about one GR-RASTA-IO PCI board */ +void gr_rasta_adcdac_print_dev(struct drvmgr_dev *dev, int options); + /* Register GR-RASTA-IO driver */ void gr_rasta_adcdac_register_drv(void); diff --git a/c/src/lib/libbsp/sparc/shared/pci/gr_rasta_adcdac.c b/c/src/lib/libbsp/sparc/shared/pci/gr_rasta_adcdac.c index 3ee6293..145c9f2 100644 --- a/c/src/lib/libbsp/sparc/shared/pci/gr_rasta_adcdac.c +++ b/c/src/lib/libbsp/sparc/shared/pci/gr_rasta_adcdac.c @@ -30,6 +30,7 @@ #include <drvmgr/drvmgr.h> #include <drvmgr/ambapp_bus.h> #include <drvmgr/pci_bus.h> +#include <drvmgr/bspcommon.h> #include <genirq.h> #include <gr_rasta_adcdac.h> @@ -55,6 +56,7 @@ extern unsigned int _RAM_START; int gr_rasta_adcdac_init1(struct drvmgr_dev *dev); int gr_rasta_adcdac_init2(struct drvmgr_dev *dev); +void gr_rasta_adcdac_isr (void *arg); struct grpci_regs { volatile unsigned int cfg_stat; @@ -179,7 +181,6 @@ struct drvmgr_bus_res *gr_rasta_adcdac_resources[] __attribute__((weak)) = { NULL }; -int gr_rasta_adcdac_resources_cnt = 0; void gr_rasta_adcdac_register_drv(void) { @@ -213,12 +214,11 @@ void gr_rasta_adcdac_isr (void *arg) DBG("RASTA-ADCDAC-IRQ: 0x%x\n", tmp); } -int gr_rasta_adcdac_hw_init1(struct gr_rasta_adcdac_priv *priv) +static int gr_rasta_adcdac_hw_init1(struct gr_rasta_adcdac_priv *priv) { uint32_t data; unsigned int *page0 = NULL; struct ambapp_dev *tmp; - int status; struct ambapp_ahb_info *ahb; struct pci_dev_info *devinfo = priv->devinfo; uint32_t bar0, bar0_size; @@ -285,7 +285,7 @@ int gr_rasta_adcdac_hw_init1(struct gr_rasta_adcdac_priv *priv) *page0 = 0x80000000; /* Find GRPCI controller */ - tmp = (void *)ambapp_for_each(&priv->abus, + tmp = (struct ambapp_dev *)ambapp_for_each(&priv->abus, (OPTIONS_ALL|OPTIONS_APB_SLVS), VENDOR_GAISLER, GAISLER_PCIFBRG, ambapp_find_by_idx, NULL); @@ -302,7 +302,7 @@ int gr_rasta_adcdac_hw_init1(struct gr_rasta_adcdac_priv *priv) priv->grpci->page1 = 0x40000000; /* Find IRQ controller */ - tmp = (void *)ambapp_for_each(&priv->abus, + tmp = (struct ambapp_dev *)ambapp_for_each(&priv->abus, (OPTIONS_ALL|OPTIONS_APB_SLVS), VENDOR_GAISLER, GAISLER_IRQMP, ambapp_find_by_idx, NULL); @@ -330,7 +330,7 @@ int gr_rasta_adcdac_hw_init1(struct gr_rasta_adcdac_priv *priv) priv->bus_maps_down[2].size = 0; /* Find GRPCI controller AHB Slave interface */ - tmp = (void *)ambapp_for_each(&priv->abus, + tmp = (struct ambapp_dev *)ambapp_for_each(&priv->abus, (OPTIONS_ALL|OPTIONS_AHB_SLVS), VENDOR_GAISLER, GAISLER_PCIFBRG, ambapp_find_by_idx, NULL); @@ -353,7 +353,7 @@ int gr_rasta_adcdac_hw_init1(struct gr_rasta_adcdac_priv *priv) return 0; } -int gr_rasta_adcdac_hw_init2(struct gr_rasta_adcdac_priv *priv) +static int gr_rasta_adcdac_hw_init2(struct gr_rasta_adcdac_priv *priv) { /* Enable DMA by enabling PCI target as master */ pci_master_enable(priv->pcidev); @@ -371,6 +371,7 @@ int gr_rasta_adcdac_init1(struct drvmgr_dev *dev) int status; uint32_t bar0, bar1, bar0_size, bar1_size; union drvmgr_key_value *value; + int resources_cnt; priv = malloc(sizeof(struct gr_rasta_adcdac_priv)); if ( !priv ) @@ -381,10 +382,7 @@ int gr_rasta_adcdac_init1(struct drvmgr_dev *dev) priv->dev = dev; /* Determine number of configurations */ - if ( gr_rasta_adcdac_resources_cnt == 0 ) { - while ( gr_rasta_adcdac_resources[gr_rasta_adcdac_resources_cnt] ) - gr_rasta_adcdac_resources_cnt++; - } + resources_cnt = get_resarray_count(gr_rasta_adcdac_resources); /* Generate Device prefix */ @@ -446,7 +444,7 @@ int gr_rasta_adcdac_init1(struct drvmgr_dev *dev) priv->config.ops = &ambapp_rasta_adcdac_ops; priv->config.maps_up = &priv->bus_maps_up[0]; priv->config.maps_down = &priv->bus_maps_down[0]; - if ( priv->dev->minor_drv < gr_rasta_adcdac_resources_cnt ) { + if ( priv->dev->minor_drv < resources_cnt ) { priv->config.resources = gr_rasta_adcdac_resources[priv->dev->minor_drv]; } else { priv->config.resources = NULL; -- 1.7.0.4 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel