small improvment to count_packets
This commit is contained in:
parent
2fcfe11096
commit
64081c2fb8
|
@ -74,6 +74,8 @@
|
||||||
|
|
||||||
#define reg(x) (*(volatile uint32_t *)(x))
|
#define reg(x) (*(volatile uint32_t *)(x))
|
||||||
|
|
||||||
|
int count_packets(void);
|
||||||
|
|
||||||
static volatile packet_t packet_pool[NUM_PACKETS];
|
static volatile packet_t packet_pool[NUM_PACKETS];
|
||||||
static volatile packet_t *free_head, *rx_end, *tx_end, *dma_tx, *dma_rx;
|
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;
|
total = free + rx + tx;
|
||||||
if(dma_rx) { total++; }
|
if(dma_rx && (dma_rx != rx_head)) { total++; }
|
||||||
if(dma_tx) { total++; }
|
if(dma_tx && (dma_tx != tx_head)) { total++; }
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue