dma_read(void *opaque, target_phys_addr_t addr, unsigned int size)

{

        struct fs_dma_ctrl *ctrl = opaque;

	int c;

	uint32_t r = 0;



	if (size != 4) {

		dma_rinvalid(opaque, addr);

	}



	/* Make addr relative to this channel and bounded to nr regs.  */

	c = fs_channel(addr);

	addr &= 0xff;

	addr >>= 2;

	switch (addr)

	{

		case RW_STAT:

			r = ctrl->channels[c].state & 7;

			r |= ctrl->channels[c].eol << 5;

			r |= ctrl->channels[c].stream_cmd_src << 8;

			break;



		default:

			r = ctrl->channels[c].regs[addr];

			D(printf ("%s c=%d addr=" TARGET_FMT_plx "\n",

				  __func__, c, addr));

			break;

	}

	return r;

}

dma_read(void *opaque, target_phys_addr_t addr, unsigned int size)

{

        struct fs_dma_ctrl *ctrl = opaque;

	int c;

	uint32_t r = 0;



	if (size != 4) {

		dma_rinvalid(opaque, addr);

	}



	

	c = fs_channel(addr);

	addr &= 0xff;

	addr >>= 2;

	switch (addr)

	{

		case RW_STAT:

			r = ctrl->channels[c].state & 7;

			r |= ctrl->channels[c].eol << 5;

			r |= ctrl->channels[c].stream_cmd_src << 8;

			break;



		default:

			r = ctrl->channels[c].regs[addr];

			D(printf ("%s c=%d addr=" TARGET_FMT_plx "\n",

				  __func__, c, addr));

			break;

	}

	return r;

}

FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, unsigned int VAR_2)

{

        struct fs_dma_ctrl *VAR_3 = VAR_0;

	int VAR_4;

	uint32_t r = 0;



	if (VAR_2 != 4) {

		dma_rinvalid(VAR_0, VAR_1);

	}



	

	VAR_4 = fs_channel(VAR_1);

	VAR_1 &= 0xff;

	VAR_1 >>= 2;

	switch (VAR_1)

	{

		case RW_STAT:

			r = VAR_3->channels[VAR_4].state & 7;

			r |= VAR_3->channels[VAR_4].eol << 5;

			r |= VAR_3->channels[VAR_4].stream_cmd_src << 8;

			break;



		default:

			r = VAR_3->channels[VAR_4].regs[VAR_1];

			D(printf ("%s VAR_4=%d VAR_1=" TARGET_FMT_plx "\n",

				  __func__, VAR_4, VAR_1));

			break;

	}

	return r;

}

FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, unsigned int VAR_2)
{ struct fs_dma_ctrl *VAR_3 = VAR_0; int VAR_4; uint32_t r = 0; if (VAR_2 != 4) { dma_rinvalid(VAR_0, VAR_1); } VAR_4 = fs_channel(VAR_1); VAR_1 &= 0xff; VAR_1 >>= 2; switch (VAR_1)
{ case RW_STAT:
r = VAR_3->channels[VAR_4].state & 7; r |= VAR_3->channels[VAR_4].eol << 5; r |= VAR_3->channels[VAR_4].stream_cmd_src << 8; break; default:
r = VAR_3->channels[VAR_4].regs[VAR_1]; D(printf ("%s VAR_4=%d VAR_1=" TARGET_FMT_plx "\n",
__func__, VAR_4, VAR_1)); break; } return r; }