add SCC-related stuff to support the tickless kernel

This commit is contained in:
Stefan Lankes 2012-07-03 10:58:20 -07:00
parent 24914fcb4f
commit 4255cc0a6b
3 changed files with 25 additions and 0 deletions

View file

@ -120,7 +120,9 @@
#define MMNIF_PSEUDO_SOCKET_START 0x31337
#if LWIP_SOCKET
static int npseudosocket = MMNIF_PSEUDO_SOCKET_START;
#endif
static spinlock_t pseudolock;
/* "message passing buffer" specific constants:
@ -527,6 +529,7 @@ static int mmnif_commit_packet(uint8_t dest, uint32_t addr)
return -1;
}
#if LWIP_SOCKET
/* mmnif_commit_packet: this function set the state of the (in advance)
* allocated packet to RDY so the recieve queue knows that it can be
* processed further
@ -549,6 +552,7 @@ static int mmnif_commit_packet_bypass(uint8_t dest, uint32_t addr, int dest_sock
return -1;
}
#endif
/* mmnif_rxbuff_free() : the opposite to mmnif_rxbuff_alloc() a from the receiver
* already processed chunk of memory is freed so that it can be allocated again
@ -691,6 +695,7 @@ static bypass_rxdesc_t *mmnif_hashlookup(int s)
return 0;
}
#if LWIP_SOCKET
/* mmnif_hashadd(): adds a entry to the hashtable
* by the socket
*/
@ -840,6 +845,7 @@ int mmnif_send(int s, void *data, size_t size, int flags)
return lwip_send(s, data, size, flags);
}
#endif
/* mmnif_link_layer(): wrapper function called by ip_output()
* adding all needed headers for the link layer
@ -1189,6 +1195,7 @@ out:
return;
}
#if LWIP_SOCKET
/* mmnif_rx_bypass(): recieve packets
* with insane speed ;)
*/
@ -1549,6 +1556,7 @@ int mmnif_closesocket(int s)
return 0;
}
#endif
/* mmnif_irqhandler():
* handles the incomint interrupts
@ -1571,11 +1579,15 @@ static void mmnif_irqhandler(struct state* s)
mmnif = (mmnif_t *) mmnif_dev->state;
if (!mmnif->check_in_progress) {
#if NO_SYS
mmnif_rx((void*) mmnif_dev);
#else
if (tcpip_callback_with_block(mmnif_rx, (void*) mmnif_dev, 0) == ERR_OK) {
mmnif->check_in_progress = 1;
} else {
DEBUGPRINTF("rckemacif_handler: unable to send a poll request to the tcpip thread\n");
}
#endif
}
tmp = ReadConfigReg(CRB_OWN + (z==0 ? GLCFG0 : GLCFG1));
@ -1596,7 +1608,12 @@ err_t mmnif_shutdown(void)
return ERR_MEM;
}
#if NO_SYS
netif_set_down(mmnif_dev);
err = ERR_OK;
#else
err = netifapi_netif_set_down(mmnif_dev);
#endif
//RCCE_shfree(mpb_start_address);
mmnif_dev = NULL;

View file

@ -536,6 +536,9 @@ void rckemacif_handler(struct state* s, uint32_t status)
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) && !rckemacif->polling) {
#if NO_SYS
rckemacif_poll((void*) write_offset);
#else
if (tcpip_callback_with_block(rckemacif_poll, (void*) write_offset, 0) == ERR_OK) {
/* Mask eMAC interrupt */
unsigned int tmp = *((volatile unsigned int*) (FPGA_BASE + IRQ_MASK + rckemacif->core * 2 * 4));
@ -546,6 +549,7 @@ void rckemacif_handler(struct state* s, uint32_t status)
} else {
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_handler: unable to send a poll request to the tcpip thread\n"));
}
#endif
}
}

View file

@ -212,7 +212,11 @@ int network_shutdown(void)
{
#if defined(CONFIG_LWIP) && defined(CONFIG_ROCKCREEK)
mmnif_shutdown();
#if NO_SYS
netif_set_down(&default_netif);
#else
netifapi_netif_set_down(&default_netif);
#endif
#elif defined(CONFIG_LWIP) && defined(CONFIG_PCI)
#if NO_SYS
dhcp_stop(&default_netif);