lkml.org 
[lkml]   [2013]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] dw_dmac: return proper residue value
From
On Wed, Jan 23, 2013 at 11:51 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 23 January 2013 15:06, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>> On Wed, Jan 23, 2013 at 11:22 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:

>>> Second to solve your problem, you can add another field here: total_len.
>>> I know it will consume 4 bytes per desc but i think that's the drawback we need
>>> to accept.
>>
>> I found already better solution I guess.
>
> Wow!!
>
>> I introduced two functions to get amount of sent bytes like
>>
>> u32 calc_sent(u32 ctlhi, u32 ctllo)
>> {
>> return f1(ctlhi) * f2(ctllo);
>> }
>>
>> u32 get_sent(dwc)
>> {
>> return calc_sent(read(CTL_HI), read(CTL_LO));
>> }
>>
>> And usage like
>>
>> /* initial residue */
>> desc->len - calc_sent(desc->lli.ctlhi, desc->lli.ctllo).
>>
>> What do you think?
>
> You plan to use it for
> - the first descriptor in a list as others already have length embedded in them?
> - And the descriptor currently getting used, by reading its ctlhi/lo
> from registers
> instead of lli.*** ?

Roughly, yes.

> Looks good. but still keeping len of individual descriptors in all
> descriptors leaving
> the first one is not the code i would like to keep :)

What about to calc len every time from lli.* instead of keeping it in
the len field of the descriptor?
It's logically looks better, but requires more resources.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2013-01-23 12:43    [W:0.100 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site