|
PCI_MemoryWrite not doing what is expected |
|
ksattic (17:59 27/5/2006) VincceH (14:18 28/5/2006) ksattic (03:31 29/5/2006) VincceH (09:28 29/5/2006) ksattic (03:11 30/5/2006)
|
|
Simon Wilson |
Message #75740, posted by ksattic at 17:59, 27/5/2006 |
Finally, an avatar!
Posts: 1291
|
I have a 64KB buffer allocated from a user mode program that I need to copy into PCI space. I alloced the PCI RAM and obtained the logical and PCI addresses using PCI_RAMAlloc.
The problem is that when copying from the PCI buffer to my user buffer using PCI_MemoryRead, the copy appears to complete fine (zeroes are copied over my user buffer). However, when copying from the user buffer to the PCI buffer using PCI_MemoryWrite, nothing is copied. There are alternative ways to do the copy, but I am wondering why this fails to do what is expected. |
|
[ Log in to reply ] |
|
VinceH |
Message #75782, posted by VincceH at 14:18, 28/5/2006, in reply to message #75740 |
Lowering the tone since the dawn of time
Posts: 1600
|
Flags in R4? The Castle's online docs don't seem to say what these are (unless I'm missing something). I wonder if its an ommission or if it's a case of being reserved for future use for flags - but in which case that something /is/ looking at what is passed atm even though it isn't used? |
|
[ Log in to reply ] |
|
Simon Wilson |
Message #75804, posted by ksattic at 03:31, 29/5/2006, in reply to message #75782 |
Finally, an avatar!
Posts: 1291
|
Flags in R4? The Castle's online docs don't seem to say what these are (unless I'm missing something). I wonder if its an ommission or if it's a case of being reserved for future use for flags - but in which case that something /is/ looking at what is passed atm even though it isn't used? The only flag I know of is bit 3 (memory is prefetchable), but I tried that, and it had no effect (I wouldn't expect it to though).
The current "cheating so and so" method I am using is to unprotect the memory pages using the MMU, before doing the copy in user mode. |
|
[ Log in to reply ] |
|
VinceH |
Message #75808, posted by VincceH at 09:28, 29/5/2006, in reply to message #75804 |
Lowering the tone since the dawn of time
Posts: 1600
|
Flags in R4? The Castle's online docs don't seem to say what these are (unless I'm missing something). I wonder if its an ommission or if it's a case of being reserved for future use for flags - but in which case that something /is/ looking at what is passed atm even though it isn't used? The only flag I know of is bit 3 (memory is prefetchable), but I tried that, and it had no effect (I wouldn't expect it to though). No, I wouldn't either.
The current "cheating so and so" method I am using is to unprotect the memory pages using the MMU, before doing the copy in user mode. MMU... I noticed yesterday that PCI_RAMAlloc mentions a call to OS_MMUControl. It jogged a vague memory, but just didn't click when I read it yesterday - but now I'm thinking an error or inconsistency in the documentation mentioned not long ago on csap?
<googles>
Okay, it was actually aproaching a year ago:
PCI DMA buffers and OS_MMUControl
But looking at Castle's documentation now, it's been fixed.
So that won't be relevant. |
|
[ Log in to reply ] |
|
Simon Wilson |
Message #75826, posted by ksattic at 03:11, 30/5/2006, in reply to message #75808 |
Finally, an avatar!
Posts: 1291
|
I did try draining the write buffer using OS_MMUControl 1 with bit 28 set. You're right, it's probably not relevant here given that I am seeing nothing copied, but I do it for safety anyway in PCITV (although I do user->pci memory copies in a different way there, using some assembly to copy in supervisor mode).
I'll send John Ballance an email. |
|
[ Log in to reply ] |
|
|