OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [dmv177/] [sonic/] [dmvsonic.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  DMV177 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
 *  $Id: dmvsonic.c,v 1.2 2001-09-27 12:00:34 chris Exp $
10
 */
11
 
12
#include <bsp.h>
13
#include <rtems/rtems_bsdnet.h>
14
#include <libchip/sonic.h>
15
 
16
void dmv177_sonic_write_register(
17
  void       *base,
18
  unsigned32  regno,
19
  unsigned32  value
20
)
21
{
22
  volatile unsigned32 *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] = value;
30
}
31
 
32
unsigned32 dmv177_sonic_read_register(
33
  void       *base,
34
  unsigned32  regno
35
)
36
{
37
  volatile unsigned32 *p = base;
38
  unsigned32           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 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 \
75
   (DCR_DW32 | DCR_WAIT0 | DCR_PO0 | DCR_PO1  | DCR_RFT24 | DCR_TFT28)
76
#ifndef SONIC_DCR
77
# define SONIC_DCR (DCR_DW32 | DCR_TFT28)
78
#endif
79
#ifndef SONIC_DC2
80
# define SONIC_DC2 (0)
81
#endif
82
 
83
/*
84
 * Default location of device registers
85
 */
86
#ifndef SONIC_BASE_ADDRESS
87
# define SONIC_BASE_ADDRESS 0xF3000000
88
# warning "Using default SONIC_BASE_ADDRESS."
89
#endif
90
 
91
/*
92
 * Default interrupt vector
93
 */
94
#ifndef SONIC_VECTOR
95
# define SONIC_VECTOR 1
96
# warning "Using default SONIC_VECTOR."
97
#endif
98
 
99
sonic_configuration_t dmv177_sonic_configuration = {
100
  SONIC_BASE_ADDRESS,        /* base address */
101
  SONIC_VECTOR,              /* vector number */
102
  SONIC_DCR,                 /* DCR register value */
103
  SONIC_DC2,                 /* DC2 register value */
104
  TDA_COUNT,                 /* number of transmit descriptors */
105
  RDA_COUNT,                 /* number of receive descriptors */
106
  dmv177_sonic_write_register,
107
  dmv177_sonic_read_register
108
};
109
 
110
int rtems_dmv177_sonic_driver_attach(struct rtems_bsdnet_ifconfig *config)
111
{
112
  return rtems_sonic_driver_attach( config, &dmv177_sonic_configuration );
113
 
114
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.