Conditional code to use hardware multiply by default.

This commit is contained in:
dak664 2010-12-15 14:11:06 +00:00
parent 404230a047
commit 1cc336f188
2 changed files with 12 additions and 3 deletions

View file

@ -752,10 +752,14 @@ HAL_RF230_ISR()
/*Handle the incomming interrupt. Prioritized.*/ /*Handle the incomming interrupt. Prioritized.*/
if ((interrupt_source & HAL_RX_START_MASK)){ if ((interrupt_source & HAL_RX_START_MASK)){
INTERRUPTDEBUG(10); INTERRUPTDEBUG(10);
/* Save RSSI for this packet if not in extended mode, scaling to 1dB resolution (avoiding multiply) */ /* Save RSSI for this packet if not in extended mode, scaling to 1dB resolution */
#if !RF230_CONF_AUTOACK #if !RF230_CONF_AUTOACK
#if 0 // 3-clock shift and add is faster on machines with no hardware multiply
rf230_last_rssi = hal_subregister_read(SR_RSSI); rf230_last_rssi = hal_subregister_read(SR_RSSI);
rf230_last_rssi = (rf230_last_rssi <<1) + rf230_last_rssi; rf230_last_rssi = (rf230_last_rssi <<1) + rf230_last_rssi;
#else // Faster with 1-clock multiply. Raven and Jackdaw have 2-clock multiply so same speed while saving 2 bytes of program memory
rf230_last_rssi = 3 * hal_subregister_read(SR_RSSI);
#endif
#endif #endif
// if(rx_start_callback != NULL){ // if(rx_start_callback != NULL){
// /* Read Frame length and call rx_start callback. */ // /* Read Frame length and call rx_start callback. */

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: rf230bb.c,v 1.18 2010/12/14 22:34:18 dak664 Exp $ * @(#)$Id: rf230bb.c,v 1.19 2010/12/15 14:11:06 dak664 Exp $
*/ */
/* /*
* This code is almost device independent and should be easy to port. * This code is almost device independent and should be easy to port.
@ -1231,8 +1231,13 @@ rf230_get_raw_rssi(void)
if ((state==RX_AACK_ON) || (state==BUSY_RX_AACK)) { if ((state==RX_AACK_ON) || (state==BUSY_RX_AACK)) {
rssi = hal_subregister_read(SR_ED_LEVEL); //0-84, resolution 1 dB rssi = hal_subregister_read(SR_ED_LEVEL); //0-84, resolution 1 dB
} else { } else {
#if 0 // 3-clock shift and add is faster on machines with no hardware multiply
rssi = hal_subregister_read(SR_RSSI); //0-28, resolution 3 dB rssi = hal_subregister_read(SR_RSSI); //0-28, resolution 3 dB
rssi = (rssi << 1) + rssi; //fast multiply by 3 rssi = (rssi << 1) + rssi; //*3
#else // Faster with 1-clock multiply. Raven and Jackdaw have 2-clock multiply so same speed while saving 2 bytes of program memory
rssi = 3 * hal_subregister_read(SR_RSSI);
#endif
} }
if(radio_was_off) { if(radio_was_off) {