minor performance improvements
=> reducing the number of interrupts
This commit is contained in:
parent
1ada6d15af
commit
1fabe449dd
2 changed files with 15 additions and 4 deletions
|
@ -349,7 +349,7 @@ static void rckemacif_input(struct netif* netif, struct pbuf* p)
|
|||
#endif /* PPPOE_SUPPORT */
|
||||
/*
|
||||
* This function is called in the context of the tcpip thread.
|
||||
* Therefore, we are able to call directly the input functions
|
||||
* Therefore, we are able to call directly the input functions.
|
||||
*/
|
||||
err = ethernet_input(p, netif);
|
||||
if (err != ERR_OK) {
|
||||
|
@ -501,6 +501,11 @@ rxDone:
|
|||
|
||||
if (read_offset != write_offset)
|
||||
goto again;
|
||||
|
||||
/* Enable eMAC interrupt */
|
||||
int tmp = *((volatile int*) (FPGA_BASE + IRQ_MASK + rckemacif->core * 2 * 4));
|
||||
*((volatile int*) (FPGA_BASE + IRQ_MASK + rckemacif->core * 2 * 4)) = tmp & ~(1 << rckemacif->num_emac);
|
||||
rckemacif->polling = 0;
|
||||
}
|
||||
|
||||
/* this function is called in the context of the tcpip thread */
|
||||
|
@ -528,8 +533,13 @@ static void rckemacif_handler(struct state* s)
|
|||
/* check for updated write offset */
|
||||
write_offset = *((volatile unsigned int*) (rckemacif->rx_buffer)) & 0xFFFF;
|
||||
//write_offset = read_emac(rckemacif->num_emac, EMAC_RX_CONTROL + EMAC_RX_BUFFER_WRITE_OFFSET, rckemacif->core);
|
||||
if ((write_offset != 0) && (rckemacif->rx_read_offset != write_offset)) {
|
||||
if (tcpip_callback_with_block(rckemacif_poll, (void*) write_offset, 0) != ERR_OK) {
|
||||
if ((write_offset != 0) && (rckemacif->rx_read_offset != write_offset) && !rckemacif->polling) {
|
||||
if (tcpip_callback_with_block(rckemacif_poll, (void*) write_offset, 0) == ERR_OK) {
|
||||
/* Maks eMAC interrupt */
|
||||
int tmp = *((volatile int*) (FPGA_BASE + IRQ_MASK + rckemacif->core * 2 * 4));
|
||||
*((volatile int*) (FPGA_BASE + IRQ_MASK + rckemacif->core * 2 * 4)) = tmp | (1 << rckemacif->num_emac);
|
||||
rckemacif->polling = 1;
|
||||
} else {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_handler: unable to send a poll request to the tcpip thread\n"));
|
||||
}
|
||||
}
|
||||
|
@ -572,7 +582,7 @@ err_t rckemacif_init(struct netif* netif)
|
|||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_init: out of memory\n"));
|
||||
return ERR_MEM;
|
||||
}
|
||||
memset(rckemacif, 0, sizeof(rckemacif_t));
|
||||
memset(rckemacif, 0x00, sizeof(rckemacif_t));
|
||||
rckemacif->core = core;
|
||||
|
||||
/* allocate the receive buffer */
|
||||
|
|
|
@ -39,6 +39,7 @@ typedef struct rckemacif {
|
|||
void* irq_address;
|
||||
uint32_t core;
|
||||
uint32_t num_emac;
|
||||
volatile uint8_t polling;
|
||||
} rckemacif_t;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue