Rockbox mail archiveSubject: Re: Cowon D2 EABI
Re: Cowon D2 EABI
From: Rob Purchase <rob.purchase_at_googlemail.com>
Date: Tue, 15 Jun 2010 00:02:14 +0100
On 14/06/2010 23:14, Andrew Poelstra wrote:
> There are two ways intuitively to do this:
> 1. I believe the ARM proc in the D2 has a PIT (periodic interval timer) that can be used as a clock counter, if you want a specific time period. It's a bit of work to initialize it but nothing major. The USB driver in u-boot uses this method.
> 2. If you're just counting clock cycles, the 'volatile' specifier should prevent gcc's loop optimizations, no?
1. The delays we are looking for here are tiny (just a few cycles). I'm
not sure a timer is going to be helpful here.
2. Yes, but this generates additional code since extra ldr/str
instructions are generated each time the loop counter is accessed,
The fact is, this code is horrible and the slightest tweak makes
unexpected things go wrong. It's used for I2C reads/writes, and if the
timing is wrong it can cause subtle errors such as occasionally missing
touch screen presses. These are read relatively frequently, so we don't
want to waste too much time busy-waiting either.
The "current" code was very carefully written so that it works in all of
the 32/48/192Mhz clock speeds used in Rockbox (or at least did with the
If any changes are made to this code, it needs to be tested *very*
carefully for correct operation at all speeds. Just tweaking the code
and committing the first one that "looks like it works" isn't going to
cut it. Which is why my preference was to give me a few days to look
into it properly all along....
Received on 2010-06-15