Return TRAC_STATUS register when tx autoretry is enabled.
This commit is contained in:
parent
433d42e170
commit
9c9d7ec5e9
|
@ -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.16 2010/12/04 21:32:35 dak664 Exp $
|
* @(#)$Id: rf230bb.c,v 1.17 2010/12/05 17:28:29 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.
|
||||||
|
@ -146,8 +146,6 @@ static unsigned long total_time_for_transmission, total_transmission_len;
|
||||||
static int num_transmissions;
|
static int num_transmissions;
|
||||||
#endif /* RF230_CONF_TIMESTAMPS */
|
#endif /* RF230_CONF_TIMESTAMPS */
|
||||||
|
|
||||||
int rf230_packets_seen, rf230_packets_read;
|
|
||||||
|
|
||||||
static uint8_t volatile pending;
|
static uint8_t volatile pending;
|
||||||
|
|
||||||
/* RF230 hardware delay times, from datasheet */
|
/* RF230 hardware delay times, from datasheet */
|
||||||
|
@ -597,6 +595,7 @@ rf230_transmit(unsigned short payload_len)
|
||||||
int txpower;
|
int txpower;
|
||||||
uint8_t total_len;
|
uint8_t total_len;
|
||||||
uint8_t radiowason;
|
uint8_t radiowason;
|
||||||
|
uint8_t tx_result;
|
||||||
#if RF230_CONF_TIMESTAMPS
|
#if RF230_CONF_TIMESTAMPS
|
||||||
struct timestamp timestamp;
|
struct timestamp timestamp;
|
||||||
#endif /* RF230_CONF_TIMESTAMPS */
|
#endif /* RF230_CONF_TIMESTAMPS */
|
||||||
|
@ -660,6 +659,12 @@ rf230_transmit(unsigned short payload_len)
|
||||||
accurate measurement of the transmission time.*/
|
accurate measurement of the transmission time.*/
|
||||||
rf230_waitidle();
|
rf230_waitidle();
|
||||||
|
|
||||||
|
/* Get the transmission result */
|
||||||
|
#if RF230_CONF_AUTORETRIES
|
||||||
|
tx_result = hal_subregister_read(SR_TRAC_STATUS);
|
||||||
|
#else
|
||||||
|
tx_result=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
|
#ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
|
||||||
ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,rf230_get_txpower());
|
ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,rf230_get_txpower());
|
||||||
|
@ -701,20 +706,17 @@ rf230_transmit(unsigned short payload_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
RELEASE_LOCK();
|
RELEASE_LOCK();
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* If we are using WITH_SEND_CCA, we get here if the packet wasn't
|
if (tx_result==1) { //success, data pending from adressee
|
||||||
transmitted because of other channel activity. */
|
tx_result=0; //Just show success?
|
||||||
// RIMESTATS_ADD(contentiondrop);
|
} else if (tx_result==3) { //CSMA channel access failure
|
||||||
// PRINTF("rf230: do_send() transmission never started\n");
|
RIMESTATS_ADD(contentiondrop);
|
||||||
|
PRINTF("rf230_transmit: Transmission never started\n");
|
||||||
|
//} else if (tx_result==5) { //Expected ACK, none received
|
||||||
|
//} else if (tx_result==7) { //Invalid (Can't happen since waited for idle above?)
|
||||||
|
}
|
||||||
|
|
||||||
//if(packetbuf_attr(PACKETBUF_ATTR_RADIO_TXPOWER) > 0) {
|
return tx_result;
|
||||||
/* Restore the transmission power */
|
|
||||||
// set_txpower(txpower & 0xff);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// RELEASE_LOCK();
|
|
||||||
// return -3; /* Transmission never started! */
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
|
@ -954,7 +956,6 @@ if (RF230_receive_on) {
|
||||||
#if RADIOSTATS
|
#if RADIOSTATS
|
||||||
RF230_receivepackets++;
|
RF230_receivepackets++;
|
||||||
#endif
|
#endif
|
||||||
rf230_packets_seen++;
|
|
||||||
|
|
||||||
#if RADIOALWAYSON
|
#if RADIOALWAYSON
|
||||||
} else {
|
} else {
|
||||||
|
@ -1060,7 +1061,6 @@ if (RF230_receive_on) {
|
||||||
rf230_time_of_departure = 0;
|
rf230_time_of_departure = 0;
|
||||||
#endif /* RF230_CONF_TIMESTAMPS */
|
#endif /* RF230_CONF_TIMESTAMPS */
|
||||||
// GET_LOCK();
|
// GET_LOCK();
|
||||||
rf230_packets_read++;
|
|
||||||
|
|
||||||
//if(len > RF230_MAX_PACKET_LEN) {
|
//if(len > RF230_MAX_PACKET_LEN) {
|
||||||
if(len > RF230_MAX_TX_FRAME_LENGTH) {
|
if(len > RF230_MAX_TX_FRAME_LENGTH) {
|
||||||
|
|
Loading…
Reference in a new issue