Ignore:
Timestamp:
Jul 26, 2000, 9:15:27 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
08330bf
Parents:
b144609
Message:

Patch from Charles-Antoine Gauthier <charles.gauthier@…> that
removes warnings from the network.c file and has slight additions
to the configuration file to support Java.

File:
1 edited

Legend:

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

    rb144609 rdb9ae70  
    5353#include <bsp.h>
    5454#include <stdio.h>
     55#include <string.h>
     56#include <stdlib.h>
    5557
    5658#include <rtems/error.h>
     
    124126static unsigned long word_swap ( unsigned long );
    125127static void * malloc_16byte_aligned ( void **, void ** adjusted_pointer, size_t );
    126 RTEMS_INLINE_ROUTINE void uti596_writePortFunction ( void *, unsigned long );
     128RTEMS_INLINE_ROUTINE void uti596_writePortFunction ( volatile void *, unsigned long );
    127129RTEMS_INLINE_ROUTINE void uti596_portReset( void );
    128130static unsigned long uti596_portSelfTest( i596_selftest * );
     
    286288 */
    287289RTEMS_INLINE_ROUTINE void uti596_writePortFunction(
    288   void * addr,
     290  volatile void * addr,
    289291  unsigned long cmd
    290292)
     
    746748  diagnose.command = CmdDiagnose;
    747749  diagnose.status = 0;
    748   uti596_softc.pCurrent_command_status = &diagnose.status;
     750  uti596_softc.pCurrent_command_status = (unsigned short *)&diagnose.status;
    749751  uti596_addPolledCmd(&diagnose);
    750752  return (uti596_wait ( &uti596_softc, UTI596_WAIT_FOR_STAT_C ));
     
    775777{
    776778  sc->set_conf.cmd.command = CmdConfigure;
    777   memcpy (sc->set_conf.data, uti596initSetup, 14);
     779  memcpy ( (void *)sc->set_conf.data, uti596initSetup, 14);
    778780  uti596_addPolledCmd( (i596_cmd *) &sc->set_conf);
    779781
    780782  /* Poll for successful command completion */
    781   sc->pCurrent_command_status = &(sc->set_conf.cmd.status);
     783  sc->pCurrent_command_status = (unsigned short *)&(sc->set_conf.cmd.status);
    782784  return ( uti596_wait ( sc, UTI596_WAIT_FOR_STAT_C ) );
    783785}
     
    812814
    813815  /* Poll for successful command completion */
    814   sc->pCurrent_command_status = &(sc->set_add.cmd.status);
     816  sc->pCurrent_command_status = (unsigned short *)&(sc->set_add.cmd.status);
    815817  return ( uti596_wait ( sc, UTI596_WAIT_FOR_STAT_C ) );
    816818}
     
    14341436     if (uti596_softc.pLastUnkRFD != I596_NULL ) {
    14351437
    1436        uti596_append(&uti596_softc.pSavedRfdQueue, pRfd); /* Only here! saved Q */
     1438       uti596_append((i596_rfd **)&uti596_softc.pSavedRfdQueue, pRfd); /* Only here! saved Q */
    14371439       uti596_softc.pEndSavedQueue = pRfd;
    14381440       uti596_softc.savedCount++;
     
    14811483    * in either case, EL bit has been read, and RNR condition will occur
    14821484    */
    1483    uti596_append( &uti596_softc.pSavedRfdQueue, pRfd); /* save it for RNR */
     1485   uti596_append( (i596_rfd **)&uti596_softc.pSavedRfdQueue, pRfd); /* save it for RNR */
    14841486
    14851487   uti596_softc.pEndSavedQueue = pRfd;  /* reset end of saved queue */
     
    16501652
    16511653int uti596_attach(
    1652   struct rtems_bsdnet_ifconfig * pConfig
     1654  struct rtems_bsdnet_ifconfig * pConfig,
     1655  int attaching
    16531656)
    16541657{
    16551658  uti596_softc_ *sc = &uti596_softc;                            /* device dependent data structure */
    1656   struct ifnet * ifp = &sc->arpcom.ac_if;   /* ifnet structure */
    1657         int unitNumber;
    1658         char *unitName;
    1659         char *pAddr;
    1660         int addr;
    1661 
    1662         #ifdef DBG_ATTACH
     1659  struct ifnet * ifp = (struct ifnet *)&sc->arpcom.ac_if;       /* ifnet structure */
     1660  int unitNumber;
     1661  char *unitName;
     1662  char *pAddr;
     1663  int addr;
     1664
     1665  #ifdef DBG_ATTACH
    16631666  printk(("uti596_attach: begins\n"))
    1664         #endif
     1667  #endif
    16651668
    16661669  /* The NIC is not started yet */
     
    16681671
    16691672  /* Indicate to ULCS that this is initialized */
    1670   ifp->if_softc = sc;
     1673  ifp->if_softc = (void *)sc;
    16711674  sc->pScp = NULL;
    16721675
    1673         /* Parse driver name */
    1674         if ((unitNumber = rtems_bsdnet_parse_driver_name (pConfig, &unitName)) < 0)
    1675                 return 0;
     1676  /* Parse driver name */
     1677  if ((unitNumber = rtems_bsdnet_parse_driver_name (pConfig, &unitName)) < 0)
     1678    return 0;
    16761679
    16771680  ifp->if_name = unitName;
     
    16931696   * structure values is unrecoverable and would be lost here.
    16941697   */
    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");
     1698  if ( (addr = nvram->ipaddr) ) {
     1699    if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
     1700      pConfig->ip_address = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
     1701    else
     1702      rtems_panic("Can't allocate ip_address buffer!\n");
     1703  }
     1704  if ( (addr = nvram->netmask) ) {
     1705    if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
     1706      pConfig->ip_netmask = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
     1707    else
     1708      rtems_panic("Can't allocate ip_netmask buffer!\n");
    17061709  }
    17071710
     
    17111714   */
    17121715  if ( nvram->enaddr ) {
    1713         memcpy (sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
     1716        memcpy ((void *)sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
    17141717  }
    17151718  else if ( pConfig->hardware_address) {
    1716     memcpy (sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
     1719    memcpy ((void *)sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
    17171720  }
    17181721  else {
    1719     memcpy (sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
     1722    memcpy ((void *)sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
    17201723  }
    17211724
     
    18011804{
    18021805  uti596_softc_ *sc = arg;
    1803   struct ifnet *ifp = &sc->arpcom.ac_if;
     1806  struct ifnet *ifp = (struct ifnet *)&sc->arpcom.ac_if;
    18041807
    18051808  if (sc->txDaemonTid == 0) {
     
    18081811     * Initialize the 82596
    18091812     */
    1810                 #ifdef DBG_INIT
     1813    #ifdef DBG_INIT
    18111814    printk(("uti596_init: begins\nuti596_init: initializing the 82596...\n"))
    1812                 #endif
     1815    #endif
    18131816    uti596_initialize_hardware(sc);
    18141817
     
    18161819     * Start driver tasks
    18171820     */
    1818                 #ifdef DBG_INIT
     1821    #ifdef DBG_INIT
    18191822    printk(("uti596_init: starting driver tasks...\n"))
    1820                 #endif
    1821     sc->txDaemonTid = rtems_bsdnet_newproc ("UTtx", 2*4096, uti596_txDaemon, sc);
    1822     sc->rxDaemonTid = rtems_bsdnet_newproc ("UTrx", 2*4096, uti596_rxDaemon, sc);
    1823     sc->resetDaemonTid = rtems_bsdnet_newproc ("UTrt", 2*4096, uti596_resetDaemon, sc);
    1824 
    1825                 #ifdef DBG_INIT
     1823    #endif
     1824    sc->txDaemonTid = rtems_bsdnet_newproc ("UTtx", 2*4096, uti596_txDaemon, (void *)sc);
     1825    sc->rxDaemonTid = rtems_bsdnet_newproc ("UTrx", 2*4096, uti596_rxDaemon, (void *)sc);
     1826    sc->resetDaemonTid = rtems_bsdnet_newproc ("UTrt", 2*4096, uti596_resetDaemon, (void *)sc);
     1827
     1828    #ifdef DBG_INIT
    18261829    printk(("uti596_init: After attach, status of board = 0x%x\n", sc->scb.status ))
    1827                 #endif
     1830    #endif
    18281831  }
    18291832
     
    18311834   * Enable receiver
    18321835   */
    1833                 #ifdef DBG_INIT
    1834     printk(("uti596_init: enabling the reciever...\n" ))
    1835                 #endif
     1836  #ifdef DBG_INIT
     1837  printk(("uti596_init: enabling the reciever...\n" ))
     1838  #endif
    18361839  sc->scb.command = RX_START;
    18371840  uti596_issueCA ( sc, UTI596_WAIT_FOR_CU_ACCEPT );
     
    18411844   */
    18421845  ifp->if_flags |= IFF_RUNNING;
    1843                 #ifdef DBG_INIT
    1844     printk(("uti596_init: completed.\n"))
    1845                 #endif 
     1846  #ifdef DBG_INIT
     1847  printk(("uti596_init: completed.\n"))
     1848  #endif 
    18461849}
    18471850
     
    18651868)
    18661869{
    1867         struct ifnet *ifp = &sc->arpcom.ac_if;
    1868 
    1869         ifp->if_flags &= ~IFF_RUNNING;
     1870  struct ifnet *ifp = (struct ifnet *)&sc->arpcom.ac_if;
     1871
     1872  ifp->if_flags &= ~IFF_RUNNING;
    18701873  sc->started = 0;
    18711874
    1872                 #ifdef DBG_STOP
    1873     printk(("uti596stop: %s: Shutting down ethercard, status was %4.4x.\n",
     1875  #ifdef DBG_STOP
     1876  printk(("uti596stop: %s: Shutting down ethercard, status was %4.4x.\n",
    18741877           uti596_softc.arpcom.ac_if.if_name, uti596_softc.scb.status))
    1875                 #endif
    1876 
    1877     printk(("Stopping interface\n"))
    1878     sc->scb.command = CUC_ABORT | RX_ABORT;
    1879     i82596->chan_attn = 0x00000000;
     1878  #endif
     1879
     1880  printk(("Stopping interface\n"))
     1881  sc->scb.command = CUC_ABORT | RX_ABORT;
     1882  i82596->chan_attn = 0x00000000;
    18801883}
    18811884
     
    18961899{
    18971900  uti596_softc_ *sc = (uti596_softc_ *)arg;
    1898   struct ifnet *ifp = &sc->arpcom.ac_if;
     1901  struct ifnet *ifp = (struct ifnet *)&sc->arpcom.ac_if;
    18991902  struct mbuf *m;
    19001903  rtems_event_set events;
     
    19411944{
    19421945  uti596_softc_ *sc = (uti596_softc_ *)arg;
    1943   struct ifnet *ifp = &sc->arpcom.ac_if;
     1946  struct ifnet *ifp = (struct ifnet *)&sc->arpcom.ac_if;
    19441947  struct mbuf *m;
    19451948
     
    19791982      * a fragment, so it is NOT a complete packet.
    19801983      */
    1981      pRfd = uti596_dequeue( &sc->pInboundFrameQueue);
     1984     pRfd = uti596_dequeue( (i596_rfd **)&sc->pInboundFrameQueue);
    19821985     while ( pRfd &&
    19831986             pRfd != I596_NULL &&
     
    20052008         m->m_pkthdr.rcvif = ifp;
    20062009         /* move everything into an mbuf */
    2007          memcpy(m->m_data, pRfd->data, pkt_len);
     2010         memcpy(m->m_data, (const char *)pRfd->data, pkt_len);
    20082011         m->m_len = m->m_pkthdr.len = pkt_len - sizeof(struct ether_header) - 4;
    20092012
     
    20602063       _ISR_Enable(level);
    20612064
    2062        pRfd = uti596_dequeue( &sc->pInboundFrameQueue); /* grab next frame */
     2065       pRfd = uti596_dequeue( (i596_rfd **)&sc->pInboundFrameQueue); /* grab next frame */
    20632066
    20642067     } /* end while */
     
    22282231        pIsrRfd = (i596_rfd *) word_swap ((unsigned long)uti596_softc.pBeginRFA->next);
    22292232        /* the append destroys the link */
    2230         uti596_append( &uti596_softc.pInboundFrameQueue , uti596_softc.pBeginRFA );
     2233        uti596_append( (i596_rfd **)&uti596_softc.pInboundFrameQueue , uti596_softc.pBeginRFA );
    22312234
    22322235       /*
     
    24622465            uti596_softc.pEndRFA -> next = I596_NULL;   /* added feb 16 */
    24632466          }
    2464           uti596_append( &uti596_softc.pSavedRfdQueue, uti596_softc.pLastUnkRFD );
     2467          uti596_append( (i596_rfd **)&uti596_softc.pSavedRfdQueue, uti596_softc.pLastUnkRFD );
    24652468          uti596_softc.savedCount++;
    24662469          uti596_softc.pEndSavedQueue = uti596_softc.pLastUnkRFD;
     
    25762579static int uti596_ioctl(
    25772580  struct ifnet *ifp,
    2578   int command, caddr_t data
     2581  int command,
     2582  caddr_t data
    25792583)
    25802584{
     
    26032607        case IFF_UP:
    26042608          printk(("IFF_UP\n"))
    2605           uti596_init (sc);
     2609          uti596_init ( (void *)sc);
    26062610          break;
    26072611
     
    26092613          printk(("IFF_UP and RUNNING\n"))
    26102614          uti596_stop (sc);
    2611           uti596_init (sc);
     2615          uti596_init ( (void *)sc);
    26122616          break;
    26132617
Note: See TracChangeset for help on using the changeset viewer.