source: rtems/bsps/sparc/erc32/net/erc32sonic.c @ c05d7a9d

5
Last change on this file since c05d7a9d was cb68253, checked in by Sebastian Huber <sebastian.huber@…>, on 09/07/18 at 04:19:02

network: Use kernel/user space header files

Add and use <machine/rtems-bsd-kernel-space.h> and
<machine/rtems-bsd-user-space.h> similar to the libbsd to avoid command
line defines and defines scattered throught the code base.

Simplify cpukit/libnetworking/Makefile.am.

Update #3375.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup sparc_erc32
5 *
6 * @brief THARSYS VME SPARC RT board SONIC Configuration Information
7 *
8 *  References:
9 *
10 *  1) SVME/DMV-171 Single Board Computer Documentation Package, #805905,
11 *     DY 4 Systems Inc., Kanata, Ontario, September, 1996.
12 */
13
14/*
15 *  COPYRIGHT (c) 2000.
16 *  European Space Agency.
17 *
18 *  The license and distribution terms for this file may be
19 *  found in the file LICENSE in this distribution or at
20 *  http://www.rtems.org/license/LICENSE.
21 */
22
23#include <machine/rtems-bsd-kernel-space.h>
24
25#include <bsp.h>
26#include <libchip/sonic.h>
27#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
28#include <stdio.h>
29#endif
30
31static void erc32_sonic_write_register(
32  void       *base,
33  uint32_t    regno,
34  uint32_t    value
35)
36{
37  volatile uint32_t   *p = base;
38
39#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
40  printf( "%p Write 0x%04x to %s (0x%02x)\n",
41      &p[regno], value, SONIC_Reg_name[regno], regno );
42  fflush( stdout );
43#endif
44  p[regno] = 0x0ffff & value;
45}
46
47static uint32_t   erc32_sonic_read_register(
48  void       *base,
49  uint32_t    regno
50)
51{
52  volatile uint32_t   *p = base;
53  uint32_t             value;
54
55  value = p[regno];
56#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
57  printf( "%p Read 0x%04x from %s (0x%02x)\n",
58      &p[regno], value, SONIC_Reg_name[regno], regno );
59  fflush( stdout );
60#endif
61  return 0x0ffff & value;
62}
63
64/*
65 * Default sizes of transmit and receive descriptor areas
66 */
67#define RDA_COUNT     20 /* 20 */
68#define TDA_COUNT     20 /* 10 */
69
70/*
71 * Default device configuration register values
72 * Conservative, generic values.
73 * DCR:
74 *      No extended bus mode
75 *      Unlatched bus retry
76 *      Programmable outputs unused
77 *      Asynchronous bus mode
78 *      User definable pins unused
79 *      No wait states (access time controlled by DTACK*)
80 *      32-bit DMA
81 *      Empty/Fill DMA mode
82 *      Maximum Transmit/Receive FIFO
83 * DC2:
84 *      Extended programmable outputs unused
85 *      Normal HOLD request
86 *      Packet compress output unused
87 *      No reject on CAM match
88 */
89#define SONIC_DCR  ( DCR_DW32 | DCR_RFT24 | DCR_TFT28)
90#define SONIC_DC2 (0)
91
92/*
93 * Default location of device registers
94 */
95#define SONIC_BASE_ADDRESS 0x10000100
96
97/*
98 * Default interrupt vector
99 */
100#define SONIC_VECTOR 0x1E
101
102sonic_configuration_t erc32_sonic_configuration = {
103  (void *)SONIC_BASE_ADDRESS, /* base address */
104  SONIC_VECTOR,               /* vector number */
105  SONIC_DCR,                  /* DCR register value */
106  SONIC_DC2,                  /* DC2 register value */
107  TDA_COUNT,                  /* number of transmit descriptors */
108  RDA_COUNT,                  /* number of receive descriptors */
109  erc32_sonic_write_register,
110  erc32_sonic_read_register
111};
112
113int rtems_erc32_sonic_driver_attach(struct rtems_bsdnet_ifconfig *config)
114{
115
116  ERC32_MEC.IO_Configuration |=
117      (0x15 << (((SONIC_BASE_ADDRESS >> 24) & 0x3) * 8));
118  ERC32_MEC.Control &= ~0x60001; /* Disable DMA time-out, parity & power-down */
119  ERC32_MEC.Control |= 0x10000;  /* Enable DMA */
120  ERC32_MEC.Interrupt_Mask &= ~(1 << (SONIC_VECTOR - 0x10));
121  return(rtems_sonic_driver_attach( config, &erc32_sonic_configuration ));
122
123}
Note: See TracBrowser for help on using the repository browser.