summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2015-02-11 12:36:50 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2015-04-17 01:10:24 +0200
commit05a45c7932f37f2f3c2e233507909302e5bd42f6 (patch)
treeea8bf69e3f44a3cdecabf0b542d11f4148ce9e45 /c/src/lib/libbsp/sparc
parentGRGPIO: fix buld warnings (diff)
downloadrtems-05a45c7932f37f2f3c2e233507909302e5bd42f6.tar.bz2
GR_701: fix build warnings
Diffstat (limited to 'c/src/lib/libbsp/sparc')
-rw-r--r--c/src/lib/libbsp/sparc/shared/include/gr_701.h9
-rw-r--r--c/src/lib/libbsp/sparc/shared/pci/gr_701.c18
2 files changed, 14 insertions, 13 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/include/gr_701.h b/c/src/lib/libbsp/sparc/shared/include/gr_701.h
index 0ff75cc97f..d0976e95ef 100644
--- a/c/src/lib/libbsp/sparc/shared/include/gr_701.h
+++ b/c/src/lib/libbsp/sparc/shared/include/gr_701.h
@@ -27,17 +27,20 @@ extern "C" {
/* An array of pointers to GR-701 resources. The resources will be
* used by the drivers controlling the cores on the GR-701 target AMBA bus.
*
- * The gr_rasta_io_resources is declared weak so that the user can override the
- * default configuration.
+ * The gr701_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 *gr701_resources[];
#define GR701_OPTIONS_AMBA 0x01
#define GR701_OPTIONS_IRQ 0x02
-/* Print information about GR-RASTA-IO PCI board */
+/* Print information about all GR-701 PCI boards */
void gr701_print(int options);
+/* Print information about one GR-701 PCI board */
+void gr701_print_dev(struct drvmgr_dev *dev, int options);
+
/* Register GR-701 driver */
void gr701_register_drv(void);
diff --git a/c/src/lib/libbsp/sparc/shared/pci/gr_701.c b/c/src/lib/libbsp/sparc/shared/pci/gr_701.c
index 14830085ec..b52b14a214 100644
--- a/c/src/lib/libbsp/sparc/shared/pci/gr_701.c
+++ b/c/src/lib/libbsp/sparc/shared/pci/gr_701.c
@@ -32,6 +32,7 @@
#include <drvmgr/drvmgr.h>
#include <drvmgr/ambapp_bus.h>
#include <drvmgr/pci_bus.h>
+#include <drvmgr/bspcommon.h>
#include <genirq.h>
#include <gr_701.h>
@@ -50,6 +51,7 @@
int gr701_init1(struct drvmgr_dev *dev);
int gr701_init2(struct drvmgr_dev *dev);
+void gr701_interrupt(void *arg);
#define READ_REG(address) (*(volatile unsigned int *)address)
@@ -186,7 +188,6 @@ struct drvmgr_bus_res *gr701_resources[] __attribute__((weak)) =
{
NULL
};
-int gr701_resources_cnt = 0;
void gr701_register_drv(void)
{
@@ -213,7 +214,7 @@ void gr701_interrupt(void *arg)
drvmgr_interrupt_clear(priv->dev, 0);
}
-int gr701_hw_init(struct gr701_priv *priv)
+static int gr701_hw_init(struct gr701_priv *priv)
{
uint32_t com1;
struct pci_bridge_regs *pcib;
@@ -277,7 +278,7 @@ int gr701_hw_init(struct gr701_priv *priv)
NULL, &priv->amba_maps[0]);
/* Frequency is the same as the PCI bus frequency */
- drvmgr_freq_get(priv->dev, NULL, &pci_freq_hz);
+ drvmgr_freq_get(priv->dev, 0, &pci_freq_hz);
/* Initialize Frequency of AMBA bus */
ambapp_freq_init(&priv->abus, NULL, pci_freq_hz);
@@ -293,7 +294,7 @@ int gr701_hw_init(struct gr701_priv *priv)
return 0;
}
-void gr701_hw_init2(struct gr701_priv *priv)
+static void gr701_hw_init2(struct gr701_priv *priv)
{
/* Enable PCI Master (for DMA) */
pci_master_enable(priv->pcidev);
@@ -307,6 +308,7 @@ int gr701_init1(struct drvmgr_dev *dev)
struct gr701_priv *priv;
struct pci_dev_info *devinfo;
uint32_t bar0, bar1, bar0_size, bar1_size;
+ int resources_cnt;
priv = malloc(sizeof(struct gr701_priv));
if ( !priv )
@@ -317,13 +319,9 @@ int gr701_init1(struct drvmgr_dev *dev)
priv->dev = dev;
/* Determine number of configurations */
- if ( gr701_resources_cnt == 0 ) {
- while ( gr701_resources[gr701_resources_cnt] )
- gr701_resources_cnt++;
- }
+ resources_cnt = get_resarray_count(gr701_resources);
/* Generate Device prefix */
-
strcpy(priv->prefix, "/dev/gr701_0");
priv->prefix[11] += dev->minor_drv;
mkdir(priv->prefix, S_IRWXU | S_IRWXG | S_IRWXO);
@@ -369,7 +367,7 @@ int gr701_init1(struct drvmgr_dev *dev)
priv->config.ops = &ambapp_gr701_ops;
priv->config.maps_up = &priv->bus_maps_up[0];
priv->config.maps_down = &priv->bus_maps_down[0];
- if ( priv->dev->minor_drv < gr701_resources_cnt ) {
+ if ( priv->dev->minor_drv < resources_cnt ) {
priv->config.resources = gr701_resources[priv->dev->minor_drv];
} else {
priv->config.resources = NULL;