15 Jun
2012
15 Jun
'12
12:02 p.m.
+struct azx_timecounter {
- cycle_t cycle_last;
- cycle_t mask;
- cycle_t elapsed_cycles;
- u64 initial_time_nsec;
- u32 mult;
- u32 shift;
+};
Any reason not using the normal struct timecounter stuff? Most of the open codes can be replaced gracefully with functions / macros there, I guess.
Yes there is a reason. The conversion from wall clock cycles to ns is a fractional operation (125/3 ratio from 24 MHz to 1 GHz). If you do this conversion to ns every time, you will accumulate rounding errors. That doesn't seem like a very good design if the precision depends on the duration of the track... On top of this, I couldn't find a way to pass the 'chip' argument in the cyclecounter .read() operation to map it to azx_read. Makes sense? -Pierre