source: rtems/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c @ 8d830fae

4.11
Last change on this file since 8d830fae was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 3, 2012 at 3:09:24 PM

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

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