Merge pull request #198 from atiselsts/bugfix/cc26xx-ieemode-driver

CC26xx radio IEEE mode driver: limit the time spend in waiting for transmissions to finish
This commit is contained in:
George Oikonomou 2017-11-24 10:07:16 +00:00 committed by GitHub
commit f161998a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -167,6 +167,9 @@ static uint8_t rf_stats[16] = { 0 };
/* How long to wait for the RF to react on CMD_ABORT: around 1 msec */
#define RF_TURN_OFF_WAIT_TIMEOUT (RTIMER_SECOND >> 10)
/* How long to wait for the RF to finish TX of a packet or an ACK */
#define TX_FINISH_WAIT_TIMEOUT (RTIMER_SECOND >> 7)
#define LIMITED_BUSYWAIT(cond, timeout) do { \
rtimer_clock_t end_time = RTIMER_NOW() + timeout; \
while(cond) { \
@ -697,7 +700,7 @@ rx_off(void)
}
/* Wait for ongoing ACK TX to finish */
while(transmitting());
LIMITED_BUSYWAIT(transmitting(), TX_FINISH_WAIT_TIMEOUT);
/* Send a CMD_ABORT command to RF Core */
if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_ABORT), &cmd_status) != RF_CORE_CMD_OK) {
@ -1140,7 +1143,7 @@ channel_clear(void)
*
* We could probably even simply return that the channel is clear
*/
while(transmitting());
LIMITED_BUSYWAIT(transmitting(), TX_FINISH_WAIT_TIMEOUT);
} else {
was_off = 1;
if(on() != RF_CORE_CMD_OK) {
@ -1297,7 +1300,7 @@ off(void)
return RF_CORE_CMD_OK;
}
while(transmitting());
LIMITED_BUSYWAIT(transmitting(), TX_FINISH_WAIT_TIMEOUT);
/* stopping the rx explicitly results in lower sleep-mode power usage */
rx_off();