Home | History | Annotate | Line # | Download | only in obio
      1 /* $NetBSD: ascreg.h,v 1.5 2025/05/12 00:35:35 nat Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2017, 2023 Nathanial Sloss <nathanialsloss (at) yahoo.com.au>
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  * POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #ifndef _SYS_ARCH_MAC68K_OBIO_ASCREG_H
     30 #define _SYS_ARCH_MAC68K_OBIO_ASCREG_H
     31 
     32 #define ASCIRQ		5
     33 
     34 #define EASC_VER	0xb0
     35 #define EASC_VER2	0xbb
     36 
     37 #define FIFO_A		0
     38 #define FIFO_B		0x400
     39 #define FIFO_A_ALT	0x1000
     40 #define FIFO_B_ALT	0x1800
     41 #define FIFO_LEN	0x400
     42 
     43 #define VERLOC		0x800
     44 
     45 #define ASCMODE		0x801
     46 #define MODESTOP	0
     47 #define MODEFIFO	1
     48 #define MODEWAVE	2 		/* not in easc */
     49 
     50 #define ASCTRL		0x802
     51 #define UNDERRUN	__BIT(7)
     52 #define STEREO		__BIT(1)
     53 #define ANAPWM		__BIT(0)
     54 
     55 #define FIFOPARAM	0x803
     56 #define CLEARFIFO	__BIT(7)
     57 #define NONCOMP		__BIT(1)
     58 #define ROMCOMP		__BIT(0)
     59 
     60 #define FIFOSTATUS	0x804
     61 #define A_HALF		__BIT(0)
     62 #define A_FULL		__BIT(1)
     63 #define B_HALF		__BIT(2)
     64 #define B_FULL		__BIT(3)
     65 
     66 #define INTVOL		0x806		/* b2-b4 Int volume. b5-b7 ext. */
     67 
     68 #define ASCRATE		0x807
     69 #define MACFREQ		0 		/* 22254 Hz */
     70 #define F22KHZ		2		/* 22050 Hz */
     71 #define F44KHZ		3		/* 44100 Hz */
     72 
     73 #define APLAYREC	0x80a
     74 #define RECORDA		__BIT(0)
     75 #define REC22KHZ	__BIT(1)
     76 
     77 #define ASCTEST		0x80f
     78 
     79 #define	A_WRITEPTRHI	0xf00
     80 #define	A_WRITEPTRLO	0xf01
     81 #define	A_READPTRHI	0xf02
     82 #define	A_READPTRLO	0xf03
     83 #define	B_WRITEPTRHI	0xf20
     84 #define	B_WRITEPTRLO	0xf21
     85 #define	B_READPTRHI	0xf22
     86 #define	B_READPTRLO	0xf23
     87 
     88 #define MACOS_HIGH_VOL	0x36  /* Should NOT exceed this value */
     89 
     90 #define A_LEFT_VOL	0xf06
     91 #define A_RIGHT_VOL	0xf07
     92 #define B_LEFT_VOL	0xf26
     93 #define B_RIGHT_VOL	0xf27
     94 
     95 #define FIFOCTRLA	0xf08
     96 #define FIFOCTRLB	0xf28
     97 #define CDQUALITY	0x81
     98 #define MACDEFAULTS	0x80
     99 
    100 #define IRQA		0xf09
    101 #define IRQB		0xf29
    102 #define DISABLEHALFIRQ	__BIT(0)
    103 
    104 /* Digitally Filtered Audio Chip (dfac) VIA2 Bits */
    105 #define DFAC_CLOCK 	(__BIT(4))
    106 #define DFAC_DATA	(__BIT(3))
    107 #define DFAC_LATCH	(__BIT(0))
    108 
    109 /* dfac config byte */
    110 #define DFAC_DISABLE	0
    111 #define DFAC_GAIN_HIGH	0x0c
    112 
    113 #endif /* !_SYS_ARCH_MAC68K_OBIO_ASCREG_H */
    114