HostDMA/EMIFA basic driver#1
Open
vanasoft23 wants to merge 1 commit into
Open
Conversation
ipc driver basic test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I implemented a very bare bones IPC between CPU and DSP.
Key points:
I wanted to make sure it works first, so I used HostDMA in stop mode, ofcourse, autobuffer mode is more preferable because the host wouldn't need to re-configure after each FIFO transfer.
Took lot's of effort, but could not find / manage to trigger an IRQ host side for the HOST_ACK (also known as FRDY/HRDY) pin, so HostDMA runs in acknowledge mode. For sake of efficiency, this sucks. Would be great to verify in ghidra if E2 firmware runs HostDMA in acknowledge or interrupt mode.
EMIFA timing has yet to be calculated and adjusted, but it may be best to pull the configuration straight from ghidra; see if it writes to 0x68000010 (EMIFAWaitTimingConfig, CE2CFG register).
Would it be possible setting up a DMA channel on the host side aswell using the EDMA3 peripheral? That would bring us closer to the "shared memory illusion" you have talked about before. Currently, from the host side, the CPU still has to perform reads and writes in loops, in fact, the process is blocking!!! Maybe I'm a driver dev noob lol
Next step in abstraction would be writing a device API layer on top of the peripheral code a command queue. Currently if the bus is busy, it just returns an error status.
Code requires an even buffer size, since the FIFO can never transfer a single word in burst mode. My opinion is that the best solution is to have the future device API on top of this only accept 32-bit buffers, as this would avoid complicating the peripheral code.
Without atomic MMR writes, I managed to add some prevention of bus contention, but more thorough testing is be needed to verify it's robustness
Learnt a lot from this ordeal but I am well aware that I probably made a lot of mistakes, but for what it is, it does seem to work properly. Pull the code and see for yourself --- look at per_emifa.c and per_hostdma.c
Cheers, 🔊Max꩜