Index: acorn32/conf/files.acorn32
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/acorn32/conf/files.acorn32,v
retrieving revision 1.8
diff -p -p -r1.8 files.acorn32
*** acorn32/conf/files.acorn32  2002/02/11 21:48:48     1.8
--- acorn32/conf/files.acorn32  2002/03/03 17:04:57
*************** file    arch/arm/iomd/vidc20config.c            vidcv
*** 160,170 ****
 file  arch/arm/iomd/vidcvideo.c               vidcvideo needs-flag

 # Audio devices
! device        beep
! attach        beep at vidc
 file  arch/arm/iomd/beep.c                    beep needs-flag

! device        vidcaudio: audio
 attach        vidcaudio at vidc
 file  arch/arm/iomd/vidcaudio.c               vidcaudio needs-flag

--- 160,170 ----
 file  arch/arm/iomd/vidcvideo.c               vidcvideo needs-flag

 # Audio devices
! device        beep: audio
! attach        beep at audio
 file  arch/arm/iomd/beep.c                    beep needs-flag

! device        vidcaudio: audio, mulaw, auconv
 attach        vidcaudio at vidc
 file  arch/arm/iomd/vidcaudio.c               vidcaudio needs-flag

Index: acorn32/conf/GENERIC
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/acorn32/conf/GENERIC,v
retrieving revision 1.11
diff -p -p -r1.11 GENERIC
*** acorn32/conf/GENERIC        2002/02/11 21:48:46     1.11
--- acorn32/conf/GENERIC        2002/03/03 17:12:04
*************** lpt*    at pioc? offset 0x0278 irq 0
*** 247,253 ****
 #lpt* at pioc? offset 0x03bc irq -1

 # Crude sound device
! beep0 at vidc?

 # Audio device
 vidcaudio0    at vidc?
--- 247,253 ----
 #lpt* at pioc? offset 0x03bc irq -1

 # Crude sound device
! #beep0        at vidc?

 # Audio device
 vidcaudio0    at vidc?
*************** audio*          at vidcaudio0
*** 255,260 ****
--- 255,263 ----

 # System beep
 sysbeep0      at vidc?
+
+ # Crude sound device
+ beep0         at audio?

 # Podule bus device
 podulebus0    at root
Index: arm/iomd/beep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm/iomd/beep.c,v
retrieving revision 1.5
diff -p -p -r1.5 beep.c
*** arm/iomd/beep.c     2002/02/18 12:36:27     1.5
--- arm/iomd/beep.c     2002/03/03 17:07:18
*************** __RCSID("$NetBSD: beep.c,v 1.5 2002/02/1
*** 51,56 ****
--- 51,60 ----
 #include <sys/proc.h>
 #include <sys/time.h>
 #include <sys/errno.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/audioio.h>
+ #include <dev/audio_if.h>

 #include <uvm/uvm_extern.h>

*************** __RCSID("$NetBSD: beep.c,v 1.5 2002/02/1
*** 62,74 ****
 #include <arm/mainbus/mainbus.h>
 #include <arm/iomd/beepvar.h>
 #include <arm/iomd/vidc.h>
- #include <arm/iomd/waveform.h>
 #include <arm/iomd/iomdreg.h>
 #include <arm/iomd/iomdvar.h>

 #include "beep.h"
 #include "locators.h"

 struct beep_softc {
       struct device sc_device;
       irqhandler_t sc_ih;
--- 66,80 ----
 #include <arm/mainbus/mainbus.h>
 #include <arm/iomd/beepvar.h>
 #include <arm/iomd/vidc.h>
 #include <arm/iomd/iomdreg.h>
 #include <arm/iomd/iomdvar.h>

 #include "beep.h"
 #include "locators.h"

+ #define BEEP_MULAW
+ #include <arm/iomd/waveform.h>
+
 struct beep_softc {
       struct device sc_device;
       irqhandler_t sc_ih;
*************** beepprobe(parent, cf, aux)
*** 104,109 ****
--- 110,117 ----
       struct cfdata *cf;
       void *aux;
 {
+       return 1;
+ #if 0
 /*    struct mainbus_attach_args *mb = aux;*/
       int id;

*************** beepprobe(parent, cf, aux)
*** 124,129 ****
--- 132,138 ----
               break;
       }
       return(0);
+ #endif
 }


*************** beepattach(parent, self, aux)
*** 133,138 ****
--- 142,150 ----
       struct device *self;
       void *aux;
 {
+       printf("\n");
+       return;
+ #if 0
       struct beep_softc *sc = (void *)self;
       struct mainbus_attach_args *mb = aux;

*************** beepattach(parent, self, aux)
*** 193,198 ****
--- 205,211 ----
       WriteWord(vidc_base, VIDC_SIR5 | SIR_CENTRE);
       WriteWord(vidc_base, VIDC_SIR6 | SIR_CENTRE);
       WriteWord(vidc_base, VIDC_SIR7 | SIR_CENTRE);
+ #endif
 }


*************** beepopen(dev, flag, mode, p)
*** 203,208 ****
--- 216,223 ----
       int mode;
       struct proc *p;
 {
+       return 0;
+ #if 0
       struct beep_softc *sc;
       int unit = minor(dev);
       int s;
*************** beepopen(dev, flag, mode, p)
*** 224,229 ****
--- 239,245 ----
       (void)splx(s);

       return(0);
+ #endif
 }


*************** beepclose(dev, flag, mode, p)
*** 234,239 ****
--- 250,257 ----
       int mode;
       struct proc *p;
 {
+       return 0;
+ #if 0
       int unit = minor(dev);
       struct beep_softc *sc = beep_cd.cd_devs[unit];
       int s;
*************** beepclose(dev, flag, mode, p)
*** 246,257 ****
--- 264,299 ----
       (void)splx(s);

       return(0);
+ #endif
 }


 void
 beep_generate(void)
 {
+       struct uio auio;
+       struct iovec aiov;
+
+ /*    printf("beep_generate.\n"); */
+
+       aiov.iov_base = (caddr_t)beep_waveform;
+       aiov.iov_len = sizeof(beep_waveform);
+       auio.uio_iov = &aiov;
+       auio.uio_iovcnt = 1;
+       auio.uio_resid = sizeof(beep_waveform);
+       auio.uio_rw = UIO_WRITE;
+       auio.uio_segflg = UIO_SYSSPACE;
+       auio.uio_procp = (struct proc *)0;
+
+       if (audioopen(AUDIO_DEVICE, FWRITE, 0, (struct proc *)0))
+               return;
+
+       if (audiowrite(AUDIO_DEVICE, &auio, 0) != 0)
+               printf("beep: write returned error\n");
+
+       audioclose(AUDIO_DEVICE, FWRITE, 0, (struct proc *)0);
+
+ #if 0
       struct beep_softc *sc = beep_cd.cd_devs[0];
 /*    int status;*/

*************** beep_generate(void)
*** 269,274 ****
--- 311,317 ----
       IOMD_WRITE_BYTE(IOMD_SD0CR, 0x90);
       IOMD_WRITE_BYTE(IOMD_SD0CR, 0x30);
       beepdma(sc, 0);
+ #endif
 }


*************** beepioctl(dev, cmd, data, flag, p)
*** 280,295 ****
       int flag;
       struct proc *p;
 {
       struct beep_softc *sc = beep_cd.cd_devs[minor(dev)];
       int rate;
       struct wavebuffer *wave = (struct wavebuffer *)data;

       switch (cmd) {
       case BEEP_GENERATE:
               beep_generate();
               break;
!
       case BEEP_SETRATE:
               rate = *(int *)data;

               if (rate < 3 || rate > 255)
--- 323,341 ----
       int flag;
       struct proc *p;
 {
+ #if 0
       struct beep_softc *sc = beep_cd.cd_devs[minor(dev)];
       int rate;
       struct wavebuffer *wave = (struct wavebuffer *)data;
+ #endif

       switch (cmd) {
       case BEEP_GENERATE:
               beep_generate();
               break;
! #if 0
       case BEEP_SETRATE:
+               return ENXIO;
               rate = *(int *)data;

               if (rate < 3 || rate > 255)
*************** beepioctl(dev, cmd, data, flag, p)
*** 308,313 ****
--- 354,360 ----
               sc->sc_sound_end1 = (sc->sc_sound_cur1 + wave->size - 16);
               break;

+ #endif
       default:
               return(ENXIO);
               break;
Index: arm/iomd/vidcaudio.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm/iomd/vidcaudio.c,v
retrieving revision 1.5
diff -p -p -r1.5 vidcaudio.c
*** arm/iomd/vidcaudio.c        2002/02/18 12:55:47     1.5
--- arm/iomd/vidcaudio.c        2002/03/03 17:07:19
***************
*** 1,6 ****
--- 1,8 ----
 /*    $NetBSD: vidcaudio.c,v 1.5 2002/02/18 12:55:47 bjh21 Exp $      */

 /*
+  * Copyright (c) 1999 Richard Earnshaw
+  * Copyright (c) 1998 Christopher Gilbert
  * Copyright (c) 1995 Melvin Tang-Richardson
  *
  * Redistribution and use in source and binary forms, with or without
***************
*** 30,39 ****
  */

 /*
!  * audio driver for the RiscPC 16 bit sound
  *
  * Interfaces with the NetBSD generic audio driver to provide SUN
  * /dev/audio (partial) compatibility.
  */

 #include <sys/param.h>        /* proc.h */
--- 32,55 ----
  */

 /*
!  * audio driver for the RiscPC sound
  *
  * Interfaces with the NetBSD generic audio driver to provide SUN
  * /dev/audio (partial) compatibility.
+  *
+  * FEATURES:
+  * Supports both 8 and 16 bit systems.
+  * 8 bit features:
+  *    plays 8 bit mono mulaw
+  * 16 bit features:
+  *    plays 8 bit mono mulaw
+  *    plays 8/16 bit mono/stereo linear samples
+  *            (big or little endian, signed or unsigned)
+  *
+  * TODO:
+  * Figure out why the converted samples are so bad, I suspect that it's
+  * the auconv/mulaw routines.  Or is this why there is an oversampled option in
+  * RiscOS.
  */

 #include <sys/param.h>        /* proc.h */
*************** __RCSID("$NetBSD: vidcaudio.c,v 1.5 2002
*** 46,121 ****
 #include <sys/audioio.h>
 #include <sys/errno.h>
 #include <sys/systm.h>

 #include <uvm/uvm_extern.h>

 #include <dev/audio_if.h>

 #include <machine/intr.h>
 #include <arm/arm32/katelib.h>

 #include <arm/iomd/vidcaudiovar.h>
 #include <arm/iomd/iomdreg.h>
 #include <arm/iomd/iomdvar.h>
! #include <arm/iomd/vidc.h>
 #include <arm/mainbus/mainbus.h>
 #include <arm/iomd/waveform.h>
- #include "vidcaudio.h"

 extern int *vidc_base;

! #undef DEBUG

! struct audio_general {
!       vm_offset_t silence;
!       irqhandler_t ih;

       void (*intr) (void *);
       void *arg;

-       vm_offset_t next_cur;
-       vm_offset_t next_end;
       void (*next_intr) (void *);
       void *next_arg;

!       int buffer;
!       int in_progress;

!       int open;
! } ag;

! struct vidcaudio_softc {
!       struct device device;
!       int iobase;
!
!       int open;
 };

! int  vidcaudio_probe  __P((struct device *parent, struct cfdata *cf, void *aux));
! void vidcaudio_attach __P((struct device *parent, struct device *self, void *aux));
! int  vidcaudio_open   __P((void *addr, int flags));
! void vidcaudio_close  __P((void *addr));
!
! int vidcaudio_intr    __P((void *arg));
! int vidcaudio_dma_program     __P((vm_offset_t cur, vm_offset_t end, void (*intr)(void *), void *arg));
! void vidcaudio_dummy_routine  __P((void *arg));
! int vidcaudio_stereo  __P((int channel, int position));
! int vidcaudio_rate    __P((int rate));
! void vidcaudio_shutdown       __P((void));

- static int sound_dma_intr;
-
 struct cfattach vidcaudio_ca = {
       sizeof(struct vidcaudio_softc), vidcaudio_probe, vidcaudio_attach
 };

 int    vidcaudio_query_encoding  __P((void *, struct audio_encoding *));
! int    vidcaudio_set_params    __P((void *, int, int, struct audio_params *, struct audio_params *));
 int    vidcaudio_round_blocksize __P((void *, int));
 int    vidcaudio_start_output  __P((void *, void *, int, void (*)(void *),
!                                        void *));
 int    vidcaudio_start_input   __P((void *, void *, int, void (*)(void *),
!                                        void *));
 int    vidcaudio_halt_output   __P((void *));
 int    vidcaudio_halt_input    __P((void *));
 int    vidcaudio_speaker_ctl   __P((void *, int));
--- 62,172 ----
 #include <sys/audioio.h>
 #include <sys/errno.h>
 #include <sys/systm.h>
+ #include <sys/uio.h>
+ #include <sys/fcntl.h>

 #include <uvm/uvm_extern.h>

 #include <dev/audio_if.h>
+ #include <dev/mulaw.h>
+ #include <dev/auconv.h>

+ #include <machine/rtc.h>
 #include <machine/intr.h>
+ #include <arm/iomd/vidc.h>
 #include <arm/arm32/katelib.h>

+
 #include <arm/iomd/vidcaudiovar.h>
 #include <arm/iomd/iomdreg.h>
 #include <arm/iomd/iomdvar.h>
! #include "vidcaudio.h"
 #include <arm/mainbus/mainbus.h>
+
+ #define BEEP_MULAW
 #include <arm/iomd/waveform.h>

 extern int *vidc_base;

! #define DEBUG

! #ifdef DEBUG
! #define DEBUGPRINTF(x, level)  if (vidcaudiodebug >= level) (void)printf x
! int vidcaudiodebug = 0;
! #else
! #define DEBUGPRINTF(x, level)
! #endif
!
! struct vidcaudio_softc {
!       struct device sc_device;
!       irqhandler_t sc_ih;
!       int sc_iobase;
!       int sc_open;
!       int sc_dmachannel;

       void (*intr) (void *);
       void *arg;

       void (*next_intr) (void *);
       void *next_arg;

!       u_int sc_silence_cur;
!       u_int sc_silence_end;
!
!       vm_offset_t sc_buffer0;
!       vm_offset_t sc_buffer1;
!
!       vm_offset_t sc_silence;
!
!       vm_offset_t sc_next_cur;
!       vm_offset_t sc_next_end;

!       int sc_in_progress;
!       int sc_buffer;

!       int sc_is16bit;
 };

! int  vidcaudio_probe  __P((struct device *, struct cfdata *, void *));
! void vidcaudio_attach __P((struct device *, struct device *, void *));
! int  vidcaudio_open   __P((void *, int));
! void vidcaudio_close  __P((void *));
!
! int  vidcaudio_intr   __P((void *));
! void vidcaudio_dummy_routine  __P((void *));
! int  vidcaudio_stereo __P((int, int));
! int  vidcaudio_rate   __P((int));
! void vidcaudio_shutdown       __P((struct vidcaudio_softc *));
! void vidcaudio_dma_reset      __P((struct vidcaudio_softc *));
!
!
! void mulaw_to_vidc    __P((void *, u_char *, int));
! void mulaw_to_stereo_slinear16        __P((void *, u_char *, int));
! void mono16_to_stereo16       __P((void *, u_char *, int));
! void mono_to_stereo_chs16     __P((void *, u_char *, int));
! void mono8_to_stereo16        __P((void *, u_char *, int));
! void mono8_to_stereo16_chs    __P((void *, u_char *, int));
! void linear8_to_linear16_chs  __P((void *, u_char *, int));
! void vidcaudio_beep_generate  __P((void));

 struct cfattach vidcaudio_ca = {
       sizeof(struct vidcaudio_softc), vidcaudio_probe, vidcaudio_attach
 };

+ /*
+  * XXX KNF says that all local functions should have
+  * their variables declared here, it's not done in gus
+  * or sb stuff should it be so?
+  */
+
 int    vidcaudio_query_encoding  __P((void *, struct audio_encoding *));
! int    vidcaudio_set_params    __P((void *, int, int, struct audio_params *,
!                                     struct audio_params *));
 int    vidcaudio_round_blocksize __P((void *, int));
 int    vidcaudio_start_output  __P((void *, void *, int, void (*)(void *),
!                                     void *));
 int    vidcaudio_start_input   __P((void *, void *, int, void (*)(void *),
!                                     void *));
 int    vidcaudio_halt_output   __P((void *));
 int    vidcaudio_halt_input    __P((void *));
 int    vidcaudio_speaker_ctl   __P((void *, int));
*************** int    vidcaudio_get_port        __P((void *,
*** 125,136 ****
 int    vidcaudio_query_devinfo         __P((void *, mixer_devinfo_t *));
 int    vidcaudio_get_props     __P((void *));

- struct audio_device vidcaudio_device = {
-       "VidcAudio 8-bit",
-       "x",
-       "vidcaudio"
- };
-
 struct audio_hw_if vidcaudio_hw_if = {
       vidcaudio_open,
       vidcaudio_close,
--- 176,181 ----
*************** struct audio_hw_if vidcaudio_hw_if = {
*** 162,175 ****
 };


 void
 vidcaudio_beep_generate()
 {
!       vidcaudio_dma_program(ag.silence, ag.silence+sizeof(beep_waveform)-16,
!           vidcaudio_dummy_routine, NULL);
! }


 int
 vidcaudio_probe(parent, cf, aux)
       struct device *parent;
--- 207,242 ----
 };


+ #define PHYS(x, y)  pmap_extract(pmap_kernel(), (x), (paddr_t *)(y))
+
+ /* Use the audio device that is attached to us to generate the beep.  That
+    way any conversions needed are performed automatically.  */
 void
 vidcaudio_beep_generate()
 {
!       struct uio auio;
!       struct iovec aiov;
!
!       DEBUGPRINTF(("\nvidcaudio_beep_generate.\n"), 1);
!
!       /* If not configured, we can't beep. */
!       if (audioopen(AUDIO_DEVICE, FWRITE, 0, (struct proc *)0))
!               return;
!
!       aiov.iov_base = (caddr_t)beep_waveform;
!       aiov.iov_len = sizeof(beep_waveform);
!       auio.uio_iov = & aiov;
!       auio.uio_iovcnt = 1;
!       auio.uio_resid = sizeof(beep_waveform);
!       auio.uio_rw = UIO_WRITE;
!       auio.uio_segflg = UIO_SYSSPACE;
!       auio.uio_procp = (struct proc *)0;

+       audiowrite(AUDIO_DEVICE, &auio, 0);

+       audioclose(AUDIO_DEVICE, FWRITE, 0, (struct proc *)0);
+ }
+
 int
 vidcaudio_probe(parent, cf, aux)
       struct device *parent;
*************** vidcaudio_probe(parent, cf, aux)
*** 180,273 ****

       id = IOMD_ID;

-       /* So far I only know about this IOMD */
       switch (id) {
       case RPC600_IOMD_ID:
!               return(1);
               break;
       case ARM7500_IOC_ID:
       case ARM7500FE_IOC_ID:
!               return(1);
               break;
       default:
               printf("vidcaudio: Unknown IOMD id=%04x", id);
               break;
       }

!       return (0);
 }

-
 void
 vidcaudio_attach(parent, self, aux)
!       struct device *parent;
!       struct device *self;
       void *aux;
 {
       struct mainbus_attach_args *mb = aux;
       struct vidcaudio_softc *sc = (void *)self;
!       int id;
!
!       sc->iobase = mb->mb_iobase;

!       sc->open = 0;
!       ag.in_progress = 0;
!
!       ag.next_cur = 0;
!       ag.next_end = 0;
!       ag.next_intr = NULL;
!       ag.next_arg = NULL;

!       vidcaudio_rate(32); /* 24*1024*/

!       /* Program the silence buffer and reset the DMA channel */
!       ag.silence = uvm_km_alloc(kernel_map, NBPG);
!       if (ag.silence == NULL)
               panic("vidcaudio: Cannot allocate memory\n");
!
!       memset((char *)ag.silence, 0, NBPG);
!       memcpy((char *)ag.silence, (char *)beep_waveform, sizeof(beep_waveform));

!       ag.buffer = 0;

!       /* Install the irq handler for the DMA interrupt */
!       ag.ih.ih_func = vidcaudio_intr;
!       ag.ih.ih_arg = NULL;
!       ag.ih.ih_level = IPL_AUDIO;
!       ag.ih.ih_name = "vidcaudio";
!
!       ag.intr = NULL;
! /*    ag.nextintr = NULL;*/
!
!       id = IOMD_ID;

       switch (id) {
       case RPC600_IOMD_ID:
!               sound_dma_intr = IRQ_DMASCH0;
               break;
       case ARM7500_IOC_ID:
       case ARM7500FE_IOC_ID:
!               sound_dma_intr = IRQ_SDMA;
               break;
       }

!       disable_irq(sound_dma_intr);

!       if (irq_claim(sound_dma_intr, &(ag.ih)))
!               panic("vidcaudio: couldn't claim IRQ %d\n", sound_dma_intr);

!       disable_irq(sound_dma_intr);

!       printf("\n");

!       vidcaudio_dma_program(ag.silence, ag.silence+NBPG-16,
!           vidcaudio_dummy_routine, NULL);

!       audio_attach_mi(&vidcaudio_hw_if, sc, &sc->device);

! #ifdef DEBUG
!       printf(" UNDER DEVELOPMENT (nuts)\n");
! #endif
 }

 int
--- 247,384 ----

       id = IOMD_ID;

       switch (id) {
       case RPC600_IOMD_ID:
!
!               return 1;
               break;
       case ARM7500_IOC_ID:
       case ARM7500FE_IOC_ID:
!               return 1;
               break;
       default:
               printf("vidcaudio: Unknown IOMD id=%04x", id);
               break;
       }

!       return 0;
 }

 void
 vidcaudio_attach(parent, self, aux)
!       struct device *parent, *self;
       void *aux;
 {
       struct mainbus_attach_args *mb = aux;
       struct vidcaudio_softc *sc = (void *)self;
!       int id = IOMD_ID;

!       sc->sc_iobase = mb->mb_iobase;
!       sc->sc_open = 0;
!
!       /* We need 2 buffers */
!       sc->sc_buffer0 = uvm_km_alloc(kernel_map, NBPG);
!       if (sc->sc_buffer0 == 0)
!               panic("vidcaudio: Can not allocate buffer 1 memory\n");
!       if ((sc->sc_buffer0 & (NBPG - 1)) != 0)
!               panic("vidcaudio: Can not allocate page aligned buffer 1\n");
!       memset((char *)sc->sc_buffer0, 0, NBPG);
!
!       sc->sc_buffer1 = uvm_km_alloc(kernel_map, NBPG);
!       if (sc->sc_buffer1 == 0)
!               panic("vidcaudio: Can not allocate buffer 1 memory\n");
!       if ((sc->sc_buffer1 & (NBPG - 1)) != 0)
!               panic("vidcaudio: Can not allocate page aligned buffer 1\n");
!       memset((char *)sc->sc_buffer1, 0, NBPG);
!
!       /* Should be location 132 in the cmos by risc os, or we can hope... */
!       /* XXX cmos_read is part of the RTC device, we shouldn't be doing this
!        * this way. */
!       DEBUGPRINTF(("Checking CMOS...\n"),1);
!
!       sc->sc_is16bit = (cmos_read(0xc4) >> 5) & 1;
!       DEBUGPRINTF(("vidcaudio: sc->sc_is16bit:= %d \n",sc->sc_is16bit),1);
!
!       if (sc->sc_is16bit) {
!               printf(": 16-bit external DAC");
!               /* Switch to 16bit mode */
!               WriteWord(vidc_base, VIDC_SCR | 0x03);
!               vidcaudio_rate(8000);
!       } else {
!               printf(":8-bit internal DAC");
!               /* Switch to 8bit mode */
!               WriteWord(vidc_base, VIDC_SCR | 0x05);
!
!               /* I think the beep is at 32 us or 31250 Hz */
!               vidcaudio_rate(31250);
!
!               /* Let's centre the channels, as we're only doing mono */
!
!               WriteWord(vidc_base, VIDC_SIR0 | SIR_CENTRE);
!               WriteWord(vidc_base, VIDC_SIR1 | SIR_CENTRE);
!               WriteWord(vidc_base, VIDC_SIR2 | SIR_CENTRE);
!               WriteWord(vidc_base, VIDC_SIR3 | SIR_CENTRE);
!               WriteWord(vidc_base, VIDC_SIR4 | SIR_CENTRE);
!               WriteWord(vidc_base, VIDC_SIR5 | SIR_CENTRE);
!               WriteWord(vidc_base, VIDC_SIR6 | SIR_CENTRE);
!               WriteWord(vidc_base, VIDC_SIR7 | SIR_CENTRE);
!       }

!       DEBUGPRINTF(("setup silence buffer, "),1);

!       sc->sc_silence = uvm_km_alloc(kernel_map, NBPG);
!       if (sc->sc_silence == 0)
               panic("vidcaudio: Cannot allocate memory\n");
!       if ((sc->sc_silence & (NBPG - 1)) != 0)
!               panic("vidcaudio: Silence buffer not page aligned\n");
!       memset((char *)sc->sc_silence, 0, NBPG);

!       PHYS((vm_offset_t)sc->sc_buffer0, &sc->sc_silence_cur);
!       sc->sc_silence_end = sc->sc_silence_cur + NBPG - 16;

!       vidcaudio_dma_reset(sc);

+       /* Now which dma are we using? */
       switch (id) {
       case RPC600_IOMD_ID:
!               sc->sc_dmachannel = IRQ_DMASCH0;
               break;
       case ARM7500_IOC_ID:
       case ARM7500FE_IOC_ID:
!               sc->sc_dmachannel = IRQ_SDMA;
               break;
+       default:
+               printf("vidcaudio: Unknown IOMD id=%04x\n", id);
+               break;
       }

!       /* Install the irq handler for the DMA interrupt */
!       DEBUGPRINTF(("installing irq handler for DMA's... "),1);

!       sc->sc_ih.ih_func = vidcaudio_intr;
!       sc->sc_ih.ih_arg = sc;
!       sc->sc_ih.ih_level = IPL_AUDIO;
!       sc->sc_ih.ih_name = "vidcaudio";

!       disable_irq(sc->sc_dmachannel);

!       if (irq_claim(sc->sc_dmachannel, &(sc->sc_ih)))
!               panic("vidcaudio: couldn't claim IRQ %d\n", sc->sc_dmachannel);

!       disable_irq(sc->sc_dmachannel);

!       DEBUGPRINTF(("installed, "),1);

!       printf("\n");
!
!       /* have to attach the audio device */
!       audio_attach_mi(&vidcaudio_hw_if, sc, &sc->sc_device);
!
!       /* Save power by not having an audio output */
!       DEBUGPRINTF(("shutting off outputs"),2);
!       WriteWord(vidc_base, VIDC_SCR | 0x00);
!
!       DEBUGPRINTF(("vidcaudio: debugging on.\n"),1);
 }

 int
*************** vidcaudio_open(addr, flags)
*** 277,293 ****
 {
       struct vidcaudio_softc *sc = addr;

! #ifdef DEBUG
!       printf("DEBUG: vidcaudio_open called\n");
! #endif

!       if (sc->open)
               return EBUSY;
!
!       sc->open = 1;
!       ag.open = 1;
!
!       return 0;
 }

 void
--- 388,399 ----
 {
       struct vidcaudio_softc *sc = addr;

!       DEBUGPRINTF(("DEBUG: vidcaudio_open called\n"),1);

!       if (sc->sc_open)
               return EBUSY;
!       sc->sc_open = 1;
!       return 0;
 }

 void
*************** vidcaudio_close(addr)
*** 296,359 ****
 {
       struct vidcaudio_softc *sc = addr;

!       vidcaudio_shutdown();

! #ifdef DEBUG
!       printf("DEBUG: vidcaudio_close called\n");
! #endif

!       sc->open = 0;
!       ag.open = 0;
 }

 /* ************************************************************************* *
  | Interface to the generic audio driver                                     |
  * ************************************************************************* */

! int
! vidcaudio_query_encoding(addr, fp)
       void *addr;
       struct audio_encoding *fp;
 {
!       switch (fp->index) {
!       case 0:
!               strcpy(fp->name, "vidc");
!               fp->encoding = AUDIO_ENCODING_ULAW;
!               fp->precision = 8;
!               fp->flags = 0;
!               break;

!       default:
!               return(EINVAL);
       }
       return 0;
 }

! int
! vidcaudio_set_params(addr, setmode, usemode, p, r)
       void *addr;
       int setmode, usemode;
       struct audio_params *p, *r;
 {
!       if (p->encoding != AUDIO_ENCODING_ULAW ||
!           p->channels != 8)
               return EINVAL;
!       vidcaudio_rate(4 * p->sample_rate / (3 * 1024)); /* XXX probably wrong */

!       return 0;
 }

 int
 vidcaudio_round_blocksize(addr, blk)
       void *addr;
       int blk;
 {
!       if (blk > NBPG)
               blk = NBPG;
!       return (blk);
 }

 #define ROUND(s)  ( ((int)s) & (~(NBPG-1)) )

 int
 vidcaudio_start_output(addr, p, cc, intr, arg)
--- 402,744 ----
 {
       struct vidcaudio_softc *sc = addr;

!       DEBUGPRINTF(("DEBUG: vidcaudio_close called\n"),1);

!       /* Setup one last interrupt that will silence the sound chip */
!       sc->intr = vidcaudio_dummy_routine;
!       sc->arg = NULL;
!       sc->sc_buffer = (++(sc->sc_buffer)) & 1;
!       sc->sc_next_cur = sc->sc_silence_cur;
!       sc->sc_next_end = (sc->sc_silence_end) | 3 << 30;
!       sc->next_intr = NULL;
!       sc->next_arg = NULL;
!
!       DEBUGPRINTF(("next_cur = %x, silence_cur = %x\n",
!                    (u_int) sc->sc_next_cur, (u_int) sc->sc_silence_cur),2);

!       sc->sc_open = 0;
 }

 /* ************************************************************************* *
  | Interface to the generic audio driver                                     |
  * ************************************************************************* */

! int vidcaudio_query_encoding(addr, fp)
       void *addr;
       struct audio_encoding *fp;
 {
!       struct vidcaudio_softc *sc = addr;

!       if (sc->sc_is16bit) {
!               /* what we can do in 16 bit mode */
!               switch (fp->index) {
!               case 0:
!                       strcpy(fp->name, AudioEmulaw);
!                       fp->encoding = AUDIO_ENCODING_ULAW;
!                       fp->precision = 8;
!                       fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
!                       break;
!               case 1:
!                       strcpy(fp->name, AudioEslinear_be);
!                       fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
!                       fp->precision = 16;
!                       fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
!                       break;
!               case 2:
!                       strcpy(fp->name, AudioEulinear_be);
!                       fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
!                       fp->precision = 16;
!                       fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
!                       break;
!               case 3:
!                       strcpy(fp->name, AudioEslinear_le);
!                       fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
!                       fp->precision = 16;
!                       fp->flags = 0;
!                       break;
!               case 4:
!                       strcpy(fp->name, AudioEulinear_le);
!                       fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
!                       fp->precision = 16;
!                       fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
!                       break;
!               default:
!                       return EINVAL;
!               }
!       } else {
!               /* what we can do in 8 bit mode */
!               switch (fp->index) {
!               case 0:
!                       strcpy(fp->name, AudioEmulaw);
!                       fp->encoding = AUDIO_ENCODING_ULAW;
!                       fp->precision = 8;
!                       fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
!                       break;
!               default:
!                       return EINVAL;
!               }
       }
       return 0;
 }

! int vidcaudio_set_params(addr, setmode, usemode, p, r)
       void *addr;
       int setmode, usemode;
       struct audio_params *p, *r;
 {
!       struct vidcaudio_softc *sc = addr;
!
!       switch (p->encoding) {
!       case AUDIO_ENCODING_ULAW:
!               if (p->precision != 8)
!                       return EINVAL;
!               break;
!       case AUDIO_ENCODING_SLINEAR_BE:
!       case AUDIO_ENCODING_SLINEAR_LE:
!       case AUDIO_ENCODING_ULINEAR_BE:
!       case AUDIO_ENCODING_ULINEAR_LE:
!               if (! sc->sc_is16bit)
!                       return EINVAL;
!               if (! (p->channels == 1 || p->channels == 2))
!                       return EINVAL;
!               if (! (p->precision == 8 || p->precision == 16))
!                       return EINVAL;
!               break;
!       default:
               return EINVAL;
!       }

!       switch (p->encoding) {
!       case AUDIO_ENCODING_ULAW:
!               if (sc->sc_is16bit) {
!                       if (p->channels == 1) {
!                               p->sw_code = mulaw_to_stereo_slinear16;
!                               p->factor = 4;
!                       } else if (p->channels == 2) {
!                               p->sw_code = mulaw_to_slinear16_le;
!                               p->factor = 2;
!                       } else
!                               return EINVAL;
!               } else {
!                       /* Fixme: Hardware supports 1, 2, 4 or 8 channels. */
!                       if (p->channels == 1) {
!                               p->sw_code = mulaw_to_vidc;
!                               p->factor = 1;
!                       } else
!                               return EINVAL;
!               }
!               break;
!
!       case AUDIO_ENCODING_ULINEAR_LE:
!               if (p->precision == 16) {
!                       if (p->channels == 1) {
!                               p->sw_code = mono_to_stereo_chs16;
!                               p->factor = 2;
!                       } else {
!                               p->sw_code = change_sign16_le;
!                               p->factor = 1;
!                       }
!               } else {
!                       if (p->channels == 1) {
!                               p->sw_code = mono8_to_stereo16_chs;
!                               p->factor = 4;
!                       } else {
!                               p->sw_code = linear8_to_linear16_chs;
!                               p->factor = 2;
!                       }
!               }
!               break;
!
!       case AUDIO_ENCODING_SLINEAR_LE:
!               if (p->precision == 16) {
!                       if (p->channels == 1) {
!                               p->sw_code = mono16_to_stereo16;
!                               p->factor = 2;
!                       } else {
!                               p->sw_code = NULL;
!                               p->factor = 1;
!                       }
!               } else {
!                       if (p->channels == 1) {
!                               p->sw_code = mono8_to_stereo16;
!                               p->factor = 4;
!                       } else {
!                               p->sw_code = linear8_to_linear16_le;
!                               p->factor = 2;
!                       }
!               }
!               break;
!
!       case AUDIO_ENCODING_SLINEAR_BE:
!               p->sw_code = swap_bytes;
!               p->factor = 1;
!               break;
!
!       case AUDIO_ENCODING_ULINEAR_BE:
!               p->sw_code = swap_bytes_change_sign16_le;
!               p->factor = 1;
!               break;
!       }
!
!       DEBUGPRINTF(("encoding = %d, " ,p->encoding),1);
!       DEBUGPRINTF(("precision = %d, " , p->precision),1);
!       DEBUGPRINTF(("channels = %d, " , p->channels),1);
!       DEBUGPRINTF(("sample_rate = %ld \n", p->sample_rate),1);
!
!       /*
!        * Set the rate according to the expansion that is required.
!        */
!       if (sc->sc_is16bit)
!               return vidcaudio_rate(p->sample_rate * 4);
!       return vidcaudio_rate(p->sample_rate);
! }
!
! void
! mulaw_to_stereo_slinear16(v, p, cc)
!       void *v;
!       u_char *p;
!       int cc;
! {
!       mulaw_to_slinear16_le(v, p, cc);
!       /* change_sign16_le(v, p, cc*2); */
!       mono16_to_stereo16(v, p, cc*2);
! }
!
! void
! mulaw_to_vidc(v, p, cc)
!       void *v;
!       u_char *p;
!       int cc;
! {
!       while (--cc >= 0) {
!               u_char c = 127 - *p;
!               *p = (c << 1) | (c >> 7);
!               ++p;
!       }
! }
!
! void
! mono16_to_stereo16(v, p, cc)
!       void *v;
!       u_char *p;
!       int cc;
! {
!       u_char *q = p;
!
!       p += cc;
!       q += cc * 2;
!       while ((cc -= 2) >= 0) {
!               u_char c0, c1;
!
!               q -= 4;
!               p -= 2;
!               c0 = p[0];
!               c1 = p[1];
!               q[0] = c0;
!               q[1] = c1;
!               q[2] = c0;
!               q[3] = c1;
!       }
 }

+ void
+ mono_to_stereo_chs16(v, p, cc)
+       void *v;
+       u_char *p;
+       int cc;
+ {
+       u_char *q = p;
+
+       p += cc;
+       q += cc * 2;
+       while ((cc -= 2) >= 0) {
+               u_char c0, c1;
+
+               q -= 4;
+               p -= 2;
+               c0 = p[0];
+               c1 = p[1] ^ 0x80;
+               q[0] = c0;
+               q[1] = c1;
+               q[2] = c0;
+               q[3] = c1;
+       }
+ }
+
+ void
+ mono8_to_stereo16(v, p, cc)
+       void *v;
+       u_char *p;
+       int cc;
+ {
+       u_char *q = p;
+
+       p += cc;
+       q += cc * 4;
+       while ((cc -= 1) >= 0) {
+               u_char c = *--p;
+               q -= 4;
+               q[0] = 0;
+               q[1] = c;
+               q[2] = 0;
+               q[3] = c;
+       }
+ }
+
+ void
+ mono8_to_stereo16_chs(v, p, cc)
+       void *v;
+       u_char *p;
+       int cc;
+ {
+       u_char *q = p;
+
+       p += cc;
+       q += cc * 4;
+       while ((cc -= 1) >= 0) {
+               u_char c = (*--p) ^ 0x80;
+               q -= 4;
+               q[0] = 0;
+               q[1] = c;
+               q[2] = 0;
+               q[3] = c;
+       }
+ }
+
+ void
+ linear8_to_linear16_chs(v, p, cc)
+       void *v;
+       u_char *p;
+       int cc;
+ {
+       u_char *q = p;
+
+       p += cc;
+       q += cc * 2;
+       while (--cc >= 0) {
+               q -= 2;
+               q[1] = (*--p) ^ 0x80;
+               q[0] = 0;
+       }
+ }
+
 int
 vidcaudio_round_blocksize(addr, blk)
       void *addr;
       int blk;
 {
!       if (blk > NBPG)         /* Can't DMA more than a page */
               blk = NBPG;
!       else if (blk < 512)     /* ... and must be aligned ??? */
!               blk = 512;
!       else if (blk & 0x0f)    /* quad word align */
!               blk &= ~0x0f;
!       return blk;
 }

 #define ROUND(s)  ( ((int)s) & (~(NBPG-1)) )
+ #define PHYSPAGE(x, y)  \
+       pmap_extract(kernel_pmap, ((x) & PG_FRAME), (paddr_t *)(y))

 int
 vidcaudio_start_output(addr, p, cc, intr, arg)
*************** vidcaudio_start_output(addr, p, cc, intr
*** 363,403 ****
       void (*intr)(void *);
       void *arg;
 {
!       /* I can only DMA inside 1 page */

! #ifdef DEBUG
!       printf("vidcaudio_start_output (%d) %08x %08x\n", cc, intr, arg);
! #endif

!       if (ROUND(p) != ROUND(p+cc)) {
!               /*
!                * If it's over a page I can fix it up by copying it into
!                * my buffer
!                */

! #ifdef DEBUG
!               printf("vidcaudio: DMA over page boundary requested."
!                   "  Fixing up\n");
! #endif
!               memcpy(p, (char *)ag.silence, cc > NBPG ? NBPG : cc);
!               p = (void *)ag.silence;

!               /*
!                * I can't DMA any more than that, but it is possible to
!                * fix it up by handling multiple buffers and only
!                * interrupting the audio driver after sending out all the
!                * stuff it gave me.  That it more than I can be bothered
!                * to do right now and it probablly wont happen so I'll just
!                * truncate the buffer and tell the user.
!                */
!
!               if (cc > NBPG) {
!                       printf("vidcaudio: DMA buffer truncated. I could fix this up\n");
!                       cc = NBPG;
               }
       }
-       vidcaudio_dma_program((vm_offset_t)p, (vm_offset_t)((char *)p+cc),
-           intr, arg);
       return 0;
 }

--- 748,837 ----
       void (*intr)(void *);
       void *arg;
 {
!       struct vidcaudio_softc *sc = addr;
!       paddr_t pa1, pa2;

!       if (sc->sc_in_progress == 0) {
!               if (1 || (ROUND(p) != ROUND(p + cc - 16)) ||
!                   ((u_int) p & 0x0000000f)) {
!                       DEBUGPRINTF(("al"),3);
!                       memcpy((char *)sc->sc_buffer0, p,
!                              cc > NBPG ? NBPG : cc);
!                       p = (void *)sc->sc_buffer0;
!               }
!               sc->sc_buffer = 0;
!               cpu_dcache_wb_range((vm_offset_t) p, (vm_offset_t)p + NBPG);
!               cpu_drain_writebuf();
!
!               /* enable the outputs */
!               if (sc->sc_is16bit)
!                       WriteWord(vidc_base, VIDC_SCR | 0x03);
!               else
!                       WriteWord(vidc_base, VIDC_SCR | 0x05);
!
!               /* Reset state machine and enable interrupts */
!               IOMD_WRITE_WORD(IOMD_SD0CR, 0x90);
!               IOMD_WRITE_WORD(IOMD_SD0CR, 0x30);

!               PHYS((vm_offset_t)p, &pa1);
!               PHYS(((vm_offset_t)p - 16 + (cc > NBPG ? NBPG : cc)), &pa2);

!               IOMD_WRITE_WORD(IOMD_SD0CURA, pa1);
!               IOMD_WRITE_WORD(IOMD_SD0ENDA, pa2);
!
!               DEBUGPRINTF(("A= %x -> %x\n", (u_int)pa1, (u_int)pa2), 3);
!
!               sc->sc_in_progress = 1;
!
!               sc->sc_next_cur = sc->sc_next_end = 0;
!               sc->next_intr = sc->next_arg = NULL;
!
!               sc->intr = intr;
!               sc->arg = arg;
!
!               DEBUGPRINTF(("vidcaudio: start output\n"),3);

!               enable_irq(sc->sc_dmachannel);
!       } else {
!               if (sc->sc_next_cur != 0) {
!                       printf("vidcaudio: Buffer already queued\n");
!                       return EIO;
!               } else {
!                       PHYS((vm_offset_t)p, &pa1);
!                       PHYS((vm_offset_t)p + cc - 16, &pa2);
!                       /* schedule next one */
!                       DEBUGPRINTF(("S2"),4);
!                       /* must check the alignment of the data... */
!                       DEBUGPRINTF((" %x -> %x", (u_int)pa1, (u_int)pa2), 4);
!
!                       if (1 || (ROUND(p) != ROUND(p + cc - 16 ))
!                           || ((u_int) p & 0x0f)) {
!                               DEBUGPRINTF(("al"),4);
!                               if (sc->sc_buffer) {
!                                       memcpy((char *)sc->sc_buffer0, p,
!                                              cc > NBPG ? NBPG : cc);
!                                       p = (void *)sc->sc_buffer0;
!                               } else {
!                                       memcpy((char *)sc->sc_buffer1, p,
!                                              cc > NBPG ? NBPG : cc);
!                                       p = (void *)sc->sc_buffer1;
!                               }
!                               PHYS((vm_offset_t)p, &pa1);
!                               PHYS((vm_offset_t)((char *)p + cc - 16), &pa2);
!                               DEBUGPRINTF((" => %x -> %x", (u_int)pa1,
!                                            (u_int)pa2), 4);
!                       }
!                       DEBUGPRINTF(("\n"),4);
!                       cpu_dcache_wb_range((vm_offset_t)p,
!                           (vm_offset_t)p + NBPG);
!                       cpu_drain_writebuf();
!                       sc->sc_buffer = (++(sc->sc_buffer)) & 1;
!                       PHYS((vm_offset_t)p, &sc->sc_next_cur);
!                       PHYS((vm_offset_t)((char *)p + cc - 16), &sc->sc_next_end);
!                       sc->next_intr = intr;
!                       sc->next_arg = arg;
               }
       }
       return 0;
 }

*************** vidcaudio_start_input(addr, p, cc, intr,
*** 409,435 ****
       void (*intr)(void *);
       void *arg;
 {
!       return EIO;
 }

 int
 vidcaudio_halt_output(addr)
       void *addr;
 {
! #ifdef DEBUG
!       printf("DEBUG: vidcaudio_halt_output\n");
! #endif
!       return EIO;
 }

 int
 vidcaudio_halt_input(addr)
       void *addr;
 {
! #ifdef DEBUG
!       printf("DEBUG: vidcaudio_halt_input\n");
! #endif
!       return EIO;
 }

 int
--- 843,868 ----
       void (*intr)(void *);
       void *arg;
 {
!       return ENODEV;
 }

 int
 vidcaudio_halt_output(addr)
       void *addr;
 {
!       struct vidcaudio_softc *sc = addr;
!
!       DEBUGPRINTF(("DEBUG: vidcaudio_halt_output\n"),1);
!       vidcaudio_shutdown(sc);
!       return 0;
 }

 int
 vidcaudio_halt_input(addr)
       void *addr;
 {
!       DEBUGPRINTF(("DEBUG: vidcaudio_halt_input\n"),1);
!       return ENODEV;
 }

 int
*************** vidcaudio_speaker_ctl(addr, newstate)
*** 437,445 ****
       void *addr;
       int newstate;
 {
! #ifdef DEBUG
!       printf("DEBUG: vidcaudio_speaker_ctl\n");
! #endif
       return 0;
 }

--- 870,876 ----
       void *addr;
       int newstate;
 {
!       DEBUGPRINTF(("vidcaudio: speaker_ctl, newstate= %d.\n", newstate),1);
       return 0;
 }

*************** vidcaudio_getdev(addr, retp)
*** 448,454 ****
       void *addr;
       struct audio_device *retp;
 {
!       *retp = vidcaudio_device;
       return 0;
 }

--- 879,893 ----
       void *addr;
       struct audio_device *retp;
 {
!       struct vidcaudio_softc *sc = addr;
!       if (sc->sc_is16bit)
!               strncpy(retp->config, "Vidcaudio 16 bit",
!                       sizeof(retp->config));
!       else
!               strncpy(retp->config, "Vidcaudio 8 bit", sizeof(retp->config));
!
!       strncpy(retp->name, "Vidcaudio", sizeof(retp->name));
!
       return 0;
 }

*************** vidcaudio_set_port(addr, cp)
*** 458,464 ****
       void *addr;
       mixer_ctrl_t *cp;
 {
!       return EINVAL;
 }

 int
--- 897,903 ----
       void *addr;
       mixer_ctrl_t *cp;
 {
!       return ENODEV;
 }

 int
*************** vidcaudio_get_port(addr, cp)
*** 466,472 ****
       void *addr;
       mixer_ctrl_t *cp;
 {
!       return EINVAL;
 }

 int
--- 905,911 ----
       void *addr;
       mixer_ctrl_t *cp;
 {
!       return ENODEV;
 }

 int
*************** vidcaudio_get_props(addr)
*** 483,709 ****
 {
       return 0;
 }
 void
 vidcaudio_dummy_routine(arg)
       void *arg;
 {
! #ifdef DEBUG
!       printf("vidcaudio_dummy_routine\n");
! #endif
 }

 int
 vidcaudio_rate(rate)
       int rate;
 {
!       WriteWord(vidc_base, VIDC_SFR | rate);
       return 0;
 }

 int
 vidcaudio_stereo(channel, position)
!       int channel;
!       int position;
 {
       if (channel < 0) return EINVAL;
       if (channel > 7) return EINVAL;
!       channel = channel<<24 | VIDC_SIR0;
       WriteWord(vidc_base, channel | position);
       return 0;
 }
-
- #define PHYS(x, y) pmap_extract(pmap_kernel(), ((x)&PG_FRAME), (paddr_t *)(y))

! /*
!  * Program the next buffer to be used
!  * This function must be re-entrant, maximum re-entrancy of 2
!  */
!
! #define FLAGS (0)
!
! int
! vidcaudio_dma_program(cur, end, intr, arg)
!       vm_offset_t cur;
!       vm_offset_t end;
!       void (*intr)(void *);
!       void *arg;
 {
!       paddr_t pa1, pa2;
!
!       /* If there isn't a transfer in progress then start a new one */
!       if (ag.in_progress == 0) {
!               ag.buffer = 0;
!               IOMD_WRITE_WORD(IOMD_SD0CR, 0x90);      /* Reset State Machine */
!               IOMD_WRITE_WORD(IOMD_SD0CR, 0x30);      /* Reset State Machine */
!
!               PHYS(cur, &pa1);
!               PHYS(end - 16, &pa2);
!
!               IOMD_WRITE_WORD(IOMD_SD0CURB, pa1);
!               IOMD_WRITE_WORD(IOMD_SD0ENDB, pa2|FLAGS);
!               IOMD_WRITE_WORD(IOMD_SD0CURA, pa1);
!               IOMD_WRITE_WORD(IOMD_SD0ENDA, pa2|FLAGS);
!
!               ag.in_progress = 1;
!
!               ag.next_cur = ag.next_end = 0;
!               ag.next_intr = ag.next_arg = 0;
!
!               ag.intr = intr;
!               ag.arg = arg;
!
!               /*
!                * The driver 'clicks' between buffer swaps, leading me
!                * to think  that the fifo is much small than on other
!                * sound cards so I'm going to have to do some tricks here
!                */
!
!               (*ag.intr)(ag.arg);                     /* Schedule the next buffer */
!               ag.intr = vidcaudio_dummy_routine;      /* Already done this        */
!               ag.arg = NULL;
!
! #ifdef PRINT
!               printf("vidcaudio: start output\n");
! #endif
! #ifdef DEBUG
!               printf("SE");
! #endif
!               enable_irq(sound_dma_intr);
!       } else {
!               /* Otherwise schedule the next one */
!               if (ag.next_cur != 0) {
!                       /* If there's one scheduled then complain */
!                       printf("vidcaudio: Buffer already Q'ed\n");
!                       return EIO;
!               } else {
!                       /* We're OK to schedule it now */
!                       ag.buffer = (++ag.buffer) & 1;
!                       PHYS(cur, &ag.next_cur);
!                       PHYS(end - 16, &ag.next_end);
!                       ag.next_intr = intr;
!                       ag.next_arg = arg;
! #ifdef DEBUG
!                       printf("s");
! #endif
!               }
!       }
!       return 0;
 }

 void
! vidcaudio_shutdown(void)
 {
!       /* Shut down the channel */
!       ag.intr = NULL;
!       ag.in_progress = 0;
! #ifdef PRINT
!       printf("vidcaudio: stop output\n");
! #endif
!       IOMD_WRITE_WORD(IOMD_SD0CURB, ag.silence);
!       IOMD_WRITE_WORD(IOMD_SD0ENDB, (ag.silence + NBPG - 16) | (1<<30));
!       disable_irq(sound_dma_intr);
 }

 int
 vidcaudio_intr(arg)
       void *arg;
 {
       int status = IOMD_READ_BYTE(IOMD_SD0ST);
       void (*nintr)(void *);
       void *narg;
       void (*xintr)(void *);
       void *xarg;
       int xcur, xend;
!       IOMD_WRITE_WORD(IOMD_DMARQ, 0x10);

! #ifdef PRINT
!       printf ( "I" );
 #endif

!       if (ag.open == 0) {
!               vidcaudio_shutdown();
               return 0;
       }

-       /* Have I got the generic audio device attached */
-
- #ifdef DEBUG
-       printf ( "[B%01x]", status );
- #endif
-
-       nintr = ag.intr;
-       narg = ag.arg;
-       ag.intr = NULL;
-
-       xintr = ag.next_intr;
-       xarg = ag.next_arg;
-       xcur = ag.next_cur;
-       xend = ag.next_end;
-       ag.next_cur = 0;
-       ag.intr = xintr;
-       ag.arg = xarg;
-
       if (nintr) {
! #ifdef DEBUG
!               printf("i");
! #endif
               (*nintr)(narg);
       }

       if (xcur == 0) {
!               vidcaudio_shutdown ();
       } else {
- #define OVERRUN       (0x04)
- #define INTERRUPT     (0x02)
- #define BANK_A                (0x00)
- #define BANK_B                (0x01)
               switch (status & 0x7) {
!               case (INTERRUPT|BANK_A):
! #ifdef PRINT
!                       printf("B");
! #endif
                       IOMD_WRITE_WORD(IOMD_SD0CURB, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDB, xend|FLAGS);
                       break;

!               case (INTERRUPT|BANK_B):
! #ifdef PRINT
!                       printf("A");
! #endif
                       IOMD_WRITE_WORD(IOMD_SD0CURA, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDA, xend|FLAGS);
                       break;

!               case (OVERRUN|INTERRUPT|BANK_A):
! #ifdef PRINT
!                       printf("A");
! #endif
                       IOMD_WRITE_WORD(IOMD_SD0CURA, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDA, xend|FLAGS);
                       break;
!
!               case (OVERRUN|INTERRUPT|BANK_B):
! #ifdef PRINT
!                       printf("B");
! #endif
                       IOMD_WRITE_WORD(IOMD_SD0CURB, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDB, xend|FLAGS);
                       break;
               }
- /*
-       ag.next_cur = 0;
-       ag.intr = xintr;
-       ag.arg = xarg;
- */
-       }
- #ifdef PRINT
-       printf ( "i" );
- #endif
-
-       if (ag.next_cur == 0) {
-               (*ag.intr)(ag.arg);                     /* Schedule the next buffer */
-               ag.intr = vidcaudio_dummy_routine;      /* Already done this        */
-               ag.arg = NULL;
       }
!       return(0);      /* Pass interrupt on down the chain */
 }
--- 922,1082 ----
 {
       return 0;
 }
+
 void
 vidcaudio_dummy_routine(arg)
       void *arg;
 {
!       DEBUGPRINTF(("vidcaudio_dummy_routine\n"),2);
 }

 int
 vidcaudio_rate(rate)
       int rate;
 {
!       int tmprate = (1000000/rate);
!
!       DEBUGPRINTF(("vidcaudio: rate set to = %dHz, or %dus \n", rate,
!                    tmprate),1);
!
!       if (tmprate > 256)
!               tmprate = 256;
!       else if (tmprate < 3)
!               tmprate = 3;
!
!       WriteWord ( vidc_base, VIDC_SFR | (tmprate - 2));
       return 0;
 }

+ /*
+  * XXX I don't think this is really needed, stereo lin does it's own stuff
+  * and mulaw is mono - Chris
+  */
+
 int
 vidcaudio_stereo(channel, position)
!      int channel;
!      int position;
 {
       if (channel < 0) return EINVAL;
       if (channel > 7) return EINVAL;
!       channel = channel << 24 | VIDC_SIR0;
       WriteWord(vidc_base, channel | position);
       return 0;
 }

! void
! vidcaudio_shutdown(sc)
!       struct vidcaudio_softc *sc;
 {
!       /* Shut down the channel */
!       sc->intr = NULL;
!       sc->sc_in_progress = 0;
!       DEBUGPRINTF(("vidcaudio: shutdown\n"),1);
!       disable_irq(sc->sc_dmachannel);
!       /* shutdown the output */
!       WriteWord(vidc_base, VIDC_SCR | 0x00);
 }

 void
! vidcaudio_dma_reset(sc)
!      struct vidcaudio_softc *sc;
 {
!       /* Reset the DMA channels */
!       DEBUGPRINTF(("reseting DMA's, "),2);
!
!       IOMD_WRITE_WORD(IOMD_SD0CURA, sc->sc_silence_cur);
!       IOMD_WRITE_WORD(IOMD_SD0ENDA, sc->sc_silence_end | 0xc0000000);
!       IOMD_WRITE_WORD(IOMD_SD0CURB, sc->sc_silence_cur);
!       IOMD_WRITE_WORD(IOMD_SD0ENDB, sc->sc_silence_end | 0xc0000000);
!
!       /* Clear the state machine, and enable the DMA channels */
!       IOMD_WRITE_BYTE(IOMD_SD0CR, 0x90);
 }

+ #define FLAGS         (0)
+
+ #define OVERRUN       (0x04)
+ #define INTERRUPT     (0x02)
+ #define BANK_A                (0x00)
+ #define BANK_B                (0x01)
+
 int
 vidcaudio_intr(arg)
       void *arg;
 {
+       struct vidcaudio_softc *sc = arg;
       int status = IOMD_READ_BYTE(IOMD_SD0ST);
       void (*nintr)(void *);
       void *narg;
       void (*xintr)(void *);
       void *xarg;
       int xcur, xend;
!
!       if ((status & INTERRUPT) == 0)
!         return 0;     /* This isn't for us, so pass it up the chain */

! #if 0
!       IOMD_WRITE_WORD(IOMD_DMARQ, 0x10);
 #endif
+       DEBUGPRINTF(("I"),4);

!       if (sc->sc_in_progress == 0) {
!               vidcaudio_shutdown(sc);
               return 0;
       }
+
+       DEBUGPRINTF(("[B%01x]", status & 7),4);
+
+       nintr = sc->intr;
+       narg = sc->arg;
+       sc->intr = NULL;

       if (nintr) {
!               DEBUGPRINTF(("i"),4);
               (*nintr)(narg);
       }

+       xintr = sc->next_intr;
+       xarg = sc->next_arg;
+       xcur = sc->sc_next_cur;
+       xend = sc->sc_next_end;
+       sc->sc_next_cur = 0;
+       sc->intr = xintr;
+       sc->arg = xarg;
+
       if (xcur == 0) {
!               vidcaudio_shutdown(sc);
       } else {
               switch (status & 0x7) {
!               case (INTERRUPT | BANK_A):
!                       DEBUGPRINTF(("B"),4);
                       IOMD_WRITE_WORD(IOMD_SD0CURB, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDB, xend|FLAGS);
+                       DEBUGPRINTF(("= %x -> %x\n", xcur, xend|FLAGS),4);
                       break;

!               case (INTERRUPT | BANK_B):
!                       DEBUGPRINTF(( "A" ),4);
                       IOMD_WRITE_WORD(IOMD_SD0CURA, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDA, xend|FLAGS);
+                       DEBUGPRINTF(("= %x -> %x\n", xcur, xend|FLAGS),4);
                       break;

!               case (OVERRUN | INTERRUPT | BANK_A):
!                       DEBUGPRINTF(("A"),4);
                       IOMD_WRITE_WORD(IOMD_SD0CURA, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDA, xend|FLAGS);
+                       DEBUGPRINTF(("= %x -> %x\n", xcur, xend|FLAGS),4);
                       break;
!
!               case (OVERRUN | INTERRUPT | BANK_B):
!                       DEBUGPRINTF(("B"),4);
                       IOMD_WRITE_WORD(IOMD_SD0CURB, xcur);
                       IOMD_WRITE_WORD(IOMD_SD0ENDB, xend|FLAGS);
+                       DEBUGPRINTF(("= %x -> %x\n", xcur, xend|FLAGS),4);
                       break;
               }
       }
!       return 0;       /* Pass interrupt on down the chain */
 }
Index: arm/iomd/waveform.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm/iomd/waveform.h,v
retrieving revision 1.1
diff -p -p -r1.1 waveform.h
*** arm/iomd/waveform.h 2001/10/05 22:27:43     1.1
--- arm/iomd/waveform.h 2002/03/03 17:07:22
***************
*** 1,4 ****
! /*    $NetBSD: waveform.h,v 1.1 2001/10/05 22:27:43 reinoud Exp $     */

 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
--- 1,4 ----
! /*    $NetBSD: waveform.h,v 1.5 2001/10/17 23:54:34 reinoud dead $    */

 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
***************
*** 33,38 ****
--- 33,39 ----
  * SUCH DAMAGE.
  */

+ #ifndef BEEP_MULAW
 static const unsigned char beep_waveform[] = {
     0x00, 0x06, 0x18, 0x2a, 0x3e, 0x4a, 0x54, 0x60,
     0x64, 0x68, 0x6a, 0x6a, 0x66, 0x62, 0x54, 0x3e,
*************** static const unsigned char beep_waveform
*** 548,551 ****
--- 549,1069 ----
     0x1f, 0x19, 0x15, 0x0f, 0x09, 0x05, 0x03, 0x00,
 };

+ #else
+ /* As above, but in standard mulaw form.  */
+ static const unsigned char beep_waveform[] = {
+     0x7f, 0x7c, 0x73, 0x6a, 0x60, 0x5a, 0x55, 0x4f,
+     0x4d, 0x4b, 0x4a, 0x4a, 0x4c, 0x4e, 0x55, 0x60,
+     0x7f, 0xdd, 0xcf, 0xc8, 0xc0, 0xbc, 0xb9, 0xb7,
+     0xb6, 0xb5, 0xb6, 0xb7, 0xba, 0xbd, 0xc6, 0xd3,
+     0x7f, 0x51, 0x43, 0x3a, 0x34, 0x2f, 0x2c, 0x2b,
+     0x2a, 0x2a, 0x2b, 0x2c, 0x2e, 0x35, 0x3c, 0x4a,
+     0x7f, 0xca, 0xba, 0xb1, 0xac, 0xa8, 0xa5, 0xa3,
+     0xa2, 0xa2, 0xa3, 0xa6, 0xa9, 0xad, 0xb6, 0xc4,
+     0x7f, 0x43, 0x34, 0x2b, 0x26, 0x21, 0x1e, 0x1d,
+     0x1c, 0x1c, 0x1d, 0x1f, 0x23, 0x29, 0x30, 0x3e,
+     0x7f, 0xbe, 0xae, 0xa7, 0xa0, 0x9d, 0x9a, 0x99,
+     0x98, 0x98, 0x99, 0x9b, 0x9e, 0xa4, 0xac, 0xbb,
+     0x7f, 0x3b, 0x2b, 0x23, 0x1d, 0x19, 0x17, 0x15,
+     0x14, 0x15, 0x16, 0x18, 0x1b, 0x20, 0x29, 0x38,
+     0x7f, 0xb8, 0xa8, 0x9e, 0x9a, 0x96, 0x93, 0x91,
+     0x90, 0x91, 0x92, 0x95, 0x98, 0x9d, 0xa6, 0xb5,
+     0x7f, 0x34, 0x25, 0x1c, 0x17, 0x13, 0x0f, 0x0e,
+     0x0d, 0x0e, 0x0e, 0x11, 0x16, 0x1b, 0x23, 0x32,
+     0x7f, 0xb1, 0xa2, 0x9a, 0x94, 0x8f, 0x8d, 0x8c,
+     0x8b, 0x8c, 0x8d, 0x8e, 0x93, 0x98, 0xa0, 0xaf,
+     0x7f, 0x2e, 0x1f, 0x18, 0x11, 0x0d, 0x0b, 0x0a,
+     0x09, 0x0a, 0x0b, 0x0d, 0x10, 0x16, 0x1e, 0x2d,
+     0x7f, 0xad, 0x9d, 0x95, 0x8e, 0x8c, 0x89, 0x88,
+     0x87, 0x88, 0x89, 0x8b, 0x8e, 0x94, 0x9c, 0xab,
+     0x7f, 0x2b, 0x1c, 0x13, 0x0d, 0x0a, 0x08, 0x06,
+     0x05, 0x06, 0x07, 0x09, 0x0c, 0x12, 0x1b, 0x2a,
+     0x7f, 0xaa, 0x9a, 0x91, 0x8c, 0x88, 0x86, 0x84,
+     0x83, 0x84, 0x85, 0x88, 0x8b, 0x90, 0x99, 0xa8,
+     0x7f, 0x28, 0x19, 0x0f, 0x0a, 0x07, 0x04, 0x02,
+     0x01, 0x02, 0x03, 0x06, 0x0a, 0x0e, 0x17, 0x27,
+     0x7f, 0xa7, 0x97, 0x8e, 0x89, 0x85, 0x82, 0x80,
+     0x80, 0x80, 0x82, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x25,
+     0x7f, 0xa5, 0x96, 0x8d, 0x88, 0x84, 0x81, 0x80,
+     0x80, 0x80, 0x81, 0x84, 0x88, 0x8d, 0x96, 0xa5,
+     0x7f, 0x25, 0x16, 0x0d, 0x08, 0x04, 0x01, 0x00,
+     0x00, 0x00, 0x01, 0x04, 0x08, 0x0d, 0x16, 0x26,
+     0x7f, 0xa6, 0x96, 0x8d, 0x88, 0x84, 0x82, 0x80,
+     0x80, 0x80, 0x82, 0x85, 0x88, 0x8d, 0x97, 0xa6,
+     0x7f, 0x26, 0x17, 0x0d, 0x09, 0x05, 0x02, 0x00,
+     0x00, 0x00, 0x02, 0x05, 0x09, 0x0d, 0x17, 0x26,
+     0x7f, 0xa6, 0x97, 0x8d, 0x89, 0x85, 0x82, 0x80,
+     0x80, 0x80, 0x82, 0x85, 0x89, 0x8d, 0x97, 0xa6,
+     0x7f, 0x26, 0x17, 0x0d, 0x09, 0x05, 0x02, 0x01,
+     0x00, 0x01, 0x02, 0x05, 0x09, 0x0e, 0x17, 0x26,
+     0x7f, 0xa6, 0x97, 0x8e, 0x89, 0x85, 0x83, 0x81,
+     0x80, 0x81, 0x83, 0x85, 0x89, 0x8e, 0x97, 0xa7,
+     0x7f, 0x27, 0x17, 0x0e, 0x09, 0x06, 0x03, 0x01,
+     0x01, 0x01, 0x03, 0x06, 0x09, 0x0e, 0x17, 0x27,
+     0x7f, 0xa7, 0x98, 0x8e, 0x89, 0x86, 0x83, 0x81,
+     0x81, 0x81, 0x83, 0x86, 0x89, 0x8e, 0x98, 0xa7,
+     0x7f, 0x27, 0x18, 0x0e, 0x0a, 0x06, 0x03, 0x02,
+     0x01, 0x02, 0x03, 0x06, 0x0a, 0x0e, 0x18, 0x27,
+     0x7f, 0xa7, 0x98, 0x8e, 0x8a, 0x86, 0x83, 0x82,
+     0x81, 0x82, 0x84, 0x86, 0x8a, 0x8e, 0x98, 0xa7,
+     0x7f, 0x27, 0x18, 0x0e, 0x0a, 0x06, 0x04, 0x02,
+     0x02, 0x02, 0x04, 0x06, 0x0a, 0x0e, 0x18, 0x28,
+     0x7f, 0xa8, 0x98, 0x8e, 0x8a, 0x87, 0x84, 0x82,
+     0x82, 0x82, 0x84, 0x87, 0x8a, 0x8f, 0x98, 0xa8,
+     0x7f, 0x28, 0x18, 0x0f, 0x0a, 0x07, 0x04, 0x03,
+     0x02, 0x03, 0x04, 0x07, 0x0a, 0x0f, 0x19, 0x28,
+     0x7f, 0xa8, 0x99, 0x8f, 0x8a, 0x87, 0x84, 0x83,
+     0x82, 0x83, 0x84, 0x87, 0x8b, 0x8f, 0x99, 0xa8,
+     0x7f, 0x28, 0x19, 0x0f, 0x0b, 0x07, 0x05, 0x03,
+     0x03, 0x03, 0x05, 0x07, 0x0b, 0x0f, 0x19, 0x28,
+     0x7f, 0xa8, 0x99, 0x8f, 0x8b, 0x87, 0x85, 0x83,
+     0x83, 0x83, 0x85, 0x87, 0x8b, 0x90, 0x99, 0xa9,
+     0x7f, 0x29, 0x19, 0x10, 0x0b, 0x08, 0x05, 0x04,
+     0x03, 0x04, 0x05, 0x08, 0x0b, 0x10, 0x19, 0x29,
+     0x7f, 0xa9, 0x99, 0x90, 0x8b, 0x88, 0x85, 0x84,
+     0x83, 0x84, 0x85, 0x88, 0x8b, 0x90, 0x9a, 0xa9,
+     0x7f, 0x29, 0x1a, 0x10, 0x0b, 0x08, 0x06, 0x04,
+     0x04, 0x04, 0x06, 0x08, 0x0b, 0x10, 0x1a, 0x29,
+     0x7f, 0xa9, 0x9a, 0x91, 0x8c, 0x88, 0x86, 0x84,
+     0x84, 0x84, 0x86, 0x88, 0x8c, 0x91, 0x9a, 0xa9,
+     0x7f, 0x29, 0x1a, 0x11, 0x0c, 0x08, 0x06, 0x05,
+     0x04, 0x05, 0x06, 0x08, 0x0c, 0x11, 0x1a, 0x2a,
+     0x7f, 0xaa, 0x9a, 0x91, 0x8c, 0x89, 0x86, 0x85,
+     0x84, 0x85, 0x86, 0x89, 0x8c, 0x91, 0x9a, 0xaa,
+     0x7f, 0x2a, 0x1a, 0x11, 0x0c, 0x09, 0x06, 0x05,
+     0x05, 0x05, 0x07, 0x09, 0x0c, 0x12, 0x1b, 0x2a,
+     0x7f, 0xaa, 0x9b, 0x92, 0x8c, 0x89, 0x87, 0x85,
+     0x85, 0x85, 0x87, 0x89, 0x8c, 0x92, 0x9b, 0xaa,
+     0x7f, 0x2a, 0x1b, 0x12, 0x0c, 0x09, 0x07, 0x05,
+     0x05, 0x06, 0x07, 0x09, 0x0c, 0x12, 0x1b, 0x2a,
+     0x7f, 0xaa, 0x9b, 0x92, 0x8d, 0x89, 0x87, 0x86,
+     0x85, 0x86, 0x87, 0x8a, 0x8d, 0x92, 0x9b, 0xab,
+     0x7f, 0x2b, 0x1b, 0x13, 0x0d, 0x0a, 0x07, 0x06,
+     0x06, 0x06, 0x07, 0x0a, 0x0d, 0x13, 0x1b, 0x2b,
+     0x7f, 0xab, 0x9b, 0x93, 0x8d, 0x8a, 0x88, 0x86,
+     0x86, 0x86, 0x88, 0x8a, 0x8d, 0x93, 0x9b, 0xab,
+     0x7f, 0x2b, 0x1c, 0x13, 0x0d, 0x0a, 0x08, 0x06,
+     0x06, 0x06, 0x08, 0x0a, 0x0d, 0x13, 0x1c, 0x2b,
+     0x7f, 0xab, 0x9c, 0x93, 0x8d, 0x8a, 0x88, 0x87,
+     0x86, 0x87, 0x88, 0x8a, 0x8d, 0x94, 0x9c, 0xab,
+     0x7f, 0x2b, 0x1c, 0x14, 0x0d, 0x0a, 0x08, 0x07,
+     0x07, 0x07, 0x08, 0x0b, 0x0e, 0x14, 0x1c, 0x2b,
+     0x7f, 0xac, 0x9c, 0x94, 0x8e, 0x8b, 0x89, 0x87,
+     0x87, 0x87, 0x89, 0x8b, 0x8e, 0x94, 0x9c, 0xac,
+     0x7f, 0x2c, 0x1c, 0x14, 0x0e, 0x0b, 0x09, 0x07,
+     0x07, 0x07, 0x09, 0x0b, 0x0e, 0x14, 0x1c, 0x2c,
+     0x7f, 0xac, 0x9d, 0x94, 0x8e, 0x8b, 0x89, 0x88,
+     0x87, 0x88, 0x89, 0x8b, 0x8e, 0x95, 0x9d, 0xac,
+     0x7f, 0x2c, 0x1d, 0x15, 0x0e, 0x0b, 0x09, 0x08,
+     0x08, 0x08, 0x09, 0x0b, 0x0e, 0x15, 0x1d, 0x2c,
+     0x7f, 0xac, 0x9d, 0x95, 0x8e, 0x8c, 0x89, 0x88,
+     0x88, 0x88, 0x8a, 0x8c, 0x8e, 0x95, 0x9d, 0xac,
+     0x7f, 0x2c, 0x1d, 0x15, 0x0f, 0x0c, 0x0a, 0x08,
+     0x08, 0x08, 0x0a, 0x0c, 0x0f, 0x15, 0x1d, 0x2d,
+     0x7f, 0xad, 0x9d, 0x96, 0x8f, 0x8c, 0x8a, 0x89,
+     0x88, 0x89, 0x8a, 0x8c, 0x8f, 0x96, 0x9d, 0xad,
+     0x7f, 0x2d, 0x1d, 0x16, 0x0f, 0x0c, 0x0a, 0x09,
+     0x09, 0x09, 0x0a, 0x0c, 0x0f, 0x16, 0x1e, 0x2d,
+     0x7f, 0xad, 0x9e, 0x96, 0x90, 0x8c, 0x8a, 0x89,
+     0x89, 0x89, 0x8a, 0x8c, 0x90, 0x96, 0x9e, 0xad,
+     0x7f, 0x2d, 0x1e, 0x16, 0x10, 0x0d, 0x0b, 0x09,
+     0x09, 0x09, 0x0b, 0x0d, 0x10, 0x17, 0x1e, 0x2d,
+     0x7f, 0xad, 0x9e, 0x97, 0x90, 0x8d, 0x8b, 0x8a,
+     0x89, 0x8a, 0x8b, 0x8d, 0x90, 0x97, 0x9e, 0xae,
+     0x7f, 0x2e, 0x1e, 0x17, 0x11, 0x0d, 0x0b, 0x0a,
+     0x0a, 0x0a, 0x0b, 0x0d, 0x11, 0x17, 0x1e, 0x2e,
+     0x7f, 0xae, 0x9e, 0x97, 0x91, 0x8d, 0x8b, 0x8a,
+     0x8a, 0x8a, 0x8b, 0x8d, 0x91, 0x97, 0x9f, 0xae,
+     0x7f, 0x2e, 0x1f, 0x18, 0x11, 0x0d, 0x0c, 0x0a,
+     0x0a, 0x0a, 0x0c, 0x0d, 0x12, 0x18, 0x1f, 0x2e,
+     0x7f, 0xae, 0x9f, 0x98, 0x92, 0x8e, 0x8c, 0x8b,
+     0x8a, 0x8b, 0x8c, 0x8e, 0x92, 0x98, 0x9f, 0xae,
+     0x7f, 0x2e, 0x1f, 0x18, 0x12, 0x0e, 0x0c, 0x0b,
+     0x0b, 0x0b, 0x0c, 0x0e, 0x12, 0x18, 0x20, 0x2f,
+     0x7f, 0xaf, 0xa0, 0x98, 0x92, 0x8e, 0x8c, 0x8b,
+     0x8b, 0x8b, 0x8c, 0x8e, 0x93, 0x99, 0xa0, 0xaf,
+     0x7f, 0x2f, 0x20, 0x19, 0x13, 0x0e, 0x0c, 0x0b,
+     0x0b, 0x0b, 0x0d, 0x0e, 0x13, 0x19, 0x21, 0x30,
+     0x7f, 0xb0, 0xa1, 0x99, 0x93, 0x8e, 0x8d, 0x8c,
+     0x8b, 0x8c, 0x8d, 0x8f, 0x93, 0x99, 0xa1, 0xb0,
+     0x7f, 0x30, 0x21, 0x19, 0x13, 0x0f, 0x0d, 0x0c,
+     0x0c, 0x0c, 0x0d, 0x0f, 0x14, 0x19, 0x21, 0x30,
+     0x7f, 0xb0, 0xa1, 0x99, 0x94, 0x8f, 0x8d, 0x8c,
+     0x8c, 0x8c, 0x8d, 0x8f, 0x94, 0x9a, 0xa2, 0xb1,
+     0x7f, 0x31, 0x22, 0x1a, 0x14, 0x10, 0x0d, 0x0c,
+     0x0c, 0x0c, 0x0d, 0x10, 0x14, 0x1a, 0x22, 0x31,
+     0x7f, 0xb1, 0xa2, 0x9a, 0x95, 0x90, 0x8e, 0x8d,
+     0x8c, 0x8d, 0x8e, 0x90, 0x95, 0x9a, 0xa2, 0xb1,
+     0x7f, 0x32, 0x23, 0x1a, 0x15, 0x10, 0x0e, 0x0d,
+     0x0d, 0x0d, 0x0e, 0x11, 0x15, 0x1a, 0x23, 0x32,
+     0x7f, 0xb2, 0xa3, 0x9b, 0x95, 0x91, 0x8e, 0x8d,
+     0x8d, 0x8d, 0x8e, 0x91, 0x95, 0x9b, 0xa3, 0xb2,
+     0x7f, 0x32, 0x23, 0x1b, 0x16, 0x11, 0x0e, 0x0d,
+     0x0d, 0x0d, 0x0e, 0x11, 0x16, 0x1b, 0x24, 0x33,
+     0x7f, 0xb3, 0xa4, 0x9b, 0x96, 0x92, 0x8f, 0x8e,
+     0x8d, 0x8e, 0x8f, 0x92, 0x96, 0x9b, 0xa4, 0xb3,
+     0x7f, 0x33, 0x24, 0x1b, 0x16, 0x12, 0x0f, 0x0e,
+     0x0e, 0x0e, 0x0f, 0x12, 0x16, 0x1c, 0x24, 0x33,
+     0x7f, 0xb3, 0xa4, 0x9c, 0x97, 0x93, 0x90, 0x8e,
+     0x8e, 0x8e, 0x90, 0x93, 0x97, 0x9c, 0xa5, 0xb4,
+     0x7f, 0x34, 0x25, 0x1c, 0x17, 0x13, 0x10, 0x0e,
+     0x0e, 0x0e, 0x10, 0x13, 0x17, 0x1c, 0x25, 0x34,
+     0x7f, 0xb4, 0xa5, 0x9c, 0x97, 0x93, 0x90, 0x8f,
+     0x8e, 0x8f, 0x91, 0x94, 0x98, 0x9c, 0xa6, 0xb5,
+     0x7f, 0x35, 0x26, 0x1d, 0x18, 0x14, 0x11, 0x0f,
+     0x0f, 0x0f, 0x11, 0x14, 0x18, 0x1d, 0x26, 0x35,
+     0x7f, 0xb5, 0xa6, 0x9d, 0x98, 0x94, 0x91, 0x90,
+     0x8f, 0x90, 0x91, 0x94, 0x98, 0x9d, 0xa6, 0xb5,
+     0x7f, 0x35, 0x26, 0x1d, 0x18, 0x15, 0x12, 0x10,
+     0x10, 0x10, 0x12, 0x15, 0x19, 0x1d, 0x27, 0x36,
+     0x7f, 0xb6, 0xa7, 0x9d, 0x99, 0x95, 0x92, 0x91,
+     0x90, 0x91, 0x92, 0x95, 0x99, 0x9e, 0xa7, 0xb6,
+     0x7f, 0x36, 0x27, 0x1e, 0x19, 0x15, 0x13, 0x11,
+     0x11, 0x11, 0x13, 0x16, 0x19, 0x1e, 0x27, 0x37,
+     0x7f, 0xb7, 0xa8, 0x9e, 0x9a, 0x96, 0x93, 0x92,
+     0x91, 0x92, 0x93, 0x96, 0x9a, 0x9e, 0xa8, 0xb7,
+     0x7f, 0x37, 0x28, 0x1e, 0x1a, 0x16, 0x14, 0x12,
+     0x12, 0x12, 0x14, 0x16, 0x1a, 0x1e, 0x28, 0x37,
+     0x7f, 0xb7, 0xa8, 0x9e, 0x9a, 0x97, 0x94, 0x93,
+     0x92, 0x93, 0x94, 0x97, 0x9a, 0x9f, 0xa9, 0xb8,
+     0x7f, 0x38, 0x29, 0x1f, 0x1b, 0x17, 0x15, 0x13,
+     0x13, 0x13, 0x15, 0x17, 0x1b, 0x1f, 0x29, 0x38,
+     0x7f, 0xb8, 0xa9, 0xa0, 0x9b, 0x98, 0x95, 0x94,
+     0x93, 0x94, 0x95, 0x98, 0x9b, 0xa0, 0xa9, 0xb8,
+     0x7f, 0x39, 0x29, 0x20, 0x1b, 0x18, 0x16, 0x14,
+     0x14, 0x14, 0x16, 0x18, 0x1b, 0x20, 0x2a, 0x39,
+     0x7f, 0xb9, 0xaa, 0xa1, 0x9c, 0x98, 0x96, 0x95,
+     0x94, 0x95, 0x96, 0x99, 0x9c, 0xa1, 0xaa, 0xb9,
+     0x7f, 0x39, 0x2a, 0x21, 0x1c, 0x19, 0x16, 0x15,
+     0x15, 0x15, 0x17, 0x19, 0x1c, 0x22, 0x2a, 0x3a,
+     0x7f, 0xba, 0xab, 0xa2, 0x9c, 0x99, 0x97, 0x95,
+     0x95, 0x96, 0x97, 0x99, 0x9d, 0xa2, 0xab, 0xba,
+     0x7f, 0x3a, 0x2b, 0x22, 0x1d, 0x1a, 0x17, 0x16,
+     0x16, 0x16, 0x17, 0x1a, 0x1d, 0x23, 0x2b, 0x3a,
+     0x7f, 0xba, 0xab, 0xa3, 0x9d, 0x9a, 0x98, 0x96,
+     0x96, 0x97, 0x98, 0x9a, 0x9d, 0xa3, 0xac, 0xbb,
+     0x7f, 0x3b, 0x2c, 0x23, 0x1d, 0x1a, 0x18, 0x17,
+     0x17, 0x17, 0x18, 0x1b, 0x1e, 0x24, 0x2c, 0x3b,
+     0x7f, 0xbb, 0xac, 0xa4, 0x9e, 0x9b, 0x99, 0x97,
+     0x97, 0x98, 0x99, 0x9b, 0x9e, 0xa4, 0xac, 0xbc,
+     0x7f, 0x3c, 0x2c, 0x25, 0x1e, 0x1b, 0x19, 0x18,
+     0x18, 0x18, 0x19, 0x1b, 0x1e, 0x25, 0x2d, 0x3c,
+     0x7f, 0xbc, 0xad, 0xa5, 0x9e, 0x9c, 0x9a, 0x98,
+     0x98, 0x98, 0x9a, 0x9c, 0x9f, 0xa5, 0xad, 0xbc,
+     0x7f, 0x3c, 0x2d, 0x26, 0x1f, 0x1c, 0x1a, 0x19,
+     0x19, 0x19, 0x1a, 0x1c, 0x1f, 0x26, 0x2e, 0x3d,
+     0x7f, 0xbd, 0xae, 0xa6, 0xa0, 0x9d, 0x9b, 0x99,
+     0x99, 0x99, 0x9b, 0x9d, 0xa0, 0xa7, 0xae, 0xbd,
+     0x7f, 0x3d, 0x2e, 0x27, 0x21, 0x1d, 0x1b, 0x1a,
+     0x1a, 0x1a, 0x1b, 0x1d, 0x21, 0x27, 0x2e, 0x3e,
+     0x7f, 0xbe, 0xae, 0xa7, 0xa1, 0x9d, 0x9c, 0x9a,
+     0x9a, 0x9a, 0x9c, 0x9e, 0xa2, 0xa8, 0xaf, 0xbe,
+     0x7f, 0x3e, 0x2f, 0x28, 0x22, 0x1e, 0x1c, 0x1b,
+     0x1b, 0x1b, 0x1c, 0x1e, 0x22, 0x28, 0x30, 0x3e,
+     0x7f, 0xbe, 0xb0, 0xa8, 0xa3, 0x9e, 0x9c, 0x9b,
+     0x9b, 0x9b, 0x9d, 0x9e, 0xa3, 0xa9, 0xb0, 0xbf,
+     0x7f, 0x3f, 0x31, 0x29, 0x23, 0x1f, 0x1d, 0x1c,
+     0x1c, 0x1c, 0x1d, 0x1f, 0x24, 0x29, 0x31, 0x40,
+     0x7f, 0xc0, 0xb1, 0xaa, 0xa4, 0xa0, 0x9d, 0x9c,
+     0x9c, 0x9c, 0x9d, 0xa0, 0xa4, 0xaa, 0xb2, 0xc1,
+     0x7f, 0x41, 0x32, 0x2a, 0x25, 0x20, 0x1e, 0x1d,
+     0x1d, 0x1d, 0x1e, 0x21, 0x25, 0x2a, 0x33, 0x41,
+     0x7f, 0xc1, 0xb3, 0xab, 0xa5, 0xa1, 0x9e, 0x9d,
+     0x9d, 0x9d, 0x9e, 0xa2, 0xa6, 0xab, 0xb3, 0xc2,
+     0x7f, 0x42, 0x34, 0x2b, 0x26, 0x22, 0x1f, 0x1e,
+     0x1e, 0x1e, 0x1f, 0x22, 0x27, 0x2c, 0x34, 0x43,
+     0x7f, 0xc3, 0xb4, 0xac, 0xa7, 0xa3, 0xa0, 0x9e,
+     0x9e, 0x9e, 0xa0, 0xa3, 0xa7, 0xac, 0xb5, 0xc4,
+     0x7f, 0x44, 0x35, 0x2c, 0x28, 0x24, 0x21, 0x1f,
+     0x1f, 0x1f, 0x21, 0x24, 0x28, 0x2d, 0x36, 0x44,
+     0x7f, 0xc5, 0xb6, 0xad, 0xa8, 0xa5, 0xa2, 0xa0,
+     0xa0, 0xa0, 0xa2, 0xa5, 0xa9, 0xad, 0xb7, 0xc5,
+     0x7f, 0x45, 0x37, 0x2d, 0x29, 0x25, 0x23, 0x21,
+     0x21, 0x21, 0x23, 0x26, 0x29, 0x2e, 0x37, 0x46,
+     0x7f, 0xc6, 0xb7, 0xae, 0xaa, 0xa6, 0xa4, 0xa2,
+     0xa2, 0xa2, 0xa4, 0xa7, 0xaa, 0xae, 0xb8, 0xc7,
+     0x7f, 0x47, 0x38, 0x2f, 0x2a, 0x27, 0x25, 0x23,
+     0x23, 0x23, 0x25, 0x27, 0x2b, 0x2f, 0x39, 0x48,
+     0x7f, 0xc8, 0xb9, 0xb0, 0xab, 0xa8, 0xa5, 0xa4,
+     0xa4, 0xa4, 0xa6, 0xa8, 0xab, 0xb0, 0xba, 0xc8,
+     0x7f, 0x48, 0x3a, 0x31, 0x2c, 0x29, 0x26, 0x25,
+     0x25, 0x25, 0x27, 0x29, 0x2c, 0x32, 0x3a, 0x49,
+     0x7f, 0xc9, 0xbb, 0xb2, 0xad, 0xaa, 0xa7, 0xa6,
+     0xa6, 0xa6, 0xa8, 0xaa, 0xad, 0xb3, 0xbb, 0xca,
+     0x7f, 0x4a, 0x3b, 0x33, 0x2d, 0x2a, 0x28, 0x27,
+     0x27, 0x27, 0x28, 0x2b, 0x2e, 0x34, 0x3c, 0x4b,
+     0x7f, 0xcb, 0xbc, 0xb4, 0xae, 0xab, 0xa9, 0xa8,
+     0xa8, 0xa8, 0xa9, 0xac, 0xae, 0xb5, 0xbd, 0xcb,
+     0x7f, 0x4c, 0x3d, 0x35, 0x2f, 0x2c, 0x2a, 0x29,
+     0x29, 0x29, 0x2a, 0x2c, 0x30, 0x36, 0x3d, 0x4c,
+     0x7f, 0xcc, 0xbe, 0xb6, 0xb0, 0xad, 0xab, 0xaa,
+     0xaa, 0xaa, 0xab, 0xad, 0xb1, 0xb7, 0xbe, 0xcd,
+     0x7f, 0x4d, 0x3e, 0x38, 0x32, 0x2e, 0x2c, 0x2b,
+     0x2b, 0x2b, 0x2c, 0x2e, 0x32, 0x38, 0x3f, 0x4e,
+     0x7f, 0xce, 0xc0, 0xb9, 0xb3, 0xaf, 0xad, 0xac,
+     0xac, 0xac, 0xad, 0xaf, 0xb4, 0xb9, 0xc1, 0xcf,
+     0x7f, 0x4f, 0x41, 0x3a, 0x35, 0x30, 0x2e, 0x2d,
+     0x2d, 0x2d, 0x2e, 0x31, 0x35, 0x3a, 0x42, 0x50,
+     0x7f, 0xd0, 0xc3, 0xbb, 0xb6, 0xb2, 0xaf, 0xae,
+     0xae, 0xae, 0xaf, 0xb2, 0xb7, 0xbc, 0xc4, 0xd2,
+     0x7f, 0x52, 0x44, 0x3c, 0x37, 0x34, 0x31, 0x2f,
+     0x2f, 0x2f, 0x31, 0x34, 0x38, 0x3d, 0x46, 0x53,
+     0x7f, 0xd3, 0xc6, 0xbd, 0xb9, 0xb5, 0xb3, 0xb1,
+     0xb1, 0xb1, 0xb3, 0xb6, 0xb9, 0xbe, 0xc7, 0xd5,
+     0x7f, 0x55, 0x47, 0x3e, 0x3a, 0x37, 0x34, 0x33,
+     0x33, 0x33, 0x35, 0x37, 0x3b, 0x3f, 0x49, 0x56,
+     0x7f, 0xd7, 0xc9, 0xc0, 0xbc, 0xb9, 0xb6, 0xb5,
+     0xb5, 0xb5, 0xb7, 0xb9, 0xbc, 0xc2, 0xca, 0xd8,
+     0x7f, 0x58, 0x4a, 0x42, 0x3d, 0x3a, 0x38, 0x37,
+     0x37, 0x37, 0x39, 0x3b, 0x3e, 0x44, 0x4c, 0x5a,
+     0x7f, 0xda, 0xcc, 0xc5, 0xbe, 0xbc, 0xba, 0xb9,
+     0xb9, 0xb9, 0xba, 0xbc, 0xc0, 0xc6, 0xcd, 0xdb,
+     0x7f, 0x5b, 0x4e, 0x47, 0x41, 0x3e, 0x3c, 0x3b,
+     0x3b, 0x3b, 0x3c, 0x3e, 0x43, 0x48, 0x4f, 0x5d,
+     0x7f, 0xdd, 0xd0, 0xc9, 0xc4, 0xc0, 0xbe, 0xbd,
+     0xbd, 0xbd, 0xbe, 0xc1, 0xc5, 0xca, 0xd2, 0xde,
+     0x7f, 0x5e, 0x53, 0x4b, 0x47, 0x43, 0x41, 0x3f,
+     0x3f, 0x40, 0x41, 0x44, 0x48, 0x4d, 0x55, 0x61,
+     0x7f, 0xe1, 0xd6, 0xce, 0xca, 0xc6, 0xc4, 0xc3,
+     0xc3, 0xc3, 0xc5, 0xc8, 0xcb, 0xcf, 0xd8, 0xe4,
+     0x7f, 0x65, 0x59, 0x51, 0x4c, 0x4a, 0x48, 0x47,
+     0x47, 0x47, 0x49, 0x4b, 0x4e, 0x54, 0x5b, 0x67,
+     0x7f, 0xe8, 0xdc, 0xd5, 0xd0, 0xcd, 0xcc, 0xcb,
+     0xcb, 0xcb, 0xcd, 0xce, 0xd3, 0xd8, 0xde, 0xea,
+     0x7f, 0x6b, 0x5f, 0x5a, 0x56, 0x52, 0x50, 0x4f,
+     0x4f, 0x50, 0x52, 0x55, 0x59, 0x5d, 0x64, 0x6e,
+     0x7f, 0xee, 0xe6, 0xde, 0xdb, 0xd9, 0xd8, 0xd7,
+     0xd7, 0xd8, 0xd9, 0xdc, 0xde, 0xe4, 0xea, 0xf3,
+     0x7f, 0x74, 0x6c, 0x67, 0x64, 0x61, 0x5f, 0x5f,
+     0x5f, 0x61, 0x63, 0x66, 0x69, 0x6d, 0x72, 0x79,
+     0x7f, 0xfa, 0xf5, 0xf2, 0xef, 0xee, 0xee, 0xef,
+     0xf0, 0xf3, 0xf5, 0xf8, 0xfb, 0xfd, 0xfe, 0x7f,
+ };
+ #endif
 /* End of waveform.h */