Removed ContikiMAC burst dependency to phase optimization

This commit is contained in:
simonduq 2011-10-04 10:29:40 +02:00
parent e0ae036a69
commit a2073db715
3 changed files with 7 additions and 17 deletions

View file

@ -548,7 +548,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_
#if WITH_PHASE_OPTIMIZATION
ret = phase_wait(&phase_list, packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
CYCLE_TIME, GUARD_TIME,
mac_callback, mac_callback_ptr, buf_list, 0);
mac_callback, mac_callback_ptr, buf_list);
if(ret == PHASE_DEFERRED) {
return MAC_TX_DEFERRED;
}
@ -748,14 +748,8 @@ qsend_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
}
/* Do not send during reception of a burst */
if(we_are_receiving_burst) {
queuebuf_to_packetbuf(curr->buf);
/* We try to defer, and return an error this wasn't possible */
int ret = phase_wait(&phase_list, packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
CYCLE_TIME, GUARD_TIME,
sent, ptr, curr, 2);
if(ret != PHASE_DEFERRED) {
mac_call_sent_callback(sent, ptr, MAC_TX_ERR, 1);
}
/* Return COLLISION so the MAC may try again later */
mac_call_sent_callback(sent, ptr, MAC_TX_COLLISION, 1);
return;
}
/* The receiver needs to be awoken before we send */

View file

@ -167,7 +167,7 @@ phase_wait(struct phase_list *list,
const rimeaddr_t *neighbor, rtimer_clock_t cycle_time,
rtimer_clock_t guard_time,
mac_callback_t mac_callback, void *mac_callback_ptr,
struct rdc_buf_list *buf_list, int extra_deferment)
struct rdc_buf_list *buf_list)
{
struct phase *e;
// const rimeaddr_t *neighbor = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
@ -176,7 +176,7 @@ phase_wait(struct phase_list *list,
time for the next expected phase and setup a ctimer to switch on
the radio just before the phase. */
e = find_neighbor(list, neighbor);
if((e != NULL) | extra_deferment) {
if(e != NULL) {
rtimer_clock_t wait, now, expected, sync;
clock_time_t ctimewait;
@ -202,14 +202,10 @@ phase_wait(struct phase_list *list,
if(wait < guard_time) {
wait += cycle_time;
}
if(extra_deferment) {
wait += extra_deferment * cycle_time;
}
ctimewait = (CLOCK_SECOND * (wait - guard_time)) / RTIMER_ARCH_SECOND;
if((ctimewait > PHASE_DEFER_THRESHOLD) | extra_deferment) {
if(ctimewait > PHASE_DEFER_THRESHOLD) {
struct phase_queueitem *p;
p = memb_alloc(&queued_packets_memb);

View file

@ -76,7 +76,7 @@ void phase_init(struct phase_list *list);
phase_status_t phase_wait(struct phase_list *list, const rimeaddr_t *neighbor,
rtimer_clock_t cycle_time, rtimer_clock_t wait_before,
mac_callback_t mac_callback, void *mac_callback_ptr,
struct rdc_buf_list *buf_list, int extra_deferment);
struct rdc_buf_list *buf_list);
void phase_update(const struct phase_list *list, const rimeaddr_t *neighbor,
rtimer_clock_t time, int mac_status);