Revision 492c30af hw/etraxfs_dma.c
b/hw/etraxfs_dma.c | ||
---|---|---|
24 | 24 |
#include <stdio.h> |
25 | 25 |
#include <sys/time.h> |
26 | 26 |
#include "hw.h" |
27 |
#include "qemu-common.h" |
|
28 |
#include "sysemu.h" |
|
27 | 29 |
|
28 | 30 |
#include "etraxfs_dma.h" |
29 | 31 |
|
... | ... | |
190 | 192 |
|
191 | 193 |
int nr_channels; |
192 | 194 |
struct fs_dma_channel *channels; |
195 |
|
|
196 |
QEMUBH *bh; |
|
193 | 197 |
}; |
194 | 198 |
|
195 | 199 |
static inline uint32_t channel_reg(struct fs_dma_ctrl *ctrl, int c, int reg) |
... | ... | |
712 | 716 |
} |
713 | 717 |
|
714 | 718 |
|
715 |
static void *etraxfs_dmac; |
|
716 |
void DMA_run(void) |
|
719 |
static void DMA_run(void *opaque) |
|
717 | 720 |
{ |
718 |
if (etraxfs_dmac) |
|
719 |
etraxfs_dmac_run(etraxfs_dmac); |
|
721 |
struct fs_dma_ctrl *etraxfs_dmac = opaque; |
|
722 |
if (vm_running) |
|
723 |
etraxfs_dmac_run(etraxfs_dmac); |
|
724 |
qemu_bh_schedule_idle(etraxfs_dmac->bh); |
|
720 | 725 |
} |
721 | 726 |
|
722 | 727 |
void *etraxfs_dmac_init(CPUState *env, |
... | ... | |
729 | 734 |
if (!ctrl) |
730 | 735 |
return NULL; |
731 | 736 |
|
737 |
ctrl->bh = qemu_bh_new(DMA_run, ctrl); |
|
738 |
qemu_bh_schedule_idle(ctrl->bh); |
|
739 |
|
|
732 | 740 |
ctrl->base = base; |
733 | 741 |
ctrl->env = env; |
734 | 742 |
ctrl->nr_channels = nr_channels; |
... | ... | |
747 | 755 |
ctrl->channels[i].regmap); |
748 | 756 |
} |
749 | 757 |
|
750 |
/* Hax, we only support one DMA controller at a time. */ |
|
751 |
etraxfs_dmac = ctrl; |
|
752 | 758 |
return ctrl; |
753 | 759 |
err: |
754 | 760 |
qemu_free(ctrl->channels); |
Also available in: Unified diff