From 64081c2fb8c839b5ade7f5f6d776ff1bc8731a46 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Fri, 21 May 2010 12:38:19 -0400 Subject: [PATCH] small improvment to count_packets --- lib/maca.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/maca.c b/lib/maca.c index acb8d9409..05eb21bd8 100644 --- a/lib/maca.c +++ b/lib/maca.c @@ -74,6 +74,8 @@ #define reg(x) (*(volatile uint32_t *)(x)) +int count_packets(void); + static volatile packet_t packet_pool[NUM_PACKETS]; static volatile packet_t *free_head, *rx_end, *tx_end, *dma_tx, *dma_rx; @@ -223,8 +225,8 @@ int count_packets(void) { } total = free + rx + tx; - if(dma_rx) { total++; } - if(dma_tx) { total++; } + if(dma_rx && (dma_rx != rx_head)) { total++; } + if(dma_tx && (dma_tx != tx_head)) { total++; } return total; }