source: rtems/bsps/shared/net/README.sonic @ a2dad96

5
Last change on this file since a2dad96 was 27de4e1f, checked in by Sebastian Huber <sebastian.huber@…>, on 04/03/18 at 05:20:11

bsps: Move libchip to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1This SONIC driver does not make any attempt to support the SONIC chip
2in any of the following modes:
3
4  + 16-bit
5  + little endian
6 
7It does not attempt to handle SONIC's older than Revision C.  There is
8a bug in chips before that revision that must be handled in the driver.
9
10The configuration table should be discussed here but if you look in the
11include file for the sonic, it is reasonably obvious. :)
12
13The performance impact of transforming this driver into libchip format
14was minimal.
15
16The powerpc/dmv177 BSP used this driver and the following should
17serve as an example configuration table.  This BSP was obsoleted after
18the 4.6 release series so the code is included here.
19
20======================================================================
21
22/*
23 *  DMV177 SONIC Configuration Information
24 *
25 *  References:
26 *
27 *  1) SVME/DMV-171 Single Board Computer Documentation Package, #805905,
28 *     DY 4 Systems Inc., Kanata, Ontario, September, 1996.
29 */
30
31#include <bsp.h>
32#include <rtems/rtems_bsdnet.h>
33#include <libchip/sonic.h>
34
35void dmv177_sonic_write_register(
36  void       *base,
37  unsigned32  regno,
38  unsigned32  value
39)
40{
41  volatile unsigned32 *p = base;
42
43#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
44  printf( "%p Write 0x%04x to %s (0x%02x)\n",
45      &p[regno], value, SONIC_Reg_name[regno], regno );
46  fflush( stdout );
47#endif
48  p[regno] = value;
49}
50
51unsigned32 dmv177_sonic_read_register(
52  void       *base,
53  unsigned32  regno
54)
55{
56  volatile unsigned32 *p = base;
57  unsigned32           value;
58
59  value = p[regno];
60#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
61  printf( "%p Read 0x%04x from %s (0x%02x)\n",
62      &p[regno], value, SONIC_Reg_name[regno], regno );
63  fflush( stdout );
64#endif
65  return value;
66}
67
68/*
69 * Default sizes of transmit and receive descriptor areas
70 */
71#define RDA_COUNT     20 /* 20 */
72#define TDA_COUNT     20 /* 10 */
73
74/*
75 * Default device configuration register values
76 * Conservative, generic values.
77 * DCR:
78 *      No extended bus mode
79 *      Unlatched bus retry
80 *      Programmable outputs unused
81 *      Asynchronous bus mode
82 *      User definable pins unused
83 *      No wait states (access time controlled by DTACK*)
84 *      32-bit DMA
85 *      Empty/Fill DMA mode
86 *      Maximum Transmit/Receive FIFO
87 * DC2:
88 *      Extended programmable outputs unused
89 *      Normal HOLD request
90 *      Packet compress output unused
91 *      No reject on CAM match
92 */
93#define SONIC_DCR \
94   (DCR_DW32 | DCR_WAIT0 | DCR_PO0 | DCR_PO1  | DCR_RFT24 | DCR_TFT28)
95#ifndef SONIC_DCR
96# define SONIC_DCR (DCR_DW32 | DCR_TFT28)
97#endif
98#ifndef SONIC_DC2
99# define SONIC_DC2 (0)
100#endif
101
102/*
103 * Default location of device registers
104 */
105#ifndef SONIC_BASE_ADDRESS
106# define SONIC_BASE_ADDRESS 0xF3000000
107# warning "Using default SONIC_BASE_ADDRESS."
108#endif
109
110/*
111 * Default interrupt vector
112 */
113#ifndef SONIC_VECTOR
114# define SONIC_VECTOR 1
115# warning "Using default SONIC_VECTOR."
116#endif
117
118sonic_configuration_t dmv177_sonic_configuration = {
119  SONIC_BASE_ADDRESS,        /* base address */
120  SONIC_VECTOR,              /* vector number */
121  SONIC_DCR,                 /* DCR register value */
122  SONIC_DC2,                 /* DC2 register value */
123  TDA_COUNT,                 /* number of transmit descriptors */
124  RDA_COUNT,                 /* number of receive descriptors */
125  dmv177_sonic_write_register,
126  dmv177_sonic_read_register
127};
128
129int rtems_dmv177_sonic_driver_attach(struct rtems_bsdnet_ifconfig *config)
130{
131  return rtems_sonic_driver_attach( config, &dmv177_sonic_configuration );
132 
133}
134
135======================================================================
Note: See TracBrowser for help on using the repository browser.