Revision 47b43a1f
b/hw/alpha/alpha_sys.h | ||
---|---|---|
1 |
/* Alpha cores and system support chips. */ |
|
2 |
|
|
3 |
#ifndef HW_ALPHA_H |
|
4 |
#define HW_ALPHA_H 1 |
|
5 |
|
|
6 |
#include "hw/pci/pci.h" |
|
7 |
#include "hw/pci/pci_host.h" |
|
8 |
#include "hw/ide.h" |
|
9 |
#include "hw/i386/pc.h" |
|
10 |
#include "hw/irq.h" |
|
11 |
|
|
12 |
|
|
13 |
PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, AlphaCPU *[4], |
|
14 |
pci_map_irq_fn); |
|
15 |
|
|
16 |
/* alpha_pci.c. */ |
|
17 |
extern const MemoryRegionOps alpha_pci_bw_io_ops; |
|
18 |
extern const MemoryRegionOps alpha_pci_conf1_ops; |
|
19 |
extern const MemoryRegionOps alpha_pci_iack_ops; |
|
20 |
|
|
21 |
#endif |
b/hw/alpha/dp264.c | ||
---|---|---|
10 | 10 |
#include "elf.h" |
11 | 11 |
#include "hw/loader.h" |
12 | 12 |
#include "hw/boards.h" |
13 |
#include "hw/alpha_sys.h"
|
|
13 |
#include "alpha_sys.h" |
|
14 | 14 |
#include "sysemu/sysemu.h" |
15 | 15 |
#include "hw/timer/mc146818rtc.h" |
16 | 16 |
#include "hw/ide.h" |
b/hw/alpha/pci.c | ||
---|---|---|
7 | 7 |
*/ |
8 | 8 |
|
9 | 9 |
#include "config.h" |
10 |
#include "hw/alpha_sys.h"
|
|
10 |
#include "alpha_sys.h" |
|
11 | 11 |
#include "qemu/log.h" |
12 | 12 |
#include "sysemu/sysemu.h" |
13 | 13 |
|
b/hw/alpha/typhoon.c | ||
---|---|---|
11 | 11 |
#include "hw/hw.h" |
12 | 12 |
#include "hw/arm/devices.h" |
13 | 13 |
#include "sysemu/sysemu.h" |
14 |
#include "hw/alpha_sys.h"
|
|
14 |
#include "alpha_sys.h" |
|
15 | 15 |
#include "exec/address-spaces.h" |
16 | 16 |
|
17 | 17 |
|
/dev/null | ||
---|---|---|
1 |
/* Alpha cores and system support chips. */ |
|
2 |
|
|
3 |
#ifndef HW_ALPHA_H |
|
4 |
#define HW_ALPHA_H 1 |
|
5 |
|
|
6 |
#include "hw/pci/pci.h" |
|
7 |
#include "hw/pci/pci_host.h" |
|
8 |
#include "hw/ide.h" |
|
9 |
#include "hw/i386/pc.h" |
|
10 |
#include "hw/irq.h" |
|
11 |
|
|
12 |
|
|
13 |
PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, AlphaCPU *[4], |
|
14 |
pci_map_irq_fn); |
|
15 |
|
|
16 |
/* alpha_pci.c. */ |
|
17 |
extern const MemoryRegionOps alpha_pci_bw_io_ops; |
|
18 |
extern const MemoryRegionOps alpha_pci_conf1_ops; |
|
19 |
extern const MemoryRegionOps alpha_pci_iack_ops; |
|
20 |
|
|
21 |
#endif |
b/hw/arm/collie.c | ||
---|---|---|
12 | 12 |
#include "hw/sysbus.h" |
13 | 13 |
#include "hw/boards.h" |
14 | 14 |
#include "hw/arm/devices.h" |
15 |
#include "hw/strongarm.h"
|
|
15 |
#include "strongarm.h" |
|
16 | 16 |
#include "hw/arm.h" |
17 | 17 |
#include "hw/block/flash.h" |
18 | 18 |
#include "sysemu/blockdev.h" |
b/hw/arm/strongarm.c | ||
---|---|---|
27 | 27 |
* GNU GPL, version 2 or (at your option) any later version. |
28 | 28 |
*/ |
29 | 29 |
#include "hw/sysbus.h" |
30 |
#include "hw/strongarm.h"
|
|
30 |
#include "strongarm.h" |
|
31 | 31 |
#include "qemu/error-report.h" |
32 | 32 |
#include "hw/arm.h" |
33 | 33 |
#include "char/char.h" |
b/hw/arm/strongarm.h | ||
---|---|---|
1 |
#ifndef _STRONGARM_H |
|
2 |
#define _STRONGARM_H |
|
3 |
|
|
4 |
#include "exec/memory.h" |
|
5 |
|
|
6 |
#define SA_CS0 0x00000000 |
|
7 |
#define SA_CS1 0x08000000 |
|
8 |
#define SA_CS2 0x10000000 |
|
9 |
#define SA_CS3 0x18000000 |
|
10 |
#define SA_PCMCIA_CS0 0x20000000 |
|
11 |
#define SA_PCMCIA_CS1 0x30000000 |
|
12 |
#define SA_CS4 0x40000000 |
|
13 |
#define SA_CS5 0x48000000 |
|
14 |
/* system registers here */ |
|
15 |
#define SA_SDCS0 0xc0000000 |
|
16 |
#define SA_SDCS1 0xc8000000 |
|
17 |
#define SA_SDCS2 0xd0000000 |
|
18 |
#define SA_SDCS3 0xd8000000 |
|
19 |
|
|
20 |
enum { |
|
21 |
SA_PIC_GPIO0_EDGE = 0, |
|
22 |
SA_PIC_GPIO1_EDGE, |
|
23 |
SA_PIC_GPIO2_EDGE, |
|
24 |
SA_PIC_GPIO3_EDGE, |
|
25 |
SA_PIC_GPIO4_EDGE, |
|
26 |
SA_PIC_GPIO5_EDGE, |
|
27 |
SA_PIC_GPIO6_EDGE, |
|
28 |
SA_PIC_GPIO7_EDGE, |
|
29 |
SA_PIC_GPIO8_EDGE, |
|
30 |
SA_PIC_GPIO9_EDGE, |
|
31 |
SA_PIC_GPIO10_EDGE, |
|
32 |
SA_PIC_GPIOX_EDGE, |
|
33 |
SA_PIC_LCD, |
|
34 |
SA_PIC_UDC, |
|
35 |
SA_PIC_RSVD1, |
|
36 |
SA_PIC_UART1, |
|
37 |
SA_PIC_UART2, |
|
38 |
SA_PIC_UART3, |
|
39 |
SA_PIC_MCP, |
|
40 |
SA_PIC_SSP, |
|
41 |
SA_PIC_DMA_CH0, |
|
42 |
SA_PIC_DMA_CH1, |
|
43 |
SA_PIC_DMA_CH2, |
|
44 |
SA_PIC_DMA_CH3, |
|
45 |
SA_PIC_DMA_CH4, |
|
46 |
SA_PIC_DMA_CH5, |
|
47 |
SA_PIC_OSTC0, |
|
48 |
SA_PIC_OSTC1, |
|
49 |
SA_PIC_OSTC2, |
|
50 |
SA_PIC_OSTC3, |
|
51 |
SA_PIC_RTC_HZ, |
|
52 |
SA_PIC_RTC_ALARM, |
|
53 |
}; |
|
54 |
|
|
55 |
typedef struct { |
|
56 |
ARMCPU *cpu; |
|
57 |
MemoryRegion sdram; |
|
58 |
DeviceState *pic; |
|
59 |
DeviceState *gpio; |
|
60 |
DeviceState *ppc; |
|
61 |
DeviceState *ssp; |
|
62 |
SSIBus *ssp_bus; |
|
63 |
} StrongARMState; |
|
64 |
|
|
65 |
StrongARMState *sa1110_init(MemoryRegion *sysmem, |
|
66 |
unsigned int sdram_size, const char *rev); |
|
67 |
|
|
68 |
#endif |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* ARM GIC support - internal interfaces |
|
3 |
* |
|
4 |
* Copyright (c) 2012 Linaro Limited |
|
5 |
* Written by Peter Maydell |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or modify |
|
8 |
* it under the terms of the GNU General Public License as published by |
|
9 |
* the Free Software Foundation, either version 2 of the License, or |
|
10 |
* (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License along |
|
18 |
* with this program; if not, see <http://www.gnu.org/licenses/>. |
|
19 |
*/ |
|
20 |
|
|
21 |
#ifndef QEMU_ARM_GIC_INTERNAL_H |
|
22 |
#define QEMU_ARM_GIC_INTERNAL_H |
|
23 |
|
|
24 |
#include "hw/sysbus.h" |
|
25 |
|
|
26 |
/* Maximum number of possible interrupts, determined by the GIC architecture */ |
|
27 |
#define GIC_MAXIRQ 1020 |
|
28 |
/* First 32 are private to each CPU (SGIs and PPIs). */ |
|
29 |
#define GIC_INTERNAL 32 |
|
30 |
/* Maximum number of possible CPU interfaces, determined by GIC architecture */ |
|
31 |
#define NCPU 8 |
|
32 |
|
|
33 |
#define ALL_CPU_MASK ((unsigned)(((1 << NCPU) - 1))) |
|
34 |
|
|
35 |
/* The NVIC has 16 internal vectors. However these are not exposed |
|
36 |
through the normal GIC interface. */ |
|
37 |
#define GIC_BASE_IRQ ((s->revision == REV_NVIC) ? 32 : 0) |
|
38 |
|
|
39 |
#define GIC_SET_ENABLED(irq, cm) s->irq_state[irq].enabled |= (cm) |
|
40 |
#define GIC_CLEAR_ENABLED(irq, cm) s->irq_state[irq].enabled &= ~(cm) |
|
41 |
#define GIC_TEST_ENABLED(irq, cm) ((s->irq_state[irq].enabled & (cm)) != 0) |
|
42 |
#define GIC_SET_PENDING(irq, cm) s->irq_state[irq].pending |= (cm) |
|
43 |
#define GIC_CLEAR_PENDING(irq, cm) s->irq_state[irq].pending &= ~(cm) |
|
44 |
#define GIC_TEST_PENDING(irq, cm) ((s->irq_state[irq].pending & (cm)) != 0) |
|
45 |
#define GIC_SET_ACTIVE(irq, cm) s->irq_state[irq].active |= (cm) |
|
46 |
#define GIC_CLEAR_ACTIVE(irq, cm) s->irq_state[irq].active &= ~(cm) |
|
47 |
#define GIC_TEST_ACTIVE(irq, cm) ((s->irq_state[irq].active & (cm)) != 0) |
|
48 |
#define GIC_SET_MODEL(irq) s->irq_state[irq].model = true |
|
49 |
#define GIC_CLEAR_MODEL(irq) s->irq_state[irq].model = false |
|
50 |
#define GIC_TEST_MODEL(irq) s->irq_state[irq].model |
|
51 |
#define GIC_SET_LEVEL(irq, cm) s->irq_state[irq].level = (cm) |
|
52 |
#define GIC_CLEAR_LEVEL(irq, cm) s->irq_state[irq].level &= ~(cm) |
|
53 |
#define GIC_TEST_LEVEL(irq, cm) ((s->irq_state[irq].level & (cm)) != 0) |
|
54 |
#define GIC_SET_TRIGGER(irq) s->irq_state[irq].trigger = true |
|
55 |
#define GIC_CLEAR_TRIGGER(irq) s->irq_state[irq].trigger = false |
|
56 |
#define GIC_TEST_TRIGGER(irq) s->irq_state[irq].trigger |
|
57 |
#define GIC_GET_PRIORITY(irq, cpu) (((irq) < GIC_INTERNAL) ? \ |
|
58 |
s->priority1[irq][cpu] : \ |
|
59 |
s->priority2[(irq) - GIC_INTERNAL]) |
|
60 |
#define GIC_TARGET(irq) s->irq_target[irq] |
|
61 |
|
|
62 |
typedef struct gic_irq_state { |
|
63 |
/* The enable bits are only banked for per-cpu interrupts. */ |
|
64 |
uint8_t enabled; |
|
65 |
uint8_t pending; |
|
66 |
uint8_t active; |
|
67 |
uint8_t level; |
|
68 |
bool model; /* 0 = N:N, 1 = 1:N */ |
|
69 |
bool trigger; /* nonzero = edge triggered. */ |
|
70 |
} gic_irq_state; |
|
71 |
|
|
72 |
typedef struct GICState { |
|
73 |
SysBusDevice busdev; |
|
74 |
qemu_irq parent_irq[NCPU]; |
|
75 |
bool enabled; |
|
76 |
bool cpu_enabled[NCPU]; |
|
77 |
|
|
78 |
gic_irq_state irq_state[GIC_MAXIRQ]; |
|
79 |
uint8_t irq_target[GIC_MAXIRQ]; |
|
80 |
uint8_t priority1[GIC_INTERNAL][NCPU]; |
|
81 |
uint8_t priority2[GIC_MAXIRQ - GIC_INTERNAL]; |
|
82 |
uint16_t last_active[GIC_MAXIRQ][NCPU]; |
|
83 |
|
|
84 |
uint16_t priority_mask[NCPU]; |
|
85 |
uint16_t running_irq[NCPU]; |
|
86 |
uint16_t running_priority[NCPU]; |
|
87 |
uint16_t current_pending[NCPU]; |
|
88 |
|
|
89 |
uint32_t num_cpu; |
|
90 |
|
|
91 |
MemoryRegion iomem; /* Distributor */ |
|
92 |
/* This is just so we can have an opaque pointer which identifies |
|
93 |
* both this GIC and which CPU interface we should be accessing. |
|
94 |
*/ |
|
95 |
struct GICState *backref[NCPU]; |
|
96 |
MemoryRegion cpuiomem[NCPU+1]; /* CPU interfaces */ |
|
97 |
uint32_t num_irq; |
|
98 |
uint32_t revision; |
|
99 |
} GICState; |
|
100 |
|
|
101 |
/* The special cases for the revision property: */ |
|
102 |
#define REV_11MPCORE 0 |
|
103 |
#define REV_NVIC 0xffffffff |
|
104 |
|
|
105 |
void gic_set_pending_private(GICState *s, int cpu, int irq); |
|
106 |
uint32_t gic_acknowledge_irq(GICState *s, int cpu); |
|
107 |
void gic_complete_irq(GICState *s, int cpu, int irq); |
|
108 |
void gic_update(GICState *s); |
|
109 |
void gic_init_irqs_and_distributor(GICState *s, int num_irq); |
|
110 |
|
|
111 |
#define TYPE_ARM_GIC_COMMON "arm_gic_common" |
|
112 |
#define ARM_GIC_COMMON(obj) \ |
|
113 |
OBJECT_CHECK(GICState, (obj), TYPE_ARM_GIC_COMMON) |
|
114 |
#define ARM_GIC_COMMON_CLASS(klass) \ |
|
115 |
OBJECT_CLASS_CHECK(ARMGICCommonClass, (klass), TYPE_ARM_GIC_COMMON) |
|
116 |
#define ARM_GIC_COMMON_GET_CLASS(obj) \ |
|
117 |
OBJECT_GET_CLASS(ARMGICCommonClass, (obj), TYPE_ARM_GIC_COMMON) |
|
118 |
|
|
119 |
typedef struct ARMGICCommonClass { |
|
120 |
SysBusDeviceClass parent_class; |
|
121 |
void (*pre_save)(GICState *s); |
|
122 |
void (*post_load)(GICState *s); |
|
123 |
} ARMGICCommonClass; |
|
124 |
|
|
125 |
#define TYPE_ARM_GIC "arm_gic" |
|
126 |
#define ARM_GIC(obj) \ |
|
127 |
OBJECT_CHECK(GICState, (obj), TYPE_ARM_GIC) |
|
128 |
#define ARM_GIC_CLASS(klass) \ |
|
129 |
OBJECT_CLASS_CHECK(ARMGICClass, (klass), TYPE_ARM_GIC) |
|
130 |
#define ARM_GIC_GET_CLASS(obj) \ |
|
131 |
OBJECT_GET_CLASS(ARMGICClass, (obj), TYPE_ARM_GIC) |
|
132 |
|
|
133 |
typedef struct ARMGICClass { |
|
134 |
ARMGICCommonClass parent_class; |
|
135 |
DeviceRealize parent_realize; |
|
136 |
} ARMGICClass; |
|
137 |
|
|
138 |
#endif /* !QEMU_ARM_GIC_INTERNAL_H */ |
b/hw/audio/adlib.c | ||
---|---|---|
47 | 47 |
void YMF262UpdateOneQEMU (int which, INT16 *dst, int length); |
48 | 48 |
#define SHIFT 2 |
49 | 49 |
#else |
50 |
#include "hw/fmopl.h"
|
|
50 |
#include "fmopl.h" |
|
51 | 51 |
#define SHIFT 1 |
52 | 52 |
#endif |
53 | 53 |
|
b/hw/audio/fmopl.c | ||
---|---|---|
39 | 39 |
#include <stdarg.h> |
40 | 40 |
#include <math.h> |
41 | 41 |
//#include "driver.h" /* use M.A.M.E. */ |
42 |
#include "hw/fmopl.h"
|
|
42 |
#include "fmopl.h" |
|
43 | 43 |
|
44 | 44 |
#ifndef PI |
45 | 45 |
#define PI 3.14159265358979323846 |
b/hw/audio/fmopl.h | ||
---|---|---|
1 |
#ifndef __FMOPL_H_ |
|
2 |
#define __FMOPL_H_ |
|
3 |
|
|
4 |
/* --- select emulation chips --- */ |
|
5 |
#define BUILD_YM3812 (HAS_YM3812) |
|
6 |
//#define BUILD_YM3526 (HAS_YM3526) |
|
7 |
//#define BUILD_Y8950 (HAS_Y8950) |
|
8 |
|
|
9 |
/* --- system optimize --- */ |
|
10 |
/* select bit size of output : 8 or 16 */ |
|
11 |
#define OPL_OUTPUT_BIT 16 |
|
12 |
|
|
13 |
/* compiler dependence */ |
|
14 |
#ifndef OSD_CPU_H |
|
15 |
#define OSD_CPU_H |
|
16 |
typedef unsigned char UINT8; /* unsigned 8bit */ |
|
17 |
typedef unsigned short UINT16; /* unsigned 16bit */ |
|
18 |
typedef unsigned int UINT32; /* unsigned 32bit */ |
|
19 |
typedef signed char INT8; /* signed 8bit */ |
|
20 |
typedef signed short INT16; /* signed 16bit */ |
|
21 |
typedef signed int INT32; /* signed 32bit */ |
|
22 |
#endif |
|
23 |
|
|
24 |
#if (OPL_OUTPUT_BIT==16) |
|
25 |
typedef INT16 OPLSAMPLE; |
|
26 |
#endif |
|
27 |
#if (OPL_OUTPUT_BIT==8) |
|
28 |
typedef unsigned char OPLSAMPLE; |
|
29 |
#endif |
|
30 |
|
|
31 |
|
|
32 |
#if BUILD_Y8950 |
|
33 |
#include "ymdeltat.h" |
|
34 |
#endif |
|
35 |
|
|
36 |
typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec); |
|
37 |
typedef void (*OPL_IRQHANDLER)(int param,int irq); |
|
38 |
typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us); |
|
39 |
typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data); |
|
40 |
typedef unsigned char (*OPL_PORTHANDLER_R)(int param); |
|
41 |
|
|
42 |
/* !!!!! here is private section , do not access there member direct !!!!! */ |
|
43 |
|
|
44 |
#define OPL_TYPE_WAVESEL 0x01 /* waveform select */ |
|
45 |
#define OPL_TYPE_ADPCM 0x02 /* DELTA-T ADPCM unit */ |
|
46 |
#define OPL_TYPE_KEYBOARD 0x04 /* keyboard interface */ |
|
47 |
#define OPL_TYPE_IO 0x08 /* I/O port */ |
|
48 |
|
|
49 |
/* Saving is necessary for member of the 'R' mark for suspend/resume */ |
|
50 |
/* ---------- OPL one of slot ---------- */ |
|
51 |
typedef struct fm_opl_slot { |
|
52 |
INT32 TL; /* total level :TL << 8 */ |
|
53 |
INT32 TLL; /* adjusted now TL */ |
|
54 |
UINT8 KSR; /* key scale rate :(shift down bit) */ |
|
55 |
INT32 *AR; /* attack rate :&AR_TABLE[AR<<2] */ |
|
56 |
INT32 *DR; /* decay rate :&DR_TALBE[DR<<2] */ |
|
57 |
INT32 SL; /* sustin level :SL_TALBE[SL] */ |
|
58 |
INT32 *RR; /* release rate :&DR_TABLE[RR<<2] */ |
|
59 |
UINT8 ksl; /* keyscale level :(shift down bits) */ |
|
60 |
UINT8 ksr; /* key scale rate :kcode>>KSR */ |
|
61 |
UINT32 mul; /* multiple :ML_TABLE[ML] */ |
|
62 |
UINT32 Cnt; /* frequency count : */ |
|
63 |
UINT32 Incr; /* frequency step : */ |
|
64 |
/* envelope generator state */ |
|
65 |
UINT8 eg_typ; /* envelope type flag */ |
|
66 |
UINT8 evm; /* envelope phase */ |
|
67 |
INT32 evc; /* envelope counter */ |
|
68 |
INT32 eve; /* envelope counter end point */ |
|
69 |
INT32 evs; /* envelope counter step */ |
|
70 |
INT32 evsa; /* envelope step for AR :AR[ksr] */ |
|
71 |
INT32 evsd; /* envelope step for DR :DR[ksr] */ |
|
72 |
INT32 evsr; /* envelope step for RR :RR[ksr] */ |
|
73 |
/* LFO */ |
|
74 |
UINT8 ams; /* ams flag */ |
|
75 |
UINT8 vib; /* vibrate flag */ |
|
76 |
/* wave selector */ |
|
77 |
INT32 **wavetable; |
|
78 |
}OPL_SLOT; |
|
79 |
|
|
80 |
/* ---------- OPL one of channel ---------- */ |
|
81 |
typedef struct fm_opl_channel { |
|
82 |
OPL_SLOT SLOT[2]; |
|
83 |
UINT8 CON; /* connection type */ |
|
84 |
UINT8 FB; /* feed back :(shift down bit) */ |
|
85 |
INT32 *connect1; /* slot1 output pointer */ |
|
86 |
INT32 *connect2; /* slot2 output pointer */ |
|
87 |
INT32 op1_out[2]; /* slot1 output for selfeedback */ |
|
88 |
/* phase generator state */ |
|
89 |
UINT32 block_fnum; /* block+fnum : */ |
|
90 |
UINT8 kcode; /* key code : KeyScaleCode */ |
|
91 |
UINT32 fc; /* Freq. Increment base */ |
|
92 |
UINT32 ksl_base; /* KeyScaleLevel Base step */ |
|
93 |
UINT8 keyon; /* key on/off flag */ |
|
94 |
} OPL_CH; |
|
95 |
|
|
96 |
/* OPL state */ |
|
97 |
typedef struct fm_opl_f { |
|
98 |
UINT8 type; /* chip type */ |
|
99 |
int clock; /* master clock (Hz) */ |
|
100 |
int rate; /* sampling rate (Hz) */ |
|
101 |
double freqbase; /* frequency base */ |
|
102 |
double TimerBase; /* Timer base time (==sampling time) */ |
|
103 |
UINT8 address; /* address register */ |
|
104 |
UINT8 status; /* status flag */ |
|
105 |
UINT8 statusmask; /* status mask */ |
|
106 |
UINT32 mode; /* Reg.08 : CSM , notesel,etc. */ |
|
107 |
/* Timer */ |
|
108 |
int T[2]; /* timer counter */ |
|
109 |
UINT8 st[2]; /* timer enable */ |
|
110 |
/* FM channel slots */ |
|
111 |
OPL_CH *P_CH; /* pointer of CH */ |
|
112 |
int max_ch; /* maximum channel */ |
|
113 |
/* Rhythm sention */ |
|
114 |
UINT8 rhythm; /* Rhythm mode , key flag */ |
|
115 |
#if BUILD_Y8950 |
|
116 |
/* Delta-T ADPCM unit (Y8950) */ |
|
117 |
YM_DELTAT *deltat; /* DELTA-T ADPCM */ |
|
118 |
#endif |
|
119 |
/* Keyboard / I/O interface unit (Y8950) */ |
|
120 |
UINT8 portDirection; |
|
121 |
UINT8 portLatch; |
|
122 |
OPL_PORTHANDLER_R porthandler_r; |
|
123 |
OPL_PORTHANDLER_W porthandler_w; |
|
124 |
int port_param; |
|
125 |
OPL_PORTHANDLER_R keyboardhandler_r; |
|
126 |
OPL_PORTHANDLER_W keyboardhandler_w; |
|
127 |
int keyboard_param; |
|
128 |
/* time tables */ |
|
129 |
INT32 AR_TABLE[75]; /* atttack rate tables */ |
|
130 |
INT32 DR_TABLE[75]; /* decay rate tables */ |
|
131 |
UINT32 FN_TABLE[1024]; /* fnumber -> increment counter */ |
|
132 |
/* LFO */ |
|
133 |
INT32 *ams_table; |
|
134 |
INT32 *vib_table; |
|
135 |
INT32 amsCnt; |
|
136 |
INT32 amsIncr; |
|
137 |
INT32 vibCnt; |
|
138 |
INT32 vibIncr; |
|
139 |
/* wave selector enable flag */ |
|
140 |
UINT8 wavesel; |
|
141 |
/* external event callback handler */ |
|
142 |
OPL_TIMERHANDLER TimerHandler; /* TIMER handler */ |
|
143 |
int TimerParam; /* TIMER parameter */ |
|
144 |
OPL_IRQHANDLER IRQHandler; /* IRQ handler */ |
|
145 |
int IRQParam; /* IRQ parameter */ |
|
146 |
OPL_UPDATEHANDLER UpdateHandler; /* stream update handler */ |
|
147 |
int UpdateParam; /* stream update parameter */ |
|
148 |
} FM_OPL; |
|
149 |
|
|
150 |
/* ---------- Generic interface section ---------- */ |
|
151 |
#define OPL_TYPE_YM3526 (0) |
|
152 |
#define OPL_TYPE_YM3812 (OPL_TYPE_WAVESEL) |
|
153 |
#define OPL_TYPE_Y8950 (OPL_TYPE_ADPCM|OPL_TYPE_KEYBOARD|OPL_TYPE_IO) |
|
154 |
|
|
155 |
FM_OPL *OPLCreate(int type, int clock, int rate); |
|
156 |
void OPLDestroy(FM_OPL *OPL); |
|
157 |
void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset); |
|
158 |
void OPLSetIRQHandler(FM_OPL *OPL,OPL_IRQHANDLER IRQHandler,int param); |
|
159 |
void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int param); |
|
160 |
/* Y8950 port handlers */ |
|
161 |
void OPLSetPortHandler(FM_OPL *OPL,OPL_PORTHANDLER_W PortHandler_w,OPL_PORTHANDLER_R PortHandler_r,int param); |
|
162 |
void OPLSetKeyboardHandler(FM_OPL *OPL,OPL_PORTHANDLER_W KeyboardHandler_w,OPL_PORTHANDLER_R KeyboardHandler_r,int param); |
|
163 |
|
|
164 |
void OPLResetChip(FM_OPL *OPL); |
|
165 |
int OPLWrite(FM_OPL *OPL,int a,int v); |
|
166 |
unsigned char OPLRead(FM_OPL *OPL,int a); |
|
167 |
int OPLTimerOver(FM_OPL *OPL,int c); |
|
168 |
|
|
169 |
/* YM3626/YM3812 local section */ |
|
170 |
void YM3812UpdateOne(FM_OPL *OPL, INT16 *buffer, int length); |
|
171 |
|
|
172 |
void Y8950UpdateOne(FM_OPL *OPL, INT16 *buffer, int length); |
|
173 |
|
|
174 |
#endif |
b/hw/audio/gus.c | ||
---|---|---|
25 | 25 |
#include "hw/audio/audio.h" |
26 | 26 |
#include "audio/audio.h" |
27 | 27 |
#include "hw/isa/isa.h" |
28 |
#include "hw/gusemu.h"
|
|
29 |
#include "hw/gustate.h"
|
|
28 |
#include "gusemu.h" |
|
29 |
#include "gustate.h" |
|
30 | 30 |
|
31 | 31 |
#define dolog(...) AUD_log ("audio", __VA_ARGS__) |
32 | 32 |
#ifdef DEBUG |
b/hw/audio/gusemu.h | ||
---|---|---|
1 |
/* |
|
2 |
* GUSEMU32 - API |
|
3 |
* |
|
4 |
* Copyright (C) 2000-2007 Tibor "TS" Schรผtz |
|
5 |
* |
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
7 |
* of this software and associated documentation files (the "Software"), to deal |
|
8 |
* in the Software without restriction, including without limitation the rights |
|
9 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
* copies of the Software, and to permit persons to whom the Software is |
|
11 |
* furnished to do so, subject to the following conditions: |
|
12 |
* |
|
13 |
* The above copyright notice and this permission notice shall be included in |
|
14 |
* all copies or substantial portions of the Software. |
|
15 |
* |
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
19 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
20 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
22 |
* THE SOFTWARE. |
|
23 |
*/ |
|
24 |
|
|
25 |
#ifndef GUSEMU_H |
|
26 |
#define GUSEMU_H |
|
27 |
|
|
28 |
/* data types (need to be adjusted if neither a VC6 nor a C99 compatible compiler is used) */ |
|
29 |
|
|
30 |
#if defined _WIN32 && defined _MSC_VER /* doesn't support other win32 compilers yet, do it yourself... */ |
|
31 |
typedef unsigned char GUSbyte; |
|
32 |
typedef unsigned short GUSword; |
|
33 |
typedef unsigned int GUSdword; |
|
34 |
typedef signed char GUSchar; |
|
35 |
typedef signed short GUSsample; |
|
36 |
#else |
|
37 |
#include <stdint.h> |
|
38 |
typedef int8_t GUSchar; |
|
39 |
typedef uint8_t GUSbyte; |
|
40 |
typedef uint16_t GUSword; |
|
41 |
typedef uint32_t GUSdword; |
|
42 |
typedef int16_t GUSsample; |
|
43 |
#endif |
|
44 |
|
|
45 |
typedef struct _GUSEmuState |
|
46 |
{ |
|
47 |
GUSbyte *himemaddr; /* 1024*1024 bytes used for storing uploaded samples (+32 additional bytes for read padding) */ |
|
48 |
GUSbyte *gusdatapos; /* (gusdataend-gusdata) bytes used for storing emulated GF1/mixer register states (32*32+4 bytes in initial GUSemu32 version) */ |
|
49 |
uint32_t gusirq; |
|
50 |
uint32_t gusdma; |
|
51 |
unsigned int timer1fraction; |
|
52 |
unsigned int timer2fraction; |
|
53 |
void *opaque; |
|
54 |
} GUSEmuState; |
|
55 |
|
|
56 |
/* ** Callback functions needed: */ |
|
57 |
/* NMI is defined as hwirq=-1 (not supported (yet?)) */ |
|
58 |
/* GUS_irqrequest returns the number of IRQs actually scheduled into the virtual machine */ |
|
59 |
/* Level triggered IRQ simulations normally return 1 */ |
|
60 |
/* Event triggered IRQ simulation can safely ignore GUS_irqclear calls */ |
|
61 |
int GUS_irqrequest(GUSEmuState *state, int hwirq, int num);/* needed in both mixer and bus emulation functions. */ |
|
62 |
void GUS_irqclear( GUSEmuState *state, int hwirq); /* used by gus_write() only - can be left empty for mixer functions */ |
|
63 |
void GUS_dmarequest(GUSEmuState *state); /* used by gus_write() only - can be left empty for mixer functions */ |
|
64 |
|
|
65 |
/* ** ISA bus interface functions: */ |
|
66 |
|
|
67 |
/* Port I/O handlers */ |
|
68 |
/* support the following ports: */ |
|
69 |
/* 2x0,2x6,2x8...2xF,3x0...3x7; */ |
|
70 |
/* optional: 388,389 (at least writes should be forwarded or some GUS detection algorithms will fail) */ |
|
71 |
/* data is passed in host byte order */ |
|
72 |
unsigned int gus_read( GUSEmuState *state, int port, int size); |
|
73 |
void gus_write(GUSEmuState *state, int port, int size, unsigned int data); |
|
74 |
/* size is given in bytes (1 for byte, 2 for word) */ |
|
75 |
|
|
76 |
/* DMA data transfer function */ |
|
77 |
/* data pointed to is passed in native x86 order */ |
|
78 |
void gus_dma_transferdata(GUSEmuState *state, char *dma_addr, unsigned int count, int TC); |
|
79 |
/* Called back by GUS_start_DMA as soon as the emulated DMA controller is ready for a transfer to or from GUS */ |
|
80 |
/* (might be immediately if the DMA controller was programmed first) */ |
|
81 |
/* dma_addr is an already translated address directly pointing to the beginning of the memory block */ |
|
82 |
/* do not forget to update DMA states after the call, including the DREQ and TC flags */ |
|
83 |
/* it is possible to break down a single transfer into multiple ones, but take care that: */ |
|
84 |
/* -dma_count is actually count-1 */ |
|
85 |
/* -before and during a transfer, DREQ is set and TC cleared */ |
|
86 |
/* -when calling gus_dma_transferdata(), TC is only set true for call transferring the last byte */ |
|
87 |
/* -after the last transfer, DREQ is cleared and TC is set */ |
|
88 |
|
|
89 |
/* ** GF1 mixer emulation functions: */ |
|
90 |
/* Usually, gus_irqgen should be called directly after gus_mixvoices if you can meet the recommended ranges. */ |
|
91 |
/* If the interrupts are executed immediately (i.e., are synchronous), it may be useful to break this */ |
|
92 |
/* down into a sequence of gus_mixvoice();gus_irqgen(); calls while mixing an audio block. */ |
|
93 |
/* If the interrupts are asynchronous, it may be needed to use a separate thread mixing into a temporary */ |
|
94 |
/* audio buffer in order to avoid quality loss caused by large numsamples and elapsed_time values. */ |
|
95 |
|
|
96 |
void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, GUSsample *bufferpos); |
|
97 |
/* recommended range: 10 < numsamples < 100 */ |
|
98 |
/* lower values may result in increased rounding error, higher values often cause audible timing delays */ |
|
99 |
|
|
100 |
void gus_irqgen(GUSEmuState *state, unsigned int elapsed_time); |
|
101 |
/* recommended range: 80us < elapsed_time < max(1000us, numsamples/playback_freq) */ |
|
102 |
/* lower values wonยดt provide any benefit at all, higher values can cause audible timing delays */ |
|
103 |
/* note: masked timers are also calculated by this function, thus it might be needed even without any IRQs in use! */ |
|
104 |
|
|
105 |
#endif /* gusemu.h */ |
b/hw/audio/gusemu_hal.c | ||
---|---|---|
26 | 26 |
* TODO: check mixer: see 7.20 of sdk for panning pos (applies to all gus models?)? |
27 | 27 |
*/ |
28 | 28 |
|
29 |
#include "hw/gustate.h"
|
|
30 |
#include "hw/gusemu.h"
|
|
29 |
#include "gustate.h" |
|
30 |
#include "gusemu.h" |
|
31 | 31 |
|
32 | 32 |
#define GUSregb(position) (* (gusptr+(position))) |
33 | 33 |
#define GUSregw(position) (*(GUSword *) (gusptr+(position))) |
b/hw/audio/gusemu_mixer.c | ||
---|---|---|
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 | 24 |
|
25 |
#include "hw/gusemu.h"
|
|
26 |
#include "hw/gustate.h"
|
|
25 |
#include "gusemu.h" |
|
26 |
#include "gustate.h" |
|
27 | 27 |
|
28 | 28 |
#define GUSregb(position) (* (gusptr+(position))) |
29 | 29 |
#define GUSregw(position) (*(GUSword *) (gusptr+(position))) |
b/hw/audio/gustate.h | ||
---|---|---|
1 |
/* |
|
2 |
* GUSEMU32 - persistent GUS register state |
|
3 |
* |
|
4 |
* Copyright (C) 2000-2007 Tibor "TS" Schรผtz |
|
5 |
* |
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
7 |
* of this software and associated documentation files (the "Software"), to deal |
|
8 |
* in the Software without restriction, including without limitation the rights |
|
9 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
* copies of the Software, and to permit persons to whom the Software is |
|
11 |
* furnished to do so, subject to the following conditions: |
|
12 |
* |
|
13 |
* The above copyright notice and this permission notice shall be included in |
|
14 |
* all copies or substantial portions of the Software. |
|
15 |
* |
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
19 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
20 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
22 |
* THE SOFTWARE. |
|
23 |
*/ |
|
24 |
|
|
25 |
#ifndef GUSTATE_H |
|
26 |
#define GUSTATE_H |
|
27 |
|
|
28 |
/*state block offset*/ |
|
29 |
#define gusdata (0) |
|
30 |
|
|
31 |
/* data stored using this structure is in host byte order! */ |
|
32 |
|
|
33 |
/*access type*/ |
|
34 |
#define PortRead (0) |
|
35 |
#define PortWrite (1) |
|
36 |
|
|
37 |
#define Port8Bitacc (0) |
|
38 |
#define Port16Bitacc (1) |
|
39 |
|
|
40 |
/*voice register offsets (in bytes)*/ |
|
41 |
#define VSRegs (0) |
|
42 |
#define VSRControl (0) |
|
43 |
#define VSRegsEnd (VSRControl+VSRegs + 32*(16*2)) |
|
44 |
#define VSRFreq (2) |
|
45 |
#define VSRLoopStartHi (4) |
|
46 |
#define VSRLoopStartLo (6) |
|
47 |
#define VSRLoopEndHi (8) |
|
48 |
#define VSRLoopEndLo (10) |
|
49 |
#define VSRVolRampRate (12) |
|
50 |
#define VSRVolRampStartVol (14) |
|
51 |
#define VSRVolRampEndVol (16) |
|
52 |
#define VSRCurrVol (18) |
|
53 |
#define VSRCurrPosHi (20) |
|
54 |
#define VSRCurrPosLo (22) |
|
55 |
#define VSRPanning (24) |
|
56 |
#define VSRVolRampControl (26) |
|
57 |
|
|
58 |
/*voice register offsets (in words)*/ |
|
59 |
#define wVSRegs (0) |
|
60 |
#define wVSRControl (0) |
|
61 |
#define wVSRegsEnd (wVSRControl+wVSRegs + 32*(16)) |
|
62 |
#define wVSRFreq (1) |
|
63 |
#define wVSRLoopStartHi (2) |
|
64 |
#define wVSRLoopStartLo (3) |
|
65 |
#define wVSRLoopEndHi (4) |
|
66 |
#define wVSRLoopEndLo (5) |
|
67 |
#define wVSRVolRampRate (6) |
|
68 |
#define wVSRVolRampStartVol (7) |
|
69 |
#define wVSRVolRampEndVol (8) |
|
70 |
#define wVSRCurrVol (9) |
|
71 |
#define wVSRCurrPosHi (10) |
|
72 |
#define wVSRCurrPosLo (11) |
|
73 |
#define wVSRPanning (12) |
|
74 |
#define wVSRVolRampControl (13) |
|
75 |
|
|
76 |
/*GUS register state block: 32 voices, padding filled with remaining registers*/ |
|
77 |
#define DataRegLoByte3x4 (VSRVolRampControl+2) |
|
78 |
#define DataRegWord3x4 (DataRegLoByte3x4) |
|
79 |
#define DataRegHiByte3x5 (VSRVolRampControl+2 +1) |
|
80 |
#define DMA_2xB (VSRVolRampControl+2+2) |
|
81 |
#define IRQ_2xB (VSRVolRampControl+2+3) |
|
82 |
|
|
83 |
#define RegCtrl_2xF (VSRVolRampControl+2+(16*2)) |
|
84 |
#define Jumper_2xB (VSRVolRampControl+2+(16*2)+1) |
|
85 |
#define GUS42DMAStart (VSRVolRampControl+2+(16*2)+2) |
|
86 |
|
|
87 |
#define GUS43DRAMIOlo (VSRVolRampControl+2+(16*2)*2) |
|
88 |
#define GUSDRAMPOS24bit (GUS43DRAMIOlo) |
|
89 |
#define GUS44DRAMIOhi (VSRVolRampControl+2+(16*2)*2+2) |
|
90 |
|
|
91 |
#define voicewavetableirq (VSRVolRampControl+2+(16*2)*3) /* voice IRQ pseudoqueue: 1 bit per voice */ |
|
92 |
|
|
93 |
#define voicevolrampirq (VSRVolRampControl+2+(16*2)*4) /* voice IRQ pseudoqueue: 1 bit per voice */ |
|
94 |
|
|
95 |
#define startvoices (VSRVolRampControl+2+(16*2)*5) /* statistics / optimizations */ |
|
96 |
|
|
97 |
#define IRQStatReg2x6 (VSRVolRampControl+2+(16*2)*6) |
|
98 |
#define TimerStatus2x8 (VSRVolRampControl+2+(16*2)*6+1) |
|
99 |
#define TimerDataReg2x9 (VSRVolRampControl+2+(16*2)*6+2) |
|
100 |
#define MixerCtrlReg2x0 (VSRVolRampControl+2+(16*2)*6+3) |
|
101 |
|
|
102 |
#define VoiceSelReg3x2 (VSRVolRampControl+2+(16*2)*7) |
|
103 |
#define FunkSelReg3x3 (VSRVolRampControl+2+(16*2)*7+1) |
|
104 |
#define AdLibStatus2x8 (VSRVolRampControl+2+(16*2)*7+2) |
|
105 |
#define StatRead_2xF (VSRVolRampControl+2+(16*2)*7+3) |
|
106 |
|
|
107 |
#define GUS48SampSpeed (VSRVolRampControl+2+(16*2)*8) |
|
108 |
#define GUS41DMACtrl (VSRVolRampControl+2+(16*2)*8+1) |
|
109 |
#define GUS45TimerCtrl (VSRVolRampControl+2+(16*2)*8+2) |
|
110 |
#define GUS46Counter1 (VSRVolRampControl+2+(16*2)*8+3) |
|
111 |
|
|
112 |
#define GUS47Counter2 (VSRVolRampControl+2+(16*2)*9) |
|
113 |
#define GUS49SampCtrl (VSRVolRampControl+2+(16*2)*9+1) |
|
114 |
#define GUS4cReset (VSRVolRampControl+2+(16*2)*9+2) |
|
115 |
#define NumVoices (VSRVolRampControl+2+(16*2)*9+3) |
|
116 |
|
|
117 |
#define TimerIRQs (VSRVolRampControl+2+(16*2)*10) /* delayed IRQ, statistics */ |
|
118 |
#define BusyTimerIRQs (VSRVolRampControl+2+(16*2)*10+2) /* delayed IRQ, statistics */ |
|
119 |
|
|
120 |
#define AdLibCommand2xA (VSRVolRampControl+2+(16*2)*11) |
|
121 |
#define AdLibData2x9 (VSRVolRampControl+2+(16*2)*11+1) |
|
122 |
#define SB2xCd (VSRVolRampControl+2+(16*2)*11+2) |
|
123 |
#define SB2xE (VSRVolRampControl+2+(16*2)*11+3) |
|
124 |
|
|
125 |
#define SynVoiceIRQ8f (VSRVolRampControl+2+(16*2)*12) |
|
126 |
#define GUS50DMAHigh (VSRVolRampControl+2+(16*2)*12+1) |
|
127 |
|
|
128 |
#define portaccesses (VSRegsEnd) /* statistics / suspend mode */ |
|
129 |
|
|
130 |
#define gusdataend (VSRegsEnd+4) |
|
131 |
|
|
132 |
#endif /* gustate.h */ |
b/hw/audio/hda-codec.c | ||
---|---|---|
19 | 19 |
|
20 | 20 |
#include "hw/hw.h" |
21 | 21 |
#include "hw/pci/pci.h" |
22 |
#include "hw/intel-hda.h"
|
|
23 |
#include "hw/intel-hda-defs.h"
|
|
22 |
#include "intel-hda.h" |
|
23 |
#include "intel-hda-defs.h" |
|
24 | 24 |
#include "audio/audio.h" |
25 | 25 |
|
26 | 26 |
/* -------------------------------------------------------------------------- */ |
b/hw/audio/intel-hda-defs.h | ||
---|---|---|
1 |
#ifndef HW_INTEL_HDA_DEFS_H |
|
2 |
#define HW_INTEL_HDA_DEFS_H |
|
3 |
|
|
4 |
/* qemu */ |
|
5 |
#define HDA_BUFFER_SIZE 256 |
|
6 |
|
|
7 |
/* --------------------------------------------------------------------- */ |
|
8 |
/* from linux/sound/pci/hda/hda_intel.c */ |
|
9 |
|
|
10 |
/* |
|
11 |
* registers |
|
12 |
*/ |
|
13 |
#define ICH6_REG_GCAP 0x00 |
|
14 |
#define ICH6_GCAP_64OK (1 << 0) /* 64bit address support */ |
|
15 |
#define ICH6_GCAP_NSDO (3 << 1) /* # of serial data out signals */ |
|
16 |
#define ICH6_GCAP_BSS (31 << 3) /* # of bidirectional streams */ |
|
17 |
#define ICH6_GCAP_ISS (15 << 8) /* # of input streams */ |
|
18 |
#define ICH6_GCAP_OSS (15 << 12) /* # of output streams */ |
|
19 |
#define ICH6_REG_VMIN 0x02 |
|
20 |
#define ICH6_REG_VMAJ 0x03 |
|
21 |
#define ICH6_REG_OUTPAY 0x04 |
|
22 |
#define ICH6_REG_INPAY 0x06 |
|
23 |
#define ICH6_REG_GCTL 0x08 |
|
24 |
#define ICH6_GCTL_RESET (1 << 0) /* controller reset */ |
|
25 |
#define ICH6_GCTL_FCNTRL (1 << 1) /* flush control */ |
|
26 |
#define ICH6_GCTL_UNSOL (1 << 8) /* accept unsol. response enable */ |
|
27 |
#define ICH6_REG_WAKEEN 0x0c |
|
28 |
#define ICH6_REG_STATESTS 0x0e |
|
29 |
#define ICH6_REG_GSTS 0x10 |
|
30 |
#define ICH6_GSTS_FSTS (1 << 1) /* flush status */ |
|
31 |
#define ICH6_REG_INTCTL 0x20 |
|
32 |
#define ICH6_REG_INTSTS 0x24 |
|
33 |
#define ICH6_REG_WALLCLK 0x30 /* 24Mhz source */ |
|
34 |
#define ICH6_REG_SYNC 0x34 |
|
35 |
#define ICH6_REG_CORBLBASE 0x40 |
|
36 |
#define ICH6_REG_CORBUBASE 0x44 |
|
37 |
#define ICH6_REG_CORBWP 0x48 |
|
38 |
#define ICH6_REG_CORBRP 0x4a |
|
39 |
#define ICH6_CORBRP_RST (1 << 15) /* read pointer reset */ |
|
40 |
#define ICH6_REG_CORBCTL 0x4c |
|
41 |
#define ICH6_CORBCTL_RUN (1 << 1) /* enable DMA */ |
|
42 |
#define ICH6_CORBCTL_CMEIE (1 << 0) /* enable memory error irq */ |
|
43 |
#define ICH6_REG_CORBSTS 0x4d |
|
44 |
#define ICH6_CORBSTS_CMEI (1 << 0) /* memory error indication */ |
|
45 |
#define ICH6_REG_CORBSIZE 0x4e |
|
46 |
|
|
47 |
#define ICH6_REG_RIRBLBASE 0x50 |
|
48 |
#define ICH6_REG_RIRBUBASE 0x54 |
|
49 |
#define ICH6_REG_RIRBWP 0x58 |
|
50 |
#define ICH6_RIRBWP_RST (1 << 15) /* write pointer reset */ |
|
51 |
#define ICH6_REG_RINTCNT 0x5a |
|
52 |
#define ICH6_REG_RIRBCTL 0x5c |
|
53 |
#define ICH6_RBCTL_IRQ_EN (1 << 0) /* enable IRQ */ |
|
54 |
#define ICH6_RBCTL_DMA_EN (1 << 1) /* enable DMA */ |
|
55 |
#define ICH6_RBCTL_OVERRUN_EN (1 << 2) /* enable overrun irq */ |
|
56 |
#define ICH6_REG_RIRBSTS 0x5d |
|
57 |
#define ICH6_RBSTS_IRQ (1 << 0) /* response irq */ |
|
58 |
#define ICH6_RBSTS_OVERRUN (1 << 2) /* overrun irq */ |
|
59 |
#define ICH6_REG_RIRBSIZE 0x5e |
|
60 |
|
|
61 |
#define ICH6_REG_IC 0x60 |
|
62 |
#define ICH6_REG_IR 0x64 |
|
63 |
#define ICH6_REG_IRS 0x68 |
|
64 |
#define ICH6_IRS_VALID (1<<1) |
|
65 |
#define ICH6_IRS_BUSY (1<<0) |
|
66 |
|
|
67 |
#define ICH6_REG_DPLBASE 0x70 |
|
68 |
#define ICH6_REG_DPUBASE 0x74 |
|
69 |
#define ICH6_DPLBASE_ENABLE 0x1 /* Enable position buffer */ |
|
70 |
|
|
71 |
/* SD offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ |
|
72 |
enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; |
|
73 |
|
|
74 |
/* stream register offsets from stream base */ |
|
75 |
#define ICH6_REG_SD_CTL 0x00 |
|
76 |
#define ICH6_REG_SD_STS 0x03 |
|
77 |
#define ICH6_REG_SD_LPIB 0x04 |
|
78 |
#define ICH6_REG_SD_CBL 0x08 |
|
79 |
#define ICH6_REG_SD_LVI 0x0c |
|
80 |
#define ICH6_REG_SD_FIFOW 0x0e |
|
81 |
#define ICH6_REG_SD_FIFOSIZE 0x10 |
|
82 |
#define ICH6_REG_SD_FORMAT 0x12 |
|
83 |
#define ICH6_REG_SD_BDLPL 0x18 |
|
84 |
#define ICH6_REG_SD_BDLPU 0x1c |
|
85 |
|
|
86 |
/* PCI space */ |
|
87 |
#define ICH6_PCIREG_TCSEL 0x44 |
|
88 |
|
|
89 |
/* |
|
90 |
* other constants |
|
91 |
*/ |
|
92 |
|
|
93 |
/* max number of SDs */ |
|
94 |
/* ICH, ATI and VIA have 4 playback and 4 capture */ |
|
95 |
#define ICH6_NUM_CAPTURE 4 |
|
96 |
#define ICH6_NUM_PLAYBACK 4 |
|
97 |
|
|
98 |
/* ULI has 6 playback and 5 capture */ |
|
99 |
#define ULI_NUM_CAPTURE 5 |
|
100 |
#define ULI_NUM_PLAYBACK 6 |
|
101 |
|
|
102 |
/* ATI HDMI has 1 playback and 0 capture */ |
|
103 |
#define ATIHDMI_NUM_CAPTURE 0 |
|
104 |
#define ATIHDMI_NUM_PLAYBACK 1 |
|
105 |
|
|
106 |
/* TERA has 4 playback and 3 capture */ |
|
107 |
#define TERA_NUM_CAPTURE 3 |
|
108 |
#define TERA_NUM_PLAYBACK 4 |
|
109 |
|
|
110 |
/* this number is statically defined for simplicity */ |
|
111 |
#define MAX_AZX_DEV 16 |
|
112 |
|
|
113 |
/* max number of fragments - we may use more if allocating more pages for BDL */ |
|
114 |
#define BDL_SIZE 4096 |
|
115 |
#define AZX_MAX_BDL_ENTRIES (BDL_SIZE / 16) |
|
116 |
#define AZX_MAX_FRAG 32 |
|
117 |
/* max buffer size - no h/w limit, you can increase as you like */ |
|
118 |
#define AZX_MAX_BUF_SIZE (1024*1024*1024) |
|
119 |
|
|
120 |
/* RIRB int mask: overrun[2], response[0] */ |
|
121 |
#define RIRB_INT_RESPONSE 0x01 |
|
122 |
#define RIRB_INT_OVERRUN 0x04 |
|
123 |
#define RIRB_INT_MASK 0x05 |
|
124 |
|
|
125 |
/* STATESTS int mask: S3,SD2,SD1,SD0 */ |
|
126 |
#define AZX_MAX_CODECS 8 |
|
127 |
#define AZX_DEFAULT_CODECS 4 |
|
128 |
#define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1) |
|
129 |
|
|
130 |
/* SD_CTL bits */ |
|
131 |
#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ |
|
132 |
#define SD_CTL_DMA_START 0x02 /* stream DMA start bit */ |
|
133 |
#define SD_CTL_STRIPE (3 << 16) /* stripe control */ |
|
134 |
#define SD_CTL_TRAFFIC_PRIO (1 << 18) /* traffic priority */ |
|
135 |
#define SD_CTL_DIR (1 << 19) /* bi-directional stream */ |
|
136 |
#define SD_CTL_STREAM_TAG_MASK (0xf << 20) |
|
137 |
#define SD_CTL_STREAM_TAG_SHIFT 20 |
|
138 |
|
|
139 |
/* SD_CTL and SD_STS */ |
|
140 |
#define SD_INT_DESC_ERR 0x10 /* descriptor error interrupt */ |
|
141 |
#define SD_INT_FIFO_ERR 0x08 /* FIFO error interrupt */ |
|
142 |
#define SD_INT_COMPLETE 0x04 /* completion interrupt */ |
|
143 |
#define SD_INT_MASK (SD_INT_DESC_ERR|SD_INT_FIFO_ERR|\ |
|
144 |
SD_INT_COMPLETE) |
|
145 |
|
|
146 |
/* SD_STS */ |
|
147 |
#define SD_STS_FIFO_READY 0x20 /* FIFO ready */ |
|
148 |
|
|
149 |
/* INTCTL and INTSTS */ |
|
150 |
#define ICH6_INT_ALL_STREAM 0xff /* all stream interrupts */ |
|
151 |
#define ICH6_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */ |
|
152 |
#define ICH6_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */ |
|
153 |
|
|
154 |
/* below are so far hardcoded - should read registers in future */ |
|
155 |
#define ICH6_MAX_CORB_ENTRIES 256 |
|
156 |
#define ICH6_MAX_RIRB_ENTRIES 256 |
|
157 |
|
|
158 |
/* position fix mode */ |
|
159 |
enum { |
|
160 |
POS_FIX_AUTO, |
|
161 |
POS_FIX_LPIB, |
|
162 |
POS_FIX_POSBUF, |
|
163 |
}; |
|
164 |
|
|
165 |
/* Defines for ATI HD Audio support in SB450 south bridge */ |
|
166 |
#define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 |
|
167 |
#define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 |
|
168 |
|
|
169 |
/* Defines for Nvidia HDA support */ |
|
170 |
#define NVIDIA_HDA_TRANSREG_ADDR 0x4e |
|
171 |
#define NVIDIA_HDA_ENABLE_COHBITS 0x0f |
|
172 |
#define NVIDIA_HDA_ISTRM_COH 0x4d |
|
173 |
#define NVIDIA_HDA_OSTRM_COH 0x4c |
|
174 |
#define NVIDIA_HDA_ENABLE_COHBIT 0x01 |
|
175 |
|
|
176 |
/* Defines for Intel SCH HDA snoop control */ |
|
177 |
#define INTEL_SCH_HDA_DEVC 0x78 |
|
178 |
#define INTEL_SCH_HDA_DEVC_NOSNOOP (0x1<<11) |
|
179 |
|
|
180 |
/* Define IN stream 0 FIFO size offset in VIA controller */ |
|
181 |
#define VIA_IN_STREAM0_FIFO_SIZE_OFFSET 0x90 |
|
182 |
/* Define VIA HD Audio Device ID*/ |
|
183 |
#define VIA_HDAC_DEVICE_ID 0x3288 |
|
184 |
|
|
185 |
/* HD Audio class code */ |
|
186 |
#define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403 |
|
187 |
|
|
188 |
/* --------------------------------------------------------------------- */ |
|
189 |
/* from linux/sound/pci/hda/hda_codec.h */ |
|
190 |
|
|
191 |
/* |
|
192 |
* nodes |
|
193 |
*/ |
|
194 |
#define AC_NODE_ROOT 0x00 |
|
195 |
|
|
196 |
/* |
|
197 |
* function group types |
|
198 |
*/ |
|
199 |
enum { |
|
200 |
AC_GRP_AUDIO_FUNCTION = 0x01, |
|
201 |
AC_GRP_MODEM_FUNCTION = 0x02, |
|
202 |
}; |
|
203 |
|
|
204 |
/* |
|
205 |
* widget types |
|
206 |
*/ |
|
207 |
enum { |
|
208 |
AC_WID_AUD_OUT, /* Audio Out */ |
|
209 |
AC_WID_AUD_IN, /* Audio In */ |
|
210 |
AC_WID_AUD_MIX, /* Audio Mixer */ |
|
211 |
AC_WID_AUD_SEL, /* Audio Selector */ |
|
212 |
AC_WID_PIN, /* Pin Complex */ |
|
213 |
AC_WID_POWER, /* Power */ |
|
214 |
AC_WID_VOL_KNB, /* Volume Knob */ |
|
215 |
AC_WID_BEEP, /* Beep Generator */ |
|
216 |
AC_WID_VENDOR = 0x0f /* Vendor specific */ |
|
217 |
}; |
|
218 |
|
|
219 |
/* |
|
220 |
* GET verbs |
|
221 |
*/ |
|
222 |
#define AC_VERB_GET_STREAM_FORMAT 0x0a00 |
|
223 |
#define AC_VERB_GET_AMP_GAIN_MUTE 0x0b00 |
|
224 |
#define AC_VERB_GET_PROC_COEF 0x0c00 |
|
225 |
#define AC_VERB_GET_COEF_INDEX 0x0d00 |
|
226 |
#define AC_VERB_PARAMETERS 0x0f00 |
|
227 |
#define AC_VERB_GET_CONNECT_SEL 0x0f01 |
|
228 |
#define AC_VERB_GET_CONNECT_LIST 0x0f02 |
|
229 |
#define AC_VERB_GET_PROC_STATE 0x0f03 |
|
230 |
#define AC_VERB_GET_SDI_SELECT 0x0f04 |
|
231 |
#define AC_VERB_GET_POWER_STATE 0x0f05 |
|
232 |
#define AC_VERB_GET_CONV 0x0f06 |
|
233 |
#define AC_VERB_GET_PIN_WIDGET_CONTROL 0x0f07 |
|
234 |
#define AC_VERB_GET_UNSOLICITED_RESPONSE 0x0f08 |
|
235 |
#define AC_VERB_GET_PIN_SENSE 0x0f09 |
|
236 |
#define AC_VERB_GET_BEEP_CONTROL 0x0f0a |
|
237 |
#define AC_VERB_GET_EAPD_BTLENABLE 0x0f0c |
|
238 |
#define AC_VERB_GET_DIGI_CONVERT_1 0x0f0d |
|
239 |
#define AC_VERB_GET_DIGI_CONVERT_2 0x0f0e /* unused */ |
|
240 |
#define AC_VERB_GET_VOLUME_KNOB_CONTROL 0x0f0f |
|
241 |
/* f10-f1a: GPIO */ |
|
242 |
#define AC_VERB_GET_GPIO_DATA 0x0f15 |
|
243 |
#define AC_VERB_GET_GPIO_MASK 0x0f16 |
|
244 |
#define AC_VERB_GET_GPIO_DIRECTION 0x0f17 |
|
245 |
#define AC_VERB_GET_GPIO_WAKE_MASK 0x0f18 |
|
246 |
#define AC_VERB_GET_GPIO_UNSOLICITED_RSP_MASK 0x0f19 |
|
247 |
#define AC_VERB_GET_GPIO_STICKY_MASK 0x0f1a |
|
248 |
#define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c |
|
249 |
/* f20: AFG/MFG */ |
|
250 |
#define AC_VERB_GET_SUBSYSTEM_ID 0x0f20 |
|
251 |
#define AC_VERB_GET_CVT_CHAN_COUNT 0x0f2d |
|
252 |
#define AC_VERB_GET_HDMI_DIP_SIZE 0x0f2e |
|
253 |
#define AC_VERB_GET_HDMI_ELDD 0x0f2f |
|
254 |
#define AC_VERB_GET_HDMI_DIP_INDEX 0x0f30 |
|
255 |
#define AC_VERB_GET_HDMI_DIP_DATA 0x0f31 |
|
256 |
#define AC_VERB_GET_HDMI_DIP_XMIT 0x0f32 |
|
257 |
#define AC_VERB_GET_HDMI_CP_CTRL 0x0f33 |
|
258 |
#define AC_VERB_GET_HDMI_CHAN_SLOT 0x0f34 |
|
259 |
|
|
260 |
/* |
|
261 |
* SET verbs |
|
262 |
*/ |
|
263 |
#define AC_VERB_SET_STREAM_FORMAT 0x200 |
|
264 |
#define AC_VERB_SET_AMP_GAIN_MUTE 0x300 |
|
265 |
#define AC_VERB_SET_PROC_COEF 0x400 |
|
266 |
#define AC_VERB_SET_COEF_INDEX 0x500 |
|
267 |
#define AC_VERB_SET_CONNECT_SEL 0x701 |
|
268 |
#define AC_VERB_SET_PROC_STATE 0x703 |
|
269 |
#define AC_VERB_SET_SDI_SELECT 0x704 |
|
270 |
#define AC_VERB_SET_POWER_STATE 0x705 |
|
271 |
#define AC_VERB_SET_CHANNEL_STREAMID 0x706 |
|
272 |
#define AC_VERB_SET_PIN_WIDGET_CONTROL 0x707 |
|
273 |
#define AC_VERB_SET_UNSOLICITED_ENABLE 0x708 |
|
274 |
#define AC_VERB_SET_PIN_SENSE 0x709 |
|
275 |
#define AC_VERB_SET_BEEP_CONTROL 0x70a |
|
276 |
#define AC_VERB_SET_EAPD_BTLENABLE 0x70c |
|
277 |
#define AC_VERB_SET_DIGI_CONVERT_1 0x70d |
|
278 |
#define AC_VERB_SET_DIGI_CONVERT_2 0x70e |
|
279 |
#define AC_VERB_SET_VOLUME_KNOB_CONTROL 0x70f |
|
280 |
#define AC_VERB_SET_GPIO_DATA 0x715 |
|
281 |
#define AC_VERB_SET_GPIO_MASK 0x716 |
|
282 |
#define AC_VERB_SET_GPIO_DIRECTION 0x717 |
|
283 |
#define AC_VERB_SET_GPIO_WAKE_MASK 0x718 |
|
284 |
#define AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK 0x719 |
|
285 |
#define AC_VERB_SET_GPIO_STICKY_MASK 0x71a |
|
286 |
#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 0x71c |
|
287 |
#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1 0x71d |
|
288 |
#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2 0x71e |
|
289 |
#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_3 0x71f |
|
290 |
#define AC_VERB_SET_EAPD 0x788 |
|
291 |
#define AC_VERB_SET_CODEC_RESET 0x7ff |
|
292 |
#define AC_VERB_SET_CVT_CHAN_COUNT 0x72d |
|
293 |
#define AC_VERB_SET_HDMI_DIP_INDEX 0x730 |
|
294 |
#define AC_VERB_SET_HDMI_DIP_DATA 0x731 |
|
295 |
#define AC_VERB_SET_HDMI_DIP_XMIT 0x732 |
|
296 |
#define AC_VERB_SET_HDMI_CP_CTRL 0x733 |
|
297 |
#define AC_VERB_SET_HDMI_CHAN_SLOT 0x734 |
|
298 |
|
|
299 |
/* |
|
300 |
* Parameter IDs |
|
301 |
*/ |
|
302 |
#define AC_PAR_VENDOR_ID 0x00 |
|
303 |
#define AC_PAR_SUBSYSTEM_ID 0x01 |
|
304 |
#define AC_PAR_REV_ID 0x02 |
|
305 |
#define AC_PAR_NODE_COUNT 0x04 |
|
306 |
#define AC_PAR_FUNCTION_TYPE 0x05 |
|
307 |
#define AC_PAR_AUDIO_FG_CAP 0x08 |
|
308 |
#define AC_PAR_AUDIO_WIDGET_CAP 0x09 |
|
309 |
#define AC_PAR_PCM 0x0a |
|
310 |
#define AC_PAR_STREAM 0x0b |
|
311 |
#define AC_PAR_PIN_CAP 0x0c |
|
312 |
#define AC_PAR_AMP_IN_CAP 0x0d |
|
313 |
#define AC_PAR_CONNLIST_LEN 0x0e |
|
314 |
#define AC_PAR_POWER_STATE 0x0f |
|
315 |
#define AC_PAR_PROC_CAP 0x10 |
|
316 |
#define AC_PAR_GPIO_CAP 0x11 |
|
317 |
#define AC_PAR_AMP_OUT_CAP 0x12 |
|
318 |
#define AC_PAR_VOL_KNB_CAP 0x13 |
|
319 |
#define AC_PAR_HDMI_LPCM_CAP 0x20 |
|
320 |
|
|
321 |
/* |
|
322 |
* AC_VERB_PARAMETERS results (32bit) |
|
323 |
*/ |
|
324 |
|
|
325 |
/* Function Group Type */ |
|
326 |
#define AC_FGT_TYPE (0xff<<0) |
|
327 |
#define AC_FGT_TYPE_SHIFT 0 |
|
328 |
#define AC_FGT_UNSOL_CAP (1<<8) |
|
329 |
|
|
330 |
/* Audio Function Group Capabilities */ |
|
331 |
#define AC_AFG_OUT_DELAY (0xf<<0) |
|
332 |
#define AC_AFG_IN_DELAY (0xf<<8) |
|
333 |
#define AC_AFG_BEEP_GEN (1<<16) |
|
334 |
|
|
335 |
/* Audio Widget Capabilities */ |
|
336 |
#define AC_WCAP_STEREO (1<<0) /* stereo I/O */ |
|
337 |
#define AC_WCAP_IN_AMP (1<<1) /* AMP-in present */ |
|
338 |
#define AC_WCAP_OUT_AMP (1<<2) /* AMP-out present */ |
|
339 |
#define AC_WCAP_AMP_OVRD (1<<3) /* AMP-parameter override */ |
|
340 |
#define AC_WCAP_FORMAT_OVRD (1<<4) /* format override */ |
|
341 |
#define AC_WCAP_STRIPE (1<<5) /* stripe */ |
|
342 |
#define AC_WCAP_PROC_WID (1<<6) /* Proc Widget */ |
|
343 |
#define AC_WCAP_UNSOL_CAP (1<<7) /* Unsol capable */ |
|
344 |
#define AC_WCAP_CONN_LIST (1<<8) /* connection list */ |
|
345 |
#define AC_WCAP_DIGITAL (1<<9) /* digital I/O */ |
|
346 |
#define AC_WCAP_POWER (1<<10) /* power control */ |
|
347 |
#define AC_WCAP_LR_SWAP (1<<11) /* L/R swap */ |
|
348 |
#define AC_WCAP_CP_CAPS (1<<12) /* content protection */ |
|
349 |
#define AC_WCAP_CHAN_CNT_EXT (7<<13) /* channel count ext */ |
|
350 |
#define AC_WCAP_DELAY (0xf<<16) |
|
351 |
#define AC_WCAP_DELAY_SHIFT 16 |
|
352 |
#define AC_WCAP_TYPE (0xf<<20) |
|
353 |
#define AC_WCAP_TYPE_SHIFT 20 |
|
354 |
|
|
355 |
/* supported PCM rates and bits */ |
|
356 |
#define AC_SUPPCM_RATES (0xfff << 0) |
|
357 |
#define AC_SUPPCM_BITS_8 (1<<16) |
|
358 |
#define AC_SUPPCM_BITS_16 (1<<17) |
|
359 |
#define AC_SUPPCM_BITS_20 (1<<18) |
|
360 |
#define AC_SUPPCM_BITS_24 (1<<19) |
|
361 |
#define AC_SUPPCM_BITS_32 (1<<20) |
|
362 |
|
|
363 |
/* supported PCM stream format */ |
|
364 |
#define AC_SUPFMT_PCM (1<<0) |
|
365 |
#define AC_SUPFMT_FLOAT32 (1<<1) |
|
366 |
#define AC_SUPFMT_AC3 (1<<2) |
|
367 |
|
|
368 |
/* GP I/O count */ |
|
369 |
#define AC_GPIO_IO_COUNT (0xff<<0) |
|
370 |
#define AC_GPIO_O_COUNT (0xff<<8) |
|
371 |
#define AC_GPIO_O_COUNT_SHIFT 8 |
|
372 |
#define AC_GPIO_I_COUNT (0xff<<16) |
|
373 |
#define AC_GPIO_I_COUNT_SHIFT 16 |
|
374 |
#define AC_GPIO_UNSOLICITED (1<<30) |
|
375 |
#define AC_GPIO_WAKE (1<<31) |
|
376 |
|
|
377 |
/* Converter stream, channel */ |
|
378 |
#define AC_CONV_CHANNEL (0xf<<0) |
|
379 |
#define AC_CONV_STREAM (0xf<<4) |
|
380 |
#define AC_CONV_STREAM_SHIFT 4 |
|
381 |
|
|
382 |
/* Input converter SDI select */ |
|
383 |
#define AC_SDI_SELECT (0xf<<0) |
|
384 |
|
|
385 |
/* stream format id */ |
|
386 |
#define AC_FMT_CHAN_SHIFT 0 |
|
387 |
#define AC_FMT_CHAN_MASK (0x0f << 0) |
|
388 |
#define AC_FMT_BITS_SHIFT 4 |
|
389 |
#define AC_FMT_BITS_MASK (7 << 4) |
|
390 |
#define AC_FMT_BITS_8 (0 << 4) |
|
391 |
#define AC_FMT_BITS_16 (1 << 4) |
|
392 |
#define AC_FMT_BITS_20 (2 << 4) |
|
393 |
#define AC_FMT_BITS_24 (3 << 4) |
|
394 |
#define AC_FMT_BITS_32 (4 << 4) |
|
395 |
#define AC_FMT_DIV_SHIFT 8 |
|
396 |
#define AC_FMT_DIV_MASK (7 << 8) |
|
397 |
#define AC_FMT_MULT_SHIFT 11 |
|
398 |
#define AC_FMT_MULT_MASK (7 << 11) |
|
399 |
#define AC_FMT_BASE_SHIFT 14 |
|
400 |
#define AC_FMT_BASE_48K (0 << 14) |
|
401 |
#define AC_FMT_BASE_44K (1 << 14) |
|
402 |
#define AC_FMT_TYPE_SHIFT 15 |
|
403 |
#define AC_FMT_TYPE_PCM (0 << 15) |
|
404 |
#define AC_FMT_TYPE_NON_PCM (1 << 15) |
|
405 |
|
|
406 |
/* Unsolicited response control */ |
|
407 |
#define AC_UNSOL_TAG (0x3f<<0) |
|
408 |
#define AC_UNSOL_ENABLED (1<<7) |
|
409 |
#define AC_USRSP_EN AC_UNSOL_ENABLED |
|
410 |
|
|
411 |
/* Unsolicited responses */ |
|
412 |
#define AC_UNSOL_RES_TAG (0x3f<<26) |
|
413 |
#define AC_UNSOL_RES_TAG_SHIFT 26 |
|
414 |
#define AC_UNSOL_RES_SUBTAG (0x1f<<21) |
|
415 |
#define AC_UNSOL_RES_SUBTAG_SHIFT 21 |
|
416 |
#define AC_UNSOL_RES_ELDV (1<<1) /* ELD Data valid (for HDMI) */ |
|
417 |
#define AC_UNSOL_RES_PD (1<<0) /* pinsense detect */ |
|
418 |
#define AC_UNSOL_RES_CP_STATE (1<<1) /* content protection */ |
|
419 |
#define AC_UNSOL_RES_CP_READY (1<<0) /* content protection */ |
|
420 |
|
|
421 |
/* Pin widget capabilies */ |
|
422 |
#define AC_PINCAP_IMP_SENSE (1<<0) /* impedance sense capable */ |
|
423 |
#define AC_PINCAP_TRIG_REQ (1<<1) /* trigger required */ |
|
424 |
#define AC_PINCAP_PRES_DETECT (1<<2) /* presence detect capable */ |
|
425 |
#define AC_PINCAP_HP_DRV (1<<3) /* headphone drive capable */ |
|
426 |
#define AC_PINCAP_OUT (1<<4) /* output capable */ |
|
427 |
#define AC_PINCAP_IN (1<<5) /* input capable */ |
|
428 |
#define AC_PINCAP_BALANCE (1<<6) /* balanced I/O capable */ |
|
429 |
/* Note: This LR_SWAP pincap is defined in the Realtek ALC883 specification, |
|
430 |
* but is marked reserved in the Intel HDA specification. |
|
431 |
*/ |
|
432 |
#define AC_PINCAP_LR_SWAP (1<<7) /* L/R swap */ |
|
433 |
/* Note: The same bit as LR_SWAP is newly defined as HDMI capability |
|
434 |
* in HD-audio specification |
|
435 |
*/ |
|
436 |
#define AC_PINCAP_HDMI (1<<7) /* HDMI pin */ |
|
437 |
#define AC_PINCAP_DP (1<<24) /* DisplayPort pin, can |
|
438 |
* coexist with AC_PINCAP_HDMI |
|
439 |
*/ |
|
440 |
#define AC_PINCAP_VREF (0x37<<8) |
|
441 |
#define AC_PINCAP_VREF_SHIFT 8 |
|
442 |
#define AC_PINCAP_EAPD (1<<16) /* EAPD capable */ |
|
443 |
#define AC_PINCAP_HBR (1<<27) /* High Bit Rate */ |
|
444 |
/* Vref status (used in pin cap) */ |
|
445 |
#define AC_PINCAP_VREF_HIZ (1<<0) /* Hi-Z */ |
|
446 |
#define AC_PINCAP_VREF_50 (1<<1) /* 50% */ |
|
447 |
#define AC_PINCAP_VREF_GRD (1<<2) /* ground */ |
|
448 |
#define AC_PINCAP_VREF_80 (1<<4) /* 80% */ |
|
449 |
#define AC_PINCAP_VREF_100 (1<<5) /* 100% */ |
|
450 |
|
|
451 |
/* Amplifier capabilities */ |
|
452 |
#define AC_AMPCAP_OFFSET (0x7f<<0) /* 0dB offset */ |
|
453 |
#define AC_AMPCAP_OFFSET_SHIFT 0 |
|
454 |
#define AC_AMPCAP_NUM_STEPS (0x7f<<8) /* number of steps */ |
|
455 |
#define AC_AMPCAP_NUM_STEPS_SHIFT 8 |
|
456 |
#define AC_AMPCAP_STEP_SIZE (0x7f<<16) /* step size 0-32dB |
|
457 |
* in 0.25dB |
|
458 |
*/ |
|
459 |
#define AC_AMPCAP_STEP_SIZE_SHIFT 16 |
|
460 |
#define AC_AMPCAP_MUTE (1<<31) /* mute capable */ |
|
461 |
#define AC_AMPCAP_MUTE_SHIFT 31 |
|
462 |
|
|
463 |
/* Connection list */ |
|
464 |
#define AC_CLIST_LENGTH (0x7f<<0) |
|
465 |
#define AC_CLIST_LONG (1<<7) |
|
466 |
|
|
467 |
/* Supported power status */ |
|
468 |
#define AC_PWRST_D0SUP (1<<0) |
|
469 |
#define AC_PWRST_D1SUP (1<<1) |
|
470 |
#define AC_PWRST_D2SUP (1<<2) |
|
471 |
#define AC_PWRST_D3SUP (1<<3) |
|
472 |
#define AC_PWRST_D3COLDSUP (1<<4) |
|
473 |
#define AC_PWRST_S3D3COLDSUP (1<<29) |
|
474 |
#define AC_PWRST_CLKSTOP (1<<30) |
|
475 |
#define AC_PWRST_EPSS (1U<<31) |
|
476 |
|
|
477 |
/* Power state values */ |
|
478 |
#define AC_PWRST_SETTING (0xf<<0) |
|
479 |
#define AC_PWRST_ACTUAL (0xf<<4) |
|
480 |
#define AC_PWRST_ACTUAL_SHIFT 4 |
|
481 |
#define AC_PWRST_D0 0x00 |
|
482 |
#define AC_PWRST_D1 0x01 |
|
483 |
#define AC_PWRST_D2 0x02 |
|
484 |
#define AC_PWRST_D3 0x03 |
|
485 |
|
|
486 |
/* Processing capabilies */ |
|
487 |
#define AC_PCAP_BENIGN (1<<0) |
|
488 |
#define AC_PCAP_NUM_COEF (0xff<<8) |
|
489 |
#define AC_PCAP_NUM_COEF_SHIFT 8 |
|
490 |
|
|
491 |
/* Volume knobs capabilities */ |
|
492 |
#define AC_KNBCAP_NUM_STEPS (0x7f<<0) |
|
493 |
#define AC_KNBCAP_DELTA (1<<7) |
|
494 |
|
|
495 |
/* HDMI LPCM capabilities */ |
|
496 |
#define AC_LPCMCAP_48K_CP_CHNS (0x0f<<0) /* max channels w/ CP-on */ |
|
497 |
#define AC_LPCMCAP_48K_NO_CHNS (0x0f<<4) /* max channels w/o CP-on */ |
|
498 |
#define AC_LPCMCAP_48K_20BIT (1<<8) /* 20b bitrate supported */ |
|
499 |
#define AC_LPCMCAP_48K_24BIT (1<<9) /* 24b bitrate supported */ |
|
500 |
#define AC_LPCMCAP_96K_CP_CHNS (0x0f<<10) /* max channels w/ CP-on */ |
|
501 |
#define AC_LPCMCAP_96K_NO_CHNS (0x0f<<14) /* max channels w/o CP-on */ |
|
502 |
#define AC_LPCMCAP_96K_20BIT (1<<18) /* 20b bitrate supported */ |
|
503 |
#define AC_LPCMCAP_96K_24BIT (1<<19) /* 24b bitrate supported */ |
|
504 |
#define AC_LPCMCAP_192K_CP_CHNS (0x0f<<20) /* max channels w/ CP-on */ |
|
505 |
#define AC_LPCMCAP_192K_NO_CHNS (0x0f<<24) /* max channels w/o CP-on */ |
|
506 |
#define AC_LPCMCAP_192K_20BIT (1<<28) /* 20b bitrate supported */ |
|
507 |
#define AC_LPCMCAP_192K_24BIT (1<<29) /* 24b bitrate supported */ |
|
508 |
#define AC_LPCMCAP_44K (1<<30) /* 44.1kHz support */ |
|
509 |
#define AC_LPCMCAP_44K_MS (1<<31) /* 44.1kHz-multiplies support */ |
|
510 |
|
|
511 |
/* |
|
512 |
* Control Parameters |
|
513 |
*/ |
|
514 |
|
|
515 |
/* Amp gain/mute */ |
|
516 |
#define AC_AMP_MUTE (1<<7) |
|
517 |
#define AC_AMP_GAIN (0x7f) |
|
518 |
#define AC_AMP_GET_INDEX (0xf<<0) |
|
519 |
|
|
520 |
#define AC_AMP_GET_LEFT (1<<13) |
|
521 |
#define AC_AMP_GET_RIGHT (0<<13) |
|
522 |
#define AC_AMP_GET_OUTPUT (1<<15) |
|
523 |
#define AC_AMP_GET_INPUT (0<<15) |
|
524 |
|
|
525 |
#define AC_AMP_SET_INDEX (0xf<<8) |
|
526 |
#define AC_AMP_SET_INDEX_SHIFT 8 |
|
527 |
#define AC_AMP_SET_RIGHT (1<<12) |
|
528 |
#define AC_AMP_SET_LEFT (1<<13) |
|
529 |
#define AC_AMP_SET_INPUT (1<<14) |
|
530 |
#define AC_AMP_SET_OUTPUT (1<<15) |
|
531 |
|
|
532 |
/* DIGITAL1 bits */ |
|
533 |
#define AC_DIG1_ENABLE (1<<0) |
|
534 |
#define AC_DIG1_V (1<<1) |
|
535 |
#define AC_DIG1_VCFG (1<<2) |
|
536 |
#define AC_DIG1_EMPHASIS (1<<3) |
|
537 |
#define AC_DIG1_COPYRIGHT (1<<4) |
|
538 |
#define AC_DIG1_NONAUDIO (1<<5) |
|
539 |
#define AC_DIG1_PROFESSIONAL (1<<6) |
|
540 |
#define AC_DIG1_LEVEL (1<<7) |
|
541 |
|
|
542 |
/* DIGITAL2 bits */ |
|
543 |
#define AC_DIG2_CC (0x7f<<0) |
|
544 |
|
|
545 |
/* Pin widget control - 8bit */ |
|
546 |
#define AC_PINCTL_EPT (0x3<<0) |
|
547 |
#define AC_PINCTL_EPT_NATIVE 0 |
|
548 |
#define AC_PINCTL_EPT_HBR 3 |
|
549 |
#define AC_PINCTL_VREFEN (0x7<<0) |
|
550 |
#define AC_PINCTL_VREF_HIZ 0 /* Hi-Z */ |
|
551 |
#define AC_PINCTL_VREF_50 1 /* 50% */ |
|
552 |
#define AC_PINCTL_VREF_GRD 2 /* ground */ |
|
553 |
#define AC_PINCTL_VREF_80 4 /* 80% */ |
|
554 |
#define AC_PINCTL_VREF_100 5 /* 100% */ |
|
555 |
#define AC_PINCTL_IN_EN (1<<5) |
|
556 |
#define AC_PINCTL_OUT_EN (1<<6) |
|
557 |
#define AC_PINCTL_HP_EN (1<<7) |
|
558 |
|
|
559 |
/* Pin sense - 32bit */ |
|
560 |
#define AC_PINSENSE_IMPEDANCE_MASK (0x7fffffff) |
|
561 |
#define AC_PINSENSE_PRESENCE (1<<31) |
|
562 |
#define AC_PINSENSE_ELDV (1<<30) /* ELD valid (HDMI) */ |
|
563 |
|
|
564 |
/* EAPD/BTL enable - 32bit */ |
|
565 |
#define AC_EAPDBTL_BALANCED (1<<0) |
|
566 |
#define AC_EAPDBTL_EAPD (1<<1) |
|
567 |
#define AC_EAPDBTL_LR_SWAP (1<<2) |
|
568 |
|
|
569 |
/* HDMI ELD data */ |
|
570 |
#define AC_ELDD_ELD_VALID (1<<31) |
|
571 |
#define AC_ELDD_ELD_DATA 0xff |
|
572 |
|
|
573 |
/* HDMI DIP size */ |
|
574 |
#define AC_DIPSIZE_ELD_BUF (1<<3) /* ELD buf size of packet size */ |
|
575 |
#define AC_DIPSIZE_PACK_IDX (0x07<<0) /* packet index */ |
|
576 |
|
|
577 |
/* HDMI DIP index */ |
|
578 |
#define AC_DIPIDX_PACK_IDX (0x07<<5) /* packet idnex */ |
|
579 |
#define AC_DIPIDX_BYTE_IDX (0x1f<<0) /* byte index */ |
|
580 |
|
|
581 |
/* HDMI DIP xmit (transmit) control */ |
|
582 |
#define AC_DIPXMIT_MASK (0x3<<6) |
|
583 |
#define AC_DIPXMIT_DISABLE (0x0<<6) /* disable xmit */ |
|
584 |
#define AC_DIPXMIT_ONCE (0x2<<6) /* xmit once then disable */ |
|
585 |
#define AC_DIPXMIT_BEST (0x3<<6) /* best effort */ |
|
586 |
|
|
587 |
/* HDMI content protection (CP) control */ |
|
588 |
#define AC_CPCTRL_CES (1<<9) /* current encryption state */ |
|
589 |
#define AC_CPCTRL_READY (1<<8) /* ready bit */ |
|
590 |
#define AC_CPCTRL_SUBTAG (0x1f<<3) /* subtag for unsol-resp */ |
|
591 |
#define AC_CPCTRL_STATE (3<<0) /* current CP request state */ |
|
592 |
|
|
593 |
/* Converter channel <-> HDMI slot mapping */ |
|
594 |
#define AC_CVTMAP_HDMI_SLOT (0xf<<0) /* HDMI slot number */ |
|
595 |
#define AC_CVTMAP_CHAN (0xf<<4) /* converter channel number */ |
|
596 |
|
|
597 |
/* configuration default - 32bit */ |
|
598 |
#define AC_DEFCFG_SEQUENCE (0xf<<0) |
|
599 |
#define AC_DEFCFG_DEF_ASSOC (0xf<<4) |
|
600 |
#define AC_DEFCFG_ASSOC_SHIFT 4 |
|
601 |
#define AC_DEFCFG_MISC (0xf<<8) |
|
602 |
#define AC_DEFCFG_MISC_SHIFT 8 |
|
603 |
#define AC_DEFCFG_MISC_NO_PRESENCE (1<<0) |
|
604 |
#define AC_DEFCFG_COLOR (0xf<<12) |
|
605 |
#define AC_DEFCFG_COLOR_SHIFT 12 |
|
606 |
#define AC_DEFCFG_CONN_TYPE (0xf<<16) |
|
607 |
#define AC_DEFCFG_CONN_TYPE_SHIFT 16 |
|
608 |
#define AC_DEFCFG_DEVICE (0xf<<20) |
|
609 |
#define AC_DEFCFG_DEVICE_SHIFT 20 |
|
610 |
#define AC_DEFCFG_LOCATION (0x3f<<24) |
|
611 |
#define AC_DEFCFG_LOCATION_SHIFT 24 |
|
612 |
#define AC_DEFCFG_PORT_CONN (0x3<<30) |
|
613 |
#define AC_DEFCFG_PORT_CONN_SHIFT 30 |
|
614 |
|
|
615 |
/* device device types (0x0-0xf) */ |
|
616 |
enum { |
|
617 |
AC_JACK_LINE_OUT, |
|
618 |
AC_JACK_SPEAKER, |
|
619 |
AC_JACK_HP_OUT, |
|
620 |
AC_JACK_CD, |
|
621 |
AC_JACK_SPDIF_OUT, |
|
622 |
AC_JACK_DIG_OTHER_OUT, |
|
623 |
AC_JACK_MODEM_LINE_SIDE, |
|
624 |
AC_JACK_MODEM_HAND_SIDE, |
|
625 |
AC_JACK_LINE_IN, |
|
626 |
AC_JACK_AUX, |
|
627 |
AC_JACK_MIC_IN, |
|
628 |
AC_JACK_TELEPHONY, |
|
629 |
AC_JACK_SPDIF_IN, |
|
630 |
AC_JACK_DIG_OTHER_IN, |
|
631 |
AC_JACK_OTHER = 0xf, |
|
632 |
}; |
Also available in: Unified diff