[BACK]Return to isic_isa_tel_s08.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / isa

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/isa/Attic/isic_isa_tel_s08.c between version 1.2 and 1.8.16.1

version 1.2, 2001/02/20 22:24:38 version 1.8.16.1, 2007/11/06 23:27:49
Line 1 
Line 1 
 /*  /*
  *   Copyright (c) 1996 Arne Helme. All rights reserved.   *   Copyright (c) 1996 Arne Helme. All rights reserved.
  *   *
  *   Copyright (c) 1996 Gary Jennejohn. All rights reserved.   *   Copyright (c) 1996 Gary Jennejohn. All rights reserved.
  *   *
  *   Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.   *   Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
  *   *
Line 19 
Line 19 
  *      without specific prior written permission.   *      without specific prior written permission.
  *   4. Altered versions must be plainly marked as such, and must not be   *   4. Altered versions must be plainly marked as such, and must not be
  *      misrepresented as being the original software and/or documentation.   *      misrepresented as being the original software and/or documentation.
  *   *
  *   THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND   *   THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  *   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE   *   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  *   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   *   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Line 37 
Line 37 
  *      isic - I4B Siemens ISDN Chipset Driver for Teles S0/8 and clones   *      isic - I4B Siemens ISDN Chipset Driver for Teles S0/8 and clones
  *      ================================================================   *      ================================================================
  *   *
  *      $Id$   *      $Id$
  *   *
  *      last edit-date: [Fri Jan  5 11:37:22 2001]   *      last edit-date: [Fri Jan  5 11:37:22 2001]
  *   *
Line 49 
Line 49 
  *   *
  *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
   
   #include <sys/cdefs.h>
   __KERNEL_RCSID(0, "$NetBSD$");
   
 #include "opt_isicisa.h"  #include "opt_isicisa.h"
 #ifdef ISICISA_TEL_S0_8  #ifdef ISICISA_TEL_S0_8
   
Line 71 
Line 74 
 #include <machine/md_var.h>  #include <machine/md_var.h>
 #include <i386/isa/isa_device.h>  #include <i386/isa/isa_device.h>
 #else  #else
 #include <machine/bus.h>  #include <sys/bus.h>
 #include <sys/device.h>  #include <sys/device.h>
 #endif  #endif
   
Line 86 
Line 89 
 #include <netisdn/i4b_ioctl.h>  #include <netisdn/i4b_ioctl.h>
 #endif  #endif
   
 #include <dev/ic/isic_l1.h>  
 #include <dev/ic/isac.h>  
 #include <dev/ic/hscx.h>  
   
 #include <netisdn/i4b_global.h>  #include <netisdn/i4b_global.h>
   #include <netisdn/i4b_debug.h>
   #include <netisdn/i4b_l2.h>
 #include <netisdn/i4b_l1l2.h>  #include <netisdn/i4b_l1l2.h>
 #include <netisdn/i4b_mbuf.h>  #include <netisdn/i4b_mbuf.h>
   
   #include <dev/ic/isic_l1.h>
   #include <dev/ic/isac.h>
   #include <dev/ic/hscx.h>
   
 #ifndef __FreeBSD__  #ifndef __FreeBSD__
 static u_int8_t tels08_read_reg __P((struct l1_softc *sc, int what, bus_size_t offs));  static u_int8_t tels08_read_reg(struct isic_softc *sc, int what, bus_size_t offs);
 static void tels08_write_reg __P((struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data));  static void tels08_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data);
 static void tels08_write_fifo __P((struct l1_softc *sc, int what, const void *data, size_t size));  static void tels08_write_fifo(struct isic_softc *sc, int what, const void *data, size_t size);
 static void tels08_read_fifo __P((struct l1_softc *sc, int what, void *buf, size_t size));  static void tels08_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size);
 #endif  #endif
   
 /*---------------------------------------------------------------------------*  /*---------------------------------------------------------------------------*
Line 119  tels08_write_reg(u_char *base, u_int i, 
Line 124  tels08_write_reg(u_char *base, u_int i, 
 static const bus_size_t offset[] = { 0x100, 0x180, 0x1c0 };  static const bus_size_t offset[] = { 0x100, 0x180, 0x1c0 };
   
 static void  static void
 tels08_write_reg(struct l1_softc *sc, int what, bus_size_t offs, u_int8_t data)  tels08_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data)
 {  {
         bus_space_tag_t t = sc->sc_maps[0].t;          bus_space_tag_t t = sc->sc_maps[0].t;
         bus_space_handle_t h = sc->sc_maps[0].h;          bus_space_handle_t h = sc->sc_maps[0].h;
Line 149  tels08_read_reg(u_char *base, u_int i)
Line 154  tels08_read_reg(u_char *base, u_int i)
 #else  #else
   
 static u_int8_t  static u_int8_t
 tels08_read_reg(struct l1_softc *sc, int what, bus_size_t offs)  tels08_read_reg(struct isic_softc *sc, int what, bus_size_t offs)
 {  {
         bus_space_tag_t t = sc->sc_maps[0].t;          bus_space_tag_t t = sc->sc_maps[0].t;
         bus_space_handle_t h = sc->sc_maps[0].h;          bus_space_handle_t h = sc->sc_maps[0].h;
Line 168  tels08_read_reg(struct l1_softc *sc, int
Line 173  tels08_read_reg(struct l1_softc *sc, int
  *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
 #ifdef __FreeBSD__  #ifdef __FreeBSD__
   
 static void  static void
 tels08_memcpyb(void *to, const void *from, size_t len)  tels08_memcpyb(void *to, const void *from, size_t len)
 {  {
         for(;len > 0; len--)          for(;len > 0; len--)
Line 178  tels08_memcpyb(void *to, const void *fro
Line 183  tels08_memcpyb(void *to, const void *fro
 #else  #else
   
 static void  static void
 tels08_write_fifo(struct l1_softc *sc, int what, const void *data, size_t size)  tels08_write_fifo(struct isic_softc *sc, int what, const void *data, size_t size)
 {  {
         bus_space_tag_t t = sc->sc_maps[0].t;          bus_space_tag_t t = sc->sc_maps[0].t;
         bus_space_handle_t h = sc->sc_maps[0].h;          bus_space_handle_t h = sc->sc_maps[0].h;
Line 186  tels08_write_fifo(struct l1_softc *sc, i
Line 191  tels08_write_fifo(struct l1_softc *sc, i
 }  }
   
 static void  static void
 tels08_read_fifo(struct l1_softc *sc, int what, void *buf, size_t size)  tels08_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size)
 {  {
         bus_space_tag_t t = sc->sc_maps[0].t;          bus_space_tag_t t = sc->sc_maps[0].t;
         bus_space_handle_t h = sc->sc_maps[0].h;          bus_space_handle_t h = sc->sc_maps[0].h;
Line 202  tels08_read_fifo(struct l1_softc *sc, in
Line 207  tels08_read_fifo(struct l1_softc *sc, in
 int  int
 isic_probe_s08(struct isa_device *dev)  isic_probe_s08(struct isa_device *dev)
 {  {
         struct l1_softc *sc = &l1_sc[dev->id_unit];          struct isic_softc *sc = &l1_sc[dev->id_unit];
   
         /* check max unit range */          /* check max unit range */
   
         if(dev->id_unit >= ISIC_MAXUNIT)          if(dev->id_unit >= ISIC_MAXUNIT)
         {          {
                 printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for Teles S0/8!\n",                  printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for Teles S0/8!\n",
                                 dev->id_unit, dev->id_unit);                                  dev->id_unit, dev->id_unit);
                 return(0);                  return(0);
         }          }
         sc->sc_unit = dev->id_unit;          sc->sc_unit = dev->id_unit;
   
         /* check IRQ validity */          /* check IRQ validity */
   
         switch(ffs(dev->id_irq)-1)          switch(ffs(dev->id_irq)-1)
         {          {
                 case 2:                  case 2:
Line 226  isic_probe_s08(struct isa_device *dev)
Line 231  isic_probe_s08(struct isa_device *dev)
                 case 6:                  case 6:
                 case 7:                  case 7:
                         break;                          break;
   
                 default:                  default:
                         printf("isic%d: Error, invalid IRQ [%d] specified for Teles S0/8!\n",                          printf("isic%d: Error, invalid IRQ [%d] specified for Teles S0/8!\n",
                                 dev->id_unit, ffs(dev->id_irq)-1);                                  dev->id_unit, ffs(dev->id_irq)-1);
                         return(0);                          return(0);
                         break;                          break;
         }          }
         sc->sc_irq = dev->id_irq;          sc->sc_irq = dev->id_irq;
   
         /* check if we got an iobase */          /* check if we got an iobase */
   
         if(dev->id_iobase > 0)          if(dev->id_iobase > 0)
         {          {
                 printf("isic%d: Error, iobase specified for Teles S0/8!\n",                  printf("isic%d: Error, iobase specified for Teles S0/8!\n",
                                 dev->id_unit);                                  dev->id_unit);
                 return(0);                  return(0);
         }          }
   
         /* check if inside memory range of 0xA0000 .. 0xDF000 */          /* check if inside memory range of 0xA0000 .. 0xDF000 */
   
         if( (kvtop(dev->id_maddr) < 0xa0000) ||          if( (kvtop(dev->id_maddr) < 0xa0000) ||
             (kvtop(dev->id_maddr) > 0xdf000) )              (kvtop(dev->id_maddr) > 0xdf000) )
         {          {
Line 253  isic_probe_s08(struct isa_device *dev)
Line 258  isic_probe_s08(struct isa_device *dev)
                                 dev->id_unit, kvtop(dev->id_maddr));                                  dev->id_unit, kvtop(dev->id_maddr));
                 return(0);                  return(0);
         }          }
   
         sc->sc_vmem_addr = (caddr_t) dev->id_maddr;          sc->sc_vmem_addr = (void *) dev->id_maddr;
         dev->id_msize = 0x1000;          dev->id_msize = 0x1000;
   
         /* setup ISAC access routines */          /* setup ISAC access routines */
   
         sc->clearirq = NULL;          sc->clearirq = NULL;
Line 267  isic_probe_s08(struct isa_device *dev)
Line 272  isic_probe_s08(struct isa_device *dev)
         sc->writefifo = tels08_memcpyb;          sc->writefifo = tels08_memcpyb;
   
         /* setup card type */          /* setup card type */
   
         sc->sc_cardtyp = CARD_TYPEP_8;          sc->sc_cardtyp = CARD_TYPEP_8;
   
         /* setup IOM bus type */          /* setup IOM bus type */
   
         sc->sc_bustyp = BUS_TYPE_IOM1;          sc->sc_bustyp = BUS_TYPE_IOM1;
   
         sc->sc_ipac = 0;          sc->sc_ipac = 0;
         sc->sc_bfifolen = HSCX_FIFO_LEN;          sc->sc_bfifolen = HSCX_FIFO_LEN;
   
         /* setup ISAC base addr */          /* setup ISAC base addr */
   
         ISAC_BASE = (caddr_t)((dev->id_maddr) + 0x100);          ISAC_BASE = (void *)((dev->id_maddr) + 0x100);
   
         /* setup HSCX base addr */          /* setup HSCX base addr */
   
         HSCX_A_BASE = (caddr_t)((dev->id_maddr) + 0x180);          HSCX_A_BASE = (void *)((dev->id_maddr) + 0x180);
         HSCX_B_BASE = (caddr_t)((dev->id_maddr) + 0x1c0);          HSCX_B_BASE = (void *)((dev->id_maddr) + 0x1c0);
   
         return (1);          return (1);
 }  }
   
Line 297  isic_probe_s08(struct isic_attach_args *
Line 302  isic_probe_s08(struct isic_attach_args *
         /* no real sensible probe is easy - write to fifo memory          /* no real sensible probe is easy - write to fifo memory
            and read back to verify there is memory doesn't work,             and read back to verify there is memory doesn't work,
            because you talk to tx fifo and rcv fifo. So, just check             because you talk to tx fifo and rcv fifo. So, just check
            HSCX version, which at least fails if no card present             HSCX version, which at least fails if no card present
            at the given location. */             at the given location. */
         bus_space_tag_t t = ia->ia_maps[0].t;          bus_space_tag_t t = ia->ia_maps[0].t;
         bus_space_handle_t h = ia->ia_maps[0].h;          bus_space_handle_t h = ia->ia_maps[0].h;
Line 328  int
Line 333  int
 #ifdef __FreeBSD__  #ifdef __FreeBSD__
 isic_attach_s08(struct isa_device *dev)  isic_attach_s08(struct isa_device *dev)
 #else  #else
 isic_attach_s08(struct l1_softc *sc)  isic_attach_s08(struct isic_softc *sc)
 #endif  #endif
 {  {
 #ifdef __FreeBSD__  #ifdef __FreeBSD__
         struct l1_softc *sc = &l1_sc[dev->id_unit];          struct isic_softc *sc = &l1_sc[dev->id_unit];
 #else  #else
         bus_space_tag_t t = sc->sc_maps[0].t;          bus_space_tag_t t = sc->sc_maps[0].t;
         bus_space_handle_t h = sc->sc_maps[0].h;          bus_space_handle_t h = sc->sc_maps[0].h;
Line 359  isic_attach_s08(struct l1_softc *sc)
Line 364  isic_attach_s08(struct l1_softc *sc)
         DELAY(SEC_DELAY / 5);          DELAY(SEC_DELAY / 5);
   
 #ifndef __FreeBSD__  #ifndef __FreeBSD__
   
         /* setup ISAC access routines */          /* setup ISAC access routines */
   
         sc->clearirq = NULL;          sc->clearirq = NULL;
Line 369  isic_attach_s08(struct l1_softc *sc)
Line 374  isic_attach_s08(struct l1_softc *sc)
         sc->writefifo = tels08_write_fifo;          sc->writefifo = tels08_write_fifo;
   
         /* setup card type */          /* setup card type */
   
         sc->sc_cardtyp = CARD_TYPEP_8;          sc->sc_cardtyp = CARD_TYPEP_8;
   
         /* setup IOM bus type */          /* setup IOM bus type */
   
         sc->sc_bustyp = BUS_TYPE_IOM1;          sc->sc_bustyp = BUS_TYPE_IOM1;
   
         sc->sc_ipac = 0;          sc->sc_ipac = 0;
         sc->sc_bfifolen = HSCX_FIFO_LEN;          sc->sc_bfifolen = HSCX_FIFO_LEN;
   
 #endif  #endif
   
         return (1);          return (1);
 }  }
   

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8.16.1

CVSweb <webmaster@jp.NetBSD.org>