source: rtems/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c @ 37f09415

Last change on this file since 37f09415 was d2a30c77, checked in by Joel Sherrill <joel.sherrill@…>, on 10/05/05 at 19:25:45

2005-10-05 Jiri Gaisler <jiri@…>

Edvin Catovic <edvin@…>
Konrad Eisele <konrad@…>

PR 827/bsps

  • .cvsignore, ChangeLog?, Makefile.am, README, bsp_specs, configure.ac, times, clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, console/.cvsignore, console/Makefile.am, console/console.c, console/consolereserveresources.c, console/debugputs.c, gnatsupp/.cvsignore, gnatsupp/Makefile.am, gnatsupp/gnatsupp.c, include/.cvsignore, include/Makefile.am, include/bsp.h, include/coverhd.h, include/leon.h, leon_open_eth/.cvsignore, leon_open_eth/Makefile.am, leon_open_eth/leon_open_eth.c, leon_smc91111/.cvsignore, leon_smc91111/Makefile.am, leon_smc91111/leon_smc91111.c, start/.cvsignore, start/Makefile.am, startup/.cvsignore, startup/Makefile.am, startup/linkcmds, startup/setvec.c, startup/spurious.c, timer/.cvsignore, timer/Makefile.am, timer/timer.c, tools/.cvsignore, tools/ChangeLog, tools/Makefile.am, tools/configure.ac, tools/runtest.in, wrapup/.cvsignore, wrapup/Makefile.am: New files.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  LEON2 Opencores Ethernet MAC Configuration Information
3 *
4 *  $Id$
5 */
6
7
8#include <bsp.h>
9#include <libchip/open_eth.h>
10#if (OPEN_ETH_DEBUG & OPEN_ETH_DEBUG_PRINT_REGISTERS)
11#include <stdio.h>
12#endif
13
14/*
15 * Default sizes of transmit and receive descriptor areas
16 */
17#define RDA_COUNT     16
18#define TDA_COUNT     16
19
20/*
21 * Default location of device registers
22 */
23#define OPEN_ETH_BASE_ADDRESS 0xb0000000
24
25/*
26 * Default interrupt vector
27 */
28#define OPEN_ETH_VECTOR 0x1C
29
30open_eth_configuration_t leon_open_eth_configuration = {
31  OPEN_ETH_BASE_ADDRESS,        /* base address */
32  OPEN_ETH_VECTOR,              /* vector number */
33  TDA_COUNT,                 /* number of transmit descriptors */
34  RDA_COUNT,                 /* number of receive descriptors */
35  0                   /* 100 MHz operation */
36};
37
38int rtems_leon_open_eth_driver_attach(struct rtems_bsdnet_ifconfig *config)
39{
40
41  /* clear control register and reset NIC */
42  *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0;
43  *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0x800;
44  *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0;
45
46  /* enable 100 MHz operation only if cpu frequency >= 50 MHz */
47  if (LEON_REG.Scaler_Reload >= 49) leon_open_eth_configuration.en100MHz = 1;
48
49  if (rtems_open_eth_driver_attach( config, &leon_open_eth_configuration )) {
50    LEON_REG.Interrupt_Clear = (1 << (OPEN_ETH_VECTOR - 0x10));
51    LEON_REG.Interrupt_Mask  |= (1 << (OPEN_ETH_VECTOR - 0x10));
52  }
53  return 0;
54}
Note: See TracBrowser for help on using the repository browser.