add the possibility to enable the L1 cache for the receive buffer
This commit is contained in:
parent
903f33f40b
commit
ada6dc727a
1 changed files with 15 additions and 0 deletions
|
@ -43,6 +43,15 @@
|
|||
#include <netif/etharp.h>
|
||||
#include <net/rckemac.h>
|
||||
|
||||
/* enables the cache for the receive buffers */
|
||||
//#define RX_CACHING 1
|
||||
|
||||
#ifdef RX_CACHING
|
||||
#define CL1INV asm volatile ( ".byte 0x0f; .byte 0x0a;\n" ) // CL1FLUSHMB
|
||||
#else
|
||||
#define CL1INV
|
||||
#endif
|
||||
|
||||
/* Limits */
|
||||
#define BUFFER_ORDER 9
|
||||
#define BUFFER_NUM (1 << BUFFER_ORDER)
|
||||
|
@ -379,6 +388,8 @@ static void rckemacif_rx_handler(struct netif* netif, unsigned int write_offset)
|
|||
}
|
||||
|
||||
again:
|
||||
CL1INV; // invalidate L1 cache entries of the receiver buffers
|
||||
|
||||
read_offset++;
|
||||
if (read_offset < 1 || read_offset > rckemacif->rx_buffer_max) {
|
||||
read_offset = 1;
|
||||
|
@ -586,7 +597,11 @@ err_t rckemacif_init(struct netif* netif)
|
|||
rckemacif->core = core;
|
||||
|
||||
/* allocate the receive buffer */
|
||||
#ifdef RX_CACHING
|
||||
rckemacif->rx_buffer = mem_allocation(BUFFER_SIZE, MAP_KERNEL_SPACE|MAP_MPE);
|
||||
#else
|
||||
rckemacif->rx_buffer = mem_allocation(BUFFER_SIZE, MAP_KERNEL_SPACE|MAP_NO_CACHE);
|
||||
#endif
|
||||
if (!(rckemacif->rx_buffer)) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_init: out of memory\n"));
|
||||
kfree(rckemacif, sizeof(rckemacif_t));
|
||||
|
|
Loading…
Add table
Reference in a new issue