Ignore:
Timestamp:
Jun 12, 2000, 7:57:02 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
41ab6966
Parents:
f481c39c
Message:

Patch from John Cotton <john.cotton@…>, Charles-Antoine Gauthier
<charles.gauthier@…>, and Darlene A. Stewart
<Darlene.Stewart@…> to add support for a number of very
significant things:

+ BSPs for many variations on the Motorola MBX8xx board series
+ Cache Manager including initial support for m68040

and PowerPC

+ Rework of mpc8xx libcpu code so all mpc8xx CPUs now use

same code base.

+ Rework of eth_comm BSP to utiltize above.

John reports this works on the 821 and 860

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/mvme167/network/network.c

    rf481c39c r8ef3818  
    4141#define UTI_596_ETH_MIN_SIZE  60
    4242
     43#define INET_ADDR_MAX_BUF_SIZE (sizeof "255.255.255.255")
     44
    4345/*
    4446 * RTEMS events
     
    5860#include <sys/socket.h>
    5961#include <sys/sockio.h>
     62#include <sys/types.h>
    6063#include <net/if.h>
    6164#include <netinet/in.h>
    6265#include <netinet/if_ether.h>
     66#include <arpa/inet.h>
    6367
    6468#include "uti596.h"
     
    8084
    8185/* Types of waiting for commands */
    82 #define UTI596_NO_WAIT                                  0
    83 #define UTI596_WAIT_FOR_CU_ACCEPT               1
    84 #define UTI596_WAIT_FOR_INITIALIZATION  2
    85 #define UTI596_WAIT_FOR_STAT_C                  3
     86#define UTI596_NO_WAIT                                                                  0
     87#define UTI596_WAIT_FOR_CU_ACCEPT                               1
     88#define UTI596_WAIT_FOR_INITIALIZATION  2
     89#define UTI596_WAIT_FOR_STAT_C                                  3
    8690
    8791/* Device dependent data structure */
     
    418422 *    sc - pointer to the uti596_softc struct
    419423 *    wait_type - UTI596_NO_WAIT
     424 *                                              UTI596_WAIT
    420425 *                UTI596_WAIT_FOR_CU_ACCEPT
    421426 *                UTI596_WAIT_FOR_INITIALIZATION
     
    433438{
    434439  rtems_interval ticks_per_second, start_ticks, end_ticks;
     440
     441  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
     442        rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
     443        end_ticks = start_ticks + ticks_per_second;
     444
     445  switch( waitType ) {
    435446 
    436   switch( waitType ) {
    437447    case UTI596_NO_WAIT:
    438448      return 0;
    439449
     450
    440451    case UTI596_WAIT_FOR_CU_ACCEPT:
    441       rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
    442                   rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
    443                   end_ticks = start_ticks + ticks_per_second;
    444 
    445452                  do {
    446453                          if (sc->scb.command == 0)
     
    460467 
    461468    case UTI596_WAIT_FOR_INITIALIZATION:
    462       rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
    463                   rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
    464                   end_ticks = start_ticks + ticks_per_second;
    465 
    466469                  do {
    467470                    if( !sc->iscp.busy )
     
    485488
    486489         case UTI596_WAIT_FOR_STAT_C:
    487            rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second);
    488                  rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_ticks);
    489                  end_ticks = start_ticks + ticks_per_second;
    490 
    491490                 do {
    492491                   if( *sc->pCurrent_command_status & STAT_C )
     
    15511550  } while( m != NULL && ++bd_count < 16 );
    15521551
    1553   /* This should never happen */
    1554   if ( bd_count == 16 ) {
    1555     printk(("TX ERROR:Too many mbufs in the packet!!!\n"))
    1556     printk(("Must coalesce!\n"))
    1557   }
    1558 
    15591552  if ( length < UTI_596_ETH_MIN_SIZE ) {
    15601553    pTbd->data = (char *) word_swap ((unsigned long) sc->zeroes); /* add padding to pTbd */
     
    16621655  uti596_softc_ *sc = &uti596_softc;                            /* device dependent data structure */
    16631656  struct ifnet * ifp = &sc->arpcom.ac_if;   /* ifnet structure */
    1664 
    1665         int unitNumber;
    1666         char *unitName;
     1657        int unitNumber;
     1658        char *unitName;
     1659        char *pAddr;
     1660        int addr;
    16671661
    16681662        #ifdef DBG_ATTACH
     
    16901684    ifp->if_mtu = ETHERMTU;
    16911685
    1692   /* Ethernet address can be specified in the ifconfig structure or
    1693    * it can be read in from BBRAM at $FFFC1F2C (6 bytes)
    1694    * mvme167 manual p. 1-47
     1686  /*
     1687   * If an IP address and netmask are provided in NVRAM, cheat,
     1688   * and stuff them into the ifconfig structure, overriding any
     1689   * existing or NULL values.
     1690   *
     1691   * Warning: If values are provided in NVRAM, the ifconfig entries
     1692   * should be NULL because buffer memory allocated to hold the
     1693   * structure values is unrecoverable and would be lost here.
    16951694   */
    1696   if ( pConfig->hardware_address) {
     1695  if ( addr = nvram->ipaddr ) {
     1696        if ( pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT ) )
     1697                        pConfig->ip_address = inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
     1698                else
     1699                        rtems_panic("Can't allocate ip_address buffer!\n");
     1700  }
     1701  if ( addr = nvram->netmask ) {
     1702        if ( pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT ) )
     1703                        pConfig->ip_netmask = inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
     1704                else
     1705                        rtems_panic("Can't allocate ip_netmask buffer!\n");
     1706  }
     1707
     1708  /* Ethernet address can be specified in NVRAM, or in the ifconfig
     1709   * structure. It will be read by default from BBRAM at $FFFC1F2C
     1710   * (6 bytes) mvme167 manual p. 1-47
     1711   */
     1712  if ( nvram->enaddr ) {
     1713        memcpy (sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
     1714  }
     1715  else if ( pConfig->hardware_address) {
    16971716    memcpy (sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
    16981717  }
     
    17001719    memcpy (sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
    17011720  }
     1721
     1722  /* Possibly override default acceptance of broadcast packets */
     1723  if (pConfig->ignore_broadcast)
     1724        uti596initSetup[8] |= 0x02;
    17021725
    17031726  /* Assign requested receive buffer descriptor count */
     
    17161739  ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
    17171740  ifp->if_snd.ifq_maxlen = ifqmaxlen;
    1718         ifp->if_init = uti596_init;
     1741  ifp->if_init = uti596_init;
    17191742  ifp->if_ioctl = uti596_ioctl;
    17201743  ifp->if_start = uti596_start;
Note: See TracChangeset for help on using the changeset viewer.