162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 262306a36Sopenharmony_ci/*************************************************************************** 362306a36Sopenharmony_ci * au88x0_cxtalk.c 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Wed Nov 19 16:29:47 2003 662306a36Sopenharmony_ci * Copyright 2003 mjander 762306a36Sopenharmony_ci * mjander@users.sourceforge.org 862306a36Sopenharmony_ci ****************************************************************************/ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include "au88x0_xtalk.h" 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* Data (a whole lot of data.... ) */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cistatic short const sXtalkWideKLeftEq = 0x269C; 1862306a36Sopenharmony_cistatic short const sXtalkWideKRightEq = 0x269C; 1962306a36Sopenharmony_cistatic short const sXtalkWideKLeftXt = 0xF25E; 2062306a36Sopenharmony_cistatic __maybe_unused short const sXtalkWideKRightXt = 0xF25E; 2162306a36Sopenharmony_cistatic short const sXtalkWideShiftLeftEq = 1; 2262306a36Sopenharmony_cistatic short const sXtalkWideShiftRightEq = 1; 2362306a36Sopenharmony_cistatic short const sXtalkWideShiftLeftXt = 0; 2462306a36Sopenharmony_cistatic __maybe_unused short const sXtalkWideShiftRightXt = 0; 2562306a36Sopenharmony_cistatic unsigned short const wXtalkWideLeftDelay = 0xd; 2662306a36Sopenharmony_cistatic unsigned short const wXtalkWideRightDelay = 0xd; 2762306a36Sopenharmony_cistatic short const sXtalkNarrowKLeftEq = 0x468D; 2862306a36Sopenharmony_cistatic short const sXtalkNarrowKRightEq = 0x468D; 2962306a36Sopenharmony_cistatic short const sXtalkNarrowKLeftXt = 0xF82E; 3062306a36Sopenharmony_cistatic __maybe_unused short const sXtalkNarrowKRightXt = 0xF82E; 3162306a36Sopenharmony_cistatic short const sXtalkNarrowShiftLeftEq = 0x3; 3262306a36Sopenharmony_cistatic short const sXtalkNarrowShiftRightEq = 0x3; 3362306a36Sopenharmony_cistatic short const sXtalkNarrowShiftLeftXt = 0; 3462306a36Sopenharmony_cistatic __maybe_unused short const sXtalkNarrowShiftRightXt = 0; 3562306a36Sopenharmony_cistatic unsigned short const wXtalkNarrowLeftDelay = 0x7; 3662306a36Sopenharmony_cistatic unsigned short const wXtalkNarrowRightDelay = 0x7; 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_cistatic __maybe_unused xtalk_gains_t const asXtalkGainsDefault = { 3962306a36Sopenharmony_ci 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 4062306a36Sopenharmony_ci 0x4000, 0x4000, 0x4000, 0x4000, 0x4000 4162306a36Sopenharmony_ci}; 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_cistatic __maybe_unused xtalk_gains_t const asXtalkGainsTest = { 4462306a36Sopenharmony_ci 0x7fff, 0x8000, 0x0000, 0x0000, 0x0001, 4562306a36Sopenharmony_ci 0xffff, 0x4000, 0xc000, 0x0002, 0xfffe 4662306a36Sopenharmony_ci}; 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_cistatic __maybe_unused xtalk_gains_t const asXtalkGains1Chan = { 4962306a36Sopenharmony_ci 0x7FFF, 0, 0, 0, 0, 5062306a36Sopenharmony_ci 0x7FFF, 0, 0, 0, 0, 5162306a36Sopenharmony_ci}; 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci// Input gain for 4 A3D slices. One possible input pair is left zero. 5462306a36Sopenharmony_cistatic xtalk_gains_t const asXtalkGainsAllChan = { 5562306a36Sopenharmony_ci 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, 5662306a36Sopenharmony_ci 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0 5762306a36Sopenharmony_ci}; 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_cistatic xtalk_gains_t const asXtalkGainsZeros = { 6062306a36Sopenharmony_ci 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 6162306a36Sopenharmony_ci}; 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_cistatic xtalk_dline_t const alXtalkDlineZeros = { 6462306a36Sopenharmony_ci 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6562306a36Sopenharmony_ci 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 6662306a36Sopenharmony_ci}; 6762306a36Sopenharmony_cistatic __maybe_unused xtalk_dline_t const alXtalkDlineTest = { 6862306a36Sopenharmony_ci 0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0, 6962306a36Sopenharmony_ci 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7062306a36Sopenharmony_ci 0, 0, 0, 0, 0, 0, 0, 0 7162306a36Sopenharmony_ci}; 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_cistatic xtalk_instate_t const asXtalkInStateZeros = { 7462306a36Sopenharmony_ci 0, 0, 0, 0 7562306a36Sopenharmony_ci}; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_cistatic __maybe_unused xtalk_instate_t const asXtalkInStateTest = { 7862306a36Sopenharmony_ci 0x0080, 0xff80, 0x0001, 0xffff 7962306a36Sopenharmony_ci}; 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_cistatic xtalk_state_t const asXtalkOutStateZeros = { 8262306a36Sopenharmony_ci {0, 0, 0, 0}, 8362306a36Sopenharmony_ci {0, 0, 0, 0}, 8462306a36Sopenharmony_ci {0, 0, 0, 0}, 8562306a36Sopenharmony_ci {0, 0, 0, 0}, 8662306a36Sopenharmony_ci {0, 0, 0, 0} 8762306a36Sopenharmony_ci}; 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_cistatic short const sDiamondKLeftEq = 0x401d; 9062306a36Sopenharmony_cistatic short const sDiamondKRightEq = 0x401d; 9162306a36Sopenharmony_cistatic short const sDiamondKLeftXt = 0xF90E; 9262306a36Sopenharmony_cistatic __maybe_unused short const sDiamondKRightXt = 0xF90E; 9362306a36Sopenharmony_cistatic short const sDiamondShiftLeftEq = 1; 9462306a36Sopenharmony_cistatic short const sDiamondShiftRightEq = 1; 9562306a36Sopenharmony_cistatic short const sDiamondShiftLeftXt = 0; 9662306a36Sopenharmony_cistatic __maybe_unused short const sDiamondShiftRightXt = 0; 9762306a36Sopenharmony_cistatic unsigned short const wDiamondLeftDelay = 0xb; 9862306a36Sopenharmony_cistatic unsigned short const wDiamondRightDelay = 0xb; 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkWideCoefsLeftEq = { 10162306a36Sopenharmony_ci {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 10262306a36Sopenharmony_ci {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 10362306a36Sopenharmony_ci {0x340B, 0xe8f5, 0x236c, 0xe40d, 0}, 10462306a36Sopenharmony_ci {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0}, 10562306a36Sopenharmony_ci {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 10662306a36Sopenharmony_ci}; 10762306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkWideCoefsRightEq = { 10862306a36Sopenharmony_ci {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 10962306a36Sopenharmony_ci {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 11062306a36Sopenharmony_ci {0x340B, 0xe8f5, 0x236c, 0xe40d, 0}, 11162306a36Sopenharmony_ci {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0}, 11262306a36Sopenharmony_ci {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 11362306a36Sopenharmony_ci}; 11462306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkWideCoefsLeftXt = { 11562306a36Sopenharmony_ci {0x55c6, 0xc97b, 0x005b, 0x0047, 0}, 11662306a36Sopenharmony_ci {0x6a60, 0xca20, 0xffc6, 0x0040, 0}, 11762306a36Sopenharmony_ci {0x6411, 0xd711, 0xfca1, 0x0190, 0}, 11862306a36Sopenharmony_ci {0x77dc, 0xc79e, 0xffb8, 0x000a, 0}, 11962306a36Sopenharmony_ci {0, 0, 0, 0, 0} 12062306a36Sopenharmony_ci}; 12162306a36Sopenharmony_cistatic __maybe_unused xtalk_coefs_t const asXtalkWideCoefsRightXt = { 12262306a36Sopenharmony_ci {0x55c6, 0xc97b, 0x005b, 0x0047, 0}, 12362306a36Sopenharmony_ci {0x6a60, 0xca20, 0xffc6, 0x0040, 0}, 12462306a36Sopenharmony_ci {0x6411, 0xd711, 0xfca1, 0x0190, 0}, 12562306a36Sopenharmony_ci {0x77dc, 0xc79e, 0xffb8, 0x000a, 0}, 12662306a36Sopenharmony_ci {0, 0, 0, 0, 0} 12762306a36Sopenharmony_ci}; 12862306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = { 12962306a36Sopenharmony_ci {0x50B5, 0xD07C, 0x026D, 0xFD21, 0}, 13062306a36Sopenharmony_ci {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0}, 13162306a36Sopenharmony_ci {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0}, 13262306a36Sopenharmony_ci {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0}, 13362306a36Sopenharmony_ci {0x383E, 0xFD9D, 0xB278, 0x4547, 0} 13462306a36Sopenharmony_ci}; 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkNarrowCoefsRightEq = { 13762306a36Sopenharmony_ci {0x50B5, 0xD07C, 0x026D, 0xFD21, 0}, 13862306a36Sopenharmony_ci {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0}, 13962306a36Sopenharmony_ci {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0}, 14062306a36Sopenharmony_ci {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0}, 14162306a36Sopenharmony_ci {0x383E, 0xFD9D, 0xB278, 0x4547, 0} 14262306a36Sopenharmony_ci}; 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkNarrowCoefsLeftXt = { 14562306a36Sopenharmony_ci {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0}, 14662306a36Sopenharmony_ci {0x6777, 0xC915, 0xFEAF, 0x00B1, 0}, 14762306a36Sopenharmony_ci {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0}, 14862306a36Sopenharmony_ci {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0}, 14962306a36Sopenharmony_ci {0, 0, 0, 0, 0} 15062306a36Sopenharmony_ci}; 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_cistatic __maybe_unused xtalk_coefs_t const asXtalkNarrowCoefsRightXt = { 15362306a36Sopenharmony_ci {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0}, 15462306a36Sopenharmony_ci {0x6777, 0xC915, 0xFEAF, 0x00B1, 0}, 15562306a36Sopenharmony_ci {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0}, 15662306a36Sopenharmony_ci {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0}, 15762306a36Sopenharmony_ci {0, 0, 0, 0, 0} 15862306a36Sopenharmony_ci}; 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkCoefsZeros = { 16162306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 16262306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 16362306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 16462306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 16562306a36Sopenharmony_ci {0, 0, 0, 0, 0} 16662306a36Sopenharmony_ci}; 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_cistatic xtalk_coefs_t const asXtalkCoefsPipe = { 16962306a36Sopenharmony_ci {0, 0, 0x0FA0, 0, 0}, 17062306a36Sopenharmony_ci {0, 0, 0x0FA0, 0, 0}, 17162306a36Sopenharmony_ci {0, 0, 0x0FA0, 0, 0}, 17262306a36Sopenharmony_ci {0, 0, 0x0FA0, 0, 0}, 17362306a36Sopenharmony_ci {0, 0, 0x1180, 0, 0}, 17462306a36Sopenharmony_ci}; 17562306a36Sopenharmony_cistatic __maybe_unused xtalk_coefs_t const asXtalkCoefsNegPipe = { 17662306a36Sopenharmony_ci {0, 0, 0xF380, 0, 0}, 17762306a36Sopenharmony_ci {0, 0, 0xF380, 0, 0}, 17862306a36Sopenharmony_ci {0, 0, 0xF380, 0, 0}, 17962306a36Sopenharmony_ci {0, 0, 0xF380, 0, 0}, 18062306a36Sopenharmony_ci {0, 0, 0xF200, 0, 0} 18162306a36Sopenharmony_ci}; 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_cistatic __maybe_unused xtalk_coefs_t const asXtalkCoefsNumTest = { 18462306a36Sopenharmony_ci {0, 0, 0xF380, 0x8000, 0x6D60}, 18562306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 18662306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 18762306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 18862306a36Sopenharmony_ci {0, 0, 0, 0, 0} 18962306a36Sopenharmony_ci}; 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_cistatic __maybe_unused xtalk_coefs_t const asXtalkCoefsDenTest = { 19262306a36Sopenharmony_ci {0xC000, 0x2000, 0x4000, 0, 0}, 19362306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 19462306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 19562306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 19662306a36Sopenharmony_ci {0, 0, 0, 0, 0} 19762306a36Sopenharmony_ci}; 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_cistatic __maybe_unused xtalk_state_t const asXtalkOutStateTest = { 20062306a36Sopenharmony_ci {0x7FFF, 0x0004, 0xFFFC, 0}, 20162306a36Sopenharmony_ci {0xFE00, 0x0008, 0xFFF8, 0x4000}, 20262306a36Sopenharmony_ci {0x0200, 0x0010, 0xFFF0, 0xC000}, 20362306a36Sopenharmony_ci {0x8000, 0x0020, 0xFFE0, 0}, 20462306a36Sopenharmony_ci {0, 0, 0, 0} 20562306a36Sopenharmony_ci}; 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_cistatic xtalk_coefs_t const asDiamondCoefsLeftEq = { 20862306a36Sopenharmony_ci {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0}, 20962306a36Sopenharmony_ci {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0}, 21062306a36Sopenharmony_ci {0xA93E, 0xDBD5, 0x022C, 0x028A, 0}, 21162306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 21262306a36Sopenharmony_ci {0, 0, 0, 0, 0} 21362306a36Sopenharmony_ci}; 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_cistatic xtalk_coefs_t const asDiamondCoefsRightEq = { 21662306a36Sopenharmony_ci {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0}, 21762306a36Sopenharmony_ci {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0}, 21862306a36Sopenharmony_ci {0xA93E, 0xDBD5, 0x022C, 0x028A, 0}, 21962306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 22062306a36Sopenharmony_ci {0, 0, 0, 0, 0} 22162306a36Sopenharmony_ci}; 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_cistatic xtalk_coefs_t const asDiamondCoefsLeftXt = { 22462306a36Sopenharmony_ci {0x3B50, 0xFE08, 0xF959, 0x0060, 0}, 22562306a36Sopenharmony_ci {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0}, 22662306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 22762306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 22862306a36Sopenharmony_ci {0, 0, 0, 0, 0} 22962306a36Sopenharmony_ci}; 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_cistatic __maybe_unused xtalk_coefs_t const asDiamondCoefsRightXt = { 23262306a36Sopenharmony_ci {0x3B50, 0xFE08, 0xF959, 0x0060, 0}, 23362306a36Sopenharmony_ci {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0}, 23462306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 23562306a36Sopenharmony_ci {0, 0, 0, 0, 0}, 23662306a36Sopenharmony_ci {0, 0, 0, 0, 0} 23762306a36Sopenharmony_ci}; 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci /**/ 24062306a36Sopenharmony_ci/* XTalk EQ and XT */ 24162306a36Sopenharmony_cistatic void 24262306a36Sopenharmony_civortex_XtalkHw_SetLeftEQ(vortex_t * vortex, short arg_0, short arg_4, 24362306a36Sopenharmony_ci xtalk_coefs_t const coefs) 24462306a36Sopenharmony_ci{ 24562306a36Sopenharmony_ci int i; 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 24862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24200 + i * 0x24, coefs[i][0]); 24962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24204 + i * 0x24, coefs[i][1]); 25062306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24208 + i * 0x24, coefs[i][2]); 25162306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2420c + i * 0x24, coefs[i][3]); 25262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24210 + i * 0x24, coefs[i][4]); 25362306a36Sopenharmony_ci } 25462306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24538, arg_0 & 0xffff); 25562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2453C, arg_4 & 0xffff); 25662306a36Sopenharmony_ci} 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_cistatic void 25962306a36Sopenharmony_civortex_XtalkHw_SetRightEQ(vortex_t * vortex, short arg_0, short arg_4, 26062306a36Sopenharmony_ci xtalk_coefs_t const coefs) 26162306a36Sopenharmony_ci{ 26262306a36Sopenharmony_ci int i; 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 26562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242b4 + i * 0x24, coefs[i][0]); 26662306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242b8 + i * 0x24, coefs[i][1]); 26762306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242bc + i * 0x24, coefs[i][2]); 26862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242c0 + i * 0x24, coefs[i][3]); 26962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242c4 + i * 0x24, coefs[i][4]); 27062306a36Sopenharmony_ci } 27162306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24540, arg_0 & 0xffff); 27262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24544, arg_4 & 0xffff); 27362306a36Sopenharmony_ci} 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_cistatic void 27662306a36Sopenharmony_civortex_XtalkHw_SetLeftXT(vortex_t * vortex, short arg_0, short arg_4, 27762306a36Sopenharmony_ci xtalk_coefs_t const coefs) 27862306a36Sopenharmony_ci{ 27962306a36Sopenharmony_ci int i; 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 28262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24368 + i * 0x24, coefs[i][0]); 28362306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2436c + i * 0x24, coefs[i][1]); 28462306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24370 + i * 0x24, coefs[i][2]); 28562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24374 + i * 0x24, coefs[i][3]); 28662306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24378 + i * 0x24, coefs[i][4]); 28762306a36Sopenharmony_ci } 28862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24548, arg_0 & 0xffff); 28962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2454C, arg_4 & 0xffff); 29062306a36Sopenharmony_ci} 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_cistatic void 29362306a36Sopenharmony_civortex_XtalkHw_SetRightXT(vortex_t * vortex, short arg_0, short arg_4, 29462306a36Sopenharmony_ci xtalk_coefs_t const coefs) 29562306a36Sopenharmony_ci{ 29662306a36Sopenharmony_ci int i; 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 29962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2441C + i * 0x24, coefs[i][0]); 30062306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24420 + i * 0x24, coefs[i][1]); 30162306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24424 + i * 0x24, coefs[i][2]); 30262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24428 + i * 0x24, coefs[i][3]); 30362306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2442C + i * 0x24, coefs[i][4]); 30462306a36Sopenharmony_ci } 30562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24550, arg_0 & 0xffff); 30662306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24554, arg_4 & 0xffff); 30762306a36Sopenharmony_ci} 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_cistatic void 31062306a36Sopenharmony_civortex_XtalkHw_SetLeftEQStates(vortex_t * vortex, 31162306a36Sopenharmony_ci xtalk_instate_t const arg_0, 31262306a36Sopenharmony_ci xtalk_state_t const coefs) 31362306a36Sopenharmony_ci{ 31462306a36Sopenharmony_ci int i; 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 31762306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24214 + i * 0x24, coefs[i][0]); 31862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24218 + i * 0x24, coefs[i][1]); 31962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]); 32062306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]); 32162306a36Sopenharmony_ci } 32262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x244F8, arg_0[0]); 32362306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x244FC, arg_0[1]); 32462306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24500, arg_0[2]); 32562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24504, arg_0[3]); 32662306a36Sopenharmony_ci} 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_cistatic void 32962306a36Sopenharmony_civortex_XtalkHw_SetRightEQStates(vortex_t * vortex, 33062306a36Sopenharmony_ci xtalk_instate_t const arg_0, 33162306a36Sopenharmony_ci xtalk_state_t const coefs) 33262306a36Sopenharmony_ci{ 33362306a36Sopenharmony_ci int i; 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 33662306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242C8 + i * 0x24, coefs[i][0]); 33762306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242CC + i * 0x24, coefs[i][1]); 33862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]); 33962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]); 34062306a36Sopenharmony_ci } 34162306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24508, arg_0[0]); 34262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2450C, arg_0[1]); 34362306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24510, arg_0[2]); 34462306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24514, arg_0[3]); 34562306a36Sopenharmony_ci} 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_cistatic void 34862306a36Sopenharmony_civortex_XtalkHw_SetLeftXTStates(vortex_t * vortex, 34962306a36Sopenharmony_ci xtalk_instate_t const arg_0, 35062306a36Sopenharmony_ci xtalk_state_t const coefs) 35162306a36Sopenharmony_ci{ 35262306a36Sopenharmony_ci int i; 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 35562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2437C + i * 0x24, coefs[i][0]); 35662306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24380 + i * 0x24, coefs[i][1]); 35762306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]); 35862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]); 35962306a36Sopenharmony_ci } 36062306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24518, arg_0[0]); 36162306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2451C, arg_0[1]); 36262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24520, arg_0[2]); 36362306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24524, arg_0[3]); 36462306a36Sopenharmony_ci} 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_cistatic void 36762306a36Sopenharmony_civortex_XtalkHw_SetRightXTStates(vortex_t * vortex, 36862306a36Sopenharmony_ci xtalk_instate_t const arg_0, 36962306a36Sopenharmony_ci xtalk_state_t const coefs) 37062306a36Sopenharmony_ci{ 37162306a36Sopenharmony_ci int i; 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 37462306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24430 + i * 0x24, coefs[i][0]); 37562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24434 + i * 0x24, coefs[i][1]); 37662306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]); 37762306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]); 37862306a36Sopenharmony_ci } 37962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24528, arg_0[0]); 38062306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x2452C, arg_0[1]); 38162306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24530, arg_0[2]); 38262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24534, arg_0[3]); 38362306a36Sopenharmony_ci} 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci#if 0 38662306a36Sopenharmony_cistatic void 38762306a36Sopenharmony_civortex_XtalkHw_GetLeftEQ(vortex_t * vortex, short *arg_0, short *arg_4, 38862306a36Sopenharmony_ci xtalk_coefs_t coefs) 38962306a36Sopenharmony_ci{ 39062306a36Sopenharmony_ci int i; 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 39362306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x24200 + i * 0x24); 39462306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x24204 + i * 0x24); 39562306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x24208 + i * 0x24); 39662306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x2420c + i * 0x24); 39762306a36Sopenharmony_ci coefs[i][4] = hwread(vortex->mmio, 0x24210 + i * 0x24); 39862306a36Sopenharmony_ci } 39962306a36Sopenharmony_ci *arg_0 = hwread(vortex->mmio, 0x24538) & 0xffff; 40062306a36Sopenharmony_ci *arg_4 = hwread(vortex->mmio, 0x2453c) & 0xffff; 40162306a36Sopenharmony_ci} 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_cistatic void 40462306a36Sopenharmony_civortex_XtalkHw_GetRightEQ(vortex_t * vortex, short *arg_0, short *arg_4, 40562306a36Sopenharmony_ci xtalk_coefs_t coefs) 40662306a36Sopenharmony_ci{ 40762306a36Sopenharmony_ci int i; 40862306a36Sopenharmony_ci 40962306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 41062306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x242b4 + i * 0x24); 41162306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x242b8 + i * 0x24); 41262306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x242bc + i * 0x24); 41362306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x242c0 + i * 0x24); 41462306a36Sopenharmony_ci coefs[i][4] = hwread(vortex->mmio, 0x242c4 + i * 0x24); 41562306a36Sopenharmony_ci } 41662306a36Sopenharmony_ci *arg_0 = hwread(vortex->mmio, 0x24540) & 0xffff; 41762306a36Sopenharmony_ci *arg_4 = hwread(vortex->mmio, 0x24544) & 0xffff; 41862306a36Sopenharmony_ci} 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_cistatic void 42162306a36Sopenharmony_civortex_XtalkHw_GetLeftXT(vortex_t * vortex, short *arg_0, short *arg_4, 42262306a36Sopenharmony_ci xtalk_coefs_t coefs) 42362306a36Sopenharmony_ci{ 42462306a36Sopenharmony_ci int i; 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 42762306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x24368 + i * 0x24); 42862306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x2436C + i * 0x24); 42962306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x24370 + i * 0x24); 43062306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x24374 + i * 0x24); 43162306a36Sopenharmony_ci coefs[i][4] = hwread(vortex->mmio, 0x24378 + i * 0x24); 43262306a36Sopenharmony_ci } 43362306a36Sopenharmony_ci *arg_0 = hwread(vortex->mmio, 0x24548) & 0xffff; 43462306a36Sopenharmony_ci *arg_4 = hwread(vortex->mmio, 0x2454C) & 0xffff; 43562306a36Sopenharmony_ci} 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_cistatic void 43862306a36Sopenharmony_civortex_XtalkHw_GetRightXT(vortex_t * vortex, short *arg_0, short *arg_4, 43962306a36Sopenharmony_ci xtalk_coefs_t coefs) 44062306a36Sopenharmony_ci{ 44162306a36Sopenharmony_ci int i; 44262306a36Sopenharmony_ci 44362306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 44462306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x2441C + i * 0x24); 44562306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x24420 + i * 0x24); 44662306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x24424 + i * 0x24); 44762306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x24428 + i * 0x24); 44862306a36Sopenharmony_ci coefs[i][4] = hwread(vortex->mmio, 0x2442C + i * 0x24); 44962306a36Sopenharmony_ci } 45062306a36Sopenharmony_ci *arg_0 = hwread(vortex->mmio, 0x24550) & 0xffff; 45162306a36Sopenharmony_ci *arg_4 = hwread(vortex->mmio, 0x24554) & 0xffff; 45262306a36Sopenharmony_ci} 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_cistatic void 45562306a36Sopenharmony_civortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0, 45662306a36Sopenharmony_ci xtalk_state_t coefs) 45762306a36Sopenharmony_ci{ 45862306a36Sopenharmony_ci int i; 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 46162306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x24214 + i * 0x24); 46262306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x24218 + i * 0x24); 46362306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24); 46462306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24); 46562306a36Sopenharmony_ci } 46662306a36Sopenharmony_ci arg_0[0] = hwread(vortex->mmio, 0x244F8); 46762306a36Sopenharmony_ci arg_0[1] = hwread(vortex->mmio, 0x244FC); 46862306a36Sopenharmony_ci arg_0[2] = hwread(vortex->mmio, 0x24500); 46962306a36Sopenharmony_ci arg_0[3] = hwread(vortex->mmio, 0x24504); 47062306a36Sopenharmony_ci} 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_cistatic void 47362306a36Sopenharmony_civortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0, 47462306a36Sopenharmony_ci xtalk_state_t coefs) 47562306a36Sopenharmony_ci{ 47662306a36Sopenharmony_ci int i; 47762306a36Sopenharmony_ci 47862306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 47962306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x242C8 + i * 0x24); 48062306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x242CC + i * 0x24); 48162306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24); 48262306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24); 48362306a36Sopenharmony_ci } 48462306a36Sopenharmony_ci arg_0[0] = hwread(vortex->mmio, 0x24508); 48562306a36Sopenharmony_ci arg_0[1] = hwread(vortex->mmio, 0x2450C); 48662306a36Sopenharmony_ci arg_0[2] = hwread(vortex->mmio, 0x24510); 48762306a36Sopenharmony_ci arg_0[3] = hwread(vortex->mmio, 0x24514); 48862306a36Sopenharmony_ci} 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_cistatic void 49162306a36Sopenharmony_civortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0, 49262306a36Sopenharmony_ci xtalk_state_t coefs) 49362306a36Sopenharmony_ci{ 49462306a36Sopenharmony_ci int i; 49562306a36Sopenharmony_ci 49662306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 49762306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x2437C + i * 0x24); 49862306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x24380 + i * 0x24); 49962306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24); 50062306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24); 50162306a36Sopenharmony_ci } 50262306a36Sopenharmony_ci arg_0[0] = hwread(vortex->mmio, 0x24518); 50362306a36Sopenharmony_ci arg_0[1] = hwread(vortex->mmio, 0x2451C); 50462306a36Sopenharmony_ci arg_0[2] = hwread(vortex->mmio, 0x24520); 50562306a36Sopenharmony_ci arg_0[3] = hwread(vortex->mmio, 0x24524); 50662306a36Sopenharmony_ci} 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_cistatic void 50962306a36Sopenharmony_civortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0, 51062306a36Sopenharmony_ci xtalk_state_t coefs) 51162306a36Sopenharmony_ci{ 51262306a36Sopenharmony_ci int i; 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci for (i = 0; i < 5; i++) { 51562306a36Sopenharmony_ci coefs[i][0] = hwread(vortex->mmio, 0x24430 + i * 0x24); 51662306a36Sopenharmony_ci coefs[i][1] = hwread(vortex->mmio, 0x24434 + i * 0x24); 51762306a36Sopenharmony_ci coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24); 51862306a36Sopenharmony_ci coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24); 51962306a36Sopenharmony_ci } 52062306a36Sopenharmony_ci arg_0[0] = hwread(vortex->mmio, 0x24528); 52162306a36Sopenharmony_ci arg_0[1] = hwread(vortex->mmio, 0x2452C); 52262306a36Sopenharmony_ci arg_0[2] = hwread(vortex->mmio, 0x24530); 52362306a36Sopenharmony_ci arg_0[3] = hwread(vortex->mmio, 0x24534); 52462306a36Sopenharmony_ci} 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_ci#endif 52762306a36Sopenharmony_ci/* Gains */ 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_cistatic void 53062306a36Sopenharmony_civortex_XtalkHw_SetGains(vortex_t * vortex, xtalk_gains_t const gains) 53162306a36Sopenharmony_ci{ 53262306a36Sopenharmony_ci int i; 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci for (i = 0; i < XTGAINS_SZ; i++) { 53562306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x244D0 + (i * 4), gains[i]); 53662306a36Sopenharmony_ci } 53762306a36Sopenharmony_ci} 53862306a36Sopenharmony_ci 53962306a36Sopenharmony_cistatic void 54062306a36Sopenharmony_civortex_XtalkHw_SetGainsAllChan(vortex_t * vortex) 54162306a36Sopenharmony_ci{ 54262306a36Sopenharmony_ci vortex_XtalkHw_SetGains(vortex, asXtalkGainsAllChan); 54362306a36Sopenharmony_ci} 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_ci#if 0 54662306a36Sopenharmony_cistatic void vortex_XtalkHw_GetGains(vortex_t * vortex, xtalk_gains_t gains) 54762306a36Sopenharmony_ci{ 54862306a36Sopenharmony_ci int i; 54962306a36Sopenharmony_ci 55062306a36Sopenharmony_ci for (i = 0; i < XTGAINS_SZ; i++) 55162306a36Sopenharmony_ci gains[i] = hwread(vortex->mmio, 0x244D0 + i * 4); 55262306a36Sopenharmony_ci} 55362306a36Sopenharmony_ci 55462306a36Sopenharmony_ci#endif 55562306a36Sopenharmony_ci/* Delay parameters */ 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_cistatic void 55862306a36Sopenharmony_civortex_XtalkHw_SetDelay(vortex_t * vortex, unsigned short right, 55962306a36Sopenharmony_ci unsigned short left) 56062306a36Sopenharmony_ci{ 56162306a36Sopenharmony_ci u32 esp0 = 0; 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci esp0 &= 0x1FFFFFFF; 56462306a36Sopenharmony_ci esp0 |= 0xA0000000; 56562306a36Sopenharmony_ci esp0 = (esp0 & 0xffffE0ff) | ((right & 0x1F) << 8); 56662306a36Sopenharmony_ci esp0 = (esp0 & 0xfffc1fff) | ((left & 0x1F) << 0xd); 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24660, esp0); 56962306a36Sopenharmony_ci} 57062306a36Sopenharmony_ci 57162306a36Sopenharmony_cistatic void 57262306a36Sopenharmony_civortex_XtalkHw_SetLeftDline(vortex_t * vortex, xtalk_dline_t const dline) 57362306a36Sopenharmony_ci{ 57462306a36Sopenharmony_ci int i; 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci for (i = 0; i < 0x20; i++) { 57762306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24000 + (i << 2), dline[i] & 0xffff); 57862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24080 + (i << 2), dline[i] >> 0x10); 57962306a36Sopenharmony_ci } 58062306a36Sopenharmony_ci} 58162306a36Sopenharmony_ci 58262306a36Sopenharmony_cistatic void 58362306a36Sopenharmony_civortex_XtalkHw_SetRightDline(vortex_t * vortex, xtalk_dline_t const dline) 58462306a36Sopenharmony_ci{ 58562306a36Sopenharmony_ci int i; 58662306a36Sopenharmony_ci 58762306a36Sopenharmony_ci for (i = 0; i < 0x20; i++) { 58862306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24100 + (i << 2), dline[i] & 0xffff); 58962306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24180 + (i << 2), dline[i] >> 0x10); 59062306a36Sopenharmony_ci } 59162306a36Sopenharmony_ci} 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_ci#if 0 59462306a36Sopenharmony_cistatic void 59562306a36Sopenharmony_civortex_XtalkHw_GetDelay(vortex_t * vortex, unsigned short *right, 59662306a36Sopenharmony_ci unsigned short *left) 59762306a36Sopenharmony_ci{ 59862306a36Sopenharmony_ci int esp0; 59962306a36Sopenharmony_ci 60062306a36Sopenharmony_ci esp0 = hwread(vortex->mmio, 0x24660); 60162306a36Sopenharmony_ci *right = (esp0 >> 8) & 0x1f; 60262306a36Sopenharmony_ci *left = (esp0 >> 0xd) & 0x1f; 60362306a36Sopenharmony_ci} 60462306a36Sopenharmony_ci 60562306a36Sopenharmony_cistatic void vortex_XtalkHw_GetLeftDline(vortex_t * vortex, xtalk_dline_t dline) 60662306a36Sopenharmony_ci{ 60762306a36Sopenharmony_ci int i; 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ci for (i = 0; i < 0x20; i++) { 61062306a36Sopenharmony_ci dline[i] = 61162306a36Sopenharmony_ci (hwread(vortex->mmio, 0x24000 + (i << 2)) & 0xffff) | 61262306a36Sopenharmony_ci (hwread(vortex->mmio, 0x24080 + (i << 2)) << 0x10); 61362306a36Sopenharmony_ci } 61462306a36Sopenharmony_ci} 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_cistatic void vortex_XtalkHw_GetRightDline(vortex_t * vortex, xtalk_dline_t dline) 61762306a36Sopenharmony_ci{ 61862306a36Sopenharmony_ci int i; 61962306a36Sopenharmony_ci 62062306a36Sopenharmony_ci for (i = 0; i < 0x20; i++) { 62162306a36Sopenharmony_ci dline[i] = 62262306a36Sopenharmony_ci (hwread(vortex->mmio, 0x24100 + (i << 2)) & 0xffff) | 62362306a36Sopenharmony_ci (hwread(vortex->mmio, 0x24180 + (i << 2)) << 0x10); 62462306a36Sopenharmony_ci } 62562306a36Sopenharmony_ci} 62662306a36Sopenharmony_ci 62762306a36Sopenharmony_ci#endif 62862306a36Sopenharmony_ci/* Control/Global stuff */ 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ci#if 0 63162306a36Sopenharmony_cistatic void vortex_XtalkHw_SetControlReg(vortex_t * vortex, u32 ctrl) 63262306a36Sopenharmony_ci{ 63362306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24660, ctrl); 63462306a36Sopenharmony_ci} 63562306a36Sopenharmony_cistatic void vortex_XtalkHw_GetControlReg(vortex_t * vortex, u32 *ctrl) 63662306a36Sopenharmony_ci{ 63762306a36Sopenharmony_ci *ctrl = hwread(vortex->mmio, 0x24660); 63862306a36Sopenharmony_ci} 63962306a36Sopenharmony_ci#endif 64062306a36Sopenharmony_cistatic void vortex_XtalkHw_SetSampleRate(vortex_t * vortex, u32 sr) 64162306a36Sopenharmony_ci{ 64262306a36Sopenharmony_ci u32 temp; 64362306a36Sopenharmony_ci 64462306a36Sopenharmony_ci temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000; 64562306a36Sopenharmony_ci temp = (temp & 0xffffff07) | ((sr & 0x1f) << 3); 64662306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24660, temp); 64762306a36Sopenharmony_ci} 64862306a36Sopenharmony_ci 64962306a36Sopenharmony_ci#if 0 65062306a36Sopenharmony_cistatic void vortex_XtalkHw_GetSampleRate(vortex_t * vortex, u32 *sr) 65162306a36Sopenharmony_ci{ 65262306a36Sopenharmony_ci *sr = (hwread(vortex->mmio, 0x24660) >> 3) & 0x1f; 65362306a36Sopenharmony_ci} 65462306a36Sopenharmony_ci 65562306a36Sopenharmony_ci#endif 65662306a36Sopenharmony_cistatic void vortex_XtalkHw_Enable(vortex_t * vortex) 65762306a36Sopenharmony_ci{ 65862306a36Sopenharmony_ci u32 temp; 65962306a36Sopenharmony_ci 66062306a36Sopenharmony_ci temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000; 66162306a36Sopenharmony_ci temp |= 1; 66262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24660, temp); 66362306a36Sopenharmony_ci 66462306a36Sopenharmony_ci} 66562306a36Sopenharmony_ci 66662306a36Sopenharmony_cistatic void vortex_XtalkHw_Disable(vortex_t * vortex) 66762306a36Sopenharmony_ci{ 66862306a36Sopenharmony_ci u32 temp; 66962306a36Sopenharmony_ci 67062306a36Sopenharmony_ci temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000; 67162306a36Sopenharmony_ci temp &= 0xfffffffe; 67262306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24660, temp); 67362306a36Sopenharmony_ci 67462306a36Sopenharmony_ci} 67562306a36Sopenharmony_ci 67662306a36Sopenharmony_cistatic void vortex_XtalkHw_ZeroIO(vortex_t * vortex) 67762306a36Sopenharmony_ci{ 67862306a36Sopenharmony_ci int i; 67962306a36Sopenharmony_ci 68062306a36Sopenharmony_ci for (i = 0; i < 20; i++) 68162306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24600 + (i << 2), 0); 68262306a36Sopenharmony_ci for (i = 0; i < 4; i++) 68362306a36Sopenharmony_ci hwwrite(vortex->mmio, 0x24650 + (i << 2), 0); 68462306a36Sopenharmony_ci} 68562306a36Sopenharmony_ci 68662306a36Sopenharmony_cistatic void vortex_XtalkHw_ZeroState(vortex_t * vortex) 68762306a36Sopenharmony_ci{ 68862306a36Sopenharmony_ci vortex_XtalkHw_ZeroIO(vortex); // inlined 68962306a36Sopenharmony_ci 69062306a36Sopenharmony_ci vortex_XtalkHw_SetLeftEQ(vortex, 0, 0, asXtalkCoefsZeros); 69162306a36Sopenharmony_ci vortex_XtalkHw_SetRightEQ(vortex, 0, 0, asXtalkCoefsZeros); 69262306a36Sopenharmony_ci 69362306a36Sopenharmony_ci vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros); 69462306a36Sopenharmony_ci vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros); 69562306a36Sopenharmony_ci 69662306a36Sopenharmony_ci vortex_XtalkHw_SetGains(vortex, asXtalkGainsZeros); // inlined 69762306a36Sopenharmony_ci 69862306a36Sopenharmony_ci vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined 69962306a36Sopenharmony_ci 70062306a36Sopenharmony_ci vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined 70162306a36Sopenharmony_ci vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined 70262306a36Sopenharmony_ci vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined 70362306a36Sopenharmony_ci vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined 70462306a36Sopenharmony_ci 70562306a36Sopenharmony_ci vortex_XtalkHw_SetLeftEQStates(vortex, asXtalkInStateZeros, 70662306a36Sopenharmony_ci asXtalkOutStateZeros); 70762306a36Sopenharmony_ci vortex_XtalkHw_SetRightEQStates(vortex, asXtalkInStateZeros, 70862306a36Sopenharmony_ci asXtalkOutStateZeros); 70962306a36Sopenharmony_ci vortex_XtalkHw_SetLeftXTStates(vortex, asXtalkInStateZeros, 71062306a36Sopenharmony_ci asXtalkOutStateZeros); 71162306a36Sopenharmony_ci vortex_XtalkHw_SetRightXTStates(vortex, asXtalkInStateZeros, 71262306a36Sopenharmony_ci asXtalkOutStateZeros); 71362306a36Sopenharmony_ci} 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_cistatic void vortex_XtalkHw_ProgramPipe(vortex_t * vortex) 71662306a36Sopenharmony_ci{ 71762306a36Sopenharmony_ci 71862306a36Sopenharmony_ci vortex_XtalkHw_SetLeftEQ(vortex, 0, 1, asXtalkCoefsPipe); 71962306a36Sopenharmony_ci vortex_XtalkHw_SetRightEQ(vortex, 0, 1, asXtalkCoefsPipe); 72062306a36Sopenharmony_ci vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros); 72162306a36Sopenharmony_ci vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros); 72262306a36Sopenharmony_ci 72362306a36Sopenharmony_ci vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined 72462306a36Sopenharmony_ci} 72562306a36Sopenharmony_ci 72662306a36Sopenharmony_cistatic void vortex_XtalkHw_ProgramXtalkWide(vortex_t * vortex) 72762306a36Sopenharmony_ci{ 72862306a36Sopenharmony_ci 72962306a36Sopenharmony_ci vortex_XtalkHw_SetLeftEQ(vortex, sXtalkWideKLeftEq, 73062306a36Sopenharmony_ci sXtalkWideShiftLeftEq, asXtalkWideCoefsLeftEq); 73162306a36Sopenharmony_ci vortex_XtalkHw_SetRightEQ(vortex, sXtalkWideKRightEq, 73262306a36Sopenharmony_ci sXtalkWideShiftRightEq, 73362306a36Sopenharmony_ci asXtalkWideCoefsRightEq); 73462306a36Sopenharmony_ci vortex_XtalkHw_SetLeftXT(vortex, sXtalkWideKLeftXt, 73562306a36Sopenharmony_ci sXtalkWideShiftLeftXt, asXtalkWideCoefsLeftXt); 73662306a36Sopenharmony_ci vortex_XtalkHw_SetRightXT(vortex, sXtalkWideKLeftXt, 73762306a36Sopenharmony_ci sXtalkWideShiftLeftXt, 73862306a36Sopenharmony_ci asXtalkWideCoefsLeftXt); 73962306a36Sopenharmony_ci 74062306a36Sopenharmony_ci vortex_XtalkHw_SetDelay(vortex, wXtalkWideRightDelay, wXtalkWideLeftDelay); // inlined 74162306a36Sopenharmony_ci} 74262306a36Sopenharmony_ci 74362306a36Sopenharmony_cistatic void vortex_XtalkHw_ProgramXtalkNarrow(vortex_t * vortex) 74462306a36Sopenharmony_ci{ 74562306a36Sopenharmony_ci 74662306a36Sopenharmony_ci vortex_XtalkHw_SetLeftEQ(vortex, sXtalkNarrowKLeftEq, 74762306a36Sopenharmony_ci sXtalkNarrowShiftLeftEq, 74862306a36Sopenharmony_ci asXtalkNarrowCoefsLeftEq); 74962306a36Sopenharmony_ci vortex_XtalkHw_SetRightEQ(vortex, sXtalkNarrowKRightEq, 75062306a36Sopenharmony_ci sXtalkNarrowShiftRightEq, 75162306a36Sopenharmony_ci asXtalkNarrowCoefsRightEq); 75262306a36Sopenharmony_ci vortex_XtalkHw_SetLeftXT(vortex, sXtalkNarrowKLeftXt, 75362306a36Sopenharmony_ci sXtalkNarrowShiftLeftXt, 75462306a36Sopenharmony_ci asXtalkNarrowCoefsLeftXt); 75562306a36Sopenharmony_ci vortex_XtalkHw_SetRightXT(vortex, sXtalkNarrowKLeftXt, 75662306a36Sopenharmony_ci sXtalkNarrowShiftLeftXt, 75762306a36Sopenharmony_ci asXtalkNarrowCoefsLeftXt); 75862306a36Sopenharmony_ci 75962306a36Sopenharmony_ci vortex_XtalkHw_SetDelay(vortex, wXtalkNarrowRightDelay, wXtalkNarrowLeftDelay); // inlined 76062306a36Sopenharmony_ci} 76162306a36Sopenharmony_ci 76262306a36Sopenharmony_cistatic void vortex_XtalkHw_ProgramDiamondXtalk(vortex_t * vortex) 76362306a36Sopenharmony_ci{ 76462306a36Sopenharmony_ci 76562306a36Sopenharmony_ci //sDiamondKLeftEq,sDiamondKRightXt,asDiamondCoefsLeftEq 76662306a36Sopenharmony_ci vortex_XtalkHw_SetLeftEQ(vortex, sDiamondKLeftEq, 76762306a36Sopenharmony_ci sDiamondShiftLeftEq, asDiamondCoefsLeftEq); 76862306a36Sopenharmony_ci vortex_XtalkHw_SetRightEQ(vortex, sDiamondKRightEq, 76962306a36Sopenharmony_ci sDiamondShiftRightEq, asDiamondCoefsRightEq); 77062306a36Sopenharmony_ci vortex_XtalkHw_SetLeftXT(vortex, sDiamondKLeftXt, 77162306a36Sopenharmony_ci sDiamondShiftLeftXt, asDiamondCoefsLeftXt); 77262306a36Sopenharmony_ci vortex_XtalkHw_SetRightXT(vortex, sDiamondKLeftXt, 77362306a36Sopenharmony_ci sDiamondShiftLeftXt, asDiamondCoefsLeftXt); 77462306a36Sopenharmony_ci 77562306a36Sopenharmony_ci vortex_XtalkHw_SetDelay(vortex, wDiamondRightDelay, wDiamondLeftDelay); // inlined 77662306a36Sopenharmony_ci} 77762306a36Sopenharmony_ci 77862306a36Sopenharmony_cistatic void vortex_XtalkHw_init(vortex_t * vortex) 77962306a36Sopenharmony_ci{ 78062306a36Sopenharmony_ci vortex_XtalkHw_ZeroState(vortex); 78162306a36Sopenharmony_ci} 78262306a36Sopenharmony_ci 78362306a36Sopenharmony_ci/* End of file */ 784