source: rtems/c/src/lib/libbsp/sparc/erc32/erc32sonic/erc32sonic.c @ 363b1f7

4.115
Last change on this file since 363b1f7 was 363b1f7, checked in by Daniel Cederman <cederman@…>, on 05/08/14 at 13:42:12

bsps/sparc: Make lines in SPARC BSPs adhere to 80 character limit.

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