Of particular interest is this line:
msg.data[0] = (clk == 0) ? clk : ((clk / 10) % 20) + 2;
It looks like calling
baikal_setoption() allows the clock to be set to an arbitrary value.
To be honest I don't get the point of this part
((clk / 10) % 20) + 2It just doesn't make any sense to me. If the clock is set to 400 MHz, then the msg.data[0] value will be 2. While if the clock is 300 MHz, then msg.data[0] is 12.
What is the logic here?
[divide by 10] indicates 10MHz increments, [mod 20] indicates a lookup table with 20 items, [+ 2] indicates the list begins at index #2:
2 400 (Giant B stock)
3 410/210
4 420/220
5 430/230
6 440/240
7 450/250
8 460/260
9 470/270
10 480/280
11 490/290
12 300 (Giant x10 stock)
13 310
14 320
15 330
16 340
17 350
18 360
19 370
20 380
21 390
Not sure whether, for example, #7 would give 450 or 250MHz - an experiment is needed.