@@ -265,10 +265,10 @@ static fp_40_24_t compute_offset(radio_t* const radio, uint64_t opmode, uint64_t
265265 if ((rotation != 0 ) && (rotation != RADIO_UNSET ) && (mcu_rate != RADIO_UNSET ) &&
266266 (n != RADIO_UNSET )) {
267267 const fp_40_24_t afe_rate = mcu_rate << n ;
268- if (rotation & 0x80 ) {
269- rotation = 0x100 - rotation ;
268+ if (rotation & 0x80000000 ) {
269+ rotation = 0x100000000 - rotation ;
270270 }
271- offset = (afe_rate * rotation ) >> 8 ;
271+ offset = (afe_rate * ( rotation >> 24 ) ) >> 8 ;
272272 }
273273 return offset ;
274274}
@@ -285,13 +285,13 @@ static fp_40_24_t digital_from_analog_rf(
285285{
286286 fp_40_24_t offset = compute_offset (radio , opmode , rotation );
287287 fp_40_24_t drf = arf ;
288- if (rotation > 0x80 ) {
288+ if (rotation > 0x80000000 ) {
289289 if (offset > arf ) {
290290 drf = offset - arf ;
291291 } else {
292292 drf = arf - offset ;
293293 }
294- } else if ((rotation & 0x7f ) > 0x00 ) {
294+ } else if ((rotation & 0x7fffffff ) > 0 ) {
295295 drf = arf + offset ;
296296 }
297297 return drf ;
@@ -310,9 +310,9 @@ static fp_40_24_t analog_from_digital_rf(
310310{
311311 fp_40_24_t offset = compute_offset (radio , opmode , rotation );
312312 fp_40_24_t arf = drf ;
313- if (rotation > 0x80 ) {
313+ if (rotation > 0x80000000 ) {
314314 arf = drf + offset ;
315- } else if ((rotation & 0x7f ) > 0x00 ) {
315+ } else if ((rotation & 0x7fffffff ) > 0 ) {
316316 if (offset > drf ) {
317317 arf = offset - drf ;
318318 } else {
@@ -405,8 +405,8 @@ static bool radio_update_frequency(radio_t* const radio, uint64_t* bank)
405405 case TRANSCEIVER_MODE_RX :
406406 case TRANSCEIVER_MODE_RX_SWEEP :
407407 /* Round to nearest supported rotation. */
408- rotation = (rotation + 0x20 ) & 0xc0 ;
409- if (rotation == 0x80 ) {
408+ rotation = (rotation + 0x20000000 ) & 0xc0000000 ;
409+ if (rotation == 0x80000000 ) {
410410 rotation = 0 ;
411411 }
412412 break ;
@@ -430,7 +430,7 @@ static bool radio_update_frequency(radio_t* const radio, uint64_t* bank)
430430 const tune_config_t * tune_config =
431431 select_tune_config (opmode , freq_rf );
432432 if (requested_rotation == RADIO_UNSET ) {
433- rotation = (uint8_t ) (tune_config -> shift ) << 6 ;
433+ rotation = (uint64_t ) (tune_config -> shift ) << 30 ;
434434 }
435435 analog_rf =
436436 analog_from_digital_rf (radio , freq_rf , opmode , rotation );
@@ -507,7 +507,7 @@ static bool radio_update_frequency(radio_t* const radio, uint64_t* bank)
507507 }
508508 if ((rotation != applied_rotation ) && (rotation != RADIO_UNSET )) {
509509#ifdef PRALINE
510- fpga_set_rx_quarter_shift_mode (& fpga , rotation >> 6 );
510+ fpga_set_rx_quarter_shift_mode (& fpga , rotation >> 30 );
511511#endif
512512 radio -> config [RADIO_BANK_APPLIED ][RADIO_ROTATION ] = rotation ;
513513 new_freq = true;
0 commit comments