source: rtems/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c @ 133f3cce

4.115
Last change on this file since 133f3cce was 133f3cce, checked in by Toma Radu <radustoma@…>, on 12/03/13 at 20:26:51

leon2: improve doxygen

Add doxygen to the cchip.c & leon_open_eth.c files.

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