Changeset c9c67390 in rtems for c/src/libchip/network/sonic.c


Ignore:
Timestamp:
Feb 5, 1999, 12:34:17 AM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
b7111263
Parents:
b5e4eb7
Message:

Split SONIC chip into appropriate files for libchip'ing. The portable
portion is now in the libchip tree and the dmv177 configuration is in
the dmv177 bsp. The performance impact of libchip'ing this driver
was minimal.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • c/src/libchip/network/sonic.c

    rb5e4eb7 rc9c67390  
    11/*
    2  *******************************************************************
    3  *******************************************************************
    4  **                                                               **
    5  **       RTEMS NETWORK DRIVER FOR NATIONAL DP83932 `SONIC'       **
    6  **         SYSTEMS-ORIENTED NETWORK INTERFACE CONTROLLER         **
    7  **                                                               **
    8  *******************************************************************
    9  *******************************************************************
    10  */
    11 
    12 /*
    13  * $Revision$   $Date$   $Author$
    14  * $State$
    15  * $Id$
    16  */
    17 
    18 /*
     2 *       RTEMS NETWORK DRIVER FOR NATIONAL DP83932 `SONIC'
     3 *         SYSTEMS-ORIENTED NETWORK INTERFACE CONTROLLER
     4 *
     5 *                     REUSABLE CHIP DRIVER
     6 *
    197 * References:
    20  * 1) DP83932C-20/25/33 MHz SONIC(TM) Systems-Oriented Network Interface
    21  *    Controller data sheet.  TL/F/10492, RRD-B30M105, National Semiconductor,
    22  *    1995.
    238 *
    24  * 2) Software Driver Programmer's Guide for the DP83932 SONIC(TM),
    25  *    Application Note 746, Wesley Lee and Mike Lui, TL/F/11140,
    26  *    RRD-B30M75, National Semiconductor, March, 1991.
     9 *  1) DP83932C-20/25/33 MHz SONIC(TM) Systems-Oriented Network Interface
     10 *     Controller data sheet.  TL/F/10492, RRD-B30M105, National Semiconductor,
     11 *     1995.
    2712 *
    28  * 3) SVME/DMV-171 Single Board Computer Documentation Package, #805905,
    29  *    DY 4 Systems Inc., Kanata, Ontario, September, 1996.
    30  */
    31 
    32 #include <bsp.h>   /* XXX JRS changed order */
    33 #include "sonic.h"
     13 *  2) Software Driver Programmer's Guide for the DP83932 SONIC(TM),
     14 *     Application Note 746, Wesley Lee and Mike Lui, TL/F/11140,
     15 *     RRD-B30M75, National Semiconductor, March, 1991.
     16 *
     17 *  COPYRIGHT (c) 1989-1997.
     18 *  On-Line Applications Research Corporation (OAR).
     19 *  Copyright assigned to U.S. Government, 1994.
     20 *
     21 *  The license and distribution terms for this file may be
     22 *  found in the file LICENSE in this distribution or at
     23 *  http://www.OARcorp.com/rtems/license.html.
     24 *
     25 *  $Id$
     26 */
     27
     28#include <rtems.h>
    3429#include <rtems/rtems_bsdnet.h>
    35 
    36 /***** CONFIGURATION ****/
    37 typedef void (*sonic_write_register_t)(
    38   void       *base,
    39   unsigned32  regno,
    40   unsigned32  value
    41 );
    42 
    43 typedef unsigned32 (*sonic_read_register_t)(
    44   void       *base,
    45   unsigned32  regno
    46 );
    47 
    48 typedef struct {
    49   unsigned32              base_address;
    50   unsigned32              vector;
    51   unsigned32              dcr_value;
    52   unsigned32              dc2_value;
    53   unsigned32              tda_count;
    54   unsigned32              rda_count;
    55   sonic_write_register_t  write_register;
    56   sonic_read_register_t   read_register;
    57 } sonic_configuration_t;
    58 
    59 /***** CONFIGURATION ****/
     30#include <libchip/sonic.h>
    6031
    6132#include <stdio.h>
     
    7445#include <netinet/in.h>
    7546#include <netinet/if_ether.h>
     47
     48/*
     49 *  XXX fix this
     50 */
     51
     52void *set_vector(void *, unsigned32, unsigned32);
    7653
    7754/*
     
    10784#include <rtems/dumpbuf.h>
    10885#endif
    109 
    110 /*
    111  * XXX
    112  */
    113 
    114 #include <dmv170.h>
    11586
    11687/*
     
    15001471
    15011472int
    1502 rtems_sonic_driver_attach_chip (
     1473rtems_sonic_driver_attach (
    15031474  struct rtems_bsdnet_ifconfig *config,
    15041475  sonic_configuration_t *chip
     
    16571628};
    16581629#endif
    1659 
    1660 void dmv177_sonic_write_register(
    1661   void       *base,
    1662   unsigned32  regno,
    1663   unsigned32  value
    1664 )
    1665 {
    1666   volatile unsigned32 *p = base;
    1667 
    1668 #if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
    1669   printf( "%p Write 0x%04x to %s (0x%02x)\n",
    1670       &p[regno], value, SONIC_Reg_name[regno], regno );
    1671   fflush( stdout );
    1672 #endif
    1673   p[regno] = value;
    1674 }
    1675 
    1676 unsigned32 dmv177_sonic_read_register(
    1677   void       *base,
    1678   unsigned32  regno
    1679 )
    1680 {
    1681   volatile unsigned32 *p = base;
    1682   unsigned32           value;
    1683 
    1684   value = p[regno];
    1685 #if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
    1686   printf( "%p Read 0x%04x from %s (0x%02x)\n",
    1687       &p[regno], value, SONIC_Reg_name[regno], regno );
    1688   fflush( stdout );
    1689 #endif
    1690   return value;
    1691 }
    1692 /********  DMV177 SPECIFIC INFORMATION ***********/
    1693 /*
    1694  * Default sizes of transmit and receive descriptor areas
    1695  */
    1696 #define RDA_COUNT     20 /* 20 */
    1697 #define TDA_COUNT     20 /* 10 */
    1698 
    1699 /*
    1700  * Default device configuration register values
    1701  * Conservative, generic values.
    1702  * DCR:
    1703  *      No extended bus mode
    1704  *      Unlatched bus retry
    1705  *      Programmable outputs unused
    1706  *      Asynchronous bus mode
    1707  *      User definable pins unused
    1708  *      No wait states (access time controlled by DTACK*)
    1709  *      32-bit DMA
    1710  *      Empty/Fill DMA mode
    1711  *      Maximum Transmit/Receive FIFO
    1712  * DC2:
    1713  *      Extended programmable outputs unused
    1714  *      Normal HOLD request
    1715  *      Packet compress output unused
    1716  *      No reject on CAM match
    1717  */
    1718 #define SONIC_DCR \
    1719    (DCR_DW32 | DCR_WAIT0 | DCR_PO0 | DCR_PO1  | DCR_RFT24 | DCR_TFT28)
    1720 #ifndef SONIC_DCR
    1721 # define SONIC_DCR (DCR_DW32 | DCR_TFT28)
    1722 #endif
    1723 #ifndef SONIC_DC2
    1724 # define SONIC_DC2 (0)
    1725 #endif
    1726 
    1727 /*
    1728  * Default location of device registers
    1729  */
    1730 #ifndef SONIC_BASE_ADDRESS
    1731 # define SONIC_BASE_ADDRESS 0xF3000000
    1732 # warning "Using default SONIC_BASE_ADDRESS."
    1733 #endif
    1734 
    1735 /*
    1736  * Default interrupt vector
    1737  */
    1738 #ifndef SONIC_VECTOR
    1739 # define SONIC_VECTOR 1
    1740 # warning "Using default SONIC_VECTOR."
    1741 #endif
    1742 
    1743 sonic_configuration_t dmv177_sonic_configuration = {
    1744   SONIC_BASE_ADDRESS,        /* base address */
    1745   SONIC_VECTOR,              /* vector number */
    1746   SONIC_DCR,                 /* DCR register value */
    1747   SONIC_DC2,                 /* DC2 register value */
    1748   TDA_COUNT,                 /* number of transmit descriptors */
    1749   RDA_COUNT,                 /* number of receive descriptors */
    1750   dmv177_sonic_write_register,
    1751   dmv177_sonic_read_register
    1752 };
    1753 
    1754 int rtems_sonic_driver_attach (struct rtems_bsdnet_ifconfig *config)
    1755 {
    1756   return rtems_sonic_driver_attach_chip ( config, &dmv177_sonic_configuration );
    1757  
    1758 }
    1759 
    1760 /********  DMV177 SPECIFIC INFORMATION ***********/
    1761 
Note: See TracChangeset for help on using the changeset viewer.