source: rtems/c/src/lib/libbsp/sparc/erc32/erc32sonic/erc32sonic.c @ 9f058fb

4.115
Last change on this file since 9f058fb was 9f058fb, checked in by Daniel Cederman <cederman@…>, on 05/08/14 at 15:08:04

bsps/sparc: Change tabs to spaces.

  • Property mode set to 100644
File size: 3.0 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 <bsp.h>
24#include <libchip/sonic.h>
25#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
26#include <stdio.h>
27#endif
28
29void erc32_sonic_write_register(
30  void       *base,
31  uint32_t    regno,
32  uint32_t    value
33)
34{
35  volatile uint32_t   *p = base;
36
37#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
38  printf( "%p Write 0x%04x to %s (0x%02x)\n",
39      &p[regno], value, SONIC_Reg_name[regno], regno );
40  fflush( stdout );
41#endif
42  p[regno] = 0x0ffff & value;
43}
44
45uint32_t   erc32_sonic_read_register(
46  void       *base,
47  uint32_t    regno
48)
49{
50  volatile uint32_t   *p = base;
51  uint32_t             value;
52
53  value = p[regno];
54#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
55  printf( "%p Read 0x%04x from %s (0x%02x)\n",
56      &p[regno], value, SONIC_Reg_name[regno], regno );
57  fflush( stdout );
58#endif
59  return 0x0ffff & value;
60}
61
62/*
63 * Default sizes of transmit and receive descriptor areas
64 */
65#define RDA_COUNT     20 /* 20 */
66#define TDA_COUNT     20 /* 10 */
67
68/*
69 * Default device configuration register values
70 * Conservative, generic values.
71 * DCR:
72 *      No extended bus mode
73 *      Unlatched bus retry
74 *      Programmable outputs unused
75 *      Asynchronous bus mode
76 *      User definable pins unused
77 *      No wait states (access time controlled by DTACK*)
78 *      32-bit DMA
79 *      Empty/Fill DMA mode
80 *      Maximum Transmit/Receive FIFO
81 * DC2:
82 *      Extended programmable outputs unused
83 *      Normal HOLD request
84 *      Packet compress output unused
85 *      No reject on CAM match
86 */
87#define SONIC_DCR  ( DCR_DW32 | DCR_RFT24 | DCR_TFT28)
88#define SONIC_DC2 (0)
89
90/*
91 * Default location of device registers
92 */
93#define SONIC_BASE_ADDRESS 0x10000100
94
95/*
96 * Default interrupt vector
97 */
98#define SONIC_VECTOR 0x1E
99
100sonic_configuration_t erc32_sonic_configuration = {
101  SONIC_BASE_ADDRESS,        /* base address */
102  SONIC_VECTOR,              /* vector number */
103  SONIC_DCR,                 /* DCR register value */
104  SONIC_DC2,                 /* DC2 register value */
105  TDA_COUNT,                 /* number of transmit descriptors */
106  RDA_COUNT,                 /* number of receive descriptors */
107  erc32_sonic_write_register,
108  erc32_sonic_read_register
109};
110
111int rtems_erc32_sonic_driver_attach(struct rtems_bsdnet_ifconfig *config)
112{
113
114  ERC32_MEC.IO_Configuration |=
115      (0x15 << (((SONIC_BASE_ADDRESS >> 24) & 0x3) * 8));
116  ERC32_MEC.Control &= ~0x60001; /* Disable DMA time-out, parity & power-down */
117  ERC32_MEC.Control |= 0x10000;  /* Enable DMA */
118  ERC32_MEC.Interrupt_Mask &= ~(1 << (SONIC_VECTOR - 0x10));
119  return(rtems_sonic_driver_attach( config, &erc32_sonic_configuration ));
120
121}
Note: See TracBrowser for help on using the repository browser.