aboutsummaryrefslogtreecommitdiff
path: root/hw/dma/xilinx_axidma.c
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2013-04-16 10:22:02 +1000
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2013-04-16 10:04:22 +0200
commitcbde584f58b484a8200eb578a5ba81057488f0eb (patch)
tree8ed286e95231e39af24c5c393f549b094ce78c3c /hw/dma/xilinx_axidma.c
parent42e8a283f50da698e8bff7ed36b8b39e21d70eaa (diff)
xilinx_axidma: Defined and use type cast macro
Standard QOM cast macro. Replaces usages of FROM_SYSBUS Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'hw/dma/xilinx_axidma.c')
-rw-r--r--hw/dma/xilinx_axidma.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index 4dd8a6b97d..0b5bb4490c 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -32,6 +32,11 @@
#define D(x)
+#define TYPE_XILINX_AXI_DMA "xlnx.axi-dma"
+
+#define XILINX_AXI_DMA(obj) \
+ OBJECT_CHECK(XilinxAXIDMA, (obj), TYPE_XILINX_AXI_DMA)
+
#define R_DMACR (0x00 / 4)
#define R_DMASR (0x04 / 4)
#define R_CURDESC (0x08 / 4)
@@ -355,7 +360,7 @@ static void stream_process_s2mem(struct Stream *s,
static void
axidma_push(StreamSlave *obj, unsigned char *buf, size_t len, uint32_t *app)
{
- XilinxAXIDMA *d = FROM_SYSBUS(typeof(*d), SYS_BUS_DEVICE(obj));
+ XilinxAXIDMA *d = XILINX_AXI_DMA(obj);
struct Stream *s = &d->streams[1];
if (!app) {
@@ -461,7 +466,7 @@ static const MemoryRegionOps axidma_ops = {
static int xilinx_axidma_init(SysBusDevice *dev)
{
- XilinxAXIDMA *s = FROM_SYSBUS(typeof(*s), dev);
+ XilinxAXIDMA *s = XILINX_AXI_DMA(dev);
int i;
sysbus_init_irq(dev, &s->streams[0].irq);
@@ -483,7 +488,7 @@ static int xilinx_axidma_init(SysBusDevice *dev)
static void xilinx_axidma_initfn(Object *obj)
{
- XilinxAXIDMA *s = FROM_SYSBUS(typeof(*s), SYS_BUS_DEVICE(obj));
+ XilinxAXIDMA *s = XILINX_AXI_DMA(obj);
object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE,
(Object **) &s->tx_dev, NULL);
@@ -506,7 +511,7 @@ static void axidma_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo axidma_info = {
- .name = "xlnx.axi-dma",
+ .name = TYPE_XILINX_AXI_DMA,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(XilinxAXIDMA),
.class_init = axidma_class_init,