<mwalle>
obviously its an expanded macro.. and it seems the vendor also supplies the correct bitmask for a field ;)
<marex>
mwalle: I did experiment with clang formatter a while ago when trying to pull out information from Redpine signals example code drop
<mwalle>
marex: mhh, i'd say there are three bitfields in the first assignment, 31:27, 15:0 and 25:16
<marex>
mwalle: oh yeah, copy .clang-format from Linux kernel, then run clang-format -i <file>
<marex>
mwalle: or just ... stick it into a C file, s@gctUINT32@uint32_t@ , compile and print the resulting value
<marex>
mwalle: it is generated code from some HDL I guess
<mwalle>
marex: mh, i'd have guessed they expanded their HERE_IS_SOME_NICE_NAME_BUT_WE_WANT_TO_KEEP_IT_A_SECRET(val) macro
<marex>
nah, its probably just generated from HDL
<mwalle>
marex: I'm not convinced :p esp. because its nicely formatted and looks like "*buffer = MACRO(bla);" judging from the indendation
<marex>
mwalle: um ... notice those ( 0 ? 0 : 0 ) fields there
adjtm is now known as Guest3802
adjtm has joined #etnaviv
<mwalle>
marex: yep, that looks like the beginning and end of the bitfields, like the first always evaluates to the highest and the second to the lowest; granted the macros might be autogenerated
pcercuei_ has joined #etnaviv
<mwalle>
i wonder about that "== 32 ? ~0U : something_else" though
<marex>
mwalle: (var == val ? value-if-cond-true : value-if-cond-false) ?
<marex>
mwalle: ~0U is 0xffffffff
Guest3802 has quit [Ping timeout: 480 seconds]
<marex>
mwalle: I feel like I'm stating the obvious, maybe I dont get the question and need some fresh air
pcercuei has quit [Ping timeout: 480 seconds]
<mwalle>
marex: yeah, but why would you test for 32, I presume the values just range from 0 to 31
<mwalle>
in any case, I'll try pattern matching by eyes with the proper kernel code ;)
<marex>
mwalle: isnt it some addition in that conditional ?
<marex>
add values and if they == 32, return value something, else return value somethingelse ?
<mwalle>
ahhhh
<marex>
because if the generated code does not have 7+1 there, but 31+1, it is 32 ?
<mwalle>
31:0 would be 32 then the mask will be all-ones
<mwalle>
no?
<marex>
there is some +1 in that expression
<mwalle>
yeah so "31 - 0 + 1 == 32"
<mwalle>
so they special case the all-ones bitfield, because their shift op in the else branch doesn't work for that edge case (?)
<mwalle>
and there is still that mysterious "0 & ~(some long expression)"
<mwalle>
and that 0 might be used for manipulating only this field
<mwalle>
eg if that 0 would be configEx, you'll be modifying 7:0 and 23:16
frieder_ has joined #etnaviv
frieder_ has quit []
Peng_Fan has quit [Quit: Connection closed for inactivity]
<laanwj>
i remember there was some script (either in etna_viv or one or the other repos) that used a regexp to match vivante-isms like that and back-substitutes somewhat readable bitfield macro usage
JohnnyonFlame has quit [Read error: Connection reset by peer]
frieder has quit [Remote host closed the connection]
smurray has quit [Read error: Connection reset by peer]
smurray has joined #etnaviv
lynxeye has quit []
JohnnyonFlame has joined #etnaviv
smurray_ has joined #etnaviv
smurray has quit [Ping timeout: 480 seconds]
adjtm has quit [Ping timeout: 480 seconds]
adjtm has joined #etnaviv
pcercuei_ has quit []
chewitt has quit [Remote host closed the connection]