summaryrefslogtreecommitdiff
path: root/attic/drv/oss_allegro
diff options
context:
space:
mode:
Diffstat (limited to 'attic/drv/oss_allegro')
-rw-r--r--attic/drv/oss_allegro/.config1
-rw-r--r--attic/drv/oss_allegro/.devices5
-rw-r--r--attic/drv/oss_allegro/.name1
-rw-r--r--attic/drv/oss_allegro/.params12
-rw-r--r--attic/drv/oss_allegro/400m_src.dat33
-rw-r--r--attic/drv/oss_allegro/500m_src.dat33
-rw-r--r--attic/drv/oss_allegro/600m_src.dat33
-rw-r--r--attic/drv/oss_allegro/800m_src.dat33
-rw-r--r--attic/drv/oss_allegro/900m_src.dat33
-rw-r--r--attic/drv/oss_allegro/a00m_src.dat33
-rw-r--r--attic/drv/oss_allegro/a80m_src.dat33
-rw-r--r--attic/drv/oss_allegro/allegro_code.h1508
-rw-r--r--attic/drv/oss_allegro/allegro_util.inc1295
-rw-r--r--attic/drv/oss_allegro/hardware.h355
-rw-r--r--attic/drv/oss_allegro/hckernel.h183
-rw-r--r--attic/drv/oss_allegro/id.h48
-rw-r--r--attic/drv/oss_allegro/kernel.dat80
-rw-r--r--attic/drv/oss_allegro/kernel.h1042
-rw-r--r--attic/drv/oss_allegro/kernel.inc6225
-rw-r--r--attic/drv/oss_allegro/kernelbn.inc1107
-rw-r--r--attic/drv/oss_allegro/memchk.dat33
-rw-r--r--attic/drv/oss_allegro/oss_allegro.c1081
-rw-r--r--attic/drv/oss_allegro/oss_allegro.man25
-rw-r--r--attic/drv/oss_allegro/port.h82
-rw-r--r--attic/drv/oss_allegro/srcmgr.h2498
-rw-r--r--attic/drv/oss_allegro/srcmgr.inc1338
26 files changed, 17150 insertions, 0 deletions
diff --git a/attic/drv/oss_allegro/.config b/attic/drv/oss_allegro/.config
new file mode 100644
index 0000000..5280084
--- /dev/null
+++ b/attic/drv/oss_allegro/.config
@@ -0,0 +1 @@
+platform=i86pc
diff --git a/attic/drv/oss_allegro/.devices b/attic/drv/oss_allegro/.devices
new file mode 100644
index 0000000..f8be458
--- /dev/null
+++ b/attic/drv/oss_allegro/.devices
@@ -0,0 +1,5 @@
+oss_allegro pci125d,1988 ESS Allegro ES1988
+oss_allegro pci125d,1990 ESS Canyon 3D ES1990
+oss_allegro pci125d,1992 ESS Canyon 3D-2 ES1992
+oss_allegro pci125d,1998 ESS Maestro3 ES1998
+oss_allegro pci125d,199a ESS Maestro3 ES199A
diff --git a/attic/drv/oss_allegro/.name b/attic/drv/oss_allegro/.name
new file mode 100644
index 0000000..78da1ff
--- /dev/null
+++ b/attic/drv/oss_allegro/.name
@@ -0,0 +1 @@
+ESS Allegro (ES1988) chipset
diff --git a/attic/drv/oss_allegro/.params b/attic/drv/oss_allegro/.params
new file mode 100644
index 0000000..f77ef89
--- /dev/null
+++ b/attic/drv/oss_allegro/.params
@@ -0,0 +1,12 @@
+int allegro_amp=0;
+/*
+ * Allegro Amp is needed for ESS 198X AC97 codecs
+ * Values: 1=Enable 0=Disable Default: 0
+ */
+
+int allegro_mpu_ioaddr=0;
+/*
+ * Allegro MPU 401 UART I/O Base
+ * Values: 0x300, 0x320, 0x33, 0x340 Default: 0
+ */
+
diff --git a/attic/drv/oss_allegro/400m_src.dat b/attic/drv/oss_allegro/400m_src.dat
new file mode 100644
index 0000000..f9d5d0e
--- /dev/null
+++ b/attic/drv/oss_allegro/400m_src.dat
@@ -0,0 +1,33 @@
+0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0412,
+0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0403, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
+0x7A80, 0x002A, 0xBE40, 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907,
+0xE308, 0x042A, 0x6909, 0x902C, 0x7980, 0x042C, 0x690D, 0x902C, 0x1009, 0x881A, 0x100A, 0xBA01,
+0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904,
+0x9027, 0x6918, 0xE308, 0x04B3, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D,
+0x6919, 0xE308, 0x0463, 0x691A, 0xE308, 0x0456, 0xB907, 0x8809, 0xBEC6, 0x0453, 0x10A9, 0x90AD,
+0x7980, 0x047C, 0xB903, 0x8809, 0xBEC6, 0x0460, 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22,
+0x90AD, 0x7980, 0x047C, 0x101A, 0xE308, 0x046F, 0xB903, 0x8809, 0xBEC6, 0x046C, 0x10A9, 0x90A0,
+0x90AD, 0x7980, 0x047C, 0xB901, 0x8809, 0xBEC6, 0x047B, 0x1889, 0x6C22, 0x90A0, 0x90AD, 0x10A9,
+0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, 0x049C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89,
+0x022C, 0x108A, 0x7C04, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x055B, 0x692A, 0x8809, 0x8B89, 0x99A0,
+0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x055B, 0x692A, 0x8809, 0x8B89, 0x99AF, 0x7B99, 0x0484,
+0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, 0x7FFF, 0xE344, 0x04AC, 0x901B, 0x8B89, 0x7A80,
+0x051A, 0x6927, 0xBA01, 0x9027, 0x7A80, 0x0523, 0x6927, 0xE308, 0x049E, 0x7980, 0x050F, 0x0624,
+0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x04C0, 0x8B8D, 0x7A80, 0x051A, 0x7980, 0x04B4,
+0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, 0x051A, 0x7A80, 0x0523, 0x1027, 0xBA01, 0x9027,
+0xE308, 0x04B4, 0x0124, 0x060F, 0x8B89, 0x691A, 0xE308, 0x04EA, 0x6919, 0xE388, 0x04E0, 0xB903,
+0x8809, 0xBEC6, 0x04DD, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x050F, 0xB901, 0x8818, 0xB907, 0x8809,
+0xBEC6, 0x04E7, 0x10EE, 0x90A9, 0x7980, 0x050F, 0x6919, 0xE308, 0x04FE, 0xB903, 0x8809, 0xBE46,
+0xBEC6, 0x04FA, 0x17A0, 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47,
+0x7980, 0x050F, 0xB901, 0x8809, 0xBEC6, 0x050E, 0x16A0, 0x26A0, 0xBFB7, 0xFF00, 0xBE1E, 0x1EA0,
+0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0516,
+0x0D07, 0x8510, 0xBE59, 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E,
+0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, 0x9825, 0x1025, 0x201C,
+0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, 0x692F, 0xE388, 0x0539, 0xBE59, 0xBB07, 0x6180,
+0x9880, 0x8BA0, 0x101F, 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E,
+0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x054F, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0,
+0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0,
+0xBEC6, 0x056B, 0xBE59, 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0,
+0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, 0x8BD0, 0x8BD8, 0xBE1F,
+0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/attic/drv/oss_allegro/500m_src.dat b/attic/drv/oss_allegro/500m_src.dat
new file mode 100644
index 0000000..c7ba59e
--- /dev/null
+++ b/attic/drv/oss_allegro/500m_src.dat
@@ -0,0 +1,33 @@
+0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0512,
+0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0503, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
+0x7A80, 0x002A, 0xBE40, 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907,
+0xE308, 0x052A, 0x6909, 0x902C, 0x7980, 0x052C, 0x690D, 0x902C, 0x1009, 0x881A, 0x100A, 0xBA01,
+0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904,
+0x9027, 0x6918, 0xE308, 0x05B3, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D,
+0x6919, 0xE308, 0x0563, 0x691A, 0xE308, 0x0556, 0xB907, 0x8809, 0xBEC6, 0x0553, 0x10A9, 0x90AD,
+0x7980, 0x057C, 0xB903, 0x8809, 0xBEC6, 0x0560, 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22,
+0x90AD, 0x7980, 0x057C, 0x101A, 0xE308, 0x056F, 0xB903, 0x8809, 0xBEC6, 0x056C, 0x10A9, 0x90A0,
+0x90AD, 0x7980, 0x057C, 0xB901, 0x8809, 0xBEC6, 0x057B, 0x1889, 0x6C22, 0x90A0, 0x90AD, 0x10A9,
+0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, 0x059C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89,
+0x022C, 0x108A, 0x7C04, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x065B, 0x692A, 0x8809, 0x8B89, 0x99A0,
+0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x065B, 0x692A, 0x8809, 0x8B89, 0x99AF, 0x7B99, 0x0584,
+0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, 0x7FFF, 0xE344, 0x05AC, 0x901B, 0x8B89, 0x7A80,
+0x061A, 0x6927, 0xBA01, 0x9027, 0x7A80, 0x0623, 0x6927, 0xE308, 0x059E, 0x7980, 0x060F, 0x0624,
+0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x05C0, 0x8B8D, 0x7A80, 0x061A, 0x7980, 0x05B4,
+0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, 0x061A, 0x7A80, 0x0623, 0x1027, 0xBA01, 0x9027,
+0xE308, 0x05B4, 0x0124, 0x060F, 0x8B89, 0x691A, 0xE308, 0x05EA, 0x6919, 0xE388, 0x05E0, 0xB903,
+0x8809, 0xBEC6, 0x05DD, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x060F, 0xB901, 0x8818, 0xB907, 0x8809,
+0xBEC6, 0x05E7, 0x10EE, 0x90A9, 0x7980, 0x060F, 0x6919, 0xE308, 0x05FE, 0xB903, 0x8809, 0xBE46,
+0xBEC6, 0x05FA, 0x17A0, 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47,
+0x7980, 0x060F, 0xB901, 0x8809, 0xBEC6, 0x060E, 0x16A0, 0x26A0, 0xBFB7, 0xFF00, 0xBE1E, 0x1EA0,
+0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0616,
+0x0D07, 0x8510, 0xBE59, 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E,
+0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, 0x9825, 0x1025, 0x201C,
+0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, 0x692F, 0xE388, 0x0639, 0xBE59, 0xBB07, 0x6180,
+0x9880, 0x8BA0, 0x101F, 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E,
+0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x064F, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0,
+0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0,
+0xBEC6, 0x066B, 0xBE59, 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0,
+0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, 0x8BD0, 0x8BD8, 0xBE1F,
+0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/attic/drv/oss_allegro/600m_src.dat b/attic/drv/oss_allegro/600m_src.dat
new file mode 100644
index 0000000..953eb20
--- /dev/null
+++ b/attic/drv/oss_allegro/600m_src.dat
@@ -0,0 +1,33 @@
+0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0612,
+0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0603, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
+0x7A80, 0x002A, 0xBE40, 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907,
+0xE308, 0x062A, 0x6909, 0x902C, 0x7980, 0x062C, 0x690D, 0x902C, 0x1009, 0x881A, 0x100A, 0xBA01,
+0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904,
+0x9027, 0x6918, 0xE308, 0x06B3, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D,
+0x6919, 0xE308, 0x0663, 0x691A, 0xE308, 0x0656, 0xB907, 0x8809, 0xBEC6, 0x0653, 0x10A9, 0x90AD,
+0x7980, 0x067C, 0xB903, 0x8809, 0xBEC6, 0x0660, 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22,
+0x90AD, 0x7980, 0x067C, 0x101A, 0xE308, 0x066F, 0xB903, 0x8809, 0xBEC6, 0x066C, 0x10A9, 0x90A0,
+0x90AD, 0x7980, 0x067C, 0xB901, 0x8809, 0xBEC6, 0x067B, 0x1889, 0x6C22, 0x90A0, 0x90AD, 0x10A9,
+0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, 0x069C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89,
+0x022C, 0x108A, 0x7C04, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x075B, 0x692A, 0x8809, 0x8B89, 0x99A0,
+0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x075B, 0x692A, 0x8809, 0x8B89, 0x99AF, 0x7B99, 0x0684,
+0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, 0x7FFF, 0xE344, 0x06AC, 0x901B, 0x8B89, 0x7A80,
+0x071A, 0x6927, 0xBA01, 0x9027, 0x7A80, 0x0723, 0x6927, 0xE308, 0x069E, 0x7980, 0x070F, 0x0624,
+0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x06C0, 0x8B8D, 0x7A80, 0x071A, 0x7980, 0x06B4,
+0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, 0x071A, 0x7A80, 0x0723, 0x1027, 0xBA01, 0x9027,
+0xE308, 0x06B4, 0x0124, 0x060F, 0x8B89, 0x691A, 0xE308, 0x06EA, 0x6919, 0xE388, 0x06E0, 0xB903,
+0x8809, 0xBEC6, 0x06DD, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x070F, 0xB901, 0x8818, 0xB907, 0x8809,
+0xBEC6, 0x06E7, 0x10EE, 0x90A9, 0x7980, 0x070F, 0x6919, 0xE308, 0x06FE, 0xB903, 0x8809, 0xBE46,
+0xBEC6, 0x06FA, 0x17A0, 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47,
+0x7980, 0x070F, 0xB901, 0x8809, 0xBEC6, 0x070E, 0x16A0, 0x26A0, 0xBFB7, 0xFF00, 0xBE1E, 0x1EA0,
+0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0716,
+0x0D07, 0x8510, 0xBE59, 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E,
+0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, 0x9825, 0x1025, 0x201C,
+0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, 0x692F, 0xE388, 0x0739, 0xBE59, 0xBB07, 0x6180,
+0x9880, 0x8BA0, 0x101F, 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E,
+0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x074F, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0,
+0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0,
+0xBEC6, 0x076B, 0xBE59, 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0,
+0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, 0x8BD0, 0x8BD8, 0xBE1F,
+0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/attic/drv/oss_allegro/800m_src.dat b/attic/drv/oss_allegro/800m_src.dat
new file mode 100644
index 0000000..d309079
--- /dev/null
+++ b/attic/drv/oss_allegro/800m_src.dat
@@ -0,0 +1,33 @@
+0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0812,
+0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0803, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
+0x7A80, 0x002A, 0xBE40, 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907,
+0xE308, 0x082A, 0x6909, 0x902C, 0x7980, 0x082C, 0x690D, 0x902C, 0x1009, 0x881A, 0x100A, 0xBA01,
+0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904,
+0x9027, 0x6918, 0xE308, 0x08B3, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D,
+0x6919, 0xE308, 0x0863, 0x691A, 0xE308, 0x0856, 0xB907, 0x8809, 0xBEC6, 0x0853, 0x10A9, 0x90AD,
+0x7980, 0x087C, 0xB903, 0x8809, 0xBEC6, 0x0860, 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22,
+0x90AD, 0x7980, 0x087C, 0x101A, 0xE308, 0x086F, 0xB903, 0x8809, 0xBEC6, 0x086C, 0x10A9, 0x90A0,
+0x90AD, 0x7980, 0x087C, 0xB901, 0x8809, 0xBEC6, 0x087B, 0x1889, 0x6C22, 0x90A0, 0x90AD, 0x10A9,
+0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, 0x089C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89,
+0x022C, 0x108A, 0x7C04, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x095B, 0x692A, 0x8809, 0x8B89, 0x99A0,
+0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x095B, 0x692A, 0x8809, 0x8B89, 0x99AF, 0x7B99, 0x0884,
+0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, 0x7FFF, 0xE344, 0x08AC, 0x901B, 0x8B89, 0x7A80,
+0x091A, 0x6927, 0xBA01, 0x9027, 0x7A80, 0x0923, 0x6927, 0xE308, 0x089E, 0x7980, 0x090F, 0x0624,
+0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x08C0, 0x8B8D, 0x7A80, 0x091A, 0x7980, 0x08B4,
+0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, 0x091A, 0x7A80, 0x0923, 0x1027, 0xBA01, 0x9027,
+0xE308, 0x08B4, 0x0124, 0x060F, 0x8B89, 0x691A, 0xE308, 0x08EA, 0x6919, 0xE388, 0x08E0, 0xB903,
+0x8809, 0xBEC6, 0x08DD, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x090F, 0xB901, 0x8818, 0xB907, 0x8809,
+0xBEC6, 0x08E7, 0x10EE, 0x90A9, 0x7980, 0x090F, 0x6919, 0xE308, 0x08FE, 0xB903, 0x8809, 0xBE46,
+0xBEC6, 0x08FA, 0x17A0, 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47,
+0x7980, 0x090F, 0xB901, 0x8809, 0xBEC6, 0x090E, 0x16A0, 0x26A0, 0xBFB7, 0xFF00, 0xBE1E, 0x1EA0,
+0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0916,
+0x0D07, 0x8510, 0xBE59, 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E,
+0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, 0x9825, 0x1025, 0x201C,
+0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, 0x692F, 0xE388, 0x0939, 0xBE59, 0xBB07, 0x6180,
+0x9880, 0x8BA0, 0x101F, 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E,
+0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x094F, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0,
+0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0,
+0xBEC6, 0x096B, 0xBE59, 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0,
+0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, 0x8BD0, 0x8BD8, 0xBE1F,
+0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/attic/drv/oss_allegro/900m_src.dat b/attic/drv/oss_allegro/900m_src.dat
new file mode 100644
index 0000000..a9cdf6a
--- /dev/null
+++ b/attic/drv/oss_allegro/900m_src.dat
@@ -0,0 +1,33 @@
+0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0912,
+0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0903, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
+0x7A80, 0x002A, 0xBE40, 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907,
+0xE308, 0x092A, 0x6909, 0x902C, 0x7980, 0x092C, 0x690D, 0x902C, 0x1009, 0x881A, 0x100A, 0xBA01,
+0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904,
+0x9027, 0x6918, 0xE308, 0x09B3, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D,
+0x6919, 0xE308, 0x0963, 0x691A, 0xE308, 0x0956, 0xB907, 0x8809, 0xBEC6, 0x0953, 0x10A9, 0x90AD,
+0x7980, 0x097C, 0xB903, 0x8809, 0xBEC6, 0x0960, 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22,
+0x90AD, 0x7980, 0x097C, 0x101A, 0xE308, 0x096F, 0xB903, 0x8809, 0xBEC6, 0x096C, 0x10A9, 0x90A0,
+0x90AD, 0x7980, 0x097C, 0xB901, 0x8809, 0xBEC6, 0x097B, 0x1889, 0x6C22, 0x90A0, 0x90AD, 0x10A9,
+0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, 0x099C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89,
+0x022C, 0x108A, 0x7C04, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x0A5B, 0x692A, 0x8809, 0x8B89, 0x99A0,
+0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x0A5B, 0x692A, 0x8809, 0x8B89, 0x99AF, 0x7B99, 0x0984,
+0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, 0x7FFF, 0xE344, 0x09AC, 0x901B, 0x8B89, 0x7A80,
+0x0A1A, 0x6927, 0xBA01, 0x9027, 0x7A80, 0x0A23, 0x6927, 0xE308, 0x099E, 0x7980, 0x0A0F, 0x0624,
+0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x09C0, 0x8B8D, 0x7A80, 0x0A1A, 0x7980, 0x09B4,
+0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, 0x0A1A, 0x7A80, 0x0A23, 0x1027, 0xBA01, 0x9027,
+0xE308, 0x09B4, 0x0124, 0x060F, 0x8B89, 0x691A, 0xE308, 0x09EA, 0x6919, 0xE388, 0x09E0, 0xB903,
+0x8809, 0xBEC6, 0x09DD, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x0A0F, 0xB901, 0x8818, 0xB907, 0x8809,
+0xBEC6, 0x09E7, 0x10EE, 0x90A9, 0x7980, 0x0A0F, 0x6919, 0xE308, 0x09FE, 0xB903, 0x8809, 0xBE46,
+0xBEC6, 0x09FA, 0x17A0, 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47,
+0x7980, 0x0A0F, 0xB901, 0x8809, 0xBEC6, 0x0A0E, 0x16A0, 0x26A0, 0xBFB7, 0xFF00, 0xBE1E, 0x1EA0,
+0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0A16,
+0x0D07, 0x8510, 0xBE59, 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E,
+0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, 0x9825, 0x1025, 0x201C,
+0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, 0x692F, 0xE388, 0x0A39, 0xBE59, 0xBB07, 0x6180,
+0x9880, 0x8BA0, 0x101F, 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E,
+0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x0A4F, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0,
+0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0,
+0xBEC6, 0x0A6B, 0xBE59, 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0,
+0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, 0x8BD0, 0x8BD8, 0xBE1F,
+0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/attic/drv/oss_allegro/a00m_src.dat b/attic/drv/oss_allegro/a00m_src.dat
new file mode 100644
index 0000000..6b6c419
--- /dev/null
+++ b/attic/drv/oss_allegro/a00m_src.dat
@@ -0,0 +1,33 @@
+0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0A12,
+0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0A03, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
+0x7A80, 0x002A, 0xBE40, 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907,
+0xE308, 0x0A2A, 0x6909, 0x902C, 0x7980, 0x0A2C, 0x690D, 0x902C, 0x1009, 0x881A, 0x100A, 0xBA01,
+0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904,
+0x9027, 0x6918, 0xE308, 0x0AB3, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D,
+0x6919, 0xE308, 0x0A63, 0x691A, 0xE308, 0x0A56, 0xB907, 0x8809, 0xBEC6, 0x0A53, 0x10A9, 0x90AD,
+0x7980, 0x0A7C, 0xB903, 0x8809, 0xBEC6, 0x0A60, 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22,
+0x90AD, 0x7980, 0x0A7C, 0x101A, 0xE308, 0x0A6F, 0xB903, 0x8809, 0xBEC6, 0x0A6C, 0x10A9, 0x90A0,
+0x90AD, 0x7980, 0x0A7C, 0xB901, 0x8809, 0xBEC6, 0x0A7B, 0x1889, 0x6C22, 0x90A0, 0x90AD, 0x10A9,
+0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, 0x0A9C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89,
+0x022C, 0x108A, 0x7C04, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x0B5B, 0x692A, 0x8809, 0x8B89, 0x99A0,
+0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x0B5B, 0x692A, 0x8809, 0x8B89, 0x99AF, 0x7B99, 0x0A84,
+0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, 0x7FFF, 0xE344, 0x0AAC, 0x901B, 0x8B89, 0x7A80,
+0x0B1A, 0x6927, 0xBA01, 0x9027, 0x7A80, 0x0B23, 0x6927, 0xE308, 0x0A9E, 0x7980, 0x0B0F, 0x0624,
+0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x0AC0, 0x8B8D, 0x7A80, 0x0B1A, 0x7980, 0x0AB4,
+0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, 0x0B1A, 0x7A80, 0x0B23, 0x1027, 0xBA01, 0x9027,
+0xE308, 0x0AB4, 0x0124, 0x060F, 0x8B89, 0x691A, 0xE308, 0x0AEA, 0x6919, 0xE388, 0x0AE0, 0xB903,
+0x8809, 0xBEC6, 0x0ADD, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x0B0F, 0xB901, 0x8818, 0xB907, 0x8809,
+0xBEC6, 0x0AE7, 0x10EE, 0x90A9, 0x7980, 0x0B0F, 0x6919, 0xE308, 0x0AFE, 0xB903, 0x8809, 0xBE46,
+0xBEC6, 0x0AFA, 0x17A0, 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47,
+0x7980, 0x0B0F, 0xB901, 0x8809, 0xBEC6, 0x0B0E, 0x16A0, 0x26A0, 0xBFB7, 0xFF00, 0xBE1E, 0x1EA0,
+0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0B16,
+0x0D07, 0x8510, 0xBE59, 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E,
+0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, 0x9825, 0x1025, 0x201C,
+0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, 0x692F, 0xE388, 0x0B39, 0xBE59, 0xBB07, 0x6180,
+0x9880, 0x8BA0, 0x101F, 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E,
+0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x0B4F, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0,
+0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0,
+0xBEC6, 0x0B6B, 0xBE59, 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0,
+0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, 0x8BD0, 0x8BD8, 0xBE1F,
+0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/attic/drv/oss_allegro/a80m_src.dat b/attic/drv/oss_allegro/a80m_src.dat
new file mode 100644
index 0000000..f175036
--- /dev/null
+++ b/attic/drv/oss_allegro/a80m_src.dat
@@ -0,0 +1,33 @@
+0xBF80, 0x101E, 0x906E, 0x006E, 0x8B88, 0x6980, 0xEF88, 0x906F, 0x0D6F, 0x6900, 0xEB08, 0x0A92,
+0xBC20, 0x696E, 0xB801, 0x906E, 0x7980, 0x0A83, 0xB90E, 0x8807, 0xBE43, 0xBF01, 0xBE47, 0xBE41,
+0x7A80, 0x002A, 0xBE40, 0x3029, 0xEFCC, 0xBE41, 0x7A80, 0x0028, 0xBE40, 0x3028, 0xEFCC, 0x6907,
+0xE308, 0x0AAA, 0x6909, 0x902C, 0x7980, 0x0AAC, 0x690D, 0x902C, 0x1009, 0x881A, 0x100A, 0xBA01,
+0x881B, 0x100D, 0x881C, 0x100E, 0xBA01, 0x881D, 0xBF80, 0x00ED, 0x881E, 0x050C, 0x0124, 0xB904,
+0x9027, 0x6918, 0xE308, 0x0B33, 0x902D, 0x6913, 0xBFA0, 0x7598, 0xF704, 0xAE2D, 0x00FF, 0x8B8D,
+0x6919, 0xE308, 0x0AE3, 0x691A, 0xE308, 0x0AD6, 0xB907, 0x8809, 0xBEC6, 0x0AD3, 0x10A9, 0x90AD,
+0x7980, 0x0AFC, 0xB903, 0x8809, 0xBEC6, 0x0AE0, 0x1889, 0x6C22, 0x90AD, 0x10A9, 0x6E23, 0x6C22,
+0x90AD, 0x7980, 0x0AFC, 0x101A, 0xE308, 0x0AEF, 0xB903, 0x8809, 0xBEC6, 0x0AEC, 0x10A9, 0x90A0,
+0x90AD, 0x7980, 0x0AFC, 0xB901, 0x8809, 0xBEC6, 0x0AFB, 0x1889, 0x6C22, 0x90A0, 0x90AD, 0x10A9,
+0x6E23, 0x6C22, 0x90A0, 0x90AD, 0x692D, 0xE308, 0x0B1C, 0x0124, 0xB703, 0xB902, 0x8818, 0x8B89,
+0x022C, 0x108A, 0x7C04, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x0BDB, 0x692A, 0x8809, 0x8B89, 0x99A0,
+0x108A, 0x90A0, 0x692B, 0x881F, 0x7E80, 0x0BDB, 0x692A, 0x8809, 0x8B89, 0x99AF, 0x7B99, 0x0B04,
+0x0124, 0x060F, 0x101B, 0x2013, 0x901B, 0xBFA0, 0x7FFF, 0xE344, 0x0B2C, 0x901B, 0x8B89, 0x7A80,
+0x0B9A, 0x6927, 0xBA01, 0x9027, 0x7A80, 0x0BA3, 0x6927, 0xE308, 0x0B1E, 0x7980, 0x0B8F, 0x0624,
+0x1026, 0x2013, 0x9026, 0xBFA0, 0x7FFF, 0xE304, 0x0B40, 0x8B8D, 0x7A80, 0x0B9A, 0x7980, 0x0B34,
+0x9026, 0x1013, 0x3026, 0x901B, 0x8B8D, 0x7A80, 0x0B9A, 0x7A80, 0x0BA3, 0x1027, 0xBA01, 0x9027,
+0xE308, 0x0B34, 0x0124, 0x060F, 0x8B89, 0x691A, 0xE308, 0x0B6A, 0x6919, 0xE388, 0x0B60, 0xB903,
+0x8809, 0xBEC6, 0x0B5D, 0x1FA0, 0x2FAE, 0x98A9, 0x7980, 0x0B8F, 0xB901, 0x8818, 0xB907, 0x8809,
+0xBEC6, 0x0B67, 0x10EE, 0x90A9, 0x7980, 0x0B8F, 0x6919, 0xE308, 0x0B7E, 0xB903, 0x8809, 0xBE46,
+0xBEC6, 0x0B7A, 0x17A0, 0xBE1E, 0x1FAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0xBE47,
+0x7980, 0x0B8F, 0xB901, 0x8809, 0xBEC6, 0x0B8E, 0x16A0, 0x26A0, 0xBFB7, 0xFF00, 0xBE1E, 0x1EA0,
+0x2EAE, 0xBFBF, 0xFF00, 0xBE13, 0xBFDF, 0x8080, 0x99A9, 0x850C, 0x860F, 0x6907, 0xE388, 0x0B96,
+0x0D07, 0x8510, 0xBE59, 0x881E, 0xBE4A, 0xEF00, 0x101E, 0x901C, 0x101F, 0x901D, 0x10A0, 0x901E,
+0x10A0, 0x901F, 0xEF00, 0x101E, 0x301C, 0x9020, 0x731B, 0x5420, 0xBE03, 0x9825, 0x1025, 0x201C,
+0x9025, 0x7325, 0x5414, 0xBE03, 0x8B8E, 0x9880, 0x692F, 0xE388, 0x0BB9, 0xBE59, 0xBB07, 0x6180,
+0x9880, 0x8BA0, 0x101F, 0x301D, 0x9021, 0x731B, 0x5421, 0xBE03, 0x982E, 0x102E, 0x201D, 0x902E,
+0x732E, 0x5415, 0xBE03, 0x9880, 0x692F, 0xE388, 0x0BCF, 0xBE59, 0xBB07, 0x6180, 0x9880, 0x8BA0,
+0x6918, 0xEF08, 0x7325, 0x5416, 0xBE03, 0x98A0, 0x732E, 0x5417, 0xBE03, 0x98A0, 0xEF00, 0x8BA0,
+0xBEC6, 0x0BEB, 0xBE59, 0xBB04, 0xAA90, 0xBE04, 0xBE1E, 0x99E0, 0x8BE0, 0x69A0, 0x90D0, 0x69A0,
+0x90D0, 0x081F, 0xB805, 0x881F, 0x8B90, 0x69A0, 0x90D0, 0x69A0, 0x9090, 0x8BD0, 0x8BD8, 0xBE1F,
+0xEF00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/attic/drv/oss_allegro/allegro_code.h b/attic/drv/oss_allegro/allegro_code.h
new file mode 100644
index 0000000..e2e9613
--- /dev/null
+++ b/attic/drv/oss_allegro/allegro_code.h
@@ -0,0 +1,1508 @@
+
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ * This source code, its compiled object code, and its associated data sets *
+ * are copyright (C) 1997-1999 ESS Technology, Inc. This source code and its *
+ * associated data sets are trade secrets of ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
+
+/*---------------------------------------------------------------------------
+ * Copyright (C) 1997-1999, ESS Technology, Inc.
+ *---------------------------------------------------------------------------
+ * FILENAME: kernelbn.c v1.01
+ *---------------------------------------------------------------------------
+ * DESCRIPTION: DSP binaries
+ *---------------------------------------------------------------------------
+ * AUTHOR: Henry Tang / Hong Kim / Alger Yeung/Don Kim
+ *---------------------------------------------------------------------------
+ * HISTORY:
+ * 09/25/97 HT Created.
+ * 01/20/97 PJCC (CRL) modified to include Sensaura 3D positional &
+ * speaker virtualization
+ * 05/05/99 AY cleanup for NT modem drivers
+ * 05/18/99 AY add cpythru for 400/500/600/800
+ * 05/24/99 AY add cpythru for 4C0/680
+ *---------------------------------------------------------------------------
+ */
+
+
+/* */
+/* Kernel */
+/* */
+
+WORD gawKernelVectCode[] = {
+#include "kernel.dat"
+};
+
+KERNEL_BIN gsKernelVectCode = {
+ gawKernelVectCode,
+ sizeof (gawKernelVectCode)
+};
+
+/* */
+/* Memory Check Kernel */
+/* */
+
+WORD gawMemChkVectCode[] = {
+#include "memchk.dat"
+};
+
+KERNEL_BIN gsMemChkVectCode = {
+ gawMemChkVectCode,
+ sizeof (gawMemChkVectCode)
+};
+
+
+/* */
+/* Copy Through */
+/* */
+
+WORD gawCpyThruDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawCpyThruVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0400[] = {
+ 0 /*#include "400cpyth.dat" */
+};
+
+WORD gawCpyThruVect04C0[] = {
+ 0x7980, 0x04C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode04C0[] = {
+ 0 /*#include "4C0cpyth.dat" */
+};
+
+WORD gawCpyThruVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0500[] = {
+ 0 /*#include "500cpyth.dat" */
+};
+
+WORD gawCpyThruVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0600[] = {
+ 0 /*#include "600cpyth.dat" */
+};
+
+
+WORD gawCpyThruVect0680[] = {
+ 0x7980, 0x0680, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0680[] = {
+ 0 /*#include "680cpyth.dat" */
+};
+
+WORD gawCpyThruVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0800[] = {
+ 0 /*#include "800cpyth.dat" */
+};
+
+CLIENT_BIN gasCpyThruVectCode[] = {
+ {
+ 0x0400,
+ gawCpyThruVect0400,
+ gawCpyThruCode0400,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0400),
+ sizeof (gawCpyThruCode0400),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x04C0,
+ gawCpyThruVect04C0,
+ gawCpyThruCode04C0,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect04C0),
+ sizeof (gawCpyThruCode04C0),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawCpyThruVect0500,
+ gawCpyThruCode0500,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0500),
+ sizeof (gawCpyThruCode0500),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawCpyThruVect0600,
+ gawCpyThruCode0600,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0600),
+ sizeof (gawCpyThruCode0600),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0680,
+ gawCpyThruVect0680,
+ gawCpyThruCode0680,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0680),
+ sizeof (gawCpyThruCode0680),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawCpyThruVect0800,
+ gawCpyThruCode0800,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0800),
+ sizeof (gawCpyThruCode0800),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+/* */
+/* Modem */
+/* */
+
+WORD gawModemData[] = {
+ /* M3 HSP client data area starts at 0x1100 */
+ /* 80H words at 1100H */
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+
+ /* 80H words at 1180H */
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+
+#ifdef NT_MODEL
+ /* 80H words at 1200H */
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+
+ /* 80H words at 1280H */
+
+ 0 /*#include "modemntd.dat" */
+#else
+ /* 80H words at 1200H */
+
+ 0 /*#include "modemd.dat" */
+#endif
+};
+
+WORD gawModemVect400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+#ifdef NT_MODEL
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0449,
+#else
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0449,
+#endif
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawModemVect800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+#ifdef NT_MODEL
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0849,
+#else
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0849,
+#endif
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawModemCode400[] = {
+#ifdef NT_MODEL
+ 0 /*#include "modemnt4.dat" */
+#else
+ 0 /*#include "400modem.dat" */
+#endif
+};
+
+WORD gawModemCode800[] = {
+#ifdef NT_MODEL
+ 0 /*#include "modemnt8.dat" */
+#else
+ 0 /*#include "800modem.dat" */
+#endif
+};
+
+CLIENT_BIN gasModemVectCode[] = {
+ {
+ 0x0400,
+ gawModemVect400,
+ gawModemCode400,
+ gawModemData,
+ sizeof (gawModemVect400),
+ sizeof (gawModemCode400),
+ sizeof (gawModemData)}
+ ,
+ {
+ 0x0800,
+ gawModemVect800,
+ gawModemCode800,
+ gawModemData,
+ sizeof (gawModemVect800),
+ sizeof (gawModemCode800),
+ sizeof (gawModemData)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+
+/* */
+/* Positional 3D */
+/* */
+/* Note: Data image contains 25 words (first 22 are CDATA_HEADER + */
+/* kernel spare, next 3 are dpaddr, control_enabled and current_count */
+/* for Pos3d) */
+/* */
+
+WORD gawPos3DDataXXXX[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000
+};
+
+WORD gawPos3DVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawPos3DCode0400[] = {
+ 0 /*#include "4pos3d.dat" */
+};
+
+WORD gawPos3DVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawPos3DCode0800[] = {
+ 0 /*#include "8pos3d.dat" */
+};
+
+CLIENT_BIN gasPos3DVectCode[] = {
+ {
+ 0x0400,
+ gawPos3DVect0400,
+ gawPos3DCode0400,
+ gawPos3DDataXXXX,
+ sizeof (gawPos3DVect0400),
+ sizeof (gawPos3DCode0400),
+ sizeof (gawPos3DDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawPos3DVect0800,
+ gawPos3DCode0800,
+ gawPos3DDataXXXX,
+ sizeof (gawPos3DVect0800),
+ sizeof (gawPos3DCode0800),
+ sizeof (gawPos3DDataXXXX)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+/* */
+/* Speaker Virtualization */
+/* */
+
+WORD gawSpkVirtDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawSpkVirtVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0400[] = {
+ 0 /*#include "4vmax.dat" */
+};
+
+WORD gawSpkVirtVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0800[] = {
+ 0 /*#include "8vmax.dat" */
+};
+
+CLIENT_BIN gasSpkVirtVectCode[] = {
+ {
+ 0x0400,
+ gawSpkVirtVect0400,
+ gawSpkVirtCode0400,
+ gawSpkVirtDataXXXX,
+ sizeof (gawSpkVirtVect0400),
+ sizeof (gawSpkVirtCode0400),
+ sizeof (gawSpkVirtDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawSpkVirtVect0800,
+ gawSpkVirtCode0800,
+ gawSpkVirtDataXXXX,
+ sizeof (gawSpkVirtVect0800),
+ sizeof (gawSpkVirtCode0800),
+ sizeof (gawSpkVirtDataXXXX)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+/* */
+/* CRL Speaker Virtualization */
+/* */
+
+WORD gawSpkVirtDataXXXX_CRL[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000
+};
+
+WORD gawSpkVirtVect0400_CRL[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0400_CRL[] = {
+ 0 /*#include "4spkvirt.dat" */
+};
+
+WORD gawSpkVirtVect0800_CRL[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0800_CRL[] = {
+ 0 /*#include "8spkvirt.dat" */
+};
+
+CLIENT_BIN gasSpkVirtVectCode_CRL[] = {
+ {
+ 0x0400,
+ gawSpkVirtVect0400_CRL,
+ gawSpkVirtCode0400_CRL,
+ gawSpkVirtDataXXXX_CRL,
+ sizeof (gawSpkVirtVect0400_CRL),
+ sizeof (gawSpkVirtCode0400_CRL),
+ sizeof (gawSpkVirtDataXXXX_CRL)}
+ ,
+ {
+ 0x0800,
+ gawSpkVirtVect0800_CRL,
+ gawSpkVirtCode0800_CRL,
+ gawSpkVirtDataXXXX_CRL,
+ sizeof (gawSpkVirtVect0800_CRL),
+ sizeof (gawSpkVirtCode0800_CRL),
+ sizeof (gawSpkVirtDataXXXX_CRL)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+/* */
+/* Sample Rate Conversion */
+/* */
+
+WORD gawSRCDataXXXX[] = {
+ 0x0000
+};
+
+
+WORD gawSRCVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0400[] = {
+ 0 /*#include "400src36.dat" */
+};
+
+WORD gawSRCVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0500[] = {
+ 0 /*#include "500src36.dat" */
+};
+
+WORD gawSRCVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0600[] = {
+ 0 /*#include "600src36.dat" */
+};
+
+WORD gawSRCVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0800[] = {
+ 0 /*#include "800src36.dat" */
+};
+
+CLIENT_BIN gasSRCVectCode[] = {
+ {
+ 0x0400,
+ gawSRCVect0400,
+ gawSRCCode0400,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0400),
+ sizeof (gawSRCCode0400),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawSRCVect0500,
+ gawSRCCode0500,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0500),
+ sizeof (gawSRCCode0500),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawSRCVect0600,
+ gawSRCCode0600,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0600),
+ sizeof (gawSRCCode0600),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawSRCVect0800,
+ gawSRCCode0800,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0800),
+ sizeof (gawSRCCode0800),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+/* */
+/* MINI Sample Rate Conversion */
+/* */
+
+WORD gawMINISRCDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawMINISRCVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0400[] = {
+#include "400m_src.dat"
+};
+
+WORD gawMINISRCVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0500[] = {
+#include "500m_src.dat"
+};
+
+WORD gawMINISRCVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0600[] = {
+#include "600m_src.dat"
+};
+
+WORD gawMINISRCVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0800[] = {
+#include "800m_src.dat"
+};
+
+
+WORD gawMINISRCVect0900[] = {
+ 0x7980, 0x0900, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0900[] = {
+#include "900m_src.dat"
+};
+
+
+WORD gawMINISRCVect0A00[] = {
+ 0x7980, 0x0A00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0A00[] = {
+#include "a00m_src.dat"
+};
+
+WORD gawMINISRCVect0A80[] = {
+ 0x7980, 0x0A80, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0A80[] = {
+#include "a80m_src.dat"
+};
+
+CLIENT_BIN gasMINISRCVectCode[] = {
+ {
+ 0x0400,
+ gawMINISRCVect0400,
+ gawMINISRCCode0400,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0400),
+ sizeof (gawMINISRCCode0400),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawMINISRCVect0500,
+ gawMINISRCCode0500,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0500),
+ sizeof (gawMINISRCCode0500),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawMINISRCVect0600,
+ gawMINISRCCode0600,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0600),
+ sizeof (gawMINISRCCode0600),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawMINISRCVect0800,
+ gawMINISRCCode0800,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0800),
+ sizeof (gawMINISRCCode0800),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0900,
+ gawMINISRCVect0900,
+ gawMINISRCCode0900,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0900),
+ sizeof (gawMINISRCCode0900),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0A00,
+ gawMINISRCVect0A00,
+ gawMINISRCCode0A00,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0A00),
+ sizeof (gawMINISRCCode0A00),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0A80,
+ gawMINISRCVect0A80,
+ gawMINISRCCode0A80,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0A80),
+ sizeof (gawMINISRCCode0A80),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+/* */
+/* SPDIF */
+/* */
+
+WORD gawSPDIFDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawSPDIFVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0400[] = {
+ 0 /*#include "400spdif.dat" */
+};
+
+WORD gawSPDIFVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0500[] = {
+ 0 /*#include "500spdif.dat" */
+};
+
+WORD gawSPDIFVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0600[] = {
+ 0 /*#include "600spdif.dat" */
+};
+
+WORD gawSPDIFVect0700[] = {
+ 0x7980, 0x0700, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0700[] = {
+ 0 /*#include "700spdif.dat" */
+};
+
+WORD gawSPDIFVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0800[] = {
+ 0 /*#include "800spdif.dat" */
+};
+
+WORD gawSPDIFVect0900[] = {
+ 0x7980, 0x0900, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0900[] = {
+ 0 /*#include "900spdif.dat" */
+};
+
+WORD gawSPDIFVect0A00[] = {
+ 0x7980, 0x0A00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0A00[] = {
+ 0 /*#include "A00spdif.dat" */
+};
+
+CLIENT_BIN gasSPDIFVectCode[] = {
+ {
+ 0x0400,
+ gawSPDIFVect0400,
+ gawSPDIFCode0400,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0400),
+ sizeof (gawSPDIFCode0400),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawSPDIFVect0500,
+ gawSPDIFCode0500,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0500),
+ sizeof (gawSPDIFCode0500),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawSPDIFVect0600,
+ gawSPDIFCode0600,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0600),
+ sizeof (gawSPDIFCode0600),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0700,
+ gawSPDIFVect0700,
+ gawSPDIFCode0700,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0700),
+ sizeof (gawSPDIFCode0700),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawSPDIFVect0800,
+ gawSPDIFCode0800,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0800),
+ sizeof (gawSPDIFCode0800),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0900,
+ gawSPDIFVect0900,
+ gawSPDIFCode0900,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0900),
+ sizeof (gawSPDIFCode0900),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0A00,
+ gawSPDIFVect0A00,
+ gawSPDIFCode0A00,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0A00),
+ sizeof (gawSPDIFCode0A00),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0, NULL, NULL, NULL, 0, 0, 0}
+};
+
+
+#ifndef NT_MODEL
+/* */
+/* FM client is a special case */
+/* */
+/* Note: If FM .dat images without passthru support are used */
+/* PASSTHRU_SIZE can be set to zero. */
+/* */
+
+#define PASSTHRU_SIZE 256
+
+#if 0
+WORD gawFMData[1024 + PASSTHRU_SIZE] = {
+#include "fm_d1000.dat"
+};
+
+WORD gawFMData2[] = {
+#include "fm_d2000.dat"
+};
+
+WORD gawFMVectCode[256 + PASSTHRU_SIZE] = {
+#include "fm_c0000.dat"
+};
+
+WORD gawFMCode[1024] = {
+#include "fm_c0800.dat"
+};
+
+FMCLIENT_BIN gsFMVectCode = {
+ 0x0800,
+ 0x2000,
+ gawFMVectCode,
+ gawFMCode,
+ gawFMData,
+ gawFMData2,
+ sizeof (gawFMVectCode),
+ sizeof (gawFMCode),
+ sizeof (gawFMData),
+ sizeof (gawFMData2)
+};
+#endif
+#endif
+
+WORD MIXER_TASK_NUMBER = 0;
+
+/*--------------------------------------------------------------------------- */
+/* End of File: kernelbn.h */
+/*--------------------------------------------------------------------------- */
+
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
+PCLIENT_BIN kBinStructAddress (PHWI phwi, DWORD dwClient, DWORD dwSearchKey);
+
+/* */
+/* Client info */
+/* */
+
+HWI ghwi = {
+
+ 0,
+ 0,
+ 0,
+ 0,
+
+ 0,
+
+ 0, 0,
+
+ 0,
+
+ /* client table */
+
+ {
+ {
+ gasCpyThruVectCode,
+ 0,
+ MAX_INSTANCE_CPYTHRU,
+ KDATA_INSTANCE0_CPYTHRU,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasModemVectCode,
+ 0,
+ MAX_INSTANCE_MODEM,
+ KDATA_INSTANCE0_MODEM,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasPos3DVectCode,
+ 0,
+ MAX_INSTANCE_POS3D,
+ KDATA_INSTANCE0_POS3D,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSpkVirtVectCode,
+ 0,
+ MAX_INSTANCE_SPKVIRT,
+ KDATA_INSTANCE0_SPKVIRT,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSpkVirtVectCode_CRL,
+ 0,
+ MAX_INSTANCE_SPKVIRT,
+ KDATA_INSTANCE0_SPKVIRT,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSRCVectCode,
+ 0,
+ MAX_INSTANCE_SRC,
+ KDATA_INSTANCE0_SRC,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasMINISRCVectCode,
+ 0,
+ MAX_INSTANCE_MINISRC,
+ KDATA_INSTANCE0_MINISRC,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSPDIFVectCode,
+ 0,
+ MAX_INSTANCE_SPDIF,
+ KDATA_INSTANCE0_SPDIF,
+ 0,
+ 0,
+ 0}
+
+ }
+ ,
+
+#if (F_FREE || (F_END != -1))
+#error Assumption about storage flags failed.
+#endif
+
+ /* task resource list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Copy Through resource list */
+
+ {
+ F_FREE, F_FREE, /* AY reduce to 2 for SPDIF IN */
+
+ (WORD) F_END}
+ ,
+
+ /* Modem resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Positional 3D resource list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Speaker Virtualization resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Sample Rate Conversion resource list */
+
+ {
+ F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* MINI Sample Rate Conversion resource list */
+
+ {
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* SPDIF resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* DMA resource list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* ADC1 resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* ADC2 resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* CD resource list */
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* MIC resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* I2S resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* CHI resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+
+ /* SPDIF IN resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* MIXER resource list */
+ {
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /*AY */
+ /* FMIXER resource list */
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* RMIXER resource list */
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* DSP code memory map */
+
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (BYTE) F_END}
+ ,
+
+ /* DSP data memory map */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (BYTE) F_END}
+ ,
+
+ /* DSP vector list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE}
+
+};
+
+/* */
+/* Memory map images */
+/* */
+
+#if (NUM_UNITS_KERNEL_CODE != 16)
+#error Assumption about kernel code size failed.
+#endif
+
+
+BYTE gabRevBCodeMemoryMapImage[] = {
+ F_USED, F_USED, F_USED, F_USED, /* 0000 - 03FF */
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+
+ F_FREE, F_FREE, F_FREE, F_FREE, /* 0400 - 07FF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE, /* 0800 - 0BFF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (BYTE) F_END
+};
+
+
+#if (NUM_UNITS_KERNEL_DATA != 2)
+#error Assumption about kernel data size failed.
+#endif
+#if (KDATA_BASE_ADDR != 0x1000)
+#error Assumption about kernel data memory location failed.
+#endif
+
+
+BYTE gabRevBDataMemoryMapImage[] = {
+ F_USED, F_USED, F_FREE, F_FREE, /* 1000 - 17FF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE, /* 1800 - 1BFF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_USED, F_USED, F_USED, F_USED, /* 1C00 - 1FFF */
+ F_USED, F_USED, F_USED, F_USED,
+
+ F_USED, F_USED, F_USED, F_USED, /* 2000 - 27FF */
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+
+ F_USED, F_USED, F_USED, F_USED, /* 2800 - 2BFF */
+ F_USED, F_USED, F_USED, F_USED,
+
+ (BYTE) F_END
+};
diff --git a/attic/drv/oss_allegro/allegro_util.inc b/attic/drv/oss_allegro/allegro_util.inc
new file mode 100644
index 0000000..253508d
--- /dev/null
+++ b/attic/drv/oss_allegro/allegro_util.inc
@@ -0,0 +1,1295 @@
+/*
+ * allegro_util.inc -- ESS Technology allegro audio driver.
+ *
+ * Copyright (C) 1992-2000 Don Kim (don.kim@esstech.com)
+ *
+ */
+
+#define DOCKF_DOCKED 0x00000001 /* Default Un-Docked */
+#define DOCKF_DEST_CODEC2 0x00000008 /* Tells VxD CODEC2 active */
+#define HW_INIT_SET_ACTIVE_ACRW 0x00000003 /* Sets the active AC Read/Write */
+#define HW_INIT_SET_ACTIVE_ACINTF 0x00000004 /* ... AC Intf (Local or Remote) */
+
+VOID CodecReset (void);
+void Set2Use36Mhz (void);
+void HWMGR_EnableRemoteCodec (allegro_devc * devc, BOOLEAN enable);
+
+#ifdef later
+VOID CloseModem ();
+#endif
+extern PHWI gphwi;
+extern oss_device_t *allegro_osdev;
+
+#define CODEC_TYPE_AC97 1
+#define CODEC_TYPE_ESS 2
+
+#define DSP33MHZ 0
+#define DSP36MHZ 1
+#define DSP49MHZ 2
+
+static unsigned char bChipType;
+static unsigned char fRemoteCodec;
+static unsigned char bCodec;
+static unsigned char gbHwVolEnabled = TRUE;
+static unsigned char bEapdSupportMode;
+static unsigned int wEapdGPOPolarity_Port;
+static unsigned char bEnable4Speaker;
+BOOL IsAC3Format = FALSE;
+BOOL g4Speaker = FALSE;
+
+/*
+ * DOCK
+ */
+static WORD gwDockVal;
+UCHAR bEnableDockDetect = TRUE;
+UCHAR bDockingDetectGPIPort = 0; /* TODO: What is the right value */
+static WORD wDockedMask;
+static WORD wDockedValue;
+UCHAR bMonoOutputSelect = 0;
+static WORD gwDefaultMonoOutVol;
+int bHwVolCtrlMode = -1;
+static ULONG ulCodec;
+#define NEC_VENDOR_ID3 0x80F11033
+void HwRelease (allegro_devc * devc);
+#define WriteLego HWMGR_WriteCodecData
+PCLIENT_INST pClient_SPDIFIN = NULL;
+BOOL fSPDIFOUT = FALSE;
+
+
+#if 0
+void
+dDbgOut (char *sz, ...)
+{
+ char buf[256];
+ va_list va;
+ va_start (va, sz);
+ vsprintf (buf, sz, va);
+ va_end (va);
+ printk (buf);
+ printk ("\n");
+}
+#endif
+
+void
+HwSetSystemParameter (allegro_devc * devc, DWORD dwValue)
+{
+ switch (dwValue >> 16)
+ {
+ case HW_INIT_SET_ACTIVE_ACRW: /*3 */
+ {
+ dprintf1 (("ACRW %x", dwValue & DOCKF_DEST_CODEC2));
+
+ /*
+ * Set the active AC out direction
+ */
+ if ((WORD) dwValue & DOCKF_DEST_CODEC2) /* In/Out AC2 */
+ HWMGR_EnableRemoteCodec (devc, TRUE);
+ else
+ HWMGR_EnableRemoteCodec (devc, FALSE);
+ }
+ break;
+
+ case HW_INIT_SET_ACTIVE_ACINTF: /*4 */
+ {
+ WORD wTmp;
+
+ dprintf1 (("ACINTF %x", dwValue));
+ if (!(dwValue & DOCKF_DOCKED)) /* Nothing there */
+ {
+ /* CODEC DAC I/F set to local only */
+ wTmp = inpw (devc->osdev, devc->base + 0x3a);
+ wTmp &= 0xFFF3; /* [3:2] = "00" */
+ outpw (devc->osdev, devc->base + 0x3a, wTmp);
+
+ /* CODEC ADC I/F set to local only */
+ wTmp = inpw (devc->osdev, devc->base + 0x3c);
+ wTmp &= 0xFFF3; /* [3:2] = "00" */
+ outpw (devc->osdev, devc->base + 0x3c, wTmp);
+ }
+ else
+ { /* DOCKED */
+ /* CODEC DAC I/F set to local + remote */
+ wTmp = inpw (devc->osdev, devc->base + 0x3a);
+ wTmp &= 0xFFF3;
+ wTmp |= 0x000C; /* [3:2] = "11" */
+ outpw (devc->osdev, devc->base + 0x3a, wTmp);
+
+ /* CODEC ADC I/F set to remote AC2 (or both??) */
+ wTmp = inpw (devc->osdev, devc->base + 0x3c);
+ wTmp &= 0xFFF3;
+ wTmp |= 0x000C; /* [3:2] = "11" */
+ outpw (devc->osdev, devc->base + 0x3c, wTmp);
+ }
+ }
+ break;
+ }
+}
+
+VOID
+PCIWrite (allegro_devc * devc, WORD address, ULONG value)
+{
+
+ pci_write_config_dword (devc->osdev, address, value);
+
+}
+
+ULONG
+PCIRead (allegro_devc * devc, WORD address)
+{
+ unsigned int dw;
+ pci_read_config_dword (devc->osdev, address, &dw);
+ return dw;
+}
+
+#ifdef DEBUGINTERFACE
+void
+dumpreg (WORD programid, WORD index, WORD value, WORD * out)
+{
+ ULONG dwData;
+
+ switch (programid)
+ {
+ case 1: /* aggr */
+ *out = inpw (devc->osdev, devc->base + index);
+ break;
+
+ case 2: /* aggw */
+ outpw (devc->osdev, devc->base + index, value);
+ break;
+
+ case 3: /* legor */
+ HWMGR_ReadCodecData (devc, devc->osdev, index, out);
+ break;
+
+ case 4: /* legow */
+ HWMGR_WriteCodecData (devc, (UCHAR) index, value);
+ break;
+
+ case 5: /* pciar */
+ index &= ~0x1; /* make sure it's even address */
+ dwData = PCIRead (devcv, index & ~0x3);
+ if ((index % 4) == 0)
+ *out = (WORD) dwData;
+ else
+ *out = (WORD) (dwData >> 16);
+ break;
+
+ case 6: /* pciaw */
+ index &= ~0x1; /* make sure it's even address */
+ dwData = PCIRead (devc, index & ~0x3);
+ if ((index % 4) == 0)
+ {
+ dwData &= ~0xffff;
+ dwData |= value;
+ }
+ else
+ {
+ dwData &= 0xffff;
+ dwData |= (value << 16);
+ }
+ PCIWrite (devc, (index & ~0x3), dwData);
+ break;
+ }
+}
+#endif /* DEBUGINTERFACE */
+
+void
+DelayMillisec (int millisec)
+{
+ int count;
+
+ millisec = millisec * 1000 / 50;
+ for (count = 0; count < millisec; count++)
+ KeStallExecutionProcessor (50);
+} /* DelayMillisec */
+
+/* -------------------------------------------------------------------------- */
+
+UCHAR
+HWMGR_ReadDataByte (allegro_devc * devc, UCHAR Index)
+{
+ return READ_PORT_UCHAR (devc->osdev, devc->base + Index);
+} /* HWMGR_ReadDataByte */
+
+
+USHORT
+HWMGR_ReadDataWord (allegro_devc * devc, UCHAR Index)
+{
+ return READ_PORT_USHORT (devc->osdev, devc->base + Index);
+} /* HWMGR_ReadDataWord */
+
+
+void
+HWMGR_WriteDataByte (allegro_devc * devc, UCHAR Index, UCHAR Value)
+{
+ WRITE_PORT_UCHAR (devc->osdev, devc->base + Index, Value);
+} /* HWMGR_WriteDataByte */
+
+
+void
+HWMGR_WriteDataWord (allegro_devc * devc, UCHAR Index, USHORT Value)
+{
+ WRITE_PORT_USHORT (devc->osdev, devc->base + Index, Value);
+} /* HWMGR_WriteDataWord */
+
+
+void
+HWMGR_RestoreACLink (allegro_devc * devc)
+{
+ int i;
+ USHORT wDataCodec;
+ USHORT wDataIn;
+ USHORT wDataOut;
+ USHORT wControl = HWMGR_ReadDataWord (devc, RING_BUS_CTRL_A);
+
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A, (USHORT) (wControl &
+ ~SERIAL_AC_LINK_ENABLE));
+ KeStallExecutionProcessor (50);
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A, wControl);
+
+ wDataCodec = HWMGR_ReadDataWord (devc, RING_BUS_CTRL_B);
+ wDataIn = HWMGR_ReadDataWord (devc, SDO_IN_DEST_CTRL);
+ wDataOut = HWMGR_ReadDataWord (devc, SDO_OUT_DEST_CTRL);
+
+ HWMGR_WriteDataWord (devc, SDO_OUT_DEST_CTRL, (USHORT) (wDataOut &
+ ~COMMAND_ADDR_OUT));
+ HWMGR_WriteDataWord (devc, SDO_IN_DEST_CTRL, (USHORT) (wDataIn &
+ ~STATUS_ADDR_IN));
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_B, (USHORT) (wDataCodec &
+ ~SECOND_CODEC_ID_MASK));
+
+ /* power down DAC to resynchronize after AC-link change */
+ HWMGR_WriteDataWord (devc, CODEC_DATA, AC97_PR1);
+ HWMGR_WriteDataByte (devc, CODEC_COMMAND, AC97_POWER_DOWN_CTRL);
+ for (i = 0; i < 1000; i++)
+ if (!(HWMGR_ReadDataByte (devc, CODEC_STATUS) & CODEC_BUSY_B))
+ break;
+ KeStallExecutionProcessor (1);
+ HWMGR_WriteDataWord (devc, CODEC_DATA, 0);
+ HWMGR_WriteDataByte (devc, CODEC_COMMAND, AC97_POWER_DOWN_CTRL);
+ for (i = 0; i < 1000; i++)
+ if (!(HWMGR_ReadDataByte (devc, CODEC_STATUS) & CODEC_BUSY_B))
+ break;
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_B, wDataCodec);
+ HWMGR_WriteDataWord (devc, SDO_IN_DEST_CTRL, wDataIn);
+ HWMGR_WriteDataWord (devc, SDO_OUT_DEST_CTRL, wDataOut);
+} /* HWMGR_RestoreACLink */
+
+BOOLEAN
+HWMGR_ReadCodecData (allegro_devc * devc, UCHAR Index, PUSHORT Value)
+{
+ int i;
+
+ *Value = 0;
+ HWMGR_WriteDataByte (devc, CODEC_COMMAND, (UCHAR) (CODEC_READ_B | Index));
+ for (i = 0; i < 1000; i++)
+ {
+ if (!(HWMGR_ReadDataByte (devc, CODEC_STATUS) & CODEC_BUSY_B))
+ {
+ *Value = HWMGR_ReadDataWord (devc, CODEC_DATA);
+ return TRUE;
+ }
+ }
+ if (CODEC_TYPE_ESS == bCodec)
+ HWMGR_RestoreACLink (devc);
+
+ return FALSE;
+} /* HWMGR_ReadCodecData */
+
+
+BOOLEAN
+HWMGR_WriteCodecData (allegro_devc * devc, UCHAR Index, USHORT Value)
+{
+ int i;
+
+ HWMGR_WriteDataWord (devc, CODEC_DATA, Value);
+ HWMGR_WriteDataByte (devc, CODEC_COMMAND, Index);
+ for (i = 0; i < 1000; i++)
+ {
+ if (!(HWMGR_ReadDataByte (devc, CODEC_STATUS) & CODEC_BUSY_B))
+ {
+ return TRUE;
+ }
+ }
+ if (CODEC_TYPE_ESS == bCodec)
+ HWMGR_RestoreACLink (devc);
+ return FALSE;
+} /* HWMGR_WriteCodecData */
+
+void
+HWMGR_EnableExternalAmp (allegro_devc * devc, BOOLEAN enable)
+{
+ USHORT wDirection;
+ USHORT wGPO;
+ USHORT wGPO2;
+ USHORT wPolarity;
+ USHORT wPolarity2;
+
+ /*
+ * by default, setup for reference board
+ */
+ if (bEapdSupportMode == 0)
+ {
+ bEapdSupportMode = 1;
+ if (bChipType >= M3_1998)
+ wEapdGPOPolarity_Port = 0x1100;
+ else
+ {
+ wEapdGPOPolarity_Port = 0x1800;
+ if (bChipType == 2)
+ wEapdGPOPolarity_Port = 0x1c00;
+ if (bEnable4Speaker)
+ wEapdGPOPolarity_Port = 0x1600;
+ }
+ }
+
+ dprintf3 (("Mode=%x PPort=%x", bEapdSupportMode, wEapdGPOPolarity_Port));
+ wGPO2 = wPolarity2 = 0;
+ switch (bEapdSupportMode)
+ {
+ case 0:
+ break;
+ case 2:
+ wGPO2 = wEapdGPOPolarity_Port & 0x0F;
+ wPolarity2 = wEapdGPOPolarity_Port >> 4 & 0x0F;
+ if (enable)
+ wPolarity2 = !wPolarity2;
+ wPolarity2 = wPolarity2 << wGPO2;
+ wGPO2 = 1 << wGPO2;
+ wGPO = wEapdGPOPolarity_Port >> 8 & 0x0F;
+ wPolarity = wEapdGPOPolarity_Port >> 12;
+ if (enable)
+ wPolarity = !wPolarity;
+ wPolarity = wPolarity << wGPO;
+ wGPO = 1 << wGPO;
+ wGPO |= wGPO2;
+ wPolarity |= wPolarity2;
+ HWMGR_WriteDataWord (devc, GPIO_MASK, (USHORT) ~ wGPO);
+ wDirection = HWMGR_ReadDataWord (devc, GPIO_DIRECTION) | wGPO;
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION, wDirection);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, (USHORT) (GPO_SECONDARY_AC97 |
+ GPO_PRIMARY_AC97 |
+ wPolarity));
+ HWMGR_WriteDataWord (devc, GPIO_MASK, 0xFFFF);
+ break;
+
+ case 1:
+ wGPO = wEapdGPOPolarity_Port >> 8 & 0x0F;
+ wPolarity = wEapdGPOPolarity_Port >> 12;
+ if (enable)
+ wPolarity = !wPolarity;
+ wPolarity = wPolarity << wGPO;
+ wGPO = 1 << wGPO;
+ wGPO |= wGPO2;
+ wPolarity |= wPolarity2;
+ HWMGR_WriteDataWord (devc, GPIO_MASK, (USHORT) ~ wGPO);
+ wDirection = HWMGR_ReadDataWord (devc, GPIO_DIRECTION) | wGPO;
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION, wDirection);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, (USHORT) (GPO_SECONDARY_AC97 |
+ GPO_PRIMARY_AC97 |
+ wPolarity));
+ HWMGR_WriteDataWord (devc, GPIO_MASK, 0xFFFF);
+ break;
+ }
+} /* HWMGR_EnableExternalAmp */
+
+
+void
+HWMGR_EnableRemoteCodec (allegro_devc * devc, BOOLEAN enable)
+{
+ USHORT wData;
+
+/* This function MUST be in a non-paged segment */
+/* PAGED_CODE(); */
+ if (enable == fRemoteCodec)
+ return;
+ fRemoteCodec = enable;
+ if (enable)
+ {
+
+ /* enable remote codec */
+ wData = HWMGR_ReadDataWord (devc, RING_BUS_CTRL_B);
+ wData = (wData & ~SECOND_CODEC_ID_MASK) | 1;
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_B, wData);
+ wData = HWMGR_ReadDataWord (devc, SDO_OUT_DEST_CTRL);
+ wData = (wData & ~COMMAND_ADDR_OUT) | 1;
+ HWMGR_WriteDataWord (devc, SDO_OUT_DEST_CTRL, wData);
+ wData = HWMGR_ReadDataWord (devc, SDO_IN_DEST_CTRL);
+ wData = (wData & ~STATUS_ADDR_IN) | 1;
+ HWMGR_WriteDataWord (devc, SDO_IN_DEST_CTRL, wData);
+ }
+ else
+ {
+
+ /* disable remote codec */
+ wData = HWMGR_ReadDataWord (devc, RING_BUS_CTRL_B);
+ wData = wData & ~SECOND_CODEC_ID_MASK;
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_B, wData);
+ wData = HWMGR_ReadDataWord (devc, SDO_OUT_DEST_CTRL);
+ wData = wData & ~COMMAND_ADDR_OUT;
+ HWMGR_WriteDataWord (devc, SDO_OUT_DEST_CTRL, wData);
+ wData = HWMGR_ReadDataWord (devc, SDO_IN_DEST_CTRL);
+ wData = wData & ~STATUS_ADDR_IN;
+ HWMGR_WriteDataWord (devc, SDO_IN_DEST_CTRL, wData);
+ }
+} /* HWMGR_EnableRemoteCodec */
+
+#define AKM_CODEC 0x414B4D
+#define TRA_CODEC 0x545241
+#define ESS_CODEC 0x458383
+#define STAC9721_CODEC 0x838476
+#define STAC9721_REV_C 0x09
+#define STAC9721_REV_D 0x44
+
+BOOLEAN
+HWMGR_ReadVendorId (allegro_devc * devc, OUT PULONG pulData, OUT PBYTE pbRev)
+{
+ USHORT wData;
+
+ *pulData = 0;
+ if (HWMGR_ReadCodecData (devc, AC97_VENDOR_ID1, &wData))
+ {
+ *pulData = (ULONG) wData << 16;
+ if (HWMGR_ReadCodecData (devc, AC97_VENDOR_ID2, &wData))
+ {
+ *pulData |= wData;
+ *pbRev = (UCHAR) * pulData;
+ *pulData >>= 8;
+ return TRUE;
+ }
+ *pulData = 0;
+ }
+ return FALSE;
+} /* HWMGR_ReadVendorId */
+
+void
+HWMGR_ResetCodec (allegro_devc * devc)
+{
+ ULONG ulData;
+ USHORT wData;
+ USHORT wDirection;
+ int delay_count;
+ int reset_count;
+ int wait_count;
+ int DoReset = TRUE;
+ BYTE bSaveCodec;
+ BYTE bRev;
+
+ delay_count = reset_count = wait_count = 0;
+ wDirection = HWMGR_ReadDataWord (devc, GPIO_DIRECTION);
+
+ /* not sure if this applies for Allegro-1/Maestro-3 */
+ if (PCIRead (devc, PCI_USER_CONFIG) & EXT_PCI_MASTER_ENABLE)
+ {
+
+ /* GPIO4 = output */
+ wDirection |= 0x10;
+ }
+
+ HWMGR_EnableRemoteCodec (devc, FALSE);
+
+ /* set bCodec to undefined so that ReadCodecData will not try to restore */
+ /* AC-link */
+ bSaveCodec = bCodec;
+ bCodec = 0;
+
+ /* If we can read codec, skip codec reset to avoid pop sound. */
+ /* HP Omnibook M3 does not setup AC-link correctly */
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A, IO_SRAM_ENABLE);
+
+ /* delay at least 20 us if disabling AC-link */
+ KeStallExecutionProcessor (20);
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A,
+ IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE);
+ KeStallExecutionProcessor (1);
+ if (HWMGR_ReadVendorId (devc, &ulData, &bRev))
+ {
+
+ dprintf1 (("codec1 id = %x", ulData));
+ /* do not need to reset */
+ DoReset = FALSE;
+ }
+ if (ulData != 0 && ulData != 0xFFFFFF)
+ {
+ ulCodec = ulData;
+ bCodec = CODEC_TYPE_AC97;
+ if (TRA_CODEC == ulCodec)
+ {
+
+ /* fix for tritech 2.0a codec */
+ HWMGR_WriteCodecData (devc, 0x2A, 0x0001);
+ HWMGR_WriteCodecData (devc, 0x2C, 0x0000);
+ HWMGR_WriteCodecData (devc, 0x2C, 0xFFFF);
+ }
+ else if (ESS_CODEC == ulCodec)
+ {
+ bCodec = CODEC_TYPE_ESS;
+ }
+ }
+ else
+ {
+ if (bChipType >= M3_1998)
+ bCodec = CODEC_TYPE_AC97;
+ else
+ bCodec = CODEC_TYPE_ESS;
+ }
+ if (bSaveCodec)
+ {
+ bCodec = bSaveCodec;
+ }
+
+ dprintf1 (("reset codec1 bCodec=%d DoReset=%d", bCodec, DoReset));
+ /* reset primary codec */
+ if (DoReset)
+ {
+
+ /* regular AC97 codec */
+ if (bChipType >= M3_1998)
+ {
+ delay_count = 20;
+#if CRYSTAL_CODEC_FIX
+ if (!ulCodec || CRY_CODEC == ulCodec)
+ {
+ wait_count = 500;
+ }
+ else
+ {
+ wait_count = 20;
+ }
+#else
+ wait_count = 20;
+#endif
+ }
+ else
+ {
+ delay_count = 50;
+
+ /* delay 800 ms!? */
+ wait_count = 800;
+ }
+ reset_count = 0;
+
+ RESET_CODEC:
+
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A, IO_SRAM_ENABLE);
+
+ /* delay at least 20 us if disabling AC-link */
+ KeStallExecutionProcessor (20);
+
+ /* write GPO0 */
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION,
+ wDirection & ~GPO_PRIMARY_AC97);
+ HWMGR_WriteDataWord (devc, GPIO_MASK, (USHORT) ~ GPO_PRIMARY_AC97);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, 0x000);
+ wDirection |= GPO_PRIMARY_AC97;
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION, wDirection);
+
+ /* delay 20 ms */
+ DelayMillisec (delay_count);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, GPO_PRIMARY_AC97);
+ KeStallExecutionProcessor (5);
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A,
+ IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE);
+ HWMGR_WriteDataWord (devc, GPIO_MASK, 0xFFFF);
+
+ /* wait for codec to be ready */
+ DelayMillisec (wait_count);
+
+#if defined( AC97_RESETFIX )
+ /* If unable to read from Codec, perform special reset */
+ if (!HWMGR_ReadCodecData (devc, AC97_VENDOR_ID1, &wData))
+ {
+ /* Save Serial Link Configuration */
+ HWMGR_ReadDataWord (devc, RING_BUS_CTRL_A, &wRingBusReg);
+
+ /* Disable Serial AC Link and Cold Reset Codec */
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A, _AC_SDFS_ENABLE);
+
+ /* Delay 20mS */
+ for (count = 0; count < 400; count++)
+ KeStallExecutionProcessor (50);
+
+ /* Enable AC Serial Link */
+ HWMGR_WriteDataWord (devc, RING_BUG_CTRL_A, wRingBusReg);
+
+ if (!HWMGR_ReadCodecData (devc, AC97_VENDOR_ID1, &wData))
+ {
+ /* Disable Serial AC Link and Cold Reset Codec */
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A, _AC_SDFS_ENABLE);
+
+ /* Warm Reset Codec */
+ HWMGR_WriteDataByte (devc, CODEC_COMMAND, 0x00);
+ /* Delay 20mS */
+ for (count = 0; count < 400; count++)
+ KeStallExecutionProcessor (50);
+
+ /* Enable AC Serial Link */
+ HWMGR_WriteDataWord (devc, RING_BUG_CTRL_A, wRingBusReg);
+
+ /* Set AC97 PR4 26h[12] */
+ HWMGR_ReadCodecData (devc, AC97_POWER_DOWN_CTRL, &wData);
+ HWMGR_WriteCodecData (devc, AC97_POWER_DOWN_CTRL,
+ wData | AC97_PR4);
+
+ /* Warm Reset Codec */
+ HWMGR_WriteDataByte (devc, CODEC_COMMAND, 0x00);
+ /* Delay 20mS */
+ for (count = 0; count < 400; count++)
+ KeStallExecutionProcessor (50);
+ }
+ }
+#endif
+
+ if (!bCodec)
+ {
+ if (HWMGR_ReadVendorId (devc, &ulData, &bRev))
+ {
+ if (ulData != 0 && ulData != 0xFFFFFF)
+ {
+ ulCodec = ulData;
+ bCodec = CODEC_TYPE_AC97;
+ if (TRA_CODEC == ulCodec)
+ {
+
+ /* fix for tritech 2.0a codec */
+ HWMGR_WriteCodecData (devc, 0x2A, 0x0001);
+ HWMGR_WriteCodecData (devc, 0x2C, 0x0000);
+ HWMGR_WriteCodecData (devc, 0x2C, 0xFFFF);
+ }
+ else if (ESS_CODEC == ulCodec)
+ {
+ bCodec = CODEC_TYPE_ESS;
+ }
+ }
+ }
+ else
+ {
+ if (++reset_count < 20)
+ {
+ delay_count += 10;
+ wait_count += 100;
+ goto RESET_CODEC;
+ }
+ }
+ if (!bCodec)
+ {
+ if (bChipType >= M3_1998)
+ bCodec = CODEC_TYPE_AC97;
+ else
+ bCodec = CODEC_TYPE_ESS;
+ }
+ }
+ }
+ else if ((wDirection & GPO_PRIMARY_AC97) == 0)
+ {
+ HWMGR_WriteDataWord (devc, GPIO_MASK, (USHORT) ~ GPO_PRIMARY_AC97);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, GPO_PRIMARY_AC97);
+ wDirection |= GPO_PRIMARY_AC97;
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION, wDirection);
+ HWMGR_WriteDataWord (devc, GPIO_MASK, 0xFFFF);
+ }
+
+ dprintf1 (("Codec:%d\n", bCodec));
+
+ if (CODEC_TYPE_ESS == bCodec)
+ {
+ if (HWMGR_ReadCodecData (devc, AC97_CLOCK_DELAY, &wData))
+ {
+ wData &= ~(AC97_CLOCK_DELAY_SEL << AC97_ADC_CDS_SHIFT);
+ wData |= 18 << AC97_ADC_CDS_SHIFT;
+ HWMGR_WriteCodecData (devc, AC97_CLOCK_DELAY, wData);
+ }
+ else
+ {
+ if (++reset_count < 20)
+ {
+ delay_count += 10;
+ wait_count += 100;
+ goto RESET_CODEC;
+ }
+ }
+ }
+
+ if (gwDockVal)
+ {
+ HWMGR_EnableRemoteCodec (devc, TRUE);
+
+ wData = HWMGR_ReadDataWord (devc, RING_BUS_CTRL_B);
+ wData &= ~(SECOND_AC_ENABLE | SECOND_CODEC_ID_MASK);
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_B,
+ (USHORT) (wData | SECOND_AC_ENABLE | 1));
+
+ /* If we can read codec, skip codec reset to avoid pop sound. */
+ DoReset = TRUE;
+ if (HWMGR_ReadVendorId (devc, &ulData, &bRev))
+ {
+
+ dprintf1 (("Read:%x,%x\n", ulData, bRev));
+
+ /* do not need to reset */
+ DoReset = FALSE;
+ }
+
+ /* reset secondary codec */
+ if (DoReset)
+ {
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A, IO_SRAM_ENABLE);
+
+ /* delay at least 20 us if disabling AC-link */
+ KeStallExecutionProcessor (20);
+
+ /* write GPO3 */
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION,
+ wDirection & ~GPO_SECONDARY_AC97);
+ HWMGR_WriteDataWord (devc, GPIO_MASK,
+ (USHORT) ~ GPO_SECONDARY_AC97);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, 0x000);
+ wDirection |= GPO_SECONDARY_AC97;
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION, wDirection);
+
+ /* delay 20 ms */
+ DelayMillisec (20);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, GPO_SECONDARY_AC97);
+
+ /* delay 20 ms */
+ DelayMillisec (20);
+ HWMGR_WriteDataWord (devc, GPIO_MASK, 0xFFFF);
+
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_A,
+ IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE);
+ KeStallExecutionProcessor (1);
+
+ /* read vendor id */
+ (void) HWMGR_ReadVendorId (devc, &ulData, &bRev);
+
+ dprintf1 (("Reset:%x,%x\n", ulData, bRev));
+ }
+ else if ((wDirection & GPO_SECONDARY_AC97) == 0)
+ {
+ HWMGR_WriteDataWord (devc, GPIO_MASK,
+ (USHORT) ~ GPO_SECONDARY_AC97);
+ HWMGR_WriteDataWord (devc, GPIO_DATA, GPO_SECONDARY_AC97);
+ wDirection |= GPO_SECONDARY_AC97;
+ HWMGR_WriteDataWord (devc, GPIO_DIRECTION, wDirection);
+ HWMGR_WriteDataWord (devc, GPIO_MASK, 0xFFFF);
+ }
+ if (ulData != 0 && ulData != 0xFFFFFF)
+ {
+ if (TRA_CODEC == ulData)
+ {
+
+ /* fix for tritech 2.0a codec */
+ HWMGR_WriteCodecData (devc, 0x2A, 0x0001);
+ HWMGR_WriteCodecData (devc, 0x2C, 0x0000);
+ HWMGR_WriteCodecData (devc, 0x2C, 0xFFFF);
+ }
+ else if (STAC9721_CODEC == ulData)
+ {
+ USHORT wStatus;
+
+ if (!HWMGR_ReadCodecData
+ (devc, AC97_POWER_DOWN_CTRL, &wStatus) || 0 == wStatus)
+ {
+ HWMGR_WriteCodecData (devc, 0x76, 0xABBA);
+ if (STAC9721_REV_D == bRev)
+ {
+ HWMGR_WriteCodecData (devc, 0x78, 0x2002);
+ KeStallExecutionProcessor (20);
+ HWMGR_WriteCodecData (devc, 0x78, 0x2802);
+ }
+ else
+ {
+ HWMGR_WriteCodecData (devc, 0x78, 0x3002);
+ KeStallExecutionProcessor (20);
+ HWMGR_WriteCodecData (devc, 0x78, 0x3802);
+ }
+ }
+ }
+ }
+ HWMGR_EnableRemoteCodec (devc, FALSE);
+
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_B, wData);
+ }
+} /* HWMGR_ResetCodec */
+
+#if 0
+#define DSP33MHZ 0
+#define DSP36MHZ 1
+#define DSP49MHZ 2
+#endif
+
+
+UCHAR bGray_Code[32] = {
+ 0x00, 0x01, 0x03, 0x02, 0x07, 0x06, 0x04, 0x05,
+ 0x0F, 0x0E, 0x0C, 0x0D, 0x08, 0x09, 0x0B, 0x0A,
+ 0x1F, 0x1E, 0x1C, 0x1D, 0x18, 0x19, 0x1B, 0x1A,
+ 0x10, 0x11, 0x13, 0x12, 0x17, 0x16, 0x14, 0x15
+};
+
+void
+HWMGR_SetClockSpeed (allegro_devc * devc, UCHAR speed)
+{
+ ULONG ulData;
+ int choice;
+ int mode;
+ UCHAR bModeValue[8];
+ UCHAR bData;
+ UCHAR bDelta;
+
+ HWMGR_WriteDataByte (devc, ASSP_CONTROL_B, RESET_ASSP);
+
+ ulData = PCIRead (devc, PCI_ALLEGRO_CONFIG);
+ ulData &= ~INT_CLK_SELECT;
+ ulData &= ~(CLK_MULT_MODE_SELECT | CLK_MULT_MODE_SELECT_2);
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ if (DSP36MHZ == speed)
+ {
+ ulData = PCIRead (devc, PCI_USER_CONFIG);
+ ulData &= ~IN_CLK_12MHZ_SELECT;
+ PCIWrite (devc, PCI_USER_CONFIG, ulData);
+
+ for (mode = 0; mode < 4; mode++)
+ {
+ ulData |= INT_CLK_MULT_RESET;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData &= ~CLK_MULT_MODE_SELECT;
+ ulData |= mode << CLK_MULT_MODE_SHIFT;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData &= ~INT_CLK_MULT_RESET;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ bModeValue[mode] =
+ bGray_Code[HWMGR_ReadDataWord (devc, CLK_MULT_DATA_PORT) >> 5
+ & 0x1F];
+ }
+ ulData |= CLK_MULT_MODE_SELECT_2;
+ for (mode = 0; mode < 4; mode++)
+ {
+ ulData |= INT_CLK_MULT_RESET;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData &= ~CLK_MULT_MODE_SELECT;
+ ulData |= mode << CLK_MULT_MODE_SHIFT;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData &= ~INT_CLK_MULT_RESET;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ bModeValue[mode + 4] =
+ bGray_Code[HWMGR_ReadDataWord (devc, CLK_MULT_DATA_PORT) >> 5
+ & 0x1F];
+ }
+#define Abs(x) ((x)<0) ? -(x) : (x)
+ bDelta = Abs (bModeValue[0] - 0x10);
+ choice = 0;
+ for (mode = 1; mode < 8; mode++)
+ {
+ if (bDelta > Abs (bModeValue[mode] - 0x10))
+ {
+ bDelta = Abs (bModeValue[mode] - 0x10);
+ choice = mode;
+ }
+ }
+
+#if 0
+ _Debug_Printf_Service ("mode:%d\n", choice);
+#endif
+ ulData &= ~(CLK_MULT_MODE_SELECT | CLK_MULT_MODE_SELECT_2);
+ if (choice > 3)
+ {
+ ulData |= CLK_MULT_MODE_SELECT_2;
+ choice -= 4;
+ }
+ ulData |= INT_CLK_MULT_RESET;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData |= choice << CLK_MULT_MODE_SHIFT;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData &= ~INT_CLK_MULT_RESET;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ ulData |= INT_CLK_SELECT;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ }
+ else
+ {
+ ulData = PCIRead (devc, PCI_USER_CONFIG);
+ ulData |= IN_CLK_12MHZ_SELECT;
+ PCIWrite (devc, PCI_USER_CONFIG, ulData);
+ }
+
+ bData = HWMGR_ReadDataByte (devc, ASSP_CONTROL_A);
+ bData &= ~(DSP_CLK_36MHZ_SELECT | ASSP_CLK_49MHZ_SELECT);
+ bData |= ASSP_0_WS_ENABLE;
+ switch (speed)
+ {
+ case DSP36MHZ:
+ bData |= DSP_CLK_36MHZ_SELECT;
+ break;
+ case DSP49MHZ:
+ bData |= ASSP_CLK_49MHZ_SELECT;
+ break;
+ }
+ HWMGR_WriteDataByte (devc, ASSP_CONTROL_A, bData);
+
+ HWMGR_WriteDataByte (devc, ASSP_CONTROL_B, RUN_ASSP);
+} /* HWMGR_SetClockSpeed */
+
+void
+HWMGR_SetM3ClockSpeed (allegro_devc * devc, UCHAR speed)
+{
+ ULONG ulData;
+ int choice;
+ int mode;
+ UCHAR bModeValue[8];
+ UCHAR bData;
+ UCHAR bDelta;
+
+ HWMGR_WriteDataByte (devc, ASSP_CONTROL_B, RESET_ASSP);
+
+ ulData = PCIRead (devc, PCI_ALLEGRO_CONFIG);
+ if (DSP33MHZ == speed)
+ ulData &= ~INT_CLK_SRC_NOT_PCI;
+ else
+ ulData |= INT_CLK_SRC_NOT_PCI;
+ ulData &= ~(INT_CLK_MULT_ENABLE | INT_CLK_SELECT);
+ ulData &= ~(CLK_MULT_MODE_SELECT | CLK_MULT_MODE_SELECT_2);
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ if (DSP36MHZ == speed)
+ {
+ ulData = PCIRead (devc, PCI_USER_CONFIG);
+ ulData |= IN_CLK_12MHZ_SELECT;
+ PCIWrite (devc, PCI_USER_CONFIG, ulData);
+
+ for (mode = 0; mode < 4; mode++)
+ {
+ ulData &= ~INT_CLK_MULT_ENABLE;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData &= ~CLK_MULT_MODE_SELECT;
+ ulData |= mode << CLK_MULT_MODE_SHIFT;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData |= INT_CLK_MULT_ENABLE;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ bModeValue[mode] =
+ bGray_Code[HWMGR_ReadDataWord (devc, CLK_MULT_DATA_PORT) >> 5
+ & 0x1F];
+ }
+ ulData |= CLK_MULT_MODE_SELECT_2;
+ for (mode = 0; mode < 4; mode++)
+ {
+ ulData &= ~INT_CLK_MULT_ENABLE;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData &= ~CLK_MULT_MODE_SELECT;
+ ulData |= mode << CLK_MULT_MODE_SHIFT;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData |= INT_CLK_MULT_ENABLE;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ READ_PORT_UCHAR (devc->osdev, 0x80);
+ bModeValue[mode + 4] =
+ bGray_Code[HWMGR_ReadDataWord (devc, CLK_MULT_DATA_PORT) >> 5
+ & 0x1F];
+ }
+ bDelta = Abs (bModeValue[0] - 0x10);
+ choice = 0;
+ for (mode = 1; mode < 8; mode++)
+ {
+ if (bDelta > Abs (bModeValue[mode] - 0x10))
+ {
+ bDelta = Abs (bModeValue[mode] - 0x10);
+ choice = mode;
+ }
+ }
+
+#if 0
+ _Debug_Printf_Service ("mode:%d\n", choice);
+#endif
+ ulData &= ~(INT_CLK_MULT_ENABLE | CLK_MULT_MODE_SELECT |
+ CLK_MULT_MODE_SELECT_2);
+ if (choice > 3)
+ {
+ ulData |= CLK_MULT_MODE_SELECT_2;
+ choice -= 4;
+ }
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData |= choice << CLK_MULT_MODE_SHIFT;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ ulData |= INT_CLK_MULT_ENABLE;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+ }
+
+ bData = HWMGR_ReadDataByte (devc, ASSP_CONTROL_A);
+ bData &= ~(DSP_CLK_36MHZ_SELECT | ASSP_CLK_49MHZ_SELECT);
+ bData |= ASSP_0_WS_ENABLE;
+ switch (speed)
+ {
+ case DSP36MHZ:
+ bData |= DSP_CLK_36MHZ_SELECT;
+ break;
+ case DSP49MHZ:
+ bData |= ASSP_CLK_49MHZ_SELECT;
+ break;
+ }
+ HWMGR_WriteDataByte (devc, ASSP_CONTROL_A, bData);
+
+ HWMGR_WriteDataByte (devc, ASSP_CONTROL_B, RUN_ASSP);
+} /* HWMGR_SetM3ClockSpeed */
+
+
+BOOLEAN
+HWMGR_InitKernel (allegro_devc * devc)
+{
+ ULONG ulData;
+
+ ulData = PCIRead (devc, PCI_ALLEGRO_CONFIG);
+ ulData &= REDUCED_DEBOUNCE;
+
+ if (gbHwVolEnabled)
+ {
+ ulData |= HV_CTRL_ENABLE;
+
+ if (bHwVolCtrlMode == -1)
+ {
+ bHwVolCtrlMode = 0;
+ if (bChipType < M3_1998)
+ bHwVolCtrlMode = 1;
+ }
+
+ if (PCIRead (devc, 0x2c) == NEC_VENDOR_ID3)
+ {
+ bHwVolCtrlMode |= (0x80 | 0x40);
+ }
+
+ if (bHwVolCtrlMode & 0x80)
+ {
+ bHwVolCtrlMode &= ~0x80;
+ ulData |= REDUCED_DEBOUNCE;
+ }
+
+ if (bHwVolCtrlMode & 0x40)
+ {
+ bHwVolCtrlMode &= ~0x40;
+ PCIWrite (devc, PCI_USER_CONFIG,
+ PCIRead (devc, PCI_USER_CONFIG) | HV_CTRL_TEST);
+ }
+
+ dprintf1 (("bHwVolCtrlMode=%x", bHwVolCtrlMode));
+
+ /* default 53/54 pin */
+ switch (bHwVolCtrlMode)
+ {
+
+ /* 44/45 pin */
+ case 0x01:
+ ulData |= HV_BUTTON_FROM_GD;
+ break;
+
+#if 0
+ /* M3E */
+ case 0x02:
+ break;
+ /* M3E */
+ case 0x03:
+ break;
+ /* M3E */
+ case 0x04:
+ break;
+#endif
+ }
+ }
+
+ ulData |= PM_CTRL_ENABLE | CLK_DIV_BY_49 | USE_PCI_TIMING;
+ PCIWrite (devc, PCI_ALLEGRO_CONFIG, ulData);
+
+ ulData = PCIRead (devc, PCI_USER_CONFIG);
+ ulData |= MIDI_1_ENABLE;
+ PCIWrite (devc, PCI_USER_CONFIG, ulData);
+
+ if (bChipType >= M3_1998)
+ HWMGR_SetM3ClockSpeed (devc, DSP49MHZ);
+ else
+ /* new Allegro board only works with external 49 Mhz clock */
+ HWMGR_SetClockSpeed (devc, DSP49MHZ);
+ /*ulDSPConnectIn = KCONNECT_ADC1; */
+
+ /* initialize the DSP kernel */
+ if (kInitKernel (devc, &gphwi, 0x1978, 0x10, devc->base, 0) !=
+ KRETURN_SUCCESS)
+ return FALSE;
+
+#ifdef later
+ InitModem ();
+#endif
+
+#ifdef FIXED_MODEM
+ {
+ extern DWORD gdwESModem;
+ extern DWORD DisableModemClient (VOID);
+ if (gdwESModem)
+ {
+ if (kOpenInstance
+ (gphwi, CLIENT_MODEM, 0, 0x180 * 2,
+ &pClient_Modem) != KRETURN_SUCCESS)
+ return FALSE;
+ DisableModemClient ();
+ }
+ }
+#endif
+
+ return TRUE;
+} /* HWMGR_InitKernel */
+
+/* -------------------------------------------------------------------------- */
+
+void
+HWMGR_InitSystem (allegro_devc * devc)
+{
+ WORD wData;
+ DWORD dwVal;
+
+#if 0 /* this cause zip sound for Compaq. Code here is for problems for older */
+ /* allegro chip, new one does not need this any more. */
+ /* prevent AC-link deadlocking */
+ HWMGR_WriteDataWord (devc, HOST_INT_CTRL, SOFTWARE_RESET_ENABLE);
+ KeStallExecutionProcessor (5);
+ HWMGR_WriteDataWord (devc, HOST_INT_CTRL, 0x0);
+#endif
+
+ HWMGR_InitKernel (devc);
+
+ if (bEnableDockDetect)
+ {
+ wDockedMask = bDockingDetectGPIPort & 0x0F;
+ wDockedValue = (bDockingDetectGPIPort >> 4 & 0x0F) << wDockedMask;
+ wDockedMask = 1 << wDockedMask;
+ gwDockVal =
+ (HWMGR_ReadDataWord (devc, GPIO_DATA) & wDockedMask) == wDockedValue;
+ }
+ else
+ {
+ wDockedMask = wDockedValue = 0;
+ }
+
+ /* force to set correct codec */
+ fRemoteCodec = 0xFF;
+
+ HWMGR_ResetCodec (devc);
+
+ /* allegro codec proble from cold boot so one more resetcodec */
+ HWMGR_ResetCodec (devc);
+
+ if (CODEC_TYPE_ESS == bCodec)
+ {
+
+ /* power down DAC to resynchronize after AC-link change */
+ HWMGR_WriteCodecData (devc, AC97_POWER_DOWN_CTRL, AC97_PR1);
+ KeStallExecutionProcessor (1);
+ }
+
+ /* codec not reset every time */
+ HWMGR_WriteCodecData (devc, AC97_POWER_DOWN_CTRL, 0);
+ HWMGR_EnableExternalAmp (devc, TRUE);
+ if (gwDockVal)
+ {
+ wData = HWMGR_ReadDataWord (devc, RING_BUS_CTRL_B);
+ wData |= SECOND_AC_ENABLE;
+ HWMGR_WriteDataWord (devc, RING_BUS_CTRL_B, wData);
+ }
+
+ HWMGR_ReadCodecData (devc, AC97_GENERAL_PURPOSE, &wData);
+ if (bMonoOutputSelect)
+ {
+ wData |= 0x300;
+
+ HWMGR_WriteCodecData (devc, AC97_MASTER_MONO_VOL, gwDefaultMonoOutVol);
+ KeStallExecutionProcessor (100);
+ HWMGR_WriteCodecData (devc, AC97_MASTER_MONO_VOL, gwDefaultMonoOutVol);
+ }
+ else
+ wData &= ~0x300;
+ HWMGR_WriteCodecData (devc, AC97_GENERAL_PURPOSE, wData);
+
+ /* fix DAC volume at 0x0808 */
+ HWMGR_WriteCodecData (devc, AC97_MASTER_VOL, 0x0404);
+ HWMGR_WriteCodecData (devc, AC97_PCM_OUT_VOL, 0x0404);
+
+ /* Mute the ADC */
+ if (!g4Speaker)
+ HWMGR_WriteCodecData (devc, AC97_RECORD_GAIN, 0x8000);
+
+ gwDSPConnectIn = KCONNECT_ADC1;
+
+ /*
+ * Undock it first
+ */
+ dwVal = HW_INIT_SET_ACTIVE_ACINTF;
+ dwVal <<= 16;
+ HwSetSystemParameter (devc, dwVal);
+
+ /*
+ * Setup active I/F
+ */
+ dwVal = HW_INIT_SET_ACTIVE_ACINTF;
+ dwVal <<= 16;
+
+ HwSetSystemParameter (devc, dwVal);
+} /* HWMGR_InitSystem */
+
+
+void
+HwRelease (allegro_devc * devc)
+{
+#ifdef later
+ CloseModem ();
+#endif
+
+ kTermKernel (devc, gphwi, devc->base);
+
+ HWMGR_EnableExternalAmp (devc, FALSE);
+
+ /* MUTE THE DAMN THING FIRST */
+ WriteLego (devc, 0x02, 0x3F3F); /* LOUT1 Master Attenuation (-1.5dB steps: 0000 = 0dB, 3F3F = -94dB, ) */
+
+ WriteLego (devc, 0x04, 0x9F1F); /* Headphone */
+ WriteLego (devc, 0x06, 0x9F1F); /* MonoOut */
+ WriteLego (devc, 0x12, 0x9F1F); /* CD to Mixer Level (80=mute; 00=+12.0dB, 08=0.0dB, 0F = -33dB) */
+ WriteLego (devc, 0x16, 0x9F1F); /* AUX to Mixer Level (80=mute; 00=+12.0dB, 08=0.0dB, 0F = -33dB) */
+ WriteLego (devc, 0x0E, 0x9F1F); /* Mic to Mixer Level (80=mute; 00=+12.0dB, 08=0.0dB, 0F = -33dB) */
+ WriteLego (devc, 0x18, 0x9F1F); /* DAC to Mixer Level (80=mute; 00=+12.0dB, 08=0.0dB, 0F = -33dB) */
+ WriteLego (devc, 0x10, 0x9F1F); /* Line in to Mixer Level (80=mute; 00=+12.0dB, 08=0.0dB, 0F = -33dB) */
+ WriteLego (devc, 0x1A, 0); /* Rec Gain */
+ WriteLego (devc, 0x1C, 0x8F0F); /* Rec Gain */
+}
diff --git a/attic/drv/oss_allegro/hardware.h b/attic/drv/oss_allegro/hardware.h
new file mode 100644
index 0000000..ffbca31
--- /dev/null
+++ b/attic/drv/oss_allegro/hardware.h
@@ -0,0 +1,355 @@
+/*
+ * ESS Technology allegro audio driver.
+ *
+ * Copyright (C) 1992-2000 Don Kim (don.kim@esstech.com)
+ */
+#ifndef __HARDWARE_H
+#define __HARDWARE_H
+
+
+#define SUBSYSTEM_VENDOR_ID 0x2C
+
+/* Allegro PCI configuration registers */
+#define PCI_LEGACY_AUDIO_CTRL 0x40
+#define SOUND_BLASTER_ENABLE 0x00000001
+#define FM_SYNTHESIS_ENABLE 0x00000002
+#define GAME_PORT_ENABLE 0x00000004
+#define MPU401_IO_ENABLE 0x00000008
+#define MPU401_IRQ_ENABLE 0x00000010
+#define ALIAS_10BIT_IO 0x00000020
+#define SB_DMA_MASK 0x000000C0
+#define SB_DMA_0 0x00000040
+#define SB_DMA_1 0x00000040
+#define SB_DMA_R 0x00000080
+#define SB_DMA_3 0x000000C0
+#define SB_IRQ_MASK 0x00000700
+#define SB_IRQ_5 0x00000000
+#define SB_IRQ_7 0x00000100
+#define SB_IRQ_9 0x00000200
+#define SB_IRQ_10 0x00000300
+#define MIDI_IRQ_MASK 0x00003800
+#define SERIAL_IRQ_ENABLE 0x00004000
+#define DISABLE_LEGACY 0x00008000
+
+#define PCI_ALLEGRO_CONFIG 0x50
+#define SB_ADDR_240 0x00000004
+#define MPU_ADDR_MASK 0x00000018
+#define MPU_ADDR_330 0x00000000
+#define MPU_ADDR_300 0x00000008
+#define MPU_ADDR_320 0x00000010
+#define MPU_ADDR_340 0x00000018
+#define USE_PCI_TIMING 0x00000040
+#define POSTED_WRITE_ENABLE 0x00000080
+#define DMA_POLICY_MASK 0x00000700
+#define DMA_DDMA 0x00000000
+#define DMA_TDMA 0x00000100
+#define DMA_PCPCI 0x00000200
+#define DMA_WBDMA16 0x00000400
+#define DMA_WBDMA4 0x00000500
+#define DMA_WBDMA2 0x00000600
+#define DMA_WBDMA1 0x00000700
+#define DMA_SAFE_GUARD 0x00000800
+#define HI_PERF_GP_ENABLE 0x00001000
+#define PIC_SNOOP_MODE_0 0x00002000
+#define PIC_SNOOP_MODE_1 0x00004000
+#define SOUNDBLASTER_IRQ_MASK 0x00008000
+#define RING_IN_ENABLE 0x00010000
+#define SPDIF_TEST_MODE 0x00020000
+#define CLK_MULT_MODE_SELECT_2 0x00040000
+#define EEPROM_WRITE_ENABLE 0x00080000
+#define CODEC_DIR_IN 0x00100000
+#define HV_BUTTON_FROM_GD 0x00200000
+#define REDUCED_DEBOUNCE 0x00400000
+#define HV_CTRL_ENABLE 0x00800000
+#define SPDIF_ENABLE 0x01000000
+#define CLK_DIV_SELECT 0x06000000
+#define CLK_DIV_BY_48 0x00000000
+#define CLK_DIV_BY_49 0x02000000
+#define CLK_DIV_BY_50 0x04000000
+#define CLK_DIV_RESERVED 0x06000000
+#define PM_CTRL_ENABLE 0x08000000
+#define CLK_MULT_MODE_SELECT 0x30000000
+#define CLK_MULT_MODE_SHIFT 28
+#define CLK_MULT_MODE_0 0x00000000
+#define CLK_MULT_MODE_1 0x10000000
+#define CLK_MULT_MODE_2 0x20000000
+#define CLK_MULT_MODE_3 0x30000000
+#define INT_CLK_SELECT 0x40000000
+#define INT_CLK_MULT_RESET 0x80000000
+
+/* M3 */
+#define INT_CLK_SRC_NOT_PCI 0x00100000
+#define INT_CLK_MULT_ENABLE 0x80000000
+
+#define PCI_ACPI_CONTROL 0x54
+#define PCI_ACPI_D0 0x00000000
+#define PCI_ACPI_D1 0xB4F70000
+#define PCI_ACPI_D2 0xB4F7B4F7
+
+#define PCI_USER_CONFIG 0x58
+#define EXT_PCI_MASTER_ENABLE 0x00000001
+#define SPDIF_OUT_SELECT 0x00000002
+#define TEST_PIN_DIR_CTRL 0x00000004
+#define AC97_CODEC_TEST 0x00000020
+#define TRI_STATE_BUFFER 0x00000080
+#define IN_CLK_12MHZ_SELECT 0x00000100
+#define MULTI_FUNC_DISABLE 0x00000200
+#define EXT_MASTER_PAIR_SEL 0x00000400
+#define PCI_MASTER_SUPPORT 0x00000800
+#define STOP_CLOCK_ENABLE 0x00001000
+#define EAPD_DRIVE_ENABLE 0x00002000
+#define REQ_TRI_STATE_ENABLE 0x00004000
+#define REQ_LOW_ENABLE 0x00008000
+#define MIDI_1_ENABLE 0x00010000
+#define MIDI_2_ENABLE 0x00020000
+#define SB_AUDIO_SYNC 0x00040000
+#define HV_CTRL_TEST 0x00100000
+#define SOUNDBLASTER_TEST 0x00400000
+
+#define PCI_USER_CONFIG_C 0x5C
+
+#define PCI_DDMA_CTRL 0x60
+#define DDMA_ENABLE 0x00000001
+
+
+/* Allegro registers */
+#define HOST_INT_CTRL 0x18
+#define SB_INT_ENABLE 0x0001
+#define MPU401_INT_ENABLE 0x0002
+#define ASSP_INT_ENABLE 0x0010
+#define RING_INT_ENABLE 0x0020
+#define HV_INT_ENABLE 0x0040
+#define CLKRUN_GEN_ENABLE 0x0100
+#define HV_CTRL_TO_PME 0x0400
+#define SOFTWARE_RESET_ENABLE 0x8000
+
+#define HOST_INT_STATUS 0x1A
+#define SB_INT_PENDING 0x01
+#define MPU401_INT_PENDING 0x02
+#define ASSP_INT_PENDING 0x10
+#define RING_INT_PENDING 0x20
+#define HV_INT_PENDING 0x40
+
+#define HARDWARE_VOL_CTRL 0x1B
+#define SHADOW_MIX_REG_VOICE 0x1C
+#define HW_VOL_COUNTER_VOICE 0x1D
+#define SHADOW_MIX_REG_MASTER 0x1E
+#define HW_VOL_COUNTER_MASTER 0x1F
+
+#define CODEC_COMMAND 0x30
+#define CODEC_READ_B 0x80
+
+#define CODEC_STATUS 0x30
+#define CODEC_BUSY_B 0x01
+
+#define CODEC_DATA 0x32
+
+/* AC97 registers */
+#define AC97_RESET 0x00
+
+#define AC97_VOL_MUTE_B 0x8000
+#define AC97_VOL_M 0x1F
+#define AC97_LEFT_VOL_S 8
+
+#define AC97_MASTER_VOL 0x02
+#define AC97_LINE_LEVEL_VOL 0x04
+#define AC97_MASTER_MONO_VOL 0x06
+#define AC97_PC_BEEP_VOL 0x0A
+#define AC97_PC_BEEP_VOL_M 0x0F
+#define AC97_SROUND_MASTER_VOL 0x38
+#define AC97_PC_BEEP_VOL_S 1
+
+#define AC97_PHONE_VOL 0x0C
+#define AC97_MIC_VOL 0x0E
+#define AC97_MIC_20DB_ENABLE 0x40
+
+#define AC97_LINEIN_VOL 0x10
+#define AC97_CD_VOL 0x12
+#define AC97_VIDEO_VOL 0x14
+#define AC97_AUX_VOL 0x16
+#define AC97_PCM_OUT_VOL 0x18
+#define AC97_RECORD_SELECT 0x1A
+#define AC97_RECORD_MIC 0x00
+#define AC97_RECORD_CD 0x01
+#define AC97_RECORD_VIDEO 0x02
+#define AC97_RECORD_AUX 0x03
+#define AC97_RECORD_MONO_MUX 0x02
+#define AC97_RECORD_DIGITAL 0x03
+#define AC97_RECORD_LINE 0x04
+#define AC97_RECORD_STEREO 0x05
+#define AC97_RECORD_MONO 0x06
+#define AC97_RECORD_PHONE 0x07
+
+#define AC97_RECORD_GAIN 0x1C
+#define AC97_RECORD_VOL_M 0x0F
+
+#define AC97_GENERAL_PURPOSE 0x20
+#define AC97_POWER_DOWN_CTRL 0x26
+#define AC97_ADC_READY 0x0001
+#define AC97_DAC_READY 0x0002
+#define AC97_ANALOG_READY 0x0004
+#define AC97_VREF_ON 0x0008
+#define AC97_PR0 0x0100
+#define AC97_PR1 0x0200
+#define AC97_PR2 0x0400
+#define AC97_PR3 0x0800
+#define AC97_PR4 0x1000
+
+#define AC97_RESERVED1 0x28
+
+#define AC97_VENDOR_TEST 0x5A
+
+#define AC97_CLOCK_DELAY 0x5C
+#define AC97_LINEOUT_MUX_SEL 0x0001
+#define AC97_MONO_MUX_SEL 0x0002
+#define AC97_CLOCK_DELAY_SEL 0x1F
+#define AC97_DAC_CDS_SHIFT 6
+#define AC97_ADC_CDS_SHIFT 11
+
+#define AC97_MULTI_CHANNEL_SEL 0x74
+
+#define AC97_VENDOR_ID1 0x7C
+#define AC97_VENDOR_ID2 0x7E
+
+
+#define RING_BUS_CTRL_A 0x36
+#define RAC_PME_ENABLE 0x0100
+#define RAC_SDFS_ENABLE 0x0200
+#define LAC_PME_ENABLE 0x0400
+#define LAC_SDFS_ENABLE 0x0800
+#define SERIAL_AC_LINK_ENABLE 0x1000
+#define IO_SRAM_ENABLE 0x2000
+#define IIS_INPUT_ENABLE 0x8000
+
+#define RING_BUS_CTRL_B 0x38
+#define SECOND_CODEC_ID_MASK 0x0003
+#define SPDIF_FUNC_ENABLE 0x0010
+#define SECOND_AC_ENABLE 0x0020
+#define SB_MODULE_INTF_ENABLE 0x0040
+#define SSPE_ENABLE 0x0040
+#define M3I_DOCK_ENABLE 0x0080
+
+#define SDO_OUT_DEST_CTRL 0x3A
+#define COMMAND_ADDR_OUT 0x0003
+#define PCM_LR_OUT_LOCAL 0x0000
+#define PCM_LR_OUT_REMOTE 0x0004
+#define PCM_LR_OUT_MUTE 0x0008
+#define PCM_LR_OUT_BOTH 0x000C
+#define LINE1_DAC_OUT_LOCAL 0x0000
+#define LINE1_DAC_OUT_REMOTE 0x0010
+#define LINE1_DAC_OUT_MUTE 0x0020
+#define LINE1_DAC_OUT_BOTH 0x0030
+#define PCM_CLS_OUT_LOCAL 0x0000
+#define PCM_CLS_OUT_REMOTE 0x0040
+#define PCM_CLS_OUT_MUTE 0x0080
+#define PCM_CLS_OUT_BOTH 0x00C0
+#define PCM_RLF_OUT_LOCAL 0x0000
+#define PCM_RLF_OUT_REMOTE 0x0100
+#define PCM_RLF_OUT_MUTE 0x0200
+#define PCM_RLF_OUT_BOTH 0x0300
+#define LINE2_DAC_OUT_LOCAL 0x0000
+#define LINE2_DAC_OUT_REMOTE 0x0400
+#define LINE2_DAC_OUT_MUTE 0x0800
+#define LINE2_DAC_OUT_BOTH 0x0C00
+#define HANDSET_OUT_LOCAL 0x0000
+#define HANDSET_OUT_REMOTE 0x1000
+#define HANDSET_OUT_MUTE 0x2000
+#define HANDSET_OUT_BOTH 0x3000
+#define IO_CTRL_OUT_LOCAL 0x0000
+#define IO_CTRL_OUT_REMOTE 0x4000
+#define IO_CTRL_OUT_MUTE 0x8000
+#define IO_CTRL_OUT_BOTH 0xC000
+
+#define SDO_IN_DEST_CTRL 0x3C
+#define STATUS_ADDR_IN 0x0003
+#define PCM_LR_IN_LOCAL 0x0000
+#define PCM_LR_IN_REMOTE 0x0004
+#define PCM_LR_RESERVED 0x0008
+#define PCM_LR_IN_BOTH 0x000C
+#define LINE1_ADC_IN_LOCAL 0x0000
+#define LINE1_ADC_IN_REMOTE 0x0010
+#define LINE1_ADC_IN_MUTE 0x0020
+#define MIC_ADC_IN_LOCAL 0x0000
+#define MIC_ADC_IN_REMOTE 0x0040
+#define MIC_ADC_IN_MUTE 0x0080
+#define LINE2_DAC_IN_LOCAL 0x0000
+#define LINE2_DAC_IN_REMOTE 0x0400
+#define LINE2_DAC_IN_MUTE 0x0800
+#define HANDSET_IN_LOCAL 0x0000
+#define HANDSET_IN_REMOTE 0x1000
+#define HANDSET_IN_MUTE 0x2000
+#define IO_STATUS_IN_LOCAL 0x0000
+#define IO_STATUS_IN_REMOTE 0x4000
+
+#define SPDIF_IN_CTRL 0x3E
+#define SPDIF_IN_ENABLE 0x0001
+
+#define GPIO_DATA 0x60
+#define GPIO_DATA_MASK 0x0FFF
+#define GPIO_HV_STATUS 0x3000
+#define GPIO_PME_STATUS 0x4000
+
+#define GPIO_MASK 0x64
+#define GPIO_DIRECTION 0x68
+#define GPO_PRIMARY_AC97 0x0001
+#define GPI_LINEOUT_SENSE 0x0004
+#define GPO_SECONDARY_AC97 0x0008
+#define GPI_VOL_DOWN 0x0010
+#define GPI_VOL_UP 0x0020
+#define GPI_IIS_CLK 0x0040
+#define GPI_IIS_LRCLK 0x0080
+#define GPI_IIS_DATA 0x0100
+#define GPI_DOCKING_STATUS 0x0100
+#define GPI_HEADPHONE_SENSE 0x0200
+#define GPO_EXT_AMP_SHUTDOWN 0x1000
+
+/* M3 */
+#define GPO_M3_EXT_AMP_SHUTDN 0x0002
+
+#define ASSP_INDEX_PORT 0x80
+#define ASSP_MEMORY_PORT 0x82
+#define ASSP_DATA_PORT 0x84
+
+#define MPU401_DATA_PORT 0x98
+#define MPU401_STATUS_PORT 0x99
+
+#define CLK_MULT_DATA_PORT 0x9C
+
+#define ASSP_CONTROL_A 0xA2
+#define ASSP_0_WS_ENABLE 0x01
+#define ASSP_CTRL_A_RESERVED1 0x02
+#define ASSP_CTRL_A_RESERVED2 0x04
+#define ASSP_CLK_49MHZ_SELECT 0x08
+#define FAST_PLU_ENABLE 0x10
+#define ASSP_CTRL_A_RESERVED3 0x20
+#define DSP_CLK_36MHZ_SELECT 0x40
+
+#define ASSP_CONTROL_B 0xA4
+#define RESET_ASSP 0x00
+#define RUN_ASSP 0x01
+#define ENABLE_ASSP_CLOCK 0x00
+#define STOP_ASSP_CLOCK 0x10
+#define RESET_TOGGLE 0x40
+
+#define ASSP_CONTROL_C 0xA6
+#define ASSP_HOST_INT_ENABLE 0x01
+#define FM_ADDR_REMAP_DISABLE 0x02
+#define HOST_WRITE_PORT_ENABLE 0x08
+
+#define ASSP_HOST_INT_STATUS 0xAC
+#define DSP2HOST_REQ_PIORECORD 0x01
+#define DSP2HOST_REQ_I2SRATE 0x02
+#define DSP2HOST_REQ_TIMER 0x04
+
+#endif
+#define A1_1988 1
+#define A1_1989 2
+#define M3_1998 3
+#define M3_1999 4
+#define M3_199A 5
+#define M3_199B 6
+
+#define LOCAL_CODEC 0
+#define REMOTE_CODEC 1
+#define CHANGE_CODEC 0
+#define RESTORE_CODEC 1
diff --git a/attic/drv/oss_allegro/hckernel.h b/attic/drv/oss_allegro/hckernel.h
new file mode 100644
index 0000000..fe7a2e7
--- /dev/null
+++ b/attic/drv/oss_allegro/hckernel.h
@@ -0,0 +1,183 @@
+/*
+ * ESS Technology allegro audio driver.
+ *
+ * Copyright (C) 1992-2000 Don Kim (don.kim@esstech.com)
+ */
+#ifndef _HCKERNEL_H_
+#define _HCKERNEL_H_
+
+
+
+
+#define IIS_APU56 0x38
+#define IIS_APU57 0x39
+
+#define DSP_4_CHANNEL 0x08000000 /*AY specify DSP 4 channel */
+#define DSP_6_CHANNEL 0x04000000 /*AY specify DSP 6 channel */
+
+#define DSP_MEMORY_INDEX 0x80
+#define DSP_MEMORY_TYPE 0x82
+#define DSP_DATA_MEMORY 0x0003
+#define DSP_CODE_MEMORY 0x0002
+#define DSP_MEMORY_VALUE 0x84
+
+#define NOT_READY 0
+#define RUNNING 1
+#define PAUSE 2
+#define STOP 3
+
+/*DSPAPU */
+#define DSPAPU_IN_BUF_SIZE 96 /* 32 * 3 BUFFERS */
+#define DSPAPU_OUT_BUF_SIZE 96 /* 32 * 3 BUFFERS */
+
+/****************** SRC3 Begin ********************** */
+/* max # of playback/record clients */
+
+#define MAXSRCPLAYCLIENT 1 /* ASSUME NO MULTIPLE STREAMS */
+#define MAXSRCRECCLIENT 1
+#define MAXSVCLIENT 1 /* assume 1 for speaker virtualization */
+
+
+/* value for bDirection */
+#define SRCPLAYBACK TRUE
+#define SRCRECORD FALSE
+
+/*/dwMode */
+#define SRC_PCM_16BIT 0x01
+#define SRC_PCM_8BIT 0x02
+#define SRC_PCM_STEREO 0x04
+#define SRC_PCM_MONO 0x08
+
+
+/* khs 0302 */
+#define SRC3_PLAYBACK 0
+#define SRC3_RECORD 1
+
+#define SRC3_STEREO 0
+#define SRC3_MONO 1
+
+#define SRC3_16BIT 0
+#define SRC3_8BIT 1
+
+#define SRC3_SR_44100 0
+#define SRC3_SR_32000 1
+#define SRC3_SR_22050 2
+#define SRC3_SR_11025 3
+#define SRC3_SR_8000 4
+
+#define DSP_PROGRAM_SIZE 0x15c /* maximum program size */
+#define SRC_PB_FILTER_SIZE 666 /* maximum playback filter size */
+
+#define SRC3_DIRECTION_OFFSET CDATA_HEADER_LEN
+#define SRC3_MODE_OFFSET CDATA_HEADER_LEN + 1
+#define SRC3_WORD_LENGTH_OFFSET CDATA_HEADER_LEN + 2
+#define SRC3_PARAMETER_OFFSET CDATA_HEADER_LEN + 3
+#define SRC3_COEFF_ADDR_OFFSET CDATA_HEADER_LEN + 8
+#define SRC3_FILTAP_ADDR_OFFSET CDATA_HEADER_LEN + 10
+#define SRC3_TEMP_INBUF_ADDR_OFFSET CDATA_HEADER_LEN + 16
+#define SRC3_TEMP_OUTBUF_ADDR_OFFSET CDATA_HEADER_LEN + 17
+#define FOR_FUTURE_USE 10 /* for storing temporary variable in future */
+
+/****************** SRC3 End ********************** */
+
+
+/****************** Speaker Virtualization Begin ********************** */
+
+ /* specify the sample rate flag = 1 for 44.1K ; 0 for 48K */
+ /* default is 0 so it is for 48K */
+#define SPKRVIRT_SR_FLAG CDATA_HEADER_LEN + 1
+#define SPKRVIRT_44K 0X0001
+#define SPKRVIRT_48K 0X0000
+
+
+/*VMAx Speaker Virtualization */
+#define SPKRVIRT_VARIABLE_LEN 81 /* IN WORD */
+#define SPKRVIRT_IN_BUFFER_OFFSET CDATA_HEADER_LEN + SPKRVIRT_VARIABLE_LEN
+#define SPKRVIRT_IN_BUFFER_SIZE (384 * 2) /* BYTE */
+
+#define SPKRVIRT_OUT_BUFFER_OFFSET SPKRVIRT_IN_BUFFER_OFFSET + (SPKRVIRT_IN_BUFFER_SIZE / 2)
+#define SPKRVIRT_OUT_BUFFER_SIZE (192 * 2) /* BYTE */
+
+#define SPKRVIRT_OWN_DATA_SIZE SPKRVIRT_OUT_BUFFER_OFFSET + (SPKRVIRT_OUT_BUFFER_SIZE / 2)
+
+/*CRL Sensaura */
+
+#define CRL_SPKRVIRT_VARIABLE_LEN 237 /* IN WORD */
+
+#define CRL_SPKRVIRT_IN_BUFFER_OFFSET CDATA_HEADER_LEN + CRL_SPKRVIRT_VARIABLE_LEN
+/*#define CRL_SPKRVIRT_IN_BUFFER_SIZE (384 * 2) // BYTE */
+#define CRL_SPKRVIRT_IN_BUFFER_SIZE (256 * 2) /* BYTE */
+
+#define CRL_SPKRVIRT_OUT_BUFFER_OFFSET CRL_SPKRVIRT_IN_BUFFER_OFFSET + (CRL_SPKRVIRT_IN_BUFFER_SIZE / 2)
+/*#define CRL_SPKRVIRT_OUT_BUFFER_SIZE (192 * 2) // BYTE */
+#define CRL_SPKRVIRT_OUT_BUFFER_SIZE (128 * 2) /* BYTE */
+
+#define CRL_SPKRVIRT_OWN_DATA_SIZE CRL_SPKRVIRT_OUT_BUFFER_OFFSET + (CRL_SPKRVIRT_OUT_BUFFER_SIZE / 2)
+
+/****************** Speaker Virtualization End ********************** */
+
+/* WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! */
+/* */
+/* Do NOT change DSP_STARTTRANSFER_INFO structure without updating hckernel.inc */
+/* */
+/* WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! */
+
+
+typedef struct sTRANSFER_INFO
+{
+ PCLIENT_INST pClient_Inst;
+ DWORD dwAutoRepeat;
+ DWORD dwHostSrcBufferAddr;
+ DWORD dwHostSrcBufferLen;
+ DWORD dwHostDstBufferAddr;
+ DWORD dwHostDstBufferLen;
+ DWORD dwDSPInBufferAddr;
+ DWORD dwDSPInBufferLen;
+ DWORD dwDSPOutBufferAddr;
+ DWORD dwDSPOutBufferLen;
+ DWORD dwDSPInConnection;
+ DWORD dwDSPOutConnection;
+
+}
+TRANSFER_INFO, *PTRANSFER_INFO;
+
+
+/*similar to kOpenInstance */
+extern WORD __cdecl DSPxxxOpen (DWORD, DWORD, DWORD, PCLIENT_INST *);
+/*similar to kCloseInstance */
+extern WORD __cdecl DSPxxxClose (PCLIENT_INST, DWORD);
+/*similar to kStartTransfer */
+extern WORD __cdecl DSPStartXfer (PTRANSFER_INFO);
+/*similar to kStopTransfer */
+extern WORD __cdecl DSPStopXfer (PCLIENT_INST);
+/*similar to kQueryPosition */
+extern WORD __cdecl DSPQueryPosition (PCLIENT_INST, DWORD, PDWORD);
+/*similar to kSetInstanceReady */
+extern WORD __cdecl DSPSetInstanceReady (PCLIENT_INST);
+/*similar to kSetInstanceNotReady */
+extern WORD __cdecl DSPSetInstanceNotReady (PCLIENT_INST);
+/*similar to kPIOInterruptHandler */
+extern WORD __cdecl DSPPIOInterruptHandler (PCLIENT_INST);
+extern WORD __cdecl DSPSetTimer (DWORD);
+/*similar to kAlterTransfer */
+extern WORD __cdecl DSPAlterTransfer (PCLIENT_INST, DWORD, DWORD, DWORD);
+
+extern WORD __cdecl DSPUnmaskInt (void);
+extern WORD __cdecl DSPMaskInt (void);
+
+extern WORD __cdecl DSPReadWord (DWORD, DWORD, DWORD);
+extern VOID __cdecl DSPWriteWord (DWORD, DWORD, DWORD, WORD);
+/*similar to kI2SInterruptHandler */
+extern WORD __cdecl DSPI2SInterruptHandler (PDWORD);
+
+extern WORD __cdecl DSPOpenPassThru (PPASSTHRU *, DWORD, DWORD);
+extern WORD __cdecl DSPClosePassThru (PPASSTHRU);
+
+extern WORD gwDisable_DSP;
+extern DWORD gwDisable_VMAx;
+#define VMAX_MAGIC 0x564D4158
+#define CRL_MAGIC 0x43524C
+
+extern WORD gwDSPConnectIn; /* tell DSP where to grab data from */
+extern WORD gwDSPConnectOut; /* tell DSP where to send data to */
+#endif
diff --git a/attic/drv/oss_allegro/id.h b/attic/drv/oss_allegro/id.h
new file mode 100644
index 0000000..c61985f
--- /dev/null
+++ b/attic/drv/oss_allegro/id.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * *
+ * (C) 1998-1998 ESS Technology, Inc. *
+ * *
+ * This source code, its compiled object code, and its associated data sets *
+ * are copyright (C) 1998-1998 ESS Technology, Inc. This source code and its *
+ * associated data sets are trade secrets of ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
+
+/*---------------------------------------------------------------------------
+ * Copyright (C) 1998-1998, ESS Technology, Inc.
+ *---------------------------------------------------------------------------
+ * FILENAME: id.h
+ *---------------------------------------------------------------------------
+ * DESCRIPTION: Header file containing Allegro device and revision IDs
+ *---------------------------------------------------------------------------
+ * AUTHOR: Henry Tang
+ *---------------------------------------------------------------------------
+ * HISTORY:
+ * 04/22/98 HT Created.
+ *---------------------------------------------------------------------------
+ */
+
+//
+// Device IDs
+//
+
+#define DEVICE_ID_1968 0x1968
+#define DEVICE_ID_1978 0x1978
+
+//
+// Revision IDs
+//
+
+#define REVISION_ID_1968 0x00
+#define REVISION_ID_1978_REV_A 0x00
+#define REVISION_ID_1978_REV_B 0x10
+
+//---------------------------------------------------------------------------
+// End of File: id.h
+//---------------------------------------------------------------------------
+
+/******************************************************************************
+ * *
+ * (C) 1998-1998 ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
diff --git a/attic/drv/oss_allegro/kernel.dat b/attic/drv/oss_allegro/kernel.dat
new file mode 100644
index 0000000..f19dd82
--- /dev/null
+++ b/attic/drv/oss_allegro/kernel.dat
@@ -0,0 +1,80 @@
+0x7980, 0x0030, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x00FB, 0x7980, 0x00DD, 0x7980, 0x03B4,
+0x7980, 0x0332, 0x7980, 0x0287, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4,
+0x7980, 0x031A, 0x7980, 0x03B4, 0x7980, 0x022F, 0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x03B4,
+0x7980, 0x03B4, 0x7980, 0x03B4, 0x7980, 0x0063, 0x7980, 0x006B, 0x7980, 0x03B4, 0x7980, 0x03B4,
+0xBF80, 0x2C7C, 0x8806, 0x8804, 0xBE40, 0xBC20, 0xAE09, 0x1000, 0xAE0A, 0x0001, 0x6938, 0xEB08,
+0x0053, 0x695A, 0xEB08, 0x00D6, 0x0009, 0x8B88, 0x6980, 0xE388, 0x0036, 0xBE30, 0xBC20, 0x6909,
+0xB801, 0x9009, 0xBE41, 0xBE41, 0x6928, 0xEB88, 0x0078, 0xBE41, 0xBE40, 0x7980, 0x0038, 0xBE41,
+0xBE41, 0x903A, 0x6938, 0xE308, 0x0056, 0x903A, 0xBE41, 0xBE40, 0xEF00, 0x903A, 0x6939, 0xE308,
+0x005E, 0x903A, 0xEF00, 0x690B, 0x660C, 0xEF8C, 0x690A, 0x660C, 0x620B, 0x6609, 0xEF00, 0x6910,
+0x660F, 0xEF04, 0xE388, 0x0075, 0x690E, 0x660F, 0x6210, 0x660D, 0xEF00, 0x690E, 0x660D, 0xEF00,
+0xAE70, 0x0001, 0xBC20, 0xAE27, 0x0001, 0x6939, 0xEB08, 0x005D, 0x6926, 0xB801, 0x9026, 0x0026,
+0x8B88, 0x6980, 0xE388, 0x00CB, 0x9028, 0x0D28, 0x4211, 0xE100, 0x007A, 0x4711, 0xE100, 0x00A0,
+0x7A80, 0x0063, 0xB811, 0x660A, 0x6209, 0xE304, 0x007A, 0x0C0B, 0x4005, 0x100A, 0xBA01, 0x9012,
+0x0C12, 0x4002, 0x7980, 0x00AF, 0x7A80, 0x006B, 0xBE02, 0x620E, 0x660D, 0xBA10, 0xE344, 0x007A,
+0x0C10, 0x4005, 0x100E, 0xBA01, 0x9012, 0x0C12, 0x4002, 0x1003, 0xBA02, 0x9012, 0x0C12, 0x4000,
+0x1003, 0xE388, 0x00BA, 0x1004, 0x7980, 0x00BC, 0x1004, 0xBA01, 0x9012, 0x0C12, 0x4001, 0x0C05,
+0x4003, 0x0C06, 0x4004, 0x1011, 0xBFB0, 0x01FF, 0x9012, 0x0C12, 0x4006, 0xBC20, 0xEF00, 0xAE26,
+0x1028, 0x6970, 0xBFD0, 0x0001, 0x9070, 0xE388, 0x007A, 0xAE28, 0x0000, 0xEF00, 0xAE70, 0x0300,
+0x0C70, 0xB00C, 0xAE5A, 0x0000, 0xEF00, 0x7A80, 0x038A, 0x697F, 0xB801, 0x907F, 0x0056, 0x8B88,
+0x0CA0, 0xB008, 0xAF71, 0xB000, 0x4E71, 0xE200, 0x00F3, 0xAE56, 0x1057, 0x0056, 0x0CA0, 0xB008,
+0x8056, 0x7980, 0x03A1, 0x0810, 0xBFA0, 0x1059, 0xE304, 0x03A1, 0x8056, 0x7980, 0x03A1, 0x7A80,
+0x038A, 0xBF01, 0xBE43, 0xBE59, 0x907C, 0x6937, 0xE388, 0x010D, 0xBA01, 0xE308, 0x010C, 0xAE71,
+0x0004, 0x0C71, 0x5000, 0x6936, 0x9037, 0xBF0A, 0x109E, 0x8B8A, 0xAF80, 0x8014, 0x4C80, 0xBF0A,
+0x0560, 0xF500, 0xBF0A, 0x0520, 0xB900, 0xBB17, 0x90A0, 0x6917, 0xE388, 0x0148, 0x0D17, 0xE100,
+0x0127, 0xBF0C, 0x0578, 0xBF0D, 0x057C, 0x7980, 0x012B, 0xBF0C, 0x0538, 0xBF0D, 0x053C, 0x6900,
+0xE308, 0x0135, 0x8B8C, 0xBE59, 0xBB07, 0x90A0, 0xBC20, 0x7980, 0x0157, 0x030C, 0x8B8B, 0xB903,
+0x8809, 0xBEC6, 0x013E, 0x69AC, 0x90AB, 0x69AD, 0x90AB, 0x0813, 0x660A, 0xE344, 0x0144, 0x0309,
+0x830C, 0xBC20, 0x7980, 0x0157, 0x6955, 0xE388, 0x0157, 0x7C38, 0xBF0B, 0x0578, 0xF500, 0xBF0B,
+0x0538, 0xB907, 0x8809, 0xBEC6, 0x0156, 0x10AB, 0x90AA, 0x6974, 0xE388, 0x0163, 0xAE72, 0x0540,
+0xF500, 0xAE72, 0x0500, 0xAE61, 0x103B, 0x7A80, 0x02F6, 0x6978, 0xE388, 0x0182, 0x8B8C, 0xBF0C,
+0x0560, 0xE500, 0x7C40, 0x0814, 0xBA20, 0x8812, 0x733D, 0x7A80, 0x0380, 0x733E, 0x7A80, 0x0380,
+0x8B8C, 0xBF0C, 0x056C, 0xE500, 0x7C40, 0x0814, 0xBA2C, 0x8812, 0x733F, 0x7A80, 0x0380, 0x7340,
+0x7A80, 0x0380, 0x6975, 0xE388, 0x018E, 0xAE72, 0x0548, 0xF500, 0xAE72, 0x0508, 0xAE61, 0x1041,
+0x7A80, 0x02F6, 0x6979, 0xE388, 0x01AD, 0x8B8C, 0xBF0C, 0x0560, 0xE500, 0x7C40, 0x0814, 0xBA18,
+0x8812, 0x7343, 0x7A80, 0x0380, 0x7344, 0x7A80, 0x0380, 0x8B8C, 0xBF0C, 0x056C, 0xE500, 0x7C40,
+0x0814, 0xBA24, 0x8812, 0x7345, 0x7A80, 0x0380, 0x7346, 0x7A80, 0x0380, 0x6976, 0xE388, 0x01B9,
+0xAE72, 0x0558, 0xF500, 0xAE72, 0x0518, 0xAE61, 0x1047, 0x7A80, 0x02F6, 0x697A, 0xE388, 0x01D8,
+0x8B8C, 0xBF0C, 0x0560, 0xE500, 0x7C40, 0x0814, 0xBA08, 0x8812, 0x7349, 0x7A80, 0x0380, 0x734A,
+0x7A80, 0x0380, 0x8B8C, 0xBF0C, 0x056C, 0xE500, 0x7C40, 0x0814, 0xBA14, 0x8812, 0x734B, 0x7A80,
+0x0380, 0x734C, 0x7A80, 0x0380, 0xBC21, 0xAE1C, 0x1090, 0x8B8A, 0xBF0A, 0x0560, 0xE500, 0x7C40,
+0x0812, 0xB804, 0x8813, 0x8B8D, 0xBF0D, 0x056C, 0xE500, 0x7C40, 0x0815, 0xB804, 0x8811, 0x7A80,
+0x034A, 0x8B8A, 0xBF0A, 0x0560, 0xE500, 0x7C40, 0x731F, 0xB903, 0x8809, 0xBEC6, 0x01F9, 0x548A,
+0xBE03, 0x98A0, 0x7320, 0xB903, 0x8809, 0xBEC6, 0x0201, 0x548A, 0xBE03, 0x98A0, 0x1F20, 0x2F1F,
+0x9826, 0xBC20, 0x6935, 0xE388, 0x03A1, 0x6933, 0xB801, 0x9033, 0xBFA0, 0x02EE, 0xE308, 0x03A1,
+0x9033, 0xBF00, 0x6951, 0xE388, 0x021F, 0x7334, 0xBE80, 0x5760, 0xBE03, 0x9F7E, 0xBE59, 0x9034,
+0x697E, 0x0D51, 0x9013, 0xBC20, 0x695C, 0xE388, 0x03A1, 0x735E, 0xBE80, 0x5760, 0xBE03, 0x9F7E,
+0xBE59, 0x905E, 0x697E, 0x0D5C, 0x9013, 0x7980, 0x03A1, 0x7A80, 0x038A, 0xBF01, 0xBE43, 0x6977,
+0xE388, 0x024E, 0xAE61, 0x104D, 0x0061, 0x8B88, 0x6980, 0xE388, 0x024E, 0x9071, 0x0D71, 0x000B,
+0xAFA0, 0x8010, 0xAFA0, 0x8010, 0x0810, 0x660A, 0xE308, 0x0249, 0x0009, 0x0810, 0x660C, 0xE388,
+0x024E, 0x800B, 0xBC20, 0x697B, 0xE388, 0x03A1, 0xBF0A, 0x109E, 0x8B8A, 0xAF80, 0x8014, 0x4C80,
+0xE100, 0x0266, 0x697C, 0xBF90, 0x0560, 0x9072, 0x0372, 0x697C, 0xBF90, 0x0564, 0x9073, 0x0473,
+0x7980, 0x0270, 0x697C, 0xBF90, 0x0520, 0x9072, 0x0372, 0x697C, 0xBF90, 0x0524, 0x9073, 0x0473,
+0x697C, 0xB801, 0x907C, 0xBF0A, 0x10FD, 0x8B8A, 0xAF80, 0x8010, 0x734F, 0x548A, 0xBE03, 0x9880,
+0xBC21, 0x7326, 0x548B, 0xBE03, 0x618B, 0x988C, 0xBE03, 0x6180, 0x9880, 0x7980, 0x03A1, 0x7A80,
+0x038A, 0x0D28, 0x4711, 0xE100, 0x02BE, 0xAF12, 0x4006, 0x6912, 0xBFB0, 0x0C00, 0xE388, 0x02B6,
+0xBFA0, 0x0800, 0xE388, 0x02B2, 0x6912, 0xBFB0, 0x0C00, 0xBFA0, 0x0400, 0xE388, 0x02A3, 0x6909,
+0x900B, 0x7980, 0x02A5, 0xAF0B, 0x4005, 0x6901, 0x9005, 0x6902, 0x9006, 0x4311, 0xE100, 0x02ED,
+0x6911, 0xBFC0, 0x2000, 0x9011, 0x7980, 0x02ED, 0x6909, 0x900B, 0x7980, 0x02B8, 0xAF0B, 0x4005,
+0xAF05, 0x4003, 0xAF06, 0x4004, 0x7980, 0x02ED, 0xAF12, 0x4006, 0x6912, 0xBFB0, 0x0C00, 0xE388,
+0x02E7, 0xBFA0, 0x0800, 0xE388, 0x02E3, 0x6912, 0xBFB0, 0x0C00, 0xBFA0, 0x0400, 0xE388, 0x02D4,
+0x690D, 0x9010, 0x7980, 0x02D6, 0xAF10, 0x4005, 0x6901, 0x9005, 0x6902, 0x9006, 0x4311, 0xE100,
+0x02ED, 0x6911, 0xBFC0, 0x2000, 0x9011, 0x7980, 0x02ED, 0x690D, 0x9010, 0x7980, 0x02E9, 0xAF10,
+0x4005, 0xAF05, 0x4003, 0xAF06, 0x4004, 0xBC20, 0x6970, 0x9071, 0x7A80, 0x0078, 0x6971, 0x9070,
+0x7980, 0x03A1, 0xBC20, 0x0361, 0x8B8B, 0x6980, 0xEF88, 0x0272, 0x0372, 0x7804, 0x9071, 0x0D71,
+0x8B8A, 0x000B, 0xB903, 0x8809, 0xBEC6, 0x0309, 0x69A8, 0x90AB, 0x69A8, 0x90AA, 0x0810, 0x660A,
+0xE344, 0x030F, 0x0009, 0x0810, 0x660C, 0xE388, 0x0314, 0x800B, 0xBC20, 0x6961, 0xB801, 0x9061,
+0x7980, 0x02F7, 0x7A80, 0x038A, 0x5D35, 0x0001, 0x6934, 0xB801, 0x9034, 0xBF0A, 0x109E, 0x8B8A,
+0xAF80, 0x8014, 0x4880, 0xAE72, 0x0550, 0xF500, 0xAE72, 0x0510, 0xAE61, 0x1051, 0x7A80, 0x02F6,
+0x7980, 0x03A1, 0x7A80, 0x038A, 0x5D35, 0x0002, 0x695E, 0xB801, 0x905E, 0xBF0A, 0x109E, 0x8B8A,
+0xAF80, 0x8014, 0x4780, 0xAE72, 0x0558, 0xF500, 0xAE72, 0x0518, 0xAE61, 0x105C, 0x7A80, 0x02F6,
+0x7980, 0x03A1, 0x001C, 0x8B88, 0x6980, 0xEF88, 0x901D, 0x0D1D, 0x100F, 0x6610, 0xE38C, 0x0358,
+0x690E, 0x6610, 0x620F, 0x660D, 0xBA0F, 0xE301, 0x037A, 0x0410, 0x8B8A, 0xB903, 0x8809, 0xBEC6,
+0x036C, 0x6A8C, 0x61AA, 0x98AB, 0x6A8C, 0x61AB, 0x98AD, 0x6A8C, 0x61AD, 0x98A9, 0x6A8C, 0x61A9,
+0x98AA, 0x7C04, 0x8B8B, 0x7C04, 0x8B8D, 0x7C04, 0x8B89, 0x7C04, 0x0814, 0x660E, 0xE308, 0x0379,
+0x040D, 0x8410, 0xBC21, 0x691C, 0xB801, 0x901C, 0x7980, 0x034A, 0xB903, 0x8809, 0x8B8A, 0xBEC6,
+0x0388, 0x54AC, 0xBE03, 0x618C, 0x98AA, 0xEF00, 0xBC20, 0xBE46, 0x0809, 0x906B, 0x080A, 0x906C,
+0x080B, 0x906D, 0x081A, 0x9062, 0x081B, 0x9063, 0x081E, 0x9064, 0xBE59, 0x881E, 0x8065, 0x8166,
+0x8267, 0x8368, 0x8469, 0x856A, 0xEF00, 0xBC20, 0x696B, 0x8809, 0x696C, 0x880A, 0x696D, 0x880B,
+0x6962, 0x881A, 0x6963, 0x881B, 0x6964, 0x881E, 0x0065, 0x0166, 0x0267, 0x0368, 0x0469, 0x056A,
+0xBE3A,
diff --git a/attic/drv/oss_allegro/kernel.h b/attic/drv/oss_allegro/kernel.h
new file mode 100644
index 0000000..6a6db12
--- /dev/null
+++ b/attic/drv/oss_allegro/kernel.h
@@ -0,0 +1,1042 @@
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ * This source code, its compiled object code, and its associated data sets *
+ * are copyright (C) 1997-1999 ESS Technology, Inc. This source code and its *
+ * associated data sets are trade secrets of ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
+
+/*---------------------------------------------------------------------------
+ * Copyright (C) 1997-1999, ESS Technology, Inc.
+ *---------------------------------------------------------------------------
+ * FILENAME: kernel.h V2.10 08/19/99
+ *---------------------------------------------------------------------------
+ * DESCRIPTION: Header file for Maestro 3/Allegro host kernel
+ *---------------------------------------------------------------------------
+ * AUTHOR: Henry Tang / Hong Kim /Alger Yeung/Don Kim
+ *---------------------------------------------------------------------------
+ * HISTORY:
+ * 09/03/97 HT Created.
+ * 05/21/99 AY SwitchClient flags
+ * 07/29/99 AY Adding 4-speaker support
+ * 08/18/99 AY Adding SPDIF IN support
+ * 08/18/99 AY Adding SPDIF IN support
+ * 08/18/99 AY Remove PIO and SoundBlaster support
+ * 08/18/99 AY Reduce Cpythru to 2 instances instead of 4
+ * 09/22/99 HK M3I feature
+ *---------------------------------------------------------------------------
+ */
+
+
+#ifndef __KERNEL_H
+#define __KERNEL_H
+
+/* */
+/* client IDs */
+/* */
+/* FM client is a special case */
+/* */
+
+#define CLIENT_CPYTHRU 0
+#define CLIENT_MODEM 1
+#define CLIENT_POS3D 2
+#define CLIENT_SPKVIRT 3
+#define CLIENT_SPKVIRT_CRL 4
+#define CLIENT_SRC 5
+#define CLIENT_MINISRC 6
+#define CLIENT_SPDIF 7
+#define NUMBER_OF_CLIENTS (CLIENT_SPDIF + 1)
+
+#define CLIENT_FM NUMBER_OF_CLIENTS
+
+#define MASK_CLIENT_CPYTHRU (1 << CLIENT_CPYTHRU )
+#define MASK_CLIENT_MODEM (1 << CLIENT_MODEM )
+#define MASK_CLIENT_POS3D (1 << CLIENT_POS3D )
+#define MASK_CLIENT_SPKVIRT (1 << CLIENT_SPKVIRT )
+#define MASK_CLIENT_SPKVIRT_CRL (1 << CLIENT_SPKVIRT_CRL)
+#define MASK_CLIENT_SRC (1 << CLIENT_SRC )
+#define MASK_CLIENT_MINISRC (1 << CLIENT_MINISRC )
+#define MASK_CLIENT_SPDIF (1 << CLIENT_SPDIF )
+
+/* WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! */
+/* */
+/* If you modify any memory map and/or definitions below be sure to reflect */
+/* the changes in the DSP version found in KERNEL.INC. */
+/* */
+/* WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! */
+
+
+/* */
+/* DSP memory map */
+/* */
+
+#define REV_A_CODE_MEMORY_BEGIN 0x0000
+#define REV_A_CODE_MEMORY_END 0x0FFF
+#define REV_A_CODE_MEMORY_UNIT_LENGTH 0x0040
+#define REV_A_CODE_MEMORY_LENGTH (REV_A_CODE_MEMORY_END - REV_A_CODE_MEMORY_BEGIN + 1)
+
+#define REV_B_CODE_MEMORY_BEGIN 0x0000
+#define REV_B_CODE_MEMORY_END 0x0BFF
+#define REV_B_CODE_MEMORY_UNIT_LENGTH 0x0040
+#define REV_B_CODE_MEMORY_LENGTH (REV_B_CODE_MEMORY_END - REV_B_CODE_MEMORY_BEGIN + 1)
+
+#if (REV_A_CODE_MEMORY_LENGTH % REV_A_CODE_MEMORY_UNIT_LENGTH)
+#error Assumption about code memory unit length failed.
+#endif
+#if (REV_B_CODE_MEMORY_LENGTH % REV_B_CODE_MEMORY_UNIT_LENGTH)
+#error Assumption about code memory unit length failed.
+#endif
+
+#define REV_A_DATA_MEMORY_BEGIN 0x1000
+#define REV_A_DATA_MEMORY_END 0x2FFF
+#define REV_A_DATA_MEMORY_UNIT_LENGTH 0x0080
+#define REV_A_DATA_MEMORY_LENGTH (REV_A_DATA_MEMORY_END - REV_A_DATA_MEMORY_BEGIN + 1)
+
+#define REV_B_DATA_MEMORY_BEGIN 0x1000
+/*#define REV_B_DATA_MEMORY_END 0x23FF */
+#define REV_B_DATA_MEMORY_END 0x2BFF
+#define REV_B_DATA_MEMORY_UNIT_LENGTH 0x0080
+#define REV_B_DATA_MEMORY_LENGTH (REV_B_DATA_MEMORY_END - REV_B_DATA_MEMORY_BEGIN + 1)
+
+#if (REV_A_DATA_MEMORY_LENGTH % REV_A_DATA_MEMORY_UNIT_LENGTH)
+#error Assumption about data memory unit length failed.
+#endif
+#if (REV_B_DATA_MEMORY_LENGTH % REV_B_DATA_MEMORY_UNIT_LENGTH)
+#error Assumption about data memory unit length failed.
+#endif
+
+#define CODE_MEMORY_MAP_LENGTH (64 + 1)
+#define DATA_MEMORY_MAP_LENGTH (64 + 1)
+
+#if (CODE_MEMORY_MAP_LENGTH < ((REV_A_CODE_MEMORY_LENGTH / REV_A_CODE_MEMORY_UNIT_LENGTH) + 1))
+#error Code memory map length too short.
+#endif
+#if (DATA_MEMORY_MAP_LENGTH < ((REV_A_DATA_MEMORY_LENGTH / REV_A_DATA_MEMORY_UNIT_LENGTH) + 1))
+#error Data memory map length too short.
+#endif
+#if (CODE_MEMORY_MAP_LENGTH < ((REV_B_CODE_MEMORY_LENGTH / REV_B_CODE_MEMORY_UNIT_LENGTH) + 1))
+#error Code memory map length too short.
+#endif
+#if (DATA_MEMORY_MAP_LENGTH < ((REV_B_DATA_MEMORY_LENGTH / REV_B_DATA_MEMORY_UNIT_LENGTH) + 1))
+#error Data memory map length too short.
+#endif
+
+
+/* */
+/* Kernel code memory definition */
+/* */
+
+#define KCODE_VECTORS_BEGIN 0x0000
+#define KCODE_VECTORS_END 0x002F
+#define KCODE_VECTORS_UNIT_LENGTH 0x0002
+#define KCODE_VECTORS_LENGTH (KCODE_VECTORS_END - KCODE_VECTORS_BEGIN + 1)
+
+
+/* */
+/* Kernel data memory definition */
+/* */
+
+#define KDATA_BASE_ADDR 0x1000
+#define KDATA_BASE_ADDR2 0x1080
+
+#define KDATA_TASK0 (KDATA_BASE_ADDR + 0x0000)
+#define KDATA_TASK1 (KDATA_BASE_ADDR + 0x0001)
+#define KDATA_TASK2 (KDATA_BASE_ADDR + 0x0002)
+#define KDATA_TASK3 (KDATA_BASE_ADDR + 0x0003)
+#define KDATA_TASK4 (KDATA_BASE_ADDR + 0x0004)
+#define KDATA_TASK5 (KDATA_BASE_ADDR + 0x0005)
+#define KDATA_TASK6 (KDATA_BASE_ADDR + 0x0006)
+#define KDATA_TASK7 (KDATA_BASE_ADDR + 0x0007)
+#define KDATA_TASK_ENDMARK (KDATA_BASE_ADDR + 0x0008)
+
+#define KDATA_CURRENT_TASK (KDATA_BASE_ADDR + 0x0009)
+#define KDATA_TASK_SWITCH (KDATA_BASE_ADDR + 0x000A)
+
+#define KDATA_INSTANCE0_POS3D (KDATA_BASE_ADDR + 0x000B)
+#define KDATA_INSTANCE1_POS3D (KDATA_BASE_ADDR + 0x000C)
+#define KDATA_INSTANCE2_POS3D (KDATA_BASE_ADDR + 0x000D)
+#define KDATA_INSTANCE3_POS3D (KDATA_BASE_ADDR + 0x000E)
+#define KDATA_INSTANCE4_POS3D (KDATA_BASE_ADDR + 0x000F)
+#define KDATA_INSTANCE5_POS3D (KDATA_BASE_ADDR + 0x0010)
+#define KDATA_INSTANCE6_POS3D (KDATA_BASE_ADDR + 0x0011)
+#define KDATA_INSTANCE7_POS3D (KDATA_BASE_ADDR + 0x0012)
+#define KDATA_INSTANCE8_POS3D (KDATA_BASE_ADDR + 0x0013)
+#define KDATA_INSTANCE_POS3D_ENDMARK (KDATA_BASE_ADDR + 0x0014)
+
+#define KDATA_INSTANCE0_SPKVIRT (KDATA_BASE_ADDR + 0x0015)
+#define KDATA_INSTANCE_SPKVIRT_ENDMARK (KDATA_BASE_ADDR + 0x0016)
+
+#define KDATA_INSTANCE0_SPDIF (KDATA_BASE_ADDR + 0x0017)
+#define KDATA_INSTANCE_SPDIF_ENDMARK (KDATA_BASE_ADDR + 0x0018)
+
+#define KDATA_INSTANCE0_MODEM (KDATA_BASE_ADDR + 0x0019)
+#define KDATA_INSTANCE_MODEM_ENDMARK (KDATA_BASE_ADDR + 0x001A)
+
+#define KDATA_INSTANCE0_SRC (KDATA_BASE_ADDR + 0x001B)
+#define KDATA_INSTANCE1_SRC (KDATA_BASE_ADDR + 0x001C)
+#define KDATA_INSTANCE_SRC_ENDMARK (KDATA_BASE_ADDR + 0x001D)
+
+#define KDATA_INSTANCE0_MINISRC (KDATA_BASE_ADDR + 0x001E)
+#define KDATA_INSTANCE1_MINISRC (KDATA_BASE_ADDR + 0x001F)
+#define KDATA_INSTANCE2_MINISRC (KDATA_BASE_ADDR + 0x0020)
+#define KDATA_INSTANCE3_MINISRC (KDATA_BASE_ADDR + 0x0021)
+#define KDATA_INSTANCE_MINISRC_ENDMARK (KDATA_BASE_ADDR + 0x0022)
+
+#define KDATA_INSTANCE0_CPYTHRU (KDATA_BASE_ADDR + 0x0023)
+#define KDATA_INSTANCE1_CPYTHRU (KDATA_BASE_ADDR + 0x0024)
+#define KDATA_INSTANCE_CPYTHRU_ENDMARK (KDATA_BASE_ADDR + 0x0025)
+
+#define KDATA_CURRENT_DMA (KDATA_BASE_ADDR + 0x0026)
+#define KDATA_DMA_SWITCH (KDATA_BASE_ADDR + 0x0027)
+#define KDATA_DMA_ACTIVE (KDATA_BASE_ADDR + 0x0028)
+
+#define KDATA_DMA_XFER0 (KDATA_BASE_ADDR + 0x0029)
+#define KDATA_DMA_XFER1 (KDATA_BASE_ADDR + 0x002A)
+#define KDATA_DMA_XFER2 (KDATA_BASE_ADDR + 0x002B)
+#define KDATA_DMA_XFER3 (KDATA_BASE_ADDR + 0x002C)
+#define KDATA_DMA_XFER4 (KDATA_BASE_ADDR + 0x002D)
+#define KDATA_DMA_XFER5 (KDATA_BASE_ADDR + 0x002E)
+#define KDATA_DMA_XFER6 (KDATA_BASE_ADDR + 0x002F)
+#define KDATA_DMA_XFER7 (KDATA_BASE_ADDR + 0x0030)
+#define KDATA_DMA_XFER8 (KDATA_BASE_ADDR + 0x0031)
+#define KDATA_DMA_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0032)
+
+#define KDATA_I2S_SAMPLE_COUNT (KDATA_BASE_ADDR + 0x0033)
+#define KDATA_I2S_INT_METER (KDATA_BASE_ADDR + 0x0034)
+#define KDATA_I2S_ACTIVE (KDATA_BASE_ADDR + 0x0035)
+
+#define KDATA_TIMER_COUNT_RELOAD (KDATA_BASE_ADDR + 0x0036)
+#define KDATA_TIMER_COUNT_CURRENT (KDATA_BASE_ADDR + 0x0037)
+
+#define KDATA_HALT_SYNCH_CLIENT (KDATA_BASE_ADDR + 0x0038)
+#define KDATA_HALT_SYNCH_DMA (KDATA_BASE_ADDR + 0x0039)
+#define KDATA_HALT_ACKNOWLEDGE (KDATA_BASE_ADDR + 0x003A)
+
+#define KDATA_ADC1_XFER0 (KDATA_BASE_ADDR + 0x003B)
+#define KDATA_ADC1_XFER_ENDMARK (KDATA_BASE_ADDR + 0x003C)
+#define KDATA_ADC1_LEFT_VOLUME (KDATA_BASE_ADDR + 0x003D)
+#define KDATA_ADC1_RIGHT_VOLUME (KDATA_BASE_ADDR + 0x003E)
+#define KDATA_ADC1_LEFT_SUR_VOL (KDATA_BASE_ADDR + 0x003F)
+#define KDATA_ADC1_RIGHT_SUR_VOL (KDATA_BASE_ADDR + 0x0040)
+
+#define KDATA_ADC2_XFER0 (KDATA_BASE_ADDR + 0x0041)
+#define KDATA_ADC2_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0042)
+#define KDATA_ADC2_LEFT_VOLUME (KDATA_BASE_ADDR + 0x0043)
+#define KDATA_ADC2_RIGHT_VOLUME (KDATA_BASE_ADDR + 0x0044)
+#define KDATA_ADC2_LEFT_SUR_VOL (KDATA_BASE_ADDR + 0x0045)
+#define KDATA_ADC2_RIGHT_SUR_VOL (KDATA_BASE_ADDR + 0x0046)
+
+#define KDATA_CD_XFER0 (KDATA_BASE_ADDR + 0x0047)
+#define KDATA_CD_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0048)
+#define KDATA_CD_LEFT_VOLUME (KDATA_BASE_ADDR + 0x0049)
+#define KDATA_CD_RIGHT_VOLUME (KDATA_BASE_ADDR + 0x004A)
+#define KDATA_CD_LEFT_SUR_VOL (KDATA_BASE_ADDR + 0x004B)
+#define KDATA_CD_RIGHT_SUR_VOL (KDATA_BASE_ADDR + 0x004C)
+
+#define KDATA_MIC_XFER0 (KDATA_BASE_ADDR + 0x004D)
+#define KDATA_MIC_XFER_ENDMARK (KDATA_BASE_ADDR + 0x004E)
+#define KDATA_MIC_VOLUME (KDATA_BASE_ADDR + 0x004F)
+#define KDATA_MIC_SUR_VOL (KDATA_BASE_ADDR + 0x0050)
+
+#define KDATA_I2S_XFER0 (KDATA_BASE_ADDR + 0x0051)
+#define KDATA_I2S_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0052)
+
+#define KDATA_CHI_XFER0 (KDATA_BASE_ADDR + 0x0053)
+#define KDATA_CHI_XFER_ENDMARK (KDATA_BASE_ADDR + 0x0054)
+
+#define KDATA_SPDIF_XFER (KDATA_BASE_ADDR + 0x0055)
+#define KDATA_SPDIF_CURRENT_FRAME (KDATA_BASE_ADDR + 0x0056)
+#define KDATA_SPDIF_FRAME0 (KDATA_BASE_ADDR + 0x0057)
+#define KDATA_SPDIF_FRAME1 (KDATA_BASE_ADDR + 0x0058)
+#define KDATA_SPDIF_FRAME2 (KDATA_BASE_ADDR + 0x0059)
+
+#define KDATA_SPDIF_REQUEST (KDATA_BASE_ADDR + 0x005A)
+#define KDATA_SPDIF_TEMP (KDATA_BASE_ADDR + 0x005B)
+
+/*AY SPDIF IN */
+#define KDATA_SPDIFIN_XFER0 (KDATA_BASE_ADDR + 0x005C)
+#define KDATA_SPDIFIN_XFER_ENDMARK (KDATA_BASE_ADDR + 0x005D)
+#define KDATA_SPDIFIN_INT_METER (KDATA_BASE_ADDR + 0x005E)
+
+#define KDATA_DSP_RESET_COUNT (KDATA_BASE_ADDR + 0x005F)
+#define KDATA_DEBUG_OUTPUT (KDATA_BASE_ADDR + 0x0060)
+
+#define KDATA_KERNEL_ISR_LIST (KDATA_BASE_ADDR + 0x0061)
+
+#define KDATA_KERNEL_ISR_CBSR1 (KDATA_BASE_ADDR + 0x0062)
+#define KDATA_KERNEL_ISR_CBER1 (KDATA_BASE_ADDR + 0x0063)
+#define KDATA_KERNEL_ISR_CBCR (KDATA_BASE_ADDR + 0x0064)
+#define KDATA_KERNEL_ISR_AR0 (KDATA_BASE_ADDR + 0x0065)
+#define KDATA_KERNEL_ISR_AR1 (KDATA_BASE_ADDR + 0x0066)
+#define KDATA_KERNEL_ISR_AR2 (KDATA_BASE_ADDR + 0x0067)
+#define KDATA_KERNEL_ISR_AR3 (KDATA_BASE_ADDR + 0x0068)
+#define KDATA_KERNEL_ISR_AR4 (KDATA_BASE_ADDR + 0x0069)
+#define KDATA_KERNEL_ISR_AR5 (KDATA_BASE_ADDR + 0x006A)
+#define KDATA_KERNEL_ISR_BRCR (KDATA_BASE_ADDR + 0x006B)
+#define KDATA_KERNEL_ISR_PASR (KDATA_BASE_ADDR + 0x006C)
+#define KDATA_KERNEL_ISR_PAER (KDATA_BASE_ADDR + 0x006D)
+
+#define KDATA_CLIENT_SCRATCH0 (KDATA_BASE_ADDR + 0x006E)
+#define KDATA_CLIENT_SCRATCH1 (KDATA_BASE_ADDR + 0x006F)
+#define KDATA_KERNEL_SCRATCH (KDATA_BASE_ADDR + 0x0070)
+#define KDATA_KERNEL_ISR_SCRATCH (KDATA_BASE_ADDR + 0x0071)
+
+#define KDATA_OUEUE_LEFT (KDATA_BASE_ADDR + 0x0072)
+#define KDATA_QUEUE_RIGHT (KDATA_BASE_ADDR + 0x0073)
+
+#define KDATA_ADC1_REQUEST (KDATA_BASE_ADDR + 0x0074)
+#define KDATA_ADC2_REQUEST (KDATA_BASE_ADDR + 0x0075)
+#define KDATA_CD_REQUEST (KDATA_BASE_ADDR + 0x0076)
+#define KDATA_MIC_REQUEST (KDATA_BASE_ADDR + 0x0077)
+
+#define KDATA_ADC1_MIXER_REQUEST (KDATA_BASE_ADDR + 0x0078)
+#define KDATA_ADC2_MIXER_REQUEST (KDATA_BASE_ADDR + 0x0079)
+#define KDATA_CD_MIXER_REQUEST (KDATA_BASE_ADDR + 0x007A)
+#define KDATA_MIC_MIXER_REQUEST (KDATA_BASE_ADDR + 0x007B)
+#define KDATA_MIC_SYNC_COUNTER (KDATA_BASE_ADDR + 0x007C)
+
+
+/* */
+/* second segment */
+/* */
+
+/* smart mixer buffer */
+
+#define KDATA_MIXER_WORD0 (KDATA_BASE_ADDR2 + 0x0000)
+#define KDATA_MIXER_WORD1 (KDATA_BASE_ADDR2 + 0x0001)
+#define KDATA_MIXER_WORD2 (KDATA_BASE_ADDR2 + 0x0002)
+#define KDATA_MIXER_WORD3 (KDATA_BASE_ADDR2 + 0x0003)
+#define KDATA_MIXER_WORD4 (KDATA_BASE_ADDR2 + 0x0004)
+#define KDATA_MIXER_WORD5 (KDATA_BASE_ADDR2 + 0x0005)
+#define KDATA_MIXER_WORD6 (KDATA_BASE_ADDR2 + 0x0006)
+#define KDATA_MIXER_WORD7 (KDATA_BASE_ADDR2 + 0x0007)
+#define KDATA_MIXER_WORD8 (KDATA_BASE_ADDR2 + 0x0008)
+#define KDATA_MIXER_WORD9 (KDATA_BASE_ADDR2 + 0x0009)
+#define KDATA_MIXER_WORDA (KDATA_BASE_ADDR2 + 0x000A)
+#define KDATA_MIXER_WORDB (KDATA_BASE_ADDR2 + 0x000B)
+#define KDATA_MIXER_WORDC (KDATA_BASE_ADDR2 + 0x000C)
+#define KDATA_MIXER_WORDD (KDATA_BASE_ADDR2 + 0x000D)
+#define KDATA_MIXER_WORDE (KDATA_BASE_ADDR2 + 0x000E)
+#define KDATA_MIXER_WORDF (KDATA_BASE_ADDR2 + 0x000F)
+
+#define KDATA_MIXER_XFER0 (KDATA_BASE_ADDR2 + 0x0010)
+#define KDATA_MIXER_XFER1 (KDATA_BASE_ADDR2 + 0x0011)
+#define KDATA_MIXER_XFER2 (KDATA_BASE_ADDR2 + 0x0012)
+#define KDATA_MIXER_XFER3 (KDATA_BASE_ADDR2 + 0x0013)
+#define KDATA_MIXER_XFER4 (KDATA_BASE_ADDR2 + 0x0014)
+#define KDATA_MIXER_XFER5 (KDATA_BASE_ADDR2 + 0x0015)
+#define KDATA_MIXER_XFER6 (KDATA_BASE_ADDR2 + 0x0016)
+#define KDATA_MIXER_XFER7 (KDATA_BASE_ADDR2 + 0x0017)
+#define KDATA_MIXER_XFER8 (KDATA_BASE_ADDR2 + 0x0018)
+#define KDATA_MIXER_XFER9 (KDATA_BASE_ADDR2 + 0x0019)
+#define KDATA_MIXER_XFER_ENDMARK (KDATA_BASE_ADDR2 + 0x001A)
+
+#define KDATA_MIXER_TASK_NUMBER (KDATA_BASE_ADDR2 + 0x001B)
+#define KDATA_CURRENT_MIXER (KDATA_BASE_ADDR2 + 0x001C)
+#define KDATA_MIXER_ACTIVE (KDATA_BASE_ADDR2 + 0x001D)
+#define KDATA_MIXER_BANK_STATUS (KDATA_BASE_ADDR2 + 0x001E)
+#define KDATA_DAC_LEFT_VOLUME (KDATA_BASE_ADDR2 + 0x001F)
+#define KDATA_DAC_RIGHT_VOLUME (KDATA_BASE_ADDR2 + 0x0020)
+
+/* AY */
+/* */
+/* 4 speaker support */
+/* */
+
+#define KDATA_DAC2_REQUEST (KDATA_BASE_ADDR2 + 0x0021)
+
+#define KDATA_FMIXER_XFER0 (KDATA_BASE_ADDR2 + 0x0022)
+#define KDATA_FMIXER_XFER_ENDMARK (KDATA_BASE_ADDR2 + 0x0023)
+
+#define KDATA_RMIXER_XFER0 (KDATA_BASE_ADDR2 + 0x0024)
+#define KDATA_RMIXER_XFER_ENDMARK (KDATA_BASE_ADDR2 + 0x0025)
+
+
+#if (REV_A_DATA_MEMORY_UNIT_LENGTH - 0x0080)
+#error Assumption about DATA_MEMORY_UNIT_LENGTH size failed.
+#endif
+
+
+/* */
+/* Client data memory definition */
+/* */
+
+#define CDATA_INSTANCE_READY 0x00
+
+#define CDATA_HOST_SRC_ADDRL 0x01
+#define CDATA_HOST_SRC_ADDRH 0x02
+#define CDATA_HOST_SRC_END_PLUS_1L 0x03
+#define CDATA_HOST_SRC_END_PLUS_1H 0x04
+#define CDATA_HOST_SRC_CURRENTL 0x05
+#define CDATA_HOST_SRC_CURRENTH 0x06
+
+#define CDATA_IN_BUF_CONNECT 0x07
+#define CDATA_OUT_BUF_CONNECT 0x08
+
+#define CDATA_IN_BUF_BEGIN 0x09
+#define CDATA_IN_BUF_END_PLUS_1 0x0A
+#define CDATA_IN_BUF_HEAD 0x0B
+#define CDATA_IN_BUF_TAIL 0x0C
+
+#define CDATA_OUT_BUF_BEGIN 0x0D
+#define CDATA_OUT_BUF_END_PLUS_1 0x0E
+#define CDATA_OUT_BUF_HEAD 0x0F
+#define CDATA_OUT_BUF_TAIL 0x10
+
+#define CDATA_DMA_CONTROL 0x11
+#define CDATA_RESERVED 0x12
+
+#define CDATA_FREQUENCY 0x13
+#define CDATA_LEFT_VOLUME 0x14
+#define CDATA_RIGHT_VOLUME 0x15
+#define CDATA_LEFT_SUR_VOL 0x16
+#define CDATA_RIGHT_SUR_VOL 0x17
+
+#define CDATA_HEADER_LEN 0x18
+
+/* */
+/* DMA control definition */
+/* */
+
+#define DMACONTROL_BLOCK_MASK 0x000F
+#define DMAC_BLOCK0_SELECTOR 0x0000
+#define DMAC_BLOCK1_SELECTOR 0x0001
+#define DMAC_BLOCK2_SELECTOR 0x0002
+#define DMAC_BLOCK3_SELECTOR 0x0003
+#define DMAC_BLOCK4_SELECTOR 0x0004
+#define DMAC_BLOCK5_SELECTOR 0x0005
+#define DMAC_BLOCK6_SELECTOR 0x0006
+#define DMAC_BLOCK7_SELECTOR 0x0007
+#define DMAC_BLOCK8_SELECTOR 0x0008
+#define DMAC_BLOCK9_SELECTOR 0x0009
+#define DMAC_BLOCKA_SELECTOR 0x000A
+#define DMAC_BLOCKB_SELECTOR 0x000B
+#define DMAC_BLOCKC_SELECTOR 0x000C
+#define DMAC_BLOCKD_SELECTOR 0x000D
+#define DMAC_BLOCKE_SELECTOR 0x000E
+#define DMAC_BLOCKF_SELECTOR 0x000F
+#define DMACONTROL_PAGE_MASK 0x00F0
+#define DMAC_PAGE0_SELECTOR 0x0030
+#define DMAC_PAGE1_SELECTOR 0x0020
+#define DMAC_PAGE2_SELECTOR 0x0010
+#define DMAC_PAGE3_SELECTOR 0x0000
+#define DMACONTROL_AUTOREPEAT 0x1000
+#define DMACONTROL_STOPPED 0x2000
+#define DMACONTROL_DIRECTION 0x0100
+
+
+/* */
+/* Direct mixer definition */
+/* */
+
+#define DIRECTMIXER_ADC1 0x0001
+#define DIRECTMIXER_ADC2 0x0002
+
+
+/* */
+/* DSP to Host interrupt request definition */
+/* */
+
+#define DSP2HOST_REQ_PIORECORD 0x01
+#define DSP2HOST_REQ_I2SRATE 0x02
+#define DSP2HOST_REQ_TIMER 0x04
+
+/* */
+/* memory check code uses this areas */
+/* */
+
+#define FLAGADD1 0x1400 /* dsp internal data */
+#define FLAGADD2 0x1800 /* dsp internal data */
+#define FLAGADD3 0x1000 /* dsp internal data */
+
+
+/* WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! */
+/* */
+/* If you modify any memory map and/or definitions above be sure to reflect */
+/* the changes in the DSP version found in KERNEL.INC. */
+/* */
+/* WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! WARNING! DANGER! */
+
+
+#define F_FREE 0x00
+#define F_USED 0x01
+#define F_END -1
+
+
+/* */
+/* Kernel/client memory allocation */
+/* */
+
+#define NUM_UNITS_KERNEL_CODE 16
+#define NUM_UNITS_KERNEL_DATA 2
+
+#define NUM_UNITS_KERNEL_CODE_WITH_HSP 16
+#ifdef NT_MODEL
+#define NUM_UNITS_KERNEL_DATA_WITH_HSP 5
+#else
+#define NUM_UNITS_KERNEL_DATA_WITH_HSP 4
+#endif
+
+#define NUM_UNITS( BYTES, UNITLEN ) ((((BYTES+1)>>1) + (UNITLEN-1)) / UNITLEN)
+
+
+/* */
+/* Maximum instances */
+/* */
+
+#define MAX_TASKS (KDATA_TASK_ENDMARK - KDATA_TASK0)
+
+#define MAX_INSTANCE_CPYTHRU (KDATA_INSTANCE_CPYTHRU_ENDMARK - KDATA_INSTANCE0_CPYTHRU)
+#define MAX_INSTANCE_MODEM (KDATA_INSTANCE_MODEM_ENDMARK - KDATA_INSTANCE0_MODEM)
+#define MAX_INSTANCE_POS3D (KDATA_INSTANCE_POS3D_ENDMARK - KDATA_INSTANCE0_POS3D)
+#define MAX_INSTANCE_SPKVIRT (KDATA_INSTANCE_SPKVIRT_ENDMARK - KDATA_INSTANCE0_SPKVIRT)
+#define MAX_INSTANCE_SRC (KDATA_INSTANCE_SRC_ENDMARK - KDATA_INSTANCE0_SRC)
+#define MAX_INSTANCE_MINISRC (KDATA_INSTANCE_MINISRC_ENDMARK - KDATA_INSTANCE0_MINISRC)
+#define MAX_INSTANCE_SPDIF (KDATA_INSTANCE_SPDIF_ENDMARK - KDATA_INSTANCE0_SPDIF)
+
+#define MAX_VIRTUAL_DMA_CHANNELS (KDATA_DMA_XFER_ENDMARK - KDATA_DMA_XFER0)
+#define MAX_VIRTUAL_ADC1_CHANNELS (KDATA_ADC1_XFER_ENDMARK - KDATA_ADC1_XFER0)
+#define MAX_VIRTUAL_ADC2_CHANNELS (KDATA_ADC2_XFER_ENDMARK - KDATA_ADC2_XFER0)
+#define MAX_VIRTUAL_CD_CHANNELS (KDATA_CD_XFER_ENDMARK - KDATA_CD_XFER0)
+#define MAX_VIRTUAL_MIC_CHANNELS (KDATA_MIC_XFER_ENDMARK - KDATA_MIC_XFER0)
+
+#define MAX_VIRTUAL_I2S_CHANNELS (KDATA_I2S_XFER_ENDMARK - KDATA_I2S_XFER0)
+#define MAX_VIRTUAL_CHI_CHANNELS (KDATA_CHI_XFER_ENDMARK - KDATA_CHI_XFER0)
+#define MAX_VIRTUAL_SOUNDBLASTER_CHANNELS (KDATA_SOUNDBLASTER_XFER_ENDMARK - KDATA_SOUNDBLASTER_XFER0)
+#define MAX_VIRTUAL_SPDIFIN_CHANNELS (KDATA_SPDIFIN_XFER_ENDMARK - KDATA_SPDIFIN_XFER0)
+
+/*AY */
+#define MAX_VIRTUAL_MIXER_CHANNELS (KDATA_MIXER_XFER_ENDMARK - KDATA_MIXER_XFER0)
+#define MAX_VIRTUAL_FMIXER_CHANNELS (KDATA_FMIXER_XFER_ENDMARK - KDATA_FMIXER_XFER0)
+#define MAX_VIRTUAL_RMIXER_CHANNELS (KDATA_RMIXER_XFER_ENDMARK - KDATA_RMIXER_XFER0)
+
+/* */
+/* Hardware instance flags */
+/* */
+
+#define HWI_FLAG_UNLOADED 0x00000001
+#define HWI_FLAG_I2S_SECONDPASS 0x00000002
+#define HWI_FLAG_FM_LOADED 0x00000004
+#define HWI_FLAG_SUSPENDED 0x00000008
+#define HWI_FLAG_HSP_PRESENT 0x00000010
+#define HWI_FLAG_MEM_CHECK 0x00000020
+
+/* */
+/* Client input/output buffer connectivity */
+/* */
+
+#define KCONNECT_NONE 0x0000
+#define KCONNECT_DMA 0x0001
+#define KCONNECT_ADC1 0x0002
+#define KCONNECT_ADC2 0x0003
+#define KCONNECT_CD 0x0004
+#define KCONNECT_MIC 0x0005
+#define KCONNECT_I2S 0x0006
+#define KCONNECT_CHI 0x0007
+#define KCONNECT_SOUNDBLASTER 0x0008
+#define KCONNECT_SPDIF 0x0009
+#define KCONNECT_PIO 0x000A
+#define KCONNECT_MIXER 0x000B
+#define KCONNECT_SPDIFIN 0x000C
+#define KCONNECT_FMIXER 0x000D /*AY */
+#define KCONNECT_RMIXER 0x000E /*AY */
+#define KCONNECT_SAME 0x000F
+#define NUMBER_OF_CONNECTIONS (KCONNECT_SAME + 1)
+
+#define MASK_KCONNECT_NONE (1 << KCONNECT_NONE)
+#define MASK_KCONNECT_DMA (1 << KCONNECT_DMA)
+#define MASK_KCONNECT_ADC1 (1 << KCONNECT_ADC1)
+#define MASK_KCONNECT_ADC2 (1 << KCONNECT_ADC2)
+#define MASK_KCONNECT_CD (1 << KCONNECT_CD)
+#define MASK_KCONNECT_MIC (1 << KCONNECT_MIC)
+#define MASK_KCONNECT_I2S (1 << KCONNECT_I2S)
+#define MASK_KCONNECT_CHI (1 << KCONNECT_CHI)
+#define MASK_KCONNECT_SOUNDBLASTER (1 << KCONNECT_SOUNDBLASTER)
+#define MASK_KCONNECT_SPDIF (1 << KCONNECT_SPDIF)
+#define MASK_KCONNECT_MIXER (1 << KCONNECT_MIXER)
+#define MASK_KCONNECT_SPDIFIN (1 << KCONNECT_SPDIFIN)
+#define MASK_KCONNECT_FMIXER (1 << KCONNECT_FMIXER) /*AY */
+#define MASK_KCONNECT_RMIXER (1 << KCONNECT_RMIXER) /*AY */
+#define MASK_KCONNECT_SAME (1 << KCONNECT_SAME)
+
+/* */
+/* Open/Close flags */
+/* */
+
+#define KOPENCLOSE_SYNCHRONOUS 0x0001
+
+/* */
+/* Switch client */
+#define KENABLE_CLIENT 0
+#define KDISABLE_CLIENT 1
+
+
+/* */
+/* DSP timeout */
+/* */
+
+#define DSP_TIMEOUT 10000
+
+
+/* */
+/* DMA transfer alteration flags */
+/* */
+
+#define KALTER_AUTOREPEAT 0x0001
+#define KALTER_POSITION 0x0002
+
+
+/* */
+/* DSP hardware */
+/* */
+
+#define DSP_PORT_TIMER_COUNT 0x06
+#define DSP_PORT_MEMORY_INDEX 0x80
+#define DSP_PORT_MEMORY_TYPE 0x82
+#define DSP_PORT_MEMORY_DATA 0x84
+#define DSP_PORT_CONTROL_REG_A 0xA2
+#define DSP_PORT_CONTROL_REG_B 0xA4
+#define DSP_PORT_CONTROL_REG_C 0xA6
+
+#define MEMTYPE_INTERNAL_CODE 0x0002
+#define MEMTYPE_INTERNAL_DATA 0x0003
+#define MEMTYPE_MASK 0x0003
+
+#define REGB_ENABLE_RESET 0x01
+#define REGB_STOP_CLOCK 0x10
+
+#define REGC_DISABLE_FM_MAPPING 0x02
+
+#define DP_SHIFT_COUNT 7
+
+#define DMA_BLOCK_LENGTH 32
+
+
+/* */
+/* kernel binary image storage */
+/* */
+
+typedef struct tagKERNEL_BIN
+{
+
+ PWORD pwBinCode;
+ DWORD dwLengthCode;
+
+}
+KERNEL_BIN, *PKERNEL_BIN;
+
+
+/* */
+/* client binary image storage */
+/* */
+
+typedef struct tagCLIENT_BIN
+{
+
+ DWORD dwCodeAddress;
+
+ PWORD pwBinVect;
+ PWORD pwBinCode;
+ PWORD pwBinData;
+
+ DWORD dwLengthVect;
+ DWORD dwLengthCode;
+ DWORD dwLengthData;
+
+}
+CLIENT_BIN, *PCLIENT_BIN;
+
+
+/* */
+/* FM client binary image storage */
+/* */
+
+typedef struct tagFMCLIENT_BIN
+{
+
+ DWORD dwCodeAddress;
+ DWORD dwData2Address;
+
+ PWORD pwBinVect;
+ PWORD pwBinCode;
+ PWORD pwBinData;
+ PWORD pwBinData2;
+
+ DWORD dwLengthVect;
+ DWORD dwLengthCode;
+ DWORD dwLengthData;
+ DWORD dwLengthData2;
+
+}
+FMCLIENT_BIN, *PFMCLIENT_BIN;
+
+
+/* */
+/* client */
+/* */
+
+typedef struct tagCLIENT
+{
+
+ /* kernel use only */
+
+ PCLIENT_BIN pClient_Bin;
+ DWORD dwReferenceCount;
+ DWORD dwMaxReference;
+ DWORD dwInstanceListArea;
+ DWORD dwDspCodeNumUnits;
+ PBYTE pbDspCodeMapPtr;
+
+ /* client use */
+
+ DWORD dwDspCodeClientArea;
+
+}
+CLIENT, *PCLIENT;
+
+
+/* */
+/* client instance */
+/* */
+
+typedef struct tagCLIENT_INST
+{
+
+ /* kernel use only */
+
+ DWORD dwClient;
+ DWORD dwHostSrcBufferAddr;
+ DWORD dwHostSrcBufferLen;
+ DWORD dwHostDstBufferAddr;
+ DWORD dwHostDstBufferLen;
+ DWORD dwHostDstCurrent;
+ DWORD dwDSPOutBufferAddr;
+ DWORD dwDSPOutBufferLen;
+ DWORD dwDSPInConnection;
+ DWORD dwDSPOutConnection;
+ DWORD dwDspDataNumUnits;
+ PBYTE pbDspDataMapPtr;
+
+ /* client use */
+
+ DWORD dwDspDataClientArea;
+ DWORD dwDspCodeClientArea;
+
+}
+CLIENT_INST, *PCLIENT_INST;
+
+
+/* */
+/* pass through descriptor */
+/* */
+
+typedef struct tagPASSTHRU
+{
+
+ DWORD dwDSPInConnection;
+ DWORD dwDSPOutConnection;
+ PBYTE pbDspDataMapPtr;
+ DWORD dwDspDataPassThruArea;
+
+ WORD wLeftVolume;
+ WORD wRightVolume;
+
+}
+PASSTHRU, *PPASSTHRU;
+
+
+/* */
+/* Hardware instance */
+/* */
+
+typedef struct tagHWI
+{
+
+ DWORD dwDeviceID;
+ DWORD dwRevisionID;
+ DWORD dwBaseIO;
+ DWORD dwFlags;
+
+ PWORD pwSuspendBuffer;
+
+ WORD wI2SSampleCount;
+ WORD wI2STimerCount;
+
+ WORD wDspResetCount;
+
+ /* client table */
+
+ CLIENT asClientTable[NUMBER_OF_CLIENTS];
+
+ /* resource lists */
+
+ WORD awTaskList[MAX_TASKS + 1];
+
+ WORD awInstanceCpyThruList[MAX_INSTANCE_CPYTHRU + 1];
+ WORD awInstanceModemList[MAX_INSTANCE_MODEM + 1];
+ WORD awInstancePos3DList[MAX_INSTANCE_POS3D + 1];
+ WORD awInstanceSpkVirtList[MAX_INSTANCE_SPKVIRT + 1];
+ WORD awInstanceSRCList[MAX_INSTANCE_SRC + 1];
+ WORD awInstanceMINISRCList[MAX_INSTANCE_MINISRC + 1];
+ WORD awInstanceSPDIFList[MAX_INSTANCE_SPDIF + 1];
+
+ WORD awVirtualDMAList[MAX_VIRTUAL_DMA_CHANNELS + 1];
+ WORD awVirtualADC1List[MAX_VIRTUAL_ADC1_CHANNELS + 1];
+ WORD awVirtualADC2List[MAX_VIRTUAL_ADC2_CHANNELS + 1];
+ WORD awVirtualCDList[MAX_VIRTUAL_CD_CHANNELS + 1];
+ WORD awVirtualMICList[MAX_VIRTUAL_MIC_CHANNELS + 1];
+
+ WORD awVirtualI2SList[MAX_VIRTUAL_I2S_CHANNELS + 1];
+ WORD awVirtualCHIList[MAX_VIRTUAL_CHI_CHANNELS + 1];
+
+ WORD awVirtualSPDIFINList[MAX_VIRTUAL_SPDIFIN_CHANNELS + 1];
+ WORD awVirtualMIXERList[MAX_VIRTUAL_MIXER_CHANNELS + 1];
+
+ /*AY */
+ WORD awVirtualFMIXERList[MAX_VIRTUAL_FMIXER_CHANNELS + 1];
+ WORD awVirtualRMIXERList[MAX_VIRTUAL_RMIXER_CHANNELS + 1];
+
+ /* memory maps */
+
+ DWORD dwCodeMemoryBegin;
+ DWORD dwCodeMemoryEnd;
+ DWORD dwCodeMemoryUnitLength;
+ DWORD dwCodeMemoryLength;
+
+ DWORD dwDataMemoryBegin;
+ DWORD dwDataMemoryEnd;
+ DWORD dwDataMemoryUnitLength;
+ DWORD dwDataMemoryLength;
+
+ BYTE abCodeMemoryMap[CODE_MEMORY_MAP_LENGTH];
+ BYTE abDataMemoryMap[DATA_MEMORY_MAP_LENGTH];
+
+ /* vector list */
+
+ WORD awVectorList[KCODE_VECTORS_LENGTH];
+
+}
+HWI, *PHWI;
+
+
+/* */
+/* function return codes */
+/* */
+
+typedef DWORD KRETURN;
+
+#define KRETURN_SUCCESS 0
+#define KRETURN_ERROR_GENERIC 1
+#define KRETURN_ERROR_BUSY 2
+#define KRETURN_ERROR_UNLOADED 3
+
+
+/* */
+/* external function prototypes */
+/* */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ WORD kDspReadWord (allegro_devc * devc, DWORD dwBaseIO, DWORD dwMemType,
+ DWORD dwMemAddr);
+
+ VOID kDspWriteWord
+ (allegro_devc * devc, DWORD dwBaseIO, DWORD dwMemType, DWORD dwMemAddr,
+ WORD wMemData);
+
+ VOID kDspReadWords
+ (allegro_devc * devc, DWORD dwBaseIO,
+ DWORD dwMemType, DWORD dwMemAddr, DWORD dwMemLen, PWORD pwHostAddr);
+
+ VOID kDspWriteWords
+ (allegro_devc * devc, DWORD dwBaseIO,
+ DWORD dwMemType, DWORD dwMemAddr, DWORD dwMemLen, PWORD pwHostAddr);
+
+ VOID kDspWriteZeros
+ (allegro_devc * devc, DWORD dwBaseIO, DWORD dwMemType, DWORD dwMemAddr,
+ DWORD dwMemLen);
+
+ VOID kPIOInterruptHandler (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst);
+
+ VOID kI2SInterruptHandler (allegro_devc * devc, PHWI phwi,
+ PDWORD pdwI2SRate);
+
+ KRETURN kQueryPosition
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst, DWORD dwQueryOutput, PDWORD pdwPosition);
+
+ KRETURN kResetApuBlockCount (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst);
+
+ KRETURN kGetApuBlockCount
+ (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst,
+ PDWORD pdwBlockCount);
+
+ KRETURN kInitKernel
+ (allegro_devc * devc, PHWI * pphwi,
+ DWORD dwDeviceID, DWORD dwRevisionID, DWORD dwBaseIO, DWORD dwFlags);
+
+ KRETURN kDSPMemCheck (allegro_devc * devc, PHWI phwi);
+
+ KRETURN kTermKernel (allegro_devc * devc, PHWI phwi, DWORD dwBaseIO);
+
+ KRETURN kSuspendKernel (allegro_devc * devc, PHWI phwi);
+
+ KRETURN kResumeKernel (allegro_devc * devc, PHWI phwi);
+
+ KRETURN kOpenInstance
+ (allegro_devc * devc, PHWI phwi,
+ DWORD dwClient,
+ DWORD dwFlags, DWORD dwLen, PCLIENT_INST * ppClient_Inst);
+
+ KRETURN kCloseInstance
+ (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst,
+ DWORD dwFlags);
+
+ KRETURN kSwitchClient (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst, DWORD dwFlags);
+
+ KRETURN kSetInstanceReady (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst);
+
+ KRETURN kSetInstanceNotReady (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst);
+
+ KRETURN kStartTransfer
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ DWORD dwAutoRepeat,
+ DWORD dwHostSrcBufferAddr,
+ DWORD dwHostSrcBufferLen,
+ DWORD dwHostDstBufferAddr,
+ DWORD dwHostDstBufferLen,
+ DWORD dwDSPInBufferAddr,
+ DWORD dwDSPInBufferLen,
+ DWORD dwDSPOutBufferAddr,
+ DWORD dwDSPOutBufferLen,
+ DWORD dwDSPInConnection, DWORD dwDSPOutConnection);
+
+ KRETURN kStopTransfer (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst);
+
+ KRETURN kAlterTransfer
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ DWORD dwFlags, DWORD dwAutoRepeat, DWORD dwPosition);
+
+ KRETURN kSwitchPINConnection
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ DWORD dwDSPInConnection, DWORD dwDSPOutConnection);
+
+ KRETURN kQueryActivity
+ (allegro_devc * devc, PHWI phwi, PDWORD pdwClientMasks,
+ PDWORD pdwConnectMasks);
+
+ KRETURN kSetTimer (allegro_devc * devc, PHWI phwi, DWORD dwTimeInterval);
+
+ KRETURN kOpenPassThru
+ (allegro_devc * devc, PHWI phwi,
+ PPASSTHRU * ppPassThru,
+ DWORD dwDSPInConnection, DWORD dwDSPOutConnection);
+
+ KRETURN kClosePassThru (allegro_devc * devc, PHWI phwi,
+ PPASSTHRU pPassThru);
+
+ KRETURN kSetVolume
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ WORD wLeftVolume, WORD wRightVolume, WORD wBoosterMode);
+
+ KRETURN kSetRearVolume
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst, WORD wLeftRearVolume, WORD wRightRearVolume);
+
+ KRETURN kSetPassThruVolume
+ (allegro_devc * devc, PHWI phwi, PPASSTHRU pPassThru, WORD wLeftVolume,
+ WORD wRightVolume);
+
+ KRETURN kSetPassThruRearVolume
+ (allegro_devc * devc, PHWI phwi,
+ PPASSTHRU pPassThru, WORD wLeftRearVolume, WORD wRightRearVolume);
+
+
+ KRETURN kSetMasterVolume (allegro_devc * devc, PHWI phwi, WORD wLeftVolume,
+ WORD wRightVolume);
+
+
+ KRETURN kSetFrequency
+ (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst,
+ WORD wFrequency);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/* */
+/* external data declarations */
+/* */
+extern KERNEL_BIN gsMemChkVectCode;
+extern KERNEL_BIN gsKernelVectCode;
+extern KERNEL_BIN gsKernelVectCodeWithHSP;
+
+
+
+extern CLIENT_BIN gasCpyThruVectCode[];
+extern CLIENT_BIN gasModemVectCode[];
+extern CLIENT_BIN gasPos3DVectCode[];
+extern CLIENT_BIN gasSpkVirtVectCode[];
+extern CLIENT_BIN gasSpkVirtVectCode_CRL[];
+extern CLIENT_BIN gasSRCVectCode[];
+extern CLIENT_BIN gasMINISRCVectCode[];
+extern CLIENT_BIN gasSPDIFVectCode[];
+
+
+extern FMCLIENT_BIN gsFMVectCode;
+
+extern WORD MIXER_TASK_NUMBER;
+
+/* */
+/* critical enter/leave */
+/* */
+
+#if defined( DOS_MODEL ) || defined( WDM_MODEL )
+#define CRITENTER
+#define CRITLEAVE
+#endif
+
+#if defined( VXD_MODEL )
+#define CRITENTER _asm pushfd \
+ _asm cli
+
+#define CRITLEAVE _asm popfd
+#endif
+
+#ifdef WDM_MODEL
+#define KCALL( func ) func
+#define KBEGIN( func ) if ( KRETURN_SUCCESS == func ) {
+#define KEND() }
+#endif
+
+#ifdef NT_MODEL
+#undef NULL
+#define NULL 0
+#endif
+
+#endif
+
+/*--------------------------------------------------------------------------- */
+/* End of File: kernel.h */
+/*--------------------------------------------------------------------------- */
+
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
diff --git a/attic/drv/oss_allegro/kernel.inc b/attic/drv/oss_allegro/kernel.inc
new file mode 100644
index 0000000..5f7c8b5
--- /dev/null
+++ b/attic/drv/oss_allegro/kernel.inc
@@ -0,0 +1,6225 @@
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ * This source code, its compiled object code, and its associated data sets *
+ * are copyright (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
+
+/*---------------------------------------------------------------------------
+ * Copyright (C) 1997-1999, ESS Technology, Inc.
+ *---------------------------------------------------------------------------
+ * FILENAME: kernel.c V2.10 08/19/99
+ *---------------------------------------------------------------------------
+ * DESCRIPTION: Maestro 3/Allegro1 host kernel
+ *---------------------------------------------------------------------------
+ * AUTHOR: Henry Tang/Hong Kim/Alger Yeung/Don Kim
+ *---------------------------------------------------------------------------
+ * HISTORY:
+ * 09/03/97 HT Created.
+ * 04/23/99 AY Use C call for lowest level access (in and out)
+ * 04/23/99 AY Remove delay since M3/Allegro1 has no delay bug
+ * 04/23/99 AY Cleanup dead code
+ * 05/08/99 AY SPDIF support SCMS
+ * 05/21/99 AY Add SwitchClient API to add/remove client from/to task list
+ * 05/24/99 AY Enable Cpythru (dwclient=0) to be loaded even though
+ * its code memory is not available at certain location
+ * 06/02/99 AY Enable PassThru support for adc1 -> mixer & adc2->mixer
+ * 07/29/99 AY Adding 4-speaker support
+ * 08/18/99 AY Adding SPDIF IN support
+ * 08/18/99 AY Remove PIO and SoundBlaster support
+ * 08/18/99 AY Reduce Cpythru to 2 instances instead of 4
+ * 09/22/99 HK Add M3I Features
+ *---------------------------------------------------------------------------
+ */
+
+#define NON_INTEL 1 /* avoid Intel x86 inline assembly instruction */
+/*#define ALLEGRO_DEBUG 1 // KERNEL debug flag */
+/*#define K_DBG 1 // KERNEL debug flag */
+
+#ifdef NT_MODEL
+#define HEAPZEROINIT 0
+#ifdef DON
+#include "../port.h"
+#include "kernel.h"
+#endif
+#endif
+
+#ifdef NON_INTEL
+/*#error ******** No Intel x86 assembly instructions ************* */
+#endif
+
+PCLIENT_BIN kBinStructAddress (PHWI phwi, DWORD dwClient, DWORD dwSearchKey);
+
+/* */
+/* Client info */
+/* */
+
+HWI ghwi = {
+
+ 0,
+ 0,
+ 0,
+ 0,
+
+ 0,
+
+ 0, 0,
+
+ 0,
+
+ /* client table */
+
+ {
+ {
+ gasCpyThruVectCode,
+ 0,
+ MAX_INSTANCE_CPYTHRU,
+ KDATA_INSTANCE0_CPYTHRU,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasModemVectCode,
+ 0,
+ MAX_INSTANCE_MODEM,
+ KDATA_INSTANCE0_MODEM,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasPos3DVectCode,
+ 0,
+ MAX_INSTANCE_POS3D,
+ KDATA_INSTANCE0_POS3D,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSpkVirtVectCode,
+ 0,
+ MAX_INSTANCE_SPKVIRT,
+ KDATA_INSTANCE0_SPKVIRT,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSpkVirtVectCode_CRL,
+ 0,
+ MAX_INSTANCE_SPKVIRT,
+ KDATA_INSTANCE0_SPKVIRT,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSRCVectCode,
+ 0,
+ MAX_INSTANCE_SRC,
+ KDATA_INSTANCE0_SRC,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasMINISRCVectCode,
+ 0,
+ MAX_INSTANCE_MINISRC,
+ KDATA_INSTANCE0_MINISRC,
+ 0,
+ 0,
+ 0}
+ ,
+
+ {
+ gasSPDIFVectCode,
+ 0,
+ MAX_INSTANCE_SPDIF,
+ KDATA_INSTANCE0_SPDIF,
+ 0,
+ 0,
+ 0}
+
+ }
+ ,
+#if 0
+#if (F_FREE || (F_END != -1))
+#error Assumption about storage flags failed.
+#endif
+#endif
+ /* task resource list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Copy Through resource list */
+
+ {
+ F_FREE, F_FREE, /* AY reduce to 2 for SPDIF IN */
+
+ (WORD) F_END}
+ ,
+
+ /* Modem resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Positional 3D resource list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Speaker Virtualization resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* Sample Rate Conversion resource list */
+
+ {
+ F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* MINI Sample Rate Conversion resource list */
+
+ {
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* SPDIF resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* DMA resource list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* ADC1 resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* ADC2 resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* CD resource list */
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* MIC resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* I2S resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* CHI resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+
+ /* SPDIF IN resource list */
+
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* MIXER resource list */
+ {
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+ F_FREE, F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /*AY */
+ /* FMIXER resource list */
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* RMIXER resource list */
+ {
+ F_FREE,
+
+ (WORD) F_END}
+ ,
+
+ /* DSP code memory map */
+
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (BYTE) F_END}
+ ,
+
+ /* DSP data memory map */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (BYTE) F_END}
+ ,
+
+ /* DSP vector list */
+
+ {
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE}
+
+};
+
+/* */
+/* Memory map images */
+/* */
+#if 0
+#if (NUM_UNITS_KERNEL_CODE != 16)
+#error Assumption about kernel code size failed.
+#endif
+#endif
+
+BYTE gabRevBCodeMemoryMapImage[] = {
+ F_USED, F_USED, F_USED, F_USED, /* 0000 - 03FF */
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+
+ F_FREE, F_FREE, F_FREE, F_FREE, /* 0400 - 07FF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE, /* 0800 - 0BFF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ (BYTE) F_END
+};
+
+#if 0
+#if (NUM_UNITS_KERNEL_DATA != 2)
+#error Assumption about kernel data size failed.
+#endif
+#endif
+
+#if 0
+#if (KDATA_BASE_ADDR != 0x1000)
+#error Assumption about kernel data memory location failed.
+#endif
+#endif
+
+BYTE gabRevBDataMemoryMapImage[] = {
+ F_USED, F_USED, F_FREE, F_FREE, /* 1000 - 17FF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_FREE, F_FREE, F_FREE, F_FREE, /* 1800 - 1BFF */
+ F_FREE, F_FREE, F_FREE, F_FREE,
+
+ F_USED, F_USED, F_USED, F_USED, /* 1C00 - 1FFF */
+ F_USED, F_USED, F_USED, F_USED,
+
+ F_USED, F_USED, F_USED, F_USED, /* 2000 - 27FF */
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+ F_USED, F_USED, F_USED, F_USED,
+
+ F_USED, F_USED, F_USED, F_USED, /* 2800 - 2BFF */
+ F_USED, F_USED, F_USED, F_USED,
+
+ (BYTE) F_END
+};
+
+
+extern WORD MIXER_TASK_NUMBER;
+
+#ifdef VXD_MODEL
+#pragma VxD_LOCKED_CODE_SEG
+#endif
+
+#if defined( DOS_MODEL ) || defined( NT_MODEL )
+/*-------------------------------------------------------------------------- */
+/* */
+/* PBYTE _HeapAllocate */
+/* */
+/* Description: */
+/* Allocate memory block of specified length. */
+/* */
+/* Parameters: */
+/* DWORD dwLength */
+/* Length in bytes of memory block. */
+/* */
+/* DWORD dwFlags */
+/* Allocation flags. */
+/* */
+/* Return (PBYTE): */
+/* Pointer to allocated memory block. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+PBYTE
+_HeapAllocate (DWORD dwLength, DWORD dwFlags)
+{
+#ifdef DOS_MODEL
+ return (PBYTE) malloc (dwLength);
+#endif
+
+#ifdef NT_MODEL
+ return (PBYTE) KERNEL_MALLOC (dwLength);
+#endif
+
+} /* _HeapAllocate() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD _HeapFree */
+/* */
+/* Description: */
+/* Deallocate previously allocated memory block. */
+/* */
+/* Parameters: */
+/* PVOID pvBlock, */
+/* Pointer to previously allocated memory block. */
+/* */
+/* DWORD dwFlags */
+/* Allocation flags. */
+/* */
+/* Return (DWORD): */
+/* Non-zero if successful, zero otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+DWORD
+_HeapFree (PVOID pvBlock, DWORD dwFlags)
+{
+#ifdef DOS_MODEL
+ free (pvBlock);
+#endif
+
+#ifdef NT_MODEL
+ KERNEL_FREE (pvBlock);
+#endif
+
+ return 1;
+
+} /* _HeapFree() */
+#endif
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDelayNMicroseconds */
+/* */
+/* Description: */
+/* Delay specified number of microseconds. */
+/* */
+/* Parameters: */
+/* DWORD dwCount */
+/* Number of microseconds to delay. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID
+kDelayNMicroseconds (DWORD dwCount)
+{
+ oss_udelay (dwCount);
+} /* kDelayNMicroseconds() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* BYTE kInB */
+/* */
+/* Description: */
+/* Do BYTE I/O read. */
+/* */
+/* Parameters: */
+/* DWORD dwPort */
+/* I/O port address. */
+/* */
+/* Return (BYTE): */
+/* Data read from specified address. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+BYTE
+kInB (allegro_devc * devc, DWORD dwPort)
+{
+ BYTE bData;
+ bData = READ_PORT_UCHAR (devc->osdev, dwPort);
+ return bData;
+} /* kInB() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kOutB */
+/* */
+/* Description: */
+/* Do BYTE I/O write. */
+/* */
+/* Parameters: */
+/* DWORD dwPort */
+/* I/O port address. */
+/* */
+/* BYTE bData */
+/* I/O port data. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+VOID
+kOutB (allegro_devc * devc, DWORD dwPort, BYTE bData)
+{
+ WRITE_PORT_UCHAR (devc->osdev, dwPort, bData);
+} /* kOutB() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* WORD kInW */
+/* */
+/* Description: */
+/* Do WORD I/O read. */
+/* */
+/* Parameters: */
+/* DWORD dwPort */
+/* I/O port address. */
+/* */
+/* Return (WORD): */
+/* Data read from specified address. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+WORD
+kInW (allegro_devc * devc, DWORD dwPort)
+{
+ WORD wData;
+ wData = READ_PORT_USHORT (devc->osdev, dwPort);
+ return wData;
+} /* kInW() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kOutW */
+/* */
+/* Description: */
+/* Do WORD I/O write. */
+/* */
+/* Parameters: */
+/* DWORD dwPort */
+/* I/O port address. */
+/* */
+/* WORD wData */
+/* I/O port data. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+VOID
+kOutW (allegro_devc * devc, DWORD dwPort, WORD wData)
+{
+ WRITE_PORT_USHORT (devc->osdev, dwPort, wData);
+} /* kOutW() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kInsW */
+/* */
+/* Description: */
+/* Do WORD I/O repeat read. */
+/* */
+/* Parameters: */
+/* DWORD dwPort */
+/* I/O port address. */
+/* */
+/* DWORD dwLen */
+/* Number of WORDs to read from specified address. */
+/* */
+/* DWORD dwAddr */
+/* Host memory address to write to. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+VOID
+kInsW (allegro_devc * devc, DWORD dwPort, DWORD dwLen, DWORD dwAddr)
+{
+#ifdef NON_INTEL
+ DWORD i;
+ WORD *wptr;
+#endif
+
+ if (!dwLen)
+ return;
+
+#ifdef DOS_MODEL
+
+#ifdef NON_INTEL
+ wptr = (WORD *) dwAddr;
+ for (i = 0; i < dwLen; ++i)
+ {
+ *wptr++ = inpw (devc, (WORD) dwPort);
+ } /* endfor */
+#else
+ _asm
+ {
+ push di
+ push es
+ cld
+ mov cx, word ptr dwLen
+ mov dx, word ptr dwPort les di, dwAddr rep insw pop es pop di}
+#endif
+
+#endif
+
+#if defined( VXD_MODEL ) || defined( WDM_MODEL ) || defined( NT_MODEL )
+
+#ifdef NON_INTEL
+ wptr = (WORD *) dwAddr;
+ for (i = 0; i < dwLen; ++i)
+ {
+ *wptr++ = inpw (devc->osdev, (WORD) dwPort);
+ } /* endfor */
+#else
+ _asm
+ {
+ push edi
+ cld mov ecx, dwLen mov edx, dwPort mov edi, dwAddr rep insw pop edi}
+#endif
+
+#endif
+
+} /* kInsW() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kOutsW */
+/* */
+/* Description: */
+/* Do WORD I/O repeat write. */
+/* */
+/* Parameters: */
+/* DWORD dwPort */
+/* I/O port address. */
+/* */
+/* DWORD dwLen */
+/* Number of WORDs to write to specified address. */
+/* */
+/* DWORD dwAddr */
+/* Host memory address to read from. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+VOID
+kOutsW (allegro_devc * devc, DWORD dwPort, DWORD dwLen, DWORD dwAddr)
+{
+#ifdef NON_INTEL
+ DWORD i;
+ WORD *wptr;
+#endif
+
+ if (!dwLen)
+ return;
+
+
+#ifdef DOS_MODEL
+#ifdef NON_INTEL
+
+ wptr = (WORD *) dwAddr;
+ for (i = 0; i < dwLen; ++i)
+ {
+ outpw (devc, (WORD) dwPort, *wptr++);
+ } /* endfor */
+
+#else
+/*#pragma message("----Using slow I/O to overcome hardware bug") */
+ _asm
+ {
+ push si
+ push ds
+ cld
+ mov cx, word ptr dwLen mov dx, word ptr dwPort lds si, dwAddr rep outsw;
+ xx:
+ ;
+ in al, 80 h;
+ delay !;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ ;
+ lodsw;
+ get data;
+ out dx, ax;
+ write it;
+ loop xx;
+ get going ... pop ds pop si}
+#endif
+#endif
+
+#if defined( VXD_MODEL ) || defined( WDM_MODEL ) || defined( NT_MODEL )
+#ifdef NON_INTEL
+ wptr = (WORD *) dwAddr;
+ for (i = 0; i < dwLen; ++i)
+ {
+ outpw (devc->osdev, (WORD) dwPort, *wptr++);
+ } /* endfor */
+#else
+ _asm
+ {
+ push esi cld mov ecx, dwLen mov edx, dwPort mov esi, dwAddr rep outsw;
+ xx:;
+ in al, 80 h;
+ delay !;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ in al, 80 h;
+ lodsw;
+ get data;
+ out dx, ax;
+ write it;
+ loop xx;
+ get going ... pop esi}
+#endif
+#endif
+
+} /* kOutsW() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* WORD kDspReadWord */
+/* */
+/* Description: */
+/* Read WORD from DSP memory. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwMemType */
+/* Type of memory to read from. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to read from. */
+/* */
+/* Return (WORD): */
+/* Data read from specified address. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+WORD
+kDspReadWord (allegro_devc * devc, DWORD dwBaseIO, DWORD dwMemType,
+ DWORD dwMemAddr)
+{
+ WORD wData;
+
+ CRITENTER
+ /* 10/04/97, per Henry Tsay, write zeros to bits 15-2 of type register */
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_TYPE, (WORD) dwMemType);
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_INDEX, (WORD) dwMemAddr);
+ wData = kInW (devc, dwBaseIO + DSP_PORT_MEMORY_DATA);
+ CRITLEAVE return wData;
+} /* kDspReadWord() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDspWriteWord */
+/* */
+/* Description: */
+/* Write WORD to DSP memory. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwMemType */
+/* Type of memory to write to. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to write to. */
+/* */
+/* WORD wMemData */
+/* Data to write to specified address. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID kDspWriteWord
+ (allegro_devc * devc, DWORD dwBaseIO, DWORD dwMemType, DWORD dwMemAddr,
+ WORD wMemData)
+{
+
+ CRITENTER
+ /* 10/04/97, per Henry Tsay, write zeros to bits 15-2 of type register */
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_TYPE, (WORD) dwMemType);
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_INDEX, (WORD) dwMemAddr);
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_DATA, wMemData);
+CRITLEAVE} /* kDspWriteWord() */
+
+/*----------------------------------------------------------------------*/
+/* */
+/* VOID kDspReadWords */
+/* */
+/* Description: */
+/* Read WORD block from DSP memory. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwMemType */
+/* Type of memory to read from. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to read from. */
+/* */
+/* DWORD dwMemLen */
+/* Number of WORDs to read from specified address. */
+/* */
+/* PWORD pwHostAddr */
+/* Host memory address to write to. */
+/* */
+/* Return (VOID): */
+/* */
+/*----------------------------------------------------------------------*/
+
+VOID kDspReadWords
+ (allegro_devc * devc, DWORD dwBaseIO,
+ DWORD dwMemType, DWORD dwMemAddr, DWORD dwMemLen, PWORD pwHostAddr)
+{
+
+ CRITENTER
+ /* 10/04/97, per Henry Tsay, write zeros to bits 15-2 of type register */
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_TYPE, (WORD) dwMemType);
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_INDEX, (WORD) dwMemAddr);
+ kInsW (devc, dwBaseIO + DSP_PORT_MEMORY_DATA, dwMemLen, (DWORD) pwHostAddr);
+CRITLEAVE} /* kDspReadWords() */
+
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDspReadLongWords */
+/* */
+/* Description: */
+/* Read WORD block which could be > 0x1000 from DSP memory. */
+/* Since auto-increment mode can cross 4K boundary, 4K block at a time */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwMemType */
+/* Type of memory to read from. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to read from. */
+/* */
+/* DWORD dwMemLen */
+/* Number of WORDs to read from specified address. */
+/* */
+/* PWORD pwHostAddr */
+/* Host memory address to write to. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID kDspReadLongWords
+ (allegro_devc * devc, DWORD dwBaseIO,
+ DWORD dwMemType, DWORD dwMemLongAddr, DWORD dwMemLongLen, PWORD pwHostAddr)
+{
+ DWORD dwMemLen;
+ DWORD dwMemBegin;
+ WORD *pwBuffer;
+
+ /* take care the Data area which could be > 0x1000 in size */
+ dwMemLen = dwMemLongLen;
+ dwMemBegin = dwMemLongAddr;
+ pwBuffer = pwHostAddr;
+
+ while (dwMemLen > 0)
+ {
+ if (dwMemLen >= 0x1000)
+ {
+ kDspReadWords (devc, dwBaseIO, dwMemType, dwMemBegin, 0x1000,
+ pwBuffer);
+
+ dwMemBegin += 0x1000;
+ dwMemLen -= 0x1000;
+ pwBuffer = (pwBuffer + 0x1000);
+
+ }
+ else
+ {
+ kDspReadWords (devc, dwBaseIO, dwMemType, dwMemBegin, dwMemLen,
+ pwBuffer);
+
+ dwMemLen = 0;
+
+ } /* endif */
+ } /* endwhile */
+} /* kDspReadLongWords() */
+
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDspWriteWords */
+/* */
+/* Description: */
+/* Write WORD block to DSP memory. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwMemType */
+/* Type of memory to write to. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to write to. */
+/* */
+/* DWORD dwMemLen */
+/* Number of WORDs to write to specified address. */
+/* */
+/* PWORD pwHostAddr */
+/* Host memory address to read from. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID kDspWriteWords
+ (allegro_devc * devc, DWORD dwBaseIO,
+ DWORD dwMemType, DWORD dwMemAddr, DWORD dwMemLen, PWORD pwHostAddr)
+{
+
+ CRITENTER
+ /* 10/04/97, per Henry Tsay, write zeros to bits 15-2 of type register */
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_TYPE, (WORD) dwMemType);
+ kOutW (devc, dwBaseIO + DSP_PORT_MEMORY_INDEX, (WORD) dwMemAddr);
+ kOutsW (devc, dwBaseIO + DSP_PORT_MEMORY_DATA, dwMemLen,
+ (DWORD) pwHostAddr);
+CRITLEAVE} /* kDspWriteWords() */
+
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDspWriteLongWords */
+/* */
+/* Description: */
+/* Write WORD block which could be > 0x1000 from DSP memory. */
+/* Since auto-increment mode can cross 4K boundary, 4K block at a time */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwMemType */
+/* Type of memory to Write to. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to Write to . */
+/* */
+/* DWORD dwMemLen */
+/* Number of WORDs to write to specified address. */
+/* */
+/* PWORD pwHostAddr */
+/* Host memory address to read from. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID kDspWriteLongWords
+ (allegro_devc * devc, DWORD dwBaseIO,
+ DWORD dwMemType, DWORD dwMemLongAddr, DWORD dwMemLongLen, PWORD pwHostAddr)
+{
+ DWORD dwMemLen;
+ DWORD dwMemBegin;
+ WORD *pwBuffer;
+
+ /* take care the Data area which could be > 0x1000 in size */
+ dwMemLen = dwMemLongLen;
+ dwMemBegin = dwMemLongAddr;
+ pwBuffer = pwHostAddr;
+
+ while (dwMemLen > 0)
+ {
+ if (dwMemLen >= 0x1000)
+ {
+ kDspWriteWords (devc, dwBaseIO, dwMemType, dwMemBegin, 0x1000,
+ pwBuffer);
+
+ dwMemBegin += 0x1000;
+ dwMemLen -= 0x1000;
+ pwBuffer = (pwBuffer + 0x1000);
+
+ }
+ else
+ {
+ kDspWriteWords (devc, dwBaseIO,
+ dwMemType, dwMemBegin, dwMemLen, pwBuffer);
+
+ dwMemLen = 0;
+
+ } /* endif */
+ } /* endwhile */
+} /* kDspWriteLongWords() */
+
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDspWriteZeros */
+/* */
+/* Description: */
+/* Write zeros to DSP memory. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwMemType */
+/* Type of memory to write to. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to write to. */
+/* */
+/* DWORD dwMemLen */
+/* Number of WORDs of zero to write to specified address. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID kDspWriteZeros
+ (allegro_devc * devc, DWORD dwBaseIO, DWORD dwMemType, DWORD dwMemAddr,
+ DWORD dwMemLen)
+{
+ while (dwMemLen--)
+ {
+/*#pragma message("----Using slow I/O to overcome hardware bug") */
+/* kDelayNMicroseconds( 8 ) ; */
+ kDspWriteWord (devc, dwBaseIO, dwMemType, dwMemAddr++, 0);
+ }
+
+} /* kDspWriteZeros() */
+
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kQueryPosition */
+/* */
+/* Description: */
+/* Return a client's current stream position. A position equal to 0 */
+/* indicates the first byte in the buffer is being transferred. A */
+/* position equal to dwHostXXXBufferLen-1 indicates the last byte */
+/* in the buffer is being transferred. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* DWORD dwQueryOutput */
+/* TRUE if querying host client output position, FALSE if querying input */
+/* */
+/* PDWORD pdwPosition */
+/* Pointer to DWORD that will contain the byte position */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kQueryPosition
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst, DWORD dwQueryOutput, PDWORD pdwPosition)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+ WORD wPosition = 0;
+ WORD wRetry = 10;
+ WORD wPositionL = 0;
+ WORD wPositionH = 0;
+ PWORD pwCur;
+
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ if ((dwQueryOutput && pClient_Inst->dwDSPInConnection == KCONNECT_DMA) ||
+ (!dwQueryOutput && pClient_Inst->dwDSPOutConnection == KCONNECT_DMA))
+ {
+ /* */
+ /* if DMA is not active return position 0 */
+ /* */
+
+ pwCur = phwi->awVirtualDMAList;
+
+ while ((*pwCur != F_FREE) && (*pwCur != (WORD) F_END))
+ {
+ if (*pwCur ==
+ (WORD) (pClient_Inst->dwDspDataClientArea >> DP_SHIFT_COUNT))
+ {
+ break;
+ }
+ ++pwCur;
+ }
+
+ if (*pwCur !=
+ (WORD) (pClient_Inst->dwDspDataClientArea >> DP_SHIFT_COUNT))
+ {
+ *pdwPosition = 0;
+ return KRETURN_SUCCESS;
+ }
+
+ /* */
+ /* Get the position */
+ /* */
+
+ while (wRetry--)
+ {
+ /* read high/low word of current position */
+
+ wPositionH = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea +
+ CDATA_HOST_SRC_CURRENTH);
+
+ wPositionL = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea +
+ CDATA_HOST_SRC_CURRENTL);
+
+ /* if the high word hasn't changed, we've got a meaningful */
+ /* current position value */
+
+ wPosition = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea +
+ CDATA_HOST_SRC_CURRENTH);
+
+ if (wPosition == wPositionH)
+ break;
+ }
+
+ /* fail if we couldn't get a meaningful position */
+
+ if (wPosition != wPositionH)
+ return KRETURN_ERROR_GENERIC;
+
+ *pdwPosition = MAKELONG (wPositionL, wPositionH) -
+ (dwQueryOutput ?
+ pClient_Inst->dwHostSrcBufferAddr :
+ pClient_Inst->dwHostDstBufferAddr);
+ }
+ else if (!dwQueryOutput && pClient_Inst->dwDSPOutConnection == KCONNECT_PIO)
+ {
+ /* */
+ /* Get the position */
+ /* */
+
+ *pdwPosition = pClient_Inst->dwHostDstCurrent -
+ pClient_Inst->dwHostDstBufferAddr;
+ }
+ else
+ {
+ return KRETURN_ERROR_GENERIC;
+ }
+
+ return KRETURN_SUCCESS;
+
+} /* kQueryPosition() */
+
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* BYTE kDspHalt */
+/* */
+/* Description: */
+/* Halt the DSP. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* Return (BYTE): */
+/* Contents of reset port. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+BYTE
+kDspHalt (allegro_devc * devc, DWORD dwBaseIO)
+{
+ BYTE bData;
+ bData = kInB (devc, dwBaseIO + DSP_PORT_CONTROL_REG_B) & ~REGB_STOP_CLOCK;
+ /* Fix for HP Typhoon Hibernation Problem RJJ 6/17/00 */
+ kDelayNMicroseconds (10);
+ kOutB (devc, dwBaseIO + DSP_PORT_CONTROL_REG_B,
+ (BYTE) (bData & ~REGB_ENABLE_RESET));
+
+ return bData;
+
+} /* kDspHalt() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDspReset */
+/* */
+/* Description: */
+/* Reset the DSP and let it run. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* BYTE bData */
+/* Contents of reset port. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID
+kDspReset (allegro_devc * devc, DWORD dwBaseIO, BYTE bData)
+{
+ kOutB (devc, dwBaseIO + DSP_PORT_CONTROL_REG_B,
+ (BYTE) (bData | REGB_ENABLE_RESET));
+
+} /* kDspReset() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kDisableFMMap */
+/* */
+/* Description: */
+/* Enable/disable FM address mapping. */
+/* */
+/* Parameters: */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwDisable */
+/* TRUE if disabling FM mapping, FALSE otherwise */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID
+kDisableFMMap (allegro_devc * devc, DWORD dwBaseIO, DWORD dwDisable)
+{
+ BYTE bData;
+
+ bData =
+ kInB (devc, dwBaseIO + DSP_PORT_CONTROL_REG_C) & ~REGC_DISABLE_FM_MAPPING;
+ bData |= (dwDisable ? REGC_DISABLE_FM_MAPPING : 0);
+ kOutB (devc, dwBaseIO + DSP_PORT_CONTROL_REG_C, (BYTE) bData);
+
+} /* kDisableFMMap() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kRestartStreams */
+/* */
+/* Description: */
+/* Restart all previously active streams. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID
+kRestartStreams (allegro_devc * devc, PHWI phwi)
+{
+ /* */
+ /* reset DMA state machine in case it was active during the suspend */
+ /* */
+ /* If DMA was active, the worst thing that could happen is that we */
+ /* will re-transfer the 16 words that were being transfered during */
+ /* the suspend. The 16 words are not duplicated in the stream, they */
+ /* simply overwrite the exact copy that was previously transfered. */
+ /* */
+
+ if (phwi->awVirtualDMAList[0])
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_DMA_ACTIVE, FALSE);
+ }
+
+
+} /* kRestartStreams() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kStateExists */
+/* */
+/* Description: */
+/* Checks if the specified DSP data memory location is TRUE or FALSE. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to check. */
+/* */
+/* DWORD dwState */
+/* Specified state to check for (TRUE or FALSE) */
+/* */
+/* Return (DWORD): */
+/* TRUE if specified state exists, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+#define RESET_IF_TIMEOUT
+
+DWORD
+kStateExists (allegro_devc * devc, PHWI phwi, DWORD dwMemAddr, DWORD dwState)
+{
+#ifdef RESET_IF_TIMEOUT
+ DWORD dwResetLoops = 50;
+#endif
+ DWORD dwLoops;
+ WORD wData;
+ BYTE bData;
+
+ for (dwLoops = 0;; ++dwLoops)
+ {
+ wData =
+ kDspReadWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA, dwMemAddr);
+
+ if ((dwState && wData) || (!dwState && !wData))
+ return TRUE;
+
+ kDelayNMicroseconds (1);
+
+ if (dwLoops == DSP_TIMEOUT)
+ {
+#ifdef RESET_IF_TIMEOUT
+
+ /* */
+ /* For some as yet unknown reason, if HSP/DSP modem runs */
+ /* concurrently with other DSP clients for a long time, */
+ /* the DSP stops executing. Under such conditions a reset */
+ /* will resume DSP execution and the clients appear to run */
+ /* fine again. Hence we do a reset if we detect the DSP */
+ /* kernel is no longer running. */
+ /* */
+
+ if (--dwResetLoops)
+ {
+ dwLoops = 0;
+ continue;
+ }
+
+ bData = kDspHalt (devc, phwi->dwBaseIO);
+
+ kRestartStreams (devc, phwi);
+
+ kDspReset (devc, phwi->dwBaseIO, bData);
+
+ /* */
+ /* Update our DSP reset counter. This is purely for */
+ /* diagnostic purposes. */
+ /* */
+
+ if (phwi->wDspResetCount + 1)
+ ++phwi->wDspResetCount;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_DSP_RESET_COUNT, phwi->wDspResetCount);
+#endif
+
+ return FALSE;
+ }
+ }
+
+} /* kStateExists() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* PBYTE kAllocDspMemory */
+/* */
+/* Description: */
+/* Find and allocate available DSP memory. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwClient */
+/* Client ID */
+/* */
+/* PBYTE pbMemoryMap */
+/* Pointer to memory map. */
+/* */
+/* DWORD dwNumWanted */
+/* Number of contiguous memory units requested. */
+/* */
+/* Return (PBYTE): */
+/* Pointer to starting memory map unit if successful, NULL otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+PBYTE kAllocDspMemory
+ (PHWI phwi, DWORD dwClient, PBYTE pbMemoryMap, DWORD dwNumWanted)
+{
+ PBYTE pbMemFound = NULL;
+ PBYTE pbMemFound2 = NULL;
+ DWORD dwNumFound = (DWORD) - 1; /* maximum 0xFFFF */
+ PBYTE pbMemTmp;
+ DWORD dwNumTmp;
+ PBYTE pbMemType;
+
+
+ if (!dwNumWanted)
+ return NULL;
+
+ pbMemType = pbMemoryMap; /*AY990524 Data & Code type */
+
+ /* */
+ /* Search for available memory. We want to find the smallest */
+ /* chunk of memory that can satisfy the request. This will minimize */
+ /* memory fragmentation. */
+ /* */
+
+ for (; *pbMemoryMap != (BYTE) F_END; ++pbMemoryMap)
+ {
+ if (*pbMemoryMap == F_USED)
+ continue;
+
+ pbMemTmp = pbMemoryMap;
+ dwNumTmp = 1;
+
+ while (*++pbMemoryMap == F_FREE)
+ ++dwNumTmp;
+
+ if ((dwNumTmp >= dwNumWanted) && (dwNumTmp < dwNumFound))
+ {
+ pbMemFound = pbMemTmp;
+ dwNumFound = dwNumTmp;
+ /*AY+ */
+ /* */
+ /* memory found, check whether it matches with client Code address */
+ /* */
+ if (pbMemType == (phwi->abCodeMemoryMap)) /* code memory */
+ {
+ DWORD dwCodeArea;
+ /*LINTED*/
+ dwCodeArea = ((pbMemFound - phwi->abCodeMemoryMap) *
+ phwi->dwCodeMemoryUnitLength) +
+ phwi->dwCodeMemoryBegin;
+
+ if (!kBinStructAddress (phwi, dwClient, dwCodeArea))
+ {
+ /* no code binary found */
+ pbMemoryMap = pbMemTmp; /* continue with next search */
+ ++pbMemoryMap;
+ dwCodeArea = NULL;
+ pbMemFound = NULL;
+ dwNumFound = (DWORD) - 1;
+
+ }
+ else
+ {
+
+ /* */
+ /* At least we found something availble, so remember just in case. */
+ /* */
+
+ pbMemFound2 = pbMemFound;
+
+ }
+
+ }
+ /*AY- */
+ }
+ --pbMemoryMap;
+ }
+
+ /* */
+ /* If memory found, allocate it. Only allocate as many units that are */
+ /* necessary to satisfy the request. If the smallest memory is not */
+ /* found, then check whether other memory is available or not because */
+ /* just failing is the last thing that kernel would want to do. */
+ /* */
+
+ if (pbMemFound)
+ {
+
+ pbMemTmp = pbMemFound;
+ dwNumTmp = dwNumWanted;
+
+ while (dwNumTmp--)
+ *pbMemTmp++ = F_USED;
+
+ }
+ else
+ {
+ if (pbMemFound2)
+ {
+
+ pbMemTmp = pbMemFound2;
+ dwNumTmp = dwNumWanted;
+ pbMemFound = pbMemFound2;
+
+ while (dwNumTmp--)
+ *pbMemTmp++ = F_USED;
+
+ }
+
+ }
+
+ return pbMemFound;
+
+} /* kAllocDspMemory() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kDeallocDspMemory */
+/* */
+/* Description: */
+/* Deallocate DSP memory. */
+/* */
+/* Parameters: */
+/* PBYTE pbMemFree */
+/* Pointer to starting memory map unit to free. */
+/* */
+/* DWORD dwNumFree */
+/* Number of contiguous memory units to free. */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD
+kDeallocDspMemory (PBYTE pbMemFree, DWORD dwNumFree)
+{
+
+ while (dwNumFree--)
+ *pbMemFree++ = F_FREE;
+
+ return TRUE;
+
+} /* kDeallocDspMemory() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kConnectDirectMixer */
+/* */
+/* Description: */
+/* Connect/Disconnect the specified directly mixed input and output. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwDSPInConnection */
+/* KCONNECT_XXX indicating input connection */
+/* */
+/* DWORD dwDSPOutConnection */
+/* KCONNECT_XXX indicating output connection */
+/* */
+/* DWORD dwConnect */
+/* TRUE if connecting, FALSE otherwise */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD kConnectDirectMixer
+ (allegro_devc * devc, PHWI phwi,
+ DWORD dwDSPInConnection, DWORD dwDSPOutConnection, DWORD dwConnect)
+{
+ WORD wAddress = 0;
+ WORD wData;
+
+ /* */
+ /* Get input setting */
+ /* */
+
+ if (dwDSPInConnection == KCONNECT_ADC1)
+ wData = DIRECTMIXER_ADC1;
+ else if (dwDSPInConnection == KCONNECT_ADC2)
+ wData = DIRECTMIXER_ADC2;
+ else
+ wData = 0;
+
+ /* */
+ /* Get output setting */
+ /* */
+
+ if ((dwDSPOutConnection == KCONNECT_SPDIF) && dwConnect)
+ {
+ /* set the DSP SPDIF request flag */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_SPDIF_REQUEST, TRUE);
+ wAddress = KDATA_SPDIF_XFER;
+ }
+
+ /* */
+ /* Write setting */
+ /* */
+
+ if (dwConnect)
+ {
+ wData |=
+ kDspReadWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA, wAddress);
+ }
+ else
+ {
+ wData ^=
+ kDspReadWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA, wAddress);
+ }
+
+ kDspWriteWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA, wAddress,
+ wData);
+
+#if 0
+#if (NUMBER_OF_CONNECTIONS != 0x10)
+#error Assumption about number of connections failed.
+#endif
+#endif
+
+ return TRUE;
+
+} /* kConnectDirectMixer() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kAddListEntry */
+/* */
+/* Description: */
+/* Add entry to host and DSP resource lists. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PWORD pwHostListBegin */
+/* Start address of host resource list. */
+/* */
+/* WORD wDSPListBegin */
+/* Start address of DSP resource list. */
+/* */
+/* WORD wEntryValue */
+/* Value of entry to add. Must not equal F_FREE or F_END! */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD kAddListEntry
+ (allegro_devc * devc, PHWI phwi, PWORD pwHostListBegin, WORD wDSPListBegin,
+ WORD wEntryValue)
+{
+ PWORD pwCur = pwHostListBegin;
+
+ /* */
+ /* Search for an unused list entry */
+ /* */
+
+ while (*pwCur != (WORD) F_END)
+ {
+ if (*pwCur == F_FREE)
+ {
+ /* */
+ /* Write wEntryValue to both the host list and the DSP list */
+ /* */
+
+ *pwCur = wEntryValue;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ wDSPListBegin + (pwCur - pwHostListBegin),
+ wEntryValue);
+ return TRUE;
+ }
+ ++pwCur;
+ }
+
+ return FALSE;
+
+} /* kAddListEntry() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kRemoveListEntry */
+/* */
+/* Description: */
+/* Remove entry from host and DSP resource lists. Then compact */
+/* the lists if necessary. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PWORD pwHostListBegin */
+/* Start address of host resource list. */
+/* */
+/* WORD wDSPListBegin */
+/* Start address of DSP resource list. */
+/* */
+/* WORD wEntryValue */
+/* Value of entry to remove. Must not equal F_FREE or F_END! */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD kRemoveListEntry
+ (allegro_devc * devc, PHWI phwi, PWORD pwHostListBegin, WORD wDSPListBegin,
+ WORD wEntryValue)
+{
+ PWORD pwCur = pwHostListBegin;
+ PWORD pwRemove = NULL;
+
+ /* */
+ /* Search for the entry containing wEntryValue and for the */
+ /* last data entry */
+ /* */
+
+ while ((*pwCur != F_FREE) && (*pwCur != (WORD) F_END))
+ {
+ if (*pwCur == wEntryValue)
+ {
+ pwRemove = pwCur;
+ }
+ ++pwCur;
+ }
+
+ /* Point to last data entry */
+
+ if (pwCur != pwHostListBegin)
+ {
+ --pwCur;
+ }
+
+ /* */
+ /* Fail if an entry containing wEntryValue could not be found */
+ /* */
+
+ if (!pwRemove)
+ return FALSE;
+
+ /* */
+ /* OK, we've found our entry to remove and we've got the location */
+ /* of the last data entry. When we remove the entry, the void */
+ /* that is created is filled by moving the last data entry into */
+ /* the void. The last data entry is then deleted. We have to fill */
+ /* up the void because list entries are defined to be packed together */
+ /* (i.e. no gaps between entries). */
+ /* */
+
+ /* */
+ /* If the entry to remove is NOT the same as the last data entry, we */
+ /* first overwrite the entry to be removed with the value of the last */
+ /* data entry. Then we delete the last data entry. */
+ /* */
+ /* If the entry to remove is the same as the last data entry, we */
+ /* simply delete the last data entry. */
+ /* */
+
+ if (pwRemove != pwCur)
+ {
+ *pwRemove = *pwCur;
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ wDSPListBegin + (pwRemove - pwHostListBegin), *pwCur);
+ }
+
+ /* */
+ /* Delete the last data entry */
+ /* */
+
+ *pwCur = NULL;
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ wDSPListBegin + (pwCur - pwHostListBegin), 0);
+
+ return TRUE;
+
+} /* kRemoveListEntry() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* PWORD kInstanceListAddress */
+/* */
+/* Description: */
+/* Return pointer to requested client instance list. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwClient */
+/* Client ID */
+/* */
+/* Return (PWORD): */
+/* Pointer to client instance list. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+PWORD
+kInstanceListAddress (PHWI phwi, DWORD dwClient)
+{
+ switch (dwClient)
+ {
+ case CLIENT_CPYTHRU:
+ return phwi->awInstanceCpyThruList;
+
+ case CLIENT_MODEM:
+ return phwi->awInstanceModemList;
+
+ case CLIENT_POS3D:
+ return phwi->awInstancePos3DList;
+
+ case CLIENT_SPKVIRT:
+ case CLIENT_SPKVIRT_CRL:
+ return phwi->awInstanceSpkVirtList;
+
+ case CLIENT_SRC:
+ return phwi->awInstanceSRCList;
+
+ case CLIENT_MINISRC:
+ return phwi->awInstanceMINISRCList;
+
+ case CLIENT_SPDIF:
+ return phwi->awInstanceSPDIFList;
+
+
+ /* we should never end up here! */
+ default:
+ return NULL;
+ }
+#if 0
+#if (NUMBER_OF_CLIENTS != 8)
+#error Assumption about number of clients failed.
+#endif
+#endif
+} /* kInstanceListAddress() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* PWORD kHostXferListAddress */
+/* */
+/* Description: */
+/* Return pointer to requested host transfer list. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwDSPConnection */
+/* KCONNECT_XXX indicating connection */
+/* */
+/* Return (PWORD): */
+/* Pointer to host transfer list. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+PWORD
+kHostXferListAddress (PHWI phwi, DWORD dwDSPConnection)
+{
+ switch (dwDSPConnection)
+ {
+ case KCONNECT_NONE:
+ return NULL;
+
+ case KCONNECT_DMA:
+ return phwi->awVirtualDMAList;
+
+ case KCONNECT_ADC1:
+ return phwi->awVirtualADC1List;
+
+ case KCONNECT_ADC2:
+ return phwi->awVirtualADC2List;
+
+ case KCONNECT_CD:
+ return phwi->awVirtualCDList;
+
+ case KCONNECT_MIC:
+ return phwi->awVirtualMICList;
+
+ case KCONNECT_I2S:
+ return phwi->awVirtualI2SList;
+
+ case KCONNECT_CHI:
+ return phwi->awVirtualCHIList;
+
+ case KCONNECT_SPDIFIN:
+ return phwi->awVirtualSPDIFINList;
+
+ case KCONNECT_MIXER:
+ return phwi->awVirtualMIXERList;
+
+ /*AY */
+ case KCONNECT_FMIXER:
+ return phwi->awVirtualFMIXERList;
+
+ case KCONNECT_RMIXER:
+ return phwi->awVirtualRMIXERList;
+
+ case KCONNECT_SAME:
+ return NULL;
+
+ /* we should never end up here! */
+ default:
+ return NULL;
+ }
+#if 0
+#if (NUMBER_OF_CONNECTIONS != 0x10)
+#error Assumption about number of connections failed.
+#endif
+#endif
+} /* kHostXferListAddress() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* WORD kDSPXferListAddress */
+/* */
+/* Description: */
+/* Return pointer to requested DSP transfer list. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwDSPConnection */
+/* KCONNECT_XXX indicating connection */
+/* */
+/* Return (WORD): */
+/* Pointer to DSP transfer list. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+WORD
+kDSPXferListAddress (PHWI phwi, DWORD dwDSPConnection)
+{
+ switch (dwDSPConnection)
+ {
+ case KCONNECT_NONE:
+ return NULL;
+
+ case KCONNECT_DMA:
+ return KDATA_DMA_XFER0;
+
+ case KCONNECT_ADC1:
+ return KDATA_ADC1_XFER0;
+
+ case KCONNECT_ADC2:
+ return KDATA_ADC2_XFER0;
+
+ case KCONNECT_CD:
+ return KDATA_CD_XFER0;
+
+ case KCONNECT_MIC:
+ return KDATA_MIC_XFER0;
+
+ case KCONNECT_I2S:
+ return KDATA_I2S_XFER0;
+
+ case KCONNECT_CHI:
+ return KDATA_CHI_XFER0;
+
+ case KCONNECT_SPDIF:
+ return KDATA_SPDIF_XFER;
+
+ case KCONNECT_SPDIFIN:
+ return KDATA_SPDIFIN_XFER0;
+
+ case KCONNECT_MIXER:
+ return KDATA_MIXER_XFER0;
+
+ /*AY */
+ case KCONNECT_FMIXER:
+ return KDATA_FMIXER_XFER0;
+
+ case KCONNECT_RMIXER:
+ return KDATA_RMIXER_XFER0;
+
+ case KCONNECT_SAME:
+ return NULL;
+
+ /* we should never end up here! */
+ default:
+ return NULL;
+ }
+#if 0
+#if (NUMBER_OF_CONNECTIONS != 0x10)
+#error Assumption about number of connections failed.
+#endif
+#endif
+} /* kDSPXferListAddress() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kConnectInputOutput */
+/* */
+/* Description: */
+/* Connect the specified input and output. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwDSPInConnection */
+/* KCONNECT_XXX indicating input connection */
+/* */
+/* DWORD dwDSPOutConnection */
+/* KCONNECT_XXX indicating output connection */
+/* */
+/* DWORD dwDspDataArea */
+/* Address of DSP data area containing connection header */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD kConnectInputOutput
+ (allegro_devc * devc, PHWI phwi,
+ DWORD dwDSPInConnection, DWORD dwDSPOutConnection, DWORD dwDspDataArea)
+{
+ /* */
+ /* connect the input */
+ /* */
+
+ if ((dwDSPInConnection != KCONNECT_NONE) &&
+ (dwDSPInConnection != KCONNECT_SAME) &&
+ (dwDSPInConnection < NUMBER_OF_CONNECTIONS))
+ {
+ if (!kAddListEntry (devc, phwi,
+ kHostXferListAddress (phwi, dwDSPInConnection),
+ kDSPXferListAddress (phwi, dwDSPInConnection),
+ (WORD) (dwDspDataArea >> DP_SHIFT_COUNT)))
+ return FALSE;
+
+ if (dwDSPInConnection == KCONNECT_ADC1)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_ADC1_REQUEST, TRUE);
+
+
+ if (dwDSPInConnection == KCONNECT_ADC2)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_ADC2_REQUEST, TRUE);
+
+
+ if (dwDSPInConnection == KCONNECT_CD)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_CD_REQUEST, TRUE);
+
+ if (dwDSPInConnection == KCONNECT_MIC)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_MIC_REQUEST, TRUE);
+
+ if (dwDSPInConnection == KCONNECT_I2S)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_I2S_INT_METER, 0);
+
+ if (dwDSPInConnection == KCONNECT_SPDIFIN)
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_SPDIFIN_INT_METER, 0);
+
+ }
+
+ }
+ else
+ {
+ /* */
+ /* input buffer is connected to other instance's output buffer */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ (WORD) (dwDspDataArea) + CDATA_IN_BUF_CONNECT,
+ (WORD) dwDSPInConnection);
+ }
+
+
+ /* */
+ /* connect the output */
+ /* */
+
+ if ((dwDSPOutConnection != KCONNECT_NONE) &&
+ (dwDSPOutConnection != KCONNECT_SAME) &&
+ (dwDSPOutConnection < NUMBER_OF_CONNECTIONS))
+ {
+ if (!kAddListEntry (devc, phwi,
+ kHostXferListAddress (phwi, dwDSPOutConnection),
+ kDSPXferListAddress (phwi, dwDSPOutConnection),
+ (WORD) (dwDspDataArea >> DP_SHIFT_COUNT)))
+ return FALSE;
+
+ /* */
+ /* if mixer, tell the dsp the total number of mixing list */
+ /* */
+
+ if (dwDSPOutConnection == KCONNECT_MIXER)
+ {
+
+ MIXER_TASK_NUMBER++;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_MIXER_TASK_NUMBER, MIXER_TASK_NUMBER);
+ }
+ }
+ else
+ {
+ /* */
+ /* output buffer is connected to other instance's input buffer */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ (WORD) (dwDspDataArea) + CDATA_OUT_BUF_CONNECT,
+ (WORD) dwDSPOutConnection);
+ }
+
+ return TRUE;
+
+} /* kConnectInputOutput() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kDisconnectInputOutput */
+/* */
+/* Description: */
+/* Disconnect the specified input and output. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwDSPInConnection */
+/* KCONNECT_XXX indicating input connection */
+/* */
+/* DWORD dwDSPOutConnection */
+/* KCONNECT_XXX indicating output connection */
+/* */
+/* DWORD dwDspDataArea */
+/* Address of DSP data area containing connection header */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD kDisconnectInputOutput
+ (allegro_devc * devc, PHWI phwi,
+ DWORD dwDSPInConnection, DWORD dwDSPOutConnection, DWORD dwDspDataArea)
+{
+ WORD wdata;
+
+ /* */
+ /* disconnect the input */
+ /* */
+
+ if ((dwDSPInConnection != KCONNECT_NONE) &&
+ (dwDSPInConnection != KCONNECT_SAME))
+ {
+
+ kRemoveListEntry (devc, phwi,
+ kHostXferListAddress (phwi, dwDSPInConnection),
+ kDSPXferListAddress (phwi, dwDSPInConnection),
+ (WORD) (dwDspDataArea >> DP_SHIFT_COUNT));
+
+ if (dwDSPInConnection == KCONNECT_ADC1)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_ADC1_REQUEST, FALSE);
+
+ if (dwDSPInConnection == KCONNECT_ADC2)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_ADC2_REQUEST, FALSE);
+
+ if (dwDSPInConnection == KCONNECT_CD)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_CD_REQUEST, FALSE);
+
+ if (dwDSPInConnection == KCONNECT_MIC)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_MIC_REQUEST, FALSE);
+
+ if (dwDSPInConnection == KCONNECT_I2S)
+ {
+ wdata = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_I2S_ACTIVE);
+
+ wdata &= ~0x1;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_I2S_ACTIVE, wdata);
+ }
+
+ if (dwDSPInConnection == KCONNECT_SPDIFIN)
+ {
+ wdata = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_I2S_ACTIVE);
+
+ wdata &= ~0x2;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_I2S_ACTIVE, wdata);
+ }
+
+ }
+
+ /* */
+ /* disconnect the output */
+ /* */
+
+ if ((dwDSPOutConnection != KCONNECT_NONE) &&
+ (dwDSPOutConnection != KCONNECT_SAME))
+ {
+ kRemoveListEntry (devc, phwi,
+ kHostXferListAddress (phwi, dwDSPOutConnection),
+ kDSPXferListAddress (phwi, dwDSPOutConnection),
+ (WORD) (dwDspDataArea >> DP_SHIFT_COUNT));
+ }
+
+ /* */
+ /* if mixer, tell the dsp the total number of mixing list */
+ /* */
+
+ if (dwDSPOutConnection == KCONNECT_MIXER)
+ {
+
+ MIXER_TASK_NUMBER--;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_MIXER_TASK_NUMBER, MIXER_TASK_NUMBER);
+ }
+
+ /* */
+ /* handle special cases */
+ /* */
+
+ if ((dwDSPInConnection == KCONNECT_DMA) ||
+ (dwDSPOutConnection == KCONNECT_DMA))
+ {
+ /* do DMA synchronization */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_DMA_SWITCH, FALSE);
+ }
+
+ return TRUE;
+
+} /* kDisconnectInputOutput() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* PCLIENT_BIN kBinStructAddress */
+/* */
+/* Description: */
+/* Return pointer to requested binary image structure. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwClient */
+/* Client ID */
+/* */
+/* DWORD dwSearchKey */
+/* Search key */
+/* */
+/* Return (PCLIENT_BIN): */
+/* Pointer to structure if successful, NULL otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+PCLIENT_BIN
+kBinStructAddress (PHWI phwi, DWORD dwClient, DWORD dwSearchKey)
+{
+ PCLIENT_BIN pClient_Bin;
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return NULL;
+
+ pClient_Bin = phwi->asClientTable[dwClient].pClient_Bin;
+
+ /* */
+ /* If search key is NULL, then just return address of first struct */
+ /* */
+
+ if (!dwSearchKey)
+ return pClient_Bin;
+
+ /* */
+ /* Search key is code load address */
+ /* */
+
+ while (pClient_Bin->dwCodeAddress)
+ {
+ if (pClient_Bin->dwCodeAddress == dwSearchKey)
+ {
+ return pClient_Bin;
+ }
+
+ ++pClient_Bin;
+ }
+
+ return NULL;
+
+} /* kBinStructAddress() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kAllocDspVectors */
+/* */
+/* Description: */
+/* Allocate DSP vectors required by client. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwClient */
+/* Client ID */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD
+kAllocDspVectors (allegro_devc * devc, PHWI phwi, DWORD dwClient)
+{
+ PCLIENT_BIN pClient_Bin;
+ DWORD dwAllocate;
+ DWORD dwIndex;
+
+ /* */
+ /* Check if client needs to allocate DSP vectors */
+ /* */
+
+ if (!(pClient_Bin = kBinStructAddress (phwi, dwClient,
+ phwi->asClientTable[dwClient].
+ dwDspCodeClientArea)))
+ return FALSE;
+
+ dwAllocate = FALSE;
+
+ for (dwIndex = KCODE_VECTORS_UNIT_LENGTH; /* vector 0 reserved */
+ dwIndex < KCODE_VECTORS_LENGTH; dwIndex += KCODE_VECTORS_UNIT_LENGTH)
+ {
+ if (pClient_Bin->pwBinVect[dwIndex + 0] ||
+ pClient_Bin->pwBinVect[dwIndex + 1])
+ {
+ dwAllocate = TRUE;
+
+ /* fail if the vector is already allocated */
+
+ if ((phwi->awVectorList[dwIndex + 0] != F_FREE) ||
+ (phwi->awVectorList[dwIndex + 1] != F_FREE))
+ return FALSE;
+ }
+ }
+
+ if (!dwAllocate)
+ return TRUE;
+
+ /* */
+ /* Make sure DSP kernel is ready to be halted */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, FALSE))
+ return FALSE;
+
+ /* */
+ /* halt the DSP kernel and wait for an acknowledgement */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, TRUE);
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, TRUE))
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ return FALSE;
+ }
+
+ /* */
+ /* DSP kernel has halted, do vector allocation */
+ /* */
+ /* Note: We halt the DSP in order to safely modify vectors */
+ /* */
+
+ for (dwIndex = KCODE_VECTORS_UNIT_LENGTH; /* vector 0 reserved */
+ dwIndex < KCODE_VECTORS_LENGTH; dwIndex += KCODE_VECTORS_UNIT_LENGTH)
+ {
+ if (pClient_Bin->pwBinVect[dwIndex + 0] ||
+ pClient_Bin->pwBinVect[dwIndex + 1])
+ {
+ /* save current DSP vector */
+
+ phwi->awVectorList[dwIndex + 0] =
+ kDspReadWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_CODE,
+ dwIndex + 0);
+
+ phwi->awVectorList[dwIndex + 1] =
+ kDspReadWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_CODE,
+ dwIndex + 1);
+
+ /* write new DSP vector */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ dwIndex + 0, pClient_Bin->pwBinVect[dwIndex + 0]);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ dwIndex + 1, pClient_Bin->pwBinVect[dwIndex + 1]);
+ }
+ }
+
+ /* */
+ /* all done, reset halt request flag to resume DSP kernel execution */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ return TRUE;
+
+} /* kAllocDspVectors() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kDeallocDspVectors */
+/* */
+/* Description: */
+/* Deallocate DSP vectors previously required by client. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwClient */
+/* Client ID */
+/* */
+/* Return (DWORD): */
+/* TRUE if successful, FALSE otherwise */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD
+kDeallocDspVectors (allegro_devc * devc, PHWI phwi, DWORD dwClient)
+{
+ PCLIENT_BIN pClient_Bin;
+ DWORD dwDeallocate;
+ DWORD dwIndex;
+
+ /* */
+ /* Check if client needs to deallocate DSP vectors */
+ /* */
+
+ if (!(pClient_Bin = kBinStructAddress (phwi, dwClient,
+ phwi->asClientTable[dwClient].
+ dwDspCodeClientArea)))
+ return FALSE;
+
+ dwDeallocate = FALSE;
+
+ for (dwIndex = KCODE_VECTORS_UNIT_LENGTH; /* vector 0 reserved */
+ dwIndex < KCODE_VECTORS_LENGTH; dwIndex += KCODE_VECTORS_UNIT_LENGTH)
+ {
+ if (pClient_Bin->pwBinVect[dwIndex + 0] ||
+ pClient_Bin->pwBinVect[dwIndex + 1])
+ {
+ dwDeallocate = TRUE;
+
+ /* fail if the vector was not allocated */
+
+ if ((phwi->awVectorList[dwIndex + 0] == F_FREE) &&
+ (phwi->awVectorList[dwIndex + 1] == F_FREE))
+ return FALSE;
+ }
+ }
+
+ if (!dwDeallocate)
+ return TRUE;
+
+ /* */
+ /* Make sure DSP kernel is ready to be halted */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, FALSE))
+ return FALSE;
+
+ /* */
+ /* halt the DSP kernel and wait for an acknowledgement */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, TRUE);
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, TRUE))
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ return FALSE;
+ }
+
+ /* */
+ /* DSP kernel has halted, do vector deallocation */
+ /* */
+ /* Note: We halt the DSP in order to safely modify vectors */
+ /* */
+
+ for (dwIndex = KCODE_VECTORS_UNIT_LENGTH; /* vector 0 reserved */
+ dwIndex < KCODE_VECTORS_LENGTH; dwIndex += KCODE_VECTORS_UNIT_LENGTH)
+ {
+ if (pClient_Bin->pwBinVect[dwIndex + 0] ||
+ pClient_Bin->pwBinVect[dwIndex + 1])
+ {
+ /* restore original DSP vector */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ dwIndex + 0, phwi->awVectorList[dwIndex + 0]);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ dwIndex + 1, phwi->awVectorList[dwIndex + 1]);
+
+ /* reset vector list */
+
+ phwi->awVectorList[dwIndex + 0] = F_FREE;
+ phwi->awVectorList[dwIndex + 1] = F_FREE;
+ }
+ }
+
+ /* */
+ /* all done, reset halt request flag to resume DSP kernel execution */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ return TRUE;
+
+} /* kDeallocDspVectors() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kLoadKernel */
+/* */
+/* Description: */
+/* Load the kernel into DSP memory. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwFlags */
+/* Hardware instance flags. */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+/*ARGSUSED*/
+VOID
+kLoadKernel (allegro_devc * devc, PHWI phwi, DWORD dwBaseIO, DWORD dwFlags)
+{
+ BYTE bData;
+
+ bData = kDspHalt (devc, dwBaseIO);
+
+ kDisableFMMap (devc, dwBaseIO, TRUE);
+
+ /* clear DSP kernel data memory */
+
+ kDspWriteZeros (devc, dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_BASE_ADDR,
+ NUM_UNITS_KERNEL_DATA * phwi->dwDataMemoryUnitLength);
+
+ /* clear DSP kernel mixer data memory */
+
+ kDspWriteZeros (devc, dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_BASE_ADDR2,
+ NUM_UNITS_KERNEL_DATA * phwi->dwDataMemoryUnitLength);
+
+
+ /* initialize current DMA pointer */
+
+ kDspWriteWord (devc, dwBaseIO, MEMTYPE_INTERNAL_DATA, KDATA_CURRENT_DMA, KDATA_DMA_XFER0); /* khs 121198 */
+
+ /* initialize SPDIF frame status pointer and array */
+
+ kDspWriteWord (devc, dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_SPDIF_CURRENT_FRAME, KDATA_SPDIF_FRAME0);
+
+ kDspWriteWord (devc, dwBaseIO, MEMTYPE_INTERNAL_DATA, KDATA_SPDIF_FRAME0,
+ /* 0x0204 ) ; */
+ 0x0100); /*AY990508 CD data and copy prohibited for SCMS */
+
+ kDspWriteWord (devc, dwBaseIO, MEMTYPE_INTERNAL_DATA, KDATA_SPDIF_FRAME1, 0x0200); /*48K only */
+
+ /* download kernel to DSP memory */
+ {
+ kDspWriteWords (devc, dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->dwCodeMemoryBegin,
+ (gsKernelVectCode.dwLengthCode + 1) / 2,
+ gsKernelVectCode.pwBinCode);
+ }
+
+ /* indicate that kernel is loaded */
+ phwi->dwFlags &= ~HWI_FLAG_UNLOADED;
+
+ /* Set Master Volume to Maximum */
+ kSetMasterVolume (devc, phwi, 0x7FFF, 0x7FFF);
+
+ kDspReset (devc, dwBaseIO, bData);
+
+} /* kLoadKernel() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kInitKernel */
+/* */
+/* Description: */
+/* Initialize the host and DSP kernel. */
+/* */
+/* Parameters: */
+/* PHWI *pphwi */
+/* Pointer to Pointer to hardware instance. */
+/* */
+/* DWORD dwDeviceID */
+/* Device ID. */
+/* */
+/* DWORD dwRevisionID */
+/* Revision ID. */
+/* should always be 0x10 for M3/Allegro1 */
+/* */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* DWORD dwFlags */
+/* Hardware instance flags. */
+/* should always be 0 since there is no difference for HSP */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kInitKernel
+ (allegro_devc * devc, PHWI * pphwi,
+ DWORD dwDeviceID, DWORD dwRevisionID, DWORD dwBaseIO, DWORD dwFlags)
+{
+
+ PHWI phwi;
+ BYTE *pbSrc;
+ BYTE *pbDst;
+ WORD i;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kInitKernel DID=%X RID=%X IO=%X Flag=%X\n",
+ dwDeviceID, dwRevisionID, dwBaseIO, dwFlags);
+#endif
+ /* */
+ /* Allocate hardware instance buffer, initialize it, and pass */
+ /* the buffer address back to the caller */
+ /* */
+
+ if (!(phwi = (PHWI) _HeapAllocate (sizeof (HWI), HEAPZEROINIT)))
+ return KRETURN_ERROR_GENERIC;
+
+ *phwi = ghwi;
+ *pphwi = phwi;
+
+ /* */
+ /* Initialize the hardware instance */
+ /* */
+
+ phwi->dwDeviceID = dwDeviceID;
+ phwi->dwRevisionID = dwRevisionID;
+ phwi->dwBaseIO = dwBaseIO;
+ phwi->dwFlags = dwFlags; /* should be 0x0 */
+
+
+ /* */
+ /* Check and report bad sectors in DSP Memory */
+ /* */
+/*aaa */
+ /*if (phwi -> dwFlags & HWI_FLAG_MEM_CHECK) { */
+ kDSPMemCheck (devc, phwi);
+ /* return KRETURN_ERROR_GENERIC ; */
+ /* } */
+
+ /* init memory map bounds */
+
+ {
+ phwi->dwCodeMemoryBegin = REV_B_CODE_MEMORY_BEGIN;
+ phwi->dwCodeMemoryEnd = REV_B_CODE_MEMORY_END;
+ phwi->dwCodeMemoryUnitLength = REV_B_CODE_MEMORY_UNIT_LENGTH;
+ phwi->dwCodeMemoryLength = REV_B_CODE_MEMORY_LENGTH;
+
+ phwi->dwDataMemoryBegin = REV_B_DATA_MEMORY_BEGIN;
+ phwi->dwDataMemoryEnd = REV_B_DATA_MEMORY_END;
+ phwi->dwDataMemoryUnitLength = REV_B_DATA_MEMORY_UNIT_LENGTH;
+ phwi->dwDataMemoryLength = REV_B_DATA_MEMORY_LENGTH;
+
+ /* transfer memory map images */
+
+ pbSrc = gabRevBCodeMemoryMapImage;
+ pbDst = phwi->abCodeMemoryMap;
+
+ while ((*pbDst++ = *pbSrc++) != (BYTE) F_END);
+
+ pbSrc = gabRevBDataMemoryMapImage;
+ pbDst = phwi->abDataMemoryMap;
+
+ while ((*pbDst++ = *pbSrc++) != (BYTE) F_END);
+ }
+
+ /* */
+ /* Initialize the DSP */
+ /* */
+
+ kLoadKernel (devc, phwi, dwBaseIO, dwFlags);
+
+
+
+ /* testing : dump memory map to 0x1800 */
+ pbDst = phwi->abDataMemoryMap;
+
+ *pbDst++ = F_USED;
+ *pbDst++ = F_USED;
+
+ pbDst = phwi->abDataMemoryMap;
+
+ for (i = 0; i < 24; i++)
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ (DWORD) 0x10c0 + i, (WORD) ((*pbDst++) * 0xFFFF));
+ }
+
+ return KRETURN_SUCCESS;
+
+} /* kInitKernel() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kDSPMemCheck */
+/* */
+/* Description: */
+/* Check the DSP Data memory and update a memory map in host kernel. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+/*kkk */
+KRETURN
+kDSPMemCheck (allegro_devc * devc, PHWI phwi)
+{
+ BYTE bData;
+ BYTE bData2;
+
+ WORD wLoop = 0;
+ WORD wFlag = 0;
+ WORD wFlag2 = 1;
+ WORD wFlag3 = 1;
+ WORD i;
+ DWORD addr = 0;
+
+
+ /* */
+ /* begin to check memory */
+ /* */
+
+ /* save the clock speed for restoreing */
+ bData2 = kInB (devc, phwi->dwBaseIO + DSP_PORT_CONTROL_REG_A);
+
+ for (wLoop = 0; wLoop < 20; wLoop++)
+ {
+
+ bData = kDspHalt (devc, phwi->dwBaseIO);
+
+ /* change to 49Mhz for intensive memory test */
+
+ kOutB (devc, phwi->dwBaseIO + DSP_PORT_CONTROL_REG_A, (BYTE) 0x09);
+/* kOutB( phwi -> dwBaseIO + DSP_PORT_CONTROL_REG_C, (BYTE) 0x10 ) ; */
+
+
+ /* clear DSP kernel data memory */
+
+ kDspWriteZeros (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_BASE_ADDR, REV_B_DATA_MEMORY_LENGTH);
+
+ /* load memory check code */
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->dwCodeMemoryBegin,
+ (gsMemChkVectCode.dwLengthCode + 1) / 2,
+ gsMemChkVectCode.pwBinCode);
+
+ /* start DSP */
+
+
+ kDspReset (devc, phwi->dwBaseIO, bData);
+
+ for (i = 0; i < 3; i++)
+ {
+
+ if (i == 0)
+ addr = FLAGADD1;
+ if (i == 1)
+ addr = FLAGADD2;
+ if (i == 2)
+ addr = FLAGADD3;
+
+
+ /* initialize */
+
+ kDspWriteWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr + 9, wFlag);
+
+ kDspWriteWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr + 5, wFlag2);
+
+ kDspWriteWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr + 6, wFlag3);
+
+
+ /* first 1k check */
+
+ /*LINTED*/
+ while (1)
+ {
+
+ wFlag =
+ kDspReadWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr);
+
+ if (wFlag == 0x0001) /* passed */
+ {
+
+ wFlag = 0;
+
+ kDspWriteWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr, wFlag);
+
+ break;
+
+ }
+ else if (wFlag == 0x0002) /* found a bad sector */
+ {
+
+ wFlag =
+ kDspReadWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr + 2);
+
+ /* update memory map */
+ gabRevBDataMemoryMapImage[((wFlag -
+ REV_B_DATA_MEMORY_BEGIN) >> 7)]
+ = F_USED;
+
+ wFlag = 0;
+
+ kDspWriteWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr, wFlag);
+
+ kDspWriteWord (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA,
+ addr + 5, wFlag2);
+ }
+
+ } /* while */
+
+ } /* for(3) */
+
+ } /* for(100) */
+
+
+ /* */
+ /* everything is done, so restore the clock */
+ /* */
+
+ bData = kDspHalt (devc, phwi->dwBaseIO);
+
+ kOutB (devc, phwi->dwBaseIO + DSP_PORT_CONTROL_REG_A, (BYTE) bData2);
+
+ kDspReset (devc, phwi->dwBaseIO, bData);
+
+
+ return KRETURN_SUCCESS;
+
+}
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kTermKernel */
+/* */
+/* Description: */
+/* Terminate the host and DSP kernel. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwBaseIO */
+/* Base I/O address of device. */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kTermKernel (allegro_devc * devc, PHWI phwi, DWORD dwBaseIO)
+{
+ kDspHalt (devc, dwBaseIO);
+
+ _HeapFree (phwi, 0);
+
+ return KRETURN_SUCCESS;
+
+} /* kTermKernel() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSuspendKernel */
+/* */
+/* Description: */
+/* Suspend the kernel and save its state. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kSuspendKernel (allegro_devc * devc, PHWI phwi)
+{
+ /* */
+ /* FM is a special case */
+ /* */
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSuspendKernel %X\n", phwi);
+#endif
+
+ if (phwi->dwFlags & HWI_FLAG_FM_LOADED)
+ {
+ /* */
+ /* Allocate host memory */
+ /* */
+
+ if (!(phwi->pwSuspendBuffer = (PWORD)
+ _HeapAllocate ((phwi->dwCodeMemoryLength +
+ phwi->dwDataMemoryLength) * 2, HEAPZEROINIT)))
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Do memory save */
+ /* */
+
+ kDspReadWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->dwCodeMemoryBegin,
+ phwi->dwCodeMemoryLength, phwi->pwSuspendBuffer);
+
+ kDspReadLongWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ phwi->dwDataMemoryBegin,
+ phwi->dwDataMemoryLength,
+ phwi->pwSuspendBuffer + phwi->dwCodeMemoryLength);
+
+ /* */
+ /* Indicate FM is suspended */
+ /* */
+
+ phwi->dwFlags |= HWI_FLAG_SUSPENDED;
+
+ return KRETURN_SUCCESS;
+ }
+
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Allocate host memory */
+ /* */
+
+ if (!(phwi->pwSuspendBuffer = (PWORD)
+ _HeapAllocate ((phwi->dwCodeMemoryLength +
+ phwi->dwDataMemoryLength) * 2, HEAPZEROINIT)))
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Make sure DSP kernel is ready to be halted */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, FALSE))
+ goto kSuspend_Error;
+
+ /* */
+ /* halt the DSP kernel and wait for an acknowledgement */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, TRUE);
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, TRUE))
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ goto kSuspend_Error;
+ }
+
+ /* */
+ /* DSP kernel has halted, do memory save */
+ /* */
+ /* Note: We halt the DSP in order to place it in a known state */
+ /* */
+
+ kDspReadWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->dwCodeMemoryBegin,
+ phwi->dwCodeMemoryLength, phwi->pwSuspendBuffer);
+
+ kDspReadLongWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ phwi->dwDataMemoryBegin,
+ phwi->dwDataMemoryLength,
+ phwi->pwSuspendBuffer + phwi->dwCodeMemoryLength);
+
+ /* */
+ /* Kernel was successfully suspended, indicate kernel is unloaded */
+ /* */
+
+ phwi->dwFlags |= (HWI_FLAG_SUSPENDED | HWI_FLAG_UNLOADED);
+
+ return KRETURN_SUCCESS;
+
+kSuspend_Error:
+
+ /* */
+ /* Failure, undo all that was done... */
+ /* */
+
+ if (phwi->pwSuspendBuffer)
+ {
+ _HeapFree (phwi->pwSuspendBuffer, 0);
+ }
+
+ return KRETURN_ERROR_GENERIC;
+
+} /* kSuspendKernel() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kResumeKernel */
+/* */
+/* Description: */
+/* Resume the kernel and restore its state. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kResumeKernel (allegro_devc * devc, PHWI phwi)
+{
+ BYTE bData;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kResumeKernel %X\n", phwi);
+#endif
+ /* */
+ /* FM is a special case */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_FM_LOADED)
+ {
+ /* */
+ /* Fail if FM isn't suspended */
+ /* */
+
+ if (!(phwi->dwFlags & HWI_FLAG_SUSPENDED))
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Do memory restore */
+ /* */
+
+ bData = kDspHalt (devc, phwi->dwBaseIO);
+
+ if (!phwi->pwSuspendBuffer)
+ return KRETURN_ERROR_GENERIC;
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->dwCodeMemoryBegin,
+ phwi->dwCodeMemoryLength, phwi->pwSuspendBuffer);
+
+ kDspWriteLongWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ phwi->dwDataMemoryBegin,
+ phwi->dwDataMemoryLength,
+ phwi->pwSuspendBuffer + phwi->dwCodeMemoryLength);
+
+ _HeapFree (phwi->pwSuspendBuffer, 0);
+
+ phwi->pwSuspendBuffer = 0;
+
+ kDspReset (devc, phwi->dwBaseIO, bData);
+
+ /* Indicate FM is no longer suspended */
+
+ phwi->dwFlags &= ~HWI_FLAG_SUSPENDED;
+
+ return KRETURN_SUCCESS;
+ }
+
+ /* */
+ /* Fail if the kernel isn't suspended */
+ /* */
+
+ if (!(phwi->dwFlags & HWI_FLAG_SUSPENDED))
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Do memory restore */
+ /* */
+
+ bData = kDspHalt (devc, phwi->dwBaseIO);
+
+ if (!phwi->pwSuspendBuffer)
+ return KRETURN_ERROR_GENERIC;
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->dwCodeMemoryBegin,
+ phwi->dwCodeMemoryLength, phwi->pwSuspendBuffer);
+
+ kDspWriteLongWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ phwi->dwDataMemoryBegin,
+ phwi->dwDataMemoryLength,
+ phwi->pwSuspendBuffer + phwi->dwCodeMemoryLength);
+
+ _HeapFree (phwi->pwSuspendBuffer, 0);
+
+ phwi->pwSuspendBuffer = 0;
+
+ kRestartStreams (devc, phwi);
+
+ /* */
+ /* all done, reset halt request flag to resume DSP kernel execution */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_ACKNOWLEDGE, FALSE);
+
+ kDspReset (devc, phwi->dwBaseIO, bData);
+
+ /* Indicate kernel is loaded */
+
+ phwi->dwFlags &= ~(HWI_FLAG_SUSPENDED | HWI_FLAG_UNLOADED);
+
+ return KRETURN_SUCCESS;
+
+} /* kResumeKernel() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kOpenInstance */
+/* */
+/* Description: */
+/* Open a client instance. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwClient */
+/* Client ID */
+/* */
+/* DWORD dwFlags */
+/* KOPENCLOSE_XXX flags indicating open to perform */
+/* */
+/* DWORD dwLen */
+/* Length in bytes of data area of CLIENT_INST (zero allowed) */
+/* */
+/* PCLIENT_INST *ppClient_Inst */
+/* Pointer to PCLIENT_INST that will contain the instance pointer */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kOpenInstance
+ (allegro_devc * devc, PHWI phwi,
+ DWORD dwClient, DWORD dwFlags, DWORD dwLen, PCLIENT_INST * ppClient_Inst)
+{
+ PCLIENT_INST pClient_Inst = NULL;
+ PCLIENT_BIN pClient_Bin = NULL;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kOpenInstance %X %X %X %X\n", phwi,
+ dwClient, dwFlags, dwLen);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+#ifndef NT_MODEL
+ /* */
+ /* FM client is a special case */
+ /* */
+ /* The FM client isn't really a client of the DSP kernel. It requires */
+ /* the entire DSP to execute therefore the DSP kernel must be swapped */
+ /* out of the DSP before it can run. When FM is closed the DSP kernel */
+ /* is reloaded into the DSP. */
+ /* */
+
+ if (dwClient == CLIENT_FM)
+ {
+ DWORD dwClientMasks;
+ DWORD dwConnectMasks;
+ BYTE bData;
+
+ /* Fail if the DSP kernel is not idle */
+
+ if (kQueryActivity (devc, phwi, &dwClientMasks, &dwConnectMasks) !=
+ KRETURN_SUCCESS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (dwClientMasks || dwConnectMasks)
+ return KRETURN_ERROR_BUSY;
+
+ /* */
+ /* Allocate host memory */
+ /* */
+
+ if (!(pClient_Inst = (PCLIENT_INST)
+ _HeapAllocate (sizeof (CLIENT_INST) + dwLen, HEAPZEROINIT)))
+ return KRETURN_ERROR_GENERIC;
+
+ pClient_Inst->dwClient = dwClient;
+
+ *ppClient_Inst = pClient_Inst;
+
+ /* download FM client to DSP memory */
+
+ bData = kDspHalt (devc, phwi->dwBaseIO);
+
+ kDisableFMMap (devc, phwi->dwBaseIO, FALSE);
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->dwCodeMemoryBegin,
+ (gsFMVectCode.dwLengthVect + 1) / 2,
+ gsFMVectCode.pwBinVect);
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ gsFMVectCode.dwCodeAddress,
+ (gsFMVectCode.dwLengthCode + 1) / 2,
+ gsFMVectCode.pwBinCode);
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ phwi->dwDataMemoryBegin,
+ (gsFMVectCode.dwLengthData + 1) / 2,
+ gsFMVectCode.pwBinData);
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ gsFMVectCode.dwData2Address,
+ (gsFMVectCode.dwLengthData2 + 1) / 2,
+ gsFMVectCode.pwBinData2);
+
+ kDspReset (devc, phwi->dwBaseIO, bData);
+
+ /* FM client was successfully loaded, indicate kernel is unloaded */
+
+ phwi->dwFlags |= (HWI_FLAG_FM_LOADED | HWI_FLAG_UNLOADED);
+
+ return KRETURN_SUCCESS;
+ }
+#endif
+
+ /* */
+ /* Do open/close synchronization */
+ /* */
+ /* Generally, an open can safely be done except just after a close. */
+ /* The reason a close might cause a problem is that when a client */
+ /* requests a close, the host-side may close but the DSP-side */
+ /* may be executing AT THAT MOMENT. This means the host-side thinks */
+ /* resources that were formally allocated are now free, whereas on */
+ /* the DSP-side they actually are still in use. So if an open is done, */
+ /* and the open happens to be assigned some of these same resources, a */
+ /* resource conflict arises. For example, the executable of the open */
+ /* client might get downloaded over the still executing close client, */
+ /* likely causing a DSP crash. */
+ /* */
+ /* One way to overcome this danger is by making sure a client task */
+ /* switch has occured SINCE THE CLOSE WAS COMPLETED. A task switch */
+ /* covers the following cases: */
+ /* */
+ /* 1) A DSP-side client is executing just as the kernel closes it. */
+ /* A subsequent task switch means this client is no longer running, */
+ /* so the close is complete and the freed resources are available. */
+ /* */
+ /* 2) A DSP-side client is idle when the kernel closes it. A */
+ /* subsequent task switch to this client either means the client */
+ /* doesn't run at all (client closed) or an instance is not */
+ /* processed at all (instance closed). Thus the resources */
+ /* previously used by the client or instance are freed. */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_TASK_SWITCH, TRUE))
+ return KRETURN_ERROR_BUSY;
+
+ /* */
+ /* Make sure client and an available instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (phwi->asClientTable[dwClient].dwReferenceCount >=
+ phwi->asClientTable[dwClient].dwMaxReference)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Allocate host memory */
+ /* */
+
+ if (!(pClient_Inst = (PCLIENT_INST)
+ _HeapAllocate (sizeof (CLIENT_INST) + dwLen, HEAPZEROINIT)))
+ goto kOpen_Error;
+
+ pClient_Inst->dwClient = dwClient;
+ pClient_Inst->dwDspDataNumUnits =
+ NUM_UNITS (dwLen, phwi->dwDataMemoryUnitLength);
+
+ /* */
+ /* Allocate DSP data memory */
+ /* */
+
+ if (dwLen)
+ {
+ if (!(pClient_Inst->pbDspDataMapPtr =
+ kAllocDspMemory (phwi, NULL,
+ phwi->abDataMemoryMap,
+ pClient_Inst->dwDspDataNumUnits)))
+ goto kOpen_Error;
+
+ pClient_Inst->dwDspDataClientArea =
+ /*LINTED*/
+ ((pClient_Inst->pbDspDataMapPtr - phwi->abDataMemoryMap) *
+ phwi->dwDataMemoryUnitLength) + phwi->dwDataMemoryBegin;
+
+ /* clear DSP client data memory */
+
+ kDspWriteZeros (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea,
+ pClient_Inst->dwDspDataNumUnits *
+ phwi->dwDataMemoryUnitLength);
+
+ /* download client data binary */
+
+ if (!(pClient_Bin = kBinStructAddress (phwi, dwClient, NULL)))
+ goto kOpen_Error;
+
+ /* make sure allocation size can hold data binary */
+
+ if (dwLen < pClient_Bin->dwLengthData)
+ goto kOpen_Error;
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea,
+ (pClient_Bin->dwLengthData + 1) / 2,
+ pClient_Bin->pwBinData);
+
+ /* add instance to instance list */
+ if (dwFlags & KOPENCLOSE_SYNCHRONOUS)
+ /*if ( 0 ) */
+ {
+ DWORD dwReturn;
+
+ /* */
+ /* Make sure DSP kernel is ready to be halted */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, FALSE))
+ goto kOpen_Error;
+
+ /* */
+ /* halt the DSP kernel and wait for an acknowledgement */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_HALT_SYNCH_CLIENT, TRUE);
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, TRUE))
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ goto kOpen_Error;
+ }
+
+ /* */
+ /* DSP kernel has halted, do open */
+ /* */
+ /* Note: We halt the DSP in order to synchronize the open */
+ /* with the client */
+ /* */
+
+ dwReturn = kAddListEntry (devc, phwi,
+ kInstanceListAddress (phwi, dwClient),
+ (WORD) phwi->asClientTable[dwClient].
+ dwInstanceListArea,
+ (WORD) (pClient_Inst->
+ dwDspDataClientArea >>
+ DP_SHIFT_COUNT));
+
+ /* */
+ /* all done, reset halt request flag to resume DSP kernel execution */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_HALT_SYNCH_CLIENT, FALSE);
+
+ if (!dwReturn)
+ goto kOpen_Error;
+ }
+ else
+ {
+ if (!kAddListEntry (devc, phwi,
+ kInstanceListAddress (phwi, dwClient),
+ (WORD) phwi->asClientTable[dwClient].
+ dwInstanceListArea,
+ (WORD) (pClient_Inst->
+ dwDspDataClientArea >> DP_SHIFT_COUNT)))
+ goto kOpen_Error;
+
+ }
+
+
+
+ }
+
+/*#pragma message("----Assuming individual client code binaries are equal length!") */
+
+ phwi->asClientTable[dwClient].dwDspCodeNumUnits =
+ NUM_UNITS (phwi->asClientTable[dwClient].pClient_Bin->dwLengthCode,
+ phwi->dwCodeMemoryUnitLength);
+
+ /* */
+ /* Allocate DSP code memory */
+ /* */
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ {
+ if (!(phwi->asClientTable[dwClient].pbDspCodeMapPtr =
+ kAllocDspMemory (phwi, dwClient,
+ phwi->abCodeMemoryMap,
+ phwi->asClientTable[dwClient].
+ dwDspCodeNumUnits)))
+ goto kOpen_Error;
+
+ phwi->asClientTable[dwClient].dwDspCodeClientArea =
+ /*LINTED*/
+ ((phwi->asClientTable[dwClient].pbDspCodeMapPtr -
+ phwi->abCodeMemoryMap) * phwi->dwCodeMemoryUnitLength) +
+ phwi->dwCodeMemoryBegin;
+
+ pClient_Inst->dwDspCodeClientArea =
+ phwi->asClientTable[dwClient].dwDspCodeClientArea;
+
+ /* clear DSP client code memory */
+
+ kDspWriteZeros (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->asClientTable[dwClient].dwDspCodeClientArea,
+ phwi->asClientTable[dwClient].dwDspCodeNumUnits *
+ phwi->dwCodeMemoryUnitLength);
+
+ /* download client code binary */
+
+ if (!(pClient_Bin = kBinStructAddress (phwi, dwClient,
+ phwi->asClientTable[dwClient].
+ dwDspCodeClientArea)))
+ goto kOpen_Error;
+
+ kDspWriteWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_CODE,
+ phwi->asClientTable[dwClient].dwDspCodeClientArea,
+ (pClient_Bin->dwLengthCode + 1) / 2,
+ pClient_Bin->pwBinCode);
+
+ /* allocate DSP vectors */
+
+ if (!kAllocDspVectors (devc, phwi, dwClient))
+ goto kOpen_Error;
+
+ /* add client to task list */
+
+ if (!kAddListEntry (devc, phwi,
+ phwi->awTaskList,
+ KDATA_TASK0,
+ (WORD) phwi->asClientTable[dwClient].
+ dwDspCodeClientArea))
+ goto kOpen_Error;
+ }
+ else
+ {
+ pClient_Inst->dwDspCodeClientArea =
+ phwi->asClientTable[dwClient].dwDspCodeClientArea;
+ }
+
+ /* */
+ /* Everything worked, increment reference counter */
+ /* */
+
+ ++phwi->asClientTable[dwClient].dwReferenceCount;
+
+ *ppClient_Inst = pClient_Inst;
+#ifdef K_DBG
+ _Debug_Printf_Service ("kOpenInstance OK %X\n", pClient_Inst);
+#endif
+
+ return KRETURN_SUCCESS;
+
+kOpen_Error:
+
+ /* */
+ /* Failure, undo all that was done... */
+ /* */
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ {
+ if (phwi->asClientTable[dwClient].pbDspCodeMapPtr)
+ {
+ kDeallocDspVectors (devc, phwi, dwClient);
+
+ kDeallocDspMemory (phwi->asClientTable[dwClient].pbDspCodeMapPtr,
+ phwi->asClientTable[dwClient].dwDspCodeNumUnits);
+ phwi->asClientTable[dwClient].pbDspCodeMapPtr = NULL;
+ }
+ }
+
+ if (pClient_Inst)
+ {
+ if (pClient_Inst->pbDspDataMapPtr)
+ {
+ kRemoveListEntry (devc, phwi,
+ kInstanceListAddress (phwi, dwClient),
+ (WORD) phwi->asClientTable[dwClient].
+ dwInstanceListArea,
+ (WORD) (pClient_Inst->
+ dwDspDataClientArea >> DP_SHIFT_COUNT));
+
+ kDeallocDspMemory (pClient_Inst->pbDspDataMapPtr,
+ pClient_Inst->dwDspDataNumUnits);
+ }
+
+ _HeapFree (pClient_Inst, 0);
+ }
+#ifdef K_DBG
+ _Debug_Printf_Service ("kOpenInstance Failed\n");
+#endif
+
+ return KRETURN_ERROR_GENERIC;
+
+} /* kOpenInstance() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kCloseInstance */
+/* */
+/* Description: */
+/* Close a client instance. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* DWORD dwFlags */
+/* KOPENCLOSE_XXX flags indicating close to perform */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kCloseInstance (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst,
+ DWORD dwFlags)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kCloseInstance %X %X %X\n", phwi,
+ pClient_Inst, dwFlags);
+
+
+#endif
+#ifndef NT_MODEL
+ /* */
+ /* FM client is a special case */
+ /* */
+
+ if (dwClient == CLIENT_FM)
+ {
+ /* Fail if the FM client isn't open */
+
+ if (!(phwi->dwFlags & HWI_FLAG_FM_LOADED))
+ return KRETURN_ERROR_GENERIC;
+
+ kLoadKernel (devc, phwi, phwi->dwBaseIO, phwi->dwFlags);
+
+ _HeapFree (pClient_Inst, 0);
+
+ /* Indicate kernel is loaded */
+
+ phwi->dwFlags &= ~(HWI_FLAG_FM_LOADED | HWI_FLAG_UNLOADED);
+
+ return KRETURN_SUCCESS;
+ }
+#endif
+
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Do DMA synchronization */
+ /* */
+ /* (see discussion in kOpenInstance) */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_DMA_SWITCH, TRUE))
+ return KRETURN_ERROR_BUSY;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Deallocate memory */
+ /* */
+
+ if (--phwi->asClientTable[dwClient].dwReferenceCount == 0)
+ {
+ /* remove client from task list */
+
+ kRemoveListEntry (devc, phwi,
+ phwi->awTaskList,
+ KDATA_TASK0,
+ (WORD) phwi->asClientTable[dwClient].
+ dwDspCodeClientArea);
+
+ if (!phwi->asClientTable[dwClient].pbDspCodeMapPtr)
+ return KRETURN_ERROR_GENERIC;
+
+ kDeallocDspVectors (devc, phwi, dwClient);
+
+ kDeallocDspMemory (phwi->asClientTable[dwClient].pbDspCodeMapPtr,
+ phwi->asClientTable[dwClient].dwDspCodeNumUnits);
+ phwi->asClientTable[dwClient].pbDspCodeMapPtr = NULL;
+ }
+
+
+ if (!pClient_Inst)
+ return KRETURN_ERROR_GENERIC;
+
+ if (pClient_Inst->pbDspDataMapPtr)
+ {
+ if (dwFlags & KOPENCLOSE_SYNCHRONOUS)
+ /* if ( 0 ) */
+ {
+ /* */
+ /* Make sure DSP kernel is ready to be halted */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, FALSE))
+ goto kClose_Error;
+
+ /* */
+ /* halt the DSP kernel and wait for an acknowledgement */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_HALT_SYNCH_CLIENT, TRUE);
+
+ kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, TRUE);
+
+ kClose_Error:
+
+ /* */
+ /* DSP kernel has halted, do close */
+ /* */
+ /* Note: We halt the DSP in order to synchronize the close */
+ /* with the client */
+ /* */
+
+ kRemoveListEntry (devc, phwi,
+ kInstanceListAddress (phwi, dwClient),
+ (WORD) phwi->asClientTable[dwClient].
+ dwInstanceListArea,
+ (WORD) (pClient_Inst->
+ dwDspDataClientArea >> DP_SHIFT_COUNT));
+
+ /* */
+ /* all done, reset halt request flag to resume DSP kernel execution */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_HALT_SYNCH_CLIENT, FALSE);
+ }
+ else
+ {
+ kRemoveListEntry (devc, phwi,
+ kInstanceListAddress (phwi, dwClient),
+ (WORD) phwi->asClientTable[dwClient].
+ dwInstanceListArea,
+ (WORD) (pClient_Inst->
+ dwDspDataClientArea >> DP_SHIFT_COUNT));
+
+ }
+
+ kDeallocDspMemory (pClient_Inst->pbDspDataMapPtr,
+ pClient_Inst->dwDspDataNumUnits);
+ }
+
+ _HeapFree (pClient_Inst, 0);
+
+ /* */
+ /* Do open/close synchronization */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_TASK_SWITCH, FALSE);
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kCloseInstance OK\n");
+#endif
+ return KRETURN_SUCCESS;
+
+} /* kCloseInstance() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSwitchClient */
+/* */
+/* Description: */
+/* Remove/Add the client from/to the task list. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* DWORD dwFlags */
+/* KENABLE_CLIENT flags adding client back to task list */
+/* KDISABLE_CLIENT flags removing client from task list */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kSwitchClient (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst,
+ DWORD dwFlags)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSwitchClient %X %X %X\n", phwi,
+ pClient_Inst, dwFlags);
+
+
+
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Do DMA synchronization */
+ /* */
+ /* (see discussion in kOpenInstance) */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_DMA_SWITCH, TRUE))
+ return KRETURN_ERROR_BUSY;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (phwi->asClientTable[dwClient].dwReferenceCount != 1)
+ return KRETURN_ERROR_GENERIC;
+
+ if (dwFlags == KDISABLE_CLIENT)
+ {
+ /* remove client from task list */
+
+ kRemoveListEntry (devc, phwi,
+ phwi->awTaskList,
+ KDATA_TASK0,
+ (WORD) phwi->asClientTable[dwClient].
+ dwDspCodeClientArea);
+
+ }
+ else
+ {
+ if (dwFlags == KENABLE_CLIENT)
+ {
+ /* add client to task list */
+
+ if (!kAddListEntry (devc, phwi,
+ phwi->awTaskList,
+ KDATA_TASK0,
+ (WORD) phwi->asClientTable[dwClient].
+ dwDspCodeClientArea))
+ {
+ return KRETURN_ERROR_GENERIC;
+ }
+
+ }
+ else
+ {
+ return KRETURN_ERROR_GENERIC;
+ } /* endif */
+ } /* endif */
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSwitchClient OK\n");
+#endif
+
+ return KRETURN_SUCCESS;
+
+} /* kSwitchClient() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetInstanceReady */
+/* */
+/* Description: */
+/* Set a client instance to the ready state. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kSetInstanceReady (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSetInstanceReady %X %x\n", phwi, pClient_Inst);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Set the instance ready flag */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_INSTANCE_READY, TRUE);
+
+ return KRETURN_SUCCESS;
+
+} /* kSetInstanceReady() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetInstanceNotReady */
+/* */
+/* Description: */
+/* Set a client instance to the not ready state. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kSetInstanceNotReady (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSetInstanceNotReady %X %x\n", phwi, pClient_Inst);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Clear the instance ready flag */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_INSTANCE_READY, FALSE);
+
+ return KRETURN_SUCCESS;
+
+} /* kSetInstanceNotReady() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kStartTransfer */
+/* */
+/* Description: */
+/* Start data transfer to/from client instance data memory. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* DWORD dwAutoRepeat */
+/* TRUE if auto-repeat buffer, FALSE if one-shot buffer */
+/* */
+/* DWORD dwHostSrcBufferAddr */
+/* Host source buffer physical address */
+/* */
+/* DWORD dwHostSrcBufferLen */
+/* Host source buffer length in bytes */
+/* */
+/* DWORD dwHostDstBufferAddr */
+/* Host destination buffer linear address */
+/* */
+/* DWORD dwHostDstBufferLen */
+/* Host destination buffer length in bytes */
+/* */
+/* DWORD dwDSPInBufferAddr */
+/* DSP input buffer absolute address */
+/* */
+/* DWORD dwDSPInBufferLen */
+/* DSP input buffer length in bytes */
+/* */
+/* DWORD dwDSPOutBufferAddr */
+/* DSP output buffer absolute address */
+/* */
+/* DWORD dwDSPOutBufferLen */
+/* DSP output buffer length in bytes */
+/* */
+/* DWORD dwDSPInConnection */
+/* KCONNECT_XXX indicating input connection */
+/* */
+/* DWORD dwDSPOutConnection */
+/* KCONNECT_XXX indicating output connection */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kStartTransfer
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ DWORD dwAutoRepeat,
+ DWORD dwHostSrcBufferAddr,
+ DWORD dwHostSrcBufferLen,
+ DWORD dwHostDstBufferAddr,
+ DWORD dwHostDstBufferLen,
+ DWORD dwDSPInBufferAddr,
+ DWORD dwDSPInBufferLen,
+ DWORD dwDSPOutBufferAddr,
+ DWORD dwDSPOutBufferLen, DWORD dwDSPInConnection, DWORD dwDSPOutConnection)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+ DWORD dwDspDataClientArea = pClient_Inst->dwDspDataClientArea;
+
+#ifdef K_DBG
+ _Debug_Printf_Service
+ ("kStartTransfer %X %X %X %X %X %X %X %X %X %X %X %X %X\n", phwi,
+ pClient_Inst, dwAutoRepeat, dwHostSrcBufferAddr, dwHostSrcBufferLen,
+ dwHostDstBufferAddr, dwHostDstBufferLen, dwDSPInBufferAddr,
+ dwDSPInBufferLen, dwDSPOutBufferAddr, dwDSPOutBufferLen,
+ dwDSPInConnection, dwDSPOutConnection);
+
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+
+ if ((dwDSPInConnection == KCONNECT_DMA) ||
+ (dwDSPOutConnection == KCONNECT_DMA))
+ {
+ /* */
+ /* Do DMA synchronization */
+ /* */
+ /* (see discussion in kOpenInstance) */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_DMA_SWITCH, TRUE))
+ return KRETURN_ERROR_BUSY;
+ }
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Verify input connection parameters */
+ /* */
+
+ if ((dwDSPInConnection != KCONNECT_NONE) &&
+ (dwDSPInConnection != KCONNECT_SAME))
+ {
+ if (!dwDSPInBufferLen)
+ return KRETURN_ERROR_GENERIC;
+
+ /* DSP buffer length must be block multiple */
+
+ if (dwDSPInBufferLen & (DMA_BLOCK_LENGTH - 1))
+ return KRETURN_ERROR_GENERIC;
+
+ if (dwDSPInConnection == KCONNECT_DMA)
+ {
+ /* host buffer must be DWORD aligned */
+
+ if (dwHostSrcBufferAddr & (sizeof (DWORD) - 1))
+ return KRETURN_ERROR_GENERIC;
+
+ if (!dwHostSrcBufferLen)
+ return KRETURN_ERROR_GENERIC;
+ }
+ }
+
+ /* */
+ /* Verify output connection parameters */
+ /* */
+
+ if ((dwDSPOutConnection != KCONNECT_NONE) &&
+ (dwDSPOutConnection != KCONNECT_SAME))
+ {
+ if (!dwDSPOutBufferLen)
+ return KRETURN_ERROR_GENERIC;
+
+ /* DSP buffer length must be block multiple */
+
+ if (dwDSPOutBufferLen & (DMA_BLOCK_LENGTH - 1))
+ return KRETURN_ERROR_GENERIC;
+
+ if ((dwDSPOutConnection == KCONNECT_DMA) ||
+ (dwDSPOutConnection == KCONNECT_PIO))
+ {
+ /* host buffer must be DWORD aligned */
+
+ if (dwHostDstBufferAddr & (sizeof (DWORD) - 1))
+ return KRETURN_ERROR_GENERIC;
+
+ if (!dwHostDstBufferLen)
+ return KRETURN_ERROR_GENERIC;
+ }
+ }
+
+ pClient_Inst->dwHostSrcBufferAddr = dwHostSrcBufferAddr;
+ pClient_Inst->dwHostSrcBufferLen = dwHostSrcBufferLen;
+ pClient_Inst->dwHostDstBufferAddr = dwHostDstBufferAddr;
+ pClient_Inst->dwHostDstBufferLen = dwHostDstBufferLen;
+ pClient_Inst->dwHostDstCurrent = dwHostDstBufferAddr;
+ pClient_Inst->dwDSPOutBufferAddr = dwDSPOutBufferAddr;
+ pClient_Inst->dwDSPOutBufferLen = dwDSPOutBufferLen;
+ pClient_Inst->dwDSPInConnection = dwDSPInConnection;
+ pClient_Inst->dwDSPOutConnection = dwDSPOutConnection;
+
+ /* */
+ /* Write parameters to client instance memory */
+ /* */
+
+ if (dwDSPInConnection == KCONNECT_DMA)
+ {
+ /* host source */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_ADDRL,
+ LOWORD (dwHostSrcBufferAddr));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_ADDRH,
+ HIWORD (dwHostSrcBufferAddr));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_END_PLUS_1L,
+ LOWORD (dwHostSrcBufferAddr + dwHostSrcBufferLen));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_END_PLUS_1H,
+ HIWORD (dwHostSrcBufferAddr + dwHostSrcBufferLen));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_CURRENTL,
+ LOWORD (dwHostSrcBufferAddr));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_CURRENTH,
+ HIWORD (dwHostSrcBufferAddr));
+ }
+
+/*#pragma message("----Stream loopback not supported!") */
+
+ else if (dwDSPOutConnection == KCONNECT_DMA)
+ {
+ /* host destination */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_ADDRL,
+ LOWORD (dwHostDstBufferAddr));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_ADDRH,
+ HIWORD (dwHostDstBufferAddr));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_END_PLUS_1L,
+ LOWORD (dwHostDstBufferAddr + dwHostDstBufferLen));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_END_PLUS_1H,
+ HIWORD (dwHostDstBufferAddr + dwHostDstBufferLen));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_CURRENTL,
+ LOWORD (dwHostDstBufferAddr));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_HOST_SRC_CURRENTH,
+ HIWORD (dwHostDstBufferAddr));
+ }
+
+ /* DSP input */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_IN_BUF_BEGIN,
+ (WORD) dwDSPInBufferAddr);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_IN_BUF_END_PLUS_1,
+ (WORD) (dwDSPInBufferAddr + (dwDSPInBufferLen / 2)));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_IN_BUF_HEAD,
+ (WORD) dwDSPInBufferAddr);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_IN_BUF_TAIL,
+ (WORD) dwDSPInBufferAddr);
+
+ /* DSP output */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_OUT_BUF_BEGIN,
+ (WORD) dwDSPOutBufferAddr);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_OUT_BUF_END_PLUS_1,
+ (WORD) (dwDSPOutBufferAddr + (dwDSPOutBufferLen / 2)));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_OUT_BUF_HEAD,
+ (WORD) dwDSPOutBufferAddr);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_OUT_BUF_TAIL,
+ (WORD) dwDSPOutBufferAddr);
+
+ /* connect the input and output */
+
+ if (dwDSPInConnection == KCONNECT_DMA)
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_DMA_CONTROL,
+ (WORD) (dwAutoRepeat ?
+ (DMACONTROL_AUTOREPEAT + DMAC_PAGE3_SELECTOR +
+ DMAC_BLOCKF_SELECTOR) : (DMAC_PAGE3_SELECTOR +
+ DMAC_BLOCKF_SELECTOR)));
+ }
+
+/*#pragma message("----Stream loopback not supported!") */
+
+ /* */
+ /* The kernel currently does not support stream loopback. */
+ /* Loopback means data is tranfered via DMA from the host to the */
+ /* DSP, then the data is transfered via DMA from the DSP back to */
+ /* the host. While the data is in DSP memory it is filtered in */
+ /* some way. Thus the DSP acts as a hardware accelerator by */
+ /* off-loading filter processing from the host processor. */
+ /* */
+
+ else if (dwDSPOutConnection == KCONNECT_DMA)
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwDspDataClientArea + CDATA_DMA_CONTROL,
+ (WORD) (dwAutoRepeat ?
+ (DMACONTROL_DIRECTION + DMACONTROL_AUTOREPEAT +
+ DMAC_PAGE3_SELECTOR +
+ DMAC_BLOCKF_SELECTOR) : (DMACONTROL_DIRECTION +
+ DMAC_PAGE3_SELECTOR +
+ DMAC_BLOCKF_SELECTOR)));
+ }
+
+ if (!kConnectInputOutput (devc, phwi,
+ dwDSPInConnection,
+ dwDSPOutConnection, dwDspDataClientArea))
+ return KRETURN_ERROR_GENERIC;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kStartTransfer OK\n");
+#endif
+ return KRETURN_SUCCESS;
+
+} /* kStartTransfer() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kStopTransfer */
+/* */
+/* Description: */
+/* Stop data transfer to/from client instance data memory. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kStopTransfer (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kStopTransfer %X %X\n", phwi, pClient_Inst);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* disconnect the input and output */
+ /* */
+
+ if (!kDisconnectInputOutput (devc, phwi,
+ pClient_Inst->dwDSPInConnection,
+ pClient_Inst->dwDSPOutConnection,
+ pClient_Inst->dwDspDataClientArea))
+ return KRETURN_ERROR_GENERIC;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kStopTransfer OK\n");
+#endif
+ return KRETURN_SUCCESS;
+
+} /* kStopTransfer() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kAlterTransfer */
+/* */
+/* Description: */
+/* Alter a client's DMA transfer. */
+/* */
+/* When altering a client's current stream position, a position */
+/* equal to 0 indicates the first byte in the buffer. A position */
+/* equal to dwHostXXXBufferLen-1 indicates the last byte in the */
+/* buffer. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* DWORD dwFlags */
+/* KALTER_XXX flags indicating alterations to perform */
+/* */
+/* DWORD dwAutoRepeat */
+/* TRUE if auto-repeat buffer, FALSE if one-shot buffer */
+/* */
+/* DWORD dwPosition */
+/* The byte position to set */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kAlterTransfer
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ DWORD dwFlags, DWORD dwAutoRepeat, DWORD dwPosition)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+ WORD wDmaControl;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kAlterTransfer %X %X %X %X %X\n", phwi,
+ pClient_Inst, dwFlags, dwAutoRepeat, dwPosition);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Make sure DSP kernel is ready to be halted */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, FALSE))
+ return KRETURN_ERROR_BUSY;
+
+ /* */
+ /* halt the DSP kernel and wait for an acknowledgement */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_DMA, TRUE);
+
+ if (!kStateExists (devc, phwi, KDATA_HALT_ACKNOWLEDGE, TRUE))
+ {
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_DMA, FALSE);
+
+ return KRETURN_ERROR_BUSY;
+ }
+
+ /* */
+ /* DSP kernel has halted, do DMA alterations */
+ /* */
+ /* Note: We halt the DSP in order to synchronize the alterations */
+ /* with the DMA state machine */
+ /* */
+
+ if (dwFlags & KALTER_AUTOREPEAT)
+ {
+ wDmaControl = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea +
+ CDATA_DMA_CONTROL);
+
+ wDmaControl &= ~(DMACONTROL_STOPPED | DMACONTROL_AUTOREPEAT);
+
+ if (dwAutoRepeat)
+ wDmaControl |= DMACONTROL_AUTOREPEAT;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea + CDATA_DMA_CONTROL,
+ wDmaControl);
+ }
+
+ if (dwFlags & KALTER_POSITION)
+ {
+ /* */
+ /* Position alterations are only permitted on playback streams... */
+ /* */
+
+ if (pClient_Inst->dwDSPInConnection == KCONNECT_DMA)
+ {
+ dwPosition += pClient_Inst->dwHostSrcBufferAddr;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea +
+ CDATA_HOST_SRC_CURRENTL, LOWORD (dwPosition));
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea +
+ CDATA_HOST_SRC_CURRENTH, HIWORD (dwPosition));
+ }
+ }
+
+ /* */
+ /* all done, reset halt request flag to resume DSP kernel execution */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_HALT_SYNCH_DMA, FALSE);
+
+ return KRETURN_SUCCESS;
+
+} /* kAlterTransfer() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSwitchPINConnection */
+/* */
+/* Description: */
+/* Switch data transfer PIN connection to/from client instance data memory. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* DWORD dwDSPInConnection */
+/* KCONNECT_XXX indicating input connection */
+/* */
+/* DWORD dwDSPOutConnection */
+/* KCONNECT_XXX indicating output connection */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kSwitchPINConnection
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ DWORD dwDSPInConnection, DWORD dwDSPOutConnection)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+ DWORD dwDspDataClientArea = pClient_Inst->dwDspDataClientArea;
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSwitchPINConnection %X %X %X %X \n",
+ phwi,
+ pClient_Inst, dwDSPInConnection, dwDSPOutConnection);
+
+#endif
+
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure connections are valid... */
+ /* */
+
+ if (dwDSPInConnection >= NUMBER_OF_CONNECTIONS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (dwDSPOutConnection >= NUMBER_OF_CONNECTIONS)
+ return KRETURN_ERROR_GENERIC;
+
+ if ((dwDSPInConnection == KCONNECT_DMA) ||
+ (dwDSPOutConnection == KCONNECT_DMA))
+ {
+ /* */
+ /* Do DMA synchronization */
+ /* */
+ /* DMA engine is not switchable at this moment!!! */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_DMA_SWITCH, TRUE))
+ return KRETURN_ERROR_BUSY;
+ }
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+
+ /* */
+ /* disconnect the input and output first */
+ /* */
+
+ if (!kDisconnectInputOutput (devc, phwi,
+ pClient_Inst->dwDSPInConnection,
+ pClient_Inst->dwDSPOutConnection,
+ pClient_Inst->dwDspDataClientArea))
+ return KRETURN_ERROR_GENERIC;
+
+
+ /* */
+ /* update PIN connection */
+ /* */
+
+ if (dwDSPInConnection != KCONNECT_SAME)
+ pClient_Inst->dwDSPInConnection = dwDSPInConnection;
+
+ if (dwDSPOutConnection != KCONNECT_SAME)
+ pClient_Inst->dwDSPOutConnection = dwDSPOutConnection;
+
+
+ /* */
+ /* Finally, connect updated PIN */
+ /* */
+
+ if (!kConnectInputOutput (devc, phwi,
+ pClient_Inst->dwDSPInConnection,
+ pClient_Inst->dwDSPOutConnection,
+ dwDspDataClientArea))
+ return KRETURN_ERROR_GENERIC;
+
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSwitchPINConnection OK\n");
+#endif
+ return KRETURN_SUCCESS;
+
+} /* kSwitchPINConnection() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kQueryActivity */
+/* */
+/* Description: */
+/* Indicate what clients and/or connections are active */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PDWORD pdwClientMasks */
+/* Pointer to DWORD that will contain MASK_CLIENT_XXX masks */
+/* */
+/* PDWORD pdwConnectMasks */
+/* Pointer to DWORD that will contain MASK_KCONNECT_XXX masks */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kQueryActivity
+ (allegro_devc * devc, PHWI phwi, PDWORD pdwClientMasks,
+ PDWORD pdwConnectMasks)
+{
+ DWORD dwClient;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kQueryActivity %X %X %X\n", phwi,
+ pdwClientMasks, pdwConnectMasks);
+
+
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Check if any client instance is defined */
+ /* */
+
+ *pdwClientMasks = 0;
+
+ for (dwClient = 0; dwClient < NUMBER_OF_CLIENTS; ++dwClient)
+ {
+ if (phwi->asClientTable[dwClient].dwReferenceCount)
+ {
+ *pdwClientMasks |= (1 << dwClient);
+ }
+ }
+
+ /* */
+ /* Check if any connections are defined */
+ /* */
+
+ *pdwConnectMasks = 0;
+
+ if (phwi->awVirtualDMAList[0])
+ *pdwConnectMasks |= MASK_KCONNECT_DMA;
+
+ if (phwi->awVirtualADC1List[0])
+ *pdwConnectMasks |= MASK_KCONNECT_ADC1;
+
+ if (phwi->awVirtualADC2List[0])
+ *pdwConnectMasks |= MASK_KCONNECT_ADC2;
+
+ if (phwi->awVirtualI2SList[0])
+ *pdwConnectMasks |= MASK_KCONNECT_I2S;
+
+ if (phwi->awVirtualCHIList[0])
+ *pdwConnectMasks |= MASK_KCONNECT_CHI;
+
+ if (kDspReadWord
+ (devc, phwi->dwBaseIO, MEMTYPE_INTERNAL_DATA, KDATA_SPDIF_XFER))
+ *pdwConnectMasks |= MASK_KCONNECT_SPDIF;
+
+ if (phwi->awVirtualMIXERList[0])
+ *pdwConnectMasks |= MASK_KCONNECT_MIXER;
+
+#if 0
+#if (NUMBER_OF_CONNECTIONS != 0x10)
+#error Assumption about number of connections failed.
+#endif
+#endif
+
+ return KRETURN_SUCCESS;
+
+} /* kQueryActivity() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetTimer */
+/* */
+/* Description: */
+/* Set the DSP to Host interrupt time interval */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwTimeInterval */
+/* Number of APU interrupts per DSP to Host interrupt */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kSetTimer (allegro_devc * devc, PHWI phwi, DWORD dwTimeInterval)
+{
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSetTimer %X %X\n", phwi, dwTimeInterval);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Check time interval size */
+ /* */
+
+ if (HIWORD (dwTimeInterval))
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Write timer values */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_TIMER_COUNT_RELOAD, (WORD) dwTimeInterval);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_TIMER_COUNT_CURRENT, (WORD) dwTimeInterval);
+
+ return KRETURN_SUCCESS;
+
+} /* kSetTimer() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kOpenPassThru */
+/* */
+/* Description: */
+/* Open a pass through. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PPASSTHRU *ppPassThru */
+/* Pointer to PPASSTHRU that will contain the pass through pointer */
+/* */
+/* DWORD dwDSPInConnection */
+/* KCONNECT_XXX indicating input connection */
+/* */
+/* DWORD dwDSPOutConnection */
+/* KCONNECT_XXX indicating output connection */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kOpenPassThru
+ (allegro_devc * devc, PHWI phwi,
+ PPASSTHRU * ppPassThru, DWORD dwDSPInConnection, DWORD dwDSPOutConnection)
+{
+ PPASSTHRU pPassThru = NULL;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kOpenPassThru %X %X <-> %X\n", phwi,
+ dwDSPInConnection, dwDSPOutConnection);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure connections are valid... */
+ /* */
+
+ if ((dwDSPInConnection == KCONNECT_NONE) ||
+ (dwDSPInConnection == KCONNECT_SAME) ||
+ (dwDSPInConnection >= NUMBER_OF_CONNECTIONS))
+ return KRETURN_ERROR_GENERIC;
+
+ if ((dwDSPOutConnection == KCONNECT_NONE) ||
+ (dwDSPOutConnection == KCONNECT_SAME) ||
+ (dwDSPOutConnection >= NUMBER_OF_CONNECTIONS))
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Do open/close synchronization */
+ /* */
+
+ if (!kStateExists (devc, phwi, KDATA_TASK_SWITCH, TRUE))
+ return KRETURN_ERROR_BUSY;
+
+ /* */
+ /* Allocate host memory */
+ /* */
+
+ if (!(pPassThru = (PPASSTHRU)
+ _HeapAllocate (sizeof (PASSTHRU), HEAPZEROINIT)))
+ return KRETURN_ERROR_GENERIC;
+
+ pPassThru->dwDSPInConnection = dwDSPInConnection;
+ pPassThru->dwDSPOutConnection = dwDSPOutConnection;
+
+ /* */
+ /* Handle directly mixed (i.e. non-buffered) connections */
+ /* */
+
+ if (dwDSPOutConnection == KCONNECT_SPDIF)
+ {
+ kConnectDirectMixer (devc, phwi, dwDSPInConnection, dwDSPOutConnection,
+ TRUE);
+ }
+ else
+ {
+ if (dwDSPOutConnection == KCONNECT_MIXER)
+ {
+ switch (dwDSPInConnection)
+ {
+ case KCONNECT_ADC1:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC1_MIXER_REQUEST, TRUE);
+ break;
+ case KCONNECT_ADC2:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC2_MIXER_REQUEST, TRUE);
+ break;
+
+ case KCONNECT_CD:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_CD_MIXER_REQUEST, TRUE);
+ break;
+
+ case KCONNECT_MIC:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_MIC_MIXER_REQUEST, TRUE);
+ break;
+
+ default:
+ goto kOpen_Error;
+ } /* endswitch */
+ } /* endif */
+
+ }
+
+ /* */
+ /* Everything worked */
+ /* */
+
+ *ppPassThru = pPassThru;
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kOpenPassThru OK %X\n", pPassThru);
+#endif
+ return KRETURN_SUCCESS;
+
+kOpen_Error:
+
+ /* */
+ /* Failure, undo all that was done... */
+ /* */
+
+ if (pPassThru)
+ {
+ _HeapFree (pPassThru, 0);
+ }
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kOpenPassThru Failed\n");
+#endif
+ return KRETURN_ERROR_GENERIC;
+
+} /* kOpenPassThru() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kClosePassThru */
+/* */
+/* Description: */
+/* Close a pass through. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PPASSTHRU pPassThru */
+/* Pointer to pass through */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kClosePassThru (allegro_devc * devc, PHWI phwi, PPASSTHRU pPassThru)
+{
+#ifdef K_DBG
+ _Debug_Printf_Service ("kClosePassThru %X %X\n", phwi, pPassThru);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Deallocate memory */
+ /* */
+
+ if (!pPassThru)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Handle directly mixed (i.e. non-buffered) connections */
+ /* */
+
+ if (pPassThru->dwDSPOutConnection == KCONNECT_SPDIF)
+ {
+ kConnectDirectMixer (devc, phwi,
+ pPassThru->dwDSPInConnection,
+ pPassThru->dwDSPOutConnection, FALSE);
+ }
+ else
+ {
+ if (pPassThru->dwDSPOutConnection == KCONNECT_MIXER)
+ {
+ switch (pPassThru->dwDSPInConnection)
+ {
+ case KCONNECT_ADC1:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC1_MIXER_REQUEST, FALSE);
+ break;
+
+ case KCONNECT_ADC2:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC2_MIXER_REQUEST, FALSE);
+ break;
+
+ case KCONNECT_CD:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_CD_MIXER_REQUEST, FALSE);
+ break;
+
+ case KCONNECT_MIC:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_MIC_MIXER_REQUEST, FALSE);
+ break;
+
+ } /* endswitch */
+
+ } /* endif */
+
+ }
+
+ _HeapFree (pPassThru, 0);
+
+ /* */
+ /* Do open/close synchronization */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_TASK_SWITCH, FALSE);
+
+ return KRETURN_SUCCESS;
+
+} /* kClosePassThru() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetVolume */
+/* */
+/* Description: */
+/* Set a client's current stream left/right Volume. */
+/* Maximum is 0x7FFF and Minimum is 0x0000. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* WORD wLeftVolume */
+/* 16 bit constant for left channel volume */
+/* */
+/* WORD wRightVolume */
+/* 16 bit constant for right channel volume */
+/* */
+/* WORD wBoosterMode */
+/* TRUE activates a broader range of volume setting. */
+/* In this mode, 7FFF represents 18dB gain */
+/* 1000 represents 0dB gain */
+/* 0 represents -Inf gain(mute) */
+/* FALSE supports only an attenuation mode. */
+/* In this mode, 7FFF represents 0dB gain */
+/* 0 represents -Inf gain(mute) */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kSetVolume
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst,
+ WORD wLeftVolume, WORD wRightVolume, WORD wBoosterMode)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+
+#if 0
+ WORD wCurLVol, wCurRVol, wLTemp, wRTemp;
+#endif
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSetVolume %X %X %X %X\n",
+ phwi, pClient_Inst, wLeftVolume, wRightVolume);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+#if 0 /* micro step the volume */
+ wCurLVol = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_LEFT_VOLUME);
+
+ wCurRVol = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_RIGHT_VOLUME);
+
+ /* need to do micro steps to avoid zipper noise */
+ /* max 7 steps */
+ wLTemp = wLeftVolume;
+ wRTemp = wRightVolume;
+
+
+ wCurLVol &= 0xF000;
+ wCurLVol |= (wLeftVolume & 0x0FFF);
+
+ if (wCurLVol < wLeftVolume)
+ {
+ wLeftVolume = wCurLVol;
+ wCurLVol = wLTemp;
+ } /* endif */
+
+ do
+ {
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_LEFT_VOLUME, wCurLVol);
+
+ kDelayNMicroseconds (10);
+ wCurLVol -= 0x800;
+ }
+ while (wCurLVol > wLeftVolume);
+
+ wCurRVol &= 0xF000;
+ wCurRVol |= (wRightVolume & 0x0FFF);
+
+ if (wCurRVol < wRightVolume)
+ {
+ wRightVolume = wCurRVol;
+ wCurRVol = wRTemp;
+ } /* endif */
+
+ do
+ {
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_RIGHT_VOLUME, wCurRVol);
+
+ kDelayNMicroseconds (10);
+ wCurRVol -= 0x800;
+ }
+ while (wCurRVol > wRightVolume);
+
+ wLeftVolume = wLTemp;
+ wRightVolume = wRTemp;
+#endif
+ /* */
+ /* write left/right word of current stream volume */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_LEFT_VOLUME, -wLeftVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_RIGHT_VOLUME, -wRightVolume);
+
+ /* */
+ /* tell the client whether this is broader range */
+ /* of volume setting or not */
+ /* */
+
+ if (wBoosterMode)
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_HEADER_LEN + 23, TRUE);
+ else
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_HEADER_LEN + 23, FALSE);
+
+
+ return KRETURN_SUCCESS;
+
+} /* kSetVolume() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetRearVolume */
+/* */
+/* Description: */
+/* Set a client's current stream rear left/rear right Volume. */
+/* Maximum is 0x7FFF and Minimum is 0x0000. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* WORD wLeftRearVolume */
+/* 16 bit constant for rear left channel volume */
+/* */
+/* WORD wRightRearVolume */
+/* 16 bit constant for rear right channel volume */
+/* */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kSetRearVolume
+ (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst, WORD wLeftRearVolume, WORD wRightRearVolume)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+
+
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSetVolume %X %X %X %X\n",
+ phwi,
+ pClient_Inst, wLeftRearVolume, wRightRearVolume);
+#endif
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* write rear left/rear right word of current stream volume */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_LEFT_SUR_VOL, wLeftRearVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_RIGHT_SUR_VOL, wRightRearVolume);
+
+ return KRETURN_SUCCESS;
+
+} /* kSetRearVolume() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetPassThruVolume */
+/* */
+/* Description: */
+/* Set a passthrough instance volume. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PPASSTHRU *ppPassThru */
+/* Pointer to PPASSTHRU that will contain the pass through pointer */
+/* */
+/* WORD wLeftVolume */
+/* 16 bit constant for left channel volume */
+/* */
+/* WORD wRightVolume */
+/* 16 bit constant for right channel volume */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+KRETURN kSetPassThruVolume
+ (allegro_devc * devc, PHWI phwi, PPASSTHRU pPassThru, WORD wLeftVolume,
+ WORD wRightVolume)
+{
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* pPassThru -> wLeftVolume = wLeftVolume ; */
+ /* pPassThru -> wRightVolume = wRightVolume ; */
+
+ switch (pPassThru->dwDSPInConnection)
+ {
+ case KCONNECT_ADC1:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC1_LEFT_VOLUME, wLeftVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC1_RIGHT_VOLUME, wRightVolume);
+
+ break;
+
+ case KCONNECT_ADC2:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC2_LEFT_VOLUME, wLeftVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC2_RIGHT_VOLUME, wRightVolume);
+
+ break;
+
+ case KCONNECT_CD:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_CD_LEFT_VOLUME, wLeftVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_CD_RIGHT_VOLUME, wRightVolume);
+ break;
+
+ case KCONNECT_MIC:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_MIC_VOLUME, wLeftVolume);
+
+ break;
+
+ default:
+ return KRETURN_ERROR_GENERIC;
+ } /* endswitch */
+
+
+ return KRETURN_SUCCESS;
+
+} /* kSetPassThruVolume */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetPassThruRearVolume */
+/* */
+/* Description: */
+/* Set a passthrough instance's rear volume. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PPASSTHRU *ppPassThru */
+/* Pointer to PPASSTHRU that will contain the pass through pointer */
+/* */
+/* WORD wLeftRearVolume */
+/* 16 bit constant for left rear channel volume */
+/* */
+/* WORD wRightRearVolume */
+/* 16 bit constant for right rear channel volume */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+KRETURN kSetPassThruRearVolume
+ (allegro_devc * devc, PHWI phwi,
+ PPASSTHRU pPassThru, WORD wLeftRearVolume, WORD wRightRearVolume)
+{
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ switch (pPassThru->dwDSPInConnection)
+ {
+ case KCONNECT_ADC1:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC1_LEFT_SUR_VOL, wLeftRearVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC1_RIGHT_SUR_VOL, wRightRearVolume);
+
+ break;
+
+
+ case KCONNECT_ADC2:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC2_LEFT_SUR_VOL, wLeftRearVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_ADC2_RIGHT_SUR_VOL, wRightRearVolume);
+
+ break;
+
+ case KCONNECT_CD:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_CD_LEFT_SUR_VOL, wLeftRearVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_CD_RIGHT_SUR_VOL, wRightRearVolume);
+ break;
+
+ case KCONNECT_MIC:
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_MIC_SUR_VOL, wLeftRearVolume);
+
+ break;
+
+ default:
+ return KRETURN_ERROR_GENERIC;
+ } /* endswitch */
+
+
+ return KRETURN_SUCCESS;
+
+} /* kSetPassThruRearVolume */
+
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetMasterVolume */
+/* */
+/* Description: */
+/* Set master volume. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* WORD wLeftVolume */
+/* 16 bit constant for left channel volume */
+/* */
+/* WORD wRightVolume */
+/* 16 bit constant for right channel volume */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+KRETURN
+kSetMasterVolume (allegro_devc * devc, PHWI phwi, WORD wLeftVolume,
+ WORD wRightVolume)
+{
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_DAC_LEFT_VOLUME, wLeftVolume);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_DAC_RIGHT_VOLUME, wRightVolume);
+
+ return KRETURN_SUCCESS;
+
+} /* kSetMasterVolume */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kSetFrequency */
+/* */
+/* Description: */
+/* Set a client's current stream sampling frequency. */
+/* 48khz is corresponding to 0x7FFF */
+/* 0 hz is corresponding to 0x0000 */
+/* The other frequencies are linear mapping between those two */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* WORD wFrequency */
+/* 16 bit constant for sampling frequency */
+/* */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kSetFrequency (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst,
+ WORD wFrequency)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+#ifdef K_DBG
+ _Debug_Printf_Service ("kSetVolume %X %X %X\n", phwi,
+ pClient_Inst, wFrequency);
+#endif
+
+
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* write left/right word of current stream sampling frequency */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_FREQUENCY, wFrequency);
+
+ return KRETURN_SUCCESS;
+
+} /* kSetFrequency */
+
+
+/**************************************************************************** */
+/* The following is unique to M2/M2E only */
+/**************************************************************************** */
+#ifdef PIOREC
+/*-------------------------------------------------------------------------- */
+/* */
+/* DWORD kCopyLinearToCircular */
+/* */
+/* Description: */
+/* Copy data from a linear DSP output buffer to a potentially */
+/* circular host destination buffer. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* DWORD dwMemAddr */
+/* Memory address to read from. */
+/* */
+/* DWORD dwMemLen */
+/* Number of WORDs to read from specified address. */
+/* */
+/* DWORD dwHostAddr */
+/* Host memory address to write to. */
+/* */
+/* DWORD dwHostBase */
+/* Base address of host buffer. */
+/* */
+/* DWORD dwHostLen */
+/* Length in bytes of host buffer. */
+/* */
+/* Return (DWORD): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+DWORD kCopyLinearToCircular
+ (allegro_devc * devc, PHWI phwi,
+ DWORD dwMemAddr,
+ DWORD dwMemLen, DWORD dwHostAddr, DWORD dwHostBase, DWORD dwHostLen)
+{
+ DWORD dwPreWrapLen;
+
+ /* */
+ /* copy DSP buffer data to host buffer */
+ /* */
+
+ if ((dwHostAddr + (dwMemLen * sizeof (WORD))) <= (dwHostBase + dwHostLen))
+ {
+ /* */
+ /* host buffer won't wrap, do straight copy */
+ /* */
+
+ kDspReadWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwMemAddr, dwMemLen, (PWORD) dwHostAddr);
+ }
+ else
+ {
+ dwPreWrapLen = (dwHostBase + dwHostLen - dwHostAddr) / sizeof (WORD);
+
+ /* */
+ /* host buffer will wrap, do pre-wrap copy */
+ /* */
+
+ kDspReadWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwMemAddr, dwPreWrapLen, (PWORD) dwHostAddr);
+
+ /* */
+ /* do post-wrap copy */
+ /* */
+
+ kDspReadWords (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ dwMemAddr + dwPreWrapLen,
+ dwMemLen - dwPreWrapLen, (PWORD) dwHostBase);
+ }
+
+ /* */
+ /* update current host pointer and check for wrap */
+ /* */
+
+ dwHostAddr += (dwMemLen * sizeof (WORD));
+
+ if (dwHostAddr >= (dwHostBase + dwHostLen))
+ {
+ dwHostAddr = dwHostBase + (dwHostAddr - (dwHostBase + dwHostLen));
+ }
+
+ return dwHostAddr;
+
+} /* kCopyLinearToCircular() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kPIOInterruptHandler */
+/* */
+/* Description: */
+/* PIO data available interrupt handler. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID
+kPIOInterruptHandler (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst)
+{
+ DWORD dwHostDstBufferAddr = pClient_Inst->dwHostDstBufferAddr;
+ DWORD dwHostDstBufferLen = pClient_Inst->dwHostDstBufferLen;
+ DWORD dwHostDstCurrent = pClient_Inst->dwHostDstCurrent;
+ DWORD dwDSPOutBufferAddr = pClient_Inst->dwDSPOutBufferAddr;
+ DWORD dwDSPOutBufferLen = pClient_Inst->dwDSPOutBufferLen;
+ DWORD dwOutBufHead;
+ DWORD dwOutBufTail;
+
+ /* */
+ /* return if PIO recording not active */
+ /* */
+
+ if (!phwi->awVirtualPIOList[0])
+ return;
+
+ /* */
+ /* read buffer state from DSP */
+ /* */
+
+ dwOutBufHead = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea +
+ CDATA_OUT_BUF_HEAD);
+
+ dwOutBufTail = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea +
+ CDATA_OUT_BUF_TAIL);
+
+ /* */
+ /* copy DSP buffer data to host buffer */
+ /* */
+
+ if (dwOutBufHead > dwOutBufTail)
+ {
+ /* */
+ /* DSP buffer data doesn't wrap, do straight copy */
+ /* */
+
+ dwHostDstCurrent =
+ kCopyLinearToCircular (devc, phwi,
+ dwOutBufTail,
+ dwOutBufHead - dwOutBufTail,
+ dwHostDstCurrent,
+ dwHostDstBufferAddr, dwHostDstBufferLen);
+ }
+ else
+ {
+ /* */
+ /* DSP buffer data wraps, do pre-wrap copy */
+ /* */
+
+ dwHostDstCurrent =
+ kCopyLinearToCircular (devc, phwi,
+ dwOutBufTail,
+ dwDSPOutBufferAddr + (dwDSPOutBufferLen / 2)
+ - dwOutBufTail,
+ dwHostDstCurrent,
+ dwHostDstBufferAddr, dwHostDstBufferLen);
+
+ /* */
+ /* do post-wrap copy */
+ /* */
+
+ dwHostDstCurrent =
+ kCopyLinearToCircular (devc, phwi,
+ dwDSPOutBufferAddr,
+ dwOutBufHead - dwDSPOutBufferAddr,
+ dwHostDstCurrent,
+ dwHostDstBufferAddr, dwHostDstBufferLen);
+ }
+
+ /* */
+ /* write updated buffer state to DSP */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->dwDspDataClientArea + CDATA_OUT_BUF_TAIL,
+ (WORD) dwOutBufHead);
+
+ pClient_Inst->dwHostDstCurrent = dwHostDstCurrent;
+
+} /* kPIOInterruptHandler() */
+#endif
+
+#ifdef HOSTI2SFREQCALC /* I2S was calculated in the host */
+#ifdef DOS_MODEL
+#pragma message("----kI2SInterruptHandler omitted (causes internal compiler error)")
+#else
+/*-------------------------------------------------------------------------- */
+/* */
+/* VOID kI2SInterruptHandler */
+/* */
+/* Description: */
+/* I2S data flow impeded interrupt handler. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PDWORD pdwI2SRate */
+/* Pointer to DWORD that will contain the I2S sample rate or */
+/* -1 if the sample rate should not be changed */
+/* */
+/* Return (VOID): */
+/* */
+/*-------------------------------------------------------------------------- */
+
+VOID
+kI2SInterruptHandler (allegro_devc * devc, PHWI phwi, PDWORD pdwI2SRate)
+{
+ WORD wI2SSampleCount;
+ WORD wI2STimerCount;
+ WORD wI2SSampleRate;
+
+ /* */
+ /* Get current sample count and timer count */
+ /* */
+
+ wI2SSampleCount = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ KDATA_I2S_SAMPLE_COUNT);
+
+ wI2STimerCount = kInW (devc, phwi->dwBaseIO + DSP_PORT_TIMER_COUNT);
+
+ /* */
+ /* I2S sample rate determination is a two pass operation. */
+ /* On the first pass we zero the activity flag and return -1. */
+ /* On the second pass we check if the activity flag is still */
+ /* zero. If so, we know the I2S data stream has stopped */
+ /* and we return 0 for the sample rate. Otherwise, we use */
+ /* the sample count data and do our best to determine the */
+ /* sample rate. */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_I2S_SECONDPASS)
+ {
+ if (!kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_I2S_ACTIVE))
+ {
+ /* */
+ /* the I2S stream has stopped */
+ /* */
+
+ *pdwI2SRate = 0;
+ }
+ else
+ {
+ /* */
+ /* the I2S stream is moving */
+ /* */
+
+ wI2SSampleCount -= phwi->wI2SSampleCount;
+ wI2STimerCount -= phwi->wI2STimerCount;
+
+ /* */
+ /* determine sample rate */
+ /* */
+ /* The timer rate is 48,000 ticks/second, so */
+ /* */
+ /* samples N samples 48,000 ticks 1 */
+ /* ------- = --------- X ------------ X ------- */
+ /* second 1 1 second M ticks */
+ /* */
+
+ wI2SSampleRate = (wI2SSampleCount * 48000) / wI2STimerCount;
+
+ if (wI2SSampleRate > (48000 + 44100) / 2)
+ *pdwI2SRate = 48000;
+ else if (wI2SSampleRate > (44100 + 32000) / 2)
+ *pdwI2SRate = 44100;
+ else if (wI2SSampleRate > (32000 + 22050) / 2)
+ *pdwI2SRate = 32000;
+ else
+ *pdwI2SRate = 22050;
+ }
+
+ phwi->dwFlags &= ~HWI_FLAG_I2S_SECONDPASS;
+ }
+ else
+ {
+ /* */
+ /* zero the activity flag and advance to the next state */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA, KDATA_I2S_ACTIVE, 0);
+
+ phwi->wI2SSampleCount = wI2SSampleCount;
+ phwi->wI2STimerCount = wI2STimerCount;
+
+ *pdwI2SRate = (DWORD) - 1;
+
+ phwi->dwFlags |= HWI_FLAG_I2S_SECONDPASS;
+ }
+
+} /* kI2SInterruptHandler() */
+#endif
+#endif
+
+#ifdef APUBLOCKCOUNT
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kResetApuBlockCount */
+/* */
+/* Description: */
+/* Reset a client's APU block count field. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN
+kResetApuBlockCount (allegro_devc * devc, PHWI phwi,
+ PCLIENT_INST pClient_Inst)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Reset the block count */
+ /* */
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_APU_BLOCK_COUNTL, 0);
+
+ kDspWriteWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea + CDATA_APU_BLOCK_COUNTH, 0);
+
+ return KRETURN_SUCCESS;
+
+} /* kResetApuBlockCount() */
+
+/*-------------------------------------------------------------------------- */
+/* */
+/* KRETURN kGetApuBlockCount */
+/* */
+/* Description: */
+/* Return a client's current stream position in terms of the number */
+/* of APU blocks transfered. */
+/* */
+/* Parameters: */
+/* PHWI phwi */
+/* Pointer to hardware instance. */
+/* */
+/* PCLIENT_INST pClient_Inst */
+/* Pointer to client instance */
+/* */
+/* PDWORD pdwBlockCount */
+/* Pointer to DWORD that will contain the number of APU blocks */
+/* */
+/* Return (KRETURN): */
+/* KRETURN_SUCCESS if successful, KRETURN_ERROR_XXX otherwise. */
+/* */
+/*-------------------------------------------------------------------------- */
+
+KRETURN kGetApuBlockCount
+ (allegro_devc * devc, PHWI phwi, PCLIENT_INST pClient_Inst,
+ PDWORD pdwBlockCount)
+{
+ DWORD dwClient = pClient_Inst->dwClient;
+ WORD wBlockCount;
+ WORD wRetry = 10;
+ WORD wBlockCountL;
+ WORD wBlockCountH;
+
+ /* */
+ /* Fail if the DSP kernel has been unloaded */
+ /* */
+
+ if (phwi->dwFlags & HWI_FLAG_UNLOADED)
+ return KRETURN_ERROR_UNLOADED;
+
+ /* */
+ /* Make sure client and an instance exist... */
+ /* */
+
+ if (dwClient >= NUMBER_OF_CLIENTS)
+ return KRETURN_ERROR_GENERIC;
+
+ if (!phwi->asClientTable[dwClient].dwReferenceCount)
+ return KRETURN_ERROR_GENERIC;
+
+ /* */
+ /* Get the block count */
+ /* */
+
+ while (wRetry--)
+ {
+ /* read high/low word of current block count */
+
+ wBlockCountH = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea +
+ CDATA_APU_BLOCK_COUNTH);
+
+ wBlockCountL = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea +
+ CDATA_APU_BLOCK_COUNTL);
+
+ /* if the high word hasn't changed, we've got a meaningful */
+ /* block count value */
+
+ wBlockCount = kDspReadWord (devc, phwi->dwBaseIO,
+ MEMTYPE_INTERNAL_DATA,
+ pClient_Inst->
+ dwDspDataClientArea +
+ CDATA_APU_BLOCK_COUNTH);
+
+ if (wBlockCount == wBlockCountH)
+ break;
+ }
+
+ /* fail if we couldn't get a meaningful block count */
+
+ if (wBlockCount != wBlockCountH)
+ return KRETURN_ERROR_GENERIC;
+
+ *pdwBlockCount = MAKELONG (wBlockCountL, wBlockCountH);
+
+ return KRETURN_SUCCESS;
+
+} /* kGetApuBlockCount() */
+
+#endif
+
+/*--------------------------------------------------------------------------- */
+/* End of File: kernel.c */
+/*--------------------------------------------------------------------------- */
+
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
diff --git a/attic/drv/oss_allegro/kernelbn.inc b/attic/drv/oss_allegro/kernelbn.inc
new file mode 100644
index 0000000..10441be
--- /dev/null
+++ b/attic/drv/oss_allegro/kernelbn.inc
@@ -0,0 +1,1107 @@
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ * This source code, its compiled object code, and its associated data sets *
+ * are copyright (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
+
+/*---------------------------------------------------------------------------
+ * Copyright (C) 1997-1999, ESS Technology, Inc.
+ *---------------------------------------------------------------------------
+ * FILENAME: kernelbn.c v1.01
+ *---------------------------------------------------------------------------
+ * DESCRIPTION: DSP binaries
+ *---------------------------------------------------------------------------
+ * AUTHOR: Henry Tang / Hong Kim / Alger Yeung/Don Kim
+ *---------------------------------------------------------------------------
+ * HISTORY:
+ * 09/25/97 HT Created.
+ * 01/20/97 PJCC (CRL) modified to include Sensaura 3D positional &
+ * speaker virtualization
+ * 05/05/99 AY cleanup for NT modem drivers
+ * 05/18/99 AY add cpythru for 400/500/600/800
+ * 05/24/99 AY add cpythru for 4C0/680
+ *---------------------------------------------------------------------------
+ */
+
+#ifdef NT_MODEL
+#ifdef DON
+#include "../port.h"
+#include "kernel.h"
+#endif
+#endif
+
+/* */
+/* Kernel */
+/* */
+
+WORD gawKernelVectCode[] = {
+#include "kernel.dat"
+};
+
+KERNEL_BIN gsKernelVectCode = {
+ gawKernelVectCode,
+ sizeof (gawKernelVectCode)
+};
+
+/* */
+/* Memory Check Kernel */
+/* */
+
+WORD gawMemChkVectCode[] = {
+#include "memchk.dat"
+};
+
+KERNEL_BIN gsMemChkVectCode = {
+ gawMemChkVectCode,
+ sizeof (gawMemChkVectCode)
+};
+
+
+/* */
+/* Copy Through */
+/* */
+
+WORD gawCpyThruDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawCpyThruVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0400[] = {
+ 0 /*#include "400cpyth.dat" */
+};
+
+WORD gawCpyThruVect04C0[] = {
+ 0x7980, 0x04C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode04C0[] = {
+ 0 /*#include "4C0cpyth.dat" */
+};
+
+WORD gawCpyThruVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0500[] = {
+ 0 /*#include "500cpyth.dat" */
+};
+
+WORD gawCpyThruVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0600[] = {
+ 0 /*#include "600cpyth.dat" */
+};
+
+
+WORD gawCpyThruVect0680[] = {
+ 0x7980, 0x0680, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0680[] = {
+ 0 /*#include "680cpyth.dat" */
+};
+
+WORD gawCpyThruVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawCpyThruCode0800[] = {
+ 0 /*#include "800cpyth.dat" */
+};
+
+CLIENT_BIN gasCpyThruVectCode[] = {
+ {
+ 0x0400,
+ gawCpyThruVect0400,
+ gawCpyThruCode0400,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0400),
+ sizeof (gawCpyThruCode0400),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x04C0,
+ gawCpyThruVect04C0,
+ gawCpyThruCode04C0,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect04C0),
+ sizeof (gawCpyThruCode04C0),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawCpyThruVect0500,
+ gawCpyThruCode0500,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0500),
+ sizeof (gawCpyThruCode0500),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawCpyThruVect0600,
+ gawCpyThruCode0600,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0600),
+ sizeof (gawCpyThruCode0600),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0680,
+ gawCpyThruVect0680,
+ gawCpyThruCode0680,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0680),
+ sizeof (gawCpyThruCode0680),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawCpyThruVect0800,
+ gawCpyThruCode0800,
+ gawCpyThruDataXXXX,
+ sizeof (gawCpyThruVect0800),
+ sizeof (gawCpyThruCode0800),
+ sizeof (gawCpyThruDataXXXX)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+/* */
+/* Modem */
+/* */
+
+WORD gawModemData[] = {
+ /* M3 HSP client data area starts at 0x1100 */
+ /* 80H words at 1100H */
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+
+ /* 80H words at 1180H */
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+
+#ifdef NT_MODEL
+ /* 80H words at 1200H */
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+
+ /* 80H words at 1280H */
+
+ 0 /*#include "modemntd.dat" */
+#else
+ /* 80H words at 1200H */
+
+ 0 /*#include "modemd.dat" */
+#endif
+};
+
+WORD gawModemVect400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+#ifdef NT_MODEL
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0449,
+#else
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0449,
+#endif
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawModemVect800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+#ifdef NT_MODEL
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0849,
+#else
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x7980, 0x0849,
+#endif
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawModemCode400[] = {
+#ifdef NT_MODEL
+ 0 /*#include "modemnt4.dat" */
+#else
+ 0 /*#include "400modem.dat" */
+#endif
+};
+
+WORD gawModemCode800[] = {
+#ifdef NT_MODEL
+ 0 /*#include "modemnt8.dat" */
+#else
+ 0 /*#include "800modem.dat" */
+#endif
+};
+
+CLIENT_BIN gasModemVectCode[] = {
+ {
+ 0x0400,
+ gawModemVect400,
+ gawModemCode400,
+ gawModemData,
+ sizeof (gawModemVect400),
+ sizeof (gawModemCode400),
+ sizeof (gawModemData)}
+ ,
+ {
+ 0x0800,
+ gawModemVect800,
+ gawModemCode800,
+ gawModemData,
+ sizeof (gawModemVect800),
+ sizeof (gawModemCode800),
+ sizeof (gawModemData)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+
+/* */
+/* Positional 3D */
+/* */
+/* Note: Data image contains 25 words (first 22 are CDATA_HEADER + */
+/* kernel spare, next 3 are dpaddr, control_enabled and current_count */
+/* for Pos3d) */
+/* */
+
+WORD gawPos3DDataXXXX[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000
+};
+
+WORD gawPos3DVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawPos3DCode0400[] = {
+ 0 /*#include "4pos3d.dat" */
+};
+
+WORD gawPos3DVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawPos3DCode0800[] = {
+ 0 /*#include "8pos3d.dat" */
+};
+
+CLIENT_BIN gasPos3DVectCode[] = {
+ {
+ 0x0400,
+ gawPos3DVect0400,
+ gawPos3DCode0400,
+ gawPos3DDataXXXX,
+ sizeof (gawPos3DVect0400),
+ sizeof (gawPos3DCode0400),
+ sizeof (gawPos3DDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawPos3DVect0800,
+ gawPos3DCode0800,
+ gawPos3DDataXXXX,
+ sizeof (gawPos3DVect0800),
+ sizeof (gawPos3DCode0800),
+ sizeof (gawPos3DDataXXXX)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+/* */
+/* Speaker Virtualization */
+/* */
+
+WORD gawSpkVirtDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawSpkVirtVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0400[] = {
+ 0 /*#include "4vmax.dat" */
+};
+
+WORD gawSpkVirtVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0800[] = {
+ 0 /*#include "8vmax.dat" */
+};
+
+CLIENT_BIN gasSpkVirtVectCode[] = {
+ {
+ 0x0400,
+ gawSpkVirtVect0400,
+ gawSpkVirtCode0400,
+ gawSpkVirtDataXXXX,
+ sizeof (gawSpkVirtVect0400),
+ sizeof (gawSpkVirtCode0400),
+ sizeof (gawSpkVirtDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawSpkVirtVect0800,
+ gawSpkVirtCode0800,
+ gawSpkVirtDataXXXX,
+ sizeof (gawSpkVirtVect0800),
+ sizeof (gawSpkVirtCode0800),
+ sizeof (gawSpkVirtDataXXXX)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+/* */
+/* CRL Speaker Virtualization */
+/* */
+
+WORD gawSpkVirtDataXXXX_CRL[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000
+};
+
+WORD gawSpkVirtVect0400_CRL[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0400_CRL[] = {
+ 0 /*#include "4spkvirt.dat" */
+};
+
+WORD gawSpkVirtVect0800_CRL[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000
+};
+
+WORD gawSpkVirtCode0800_CRL[] = {
+ 0 /*#include "8spkvirt.dat" */
+};
+
+CLIENT_BIN gasSpkVirtVectCode_CRL[] = {
+ {
+ 0x0400,
+ gawSpkVirtVect0400_CRL,
+ gawSpkVirtCode0400_CRL,
+ gawSpkVirtDataXXXX_CRL,
+ sizeof (gawSpkVirtVect0400_CRL),
+ sizeof (gawSpkVirtCode0400_CRL),
+ sizeof (gawSpkVirtDataXXXX_CRL)}
+ ,
+ {
+ 0x0800,
+ gawSpkVirtVect0800_CRL,
+ gawSpkVirtCode0800_CRL,
+ gawSpkVirtDataXXXX_CRL,
+ sizeof (gawSpkVirtVect0800_CRL),
+ sizeof (gawSpkVirtCode0800_CRL),
+ sizeof (gawSpkVirtDataXXXX_CRL)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+/* */
+/* Sample Rate Conversion */
+/* */
+
+WORD gawSRCDataXXXX[] = {
+ 0x0000
+};
+
+
+WORD gawSRCVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0400[] = {
+ 0 /*#include "400src36.dat" */
+};
+
+WORD gawSRCVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0500[] = {
+ 0 /*#include "500src36.dat" */
+};
+
+WORD gawSRCVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0600[] = {
+ 0 /*#include "600src36.dat" */
+};
+
+WORD gawSRCVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSRCCode0800[] = {
+ 0 /*#include "800src36.dat" */
+};
+
+CLIENT_BIN gasSRCVectCode[] = {
+ {
+ 0x0400,
+ gawSRCVect0400,
+ gawSRCCode0400,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0400),
+ sizeof (gawSRCCode0400),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawSRCVect0500,
+ gawSRCCode0500,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0500),
+ sizeof (gawSRCCode0500),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawSRCVect0600,
+ gawSRCCode0600,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0600),
+ sizeof (gawSRCCode0600),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawSRCVect0800,
+ gawSRCCode0800,
+ gawSRCDataXXXX,
+ sizeof (gawSRCVect0800),
+ sizeof (gawSRCCode0800),
+ sizeof (gawSRCDataXXXX)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+/* */
+/* MINI Sample Rate Conversion */
+/* */
+
+WORD gawMINISRCDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawMINISRCVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0400[] = {
+#include "400m_src.dat"
+};
+
+WORD gawMINISRCVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0500[] = {
+#include "500m_src.dat"
+};
+
+WORD gawMINISRCVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0600[] = {
+#include "600m_src.dat"
+};
+
+WORD gawMINISRCVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0800[] = {
+#include "800m_src.dat"
+};
+
+
+WORD gawMINISRCVect0900[] = {
+ 0x7980, 0x0900, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0900[] = {
+#include "900m_src.dat"
+};
+
+
+WORD gawMINISRCVect0A00[] = {
+ 0x7980, 0x0A00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0A00[] = {
+#include "a00m_src.dat"
+};
+
+WORD gawMINISRCVect0A80[] = {
+ 0x7980, 0x0A80, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawMINISRCCode0A80[] = {
+#include "a80m_src.dat"
+};
+
+CLIENT_BIN gasMINISRCVectCode[] = {
+ {
+ 0x0400,
+ gawMINISRCVect0400,
+ gawMINISRCCode0400,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0400),
+ sizeof (gawMINISRCCode0400),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawMINISRCVect0500,
+ gawMINISRCCode0500,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0500),
+ sizeof (gawMINISRCCode0500),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawMINISRCVect0600,
+ gawMINISRCCode0600,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0600),
+ sizeof (gawMINISRCCode0600),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawMINISRCVect0800,
+ gawMINISRCCode0800,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0800),
+ sizeof (gawMINISRCCode0800),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0900,
+ gawMINISRCVect0900,
+ gawMINISRCCode0900,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0900),
+ sizeof (gawMINISRCCode0900),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0A00,
+ gawMINISRCVect0A00,
+ gawMINISRCCode0A00,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0A00),
+ sizeof (gawMINISRCCode0A00),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ 0x0A80,
+ gawMINISRCVect0A80,
+ gawMINISRCCode0A80,
+ gawMINISRCDataXXXX,
+ sizeof (gawMINISRCVect0A80),
+ sizeof (gawMINISRCCode0A80),
+ sizeof (gawMINISRCDataXXXX)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+/* */
+/* SPDIF */
+/* */
+
+WORD gawSPDIFDataXXXX[] = {
+ 0x0000
+};
+
+WORD gawSPDIFVect0400[] = {
+ 0x7980, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0400[] = {
+ 0 /*#include "400spdif.dat" */
+};
+
+WORD gawSPDIFVect0500[] = {
+ 0x7980, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0500[] = {
+ 0 /*#include "500spdif.dat" */
+};
+
+WORD gawSPDIFVect0600[] = {
+ 0x7980, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0600[] = {
+ 0 /*#include "600spdif.dat" */
+};
+
+WORD gawSPDIFVect0700[] = {
+ 0x7980, 0x0700, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0700[] = {
+ 0 /*#include "700spdif.dat" */
+};
+
+WORD gawSPDIFVect0800[] = {
+ 0x7980, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0800[] = {
+ 0 /*#include "800spdif.dat" */
+};
+
+WORD gawSPDIFVect0900[] = {
+ 0x7980, 0x0900, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0900[] = {
+ 0 /*#include "900spdif.dat" */
+};
+
+WORD gawSPDIFVect0A00[] = {
+ 0x7980, 0x0A00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000,
+};
+
+WORD gawSPDIFCode0A00[] = {
+ 0 /*#include "A00spdif.dat" */
+};
+
+CLIENT_BIN gasSPDIFVectCode[] = {
+ {
+ 0x0400,
+ gawSPDIFVect0400,
+ gawSPDIFCode0400,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0400),
+ sizeof (gawSPDIFCode0400),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0500,
+ gawSPDIFVect0500,
+ gawSPDIFCode0500,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0500),
+ sizeof (gawSPDIFCode0500),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0600,
+ gawSPDIFVect0600,
+ gawSPDIFCode0600,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0600),
+ sizeof (gawSPDIFCode0600),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0700,
+ gawSPDIFVect0700,
+ gawSPDIFCode0700,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0700),
+ sizeof (gawSPDIFCode0700),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0800,
+ gawSPDIFVect0800,
+ gawSPDIFCode0800,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0800),
+ sizeof (gawSPDIFCode0800),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0900,
+ gawSPDIFVect0900,
+ gawSPDIFCode0900,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0900),
+ sizeof (gawSPDIFCode0900),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ 0x0A00,
+ gawSPDIFVect0A00,
+ gawSPDIFCode0A00,
+ gawSPDIFDataXXXX,
+ sizeof (gawSPDIFVect0A00),
+ sizeof (gawSPDIFCode0A00),
+ sizeof (gawSPDIFDataXXXX)}
+ ,
+ {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+};
+
+#if 0
+#ifndef NT_MODEL
+/* */
+/* FM client is a special case */
+/* */
+/* Note: If FM .dat images without passthru support are used */
+/* PASSTHRU_SIZE can be set to zero. */
+/* */
+
+#define PASSTHRU_SIZE 256
+
+WORD gawFMData[1024 + PASSTHRU_SIZE] = {
+#include "fm_d1000.dat"
+};
+
+WORD gawFMData2[] = {
+#include "fm_d2000.dat"
+};
+
+WORD gawFMVectCode[256 + PASSTHRU_SIZE] = {
+#include "fm_c0000.dat"
+};
+
+WORD gawFMCode[1024] = {
+#include "fm_c0800.dat"
+};
+
+FMCLIENT_BIN gsFMVectCode = {
+ 0x0800,
+ 0x2000,
+ gawFMVectCode,
+ gawFMCode,
+ gawFMData,
+ gawFMData2,
+ sizeof (gawFMVectCode),
+ sizeof (gawFMCode),
+ sizeof (gawFMData),
+ sizeof (gawFMData2)
+};
+#endif
+#endif
+WORD MIXER_TASK_NUMBER = 0;
+
+/*--------------------------------------------------------------------------- */
+/* End of File: kernelbn.h */
+/*--------------------------------------------------------------------------- */
+
+/******************************************************************************
+ * *
+ * (C) 1997-1999 ESS Technology, Inc. *
+ * *
+ ******************************************************************************/
diff --git a/attic/drv/oss_allegro/memchk.dat b/attic/drv/oss_allegro/memchk.dat
new file mode 100644
index 0000000..1f8d3f6
--- /dev/null
+++ b/attic/drv/oss_allegro/memchk.dat
@@ -0,0 +1,33 @@
+0x7980, 0x001A, 0x7980, 0x0020, 0x7980, 0x0020, 0x7980, 0x0020, 0x7980, 0x0020, 0x7980, 0x0020,
+0x7980, 0x0020, 0x7980, 0x0020, 0x7980, 0x0020, 0x7980, 0x0020, 0x7980, 0x0020, 0x7980, 0x0020,
+0x7980, 0x0020, 0x0807, 0xBFC0, 0x0024, 0x8807, 0x7980, 0x005C, 0xBE38, 0x7980, 0x0021, 0x8BD0,
+0x0818, 0x9001, 0x0810, 0x9002, 0xBF80, 0xFFFF, 0x9003, 0x1080, 0x9004, 0x7980, 0x0051, 0x8BD0,
+0x0818, 0x9001, 0x0810, 0x9002, 0xBF80, 0x0000, 0x9003, 0x1080, 0x9004, 0x7980, 0x0051, 0x8BD0,
+0x0818, 0x9001, 0x0810, 0x9002, 0xBF80, 0x5555, 0x9003, 0x1080, 0x9004, 0x7980, 0x0051, 0x8BD0,
+0x0818, 0x9001, 0x0810, 0x9002, 0xBF80, 0xAAAA, 0x9003, 0x1080, 0x9004, 0x8BE0, 0xBF80, 0x0000,
+0x9005, 0xBF80, 0x0002, 0x9000, 0x1005, 0xE388, 0x0058, 0xEF00, 0x8B88, 0xBE46, 0xBF80, 0x0001,
+0x8818, 0xBF80, 0x1000, 0x8816, 0x0816, 0xBE1E, 0xBC28, 0xBFA0, 0x1000, 0xE388, 0x0072, 0xBE1F,
+0xBC30, 0xBFA0, 0x1400, 0xE388, 0x0072, 0xBC20, 0x6906, 0xE388, 0x0072, 0x0818, 0xBA01, 0x8811,
+0xBF80, 0x01FF, 0xBE1E, 0x0818, 0xBE0A, 0xE388, 0x0084, 0xBE1D, 0xBE0A, 0xBE1D, 0x7980, 0x007C,
+0xBE1D, 0x8817, 0x0816, 0x8810, 0x8B88, 0x0817, 0x8809, 0xBF80, 0x0000, 0xBFC0, 0xFFFF, 0xBEC6,
+0x0093, 0x8B00, 0x90E0, 0x98E0, 0x8B89, 0x0810, 0xBFA0, 0x03FF, 0x8810, 0x7B90, 0x0088, 0x0818,
+0xBA01, 0x8811, 0x0816, 0x8810, 0x8B88, 0x0817, 0x8809, 0x8B00, 0x8B00, 0xBEC6, 0x00B2, 0x10E0,
+0xBFA0, 0xFFFF, 0xEB08, 0x0023, 0x10E0, 0xBA00, 0xEB08, 0x002F, 0x8B00, 0x8B00, 0x8B00, 0x8B89,
+0x0810, 0xBFA0, 0x03FF, 0x8810, 0x7B90, 0x00A0, 0x0818, 0xBA01, 0x8811, 0x0816, 0x8810, 0x8B88,
+0x0817, 0x8809, 0xBF80, 0x0000, 0xBE82, 0xFFFF, 0xBEC6, 0x00CA, 0x8B00, 0x90E0, 0x98E0, 0x8B89,
+0x0810, 0xBFA0, 0x03FF, 0x8810, 0x7B90, 0x00BF, 0x0818, 0xBA01, 0x8811, 0x0816, 0x8810, 0x8B88,
+0x0817, 0x8809, 0x8B00, 0x8B00, 0xBEC6, 0x00E9, 0x10E0, 0xBA00, 0xEB08, 0x002F, 0x10E0, 0xBFA0,
+0xFFFF, 0xEB08, 0x0023, 0x8B00, 0x8B00, 0x8B00, 0x8B89, 0x0810, 0xBFA0, 0x03FF, 0x8810, 0x7B90,
+0x00D7, 0x0818, 0xBA01, 0x8811, 0x0816, 0x8810, 0x8B88, 0x0817, 0x8809, 0xBF80, 0x5555, 0xBE82,
+0xAAAA, 0xBEC6, 0x0101, 0x8B00, 0x90E0, 0x98E0, 0x8B89, 0x0810, 0xBFA0, 0x03FF, 0x8810, 0x7B90,
+0x00F6, 0x0818, 0xBA01, 0x8811, 0x0816, 0x8810, 0x8B88, 0x0817, 0x8809, 0x8B00, 0x8B00, 0xBEC6,
+0x0121, 0x10E0, 0xBFA0, 0x5555, 0xEB08, 0x003B, 0x10E0, 0xBFA0, 0xAAAA, 0xEB08, 0x0047, 0x8B00,
+0x8B00, 0x8B00, 0x8B89, 0x0810, 0xBFA0, 0x03FF, 0x8810, 0x7B90, 0x010E, 0x0818, 0xBA01, 0x8811,
+0x0816, 0x8810, 0x8B88, 0x0817, 0x8809, 0xBF80, 0xAAAA, 0xBE82, 0x5555, 0xBEC6, 0x0139, 0x8B00,
+0x90E0, 0x98E0, 0x8B89, 0x0810, 0xBFA0, 0x03FF, 0x8810, 0x7B90, 0x012E, 0x0818, 0xBA01, 0x8811,
+0x0816, 0x8810, 0x8B88, 0x0817, 0x8809, 0x8B00, 0x8B00, 0xBEC6, 0x0159, 0x10E0, 0xBFA0, 0xAAAA,
+0xEB08, 0x0047, 0x10E0, 0xBFA0, 0x5555, 0xEB08, 0x003B, 0x8B00, 0x8B00, 0x8B00, 0x8B89, 0x0810,
+0xBFA0, 0x03FF, 0x8810, 0x7B90, 0x0146, 0x1009, 0xE308, 0x016E, 0x0818, 0xBE09, 0xBE1E, 0xBA40,
+0xE304, 0x016E, 0xBE1F, 0x8818, 0x7980, 0x0072, 0xBF80, 0x0001, 0x9000, 0x1000, 0xE308, 0x0171,
+0xBF80, 0x0001, 0x8818, 0x0816, 0xBF90, 0x0400, 0x8816, 0xBFA0, 0x1800, 0xE3CC, 0x0064, 0x7980,
+0x0021,
diff --git a/attic/drv/oss_allegro/oss_allegro.c b/attic/drv/oss_allegro/oss_allegro.c
new file mode 100644
index 0000000..150f8e5
--- /dev/null
+++ b/attic/drv/oss_allegro/oss_allegro.c
@@ -0,0 +1,1081 @@
+/*
+ * Driver for ALLEGRO PCI audio controller.
+ */
+/*
+ *
+ * This file is part of Open Sound System.
+ *
+ * Copyright (C) 4Front Technologies 1996-2008.
+ *
+ * This this source file is released under GPL v2 license (no other versions).
+ * See the COPYING file included in the main directory of this source
+ * distribution for the license terms and conditions.
+ *
+ */
+
+
+#include "oss_allegro_cfg.h"
+#include "oss_pci.h"
+#include "ac97.h"
+#include "uart401.h"
+
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+
+#define NT_MODEL
+
+#define ESSM3_VENDOR_ID 0x125D
+#define ESS_1988 0x1988 /* allegro */
+#define ESS_1989 0x1989 /* allegro */
+#define ESS_1990 0x1990 /* Canyon 3D */
+#define ESS_1992 0x1992 /* Canyon 3D-2 */
+#define ESS_1998 0x1998 /* m3 */
+#define ESS_1999 0x1999 /* m3 */
+#define ESS_199A 0x199a /* m3 */
+#define ESS_199B 0x199b /* m3 */
+
+#define NT_MODEL
+#define MAX_PORTC 2
+
+typedef struct allegro_portc
+{
+ int speed, bits, channels;
+ int open_mode;
+ int audio_enabled;
+ int trigger_bits;
+ int audiodev;
+}
+allegro_portc;
+
+typedef struct allegro_devc
+{
+ oss_device_t *osdev;
+ oss_native_word base, mpu_base;
+ int mpu_attached, fm_attached;
+ uart401_devc uart401devc;
+ int irq;
+ int model;
+#define MDL_ESS1988 1
+#define MDL_ESS1989 2
+#define MDL_ESS1990 3
+#define MDL_ESS1992 4
+#define MDL_ESS1998 5
+#define MDL_ESS1999 6
+#define MDL_ESS199A 7
+#define MDL_ESS199B 8
+ char *chip_name;
+
+ /* Audio parameters */
+ int open_mode;
+ int audio_initialized;
+ allegro_portc portc[MAX_PORTC];
+ oss_mutex_t mutex;
+ oss_mutex_t low_mutex;
+
+ /* buffer and device control */
+ unsigned char fmt, ctrl;
+ struct dmabuf
+ {
+ void *rawbuf;
+ unsigned dmasize;
+ oss_native_word base; /* Offset for ptr */
+ }
+ dma_adc, dma_dac;
+
+ oss_dma_handle_t dma_handle;
+
+ /* Mixer parameters */
+ ac97_devc ac97devc;
+}
+allegro_devc;
+
+#include "port.h"
+#include "hardware.h"
+#include "kernel.h"
+#include "srcmgr.h"
+
+PALLEGRO_WAVE *WaveStream = NULL;
+extern int allegro_mpu_ioaddr;
+extern int allegro_amp;
+int debug = 0;
+
+#define ESS_CFMT_STEREO 0x01
+#define ESS_CFMT_16BIT 0x02
+#define ESS_CFMT_MASK 0x03
+#define ESS_CFMT_ASHIFT 0
+#define ESS_CFMT_CSHIFT 4
+
+#define CTRL_DAC_EN 0x40 /* enable DAC */
+#define CTRL_ADC_EN 0x10 /* enable ADC */
+
+WORD gwDSPConnectIn = KCONNECT_ADC1; /* Default ADC1 */
+
+#include "allegro_util.inc"
+#include "srcmgr.inc"
+#include "kernel.inc"
+#include "kernelbn.inc"
+
+
+unsigned int
+GetPosition (allegro_devc * devc, unsigned char Direction)
+{
+ oss_native_word flags;
+ unsigned long pos = 0;
+
+ if (!Direction)
+ WaveStream = &CaptureStream;
+ else
+ WaveStream = &PlaybackStream;
+
+ MUTEX_ENTER_IRQDISABLE (devc->mutex, flags);
+
+ if (*WaveStream)
+ pos = SRCMGR_GetPosition (devc, *WaveStream);
+
+ MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);
+ return pos;
+}
+
+static int
+ac97_write (void *devc_, int addr, int data)
+{
+ oss_native_word flags;
+ allegro_devc *devc = devc_;
+#if 0
+ int i;
+
+ MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
+ for (i = 0; i < 1000; i++)
+ if (!(INB (devc->osdev, devc->base + 0x30) & 0x01))
+ break;
+ OUTW (devc->osdev, data & 0xffff, devc->base + 0x32);
+ oss_udelay (100);
+ OUTW (devc->osdev, (addr & 0x7f) & ~0x80, devc->base + 0x30);
+ MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
+#else
+ MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
+ HWMGR_WriteCodecData (devc, (UCHAR) addr, data);
+ MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
+#endif
+ return 0;
+}
+
+static int
+ac97_read (void *devc_, int addr)
+{
+ allegro_devc *devc = devc_;
+ oss_native_word flags;
+ unsigned short data;
+#if 0
+ int i;
+ int sanity = 10000;
+
+ MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
+ for (i = 0; i < 100000; i++)
+ if (!(INB (devc->osdev, devc->base + 0x30) & 0x01))
+ break;
+ OUTW (devc->osdev, addr | 0x80, devc->base + 0x30);
+
+ while (INB (devc->osdev, devc->base + 0x30) & 1)
+ {
+ sanity--;
+ if (!sanity)
+ {
+ cmn_err (CE_WARN, "ac97 codec timeout - 0x%x.\n", addr);
+ MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
+ return 0;
+ }
+ }
+
+ data = INW (devc->osdev, devc->base + 0x32);
+ MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
+#else
+ MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
+ HWMGR_ReadCodecData (devc, (UCHAR) addr, &data);
+ MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
+#endif
+ return data;
+}
+
+void
+HwStartDMA (allegro_devc * devc, unsigned char Direction)
+{
+ if (!Direction)
+ WaveStream = &CaptureStream;
+ else
+ WaveStream = &PlaybackStream;
+
+ SetState (devc, *WaveStream, KSSTATE_RUN);
+
+ DDB (cmn_err (CE_WARN, "Wave%s DMA started\n", !Direction ? "In" : "Out"));
+}
+
+
+void
+HwStopDMA (allegro_devc * devc, unsigned char Direction)
+{
+ if (!Direction)
+ WaveStream = &CaptureStream;
+ else
+ WaveStream = &PlaybackStream;
+
+ SetState (devc, *WaveStream, KSSTATE_STOP);
+
+ DDB (cmn_err (CE_WARN, "Wave%s DMA stopped\n", !Direction ? "In" : "Out"));
+}
+
+
+void
+HwSetWaveFormat (allegro_devc * devc, PWAVE_INFO WaveInfo,
+ unsigned char Direction)
+{
+
+ if (!Direction)
+ WaveStream = &CaptureStream;
+ else
+ WaveStream = &PlaybackStream;
+
+ SetFormat (devc, *WaveStream, WaveInfo);
+}
+
+
+static int
+allegrointr (oss_device_t * osdev)
+{
+ allegro_devc *devc = (allegro_devc *) osdev->devc;
+ unsigned char bIntStatus;
+ unsigned char bIntTimer = FALSE;
+ unsigned int currdac, curradc, n, i;
+ int serviced = 0;
+
+ bIntStatus = INB (devc->osdev, devc->base + 0x1A);
+
+ if (bIntStatus == 0xff)
+ return 0;
+ OUTW (devc->osdev, bIntStatus, devc->base + 0x1A);
+ if (bIntStatus & ASSP_INT_PENDING)
+ {
+ unsigned char status;
+ serviced = 1;
+
+ status = INB (devc->osdev, (devc->base + ASSP_CONTROL_B));
+ if ((status & STOP_ASSP_CLOCK) == 0)
+ {
+ status = INB (devc->osdev, (devc->base + ASSP_HOST_INT_STATUS));
+
+ /* acknowledge other interrupts */
+ if (status & DSP2HOST_REQ_TIMER)
+ {
+ OUTB (devc->osdev, DSP2HOST_REQ_TIMER,
+ (devc->base + ASSP_HOST_INT_STATUS));
+ bIntTimer = TRUE;
+ }
+ }
+ }
+
+ if (bIntStatus & 0x40)
+ {
+ serviced = 1;
+ OUTB (devc->osdev, 0x40, devc->base + 0x1A);
+ }
+
+ if (bIntStatus & MPU401_INT_PENDING)
+ {
+ serviced = 1;
+ uart401_irq (&devc->uart401devc);
+ }
+
+ if (!bIntTimer)
+ return serviced;
+
+ for (i = 0; i < MAX_PORTC; i++)
+ {
+ allegro_portc *portc = &devc->portc[i];
+ if (portc->trigger_bits & PCM_ENABLE_OUTPUT)
+ {
+ dmap_t *dmapout = audio_engines[portc->audiodev]->dmap_out;
+ currdac = GetPosition (devc, 1);
+ currdac /= dmapout->fragment_size;
+ n = 0;
+ while (dmap_get_qhead (dmapout) != currdac && n++ < dmapout->nfrags)
+ oss_audio_outputintr (portc->audiodev, 1);
+ }
+ if (portc->trigger_bits & PCM_ENABLE_INPUT)
+ {
+ dmap_t *dmapin = audio_engines[portc->audiodev]->dmap_in;
+ curradc = GetPosition (devc, 0);
+ curradc /= dmapin->fragment_size;
+
+ n = 0;
+ while (dmap_get_qtail (dmapin) != curradc && n++ < dmapin->nfrags)
+ oss_audio_inputintr (portc->audiodev, 0);
+ }
+ }
+
+ return serviced;
+}
+
+static int
+allegro_audio_set_rate (int dev, int arg)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+
+ if (arg == 0)
+ return portc->speed;
+
+ if (arg > 48000)
+ arg = 48000;
+ if (arg < 5000)
+ arg = 5000;
+ portc->speed = arg;
+ return portc->speed;
+}
+
+static short
+allegro_audio_set_channels (int dev, short arg)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+
+ if ((arg != 1) && (arg != 2))
+ return portc->channels;
+ portc->channels = arg;
+
+ return portc->channels;
+}
+
+static unsigned int
+allegro_audio_set_format (int dev, unsigned int arg)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+
+ if (arg == 0)
+ return portc->bits;
+
+ if (!(arg & (AFMT_U8 | AFMT_S16_LE)))
+ return portc->bits;
+ portc->bits = arg;
+
+ return portc->bits;
+}
+
+/*ARGSUSED*/
+static int
+allegro_audio_ioctl (int dev, unsigned int cmd, ioctl_arg arg)
+{
+ return OSS_EINVAL;
+}
+
+static void allegro_audio_trigger (int dev, int state);
+
+static void
+allegro_audio_reset (int dev)
+{
+ allegro_audio_trigger (dev, 0);
+}
+
+static void
+allegro_audio_reset_input (int dev)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+ allegro_audio_trigger (dev, portc->trigger_bits & ~PCM_ENABLE_INPUT);
+}
+
+static void
+allegro_audio_reset_output (int dev)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+ allegro_audio_trigger (dev, portc->trigger_bits & ~PCM_ENABLE_OUTPUT);
+}
+
+/*ARGSUSED*/
+static int
+allegro_audio_open (int dev, int mode, int open_flags)
+{
+ oss_native_word flags;
+ allegro_portc *portc = audio_engines[dev]->portc;
+ allegro_devc *devc = audio_engines[dev]->devc;
+
+ MUTEX_ENTER_IRQDISABLE (devc->mutex, flags);
+ if (portc->open_mode)
+ {
+ MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);
+ return OSS_EBUSY;
+ }
+
+ if (devc->open_mode & mode)
+ {
+ MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);
+ return OSS_EBUSY;
+ }
+
+ devc->open_mode |= mode;
+
+
+ portc->open_mode = mode;
+ portc->audio_enabled &= ~mode;
+
+ MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);
+
+ return 0;
+}
+
+static void
+allegro_audio_close (int dev, int mode)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+ allegro_devc *devc = audio_engines[dev]->devc;
+
+ allegro_audio_reset (dev);
+ portc->open_mode = 0;
+ devc->open_mode &= ~mode;
+ portc->audio_enabled &= ~mode;
+}
+
+/*ARGSUSED*/
+static void
+allegro_audio_output_block (int dev, oss_native_word buf, int count,
+ int fragsize, int intrflag)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+
+ portc->audio_enabled |= PCM_ENABLE_OUTPUT;
+ portc->trigger_bits &= ~PCM_ENABLE_OUTPUT;
+
+}
+
+/*ARGSUSED*/
+static void
+allegro_audio_start_input (int dev, oss_native_word buf, int count,
+ int fragsize, int intrflag)
+{
+ allegro_portc *portc = audio_engines[dev]->portc;
+
+ portc->audio_enabled |= PCM_ENABLE_INPUT;
+ portc->trigger_bits &= ~PCM_ENABLE_INPUT;
+
+}
+
+static void
+allegro_audio_trigger (int dev, int state)
+{
+ /*oss_native_word flags; */
+ allegro_portc *portc = audio_engines[dev]->portc;
+ allegro_devc *devc = audio_engines[dev]->devc;
+
+ /* MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags); */
+ if (portc->open_mode & OPEN_WRITE)
+ {
+ if (state & PCM_ENABLE_OUTPUT)
+ {
+ if ((portc->audio_enabled & PCM_ENABLE_OUTPUT) &&
+ !(portc->trigger_bits & PCM_ENABLE_OUTPUT))
+
+ {
+ devc->ctrl |= CTRL_DAC_EN;
+ HwStartDMA (devc, TRUE);
+ portc->trigger_bits |= PCM_ENABLE_OUTPUT;
+ }
+ }
+ else
+ {
+ if ((portc->audio_enabled & PCM_ENABLE_OUTPUT) &&
+ (portc->trigger_bits & PCM_ENABLE_OUTPUT))
+ {
+ portc->audio_enabled &= ~PCM_ENABLE_OUTPUT;
+ portc->trigger_bits &= ~PCM_ENABLE_OUTPUT;
+ devc->ctrl &= ~CTRL_DAC_EN;
+ HwStopDMA (devc, TRUE);
+ FreeStream (devc, PlaybackStream);
+ }
+ }
+ }
+ if (portc->open_mode & OPEN_READ)
+ {
+ if (state & PCM_ENABLE_INPUT)
+ {
+ if ((portc->audio_enabled & PCM_ENABLE_INPUT) &&
+ !(portc->trigger_bits & PCM_ENABLE_INPUT))
+
+ {
+ devc->ctrl |= CTRL_ADC_EN;
+ HwStartDMA (devc, FALSE);
+ portc->trigger_bits |= PCM_ENABLE_INPUT;
+ }
+ }
+ else
+ {
+ if ((portc->audio_enabled & PCM_ENABLE_INPUT) &&
+ (portc->trigger_bits & PCM_ENABLE_INPUT))
+
+ {
+ portc->audio_enabled &= ~PCM_ENABLE_INPUT;
+ portc->trigger_bits &= ~PCM_ENABLE_INPUT;
+ devc->ctrl &= ~CTRL_ADC_EN;
+ HwStopDMA (devc, FALSE);
+ FreeStream (devc, CaptureStream);
+ }
+ }
+ }
+ /* MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags); */
+}
+
+/*ARGSUSED*/
+static int
+allegro_audio_prepare_for_input (int dev, int bsize, int bcount)
+{
+ allegro_devc *devc = audio_engines[dev]->devc;
+ allegro_portc *portc = audio_engines[dev]->portc;
+ oss_native_word flags;
+ WAVE_INFO WaveInfo;
+
+ MUTEX_ENTER_IRQDISABLE (devc->mutex, flags);
+ WaveInfo.BitsPerSample = portc->bits;
+ WaveInfo.Channels = portc->channels;
+ WaveInfo.SamplesPerSec = portc->speed;
+
+ HwSetWaveFormat (devc, &WaveInfo, FALSE);
+ MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);
+
+ portc->audio_enabled &= ~PCM_ENABLE_INPUT;
+ portc->trigger_bits &= ~PCM_ENABLE_INPUT;
+ return 0;
+}
+
+/*ARGSUSED*/
+static int
+allegro_audio_prepare_for_output (int dev, int bsize, int bcount)
+{
+ allegro_devc *devc = audio_engines[dev]->devc;
+ allegro_portc *portc = audio_engines[dev]->portc;
+ oss_native_word flags;
+ WAVE_INFO WaveInfo;
+
+ MUTEX_ENTER_IRQDISABLE (devc->mutex, flags);
+ WaveInfo.BitsPerSample = portc->bits;
+ WaveInfo.Channels = portc->channels;
+ WaveInfo.SamplesPerSec = portc->speed;
+ SRCMGR_SetVolume (devc, PlaybackStream->DspClientInstance, 0x7FFF, 0x7FFF);
+
+ HwSetWaveFormat (devc, &WaveInfo, TRUE);
+ MUTEX_EXIT_IRQRESTORE (devc->mutex, flags);
+
+ portc->audio_enabled &= ~PCM_ENABLE_OUTPUT;
+ portc->trigger_bits &= ~PCM_ENABLE_OUTPUT;
+ return 0;
+}
+
+static int
+allegro_alloc_buffer (int dev, dmap_t * dmap, int direction)
+{
+
+ allegro_devc *devc = audio_engines[dev]->devc;
+
+ if (dmap->dmabuf != NULL)
+ return 0;
+
+ if (direction == PCM_ENABLE_OUTPUT)
+ {
+ dmap->dmabuf = devc->dma_dac.rawbuf;
+ dmap->dmabuf_phys = devc->dma_dac.base;
+ dmap->buffsize = devc->dma_dac.dmasize;
+ }
+ if (direction == PCM_ENABLE_INPUT)
+ {
+ dmap->dmabuf = devc->dma_adc.rawbuf;
+ dmap->dmabuf_phys = devc->dma_adc.base;
+ dmap->buffsize = devc->dma_adc.dmasize;
+ }
+ return 0;
+}
+
+
+/*ARGSUSED*/
+static int
+allegro_free_buffer (int dev, dmap_t * dmap, int direction)
+{
+ if (dmap->dmabuf == NULL)
+ return 0;
+
+ dmap->dmabuf = NULL;
+ dmap->dmabuf_phys = 0;
+ dmap->buffsize = 0;
+
+ return 0;
+}
+
+/*ARGSUSED*/
+static int
+allegro_get_buffer_pointer (int dev, dmap_t * dmap, int direction)
+{
+ allegro_devc *devc = audio_engines[dev]->devc;
+ oss_native_word flags;
+ oss_native_word ptr = 0;
+
+ MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
+ if (direction == PCM_ENABLE_OUTPUT)
+ {
+ ptr = GetPosition (devc, 1);
+ }
+ if (direction == PCM_ENABLE_INPUT)
+ {
+ ptr = GetPosition (devc, 0);
+ }
+ MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
+ return ptr;
+}
+
+
+static int
+alloc_dmabuf (allegro_devc * devc, int direction)
+{
+ struct dmabuf *db = direction ? &devc->dma_adc : &devc->dma_dac;
+ unsigned char fmt = 0;
+ oss_native_word phaddr;
+
+ if (direction)
+ {
+ fmt &= ~((ESS_CFMT_STEREO | ESS_CFMT_16BIT) << ESS_CFMT_CSHIFT);
+ fmt >>= ESS_CFMT_CSHIFT;
+
+ }
+ else
+ {
+ fmt &= ~((ESS_CFMT_STEREO | ESS_CFMT_16BIT) << ESS_CFMT_ASHIFT);
+ fmt >>= ESS_CFMT_ASHIFT;
+ }
+
+ if (!db->rawbuf)
+ {
+#define MAX_REJECTED 8
+ int rejected = 0;
+ oss_native_word rejectedPA[MAX_REJECTED];
+ oss_native_word PhysicalAddressConstraint = 0xFFFF;
+
+ /* alloc as big a chunk as we can */
+ db->dmasize = 16384;
+
+ while (!db->rawbuf)
+ {
+ oss_native_word LogicalAddress;
+ void *rawbuf;
+ rawbuf =
+ (void *) CONTIG_MALLOC (devc->osdev, db->dmasize,
+ MEMLIMIT_32BITS, &phaddr, devc->dma_handle);
+
+ if (!rawbuf)
+ break;
+ LogicalAddress = phaddr;
+ if (((LogicalAddress & ~PhysicalAddressConstraint) ==
+ ((LogicalAddress + 0x4000 - 1) & ~PhysicalAddressConstraint)))
+ {
+ db->rawbuf = rawbuf;
+ }
+ else
+ {
+ if (rejected == MAX_REJECTED)
+ {
+ CONTIG_FREE (devc->osdev, rawbuf, db->dmasize, devc->dma_handle);
+ break;
+ }
+ rejectedPA[rejected] = (oss_native_word) rawbuf;
+ rejected++;
+ }
+ }
+
+ while (rejected--)
+ {
+ CONTIG_FREE (devc->osdev, (char *) rejectedPA[rejected],
+ db->dmasize, TODO);
+ }
+
+ if (!db->rawbuf)
+ return OSS_ENOMEM;
+
+#ifdef linux
+ /* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
+ oss_reserve_pages ((oss_native_word) db->rawbuf,
+ (oss_native_word) db->rawbuf + (PAGE_SIZE << 2) - 1);
+#endif
+ }
+ memset (db->rawbuf, (fmt & ESS_CFMT_16BIT) ? 0 : 0x80, db->dmasize);
+ db->base = phaddr;
+ return 0;
+}
+
+static int
+free_dmabuf (allegro_devc * devc, unsigned direction)
+{
+ struct dmabuf *db;
+
+ if (direction)
+ db = &devc->dma_dac;
+ else
+ db = &devc->dma_adc;
+
+ if (db->rawbuf)
+ {
+#ifdef linux
+ /* undo marking the pages as reserved */
+ oss_unreserve_pages ((oss_native_word) db->rawbuf,
+ (oss_native_word) db->rawbuf + (PAGE_SIZE << 2) -
+ 1);
+#endif
+ CONTIG_FREE (devc->osdev, db->rawbuf, db->dmasize, TODO);
+ db->rawbuf = NULL;
+ return 0;
+ }
+ return OSS_EIO;
+}
+
+static audiodrv_t allegro_audio_driver = {
+ allegro_audio_open,
+ allegro_audio_close,
+ allegro_audio_output_block,
+ allegro_audio_start_input,
+ allegro_audio_ioctl,
+ allegro_audio_prepare_for_input,
+ allegro_audio_prepare_for_output,
+ allegro_audio_reset,
+ NULL,
+ NULL,
+ allegro_audio_reset_input,
+ allegro_audio_reset_output,
+ allegro_audio_trigger,
+ allegro_audio_set_rate,
+ allegro_audio_set_format,
+ allegro_audio_set_channels,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ allegro_alloc_buffer,
+ allegro_free_buffer,
+ NULL,
+ NULL,
+ allegro_get_buffer_pointer
+};
+
+#if 0
+static void
+attach_fm (allegro_devc * devc)
+{
+ if (!opl3_detect (0x388, devc->osdev))
+ return;
+ opl3_init (0x388, devc->osdev);
+ devc->fm_attached = 1;
+}
+#endif
+
+static void
+attach_mpu (allegro_devc * devc)
+{
+ devc->mpu_attached = 1;
+ uart401_init (&devc->uart401devc, devc->osdev, devc->mpu_base,
+ "Allegro MIDI UART");
+}
+
+static int
+init_allegro (allegro_devc * devc)
+{
+ int my_mixer, adev;
+ int first_dev = 0;
+ int ret, i;
+ unsigned short val;
+
+ devc->mpu_attached = devc->fm_attached = 0;
+
+ ret = alloc_dmabuf (devc, 0);
+ if (ret != 0)
+ {
+ cmn_err (CE_WARN, "Couldn't allocate playback memory\n");
+ return 1;
+ }
+
+ ret = alloc_dmabuf (devc, 1);
+ if (ret != 0)
+ {
+ cmn_err (CE_WARN, "Couldn't allocate recording memory\n");
+ return 1;
+ }
+
+ AllocateStream (devc, WAVE_CAPTURE);
+ AllocateStream (devc, WAVE_PLAYBACK);
+
+#if 0
+ for (i = devc->base + 0x1c; i <= devc->base + 0x1f; i++)
+ OUTB (devc->osdev, 0x00, i);
+ OUTB (devc->osdev, 0x40, devc->base + 0x38);
+ OUTB (devc->osdev, 0x10, devc->base + 0x3e);
+ OUTB (devc->osdev, 0x44, devc->base + 0x3f);
+#endif
+
+ HWMGR_InitSystem (devc);
+ OUTW (devc->osdev, 0x0012, devc->base + 0x18);
+
+ /* Once enable it, never touch again */
+ OUTB (devc->osdev, (INB (devc->osdev, devc->base + 0xA6) | 0x01),
+ devc->base + 0xA6);
+
+ pci_read_config_word (devc->osdev, PCI_ALLEGRO_CONFIG, &val);
+ switch (devc->mpu_base)
+ {
+ case 0x330:
+ val |= 0;
+ break;
+ case 0x300:
+ val |= (1 << 3);
+ break;
+ case 0x320:
+ val |= (2 << 3);
+ break;
+ case 0x340:
+ val |= (3 << 3);
+ break;
+ }
+ pci_write_config_word (devc->osdev, PCI_ALLEGRO_CONFIG, val);
+
+#if 0
+ attach_fm (devc);
+#endif
+
+ if (devc->mpu_base > 0)
+ attach_mpu (devc);
+
+
+ InitStream ();
+
+ if (allegro_amp)
+ {
+ /*initialize the GPIOs....this is hacked using Windows settings */
+ OUTB (devc->osdev, 0xff, devc->base + 0x61);
+ oss_udelay (100);
+
+ OUTB (devc->osdev, 0xff, devc->base + 0x63);
+ oss_udelay (100);
+
+ OUTB (devc->osdev, 0xff, devc->base + 0x67);
+ oss_udelay (100);
+ OUTB (devc->osdev, 0xff, devc->base + 0x69);
+ }
+
+ my_mixer = ac97_install (&devc->ac97devc, "AC97 Mixer",
+ ac97_read, ac97_write, devc, devc->osdev);
+ if (my_mixer < 0)
+ return 0;
+
+ for (i = 0; i < MAX_PORTC; i++)
+ {
+ int caps = ADEV_AUTOMODE;
+ allegro_portc *portc = &devc->portc[i];
+ char tmp_name[256];
+
+ if (i == 0)
+ {
+ strcpy (tmp_name, devc->chip_name);
+ caps |= ADEV_DUPLEX;
+ }
+ else
+ {
+ strcpy (tmp_name, devc->chip_name);
+ caps |= ADEV_DUPLEX | ADEV_SHADOW;
+ }
+
+ if ((adev = oss_install_audiodev (OSS_AUDIO_DRIVER_VERSION,
+ devc->osdev,
+ devc->osdev,
+ tmp_name,
+ &allegro_audio_driver,
+ sizeof (audiodrv_t),
+ caps,
+ AFMT_U8 | AFMT_S16_LE, devc, -1)) < 0)
+ {
+ adev = -1;
+ return 0;
+ }
+ else
+ {
+ if (i == 0)
+ first_dev = adev;
+ audio_engines[adev]->portc = portc;
+ audio_engines[adev]->rate_source = first_dev;
+ audio_engines[adev]->mixer_dev = my_mixer;
+ audio_engines[adev]->min_rate = 5000;
+ audio_engines[adev]->max_rate = 48000;
+ audio_engines[adev]->caps |= PCM_CAP_FREERATE;
+ audio_engines[adev]->vmix_flags = VMIX_MULTIFRAG;
+ portc->open_mode = 0;
+ portc->audiodev = adev;
+ portc->audio_enabled = 0;
+#ifdef CONFIG_OSS_VMIX
+ if (i == 0)
+ vmix_attach_audiodev(devc->osdev, adev, -1, 0);
+#endif
+ }
+ }
+
+ return 1;
+}
+
+int
+oss_allegro_attach (oss_device_t * osdev)
+{
+ unsigned char pci_irq_line, pci_revision;
+ unsigned short pci_command, vendor, device;
+ unsigned int pci_ioaddr;
+ int err;
+ allegro_devc *devc;
+ DDB (cmn_err (CE_WARN, "Entered ALLEGRO ALLEGRO probe routine\n"));
+
+ pci_read_config_word (osdev, PCI_VENDOR_ID, &vendor);
+ pci_read_config_word (osdev, PCI_DEVICE_ID, &device);
+
+ if (vendor != ESSM3_VENDOR_ID ||
+ (device != ESS_1988 && device != ESS_1989 && device != ESS_1990 &&
+ device != ESS_1992 && device != ESS_1998 && device != ESS_1999 &&
+ device != ESS_199A && device != ESS_199B))
+
+ return 0;
+
+ pci_read_config_byte (osdev, PCI_REVISION_ID, &pci_revision);
+ pci_read_config_word (osdev, PCI_COMMAND, &pci_command);
+ pci_read_config_irq (osdev, PCI_INTERRUPT_LINE, &pci_irq_line);
+ pci_read_config_dword (osdev, PCI_BASE_ADDRESS_0, &pci_ioaddr);
+
+ DDB (cmn_err (CE_WARN, "ALLEGRO I/O base %04x\n", pci_ioaddr));
+
+ if (pci_ioaddr == 0)
+ {
+ cmn_err (CE_WARN, "I/O address not assigned by BIOS.\n");
+ return 0;
+ }
+
+ if (pci_irq_line == 0)
+ {
+ cmn_err (CE_WARN, "IRQ not assigned by BIOS (%d).\n", pci_irq_line);
+ return 0;
+ }
+
+ if ((devc = PMALLOC (osdev, sizeof (*devc))) == NULL)
+ {
+ cmn_err (CE_WARN, "Out of memory\n");
+ return 0;
+ }
+
+
+ devc->osdev = osdev;
+ osdev->devc = devc;
+ devc->irq = pci_irq_line;
+ devc->mpu_base = allegro_mpu_ioaddr;
+
+ devc->base = MAP_PCI_IOADDR (devc->osdev, 0, pci_ioaddr);
+ /* Remove I/O space marker in bit 0. */
+ devc->base &= ~3;
+
+ pci_command |= PCI_COMMAND_MASTER | PCI_COMMAND_IO;
+ pci_write_config_word (osdev, PCI_COMMAND, pci_command);
+
+ /* Enable Game port/MPU401 */
+ pci_read_config_word (osdev, PCI_LEGACY_AUDIO_CTRL, &pci_command);
+ pci_command = GAME_PORT_ENABLE | MPU401_IO_ENABLE | MPU401_IRQ_ENABLE;
+ pci_write_config_word (osdev, PCI_LEGACY_AUDIO_CTRL, pci_command);
+
+ switch (device)
+ {
+ case ESS_1988:
+ devc->model = MDL_ESS1998;
+ devc->chip_name = "ESS Allegro (ESS1998)";
+ bChipType = A1_1988;
+ break;
+ case ESS_1989:
+ devc->model = MDL_ESS1989;
+ devc->chip_name = "ESS Allegro (ESS1989)";
+ bChipType = A1_1989;
+ break;
+ case ESS_1990:
+ devc->model = MDL_ESS1990;
+ devc->chip_name = "ESS Canyon 3D (ESS1990)";
+ break;
+ case ESS_1992:
+ devc->model = MDL_ESS1992;
+ devc->chip_name = "ESS Canyon 3D-II (ESS1992)";
+ break;
+ case ESS_1998:
+ devc->model = MDL_ESS1998;
+ devc->chip_name = "ESS Maestro3 (ESS1998)";
+ bChipType = M3_1998;
+ break;
+ case ESS_1999:
+ devc->model = MDL_ESS1999;
+ devc->chip_name = "ESS Maestro3 (ESS1999)";
+ bChipType = M3_1999;
+ break;
+ case ESS_199A:
+ devc->model = MDL_ESS199A;
+ devc->chip_name = "ESS Maestro3 (ESS199A)";
+ bChipType = M3_199A;
+ break;
+ case ESS_199B:
+ devc->model = MDL_ESS199B;
+ devc->chip_name = "ESS Maestro3 (ESS199B)";
+ bChipType = M3_199B;
+ break;
+
+ }
+
+ MUTEX_INIT (devc->osdev, devc->mutex, MH_DRV);
+ MUTEX_INIT (devc->osdev, devc->low_mutex, MH_DRV + 1);
+
+ oss_register_device (osdev, devc->chip_name);
+
+ if ((err = oss_register_interrupts (devc->osdev, 0, allegrointr, NULL)) < 0)
+ {
+ cmn_err (CE_WARN, "Can't allocate IRQ%d, err=%d\n", pci_irq_line, err);
+ return 0;
+ }
+
+ return init_allegro (devc); /* Detected */
+}
+
+
+int
+oss_allegro_detach (oss_device_t * osdev)
+{
+ allegro_devc *devc = (allegro_devc *) osdev->devc;
+ int ret;
+
+ if (oss_disable_device (osdev) < 0)
+ return 0;
+
+
+ OUTW (devc->osdev, 0x00, devc->base + 0x18);
+
+ if (devc->mpu_attached)
+ {
+ uart401_disable (&devc->uart401devc);
+ devc->mpu_attached = 0;
+ }
+
+ oss_unregister_interrupts (devc->osdev);
+
+ ret = free_dmabuf (devc, 0); /* free playback mem */
+ if (ret != 0)
+ {
+ cmn_err (CE_WARN, "Couldn't free playback memory\n");
+ return 0;
+ }
+
+ ret = free_dmabuf (devc, 1); /* free record mem */
+ if (ret != 0)
+ {
+ cmn_err (CE_WARN, "Couldn't free record memory\n");
+ return 0;
+ }
+
+ MUTEX_CLEANUP (devc->mutex);
+ MUTEX_CLEANUP (devc->low_mutex);
+ UNMAP_PCI_IOADDR (devc->osdev, 0);
+
+ oss_unregister_device (osdev);
+ return 1;
+}
diff --git a/attic/drv/oss_allegro/oss_allegro.man b/attic/drv/oss_allegro/oss_allegro.man
new file mode 100644
index 0000000..b36bdbd
--- /dev/null
+++ b/attic/drv/oss_allegro/oss_allegro.man
@@ -0,0 +1,25 @@
+NAME
+oss_allegro - ESS Allegro/Maestro3 audio driver
+
+DESCRIPTION
+Open Sound System driver for ESS Allegro/Maestro3 sound cards.
+Allegro device characteristics:
+ - 8/16 bit playback/record
+ - mono/stereo playback/recording
+ - 8KHz to 48Khz sample rate.
+
+OPTIONS
+o allegro_amp=0|1
+Some ES1988 devices have the ESS19XX ac97 device that needs to be turned on.
+
+
+o allegro_mpu_ioaddr=<xxx>
+The ESS allegro device supports the UART401 device (not usually found in
+laptop models but only on certain PCI cards). Check the allegro.conf
+file (see below) for valid addresses.
+
+FILES
+CONFIGFILEPATH/oss_allegro.conf Device configuration file
+
+AUTHOR
+4Front Technologies
diff --git a/attic/drv/oss_allegro/port.h b/attic/drv/oss_allegro/port.h
new file mode 100644
index 0000000..78397f4
--- /dev/null
+++ b/attic/drv/oss_allegro/port.h
@@ -0,0 +1,82 @@
+/*
+ * ESS Technology allegro audio driver.
+ *
+ * Copyright (C) 1992-2000 Don Kim (don.kim@esstech.com)
+ *
+ */
+#define VOID void
+typedef void *PVOID;
+typedef char CHAR;
+typedef short SHORT;
+typedef long LONG;
+//typedef int BOOL;
+//typedef unsigned char UCHAR;
+typedef unsigned char *PBYTE;
+typedef unsigned short *PUSHORT;
+#define BYTE UCHAR
+#define BOOLEAN UCHAR
+typedef unsigned long DWORD;
+#define USHORT WORD
+typedef unsigned short WORD;
+#define ULONG DWORD
+#define IN
+#define OUT
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+typedef unsigned short *PWORD;
+typedef unsigned long *PDWORD;
+typedef unsigned long *PULONG;
+
+#define inp(o,a) INB(o, a)
+#define inpw(o,a) INW(o, a)
+#define outp(o,a,d) OUTB(o, d, a)
+#define outpw(o,a,d) OUTW(o, d, a)
+
+#define CRITENTER
+
+#define CRITLEAVE
+
+#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
+#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
+#define LOWORD(l) ((WORD)(l))
+#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
+#define LOBYTE(w) ((BYTE)(w))
+#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
+
+
+#define KeStallExecutionProcessor oss_udelay
+#define SoundDelay mdelay
+
+#define KeAcquireSpinLock(a, b)
+
+#define KeReleaseSpinLock(a, b)
+
+
+#define READ_PORT_UCHAR( o, a ) INB(o, a)
+#define READ_PORT_USHORT( o, a ) INW(o, a)
+#define WRITE_PORT_UCHAR( o, a, d ) OUTB(o, d, a)
+#define WRITE_PORT_USHORT( o, a, d ) OUTW(o, d, a)
+
+#define __cdecl
+
+typedef struct _WAVE_INFO
+{
+ ULONG SamplesPerSec;
+ UCHAR BitsPerSample;
+ UCHAR Channels;
+}
+WAVE_INFO, *PWAVE_INFO;
+
+#define KIRQL
+#define OldIrql
+
+#ifdef MDEBUG
+extern void dDbgOut (char *sz, ...);
+#define dprintf1( _x_ ) if (debug >= 1) dDbgOut _x_
+#define dprintf3( _x_ ) if (debug >= 3) dDbgOut _x_
+#else
+#define dprintf1( _x_ )
+#define dprintf3( _x_ )
+#endif
diff --git a/attic/drv/oss_allegro/srcmgr.h b/attic/drv/oss_allegro/srcmgr.h
new file mode 100644
index 0000000..987dadf
--- /dev/null
+++ b/attic/drv/oss_allegro/srcmgr.h
@@ -0,0 +1,2498 @@
+/*
+ * ESS Technology allegro audio driver.
+ *
+ * Copyright (C) 1992-2000 Don Kim (don.kim@esstech.com)
+ *
+ */
+#ifndef __SRCMGR_H
+#define __SRCMGR_H
+
+typedef enum
+{
+ KSSTATE_STOP,
+ /*KSSTATE_ACQUIRE, */
+ /*KSSTATE_PAUSE, */
+ KSSTATE_RUN
+}
+KSSTATE, *PKSSTATE;
+
+/* -------------------------------------------------------------------------- */
+
+typedef struct
+{
+ ULONG Physical;
+ ULONG Length;
+}
+MBUFFER, *PMBUFFER;
+
+typedef struct
+{
+ BYTE WaveType;
+ BOOLEAN Format16Bit;
+ BOOLEAN FormatStereo;
+ BOOLEAN SR_8khzFlag;
+ KSSTATE State;
+ ULONG Frequency;
+ ULONG Length;
+ PMBUFFER Buffer;
+
+ /* DSP kernel support */
+ PCLIENT_INST DspClientInstance;
+ USHORT wFreqIndex;
+ USHORT wSRC3VarLen;
+ ULONG StreamType;
+ ULONG PositionBeforePaused;
+}
+ALLEGRO_WAVE, *PALLEGRO_WAVE;
+
+
+#define WAVE_PLAYBACK 0
+#define WAVE_CAPTURE 1
+#define WAVE_MIXER 2
+
+extern PALLEGRO_WAVE CaptureStream;
+extern PALLEGRO_WAVE PlaybackStream;
+extern PALLEGRO_WAVE MidiStream;
+
+
+/*void AllocateStream ( BYTE waveType, PWAVE_INFO waveFormat ); */
+void InitStream ();
+void AllocateStream (allegro_devc * devc, BYTE waveType);
+void FreeStream (allegro_devc * devc, PALLEGRO_WAVE AllegroWave);
+ULONG SRCMGR_GetPosition (allegro_devc * devc, PALLEGRO_WAVE AllegroWave);
+void SetFormat (allegro_devc * devc, PALLEGRO_WAVE AllegroWave,
+ PWAVE_INFO waveFormat);
+/*void SetState ( struct ess_state *s, PALLEGRO_WAVE AllegroWave, KSSTATE NewState ); */
+void
+SRCMGR_SetVolume (allegro_devc * devc, IN PCLIENT_INST client, IN USHORT left,
+ IN USHORT right);
+void SRCMGR_SetRearVolume (allegro_devc * devc, IN PCLIENT_INST client,
+ IN USHORT left, IN USHORT right);
+void SRCMGR_SetPassThruVolume (allegro_devc * devc, IN PPASSTHRU client,
+ IN USHORT left, IN USHORT right);
+void SRCMGR_SetPassThruRearVolume (allegro_devc * devc, IN PPASSTHRU client,
+ IN USHORT left, IN USHORT right);
+/*#include "src3pbc.h" */
+short SRC3_PB_COEFF_HALF[5][666] = {
+
+
+#if 0
+ /* src3.5 44.1 khz */
+ {0, -1, 2, -6, 13, -26, 48, -83, 135, -212, 326, -497, 776, -1325, 3084,
+ 15636, -2172, 1090, -665, 431, -283, 183, -115, 70, -40, 21, -10, 4, -2, 0,
+ 0, -1, 4, -9, 20, -40, 72, -122, 199, -311, 477, -728, 1142, -1975, 4859,
+ 14731, -2854, 1472, -906, 588, -386, 250, -157, 94, -54, 28, -14, 6, -2, 0,
+ 0, -1, 5, -12, 26, -51, 92, -156, 253, -395, 605, -924, 1456, -2555, 6712,
+ 13518, -3263, 1725, -1069, 696, -456, 294, -184, 111, -63, 33, -16, 7, -2,
+ 1, 0, -2, 6, -14, 31, -60, 108, -182, 293, -457, 699, -1068, 1692, -3017,
+ 8574, 12046, -3408, 1842, -1149, 749, -491, 316, -197, 118, -66, 35, -16,
+ 7, -2, 1, 0, -2, 6, -16, 34, -65, 117, -196, 315, -490, 749, -1147, 1827,
+ -3315, 10376, 10376, -3315, 1827, -1147, 749, -490, 315, -196, 117, -65,
+ 34, -16, 6, -2, 0, 1, -2, 7, -16, 35, -66, 118, -197, 316, -491, 749,
+ -1149, 1842, -3408, 12046, 8574, -3017, 1692, -1068, 699, -457, 293, -182,
+ 108, -60, 31, -14, 6, -2, 0, 1, -2, 7, -16, 33, -63, 111, -184, 294, -456,
+ 696, -1069, 1725, -3263, 13518, 6712, -2555, 1456, -924, 605, -395, 253,
+ -156, 92, -51, 26, -12, 5, -1, 0, 0, -2, 6, -14, 28, -54, 94, -157, 250,
+ -386, 588, -906, 1472, -2854, 14731, 4859, -1975, 1142, -728, 477, -311,
+ 199, -122, 72, -40, 20, -9, 4, -1, 0, 0, -2, 4, -10, 21, -40, 70, -115,
+ 183, -283, 431, -665, 1090, -2172, 15636, 3084, -1325, 776, -497, 326,
+ -212, 135, -83, 48, -26, 13, -6, 2, -1, 0, 0, -1, 2, -6, 12, -22, 38, -62,
+ 98, -152, 231, -358, 591, -1215, 16195, 1447, -652, 386, -248, 163, -106,
+ 67, -41, 24, -13, 6, -3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -3, 6, -13,
+ 24, -41, 67, -106, 163, -248, 386, -652, 1447, 16195, -1215, 591, -358,
+ 231, -152, 98, -62, 38, -22, 12, -6, 2, -1, 0},
+#else /* if */ /* src3.6 44.1 khz */
+ {0,
+ -2,
+ 9,
+ -30,
+ 78,
+ -176,
+ 364,
+ -743,
+ 1859,
+ 16060,
+ -1459,
+ 633,
+ -312,
+ 149,
+ -64,
+ 23,
+ -7,
+ 1,
+ 0,
+ -4,
+ 17,
+ -54,
+ 141,
+ -315,
+ 647,
+ -1329,
+ 3466,
+ 15404,
+ -2260,
+ 1004,
+ -495,
+ 235,
+ -100,
+ 36,
+ -10,
+ 2,
+ 0,
+ -5,
+ 25,
+ -79,
+ 202,
+ -448,
+ 918,
+ -1897,
+ 5200,
+ 14423,
+ -2803,
+ 1269,
+ -627,
+ 296,
+ -125,
+ 44,
+ -12,
+ 2,
+ 1,
+ -8,
+ 33,
+ -102,
+ 258,
+ -566,
+ 1156,
+ -2406,
+ 7004,
+ 13158,
+ -3095,
+ 1425,
+ -703,
+ 330,
+ -137,
+ 47,
+ -12,
+ 2,
+ 1,
+ -9,
+ 40,
+ -122,
+ 302,
+ -658,
+ 1339,
+ -2813,
+ 8814,
+ 11661,
+ -3154,
+ 1473,
+ -726,
+ 338,
+ -139,
+ 47,
+ -12,
+ 2,
+ 1,
+ -11,
+ 45,
+ -135,
+ 330,
+ -714,
+ 1449,
+ -3077,
+ 10563,
+ 9991,
+ -3008,
+ 1422,
+ -700,
+ 323,
+ -131,
+ 44,
+ -11,
+ 1,
+ 2,
+ -12,
+ 48,
+ -139,
+ 338,
+ -724,
+ 1469,
+ -3158,
+ 12182,
+ 8215,
+ -2692,
+ 1285,
+ -631,
+ 289,
+ -116,
+ 38,
+ -9,
+ 1,
+ 2,
+ -12,
+ 47,
+ -134,
+ 321,
+ -684,
+ 1385,
+ -3024,
+ 13609,
+ 6399,
+ -2245,
+ 1081,
+ -529,
+ 240,
+ -95,
+ 30,
+ -7,
+ 1,
+ 2,
+ -11,
+ 42,
+ -118,
+ 278,
+ -589,
+ 1193,
+ -2650,
+ 14784,
+ 4611,
+ -1712,
+ 830,
+ -405,
+ 182,
+ -71,
+ 22,
+ -5,
+ 0,
+ 2,
+ -9,
+ 32,
+ -90,
+ 209,
+ -440,
+ 891,
+ -2021,
+ 15660,
+ 2913,
+ -1133,
+ 553,
+ -269,
+ 120,
+ -46,
+ 14,
+ -3,
+ 0,
+ 1,
+ -5,
+ 18,
+ -50,
+ 115,
+ -241,
+ 488,
+ -1135,
+ 16201,
+ 1361,
+ -551,
+ 270,
+ -131,
+ 58,
+ -22,
+ 7,
+ -1,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ 16384,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ 0,
+ -1,
+ 7,
+ -22,
+ 58,
+ -131,
+ 270,
+ -551,
+ 1361,
+ 16201,
+ -1135,
+ 488,
+ -241,
+ 115,
+ -50,
+ 18,
+ -5,
+ 1,
+ 0,
+ -3,
+ 14,
+ -46,
+ 120,
+ -269,
+ 553,
+ -1133,
+ 2913,
+ 15660,
+ -2021,
+ 891,
+ -440,
+ 209,
+ -90,
+ 32,
+ -9,
+ 2,
+ 0,
+ -5,
+ 22,
+ -71,
+ 182,
+ -405,
+ 830,
+ -1712,
+ 4611,
+ 14784,
+ -2650,
+ 1193,
+ -589,
+ 278,
+ -118,
+ 42,
+ -11,
+ 2,
+ 1,
+ -7,
+ 30,
+ -95,
+ 240,
+ -529,
+ 1081,
+ -2245,
+ 6399,
+ 13609,
+ -3024,
+ 1385,
+ -684,
+ 321,
+ -134,
+ 47,
+ -12,
+ 2,
+ 1,
+ -9,
+ 38,
+ -116,
+ 289,
+ -631,
+ 1285,
+ -2692,
+ 8215,
+ 12182,
+ -3158,
+ 1469,
+ -724,
+ 338,
+ -139,
+ 48,
+ -12,
+ 2,
+ 1,
+ -11,
+ 44,
+ -131,
+ 323,
+ -700,
+ 1422,
+ -3008,
+ 9991,
+ 10563,
+ -3077,
+ 1449,
+ -714,
+ 330,
+ -135,
+ 45,
+ -11,
+ 1,
+ 2,
+ -12,
+ 47,
+ -139,
+ 338,
+ -726,
+ 1473,
+ -3154,
+ 11661,
+ 8814,
+ -2813,
+ 1339,
+ -658,
+ 302,
+ -122,
+ 40,
+ -9,
+ 1,
+ 2,
+ -12,
+ 47,
+ -137,
+ 330,
+ -703,
+ 1425,
+ -3095,
+ 13158,
+ 7004,
+ -2406,
+ 1156,
+ -566,
+ 258,
+ -102,
+ 33,
+ -8,
+ 1,
+ 2,
+ -12,
+ 44,
+ -125,
+ 296,
+ -627,
+ 1269,
+ -2803,
+ 14423,
+ 5200,
+ -1897,
+ 918,
+ -448,
+ 202,
+ -79,
+ 25,
+ -5,
+ 0,
+ 2,
+ -10,
+ 36,
+ -100,
+ 235,
+ -495,
+ 1004,
+ -2260,
+ 15404,
+ 3466,
+ -1329,
+ 647,
+ -315,
+ 141,
+ -54,
+ 17,
+ -4,
+ 0,
+ 1,
+ -7,
+ 23,
+ -64,
+ 149,
+ -312,
+ 633,
+ -1459,
+ 16060,
+ 1859,
+ -743,
+ 364,
+ -176,
+ 78,
+ -30,
+ 9,
+ -2,
+ 0,
+ 0,
+ -2,
+ 7,
+ -18,
+ 40,
+ -84,
+ 171,
+ -405,
+ 16364,
+ 430,
+ -178,
+ 87,
+ -42,
+ 18,
+ -7,
+ 2,
+ -0,
+ 0,
+ 0,
+ -1,
+ 4,
+ -14,
+ 38,
+ -86,
+ 178,
+ -362,
+ 884,
+ 16303,
+ -783,
+ 334,
+ -165,
+ 79,
+ -34,
+ 13,
+ -4,
+ 1,
+ 0,
+ -2,
+ 11,
+ -38,
+ 99,
+ -222,
+ 458,
+ -938,
+ 2377,
+ 15879,
+ -1754,
+ 768,
+ -379,
+ 181,
+ -78,
+ 28,
+ -8,
+ 1,
+ 0,
+ -4,
+ 19,
+ -63,
+ 162,
+ -360,
+ 740,
+ -1522,
+ 4032,
+ 15111,
+ -2469,
+ 1104,
+ -545,
+ 258,
+ -110,
+ 39,
+ -11,
+ 2,
+ 1,
+ -6,
+ 28,
+ -87,
+ 222,
+ -490,
+ 1002,
+ -2075,
+ 5797,
+ 14031,
+ -2927,
+ 1333,
+ -658,
+ 310,
+ -130,
+ 46,
+ -12,
+ 2,
+ 1,
+ -8,
+ 35,
+ -109,
+ 274,
+ -600,
+ 1224,
+ -2555,
+ 7610,
+ 12682,
+ -3139,
+ 1453,
+ -717,
+ 335,
+ -139,
+ 48,
+ -12,
+ 2,
+ 1,
+ -10,
+ 42,
+ -127,
+ 314,
+ -681,
+ 1385,
+ -2919,
+ 9407,
+ 11120,
+ -3126,
+ 1466,
+ -723,
+ 335,
+ -137,
+ 46,
+ -11,
+ 1,
+ 1,
+ -11,
+ 46,
+ -137,
+ 335,
+ -723,
+ 1466,
+ -3126,
+ 11120,
+ 9407,
+ -2919,
+ 1385,
+ -681,
+ 314,
+ -127,
+ 42,
+ -10,
+ 1,
+ 2,
+ -12,
+ 48,
+ -139,
+ 335,
+ -717,
+ 1453,
+ -3139,
+ 12682,
+ 7610,
+ -2555,
+ 1224,
+ -600,
+ 274,
+ -109,
+ 35,
+ -8,
+ 1,
+ 2,
+ -12,
+ 46,
+ -130,
+ 310,
+ -658,
+ 1333,
+ -2927,
+ 14031,
+ 5797,
+ -2075,
+ 1002,
+ -490,
+ 222,
+ -87,
+ 28,
+ -6,
+ 1,
+ 2,
+ -11,
+ 39,
+ -110,
+ 258,
+ -545,
+ 1104,
+ -2469,
+ 15111,
+ 4032,
+ -1522,
+ 740,
+ -360,
+ 162,
+ -63,
+ 19,
+ -4,
+ 0,
+ 1,
+ -8,
+ 28,
+ -78,
+ 181,
+ -379,
+ 768,
+ -1754,
+ 15879,
+ 2377,
+ -938,
+ 458,
+ -222,
+ 99,
+ -38,
+ 11,
+ -2,
+ 0,
+ 1,
+ -4,
+ 13,
+ -34,
+ 79,
+ -165,
+ 334,
+ -783,
+ 16303,
+ 884,
+ -362,
+ 178,
+ -86,
+ 38,
+ -14,
+ 4,
+ -1,
+ 0,
+ 0,
+ -0,
+ 2,
+ -7,
+ 18,
+ -42,
+ 87,
+ -178,
+ 430,
+ 16364,
+ -405,
+ 171,
+ -84,
+ 40,
+ -18,
+ 7,
+ -2,
+ 0,
+ },
+
+
+#endif
+/* 32khz */
+ {-1,
+ 8,
+ -31,
+ 85,
+ -198,
+ 410,
+ -788,
+ 1490,
+ -3112,
+ 13478,
+ 6633,
+ -2373,
+ 1202,
+ -637,
+ 325,
+ -151,
+ 62,
+ -21,
+ 5,
+ -1,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ 16384,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ -1,
+ 5,
+ -21,
+ 62,
+ -151,
+ 325,
+ -637,
+ 1202,
+ -2373,
+ 6633,
+ 13478,
+ -3112,
+ 1490,
+ -788,
+ 410,
+ -198,
+ 85,
+ -31,
+ 8,
+ -1,
+ },
+
+#if 0 /* src3.6 */
+/* 22.05 khz */
+ {1, -4, 11, -29, 63, -124, 226, -387, 639, -1039, 1741, -3337, 12626, 7840,
+ -2805, 1536, -928, 570, -343, 198, -107, 53, -24, 9, -3, 0, 0, -1, 3, -10,
+ 22, -46, 86, -151, 253, -412, 677, -1192, 2807, 15743, -2023, 987, -579,
+ 355, -217, 128, -71, 37, -17, 7, -2, 1, 1, -3, 11, -27, 59, -115, 208,
+ -355, 584, -950, 1600, -3128, 13912, 6117, -2340, 1298, -787, 483, -290,
+ 167, -90, 44, -19, 7, -2, 0, 0, -1, 5, -15, 34, -69, 128, -224, 375, -611,
+ 1005, -1790, 4422, 14964, -2693, 1347, -795, 488, -297, 175, -97, 50, -23,
+ 9, -3, 1, 1, -3, 9, -23, 50, -97, 175, -297, 488, -795, 1347, -2693, 14964,
+ 4422, -1790, 1005, -611, 375, -224, 128, -69, 34, -15, 5, -1, 0, 0, -2, 7,
+ -19, 44, -90, 167, -290, 483, -787, 1298, -2340, 6117, 13912, -3128, 1600,
+ -950, 584, -355, 208, -115, 59, -27, 11, -3, 1, 1, -2, 7, -17, 37, -71,
+ 128, -217, 355, -579, 987, -2023, 15743, 2807, -1192, 677, -412, 253, -151,
+ 86, -46, 22, -10, 3, -1, 0, 0, -3, 9, -24, 53, -107, 198, -343, 570, -928,
+ 1536, -2805, 7840, 12626, -3337, 1741, -1039, 639, -387, 226, -124, 63,
+ -29, 11, -4, 1, 0, -1, 4, -10, 20, -39, 69, -116, 190, -310, 532, -1122,
+ 16222, 1320, -585, 335, -205, 125, -75, 42, -22, 11, -5, 2, 0, 0, 1, -3,
+ 10, -27, 60, -120, 220, -380, 629, -1023, 1699, -3148, 9537, 11150, -3336,
+ 1772, -1062, 653, -395, 230, -126, 63, -29, 11, -3, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -3, 11,
+ -29, 63, -126, 230, -395, 653, -1062, 1772, -3336, 11150, 9537, -3148,
+ 1699, -1023, 629, -380, 220, -120, 60, -27, 10, -3, 1, 0, 0, 2, -5, 11,
+ -22, 42, -75, 125, -205, 335, -585, 1320, 16222, -1122, 532, -310, 190,
+ -116, 69, -39, 20, -10, 4, -1, 0},
+#else /* src3.7 */
+ {2,
+ -12,
+ 47,
+ -139,
+ 338,
+ -726,
+ 1473,
+ -3154,
+ 11661,
+ 8814,
+ -2813,
+ 1339,
+ -658,
+ 302,
+ -122,
+ 40,
+ -9,
+ 1,
+ 0,
+ -2,
+ 9,
+ -30,
+ 78,
+ -176,
+ 364,
+ -743,
+ 1859,
+ 16060,
+ -1459,
+ 633,
+ -312,
+ 149,
+ -64,
+ 23,
+ -7,
+ 1,
+ 2,
+ -12,
+ 47,
+ -137,
+ 330,
+ -703,
+ 1425,
+ -3095,
+ 13158,
+ 7004,
+ -2406,
+ 1156,
+ -566,
+ 258,
+ -102,
+ 33,
+ -8,
+ 1,
+ 0,
+ -4,
+ 17,
+ -54,
+ 141,
+ -315,
+ 647,
+ -1329,
+ 3466,
+ 15404,
+ -2260,
+ 1004,
+ -495,
+ 235,
+ -100,
+ 36,
+ -10,
+ 2,
+ 2,
+ -12,
+ 44,
+ -125,
+ 296,
+ -627,
+ 1269,
+ -2803,
+ 14423,
+ 5200,
+ -1897,
+ 918,
+ -448,
+ 202,
+ -79,
+ 25,
+ -5,
+ 0,
+ 0,
+ -5,
+ 25,
+ -79,
+ 202,
+ -448,
+ 918,
+ -1897,
+ 5200,
+ 14423,
+ -2803,
+ 1269,
+ -627,
+ 296,
+ -125,
+ 44,
+ -12,
+ 2,
+ 2,
+ -10,
+ 36,
+ -100,
+ 235,
+ -495,
+ 1004,
+ -2260,
+ 15404,
+ 3466,
+ -1329,
+ 647,
+ -315,
+ 141,
+ -54,
+ 17,
+ -4,
+ 0,
+ 1,
+ -8,
+ 33,
+ -102,
+ 258,
+ -566,
+ 1156,
+ -2406,
+ 7004,
+ 13158,
+ -3095,
+ 1425,
+ -703,
+ 330,
+ -137,
+ 47,
+ -12,
+ 2,
+ 1,
+ -7,
+ 23,
+ -64,
+ 149,
+ -312,
+ 633,
+ -1459,
+ 16060,
+ 1859,
+ -743,
+ 364,
+ -176,
+ 78,
+ -30,
+ 9,
+ -2,
+ 0,
+ 1,
+ -9,
+ 40,
+ -122,
+ 302,
+ -658,
+ 1339,
+ -2813,
+ 8814,
+ 11661,
+ -3154,
+ 1473,
+ -726,
+ 338,
+ -139,
+ 47,
+ -12,
+ 2,
+ 0,
+ -2,
+ 7,
+ -18,
+ 40,
+ -84,
+ 171,
+ -405,
+ 16364,
+ 430,
+ -178,
+ 87,
+ -42,
+ 18,
+ -7,
+ 2,
+ -0,
+ 0,
+ 1,
+ -11,
+ 45,
+ -135,
+ 330,
+ -714,
+ 1449,
+ -3077,
+ 10563,
+ 9991,
+ -3008,
+ 1422,
+ -700,
+ 323,
+ -131,
+ 44,
+ -11,
+ 1,
+ 0,
+ -1,
+ 4,
+ -14,
+ 38,
+ -86,
+ 178,
+ -362,
+ 884,
+ 16303,
+ -783,
+ 334,
+ -165,
+ 79,
+ -34,
+ 13,
+ -4,
+ 1,
+ 2,
+ -12,
+ 48,
+ -139,
+ 338,
+ -724,
+ 1469,
+ -3158,
+ 12182,
+ 8215,
+ -2692,
+ 1285,
+ -631,
+ 289,
+ -116,
+ 38,
+ -9,
+ 1,
+ 0,
+ -2,
+ 11,
+ -38,
+ 99,
+ -222,
+ 458,
+ -938,
+ 2377,
+ 15879,
+ -1754,
+ 768,
+ -379,
+ 181,
+ -78,
+ 28,
+ -8,
+ 1,
+ 2,
+ -12,
+ 47,
+ -134,
+ 321,
+ -684,
+ 1385,
+ -3024,
+ 13609,
+ 6399,
+ -2245,
+ 1081,
+ -529,
+ 240,
+ -95,
+ 30,
+ -7,
+ 1,
+ 0,
+ -4,
+ 19,
+ -63,
+ 162,
+ -360,
+ 740,
+ -1522,
+ 4032,
+ 15111,
+ -2469,
+ 1104,
+ -545,
+ 258,
+ -110,
+ 39,
+ -11,
+ 2,
+ 2,
+ -11,
+ 42,
+ -118,
+ 278,
+ -589,
+ 1193,
+ -2650,
+ 14784,
+ 4611,
+ -1712,
+ 830,
+ -405,
+ 182,
+ -71,
+ 22,
+ -5,
+ 0,
+ 1,
+ -6,
+ 28,
+ -87,
+ 222,
+ -490,
+ 1002,
+ -2075,
+ 5797,
+ 14031,
+ -2927,
+ 1333,
+ -658,
+ 310,
+ -130,
+ 46,
+ -12,
+ 2,
+ 2,
+ -9,
+ 32,
+ -90,
+ 209,
+ -440,
+ 891,
+ -2021,
+ 15660,
+ 2913,
+ -1133,
+ 553,
+ -269,
+ 120,
+ -46,
+ 14,
+ -3,
+ 0,
+ 1,
+ -8,
+ 35,
+ -109,
+ 274,
+ -600,
+ 1224,
+ -2555,
+ 7610,
+ 12682,
+ -3139,
+ 1453,
+ -717,
+ 335,
+ -139,
+ 48,
+ -12,
+ 2,
+ 1,
+ -5,
+ 18,
+ -50,
+ 115,
+ -241,
+ 488,
+ -1135,
+ 16201,
+ 1361,
+ -551,
+ 270,
+ -131,
+ 58,
+ -22,
+ 7,
+ -1,
+ 0,
+ 1,
+ -10,
+ 42,
+ -127,
+ 314,
+ -681,
+ 1385,
+ -2919,
+ 9407,
+ 11120,
+ -3126,
+ 1466,
+ -723,
+ 335,
+ -137,
+ 46,
+ -11,
+ 1,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ 16384,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ -0,
+ 0,
+ 1,
+ -11,
+ 46,
+ -137,
+ 335,
+ -723,
+ 1466,
+ -3126,
+ 11120,
+ 9407,
+ -2919,
+ 1385,
+ -681,
+ 314,
+ -127,
+ 42,
+ -10,
+ 1,
+ 0,
+ -1,
+ 7,
+ -22,
+ 58,
+ -131,
+ 270,
+ -551,
+ 1361,
+ 16201,
+ -1135,
+ 488,
+ -241,
+ 115,
+ -50,
+ 18,
+ -5,
+ 1,
+ 2,
+ -12,
+ 48,
+ -139,
+ 335,
+ -717,
+ 1453,
+ -3139,
+ 12682,
+ 7610,
+ -2555,
+ 1224,
+ -600,
+ 274,
+ -109,
+ 35,
+ -8,
+ 1,
+ 0,
+ -3,
+ 14,
+ -46,
+ 120,
+ -269,
+ 553,
+ -1133,
+ 2913,
+ 15660,
+ -2021,
+ 891,
+ -440,
+ 209,
+ -90,
+ 32,
+ -9,
+ 2,
+ 2,
+ -12,
+ 46,
+ -130,
+ 310,
+ -658,
+ 1333,
+ -2927,
+ 14031,
+ 5797,
+ -2075,
+ 1002,
+ -490,
+ 222,
+ -87,
+ 28,
+ -6,
+ 1,
+ 0,
+ -5,
+ 22,
+ -71,
+ 182,
+ -405,
+ 830,
+ -1712,
+ 4611,
+ 14784,
+ -2650,
+ 1193,
+ -589,
+ 278,
+ -118,
+ 42,
+ -11,
+ 2,
+ 2,
+ -11,
+ 39,
+ -110,
+ 258,
+ -545,
+ 1104,
+ -2469,
+ 15111,
+ 4032,
+ -1522,
+ 740,
+ -360,
+ 162,
+ -63,
+ 19,
+ -4,
+ 0,
+ 1,
+ -7,
+ 30,
+ -95,
+ 240,
+ -529,
+ 1081,
+ -2245,
+ 6399,
+ 13609,
+ -3024,
+ 1385,
+ -684,
+ 321,
+ -134,
+ 47,
+ -12,
+ 2,
+ 1,
+ -8,
+ 28,
+ -78,
+ 181,
+ -379,
+ 768,
+ -1754,
+ 15879,
+ 2377,
+ -938,
+ 458,
+ -222,
+ 99,
+ -38,
+ 11,
+ -2,
+ 0,
+ 1,
+ -9,
+ 38,
+ -116,
+ 289,
+ -631,
+ 1285,
+ -2692,
+ 8215,
+ 12182,
+ -3158,
+ 1469,
+ -724,
+ 338,
+ -139,
+ 48,
+ -12,
+ 2,
+ 1,
+ -4,
+ 13,
+ -34,
+ 79,
+ -165,
+ 334,
+ -783,
+ 16303,
+ 884,
+ -362,
+ 178,
+ -86,
+ 38,
+ -14,
+ 4,
+ -1,
+ 0,
+ 1,
+ -11,
+ 44,
+ -131,
+ 323,
+ -700,
+ 1422,
+ -3008,
+ 9991,
+ 10563,
+ -3077,
+ 1449,
+ -714,
+ 330,
+ -135,
+ 45,
+ -11,
+ 1,
+ 0,
+ -0,
+ 2,
+ -7,
+ 18,
+ -42,
+ 87,
+ -178,
+ 430,
+ 16364,
+ -405,
+ 171,
+ -84,
+ 40,
+ -18,
+ 7,
+ -2,
+ 0,
+ },
+
+#endif
+
+/* 11.025 khz */
+ {0, -1, 2, -7, 19, -43, 89, -169, 303, -529, 947, -1999, 15740, 2789, -1157,
+ 629, -360, 204, -110, 55, -25, 10, -3, 1, 0, 0, 0, -1, 3, -11, 31, -73,
+ 153, -296, 535, -937, 1655, -3280, 12609, 7814, -2740, 1444, -824, 469,
+ -256, 130, -61, 25, -9, 3, 0, 0, 0, 0, 3, -9, 25, -61, 130, -256, 469,
+ -824, 1444, -2740, 7814, 12609, -3280, 1655, -937, 535, -296, 153, -73, 31,
+ -11, 3, -1, 0, 0, 0, 1, -3, 10, -25, 55, -110, 204, -360, 629, -1157, 2789,
+ 15740, -1999, 947, -529, 303, -169, 89, -43, 19, -7, 2, -1, 0, 0, 0, 1, -4,
+ 11, -24, 48, -91, 163, -285, 512, -1110, 16221, 1310, -566, 310, -178, 100,
+ -54, 27, -12, 5, -2, 0, 0, 0, 0, -1, 3, -11, 29, -68, 142, -273, 492, -860,
+ 1525, -3081, 13900, 6091, -2281, 1216, -695, 395, -214, 109, -50, 21, -7,
+ 2, 0, 0, 0, -1, 3, -10, 29, -69, 146, -285, 520, -913, 1604, -3082, 9512,
+ 11129, -3273, 1678, -953, 544, -299, 154, -73, 31, -11, 3, -1, 0, 0, 0, 1,
+ -5, 15, -38, 83, -164, 304, -537, 938, -1740, 4398, 14957, -2657, 1288,
+ -724, 414, -231, 121, -58, 25, -10, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -10, 25, -58,
+ 121, -231, 414, -724, 1288, -2657, 14957, 4398, -1740, 938, -537, 304,
+ -164, 83, -38, 15, -5, 1, 0, 0, 0, -1, 3, -11, 31, -73, 154, -299, 544,
+ -953, 1678, -3273, 11129, 9512, -3082, 1604, -913, 520, -285, 146, -69, 29,
+ -10, 3, -1, 0, 0, 0, 2, -7, 21, -50, 109, -214, 395, -695, 1216, -2281,
+ 6091, 13900, -3081, 1525, -860, 492, -273, 142, -68, 29, -11, 3, -1, 0, 0,
+ 0, 0, -2, 5, -12, 27, -54, 100, -178, 310, -566, 1310, 16221, -1110, 512,
+ -285, 163, -91, 48, -24, 11, -4, 1, 0, 0},
+
+
+ /* 8khz */
+
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 2, -4, 6, -8, 11, -16, 21,
+ -28, 36, -47, 60, -76, 95, -118, 146, -181, 223, -277, 345, -438, 571,
+ -781, 1174, -2219, 15643, 3118, -1397, 882, -629, 477, -373, 297, -240,
+ 194, -157, 127, -102, 82, -65, 51, -40, 30, -23, 17, -13, 9, -6, 4, -3, 2,
+ -1, 1, 0, 0, 0, 0, 0, -1, 1, -2, 4, -6, 9, -13, 18, -26, 35, -46, 60, -78,
+ 100, -126, 159, -198, 245, -302, 373, -462, 576, -728, 944, -1278, 1881,
+ -3356, 13542, 6759, -2670, 1631, -1147, 862, -672, 535, -430, 348, -282,
+ 228, -184, 147, -117, 92, -72, 55, -42, 31, -23, 16, -12, 8, -5, 3, -2, 1,
+ -1, 0, 0, 0, 0, -1, 1, -3, 4, -6, 10, -14, 20, -28, 38, -51, 67, -87, 111,
+ -140, 176, -220, 273, -337, 416, -515, 641, -807, 1041, -1397, 2018, -3436,
+ 10417, 10417, -3436, 2018, -1397, 1041, -807, 641, -515, 416, -337, 273,
+ -220, 176, -140, 111, -87, 67, -51, 38, -28, 20, -14, 10, -6, 4, -3, 1, -1,
+ 0, 0, 0, 0, -1, 1, -2, 3, -5, 8, -12, 16, -23, 31, -42, 55, -72, 92, -117,
+ 147, -184, 228, -282, 348, -430, 535, -672, 862, -1147, 1631, -2670, 6759,
+ 13542, -3356, 1881, -1278, 944, -728, 576, -462, 373, -302, 245, -198, 159,
+ -126, 100, -78, 60, -46, 35, -26, 18, -13, 9, -6, 4, -2, 1, -1, 0, 0, 0, 0,
+ 0, 1, -1, 2, -3, 4, -6, 9, -13, 17, -23, 30, -40, 51, -65, 82, -102, 127,
+ -157, 194, -240, 297, -373, 477, -629, 882, -1397, 3118, 15643, -2219,
+ 1174, -781, 571, -438, 345, -277, 223, -181, 146, -118, 95, -76, 60, -47,
+ 36, -28, 21, -16, 11, -8, 6, -4, 2, -1, 1, 0, 0, 0}
+};
+
+/*#include "src3rec.h" */
+#define REDUCED_FILTER 1
+
+#if REDUCED_FILTER
+/*short SRC3_REC_COEFF_HALF[4][313] = { */
+short SRC3_REC_COEFF_HALF[5][680] = {
+#else /* if */
+short SRC3_REC_COEFF_HALF[4][528] = {
+#endif
+
+#if REDUCED_FILTER
+
+#if 1 /* Higher Sampling Rate Acuracy for 44.1khz */
+ {2,
+ -11,
+ 44,
+ -126,
+ 288,
+ -552,
+ 921,
+ -1398,
+ 2184,
+ 14981,
+ 395,
+ -683,
+ 594,
+ -412,
+ 237,
+ -112,
+ 42,
+ -11,
+ 2,
+ 0,
+ 2,
+ -11,
+ 43,
+ -117,
+ 252,
+ -450,
+ 680,
+ -862,
+ 812,
+ 15037,
+ 1708,
+ -1221,
+ 843,
+ -520,
+ 278,
+ -124,
+ 44,
+ -11,
+ 2,
+ 0,
+ 2,
+ -11,
+ 39,
+ -101,
+ 204,
+ -331,
+ 421,
+ -333,
+ -372,
+ 14758,
+ 3185,
+ -1743,
+ 1062,
+ -605,
+ 303,
+ -128,
+ 43,
+ -10,
+ 1,
+ 0,
+ 1,
+ -9,
+ 33,
+ -80,
+ 149,
+ -204,
+ 163,
+ 157,
+ -1340,
+ 14155,
+ 4778,
+ -2211,
+ 1231,
+ -656,
+ 310,
+ -123,
+ 38,
+ -8,
+ 1,
+ 0,
+ 1,
+ -8,
+ 25,
+ -58,
+ 91,
+ -79,
+ -77,
+ 582,
+ -2077,
+ 13254,
+ 6436,
+ -2585,
+ 1332,
+ -666,
+ 295,
+ -108,
+ 30,
+ -5,
+ -0,
+ 0,
+ 1,
+ -6,
+ 18,
+ -35,
+ 35,
+ 37,
+ -287,
+ 922,
+ -2576,
+ 12092,
+ 8100,
+ -2828,
+ 1350,
+ -629,
+ 256,
+ -82,
+ 17,
+ 0,
+ -1,
+ 0,
+ 1,
+ -4,
+ 11,
+ -13,
+ -16,
+ 137,
+ -455,
+ 1166,
+ -2844,
+ 10715,
+ 9706,
+ -2902,
+ 1273,
+ -541,
+ 192,
+ -46,
+ -0,
+ 6,
+ -3,
+ 0,
+ 0,
+ -2,
+ 4,
+ 6,
+ -59,
+ 216,
+ -576,
+ 1309,
+ -2898,
+ 9181,
+ 11195,
+ -2779,
+ 1096,
+ -404,
+ 106,
+ 0,
+ -20,
+ 13,
+ -4,
+ 1,
+ 0,
+ -1,
+ -2,
+ 22,
+ -92,
+ 272,
+ -646,
+ 1354,
+ -2764,
+ 7548,
+ 12505,
+ -2435,
+ 819,
+ -221,
+ -0,
+ 53,
+ -42,
+ 20,
+ -6,
+ 1,
+ 0,
+ 0,
+ -6,
+ 33,
+ -114,
+ 303,
+ -667,
+ 1307,
+ -2473,
+ 5880,
+ 13585,
+ -1858,
+ 449,
+ 0,
+ -120,
+ 110,
+ -65,
+ 28,
+ -8,
+ 1,
+ 1,
+ -9,
+ 40,
+ -126,
+ 310,
+ -643,
+ 1181,
+ -2063,
+ 4237,
+ 14391,
+ -1043,
+ -0,
+ 248,
+ -247,
+ 167,
+ -87,
+ 35,
+ -10,
+ 1,
+ 0,
+ 1,
+ -11,
+ 44,
+ -128,
+ 297,
+ -580,
+ 994,
+ -1573,
+ 2677,
+ 14888,
+ 0,
+ -506,
+ 508,
+ -372,
+ 221,
+ -106,
+ 40,
+ -11,
+ 2,
+ 0,
+ 2,
+ -11,
+ 43,
+ -121,
+ 265,
+ -487,
+ 763,
+ -1041,
+ 1251,
+ 15056,
+ 1251,
+ -1041,
+ 763,
+ -487,
+ 265,
+ -121,
+ 43,
+ -11,
+ 2,
+ 0,
+ 2,
+ -11,
+ 40,
+ -106,
+ 221,
+ -372,
+ 508,
+ -506,
+ 0,
+ 14888,
+ 2677,
+ -1573,
+ 994,
+ -580,
+ 297,
+ -128,
+ 44,
+ -11,
+ 1,
+ 0,
+ 1,
+ -10,
+ 35,
+ -87,
+ 167,
+ -247,
+ 248,
+ -0,
+ -1043,
+ 14391,
+ 4237,
+ -2063,
+ 1181,
+ -643,
+ 310,
+ -126,
+ 40,
+ -9,
+ 1,
+ 0,
+ 1,
+ -8,
+ 28,
+ -65,
+ 110,
+ -120,
+ 0,
+ 449,
+ -1858,
+ 13585,
+ 5880,
+ -2473,
+ 1307,
+ -667,
+ 303,
+ -114,
+ 33,
+ -6,
+ 0,
+ 0,
+ 1,
+ -6,
+ 20,
+ -42,
+ 53,
+ -0,
+ -221,
+ 819,
+ -2435,
+ 12505,
+ 7548,
+ -2764,
+ 1354,
+ -646,
+ 272,
+ -92,
+ 22,
+ -2,
+ -1,
+ 0,
+ 1,
+ -4,
+ 13,
+ -20,
+ 0,
+ 106,
+ -404,
+ 1096,
+ -2779,
+ 11195,
+ 9181,
+ -2898,
+ 1309,
+ -576,
+ 216,
+ -59,
+ 6,
+ 4,
+ -2,
+ 0,
+ 0,
+ -3,
+ 6,
+ -0,
+ -46,
+ 192,
+ -541,
+ 1273,
+ -2902,
+ 9706,
+ 10715,
+ -2844,
+ 1166,
+ -455,
+ 137,
+ -16,
+ -13,
+ 11,
+ -4,
+ 1,
+ 0,
+ -1,
+ 0,
+ 17,
+ -82,
+ 256,
+ -629,
+ 1350,
+ -2828,
+ 8100,
+ 12092,
+ -2576,
+ 922,
+ -287,
+ 37,
+ 35,
+ -35,
+ 18,
+ -6,
+ 1,
+ 0,
+ -0,
+ -5,
+ 30,
+ -108,
+ 295,
+ -666,
+ 1332,
+ -2585,
+ 6436,
+ 13254,
+ -2077,
+ 582,
+ -77,
+ -79,
+ 91,
+ -58,
+ 25,
+ -8,
+ 1,
+ 1,
+ -8,
+ 38,
+ -123,
+ 310,
+ -656,
+ 1231,
+ -2211,
+ 4778,
+ 14155,
+ -1340,
+ 157,
+ 163,
+ -204,
+ 149,
+ -80,
+ 33,
+ -9,
+ 1,
+ 0,
+ 1,
+ -10,
+ 43,
+ -128,
+ 303,
+ -605,
+ 1062,
+ -1743,
+ 3185,
+ 14758,
+ -372,
+ -333,
+ 421,
+ -331,
+ 204,
+ -101,
+ 39,
+ -11,
+ 2,
+ 0,
+ 2,
+ -11,
+ 44,
+ -124,
+ 278,
+ -520,
+ 843,
+ -1221,
+ 1708,
+ 15037,
+ 812,
+ -862,
+ 680,
+ -450,
+ 252,
+ -117,
+ 43,
+ -11,
+ 2,
+ 0,
+ 2,
+ -11,
+ 42,
+ -112,
+ 237,
+ -412,
+ 594,
+ -683,
+ 395,
+ 14981,
+ 2184,
+ -1398,
+ 921,
+ -552,
+ 288,
+ -126,
+ 44,
+ -11,
+ 2,
+ 0,
+ 2,
+ -10,
+ 37,
+ -94,
+ 186,
+ -289,
+ 334,
+ -164,
+ -720,
+ 14592,
+ 3705,
+ -1907,
+ 1125,
+ -626,
+ 308,
+ -128,
+ 42,
+ -10,
+ 1,
+ 0,
+ 1,
+ -9,
+ 30,
+ -73,
+ 129,
+ -162,
+ 80,
+ 307,
+ -1612,
+ 13886,
+ 5327,
+ -2348,
+ 1273,
+ -664,
+ 308,
+ -120,
+ 36,
+ -7,
+ 1,
+ 0,
+ 1,
+ -7,
+ 23,
+ -50,
+ 72,
+ -39,
+ -151,
+ 705,
+ -2269,
+ 12893,
+ 6993,
+ -2683,
+ 1348,
+ -659,
+ 285,
+ -101,
+ 26,
+ -3,
+ -0,
+ 0,
+ 1,
+ -5,
+ 15,
+ -27,
+ 17,
+ 73,
+ -348,
+ 1015,
+ -2690,
+ 11654,
+ 8645,
+ -2873,
+ 1335,
+ -605,
+ 237,
+ -71,
+ 12,
+ 2,
+ -2,
+ 0,
+ 0,
+ -3,
+ 8,
+ -6,
+ -31,
+ 166,
+ -501,
+ 1225,
+ -2885,
+ 10219,
+ 10219,
+ -2885,
+ 1225,
+ -501,
+ 166,
+ -31,
+ -6,
+ 8,
+ -3,
+ 0,
+ 0,
+ -2,
+ 2,
+ 12,
+ -71,
+ 237,
+ -605,
+ 1335,
+ -2873,
+ 8645,
+ 11654,
+ -2690,
+ 1015,
+ -348,
+ 73,
+ 17,
+ -27,
+ 15,
+ -5,
+ 1,
+ 0,
+ -0,
+ -3,
+ 26,
+ -101,
+ 285,
+ -659,
+ 1348,
+ -2683,
+ 6993,
+ 12893,
+ -2269,
+ 705,
+ -151,
+ -39,
+ 72,
+ -50,
+ 23,
+ -7,
+ 1,
+ 0,
+ 1,
+ -7,
+ 36,
+ -120,
+ 308,
+ -664,
+ 1273,
+ -2348,
+ 5327,
+ 13886,
+ -1612,
+ 307,
+ 80,
+ -162,
+ 129,
+ -73,
+ 30,
+ -9,
+ 1,
+ 1,
+ -10,
+ 42,
+ -128,
+ 308,
+ -626,
+ 1125,
+ -1907,
+ 3705,
+ 14592,
+ -720,
+ -164,
+ 334,
+ -289,
+ 186,
+ -94,
+ 37,
+ -10,
+ 2,
+ 0,
+ },
+
+#else /* if */ /* Less Acurate for 44.1khz */
+ {1, -5, 19, -53, 119, -224, 363, -511, 613, -558, 0, 14844, 2791, -1712,
+ 1170, -769, 464, -250, 117, -45, 13, -2, 0, 0, 1, -6, 20, -51, 108, -189,
+ 282, -344, 302, 0, -1091, 14326, 4409, -2226, 1371, -835, 472, -237, 102,
+ -34, 7, 0, -1, 0, 1, -6, 18, -46, 90, -146, 189, -170, 0, 500, -1942,
+ 13488, 6103, -2642, 1492, -846, 444, -205, 77, -19, 0, 3, -1, 0, 1, -5, 16,
+ -38, 69, -97, 93, 0, -274, 916, -2543, 12366, 7811, -2917, 1516, -796, 381,
+ -153, 42, 0, -9, 6, -2, 0, 1, -4, 13, -29, 46, -48, 0, 154, -505, 1230,
+ -2895, 11007, 9468, -3012, 1430, -681, 283, -83, 0, 22, -19, 10, -3, 1, 1,
+ -3, 10, -19, 22, 0, -83, 283, -681, 1430, -3012, 9468, 11007, -2895, 1230,
+ -505, 154, 0, -48, 46, -29, 13, -4, 1, 0, -2, 6, -9, 0, 42, -153, 381,
+ -796, 1516, -2917, 7811, 12366, -2543, 916, -274, 0, 93, -97, 69, -38, 16,
+ -5, 1, 0, -1, 3, 0, -19, 77, -205, 444, -846, 1492, -2642, 6103, 13488,
+ -1942, 500, 0, -170, 189, -146, 90, -46, 18, -6, 1, 0, -1, 0, 7, -34, 102,
+ -237, 472, -835, 1371, -2226, 4409, 14326, -1091, 0, 302, -344, 282, -189,
+ 108, -51, 20, -6, 1, 0, 0, -2, 13, -45, 117, -250, 464, -769, 1170, -1712,
+ 2791, 14844, 0, -558, 613, -511, 363, -224, 119, -53, 19, -5, 1, 0, -4, 17,
+ -51, 123, -245, 426, -657, 910, -1142, 1306, 15019, 1306, -1142, 910, -657,
+ 426, -245, 123, -51, 17, -4, 0, 0},
+#endif
+
+#else /* if */ /* not reduced 44k filter */
+ {0, 1, -2, 4, -7, 11, -16, 20, -21, 16, 0, -31, 81, -152, 245, -358, 482,
+ -606, 715, -785, 780, -623, 0, 14847, 2849, -1874, 1448, -1135, 869, -637,
+ 438, -275, 149, -59, 0, 33, -46, 46, -39, 30, -20, 12, -7, 3, -1, 0, 0, 0,
+ 0, 1, -2, 4, -6, 10, -13, 14, -11, 0, 22, -58, 111, -182, 267, -361, 454,
+ -531, 569, -539, 390, 0, -1129, 14338, 4482, -2417, 1674, -1210, 862, -585,
+ 366, -199, 79, 0, -45, 65, -67, 59, -46, 32, -20, 11, -6, 2, -1, 0, 0, 0,
+ 0, 1, -2, 3, -5, 8, -9, 7, 0, -15, 41, -80, 132, -197, 270, -341, 398,
+ -423, 392, -272, 0, 569, -2022, 13513, 6183, -2846, 1798, -1205, 793, -490,
+ 265, -105, 0, 62, -90, 94, -84, 67, -49, 32, -19, 10, -4, 1, 0, 0, 0, 0, 0,
+ 1, -2, 3, -4, 5, -4, 0, 10, -28, 56, -95, 144, -199, 254, -298, 317, -292,
+ 198, 0, -365, 1053, -2663, 12407, 7890, -3117, 1804, -1113, 665, -355, 141,
+ 0, -83, 122, -130, 119, -97, 72, -49, 30, -16, 7, -2, 0, 1, -1, 0, 0, 0, 1,
+ -1, 2, -3, 3, 0, -6, 18, -38, 66, -103, 145, -187, 222, -238, 219, -147, 0,
+ 257, -684, 1430, -3051, 11064, 9538, -3196, 1682, -937, 483, -188, 0, 111,
+ -164, 177, -164, 136, -103, 72, -45, 25, -12, 4, 0, -1, 1, -1, 0, 0, 0, 0,
+ -1, 1, -1, 0, 4, -12, 25, -45, 72, -103, 136, -164, 177, -164, 111, 0,
+ -188, 483, -937, 1682, -3196, 9538, 11064, -3051, 1430, -684, 257, 0, -147,
+ 219, -238, 222, -187, 145, -103, 66, -38, 18, -6, 0, 3, -3, 2, -1, 1, 0, 0,
+ 0, -1, 1, 0, -2, 7, -16, 30, -49, 72, -97, 119, -130, 122, -83, 0, 141,
+ -355, 665, -1113, 1804, -3117, 7890, 12407, -2663, 1053, -365, 0, 198,
+ -292, 317, -298, 254, -199, 144, -95, 56, -28, 10, 0, -4, 5, -4, 3, -2, 1,
+ 0, 0, 0, 0, 0, 1, -4, 10, -19, 32, -49, 67, -84, 94, -90, 62, 0, -105, 265,
+ -490, 793, -1205, 1798, -2846, 6183, 13513, -2022, 569, 0, -272, 392, -423,
+ 398, -341, 270, -197, 132, -80, 41, -15, 0, 7, -9, 8, -5, 3, -2, 1, 0, 0,
+ 0, 0, -1, 2, -6, 11, -20, 32, -46, 59, -67, 65, -45, 0, 79, -199, 366,
+ -585, 862, -1210, 1674, -2417, 4482, 14338, -1129, 0, 390, -539, 569, -531,
+ 454, -361, 267, -182, 111, -58, 22, 0, -11, 14, -13, 10, -6, 4, -2, 1, 0,
+ 0, 0, 0, -1, 3, -7, 12, -20, 30, -39, 46, -46, 33, 0, -59, 149, -275, 438,
+ -637, 869, -1135, 1448, -1874, 2849, 14847, 0, -623, 780, -785, 715, -606,
+ 482, -358, 245, -152, 81, -31, 0, 16, -21, 20, -16, 11, -7, 4, -2, 1, 0, 0,
+ 0, -1, 4, -7, 12, -19, 26, -31, 32, -23, 0, 43, -110, 205, -328, 477, -643,
+ 818, -989, 1141, -1261, 1339, 15019, 1339, -1261, 1141, -989, 818, -643,
+ 477, -328, 205, -110, 43, 0, -23, 32, -31, 26, -19, 12, -7, 4, -1, 0, 0,
+ 0},
+
+#endif
+/* 32k */
+ {-0,
+ 0,
+ 6,
+ -14,
+ 0,
+ 57,
+ -101,
+ 0,
+ 273,
+ -425,
+ 0,
+ 993,
+ -1582,
+ 0,
+ 8985,
+ 8985,
+ 0,
+ -1582,
+ 993,
+ 0,
+ -425,
+ 273,
+ 0,
+ -101,
+ 57,
+ 0,
+ -14,
+ 6,
+ 0,
+ -0,
+ -1,
+ 3,
+ -0,
+ -20,
+ 41,
+ -0,
+ -132,
+ 216,
+ -0,
+ -526,
+ 801,
+ -0,
+ -2075,
+ 4422,
+ 10923,
+ 4422,
+ -2075,
+ -0,
+ 801,
+ -526,
+ -0,
+ 216,
+ -132,
+ -0,
+ 41,
+ -20,
+ -0,
+ 3,
+ -1,
+ -0,
+ },
+
+
+/* 22k */
+ {0, 0, 1, 2, -3, -7, 6, 19, -7, -42, 0, 80, 26, -134, -87, 199, 205, -262,
+ -415, 300, 781, -265, -1523, 0, 4395, 7487, 5823, 1291, -1432, -813, 607,
+ 578, -254, -401, 80, 261, 0, -155, -28, 83, 30, -39, -22, 15, 12, -4, -6,
+ 1, 2, 0, 0, 0, 0, 0, 1, 2, -2, -7, 3, 18, 0, -39, -13, 71, 48, -112, -119,
+ 154, 245, -176, -453, 148, 793, 0, -1436, -515, 3612, 7265, 6418, 2035,
+ -1234, -1065, 445, 685, -136, -443, 0, 272, 51, -153, -58, 77, 46, -33,
+ -29, 11, 15, -2, -6, 0, 2, 0, 0, 0, 0, 0, 1, 2, -1, -7, 0, 17, 6, -35, -24,
+ 60, 65, -86, -141, 103, 267, -87, -461, 0, 760, 240, -1278, -928, 2816,
+ 6904, 6904, 2816, -928, -1278, 240, 760, 0, -461, -87, 267, 103, -141, -86,
+ 65, 60, -24, -35, 6, 17, 0, -7, -1, 2, 1, 0, 0, 0, 0, 0, 2, 0, -6, -2, 15,
+ 11, -29, -33, 46, 77, -58, -153, 51, 272, 0, -443, -136, 685, 445, -1065,
+ -1234, 2035, 6418, 7265, 3612, -515, -1436, 0, 793, 148, -453, -176, 245,
+ 154, -119, -112, 48, 71, -13, -39, 0, 18, 3, -7, -2, 2, 1, 0, 0, 0, 0, 0,
+ 2, 1, -6, -4, 12, 15, -22, -39, 30, 83, -28, -155, 0, 261, 80, -401, -254,
+ 578, 607, -813, -1432, 1291, 5823, 7487, 4395, 0, -1523, -265, 781, 300,
+ -415, -262, 205, 199, -87, -134, 26, 80, 0, -42, -7, 19, 6, -7, -3, 2, 1,
+ 0, 0, 0, 0, 2, 1, -4, -6, 9, 17, -14, -41, 15, 84, 0, -148, -47, 235, 150,
+ -339, -348, 446, 719, -541, -1526, 607, 5141, 7562, 5141, 607, -1526, -541,
+ 719, 446, -348, -339, 150, 235, -47, -148, 0, 84, 15, -41, -14, 17, 9, -6,
+ -4, 1, 2, 0, 0, 0},
+
+/* 11k */
+ {0, -1, -1, -1, 1, 6, 12, 12, 0, -26, -55, -63, -25, 63, 167, 216, 138, -91,
+ -398, -614, -530, 0, 959, 2135, 3179, 3741, 3624, 2869, 1739, 601, -229,
+ -603, -566, -296, 0, 182, 211, 135, 30, -43, -64, -46, -16, 6, 13, 10, 4,
+ 0, -1, -1, 0, 0, 0, 0, -1, -1, 0, 4, 10, 13, 6, -16, -46, -64, -43, 30,
+ 135, 211, 182, 0, -296, -566, -603, -229, 601, 1739, 2869, 3624, 3741,
+ 3179, 2135, 959, 0, -530, -614, -398, -91, 138, 216, 167, 63, -25, -63,
+ -55, -26, 0, 12, 12, 6, 1, -1, -1, -1, 0, 0, -1, -1, -1, 3, 8, 13, 10, -7,
+ -36, -61, -56, 0, 99, 194, 207, 77, -191, -491, -629, -406, 279, 1343,
+ 2517, 3434, 3781, 3434, 2517, 1343, 279, -406, -629, -491, -191, 77, 207,
+ 194, 99, 0, -56, -61, -36, -7, 10, 13, 8, 3, -1, -1, -1, 0, 0},
+
+
+/* 8k */
+ {0, 1, 1, 2, 2, 0, -4, -10, -17, -21, -16, 0, 29, 66, 98, 108, 79, 0, -123,
+ -263, -375, -401, -287, 0, 457, 1037, 1658, 2211, 2594, 2731, 2594, 2211,
+ 1658, 1037, 457, 0, -287, -401, -375, -263, -123, 0, 79, 108, 98, 66, 29,
+ 0, -16, -21, -17, -10, -4, 0, 2, 2, 1, 1, 0, 0}
+};
+
+
+/*#include "minisrc.h" */
+/* warning!! warning!! warning!! warning!! warning!! warning!! warning!!*/
+
+/* You really have to watch out "the order of IIR coefficients"!!!!!! */
+/* the order is : b2, b1, b0, -a2, -a1 */
+
+/*#define MINISRC_BIQUAD_STAGE 2 */
+
+#if 1
+WORD MINISRC_LPF[10] = {
+ 0X0743,
+ 0X1104,
+ 0X0A4C,
+ 0XF88D,
+ 0X242C,
+
+ 0X1023,
+ 0X1AA9,
+ 0X0B60,
+ 0XEFDD,
+ 0X186F
+};
+
+#else
+WORD MINISRC_LPF[10] = {
+ 0x01B7,
+ 0XF632,
+ 0X0BE4,
+ 0XDC94,
+ 0X2D03,
+
+ 0X3748,
+ 0X938D,
+ 0X5887,
+ 0XC7F9,
+ 0X6D75
+};
+#endif
+/*#include "msrcsize.h" */
+#ifndef __MSRCSIZE
+#define __MSRCSIZE
+
+#define MINISRC_IN_BUFFER_SIZE ( 0x50 * 2 )
+#define MINISRC_OUT_BUFFER_SIZE ( 0x50 * 2 * 2)
+#define MINISRC_TMP_BUFFER_SIZE ( 112 + ( MINISRC_BIQUAD_STAGE * 3 + 4 ) * 2 * 2 )
+#define MINISRC_BIQUAD_STAGE 2
+/* M. SRC LPF coefficient could be changed in the DSP code */
+#define MINISRC_COEF_LOC 0X175
+
+
+#endif
+
+#endif
diff --git a/attic/drv/oss_allegro/srcmgr.inc b/attic/drv/oss_allegro/srcmgr.inc
new file mode 100644
index 0000000..c1a3b93
--- /dev/null
+++ b/attic/drv/oss_allegro/srcmgr.inc
@@ -0,0 +1,1338 @@
+/*
+ * srcmgr.c -- ESS Technology allegro audio driver.
+ *
+ * Copyright (C) 1992-2000 Don Kim (don.kim@esstech.com)
+ *
+ */
+
+#include "hckernel.h"
+static int num_errors = 0; /* Dummy variable used to supress lint warnings. */
+
+#define DMAREC
+
+/*/////////////////////////////////////////////////////////////////////////// */
+/* DSP kernel support */
+/* index 0 - 44.1k; 1 - 32k; 2 - 22.05k; 3 - 11.025k; 4 - 8k */
+/* */
+/*/////////////////////////////////////////////////////////////////////////// */
+WORD gwSRC3_PB_SIZE_OUT[5] =
+ { 37 * 2 * 2, 6 * 2, 37 * 2 * 2, 26 * 2, 12 * 2 };
+WORD gwSRC3_PB_SIZE_IN[5] = { 34 * 2, 4, 17 * 2, 6, 2 };
+WORD gwSRC3_PB_FILTER_LENGTH[5] = { 666, 60, 666, 338, 360 };
+WORD gwSRC3_PB_FILTER_TAP_SIZE[5] = { 17, 19, 17, 25, 59 }; /* SIZE - 1 */
+WORD gwSRC3_PB_BIG_LOOP_COUNTER[5] = { 11, 1, 5, 2, 0 };
+WORD gwSRC3_PB_SMALL_LOOP_COUNTER[5] = { 0, 0, 1, 3, 4 };
+WORD gwSRC3_IN_BufferSize[5] =
+ { 2 * 17 * 16, 192 * 2, 2 * 17 * 16, 192 * 2, 192 * 2 };
+WORD gwSRC3_OUT_BufferSize[5] =
+ { 160 * 4, 160 * 2, 160 * 4, 160 * 2, 160 * 2 };
+
+WORD gwSRC3_REC_SIZE_OUT[5] = { 34 * 2, 4, 12, 6, 2 };
+WORD gwSRC3_REC_SIZE_IN[5] = { 37 * 2, 6, 26, 26, 12 };
+WORD gwSRC3_REC_FILTER_LENGTH[5] = { 680, 60, 312, 156, 60 };
+WORD gwSRC3_REC_FILTER_TAP_SIZE[5] = { 19, 29, 51, 51, 59 }; /* SIZE - 1 */
+
+/* WORD gwSRC3_REC_BIG_LOOP_COUNTER[5] = { 9, 0, 4, 1, -1 }; */
+WORD gwSRC3_REC_SMALL_LOOP_COUNTER[5] = { 0, 0, 1, 3, 4 };
+WORD gwSRC3_REC_IN_BufferSize[5] = { 37 * 16 * 2, 32 * 6 * 2, 416, 416, 384 };
+WORD gwSRC3_REC_OUT_BufferSize[5] =
+ { 160 * 4, 160 * 2, 160 * 2, 160 * 2, 160 * 2 };
+
+#define PB_DMA_BUFFER_SIZE 0x2400
+#define PLAYBACK_BUFFER_SIZE PB_DMA_BUFFER_SIZE
+/*#define WAVE_BUFFER_BLOCK_SIZE (MAXNUM_WAVE_RENDER * PLAYBACK_BUFFER_SIZE) + 0x8000 */
+
+#define STREAM_TYPE_DSPSRC 1 /* high quality SRC stream */
+#define STREAM_TYPE_DSPMSRC 2 /* general mini SRC stream */
+#define STREAM_TYPE_NULL (( ULONG ) -1 )
+
+BYTE AllocateSRCPlay = FALSE;
+BYTE AllocateSRCRec = FALSE;
+/* -------------------------------------------------------------------------- */
+
+/* khs, for full-dupulex */
+#define MAX_SRC_STREAMS 2
+
+
+PHWI gphwi = NULL;
+
+#define _Debug_Printf_Service(x) dprintf3((x))
+
+#if 0
+extern PHYSICAL_ADDRESS PPhysicalAddress;
+extern PHYSICAL_ADDRESS RPhysicalAddress;
+extern ULONG SWTAddress;
+#endif
+
+#define wSPDIFVarLen (CDATA_HEADER_LEN + 10)
+#define gwSPDIF_IN_BufferSize 192
+/* -------------------------------------------------------------------------- */
+
+#define MAXNUM_WAVE_RENDER 1
+#define MAXNUM_WAVE_CAPTURE 1
+#define MAXNUM_WAVE_MIXER 1
+#define MAXNUM_WAVE_CHANNELS MAXNUM_WAVE_RENDER + MAXNUM_WAVE_CAPTURE + MAXNUM_WAVE_MIXER
+
+
+ALLEGRO_WAVE WaveStreams[MAXNUM_WAVE_CHANNELS] = { {0} };
+
+PALLEGRO_WAVE CaptureStream = NULL;
+PALLEGRO_WAVE PlaybackStream = NULL;
+PALLEGRO_WAVE MidiStream = NULL;
+
+MBUFFER CaptureBuffer;
+MBUFFER RenderBuffer;
+MBUFFER MidiBuffer;
+
+static int StreamsRunning = 0;
+
+void
+InitStream ()
+{
+ int i;
+ for (i = 0; i < 3; i++)
+ {
+ WaveStreams[i].PositionBeforePaused = 0;
+ WaveStreams[i].DspClientInstance = NULL;
+ WaveStreams[i].StreamType = STREAM_TYPE_NULL;
+ WaveStreams[i].State = KSSTATE_STOP;
+ }
+
+ WaveStreams[0].WaveType = WAVE_PLAYBACK;
+ WaveStreams[1].WaveType = WAVE_CAPTURE;
+ WaveStreams[2].WaveType = WAVE_MIXER;
+
+#if 0
+ RenderBuffer.Physical = (ULONG) PPhysicalAddress.LowPart;
+ RenderBuffer.Length = 0x2000;
+ WaveStreams[0].Buffer = &RenderBuffer;
+ WaveStreams[0].Length = RenderBuffer.Length;
+
+ CaptureBuffer.Physical = (ULONG) RPhysicalAddress.LowPart;
+ CaptureBuffer.Length = 0x4000;
+ WaveStreams[1].Buffer = &CaptureBuffer;
+ WaveStreams[1].Length = CaptureBuffer.Length;
+
+ MidiBuffer.Physical = (ULONG) SWTAddress;
+ MidiBuffer.Length = 3520;
+ WaveStreams[2].Buffer = &MidiBuffer;
+ WaveStreams[2].Length = MidiBuffer.Length;
+ WaveStreams[2].StreamType = STREAM_TYPE_DSPMSRC;
+#endif
+
+ PlaybackStream = &WaveStreams[0];
+ CaptureStream = &WaveStreams[1];
+ MidiStream = &WaveStreams[2];
+}
+
+/*ARGSUSED*/
+void
+AllocateStream (allegro_devc * devc, IN BYTE waveType)
+{
+ dprintf1 (("AllocateStream %d", waveType));
+ WaveStreams[waveType].DspClientInstance = NULL;
+ WaveStreams[waveType].StreamType = STREAM_TYPE_NULL;
+ WaveStreams[waveType].State = KSSTATE_STOP;
+
+ /* */
+ /* at the request of record, turn off SPDIF out if already on. */
+ /* at the end of record, turn on */
+#ifdef later
+ if ((WAVE_CAPTURE == waveType) && fSPDIFOUT)
+ HWMGR_Enable_SPDIF (devc, FALSE);
+#endif
+
+/* SetFormat( &WaveStreams[ waveType ], WaveInfo ); */
+} /* AllocateStream */
+
+void
+FreeStream (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave)
+{
+ /* close DSP instance */
+ dprintf3 (("FreeStream:%x", AllegroWave->DspClientInstance));
+ if (AllegroWave->DspClientInstance)
+ {
+ if (kCloseInstance (devc, gphwi, AllegroWave->DspClientInstance,
+ KOPENCLOSE_SYNCHRONOUS) != KRETURN_SUCCESS)
+ {
+ /*_Debug_Printf_Service( "Close Inst!\n" ); */
+ dprintf1 (("ERROR: FreeStream kCloseInstance"));
+ num_errors++;
+ }
+ AllegroWave->DspClientInstance = NULL;
+ }
+
+ if (IsAC3Format)
+ {
+ /* */
+ /* reset the spdif out data type to PCM */
+ HWMGR_WriteDataWord (devc, ASSP_MEMORY_PORT, DSP_DATA_MEMORY);
+ HWMGR_WriteDataWord (devc, ASSP_INDEX_PORT, KDATA_SPDIF_FRAME0);
+ HWMGR_WriteDataWord (devc, ASSP_DATA_PORT, 0x100);
+ }
+
+ if (STREAM_TYPE_DSPSRC == AllegroWave->StreamType)
+ {
+ AllocateSRCRec = FALSE;
+ AllocateSRCPlay = FALSE;
+ }
+} /* FreeStream */
+
+
+void
+SRCMGR_Stop (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave)
+{
+ dprintf1 (("SRCMGR_Stop: Client = %x", AllegroWave->DspClientInstance));
+ if (AllegroWave->DspClientInstance)
+ {
+
+ /* stop DMA transfer */
+ kStopTransfer (devc, gphwi, AllegroWave->DspClientInstance);
+
+ /* stop the DSP client */
+ kSetInstanceNotReady (devc, gphwi, AllegroWave->DspClientInstance);
+ }
+} /* SRCMGR_Stop */
+
+void
+SRCMGR_StartSPDIFIN (allegro_devc * devc, IN BOOLEAN start)
+{
+ ULONG FilterLength;
+ ULONG i;
+ USHORT wCC_offset;
+ USHORT wCD_offset;
+
+ if (start)
+ {
+ if (pClient_SPDIFIN)
+ {
+ kCloseInstance (devc, gphwi, pClient_SPDIFIN,
+ KOPENCLOSE_SYNCHRONOUS);
+ pClient_SPDIFIN = NULL;
+#if 0
+ StreamsRunning--;
+ if (0 == StreamsRunning)
+ {
+ WRITE_PORT_USHORT (devc->osdev, devc->base + HOST_INT_CTRL,
+ (USHORT) (READ_PORT_USHORT
+ (devc->osdev,
+ devc->base +
+ HOST_INT_CTRL) &
+ ~CLKRUN_GEN_ENABLE));
+ }
+#endif
+ }
+ kOpenInstance (devc, gphwi,
+ CLIENT_MINISRC,
+ 0,
+ 2 * (MINISRC_TMP_BUFFER_SIZE / 2 +
+ MINISRC_IN_BUFFER_SIZE / 2 + 1 +
+ MINISRC_OUT_BUFFER_SIZE / 2 + 1), &pClient_SPDIFIN);
+ if (pClient_SPDIFIN)
+ {
+#if 0
+ StreamsRunning++;
+ if (1 == StreamsRunning)
+ {
+ WRITE_PORT_USHORT (devc->osdev, devc->base + HOST_INT_CTRL,
+ (USHORT) (READ_PORT_USHORT
+ (devc->osdev,
+ devc->base +
+ HOST_INT_CTRL) |
+ CLKRUN_GEN_ENABLE));
+ }
+#endif
+ wCC_offset = (WORD) (pClient_SPDIFIN->dwDspCodeClientArea);
+ wCD_offset = (WORD) (pClient_SPDIFIN->dwDspDataClientArea);
+
+ dprintf1 (("success %x %x %x", pClient_SPDIFIN, wCC_offset,
+ wCD_offset));
+ kStartTransfer (devc, gphwi, pClient_SPDIFIN, TRUE, 0L, 0L, 0L, 0L,
+ (ULONG) (wCD_offset + MINISRC_TMP_BUFFER_SIZE / 2),
+ (ULONG) (MINISRC_IN_BUFFER_SIZE),
+ (ULONG) (wCD_offset + MINISRC_TMP_BUFFER_SIZE / 2 +
+ MINISRC_IN_BUFFER_SIZE / 2 + 1),
+ (ULONG) (MINISRC_OUT_BUFFER_SIZE), KCONNECT_SPDIFIN,
+ KCONNECT_MIXER);
+
+ /* ------------------------------------------------------------------------- */
+ /* load the coefficient starting at offset of program size in program memory */
+ /* ------------------------------------------------------------------------- */
+
+ /* filter length calculation */
+ FilterLength = sizeof (MINISRC_LPF) / 2;
+
+ for (i = 0; i < FilterLength; i++)
+ {
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_CODE, wCC_offset + MINISRC_COEF_LOC + i, (USHORT) (MINISRC_LPF[i])); /*since it is in sequence. */
+ }
+
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_CODE,
+ wCC_offset + MINISRC_COEF_LOC + FilterLength,
+ 0X8000);
+
+/*------------------------------------------------------------------------------------------- */
+/* Transfer all parameters into DSP Data memory */
+/* All the change below should be consistent with DSP client --- khs 04/17/98 */
+/*------------------------------------------------------------------------------------------- */
+
+ /* left Volume */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + CDATA_LEFT_VOLUME, 0X7FFF);
+
+ /* right Volume */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + CDATA_LEFT_VOLUME + 1, 0X7FFF);
+
+ /* DIRECTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA, wCD_offset + SRC3_DIRECTION_OFFSET, 0 /* playback */
+ );
+
+ /* MODE */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA, wCD_offset + SRC3_DIRECTION_OFFSET + 1, 0 /* stereo */
+ );
+
+ /* WORDLEN */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA, wCD_offset + SRC3_DIRECTION_OFFSET + 2, 0 /* 16bit */
+ );
+
+ /* FRACTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 3, 0X0000);
+
+ /* FIRST_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 4, 0);
+
+ /* FIRST_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 5, 0);
+
+ /* SECOND_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 6, 0);
+
+ /* SECOND_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 7, 0);
+
+ /* DELTA_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 8, 0);
+
+ /* DELTA_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 9, 0);
+
+ /* ROUND */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 10, 0X8000);
+
+ /* HIGHER BYTE MASK */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 11, 0XFF00);
+
+ /* TEMPORARY INPUT BUFFER ADDRESS */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 12,
+ (WORD) (wCD_offset + 40 + 8));
+
+ /* TEMP0 */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 13, 0);
+
+ /* C_FRACTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 14, 0);
+
+ /* COUNTER */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 15, 0);
+
+ /* NUMIN */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 16, 8);
+
+ /* NUMOUT */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 17, 24);
+
+ /* NUMSTAGE */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 18,
+ (MINISRC_BIQUAD_STAGE - 1));
+
+ /* COEF */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 19,
+ (WORD) (wCC_offset + MINISRC_COEF_LOC));
+
+ /* FILTERTAP */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 20, 0);
+
+ /* BOOSTER */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 21, 0);
+
+ /* SKIPLPF */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 22, 0xFF);
+
+
+ /* set the run-flag to start */
+ kSetInstanceReady (devc, gphwi, pClient_SPDIFIN);
+ }
+ }
+ else
+ {
+ if (pClient_SPDIFIN)
+ {
+
+ /* stop DMA transfer */
+ kStopTransfer (devc, gphwi, pClient_SPDIFIN);
+
+ /* stop the DSP client */
+ kSetInstanceNotReady (devc, gphwi, pClient_SPDIFIN);
+
+ kCloseInstance (devc, gphwi, pClient_SPDIFIN,
+ KOPENCLOSE_SYNCHRONOUS);
+ pClient_SPDIFIN = NULL;
+#if 0
+ StreamsRunning--;
+ if (0 == StreamsRunning)
+ {
+ WRITE_PORT_USHORT (devc->osdev, devc->base + HOST_INT_CTRL,
+ (USHORT) (READ_PORT_USHORT
+ (devc->osdev,
+ devc->base +
+ HOST_INT_CTRL) &
+ ~CLKRUN_GEN_ENABLE));
+ }
+#endif
+ }
+ }
+} /* SRCMGR_StartSPDIFIN */
+
+#define REAL_SHIFT 15
+#define REAL_SCALE ( 1 << REAL_SHIFT )
+
+void
+SRCMGR_SetFrequency (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave)
+{
+ LONG frequency;
+
+ if (AllegroWave->DspClientInstance)
+ {
+ frequency = (AllegroWave->Frequency * REAL_SCALE + 24000) / 48000;
+ if (frequency > 0)
+ --frequency;
+ kSetFrequency (devc, gphwi, AllegroWave->DspClientInstance,
+ (WORD) frequency);
+ }
+} /* SRCMGR_SetFrequency */
+
+void
+SRCMGR_StartPlay (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave)
+{
+ ULONG FilterLength;
+ ULONG i;
+ ULONG Length;
+ ULONG SizeIn;
+ ULONG SizeOut;
+ ULONG StartOffset;
+ USHORT wCC_offset;
+ USHORT wCD_offset;
+
+ if (AllegroWave->DspClientInstance)
+ {
+
+ if (!IsAC3Format)
+ SRCMGR_SetFrequency (devc, AllegroWave);
+
+ wCC_offset =
+ (WORD) (AllegroWave->DspClientInstance->dwDspCodeClientArea);
+ wCD_offset =
+ (WORD) (AllegroWave->DspClientInstance->dwDspDataClientArea);
+
+ Length = devc->dma_dac.dmasize; /*AllegroWave->Buffer->Length; */
+ AllegroWave->Length = Length;
+
+ if (!IsAC3Format)
+ {
+ StartOffset = 0x20 * 2;
+ SizeIn = MINISRC_IN_BUFFER_SIZE - StartOffset;
+ SizeOut = MINISRC_OUT_BUFFER_SIZE + StartOffset;
+ StartOffset = wCD_offset + MINISRC_TMP_BUFFER_SIZE / 2;
+
+ kStartTransfer (devc, gphwi, AllegroWave->DspClientInstance, TRUE, devc->dma_dac.base, /*AllegroWave->Buffer->Physical, */
+ Length,
+ 0L,
+ 0L,
+ StartOffset,
+ SizeIn,
+ StartOffset + SizeIn / 2 + 1,
+ SizeOut, KCONNECT_DMA, KCONNECT_MIXER);
+
+ /* ------------------------------------------------------------------------- */
+ /* load the coefficient starting at offset of program size in program memory */
+ /* ------------------------------------------------------------------------- */
+
+ /* filter length calculation */
+ FilterLength = sizeof (MINISRC_LPF) / 2;
+
+ for (i = 0; i < FilterLength; i++)
+ {
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_CODE, wCC_offset + MINISRC_COEF_LOC + i, (USHORT) (MINISRC_LPF[i])); /*since it is in sequence. */
+ }
+
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_CODE,
+ wCC_offset + MINISRC_COEF_LOC + FilterLength,
+ 0X8000);
+
+/*------------------------------------------------------------------------------------------- */
+/* Transfer all parameters into DSP Data memory */
+/* All the change below should be consistent with DSP client --- khs 04/17/98 */
+/*------------------------------------------------------------------------------------------- */
+
+ /* left Volume */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + CDATA_LEFT_VOLUME, 0X7FFF);
+
+ /* right Volume */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + CDATA_LEFT_VOLUME + 1, 0X7FFF);
+
+ /* DIRECTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA, wCD_offset + SRC3_DIRECTION_OFFSET, 0 /* playback */
+ );
+
+ /* MODE */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 1,
+ (WORD) ! AllegroWave->FormatStereo);
+
+ /* WORDLEN */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 2,
+ (WORD) ! AllegroWave->Format16Bit);
+
+ /* FRACTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 3, 0X0000);
+
+ /* FIRST_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 4, 0);
+
+ /* FIRST_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 5, 0);
+
+ /* SECOND_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 6, 0);
+
+ /* SECOND_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 7, 0);
+
+ /* DELTA_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 8, 0);
+
+ /* DELTA_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 9, 0);
+
+ /* ROUND */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 10, 0X8000);
+
+ /* HIGHER BYTE MASK */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 11, 0XFF00);
+
+ /* TEMPORARY INPUT BUFFER ADDRESS */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 12,
+ (WORD) (wCD_offset + 40 + 8));
+
+ /* TEMP0 */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 13, 0);
+
+ /* C_FRACTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 14, 0);
+
+ /* COUNTER */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 15, 0);
+
+ /* NUMIN */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 16, 8);
+
+ if (0 < AllegroWave->Frequency && AllegroWave->Frequency < 8000)
+ {
+ Length = 48000 * 8 / AllegroWave->Frequency;
+
+ /* add one more for remainder */
+ ++Length;
+
+ /* make it even */
+ if (Length & 1)
+ ++Length;
+
+ /* NUMOUT */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 17,
+ (USHORT) Length * 2);
+ }
+ else
+ /* NUMOUT */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 17, 50 * 2);
+
+ /* NUMSTAGE */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 18,
+ (MINISRC_BIQUAD_STAGE - 1));
+
+ /* COEF */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 19,
+ (WORD) (wCC_offset + MINISRC_COEF_LOC));
+
+ /* FILTERTAP */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 20, 0);
+
+ /* BOOSTER */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 21, 0);
+
+ /* SKIPLPF */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 22,
+ (WORD) ((AllegroWave->Frequency >
+ 45000) ? 0xFF : 0));
+
+
+ if (AllegroWave->PositionBeforePaused)
+ kAlterTransfer (devc, gphwi,
+ AllegroWave->DspClientInstance,
+ KALTER_POSITION,
+ TRUE, AllegroWave->PositionBeforePaused);
+ }
+ else
+ {
+ kStartTransfer (devc, gphwi, AllegroWave->DspClientInstance, TRUE, devc->dma_dac.base, /*AllegroWave->Buffer->Physical, */
+ Length,
+ 0L,
+ 0L,
+ (ULONG) (wCD_offset + wSPDIFVarLen),
+ (ULONG) (gwSPDIF_IN_BufferSize),
+ (DWORD) NULL, 0, KCONNECT_DMA, 0);
+
+ /* only one parameter */
+ /* when you close ac3-spdif, you have to put it back with "0x100" */
+ HWMGR_WriteDataWord (devc, ASSP_MEMORY_PORT, DSP_DATA_MEMORY);
+ HWMGR_WriteDataWord (devc, ASSP_INDEX_PORT, KDATA_SPDIF_FRAME0);
+ HWMGR_WriteDataWord (devc, ASSP_DATA_PORT, 0x102); /*;0x102 -- AC3 data */
+ }
+ /*;0x100 -- pcm data */
+ /* set the run-flag to start */
+ kSetInstanceReady (devc, gphwi, AllegroWave->DspClientInstance);
+ }
+} /* SRCMGR_StartPlay */
+
+
+void
+SRCMGR_StartRecord (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave)
+{
+ ULONG Length;
+ ULONG SizeIn;
+ ULONG SizeOut;
+ ULONG StartOffset;
+ USHORT wCD_offset;
+
+ if (AllegroWave->DspClientInstance)
+ {
+
+ SRCMGR_SetFrequency (devc, AllegroWave);
+
+ wCD_offset =
+ (WORD) (AllegroWave->DspClientInstance->dwDspDataClientArea);
+
+ Length = devc->dma_adc.dmasize; /*AllegroWave->Buffer->Length; */
+ AllegroWave->Length = Length;
+ StartOffset = 0x10 * 2;
+ SizeIn = MINISRC_IN_BUFFER_SIZE + StartOffset;
+ SizeOut = MINISRC_OUT_BUFFER_SIZE - StartOffset;
+ StartOffset = wCD_offset + MINISRC_TMP_BUFFER_SIZE / 2;
+
+ kStartTransfer (devc, gphwi, AllegroWave->DspClientInstance, TRUE, 0L, 0L, devc->dma_adc.base, /*AllegroWave->Buffer->Physical, */
+ Length,
+ StartOffset,
+ SizeIn,
+ StartOffset + SizeIn / 2 + 1,
+ SizeOut, gwDSPConnectIn, KCONNECT_DMA);
+
+/*------------------------------------------------------------------------------------------- */
+/* Transfer all parameters into DSP Data memory */
+/* All the change below should be consistent with DSP client --- khs 04/17/98 */
+/*------------------------------------------------------------------------------------------- */
+
+ /* left Volume */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + CDATA_LEFT_VOLUME, 0X7FFF);
+
+ /* right Volume */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + CDATA_LEFT_VOLUME + 1, 0X7FFF);
+
+ /* DIRECTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA, wCD_offset + SRC3_DIRECTION_OFFSET, 1 /* recording */
+ );
+
+ /* MODE */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 1,
+ (WORD) ! AllegroWave->FormatStereo);
+
+ /* WORDLEN */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 2,
+ (WORD) ! AllegroWave->Format16Bit);
+
+ /* FRACTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 3, 0X0000);
+
+ /* FIRST_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 4, 0);
+
+ /* FIRST_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 5, 0);
+
+ /* SECOND_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 6, 0);
+
+ /* SECOND_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 7, 0);
+
+ /* DELTA_L */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 8, 0);
+
+ /* DELTA_R */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 9, 0);
+
+ /* ROUND */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 10, 0X8000);
+
+ /* HIGHER BYTE MASK */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 11, 0XFF00);
+
+ /* TEMPORARY INPUT BUFFER ADDRESS */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 12,
+ (WORD) (wCD_offset + 40 + 8));
+
+ /* TEMP0 */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 13, 0);
+
+ /* C_FRACTION */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 14, 0);
+
+ /* COUNTER */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 15, 0);
+
+ if (0 < AllegroWave->Frequency && AllegroWave->Frequency < 8000)
+ {
+ Length = 48000 * 8 / AllegroWave->Frequency;
+
+ /* add one more for remainder */
+ ++Length;
+
+ /* make it even */
+ if (Length & 1)
+ ++Length;
+
+ /* NUMIN */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 16,
+ (USHORT) Length);
+ }
+ else
+ /* NUMIN */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 16, 50);
+
+ /* NUMOUT */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 17, 8);
+
+ /*AY */
+ /* NUMSTAGE */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 18, 0);
+
+ /* COEF */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 19, 0);
+
+ /* FILTERTAP */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 20, 0);
+
+ /* BOOSTER */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 21, 0);
+
+ /* SKIPLPF = FF ; no LPF for any recording */
+ kDspWriteWord (devc, devc->base, MEMTYPE_INTERNAL_DATA,
+ wCD_offset + SRC3_DIRECTION_OFFSET + 22, 0xFF);
+
+ /* set the run-flag to start */
+ kSetInstanceReady (devc, gphwi, AllegroWave->DspClientInstance);
+ }
+} /* SRCMGR_StartRec */
+void
+SRCMGR_SetVolume (allegro_devc * devc, IN PCLIENT_INST client, IN USHORT left,
+ IN USHORT right)
+{
+ USHORT lvalue;
+ USHORT rvalue;
+
+ if (client)
+ {
+ lvalue = left >> 1;
+ rvalue = right >> 1;
+
+ kSetVolume (devc, gphwi, client, lvalue, rvalue, 0);
+ }
+} /* SRCMGR_SetVolume */
+
+void
+SRCMGR_SetRearVolume (allegro_devc * devc, IN PCLIENT_INST client,
+ IN USHORT left, IN USHORT right)
+{
+ USHORT lvalue;
+ USHORT rvalue;
+
+ if (client)
+ {
+ lvalue = left >> 1;
+ rvalue = right >> 1;
+
+ kSetRearVolume (devc, gphwi, client, lvalue, rvalue);
+ }
+} /* SRCMGR_SetVolume */
+
+void
+SRCMGR_SetupStream (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave)
+{
+
+#ifdef SRC4
+ /* using host src */
+ AllegroWave->SR_8khzFlag = FALSE;
+
+#else
+ /* not using host src */
+ AllegroWave->SR_8khzFlag = TRUE;
+#endif
+ if (STREAM_TYPE_NULL == AllegroWave->StreamType)
+ {
+ AllegroWave->StreamType = STREAM_TYPE_DSPSRC;
+
+ /* 8-bit not supported by SRC */
+ if (!AllegroWave->Format16Bit)
+ AllegroWave->StreamType = STREAM_TYPE_DSPMSRC;
+ }
+
+#if ALLEGRO_DEBUG
+ if (AllegroWave->StreamType == STREAM_TYPE_DSPMSRC)
+ {
+ _Debug_Printf_Service ("M. SRC\r\n");
+ }
+ else
+ {
+ _Debug_Printf_Service ("SRC 3.X\r\n");
+ } /* endif */
+#endif
+ /* see if we can acquire a DSP client instance for the new */
+ /* requested format */
+ if (AllegroWave->StreamType == STREAM_TYPE_DSPSRC)
+ {
+ switch (AllegroWave->Frequency)
+ {
+ case 44100:
+ AllegroWave->wFreqIndex = SRC3_SR_44100;
+ break;
+
+ case 32000:
+ AllegroWave->wFreqIndex = SRC3_SR_32000;
+ break;
+#if 1
+ case 22050:
+ AllegroWave->wFreqIndex = SRC3_SR_22050;
+ break;
+ case 11025:
+ AllegroWave->wFreqIndex = SRC3_SR_11025;
+ break;
+ case 8000:
+ AllegroWave->wFreqIndex = SRC3_SR_8000;
+
+ /* khs */
+ AllegroWave->SR_8khzFlag = TRUE;
+ break;
+#endif
+ default:
+ AllegroWave->StreamType = STREAM_TYPE_DSPMSRC;
+ }
+ }
+
+#if 1
+ AllegroWave->StreamType = STREAM_TYPE_DSPMSRC; /*DON */
+ dprintf1 (("SRCMGR_SetupStream Mode %d", AllegroWave->StreamType));
+#endif
+#if ALLEGRO_DEBUG
+ if (AllegroWave->StreamType == STREAM_TYPE_DSPMSRC)
+ {
+ _Debug_Printf_Service ("M. SRC\r\n");
+ }
+ else
+ {
+ _Debug_Printf_Service ("SRC 3.X\r\n");
+ } /* endif */
+#endif
+
+ /* ok, if it was determined we are to attempt to do a SCR stream */
+ /* we still don't know if we can so we have to see if the SRC */
+ /* manager will allow us to do it... and if so we have to try and */
+ /* get an instance from the DSP kernel, if the SRC manager didn't */
+ /* let us get it or the DSP kernel didn't allow it we defer it */
+ /* back to Mini SRC stream */
+ if (AllegroWave->StreamType == STREAM_TYPE_DSPSRC)
+ {
+ if (WAVE_CAPTURE == AllegroWave->WaveType)
+ {
+ if (!AllocateSRCRec)
+ {
+
+ /* Temporary Buffer Size: Two Filter Tap buffer, one block of temporary output buffer */
+ AllegroWave->wSRC3VarLen = SRC3_TEMP_OUTBUF_ADDR_OFFSET + 2
+ + 2 * (gwSRC3_REC_FILTER_TAP_SIZE[AllegroWave->wFreqIndex] +
+ 1) + 2 + gwSRC3_REC_SIZE_IN[AllegroWave->wFreqIndex] +
+ 1 + gwSRC3_REC_SIZE_OUT[AllegroWave->wFreqIndex] + 1 + 1 +
+ FOR_FUTURE_USE;
+
+ kOpenInstance (devc, gphwi,
+ CLIENT_SRC,
+ 0,
+ 2 * (AllegroWave->wSRC3VarLen +
+ gwSRC3_REC_IN_BufferSize[AllegroWave->
+ wFreqIndex] / 2 +
+ 1 +
+ gwSRC3_REC_OUT_BufferSize[AllegroWave->
+ wFreqIndex] / 2 +
+ 1), &AllegroWave->DspClientInstance);
+ if (AllegroWave->DspClientInstance)
+ {
+
+/* SRC does not support full-duplex */
+#if 1
+ AllocateSRCPlay = TRUE;
+#endif
+ AllocateSRCRec = TRUE;
+ }
+ }
+ }
+ else
+ {
+ if (!AllocateSRCPlay)
+ {
+
+ /* khs 082098 */
+ /* Temporary Buffer Size: Two Filter Tap buffer, one block of temporary input/output buffer */
+ AllegroWave->wSRC3VarLen = SRC3_TEMP_OUTBUF_ADDR_OFFSET + 2
+ + 2 * (gwSRC3_PB_FILTER_TAP_SIZE[AllegroWave->wFreqIndex] + 1)
+ + 2
+ + gwSRC3_PB_SIZE_OUT[AllegroWave->wFreqIndex] + 1
+ + gwSRC3_PB_SIZE_IN[AllegroWave->wFreqIndex] + 1
+ + FOR_FUTURE_USE;
+
+ kOpenInstance (devc, gphwi, CLIENT_SRC, 0, 2 * (AllegroWave->wSRC3VarLen + gwSRC3_IN_BufferSize[AllegroWave->wFreqIndex] / 2 + 1 + gwSRC3_OUT_BufferSize[AllegroWave->wFreqIndex] / 2 + 1), /* word */
+ &AllegroWave->DspClientInstance);
+ dprintf3 (("kOpenIns:%x", AllegroWave->DspClientInstance));
+ if (AllegroWave->DspClientInstance)
+ {
+ AllocateSRCPlay = TRUE;
+
+/* SRC does not support full-duplex */
+#if 1
+ AllocateSRCRec = TRUE;
+#endif
+ }
+ }
+ }
+ if (!AllegroWave->DspClientInstance)
+ AllegroWave->StreamType = STREAM_TYPE_DSPMSRC;
+ }
+
+ if (STREAM_TYPE_DSPMSRC == AllegroWave->StreamType)
+ {
+ if (kOpenInstance (devc, gphwi,
+ IsAC3Format ? CLIENT_SPDIF : CLIENT_MINISRC,
+ 0,
+ IsAC3Format ? 2 * (wSPDIFVarLen +
+ gwSPDIF_IN_BufferSize / 2) : 2 *
+ (MINISRC_TMP_BUFFER_SIZE / 2 +
+ MINISRC_IN_BUFFER_SIZE / 2 + 1 +
+ MINISRC_OUT_BUFFER_SIZE / 2 + 1),
+ &AllegroWave->DspClientInstance) != KRETURN_SUCCESS)
+ {
+ dprintf1 (("%x:Open M SRC Inst!\n"));
+ num_errors++;
+ }
+ }
+} /* SRCMGR_SetupStream */
+
+ULONG
+SRCMGR_GetPosition (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave)
+{
+ int i;
+ ULONG Position;
+ ULONG BufferPosition = 0;
+ KIRQL OldIrql;
+
+/*dprintf1(("GetPos=%x %x %x %x", AllegroWave->State, AllegroWave->DspClientInstance, AllegroWave->Length, AllegroWave->WaveType)); */
+
+ /* to make sure nothing funny happens if this stream is in stop */
+ /* state, just return 0 */
+ if (KSSTATE_STOP == AllegroWave->State || !AllegroWave->DspClientInstance)
+ return 0;
+
+ KeAcquireSpinLock (&gpGDI->ControlSpinLock, &OldIrql);
+
+ if (WAVE_CAPTURE == AllegroWave->WaveType)
+ {
+
+#ifndef DMAREC
+ /* khs 090298 for PIO recording */
+ kPIOInterruptHandler (devc, gphwi, AllegroWave->DspClientInstance);
+#endif
+ for (i = 0; i < 100; i++)
+ {
+ if (kQueryPosition (devc, gphwi,
+ AllegroWave->DspClientInstance,
+ FALSE, &BufferPosition) == KRETURN_SUCCESS)
+ break;
+ }
+
+#if 0
+ if (BufferPosition >= AllegroWave->Length)
+ {
+ dprintf1 (("!%d ", BufferPosition));
+ BufferPosition = 0;
+ }
+#endif
+ Position = BufferPosition % AllegroWave->Length;
+ }
+ else
+ {
+ for (i = 0; i < 100; i++)
+ {
+ if (kQueryPosition (devc, gphwi,
+ AllegroWave->DspClientInstance,
+ TRUE, &BufferPosition) == KRETURN_SUCCESS)
+ break;
+ }
+
+#if 0
+ if (BufferPosition >= AllegroWave->Length)
+ {
+ dprintf1 (("!%d ", BufferPosition));
+ BufferPosition = 0;
+ }
+#endif
+ Position = BufferPosition % AllegroWave->Length;
+ }
+
+ KeReleaseSpinLock (&gpGDI->ControlSpinLock, OldIrql);
+
+ return (Position);
+} /* GetPosition */
+
+
+void
+SetFormat (allegro_devc * devc, IN PALLEGRO_WAVE AllegroWave,
+ IN PWAVE_INFO WaveInfo)
+{
+
+ /* close previous client if it is SRC and sampling rate is different */
+ if (AllegroWave->DspClientInstance &&
+ STREAM_TYPE_DSPSRC == AllegroWave->StreamType &&
+ WaveInfo->SamplesPerSec != AllegroWave->Frequency)
+ {
+ dprintf1 (("SetFormat CloseInstance:%x",
+ AllegroWave->DspClientInstance));
+ if (kCloseInstance
+ (devc, gphwi, AllegroWave->DspClientInstance,
+ KOPENCLOSE_SYNCHRONOUS) != KRETURN_SUCCESS)
+ {
+ _Debug_Printf_Service ("Close inst!\n");
+ num_errors++;
+ }
+
+#if 0
+ if (WAVE_CAPTURE == AllegroWave->WaveType)
+ AllocateSRCRec = FALSE;
+ else
+ AllocateSRCPlay = FALSE;
+#else
+ AllocateSRCPlay = FALSE;
+ AllocateSRCRec = FALSE;
+#endif
+ AllegroWave->DspClientInstance = NULL;
+ AllegroWave->StreamType = STREAM_TYPE_NULL;
+ }
+ AllegroWave->FormatStereo = (WaveInfo->Channels == 2);
+ AllegroWave->Format16Bit = (WaveInfo->BitsPerSample == 16);
+ AllegroWave->Frequency = WaveInfo->SamplesPerSec;
+
+ dprintf1 (("SetFormat:%d,%d,%d", WaveInfo->SamplesPerSec,
+ WaveInfo->BitsPerSample, WaveInfo->Channels));
+} /* SetFormat */
+
+
+void
+SetState (allegro_devc * devc,
+ IN PALLEGRO_WAVE AllegroWave, IN KSSTATE NewState)
+{
+ KIRQL OldIrql;
+
+ dprintf1 (("SetState=(%x, %x)", AllegroWave->State, NewState));
+ KeAcquireSpinLock (&gpGDI->ControlSpinLock, &OldIrql);
+ if (AllegroWave->State != NewState)
+ {
+ switch (NewState)
+ {
+ case KSSTATE_STOP:
+
+
+ AllegroWave->PositionBeforePaused = 0;
+ if (KSSTATE_RUN == AllegroWave->State)
+ {
+ StreamsRunning--;
+
+ if (!StreamsRunning)
+ {
+ kSetTimer (devc, gphwi, 0);
+ WRITE_PORT_USHORT (devc->osdev, (devc->base + 0x18),
+ READ_PORT_USHORT (devc->osdev,
+ (devc->base + 0x18)) &
+ ~CLKRUN_GEN_ENABLE);
+ }
+ SRCMGR_Stop (devc, AllegroWave);
+ }
+ break;
+
+ case KSSTATE_RUN:
+
+
+ /* client not opened */
+ if (!AllegroWave->DspClientInstance)
+ {
+ SRCMGR_SetupStream (devc, AllegroWave);
+ }
+
+ /* start the transfer on whatevr method specified */
+ switch (AllegroWave->StreamType)
+ {
+ case STREAM_TYPE_DSPMSRC:
+ if (WAVE_CAPTURE == AllegroWave->WaveType)
+ SRCMGR_StartRecord (devc, AllegroWave);
+ else
+ SRCMGR_StartPlay (devc, AllegroWave);
+ break;
+ }
+
+ StreamsRunning++;
+
+ if (1 == StreamsRunning)
+ {
+ /* 4 ms * 12000 / 1000 */
+ kSetTimer (devc, gphwi, 240);
+ WRITE_PORT_USHORT (devc->osdev, (devc->base + 0x18),
+ READ_PORT_USHORT (devc->osdev,
+ (devc->base + 0x18)) |
+ CLKRUN_GEN_ENABLE);
+ }
+
+ break;
+ }
+ AllegroWave->State = NewState;
+ }
+ KeReleaseSpinLock (&gpGDI->ControlSpinLock, OldIrql);
+} /* SetState */
+
+#ifdef later
+ULONG
+GetMidiPosition ()
+{
+ return SRCMGR_GetPosition (devc, MidiStream);
+}
+
+PCLIENT_INST pClient;
+#define DBG_TRACE dprintf1
+
+DWORD
+InitModem (allegro_devc * devc)
+{
+ int cnt = 0;
+ int wRC, retry = 0;
+
+ do
+ {
+ wRC = kOpenInstance (devc, gphwi, CLIENT_MODEM, 0, 512 * 2 + 64, &pClient); /* HSP_Open */
+ }
+ while ((wRC != KRETURN_SUCCESS) && (cnt++ < 100)); /* enddo */
+
+ if (wRC != KRETURN_SUCCESS)
+ {
+ DBG_TRACE (("KOpenInstance from HSP modem fail"));
+ return FALSE;
+ } /* endif */
+ DBG_TRACE (("KOpenInstance from HSP modem OK"));
+
+ dprintf1 (("pClient Area=%x", pClient->dwDspDataClientArea));
+ /* setup the outbuffer address and length so Kernel can */
+ /* move the output data to MIXER */
+
+ retry = 0;
+ do
+ {
+
+ wRC = kStartTransfer (devc, gphwi,
+ pClient,
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ pClient->dwDspDataClientArea + 32,
+ 128, KCONNECT_NONE, KCONNECT_MIXER);
+
+#if ALLEGRO_DEBUG
+ if (wRC != KRETURN_SUCCESS)
+ {
+ DBG_TRACE (("kStartTransfer fail"));
+ } /* endif */
+#endif
+ }
+ while ((wRC != KRETURN_SUCCESS) && (retry++ < 100)); /* enddo */
+
+
+ if (wRC != KRETURN_SUCCESS)
+ {
+ DBG_TRACE (("kStartTransfer fail"));
+ kCloseInstance (gphwi, pClient, 0);
+#pragma message("----Closing client, can we handle this?")
+ return FALSE;
+ }
+ else
+ {
+ DBG_TRACE (("kStartTransfer OK"));
+ } /* endif */
+ return TRUE;
+
+}
+
+VOID
+CloseModem ()
+{
+
+ int cnt = 0;
+ int wRC;
+
+ cnt = 0;
+ if (!pClient)
+ return;
+
+ do
+ {
+ wRC = kStopTransfer (devc, gphwi, pClient);
+#if ALLEGRO_DEBUG
+ if (wRC != KRETURN_SUCCESS)
+ {
+ DBG_TRACE (("DSPStopXfer fail"));
+ } /* endif */
+#endif
+ }
+ while ((wRC != KRETURN_SUCCESS) && (cnt++ < 100));
+
+ cnt = 0;
+ do
+ {
+ wRC = kCloseInstance (devc, gphwi, pClient, 0);
+ }
+ while ((wRC != KRETURN_SUCCESS) && (cnt++ < 100)); /* enddo */
+
+}
+#endif
+
+void
+SRCMGR_SetPassThruVolume (allegro_devc * devc, IN PPASSTHRU client,
+ IN USHORT left, IN USHORT right)
+{
+ USHORT lvalue;
+ USHORT rvalue;
+
+ if (client)
+ {
+ lvalue = left >> 1;
+ rvalue = right >> 1;
+
+ kSetPassThruVolume (devc, gphwi, client, lvalue, rvalue);
+ dprintf3 (("kSetPassThruVolume %x %x", lvalue, rvalue));
+ }
+} /* SRCMGR_SetPassThruVolume */
+
+void
+SRCMGR_SetPassThruRearVolume (allegro_devc * devc, IN PPASSTHRU client,
+ IN USHORT left, IN USHORT right)
+{
+ USHORT lvalue;
+ USHORT rvalue;
+
+ if (!client)
+ return;
+
+ /*LeftPassThruVolRear = left; */
+ /*RightPassThruVolRear = right; */
+
+
+ if (client)
+ {
+ lvalue = left >> 1;
+ rvalue = right >> 1;
+
+ kSetPassThruRearVolume (devc, gphwi, client, lvalue, rvalue);
+ }
+} /* SRCMGR_SetPassThruRearVolume */