X-Git-Url: https://git.llucax.com/z.facultad/66.09/etherled.git/blobdiff_plain/2cf7241a2ec32fd51b6d859c2eb0317b23739609..fbc34c6cf2195ded81d1f3736c6bc710823c320c:/src/dp8390.c diff --git a/src/dp8390.c b/src/dp8390.c index c56bb84..5c472a5 100644 --- a/src/dp8390.c +++ b/src/dp8390.c @@ -247,6 +247,10 @@ bool netdev_init() /** Comienza el envío de un nuevo frame */ void netdev_send_start() { + // Wait until pending transmit operation completes. + while (read_reg(CR) & TXP) continue; + write_reg(ISR, PTX); // Limpio bit de interrupción + // Set remote DMA start address registers to indicate where to load packet. write_reg(RSAR0, 0u); write_reg(RSAR1, TX_PAGE_START); @@ -272,15 +276,26 @@ void netdev_send_end(byte len) // Issue command for RTL8019AS to transmit packet from it's local buffer. write_reg(CR, START | TXP); - - // Wait until pending transmit operation completes. - while(read_reg(CR) & TXP) continue; } void netdev_write_start(byte len) { // Set remote DMA byte count registers to indicate length of packet load. - write_reg(RBCR0, len); // Tamaño máximo en principio + write_reg(RBCR0, len); + write_reg(RBCR1, 0u); + + // Initiate DMA transfer of uip_buf & uip_appdata buffers to RTL8019AS. + write_reg(CR, WRITE); +} + +void netdev_write_start_at(byte offset, byte len) +{ + // Set remote DMA start address registers to packet data. + write_reg(RSAR0, offset); + write_reg(RSAR1, TX_PAGE_START); + + // Set remote DMA byte count registers to indicate length of packet load. + write_reg(RBCR0, len); write_reg(RBCR1, 0u); // Initiate DMA transfer of uip_buf & uip_appdata buffers to RTL8019AS. @@ -333,7 +348,7 @@ byte netdev_recv_start() printb(read_reg(ISR), 0x01); printb(read_reg(BNRY), 0x02); printb(current, 0x04); - ledsb(0x00, 0x00); + printb(0x00, 0x00); reset(); } return 0;