Lines Matching +full:layers +full:- +full:configurable
2 Ported to U-Boot by Christian Pellegrin <chri@ascensit.com>
16 -------------------------------------------
17 This file is part of eCos, the Embedded Configurable Operating System.
31 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
44 at http://sources.redhat.com/ecos/ecos-license/
45 -------------------------------------------
49 -------------------------------------------
54 -------------------------------------------
62 Date: 2001-06-13
114 base = dp->base; in dp83902a_init()
126 DP_IN(base, DP_P1_PAR0+i, dp->esa[i]); in dp83902a_init()
129 printf("NE2000 - %s ESA: %02x:%02x:%02x:%02x:%02x:%02x\n", in dp83902a_init()
131 dp->esa[0], in dp83902a_init()
132 dp->esa[1], in dp83902a_init()
133 dp->esa[2], in dp83902a_init()
134 dp->esa[3], in dp83902a_init()
135 dp->esa[4], in dp83902a_init()
136 dp->esa[5] ); in dp83902a_init()
138 memcpy(enetaddr, dp->esa, 6); /* Use MAC from serial EEPROM */ in dp83902a_init()
147 u8 *base = dp->base; in dp83902a_stop()
155 dp->running = false; in dp83902a_stop()
168 u8 *base = dp->base; in dp83902a_start()
181 DP_OUT(base, DP_TPSR, dp->tx_buf1); /* Transmitter start page */ in dp83902a_start()
182 dp->tx1 = dp->tx2 = 0; in dp83902a_start()
183 dp->tx_next = dp->tx_buf1; in dp83902a_start()
184 dp->tx_started = false; in dp83902a_start()
185 dp->running = true; in dp83902a_start()
186 DP_OUT(base, DP_PSTART, dp->rx_buf_start); /* Receive ring start page */ in dp83902a_start()
187 DP_OUT(base, DP_BNDRY, dp->rx_buf_end - 1); /* Receive ring boundary */ in dp83902a_start()
188 DP_OUT(base, DP_PSTOP, dp->rx_buf_end); /* Receive ring end page */ in dp83902a_start()
189 dp->rx_next = dp->rx_buf_start - 1; in dp83902a_start()
190 dp->running = true; in dp83902a_start()
194 DP_OUT(base, DP_P1_CURP, dp->rx_buf_start); /* Current page - next free page for Rx */ in dp83902a_start()
195 dp->running = true; in dp83902a_start()
206 dp->running = true; in dp83902a_start()
219 u8 *base = dp->base; in dp83902a_start_xmit()
225 if (dp->tx_started) in dp83902a_start_xmit()
236 dp->tx_started = true; in dp83902a_start_xmit()
240 * This routine is called to send data to the hardware. It is known a-priori
241 * that there is free buffer space (dp->tx_next).
247 u8 *base = dp->base; in dp83902a_send()
259 start_page = dp->tx_next; in dp83902a_send()
260 if (dp->tx_next == dp->tx_buf1) { in dp83902a_send()
261 dp->tx1 = start_page; in dp83902a_send()
262 dp->tx1_len = pkt_len; in dp83902a_send()
263 dp->tx1_key = key; in dp83902a_send()
264 dp->tx_next = dp->tx_buf2; in dp83902a_send()
266 dp->tx2 = start_page; in dp83902a_send()
267 dp->tx2_len = pkt_len; in dp83902a_send()
268 dp->tx2_key = key; in dp83902a_send()
269 dp->tx_next = dp->tx_buf1; in dp83902a_send()
287 DP_OUT(base, DP_RSAL, 0x100 - len); in dp83902a_send()
288 DP_OUT(base, DP_RSAH, (start_page - 1) & 0xff); in dp83902a_send()
292 DP_IN_DATA(dp->data, tmp); in dp83902a_send()
321 DP_OUT_DATA(dp->data, *data++); in dp83902a_send()
322 len--; in dp83902a_send()
329 printf(" + %d bytes of padding\n", pkt_len - total_len); in dp83902a_send()
334 DP_OUT_DATA(dp->data, 0); in dp83902a_send()
356 if (!dp->tx_started) { in dp83902a_send()
357 if (start_page == dp->tx1) { in dp83902a_send()
358 dp->tx_int = 1; /* Expecting interrupt from BUF1 */ in dp83902a_send()
360 dp->tx_int = 2; /* Expecting interrupt from BUF2 */ in dp83902a_send()
377 u8 *base = dp->base; in dp83902a_RxEvent()
393 if (pkt == dp->rx_buf_end) in dp83902a_RxEvent()
394 pkt = dp->rx_buf_start; in dp83902a_RxEvent()
403 if (dp->rx_next == pkt) { in dp83902a_RxEvent()
404 if (cur == dp->rx_buf_start) in dp83902a_RxEvent()
405 DP_OUT(base, DP_BNDRY, dp->rx_buf_end - 1); in dp83902a_RxEvent()
407 DP_OUT(base, DP_BNDRY, cur - 1); /* Update pointer */ in dp83902a_RxEvent()
410 dp->rx_next = pkt; in dp83902a_RxEvent()
419 DP_IN_DATA(dp->data, rcv_hdr[i++]); in dp83902a_RxEvent()
426 len = ((rcv_hdr[3] << 8) | rcv_hdr[2]) - sizeof(rcv_hdr); in dp83902a_RxEvent()
431 if (rcv_hdr[1] == dp->rx_buf_start) in dp83902a_RxEvent()
432 DP_OUT(base, DP_BNDRY, dp->rx_buf_end - 1); in dp83902a_RxEvent()
434 DP_OUT(base, DP_BNDRY, rcv_hdr[1] - 1); /* Update pointer */ in dp83902a_RxEvent()
442 * may come in pieces, using a scatter-gather list. This allows for more
443 * efficient processing in the upper layers of the stack.
449 u8 *base = dp->base; in dp83902a_recv()
460 printf("Rx packet %d length %d\n", dp->rx_next, len); in dp83902a_recv()
468 DP_OUT(base, DP_RSAH, dp->rx_next); in dp83902a_recv()
487 mlen--; in dp83902a_recv()
494 DP_IN_DATA(dp->data, tmp); in dp83902a_recv()
500 mlen--; in dp83902a_recv()
514 u8 *base = dp->base; in dp83902a_TxEvent()
521 if (dp->tx_int == 1) { in dp83902a_TxEvent()
522 key = dp->tx1_key; in dp83902a_TxEvent()
523 dp->tx1 = 0; in dp83902a_TxEvent()
525 key = dp->tx2_key; in dp83902a_TxEvent()
526 dp->tx2 = 0; in dp83902a_TxEvent()
529 dp->tx_started = false; in dp83902a_TxEvent()
530 if (dp->tx1) { in dp83902a_TxEvent()
531 dp83902a_start_xmit(dp->tx1, dp->tx1_len); in dp83902a_TxEvent()
532 dp->tx_int = 1; in dp83902a_TxEvent()
533 } else if (dp->tx2) { in dp83902a_TxEvent()
534 dp83902a_start_xmit(dp->tx2, dp->tx2_len); in dp83902a_TxEvent()
535 dp->tx_int = 2; in dp83902a_TxEvent()
537 dp->tx_int = 0; in dp83902a_TxEvent()
551 u8 *base = dp->base; in dp83902a_ClearCounters()
568 u8 *base = dp->base; in dp83902a_Overflow()
600 if (dp->tx_started && !(isr & (DP_ISR_TxP|DP_ISR_TxE))) { in dp83902a_Overflow()
609 u8 *base = dp->base; in dp83902a_poll()
637 if (!dp->running) break; /* Is this necessary? */ in dp83902a_poll()
642 if (isr & (DP_ISR_TxP|DP_ISR_TxE) && dp->tx_started) { in dp83902a_poll()
654 /* U-Boot specific routines */
657 static int pkey = -1;
681 * @param struct ethdevice of this instance of the driver for dev->enetaddr
682 * @return 0 on success, -1 on error (causing caller to print error msg)
692 return -1; in ne2k_setup_driver()
719 if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr)) { in ne2k_setup_driver()
721 if (!get_prom(dev->enetaddr, nic.base)) /* get MAC from prom */ in ne2k_setup_driver()
722 dp83902a_init(dev->enetaddr); /* fallback: seeprom */ in ne2k_setup_driver()
724 * returns -1 due to eth_env_get_enetaddr_by_index() failing, in ne2k_setup_driver()
727 eth_env_set_enetaddr("ethaddr", dev->enetaddr); in ne2k_setup_driver()
734 dp83902a_start(dev->enetaddr); in ne2k_init()
759 pkey = -1; in ne2k_send()
765 if (pkey != -1) { in ne2k_send()
780 * @return 0 on success, -1 on error (causing caller to print error msg)
788 return -1; in ne2k_register()
791 return -1; in ne2k_register()
793 dev->init = ne2k_init; in ne2k_register()
794 dev->halt = ne2k_halt; in ne2k_register()
795 dev->send = ne2k_send; in ne2k_register()
796 dev->recv = ne2k_recv; in ne2k_register()
798 strcpy(dev->name, "NE2000"); in ne2k_register()