Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allwinner T113-s3 DSP static DRAM interleave fix proposal. #5

Closed
ua1arn opened this issue Jul 1, 2023 · 2 comments
Closed

Allwinner T113-s3 DSP static DRAM interleave fix proposal. #5

ua1arn opened this issue Jul 1, 2023 · 2 comments

Comments

@ua1arn
Copy link

ua1arn commented Jul 1, 2023

Then I fill data ram of embedded DSP, address translation discovered.
You can integrate these functions:

// HiFI4 DSP-viewed address offset translate to host cpu viewwed
static ptrdiff_t xlate_dsp2mpu(ptrdiff_t a)
{
	const ptrdiff_t BANKSIZE = 0x08000u;
	const ptrdiff_t CELLBASE = 0x10000u;
	const ptrdiff_t CELLSIZE = 16;
	const ptrdiff_t cellbank = (a - CELLBASE) / BANKSIZE;
	const ptrdiff_t cellrow = (a - CELLBASE) % BANKSIZE / CELLSIZE;	// 16 bytes granularity
	const unsigned cellpos = (a % CELLSIZE);	// 16 bytes granularity

	if (a < CELLBASE)
		return a;	/* translation not needed. */

	return CELLBASE +
			cellbank * BANKSIZE +
			CELLSIZE * ((cellrow % 2) ? (cellrow / 2) + (BANKSIZE / CELLSIZE / 2) : cellrow / 2) +
			cellpos;
}

static void copy2dsp(uint8_t * pdspmap, const uint8_t * pcpu, unsigned offs, unsigned size)
{
	for (; size --; ++ offs)
	{
		pdspmap [xlate_dsp2mpu(offs)] = pcpu [offs];
	}
}

static void zero2dsp(uint8_t * pdspmap, unsigned offs, unsigned size)
{
	for (; size --; ++ offs)
	{
		pdspmap [xlate_dsp2mpu(offs)] = 0x00;
	}
}
@ua1arn ua1arn changed the title Allwinner T113-s3 DSP static DRAM interleave fix Allwinner T113-s3 DSP static DRAM interleave fix proposal. Jul 1, 2023
@YuzukiTsuru
Copy link
Contributor

Currently, there is no mmu adapter driver available. All access to dram may result in errors. After consideration, provide these support soon

@ua1arn
Copy link
Author

ua1arn commented Jul 10, 2023

I tested on static ram at 0x20038000 at or 0x00038000 hifi4 view (0x00040000 from host view)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants