Dear ADI

I have a question about "ad9361_rx_tia_calib" this function.

what's the definition of DIV_ROUND_CLOSEST(x , y)?

Is it x/y or (x+y)/2/y ?

Base on equation 41 and table 54 in "AD9361_Register_Map_v2.8C", it should be x/y.

However, I found a definition in util.h which described as below.

#define DIV_ROUND_CLOSEST(x, divisor) (((x) + (divisor) / 2) / (divisor))

so.. which one is correct?

thank you

Darren

Hi,

The DIV_ROUND_CLOSEST() macro performs a division and rounds to the closest integer, this is done to minimize the rounding error. Whereas normal integer division will always round down.

Both the datasheet and the code are correct.

- Lars