[PATCH 071/111] GRPCI: fixed build warnings
Daniel Hellstrom
daniel at gaisler.com
Thu Feb 26 16:39:13 UTC 2015
---
c/src/lib/libbsp/sparc/Makefile.am | 1 +
c/src/lib/libbsp/sparc/leon2/Makefile.am | 1 +
c/src/lib/libbsp/sparc/leon2/preinstall.am | 4 +++
c/src/lib/libbsp/sparc/leon3/Makefile.am | 1 +
c/src/lib/libbsp/sparc/leon3/preinstall.am | 4 +++
c/src/lib/libbsp/sparc/shared/include/grpci.h | 31 +++++++++++++++++++++++
c/src/lib/libbsp/sparc/shared/pci/grpci.c | 33 ++++++++++++++++---------
7 files changed, 63 insertions(+), 12 deletions(-)
create mode 100644 c/src/lib/libbsp/sparc/shared/include/grpci.h
diff --git a/c/src/lib/libbsp/sparc/Makefile.am b/c/src/lib/libbsp/sparc/Makefile.am
index 0a3aa4e..265cbca 100644
--- a/c/src/lib/libbsp/sparc/Makefile.am
+++ b/c/src/lib/libbsp/sparc/Makefile.am
@@ -39,6 +39,7 @@ EXTRA_DIST += shared/timer/tlib.c
EXTRA_DIST += shared/timer/tlib_ckinit.c
# PCI bus
+EXTRA_DIST += shared/include/grpci.h
EXTRA_DIST += shared/include/grpci2.h
EXTRA_DIST += shared/pci/grpci.c
EXTRA_DIST += shared/pci/grpci2.c
diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am
index 09470dc..67805e4 100644
--- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
@@ -97,6 +97,7 @@ libbsp_a_SOURCES += ../../sparc/shared/timer/gptimer.c
libbsp_a_SOURCES += ../../sparc/shared/timer/tlib.c
# PCI
+include_HEADERS += ../../sparc/shared/include/grpci.h
include_HEADERS += ../../sparc/shared/include/grpci2.h
libbsp_a_SOURCES += ../../sparc/shared/pci/grpci2.c
libbsp_a_SOURCES += ../../sparc/shared/pci/grpci.c
diff --git a/c/src/lib/libbsp/sparc/leon2/preinstall.am b/c/src/lib/libbsp/sparc/leon2/preinstall.am
index 30ccf39..3c751d6 100644
--- a/c/src/lib/libbsp/sparc/leon2/preinstall.am
+++ b/c/src/lib/libbsp/sparc/leon2/preinstall.am
@@ -117,6 +117,10 @@ $(PROJECT_INCLUDE)/tlib.h: ../../sparc/shared/include/tlib.h $(PROJECT_INCLUDE)/
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tlib.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/tlib.h
+$(PROJECT_INCLUDE)/grpci.h: ../../sparc/shared/include/grpci.h $(PROJECT_INCLUDE)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grpci.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/grpci.h
+
$(PROJECT_INCLUDE)/grpci2.h: ../../sparc/shared/include/grpci2.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grpci2.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/grpci2.h
diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index fee567b..d445d8f 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -106,6 +106,7 @@ libbsp_a_SOURCES += \
../../shared/src/irq-shell.c
# PCI
+include_HEADERS += ../../sparc/shared/include/grpci.h
include_HEADERS += ../../sparc/shared/include/grpci2.h
libbsp_a_SOURCES += ../../sparc/shared/pci/grpci.c
libbsp_a_SOURCES += ../../sparc/shared/pci/grpci2.c
diff --git a/c/src/lib/libbsp/sparc/leon3/preinstall.am b/c/src/lib/libbsp/sparc/leon3/preinstall.am
index 5020a96..375e8e8 100644
--- a/c/src/lib/libbsp/sparc/leon3/preinstall.am
+++ b/c/src/lib/libbsp/sparc/leon3/preinstall.am
@@ -133,6 +133,10 @@ $(PROJECT_INCLUDE)/bsp/irq.h: include/bsp/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstam
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
+$(PROJECT_INCLUDE)/grpci.h: ../../sparc/shared/include/grpci.h $(PROJECT_INCLUDE)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grpci.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/grpci.h
+
$(PROJECT_INCLUDE)/grpci2.h: ../../sparc/shared/include/grpci2.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grpci2.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/grpci2.h
diff --git a/c/src/lib/libbsp/sparc/shared/include/grpci.h b/c/src/lib/libbsp/sparc/shared/include/grpci.h
new file mode 100644
index 0000000..2321706
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/shared/include/grpci.h
@@ -0,0 +1,31 @@
+#ifndef __GRPCI_H__
+#define __GRPCI_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Register the GRPCI driver to the Driver Manager */
+extern void grpci_register_drv(void);
+
+/* Transfer data using GRPCI DMA unit from AMBA to PCI space. Blocks until
+ * operation completes.
+ */
+int grpci_dma_to_pci(
+ unsigned int ahb_addr,
+ unsigned int pci_addr,
+ unsigned int len);
+
+/* Transfer data using GRPCI DMA unit from PCI to AMBA space. Blocks until
+ * operation completes.
+ */
+int grpci_dma_from_pci(
+ unsigned int ahb_addr,
+ unsigned int pci_addr,
+ unsigned int len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/lib/libbsp/sparc/shared/pci/grpci.c b/c/src/lib/libbsp/sparc/shared/pci/grpci.c
index 08720f0..af3d035 100644
--- a/c/src/lib/libbsp/sparc/shared/pci/grpci.c
+++ b/c/src/lib/libbsp/sparc/shared/pci/grpci.c
@@ -29,6 +29,7 @@
#include <drvmgr/ambapp_bus.h>
#include <ambapp.h>
#include <drvmgr/pci_bus.h>
+#include <grpci.h>
#define DMAPCI_ADDR 0x80000500
@@ -166,7 +167,7 @@ void grpci_register_drv(void)
drvmgr_drv_register(&grpci_info.general);
}
-int grpci_cfg_r32(pci_dev_t dev, int ofs, uint32_t *val)
+static int grpci_cfg_r32(pci_dev_t dev, int ofs, uint32_t *val)
{
struct grpci_priv *priv = grpcipriv;
volatile uint32_t *pci_conf;
@@ -216,7 +217,7 @@ int grpci_cfg_r32(pci_dev_t dev, int ofs, uint32_t *val)
}
-int grpci_cfg_r16(pci_dev_t dev, int ofs, uint16_t *val)
+static int grpci_cfg_r16(pci_dev_t dev, int ofs, uint16_t *val)
{
uint32_t v;
int retval;
@@ -230,7 +231,7 @@ int grpci_cfg_r16(pci_dev_t dev, int ofs, uint16_t *val)
return retval;
}
-int grpci_cfg_r8(pci_dev_t dev, int ofs, uint8_t *val)
+static int grpci_cfg_r8(pci_dev_t dev, int ofs, uint8_t *val)
{
uint32_t v;
int retval;
@@ -242,7 +243,7 @@ int grpci_cfg_r8(pci_dev_t dev, int ofs, uint8_t *val)
return retval;
}
-int grpci_cfg_w32(pci_dev_t dev, int ofs, uint32_t val)
+static int grpci_cfg_w32(pci_dev_t dev, int ofs, uint32_t val)
{
struct grpci_priv *priv = grpcipriv;
volatile uint32_t *pci_conf;
@@ -284,7 +285,7 @@ int grpci_cfg_w32(pci_dev_t dev, int ofs, uint32_t val)
return PCISTS_OK;
}
-int grpci_cfg_w16(pci_dev_t dev, int ofs, uint16_t val)
+static int grpci_cfg_w16(pci_dev_t dev, int ofs, uint16_t val)
{
uint32_t v;
int retval;
@@ -301,7 +302,7 @@ int grpci_cfg_w16(pci_dev_t dev, int ofs, uint16_t val)
return grpci_cfg_w32(dev, ofs & ~0x3, v);
}
-int grpci_cfg_w8(pci_dev_t dev, int ofs, uint8_t val)
+static int grpci_cfg_w8(pci_dev_t dev, int ofs, uint8_t val)
{
uint32_t v;
int retval;
@@ -324,7 +325,7 @@ int grpci_cfg_w8(pci_dev_t dev, int ofs, uint8_t val)
* Returns the "system IRQ" for the PCI INTA#..INTD# pin in irq_pin. Returns
* 0xff if not assigned.
*/
-uint8_t grpci_bus0_irq_map(pci_dev_t dev, int irq_pin)
+static uint8_t grpci_bus0_irq_map(pci_dev_t dev, int irq_pin)
{
uint8_t sysIrqNr = 0; /* not assigned */
int irq_group;
@@ -339,7 +340,7 @@ uint8_t grpci_bus0_irq_map(pci_dev_t dev, int irq_pin)
return sysIrqNr;
}
-int grpci_translate(uint32_t *address, int type, int dir)
+static int grpci_translate(uint32_t *address, int type, int dir)
{
uint32_t adr;
struct grpci_priv *priv = grpcipriv;
@@ -427,7 +428,7 @@ struct pci_io_ops grpci_io_ops_be =
_st_be32,
};
-int grpci_hw_init(struct grpci_priv *priv)
+static int grpci_hw_init(struct grpci_priv *priv)
{
volatile unsigned int *mbar0, *page0;
uint32_t data, addr, mbar0size;
@@ -501,7 +502,7 @@ int grpci_hw_init(struct grpci_priv *priv)
* -3 Error due to GRPCI hardware initialization
* -4 Error registering driver to PCI layer
*/
-int grpci_init(struct grpci_priv *priv)
+static int grpci_init(struct grpci_priv *priv)
{
struct ambapp_apb_info *apb;
struct ambapp_ahb_info *ahb;
@@ -673,7 +674,11 @@ int grpci_init1(struct drvmgr_dev *dev)
}
/* DMA functions which uses GRPCIs optional DMA controller (len in words) */
-int grpci_dma_to_pci(unsigned int ahb_addr, unsigned int pci_addr, unsigned int len) {
+int grpci_dma_to_pci(
+ unsigned int ahb_addr,
+ unsigned int pci_addr,
+ unsigned int len)
+{
int ret = 0;
pcidma[0] = 0x82;
@@ -694,7 +699,11 @@ int grpci_dma_to_pci(unsigned int ahb_addr, unsigned int pci_addr, unsigned int
}
-int grpci_dma_from_pci(unsigned int ahb_addr, unsigned int pci_addr, unsigned int len) {
+int grpci_dma_from_pci(
+ unsigned int ahb_addr,
+ unsigned int pci_addr,
+ unsigned int len)
+{
int ret = 0;
pcidma[0] = 0x80;
--
1.7.0.4
More information about the devel
mailing list