/* Blackfin Direct Memory Access (DMA) Channel model.
- Copyright (C) 2010-2011 Free Software Foundation, Inc.
+ Copyright (C) 2010-2020 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
This file is part of simulators.
#define mmr_base() offsetof(struct bfin_dma, next_desc_ptr)
#define mmr_offset(mmr) (offsetof(struct bfin_dma, mmr) - mmr_base())
-static const char * const mmr_names[] = {
+static const char * const mmr_names[] =
+{
"NEXT_DESC_PTR", "START_ADDR", "CONFIG", "<INV>", "X_COUNT", "X_MODIFY",
"Y_COUNT", "Y_MODIFY", "CURR_DESC_PTR", "CURR_ADDR", "IRQ_STATUS",
"PERIPHERAL_MAP", "CURR_X_COUNT", "<INV>", "CURR_Y_COUNT", "<INV>",
/* XXX: This sucks performance wise. */
nr_bytes = dma->ele_size;
else
- nr_bytes = MIN (sizeof (buf), dma->curr_x_count * dma->ele_size);
+ nr_bytes = min (sizeof (buf), dma->curr_x_count * dma->ele_size);
/* Pumping a chunk! */
bfin_peer->dma_master = me;
bu32 *value32p;
void *valuep;
+ /* Invalid access mode is higher priority than missing register. */
+ if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, true))
+ return 0;
+
if (nr_bytes == 4)
value = dv_load_4 (source);
else
if (nr_bytes == 4)
*value32p = value;
else
- *value16p = value;
+ *value16p = value;
}
else
HW_TRACE ((me, "discarding write while dma running"));
default:
/* XXX: The HW lets the pad regions be read/written ... */
dv_bfin_mmr_invalid (me, addr, nr_bytes, true);
- break;
+ return 0;
}
return nr_bytes;
bu32 *value32p;
void *valuep;
+ /* Invalid access mode is higher priority than missing register. */
+ if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, false))
+ return 0;
+
mmr_off = addr % dma->base;
valuep = (void *)((unsigned long)dma + mmr_base() + mmr_off);
value16p = valuep;
return ret;
}
-static const struct hw_port_descriptor bfin_dma_ports[] = {
+static const struct hw_port_descriptor bfin_dma_ports[] =
+{
{ "di", 0, 0, output_port, }, /* DMA Interrupt */
{ NULL, 0, 0, 0, },
};
dma->peripheral_map = bfin_dmac_default_pmap (me);
}
-const struct hw_descriptor dv_bfin_dma_descriptor[] = {
+const struct hw_descriptor dv_bfin_dma_descriptor[] =
+{
{"bfin_dma", bfin_dma_finish,},
{NULL, NULL},
};