neomagic.h revision 55639
1/*
2 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
3 * All rights reserved.
4 *
5 * Derived from the public domain Linux driver
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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/sound/pci/neomagic.h 55639 2000-01-09 08:14:11Z cg $
29 */
30
31#ifndef _NM256_H_
32#define _NM256_H_
33
34/* The BIOS signature. */
35#define NM_SIGNATURE 0x4e4d0000
36/* Signature mask. */
37#define NM_SIG_MASK 0xffff0000
38
39/* Size of the second memory area. */
40#define NM_PORT2_SIZE 4096
41
42/* The base offset of the mixer in the second memory area. */
43#define NM_MIXER_OFFSET 0x600
44
45/* The maximum size of a coefficient entry. */
46#define NM_MAX_COEFFICIENT 0x5000
47
48/* The interrupt register. */
49#define NM_INT_REG 0xa04
50/* And its bits. */
51#define NM_PLAYBACK_INT 0x40
52#define NM_RECORD_INT 0x100
53#define NM_MISC_INT_1 0x4000
54#define NM_MISC_INT_2 0x1
55
56/* The AV's "mixer ready" status bit and location. */
57#define NM_MIXER_STATUS_OFFSET 0xa04
58#define NM_MIXER_READY_MASK 0x0800
59
60/*
61 * For the ZX.  It uses the same interrupt register, but it holds 32
62 * bits instead of 16.
63 */
64#define NM2_PLAYBACK_INT 0x10000
65#define NM2_RECORD_INT 0x80000
66#define NM2_MISC_INT_1 0x8
67#define NM2_MISC_INT_2 0x2
68
69/* The ZX's "mixer ready" status bit and location. */
70#define NM2_MIXER_STATUS_OFFSET 0xa06
71#define NM2_MIXER_READY_MASK 0x0800
72
73/* The playback registers start from here. */
74#define NM_PLAYBACK_REG_OFFSET 0x0
75/* The record registers start from here. */
76#define NM_RECORD_REG_OFFSET 0x200
77
78/* The rate register is located 2 bytes from the start of the register area. */
79#define NM_RATE_REG_OFFSET 2
80
81/* Mono/stereo flag, number of bits on playback, and rate mask. */
82#define NM_RATE_STEREO 1
83#define NM_RATE_BITS_16 2
84#define NM_RATE_MASK 0xf0
85
86/* Playback enable register. */
87#define NM_PLAYBACK_ENABLE_REG (NM_PLAYBACK_REG_OFFSET + 0x1)
88#define NM_PLAYBACK_ENABLE_FLAG 1
89#define NM_PLAYBACK_ONESHOT 2
90#define NM_PLAYBACK_FREERUN 4
91
92/* Mutes the audio output. */
93#define NM_AUDIO_MUTE_REG (NM_PLAYBACK_REG_OFFSET + 0x18)
94#define NM_AUDIO_MUTE_LEFT 0x8000
95#define NM_AUDIO_MUTE_RIGHT 0x0080
96#define NM_AUDIO_MUTE_BOTH 0x8080
97
98/* Recording enable register. */
99#define NM_RECORD_ENABLE_REG (NM_RECORD_REG_OFFSET + 0)
100#define NM_RECORD_ENABLE_FLAG 1
101#define NM_RECORD_FREERUN 2
102
103#define NM_RBUFFER_START (NM_RECORD_REG_OFFSET + 0x4)
104#define NM_RBUFFER_END   (NM_RECORD_REG_OFFSET + 0x10)
105#define NM_RBUFFER_WMARK (NM_RECORD_REG_OFFSET + 0xc)
106#define NM_RBUFFER_CURRP (NM_RECORD_REG_OFFSET + 0x8)
107
108#define NM_PBUFFER_START (NM_PLAYBACK_REG_OFFSET + 0x4)
109#define NM_PBUFFER_END   (NM_PLAYBACK_REG_OFFSET + 0x14)
110#define NM_PBUFFER_WMARK (NM_PLAYBACK_REG_OFFSET + 0xc)
111#define NM_PBUFFER_CURRP (NM_PLAYBACK_REG_OFFSET + 0x8)
112
113
114#endif
115