示例#1
0
文件: ethernet.c 项目: rasco/armnet
// This function gets called at every interrupt caused by the EMAC
void ethernet_irq()
{
    unsigned int status = DEREF_INT(ADDR_ETH_BASE+ADDR_ETH_ISR);
    dprintf("Ethernet Interrupt ETH_ISR: %x\n", status);
    //DEREF_INT(ADDR_ETH_BASE+ADDR_ETH_RSR) = 7;
    
    if ( status & 1 << 2 )
        DEREF_INT(ADDR_ETH_BASE+ADDR_ETH_RBQP) = (int)rbq;
    if ( status & 1<<1 || status & 1<<2 ) // Receive Complete
    {
        //printf("Receive complete\n");
        ethernet_recv();
    }
}
示例#2
0
文件: ethernet.c 项目: nekogigi/kozos
static int ethernet_proc(struct netbuf *buf)
{
    int ret = 0;
    switch (buf->cmd) {
    case ETHERNET_CMD_MACADDR:
        memcpy(my_macaddr, buf->option.common.macaddr.addr, MACADDR_SIZE);
        buf->cmd = ARP_CMD_MACADDR;
        kz_send(MSGBOX_ID_ARPPROC, 0, (char *)buf);
        initialized++;
        ret = 1;
        break;
    case ETHERNET_CMD_RECV:
        ret = ethernet_recv(buf);
        break;
    case ETHERNET_CMD_SEND:
        ret = ethernet_send(buf);
        break;
    default:
        break;
    }
    return ret;
}