#106448 - Goosey - Thu Oct 19, 2006 6:20 am
Greets,
I have been trying to implement a Non-Blocking FIFO Queue to transfer log messages from the ARM7 to the ARM9. Initially I implemented this to transfer a single u32 and it worked fine, but when I extended it to use my LogMessage structure it failed to work on hardware (still runs fine in Dualis).
The basic strategy I used was to define the FIFOQueue class, take the memory address at (IPC+1) and cast it to a pointer of the class as such:
I worried that this might have some issues since I am not really allocating the memory for it, I am simply putting it at a constant address (which seems to be the same pattern the IPC structure follows).
I think the reason it would work with a u32 queue but fails on the LogMessage queue is that the memory size of the queue is quite larger and it is 'poking' into memory that is being used for the stack. That's just my guess though.
My questions are then:
- Anyone with experience in defining an arbitrary memory address for shared access know of a 'safe' way to do this.. IE: to be able to 'allocate' the space so that the head manager and the stack will not tread into it... IE: How does IPC get away with this?
- Is this heading in a foolish direction? I am aware of the hardware FIFO, however this was a simpler solution then writing a wrapper to seamlessly translate log messages into 32bit chunks the hardware FIFO can pass... It is starting to look like a general purpose FIFO 'stream' class is going to be needed now.
Any advice is welcome. I can produce the code if it would help, although the implementation details didn't seem relevant (more wondering if I am heading in the right design direction on using the fixed memory address for this stuff)..
Right now it is just for logging messages between the procs, however in the future I planned to use the FIFO pattern for other means of ipc data transfer (such as sound).
I have been trying to implement a Non-Blocking FIFO Queue to transfer log messages from the ARM7 to the ARM9. Initially I implemented this to transfer a single u32 and it worked fine, but when I extended it to use my LogMessage structure it failed to work on hardware (still runs fine in Dualis).
The basic strategy I used was to define the FIFOQueue class, take the memory address at (IPC+1) and cast it to a pointer of the class as such:
Code: |
class FIFOQueue { /// Stuff here... }; FIFOQueue* ARM7_TO_ARM9_FIFOQUEUE = (FIFOQueue*)(IPC+1); |
I worried that this might have some issues since I am not really allocating the memory for it, I am simply putting it at a constant address (which seems to be the same pattern the IPC structure follows).
I think the reason it would work with a u32 queue but fails on the LogMessage queue is that the memory size of the queue is quite larger and it is 'poking' into memory that is being used for the stack. That's just my guess though.
My questions are then:
- Anyone with experience in defining an arbitrary memory address for shared access know of a 'safe' way to do this.. IE: to be able to 'allocate' the space so that the head manager and the stack will not tread into it... IE: How does IPC get away with this?
- Is this heading in a foolish direction? I am aware of the hardware FIFO, however this was a simpler solution then writing a wrapper to seamlessly translate log messages into 32bit chunks the hardware FIFO can pass... It is starting to look like a general purpose FIFO 'stream' class is going to be needed now.
Any advice is welcome. I can produce the code if it would help, although the implementation details didn't seem relevant (more wondering if I am heading in the right design direction on using the fixed memory address for this stuff)..
Right now it is just for logging messages between the procs, however in the future I planned to use the FIFO pattern for other means of ipc data transfer (such as sound).