source: rtems/c/src/lib/libbsp/sparc/leon3/leon_greth/leon_greth.c @ 44b06ca

4.104.115
Last change on this file since 44b06ca was 44b06ca, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/29/09 at 15:33:28

Whitespace removal.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  LEON3 Opencores Ethernet MAC Configuration Information
3 *
4 *  COPYRIGHT (c) 2004.
5 *  Gaisler Research
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  leon_open_eth.c,v 1.1.2.1 2005/10/05 19:26:00 joel Exp
12 */
13
14
15#include <bsp.h>
16#include <libchip/greth.h>
17/*#if (GRETH_DEBUG & GRETH_DEBUG_PRINT_REGISTERS)*/
18#include <stdio.h>
19/*#endif*/
20
21/*
22 * Default sizes of transmit and receive descriptor areas
23 */
24#define RDA_COUNT     32
25#define TDA_COUNT     32
26
27greth_configuration_t leon_greth_configuration;
28
29int rtems_leon_greth_driver_attach(
30  struct rtems_bsdnet_ifconfig *config,
31  int attach
32)
33{
34  int device_found = 0;
35  unsigned int base_addr = 0; /* avoid warnings */
36  unsigned int eth_irq = 0;   /* avoid warnings */
37        amba_apb_device apbgreth;
38
39  /* Scan for MAC AHB slave interface */
40        device_found = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_ETHMAC,&apbgreth);
41  if (device_found == 1)
42  {
43                base_addr = apbgreth.start;
44                eth_irq = apbgreth.irq + 0x10;
45
46    /* clear control register and reset NIC */
47    *(volatile int *) base_addr = 0;
48    *(volatile int *) base_addr = GRETH_CTRL_RST;
49    *(volatile int *) base_addr = 0;
50    leon_greth_configuration.base_address = base_addr;
51    leon_greth_configuration.vector = eth_irq;
52    leon_greth_configuration.txd_count = TDA_COUNT;
53    leon_greth_configuration.rxd_count = RDA_COUNT;
54    if (rtems_greth_driver_attach( config, &leon_greth_configuration )) {
55      LEON_Clear_interrupt(leon_greth_configuration.vector);
56      LEON_Unmask_interrupt(leon_greth_configuration.vector);
57    }
58  }
59  return 0;
60}
Note: See TracBrowser for help on using the repository browser.