i just uploaded this file:
http://inferno-ds.googlecode.com/files/patch-fifo-104.diff
it adds supports for fifo's. this patch also has code to send a
"change-brightness" command from the arm9 to the arm7 (only the arm7
can change the brightness) over the fifo.
WARNING: setting the brightness is ds-lite only, not old ds. the code
will just set the bits, i don't know how the old ds reacts to this.
about the fifo: the fifo is a 16-element, 32-bits per element, buffered
channel between the arm7 and arm9, in both directions, independent from
eachother. interrupts can be generated when something can be sent, or
on incoming data. in this patch, i used the lower 4 bits of the 32-bit
word for "command", the other 28 bits as a parameter. this can easily
be changed though. we don't even necessarily have to cram an op+param
in one word, we could also send multiple words. on the arm9-sending
side, a qlock+rendez protects access and queues the callers. i haven't
used the qlock/rendez functions before, so i hope i got it right...
a write to /dev/ndsctl of the form "brightness x" (x being 0 to 3, low
to high) will send the request to the arm7 using the fifo.
currently, some code is duplicated in arm7/, because otherwise i would
have to link in qlock & friends (which i couldn't do easily), and because
the interrupt-setting functions are different. i think the arm7 interrupt
functions can be done better anyway, so might as well change them to
match the arm9's soon.
this patch is against -r104. however, to make it work, you will have
to resurrect arm7/div.s (and the mkfile change that compiles it in just
after l.$O) from -r102. otherwise it doesn't work. we should investigate
this more. :)
ideas/comments are welcome!
best regards,
mechiel
it has to do with interrupt handlers, not being called properly,
since i removed arm7/div.s audio, which was started from VblankHandler()
has also stopped working, we'll have to get more details.
--
salva
it has also to do with the issues i wrote on the list about the _div code
not working properly on the arm7 cpu [1]. As a blind guess i think
we're trashing
the ram section where the div.$O code lives, just after l.$O, one can check that
by moving div.$O down the $OBJ list in the arm7/mkfile.
This means that probably we're not laying down correctly the code in ram.
I don't know much of the kernel's layout, what i know is what i could grasp
from the other Inferno arm ports.
I assume the code produced by 5l is in a.out(10) format, so i'll be
looking at that.
By now, we've put back div.$O, and we will continue investigating in bg.
--
salva
yes, the text/data/bss was not layed out correctly. we were calling 5l
like this:
5l -H4 -R0 -T$KTZERO7 -D$KDZERO7 ...
where KTZERO7 and KDZERO7 were both 0x03800000. this meant that data
and text section were at the same location in memory, overwriting each
other. also, after startup, we zero the bss, destroying code.
inspection with inm (for text/data symbol locations) and acid (for
values of etext, bdata, edata, end, setR12) showed the bss was within
the boundaries of the div.$O code. this was also why div was not
working.
calling 5l like this:
5l -H0 -R4 -T$KTZERO7 ...
causes 5l to lay down the data after whereever the text is (at the
specified location), rounding text/data boundary up to 4 bytes (i.e.
directly after eachother). -H0 seems to do the same thing as -H4, but
-H4 seems to be for a specific (other) machine and -H0 simply a headerless
file.
i just committed these changes, r120. that commit also changes
key/mouse handling. now that div is working, arm7 now calculates the
mouse locations (in pixels) and send them to the arm9 over the fifo.
the same is done for button presses. anyway, the full commit message &
changes can be read here:
http://code.google.com/p/inferno-ds/source/detail?r=120
as noted in the commit message, there is some cleanup after this patch
to do. i wanted this committed first.
best regards,
mechiel