18c2ecf20Sopenharmony_ci/**************************************************************************** 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci Copyright Echo Digital Audio Corporation (c) 1998 - 2004 48c2ecf20Sopenharmony_ci All rights reserved 58c2ecf20Sopenharmony_ci www.echoaudio.com 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci This file is part of Echo Digital Audio's generic driver library. 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci Echo Digital Audio's generic driver library is free software; 108c2ecf20Sopenharmony_ci you can redistribute it and/or modify it under the terms of 118c2ecf20Sopenharmony_ci the GNU General Public License as published by the Free Software 128c2ecf20Sopenharmony_ci Foundation. 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci This program is distributed in the hope that it will be useful, 158c2ecf20Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 178c2ecf20Sopenharmony_ci GNU General Public License for more details. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci You should have received a copy of the GNU General Public License 208c2ecf20Sopenharmony_ci along with this program; if not, write to the Free Software 218c2ecf20Sopenharmony_ci Foundation, Inc., 59 Temple Place - Suite 330, Boston, 228c2ecf20Sopenharmony_ci MA 02111-1307, USA. 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci ************************************************************************* 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci Translation from C++ and adaptation for use in ALSA-Driver 278c2ecf20Sopenharmony_ci were made by Giuliano Pochini <pochini@shiny.it> 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci****************************************************************************/ 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#ifndef _ECHO_DSP_ 328c2ecf20Sopenharmony_ci#define _ECHO_DSP_ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/**** Echogals: Darla20, Gina20, Layla20, and Darla24 ****/ 368c2ecf20Sopenharmony_ci#if defined(ECHOGALS_FAMILY) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define NUM_ASIC_TESTS 5 398c2ecf20Sopenharmony_ci#define READ_DSP_TIMEOUT 1000000L /* one second */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/**** Echo24: Gina24, Layla24, Mona, Mia, Mia-midi ****/ 428c2ecf20Sopenharmony_ci#elif defined(ECHO24_FAMILY) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define DSP_56361 /* Some Echo24 cards use the 56361 DSP */ 458c2ecf20Sopenharmony_ci#define READ_DSP_TIMEOUT 100000L /* .1 second */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/**** 3G: Gina3G, Layla3G ****/ 488c2ecf20Sopenharmony_ci#elif defined(ECHO3G_FAMILY) 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define DSP_56361 518c2ecf20Sopenharmony_ci#define READ_DSP_TIMEOUT 100000L /* .1 second */ 528c2ecf20Sopenharmony_ci#define MIN_MTC_1X_RATE 32000 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/**** Indigo: Indigo, Indigo IO, Indigo DJ ****/ 558c2ecf20Sopenharmony_ci#elif defined(INDIGO_FAMILY) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define DSP_56361 588c2ecf20Sopenharmony_ci#define READ_DSP_TIMEOUT 100000L /* .1 second */ 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#else 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#error No family is defined 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#endif 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* 698c2ecf20Sopenharmony_ci * 708c2ecf20Sopenharmony_ci * Max inputs and outputs 718c2ecf20Sopenharmony_ci * 728c2ecf20Sopenharmony_ci */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define DSP_MAXAUDIOINPUTS 16 /* Max audio input channels */ 758c2ecf20Sopenharmony_ci#define DSP_MAXAUDIOOUTPUTS 16 /* Max audio output channels */ 768c2ecf20Sopenharmony_ci#define DSP_MAXPIPES 32 /* Max total pipes (input + output) */ 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci/* 808c2ecf20Sopenharmony_ci * 818c2ecf20Sopenharmony_ci * These are the offsets for the memory-mapped DSP registers; the DSP base 828c2ecf20Sopenharmony_ci * address is treated as the start of a u32 array. 838c2ecf20Sopenharmony_ci */ 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define CHI32_CONTROL_REG 4 868c2ecf20Sopenharmony_ci#define CHI32_STATUS_REG 5 878c2ecf20Sopenharmony_ci#define CHI32_VECTOR_REG 6 888c2ecf20Sopenharmony_ci#define CHI32_DATA_REG 7 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* 928c2ecf20Sopenharmony_ci * 938c2ecf20Sopenharmony_ci * Interesting bits within the DSP registers 948c2ecf20Sopenharmony_ci * 958c2ecf20Sopenharmony_ci */ 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define CHI32_VECTOR_BUSY 0x00000001 988c2ecf20Sopenharmony_ci#define CHI32_STATUS_REG_HF3 0x00000008 998c2ecf20Sopenharmony_ci#define CHI32_STATUS_REG_HF4 0x00000010 1008c2ecf20Sopenharmony_ci#define CHI32_STATUS_REG_HF5 0x00000020 1018c2ecf20Sopenharmony_ci#define CHI32_STATUS_HOST_READ_FULL 0x00000004 1028c2ecf20Sopenharmony_ci#define CHI32_STATUS_HOST_WRITE_EMPTY 0x00000002 1038c2ecf20Sopenharmony_ci#define CHI32_STATUS_IRQ 0x00000040 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* 1078c2ecf20Sopenharmony_ci * 1088c2ecf20Sopenharmony_ci * DSP commands sent via slave mode; these are sent to the DSP by write_dsp() 1098c2ecf20Sopenharmony_ci * 1108c2ecf20Sopenharmony_ci */ 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define DSP_FNC_SET_COMMPAGE_ADDR 0x02 1138c2ecf20Sopenharmony_ci#define DSP_FNC_LOAD_LAYLA_ASIC 0xa0 1148c2ecf20Sopenharmony_ci#define DSP_FNC_LOAD_GINA24_ASIC 0xa0 1158c2ecf20Sopenharmony_ci#define DSP_FNC_LOAD_MONA_PCI_CARD_ASIC 0xa0 1168c2ecf20Sopenharmony_ci#define DSP_FNC_LOAD_LAYLA24_PCI_CARD_ASIC 0xa0 1178c2ecf20Sopenharmony_ci#define DSP_FNC_LOAD_MONA_EXTERNAL_ASIC 0xa1 1188c2ecf20Sopenharmony_ci#define DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC 0xa1 1198c2ecf20Sopenharmony_ci#define DSP_FNC_LOAD_3G_ASIC 0xa0 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci/* 1238c2ecf20Sopenharmony_ci * 1248c2ecf20Sopenharmony_ci * Defines to handle the MIDI input state engine; these are used to properly 1258c2ecf20Sopenharmony_ci * extract MIDI time code bytes and their timestamps from the MIDI input stream. 1268c2ecf20Sopenharmony_ci * 1278c2ecf20Sopenharmony_ci */ 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#define MIDI_IN_STATE_NORMAL 0 1308c2ecf20Sopenharmony_ci#define MIDI_IN_STATE_TS_HIGH 1 1318c2ecf20Sopenharmony_ci#define MIDI_IN_STATE_TS_LOW 2 1328c2ecf20Sopenharmony_ci#define MIDI_IN_STATE_F1_DATA 3 1338c2ecf20Sopenharmony_ci#define MIDI_IN_SKIP_DATA (-1) 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci/*---------------------------------------------------------------------------- 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ciSetting the sample rates on Layla24 is somewhat schizophrenic. 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ciFor standard rates, it works exactly like Mona and Gina24. That is, for 1418c2ecf20Sopenharmony_ci8, 11.025, 16, 22.05, 32, 44.1, 48, 88.2, and 96 kHz, you just set the 1428c2ecf20Sopenharmony_ciappropriate bits in the control register and write the control register. 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ciIn order to support MIDI time code sync (and possibly SMPTE LTC sync in 1458c2ecf20Sopenharmony_cithe future), Layla24 also has "continuous sample rate mode". In this mode, 1468c2ecf20Sopenharmony_ciLayla24 can generate any sample rate between 25 and 50 kHz inclusive, or 1478c2ecf20Sopenharmony_ci50 to 100 kHz inclusive for double speed mode. 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ciTo use continuous mode: 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci-Set the clock select bits in the control register to 0xe (see the #define 1528c2ecf20Sopenharmony_ci below) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci-Set double-speed mode if you want to use sample rates above 50 kHz 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci-Write the control register as you would normally 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci-Now, you need to set the frequency register. First, you need to determine the 1598c2ecf20Sopenharmony_ci value for the frequency register. This is given by the following formula: 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_cifrequency_reg = (LAYLA24_MAGIC_NUMBER / sample_rate) - 2 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ciNote the #define below for the magic number 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci-Wait for the DSP handshake 1668c2ecf20Sopenharmony_ci-Write the frequency_reg value to the .SampleRate field of the comm page 1678c2ecf20Sopenharmony_ci-Send the vector command SET_LAYLA24_FREQUENCY_REG (see vmonkey.h) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ciOnce you have set the control register up for continuous mode, you can just 1708c2ecf20Sopenharmony_ciwrite the frequency register to change the sample rate. This could be 1718c2ecf20Sopenharmony_ciused for MIDI time code sync. For MTC sync, the control register is set for 1728c2ecf20Sopenharmony_cicontinuous mode. The driver then just keeps writing the 1738c2ecf20Sopenharmony_ciSET_LAYLA24_FREQUENCY_REG command. 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci-----------------------------------------------------------------------------*/ 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci#define LAYLA24_MAGIC_NUMBER 677376000 1788c2ecf20Sopenharmony_ci#define LAYLA24_CONTINUOUS_CLOCK 0x000e 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci/* 1828c2ecf20Sopenharmony_ci * 1838c2ecf20Sopenharmony_ci * DSP vector commands 1848c2ecf20Sopenharmony_ci * 1858c2ecf20Sopenharmony_ci */ 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci#define DSP_VC_RESET 0x80ff 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci#ifndef DSP_56361 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci#define DSP_VC_ACK_INT 0x8073 1928c2ecf20Sopenharmony_ci#define DSP_VC_SET_VMIXER_GAIN 0x0000 /* Not used, only for compile */ 1938c2ecf20Sopenharmony_ci#define DSP_VC_START_TRANSFER 0x0075 /* Handshke rqd. */ 1948c2ecf20Sopenharmony_ci#define DSP_VC_METERS_ON 0x0079 1958c2ecf20Sopenharmony_ci#define DSP_VC_METERS_OFF 0x007b 1968c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_OUTVOL 0x007d /* Handshke rqd. */ 1978c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_INGAIN 0x007f /* Handshke rqd. */ 1988c2ecf20Sopenharmony_ci#define DSP_VC_ADD_AUDIO_BUFFER 0x0081 /* Handshke rqd. */ 1998c2ecf20Sopenharmony_ci#define DSP_VC_TEST_ASIC 0x00eb 2008c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_CLOCKS 0x00ef /* Handshke rqd. */ 2018c2ecf20Sopenharmony_ci#define DSP_VC_SET_LAYLA_SAMPLE_RATE 0x00f1 /* Handshke rqd. */ 2028c2ecf20Sopenharmony_ci#define DSP_VC_SET_GD_AUDIO_STATE 0x00f1 /* Handshke rqd. */ 2038c2ecf20Sopenharmony_ci#define DSP_VC_WRITE_CONTROL_REG 0x00f1 /* Handshke rqd. */ 2048c2ecf20Sopenharmony_ci#define DSP_VC_MIDI_WRITE 0x00f5 /* Handshke rqd. */ 2058c2ecf20Sopenharmony_ci#define DSP_VC_STOP_TRANSFER 0x00f7 /* Handshke rqd. */ 2068c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_FLAGS 0x00fd /* Handshke rqd. */ 2078c2ecf20Sopenharmony_ci#define DSP_VC_GO_COMATOSE 0x00f9 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci#else /* !DSP_56361 */ 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci/* Vector commands for families that use either the 56301 or 56361 */ 2128c2ecf20Sopenharmony_ci#define DSP_VC_ACK_INT 0x80F5 2138c2ecf20Sopenharmony_ci#define DSP_VC_SET_VMIXER_GAIN 0x00DB /* Handshke rqd. */ 2148c2ecf20Sopenharmony_ci#define DSP_VC_START_TRANSFER 0x00DD /* Handshke rqd. */ 2158c2ecf20Sopenharmony_ci#define DSP_VC_METERS_ON 0x00EF 2168c2ecf20Sopenharmony_ci#define DSP_VC_METERS_OFF 0x00F1 2178c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_OUTVOL 0x00E3 /* Handshke rqd. */ 2188c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_INGAIN 0x00E5 /* Handshke rqd. */ 2198c2ecf20Sopenharmony_ci#define DSP_VC_ADD_AUDIO_BUFFER 0x00E1 /* Handshke rqd. */ 2208c2ecf20Sopenharmony_ci#define DSP_VC_TEST_ASIC 0x00ED 2218c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_CLOCKS 0x00E9 /* Handshke rqd. */ 2228c2ecf20Sopenharmony_ci#define DSP_VC_SET_LAYLA24_FREQUENCY_REG 0x00E9 /* Handshke rqd. */ 2238c2ecf20Sopenharmony_ci#define DSP_VC_SET_LAYLA_SAMPLE_RATE 0x00EB /* Handshke rqd. */ 2248c2ecf20Sopenharmony_ci#define DSP_VC_SET_GD_AUDIO_STATE 0x00EB /* Handshke rqd. */ 2258c2ecf20Sopenharmony_ci#define DSP_VC_WRITE_CONTROL_REG 0x00EB /* Handshke rqd. */ 2268c2ecf20Sopenharmony_ci#define DSP_VC_MIDI_WRITE 0x00E7 /* Handshke rqd. */ 2278c2ecf20Sopenharmony_ci#define DSP_VC_STOP_TRANSFER 0x00DF /* Handshke rqd. */ 2288c2ecf20Sopenharmony_ci#define DSP_VC_UPDATE_FLAGS 0x00FB /* Handshke rqd. */ 2298c2ecf20Sopenharmony_ci#define DSP_VC_GO_COMATOSE 0x00d9 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci#endif /* !DSP_56361 */ 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci/* 2358c2ecf20Sopenharmony_ci * 2368c2ecf20Sopenharmony_ci * Timeouts 2378c2ecf20Sopenharmony_ci * 2388c2ecf20Sopenharmony_ci */ 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci#define HANDSHAKE_TIMEOUT 20000 /* send_vector command timeout (20ms) */ 2418c2ecf20Sopenharmony_ci#define VECTOR_BUSY_TIMEOUT 100000 /* 100ms */ 2428c2ecf20Sopenharmony_ci#define MIDI_OUT_DELAY_USEC 2000 /* How long to wait after MIDI fills up */ 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci/* 2468c2ecf20Sopenharmony_ci * 2478c2ecf20Sopenharmony_ci * Flags for .Flags field in the comm page 2488c2ecf20Sopenharmony_ci * 2498c2ecf20Sopenharmony_ci */ 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci#define DSP_FLAG_MIDI_INPUT 0x0001 /* Enable MIDI input */ 2528c2ecf20Sopenharmony_ci#define DSP_FLAG_SPDIF_NONAUDIO 0x0002 /* Sets the "non-audio" bit 2538c2ecf20Sopenharmony_ci * in the S/PDIF out status 2548c2ecf20Sopenharmony_ci * bits. Clear this flag for 2558c2ecf20Sopenharmony_ci * audio data; 2568c2ecf20Sopenharmony_ci * set it for AC3 or WMA or 2578c2ecf20Sopenharmony_ci * some such */ 2588c2ecf20Sopenharmony_ci#define DSP_FLAG_PROFESSIONAL_SPDIF 0x0008 /* 1 Professional, 0 Consumer */ 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci/* 2628c2ecf20Sopenharmony_ci * 2638c2ecf20Sopenharmony_ci * Clock detect bits reported by the DSP for Gina20, Layla20, Darla24, and Mia 2648c2ecf20Sopenharmony_ci * 2658c2ecf20Sopenharmony_ci */ 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci#define GLDM_CLOCK_DETECT_BIT_WORD 0x0002 2688c2ecf20Sopenharmony_ci#define GLDM_CLOCK_DETECT_BIT_SUPER 0x0004 2698c2ecf20Sopenharmony_ci#define GLDM_CLOCK_DETECT_BIT_SPDIF 0x0008 2708c2ecf20Sopenharmony_ci#define GLDM_CLOCK_DETECT_BIT_ESYNC 0x0010 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci/* 2748c2ecf20Sopenharmony_ci * 2758c2ecf20Sopenharmony_ci * Clock detect bits reported by the DSP for Gina24, Mona, and Layla24 2768c2ecf20Sopenharmony_ci * 2778c2ecf20Sopenharmony_ci */ 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_WORD96 0x0002 2808c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_WORD48 0x0004 2818c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_SPDIF48 0x0008 2828c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_SPDIF96 0x0010 2838c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_WORD (GML_CLOCK_DETECT_BIT_WORD96 | GML_CLOCK_DETECT_BIT_WORD48) 2848c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_SPDIF (GML_CLOCK_DETECT_BIT_SPDIF48 | GML_CLOCK_DETECT_BIT_SPDIF96) 2858c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_ESYNC 0x0020 2868c2ecf20Sopenharmony_ci#define GML_CLOCK_DETECT_BIT_ADAT 0x0040 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/* 2908c2ecf20Sopenharmony_ci * 2918c2ecf20Sopenharmony_ci * Layla clock numbers to send to DSP 2928c2ecf20Sopenharmony_ci * 2938c2ecf20Sopenharmony_ci */ 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci#define LAYLA20_CLOCK_INTERNAL 0 2968c2ecf20Sopenharmony_ci#define LAYLA20_CLOCK_SPDIF 1 2978c2ecf20Sopenharmony_ci#define LAYLA20_CLOCK_WORD 2 2988c2ecf20Sopenharmony_ci#define LAYLA20_CLOCK_SUPER 3 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci/* 3028c2ecf20Sopenharmony_ci * 3038c2ecf20Sopenharmony_ci * Gina/Darla clock states 3048c2ecf20Sopenharmony_ci * 3058c2ecf20Sopenharmony_ci */ 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci#define GD_CLOCK_NOCHANGE 0 3088c2ecf20Sopenharmony_ci#define GD_CLOCK_44 1 3098c2ecf20Sopenharmony_ci#define GD_CLOCK_48 2 3108c2ecf20Sopenharmony_ci#define GD_CLOCK_SPDIFIN 3 3118c2ecf20Sopenharmony_ci#define GD_CLOCK_UNDEF 0xff 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci/* 3158c2ecf20Sopenharmony_ci * 3168c2ecf20Sopenharmony_ci * Gina/Darla S/PDIF status bits 3178c2ecf20Sopenharmony_ci * 3188c2ecf20Sopenharmony_ci */ 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci#define GD_SPDIF_STATUS_NOCHANGE 0 3218c2ecf20Sopenharmony_ci#define GD_SPDIF_STATUS_44 1 3228c2ecf20Sopenharmony_ci#define GD_SPDIF_STATUS_48 2 3238c2ecf20Sopenharmony_ci#define GD_SPDIF_STATUS_UNDEF 0xff 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci/* 3278c2ecf20Sopenharmony_ci * 3288c2ecf20Sopenharmony_ci * Layla20 output clocks 3298c2ecf20Sopenharmony_ci * 3308c2ecf20Sopenharmony_ci */ 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci#define LAYLA20_OUTPUT_CLOCK_SUPER 0 3338c2ecf20Sopenharmony_ci#define LAYLA20_OUTPUT_CLOCK_WORD 1 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci/**************************************************************************** 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci Magic constants for the Darla24 hardware 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci ****************************************************************************/ 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci#define GD24_96000 0x0 3438c2ecf20Sopenharmony_ci#define GD24_48000 0x1 3448c2ecf20Sopenharmony_ci#define GD24_44100 0x2 3458c2ecf20Sopenharmony_ci#define GD24_32000 0x3 3468c2ecf20Sopenharmony_ci#define GD24_22050 0x4 3478c2ecf20Sopenharmony_ci#define GD24_16000 0x5 3488c2ecf20Sopenharmony_ci#define GD24_11025 0x6 3498c2ecf20Sopenharmony_ci#define GD24_8000 0x7 3508c2ecf20Sopenharmony_ci#define GD24_88200 0x8 3518c2ecf20Sopenharmony_ci#define GD24_EXT_SYNC 0x9 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/* 3558c2ecf20Sopenharmony_ci * 3568c2ecf20Sopenharmony_ci * Return values from the DSP when ASIC is loaded 3578c2ecf20Sopenharmony_ci * 3588c2ecf20Sopenharmony_ci */ 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci#define ASIC_ALREADY_LOADED 0x1 3618c2ecf20Sopenharmony_ci#define ASIC_NOT_LOADED 0x0 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci/* 3658c2ecf20Sopenharmony_ci * 3668c2ecf20Sopenharmony_ci * DSP Audio formats 3678c2ecf20Sopenharmony_ci * 3688c2ecf20Sopenharmony_ci * These are the audio formats that the DSP can transfer 3698c2ecf20Sopenharmony_ci * via input and output pipes. LE means little-endian, 3708c2ecf20Sopenharmony_ci * BE means big-endian. 3718c2ecf20Sopenharmony_ci * 3728c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_MS_8 3738c2ecf20Sopenharmony_ci * 3748c2ecf20Sopenharmony_ci * 8-bit mono unsigned samples. For playback, 3758c2ecf20Sopenharmony_ci * mono data is duplicated out the left and right channels 3768c2ecf20Sopenharmony_ci * of the output bus. The "MS" part of the name 3778c2ecf20Sopenharmony_ci * means mono->stereo. 3788c2ecf20Sopenharmony_ci * 3798c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_MS_16LE 3808c2ecf20Sopenharmony_ci * 3818c2ecf20Sopenharmony_ci * 16-bit signed little-endian mono samples. Playback works 3828c2ecf20Sopenharmony_ci * like the previous code. 3838c2ecf20Sopenharmony_ci * 3848c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_MS_24LE 3858c2ecf20Sopenharmony_ci * 3868c2ecf20Sopenharmony_ci * 24-bit signed little-endian mono samples. Data is packed 3878c2ecf20Sopenharmony_ci * three bytes per sample; if you had two samples 0x112233 and 0x445566 3888c2ecf20Sopenharmony_ci * they would be stored in memory like this: 33 22 11 66 55 44. 3898c2ecf20Sopenharmony_ci * 3908c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_MS_32LE 3918c2ecf20Sopenharmony_ci * 3928c2ecf20Sopenharmony_ci * 24-bit signed little-endian mono samples in a 32-bit 3938c2ecf20Sopenharmony_ci * container. In other words, each sample is a 32-bit signed 3948c2ecf20Sopenharmony_ci * integer, where the actual audio data is left-justified 3958c2ecf20Sopenharmony_ci * in the 32 bits and only the 24 most significant bits are valid. 3968c2ecf20Sopenharmony_ci * 3978c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_SS_8 3988c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_SS_16LE 3998c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_SS_24LE 4008c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_SS_32LE 4018c2ecf20Sopenharmony_ci * 4028c2ecf20Sopenharmony_ci * Like the previous ones, except now with stereo interleaved 4038c2ecf20Sopenharmony_ci * data. "SS" means stereo->stereo. 4048c2ecf20Sopenharmony_ci * 4058c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_MM_32LE 4068c2ecf20Sopenharmony_ci * 4078c2ecf20Sopenharmony_ci * Similar to DSP_AUDIOFORM_MS_32LE, except that the mono 4088c2ecf20Sopenharmony_ci * data is not duplicated out both the left and right outputs. 4098c2ecf20Sopenharmony_ci * This mode is used by the ASIO driver. Here, "MM" means 4108c2ecf20Sopenharmony_ci * mono->mono. 4118c2ecf20Sopenharmony_ci * 4128c2ecf20Sopenharmony_ci * DSP_AUDIOFORM_MM_32BE 4138c2ecf20Sopenharmony_ci * 4148c2ecf20Sopenharmony_ci * Just like DSP_AUDIOFORM_MM_32LE, but now the data is 4158c2ecf20Sopenharmony_ci * in big-endian format. 4168c2ecf20Sopenharmony_ci * 4178c2ecf20Sopenharmony_ci */ 4188c2ecf20Sopenharmony_ci 4198c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_MS_8 0 /* 8 bit mono */ 4208c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_MS_16LE 1 /* 16 bit mono */ 4218c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_MS_24LE 2 /* 24 bit mono */ 4228c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_MS_32LE 3 /* 32 bit mono */ 4238c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SS_8 4 /* 8 bit stereo */ 4248c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SS_16LE 5 /* 16 bit stereo */ 4258c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SS_24LE 6 /* 24 bit stereo */ 4268c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SS_32LE 7 /* 32 bit stereo */ 4278c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_MM_32LE 8 /* 32 bit mono->mono little-endian */ 4288c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_MM_32BE 9 /* 32 bit mono->mono big-endian */ 4298c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SS_32BE 10 /* 32 bit stereo big endian */ 4308c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_INVALID 0xFF /* Invalid audio format */ 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci/* 4348c2ecf20Sopenharmony_ci * 4358c2ecf20Sopenharmony_ci * Super-interleave is defined as interleaving by 4 or more. Darla20 and Gina20 4368c2ecf20Sopenharmony_ci * do not support super interleave. 4378c2ecf20Sopenharmony_ci * 4388c2ecf20Sopenharmony_ci * 16 bit, 24 bit, and 32 bit little endian samples are supported for super 4398c2ecf20Sopenharmony_ci * interleave. The interleave factor must be even. 16 - way interleave is the 4408c2ecf20Sopenharmony_ci * current maximum, so you can interleave by 4, 6, 8, 10, 12, 14, and 16. 4418c2ecf20Sopenharmony_ci * 4428c2ecf20Sopenharmony_ci * The actual format code is derived by taking the define below and or-ing with 4438c2ecf20Sopenharmony_ci * the interleave factor. So, 32 bit interleave by 6 is 0x86 and 4448c2ecf20Sopenharmony_ci * 16 bit interleave by 16 is (0x40 | 0x10) = 0x50. 4458c2ecf20Sopenharmony_ci * 4468c2ecf20Sopenharmony_ci */ 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SUPER_INTERLEAVE_16LE 0x40 4498c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SUPER_INTERLEAVE_24LE 0xc0 4508c2ecf20Sopenharmony_ci#define DSP_AUDIOFORM_SUPER_INTERLEAVE_32LE 0x80 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci/* 4548c2ecf20Sopenharmony_ci * 4558c2ecf20Sopenharmony_ci * Gina24, Mona, and Layla24 control register defines 4568c2ecf20Sopenharmony_ci * 4578c2ecf20Sopenharmony_ci */ 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_ci#define GML_CONVERTER_ENABLE 0x0010 4608c2ecf20Sopenharmony_ci#define GML_SPDIF_PRO_MODE 0x0020 /* Professional S/PDIF == 1, 4618c2ecf20Sopenharmony_ci consumer == 0 */ 4628c2ecf20Sopenharmony_ci#define GML_SPDIF_SAMPLE_RATE0 0x0040 4638c2ecf20Sopenharmony_ci#define GML_SPDIF_SAMPLE_RATE1 0x0080 4648c2ecf20Sopenharmony_ci#define GML_SPDIF_TWO_CHANNEL 0x0100 /* 1 == two channels, 4658c2ecf20Sopenharmony_ci 0 == one channel */ 4668c2ecf20Sopenharmony_ci#define GML_SPDIF_NOT_AUDIO 0x0200 4678c2ecf20Sopenharmony_ci#define GML_SPDIF_COPY_PERMIT 0x0400 4688c2ecf20Sopenharmony_ci#define GML_SPDIF_24_BIT 0x0800 /* 1 == 24 bit, 0 == 20 bit */ 4698c2ecf20Sopenharmony_ci#define GML_ADAT_MODE 0x1000 /* 1 == ADAT mode, 0 == S/PDIF mode */ 4708c2ecf20Sopenharmony_ci#define GML_SPDIF_OPTICAL_MODE 0x2000 /* 1 == optical mode, 0 == RCA mode */ 4718c2ecf20Sopenharmony_ci#define GML_SPDIF_CDROM_MODE 0x3000 /* 1 == CDROM mode, 4728c2ecf20Sopenharmony_ci * 0 == RCA or optical mode */ 4738c2ecf20Sopenharmony_ci#define GML_DOUBLE_SPEED_MODE 0x4000 /* 1 == double speed, 4748c2ecf20Sopenharmony_ci 0 == single speed */ 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci#define GML_DIGITAL_IN_AUTO_MUTE 0x800000 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci#define GML_96KHZ (0x0 | GML_DOUBLE_SPEED_MODE) 4798c2ecf20Sopenharmony_ci#define GML_88KHZ (0x1 | GML_DOUBLE_SPEED_MODE) 4808c2ecf20Sopenharmony_ci#define GML_48KHZ 0x2 4818c2ecf20Sopenharmony_ci#define GML_44KHZ 0x3 4828c2ecf20Sopenharmony_ci#define GML_32KHZ 0x4 4838c2ecf20Sopenharmony_ci#define GML_22KHZ 0x5 4848c2ecf20Sopenharmony_ci#define GML_16KHZ 0x6 4858c2ecf20Sopenharmony_ci#define GML_11KHZ 0x7 4868c2ecf20Sopenharmony_ci#define GML_8KHZ 0x8 4878c2ecf20Sopenharmony_ci#define GML_SPDIF_CLOCK 0x9 4888c2ecf20Sopenharmony_ci#define GML_ADAT_CLOCK 0xA 4898c2ecf20Sopenharmony_ci#define GML_WORD_CLOCK 0xB 4908c2ecf20Sopenharmony_ci#define GML_ESYNC_CLOCK 0xC 4918c2ecf20Sopenharmony_ci#define GML_ESYNCx2_CLOCK 0xD 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_ci#define GML_CLOCK_CLEAR_MASK 0xffffbff0 4948c2ecf20Sopenharmony_ci#define GML_SPDIF_RATE_CLEAR_MASK (~(GML_SPDIF_SAMPLE_RATE0|GML_SPDIF_SAMPLE_RATE1)) 4958c2ecf20Sopenharmony_ci#define GML_DIGITAL_MODE_CLEAR_MASK 0xffffcfff 4968c2ecf20Sopenharmony_ci#define GML_SPDIF_FORMAT_CLEAR_MASK 0xfffff01f 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci/* 5008c2ecf20Sopenharmony_ci * 5018c2ecf20Sopenharmony_ci * Mia sample rate and clock setting constants 5028c2ecf20Sopenharmony_ci * 5038c2ecf20Sopenharmony_ci */ 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci#define MIA_32000 0x0040 5068c2ecf20Sopenharmony_ci#define MIA_44100 0x0042 5078c2ecf20Sopenharmony_ci#define MIA_48000 0x0041 5088c2ecf20Sopenharmony_ci#define MIA_88200 0x0142 5098c2ecf20Sopenharmony_ci#define MIA_96000 0x0141 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_ci#define MIA_SPDIF 0x00000044 5128c2ecf20Sopenharmony_ci#define MIA_SPDIF96 0x00000144 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci#define MIA_MIDI_REV 1 /* Must be Mia rev 1 for MIDI support */ 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_ci 5178c2ecf20Sopenharmony_ci/* 5188c2ecf20Sopenharmony_ci * 5198c2ecf20Sopenharmony_ci * 3G register bits 5208c2ecf20Sopenharmony_ci * 5218c2ecf20Sopenharmony_ci */ 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci#define E3G_CONVERTER_ENABLE 0x0010 5248c2ecf20Sopenharmony_ci#define E3G_SPDIF_PRO_MODE 0x0020 /* Professional S/PDIF == 1, 5258c2ecf20Sopenharmony_ci consumer == 0 */ 5268c2ecf20Sopenharmony_ci#define E3G_SPDIF_SAMPLE_RATE0 0x0040 5278c2ecf20Sopenharmony_ci#define E3G_SPDIF_SAMPLE_RATE1 0x0080 5288c2ecf20Sopenharmony_ci#define E3G_SPDIF_TWO_CHANNEL 0x0100 /* 1 == two channels, 5298c2ecf20Sopenharmony_ci 0 == one channel */ 5308c2ecf20Sopenharmony_ci#define E3G_SPDIF_NOT_AUDIO 0x0200 5318c2ecf20Sopenharmony_ci#define E3G_SPDIF_COPY_PERMIT 0x0400 5328c2ecf20Sopenharmony_ci#define E3G_SPDIF_24_BIT 0x0800 /* 1 == 24 bit, 0 == 20 bit */ 5338c2ecf20Sopenharmony_ci#define E3G_DOUBLE_SPEED_MODE 0x4000 /* 1 == double speed, 5348c2ecf20Sopenharmony_ci 0 == single speed */ 5358c2ecf20Sopenharmony_ci#define E3G_PHANTOM_POWER 0x8000 /* 1 == phantom power on, 5368c2ecf20Sopenharmony_ci 0 == phantom power off */ 5378c2ecf20Sopenharmony_ci 5388c2ecf20Sopenharmony_ci#define E3G_96KHZ (0x0 | E3G_DOUBLE_SPEED_MODE) 5398c2ecf20Sopenharmony_ci#define E3G_88KHZ (0x1 | E3G_DOUBLE_SPEED_MODE) 5408c2ecf20Sopenharmony_ci#define E3G_48KHZ 0x2 5418c2ecf20Sopenharmony_ci#define E3G_44KHZ 0x3 5428c2ecf20Sopenharmony_ci#define E3G_32KHZ 0x4 5438c2ecf20Sopenharmony_ci#define E3G_22KHZ 0x5 5448c2ecf20Sopenharmony_ci#define E3G_16KHZ 0x6 5458c2ecf20Sopenharmony_ci#define E3G_11KHZ 0x7 5468c2ecf20Sopenharmony_ci#define E3G_8KHZ 0x8 5478c2ecf20Sopenharmony_ci#define E3G_SPDIF_CLOCK 0x9 5488c2ecf20Sopenharmony_ci#define E3G_ADAT_CLOCK 0xA 5498c2ecf20Sopenharmony_ci#define E3G_WORD_CLOCK 0xB 5508c2ecf20Sopenharmony_ci#define E3G_CONTINUOUS_CLOCK 0xE 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_ci#define E3G_ADAT_MODE 0x1000 5538c2ecf20Sopenharmony_ci#define E3G_SPDIF_OPTICAL_MODE 0x2000 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci#define E3G_CLOCK_CLEAR_MASK 0xbfffbff0 5568c2ecf20Sopenharmony_ci#define E3G_DIGITAL_MODE_CLEAR_MASK 0xffffcfff 5578c2ecf20Sopenharmony_ci#define E3G_SPDIF_FORMAT_CLEAR_MASK 0xfffff01f 5588c2ecf20Sopenharmony_ci 5598c2ecf20Sopenharmony_ci/* Clock detect bits reported by the DSP */ 5608c2ecf20Sopenharmony_ci#define E3G_CLOCK_DETECT_BIT_WORD96 0x0001 5618c2ecf20Sopenharmony_ci#define E3G_CLOCK_DETECT_BIT_WORD48 0x0002 5628c2ecf20Sopenharmony_ci#define E3G_CLOCK_DETECT_BIT_SPDIF48 0x0004 5638c2ecf20Sopenharmony_ci#define E3G_CLOCK_DETECT_BIT_ADAT 0x0004 5648c2ecf20Sopenharmony_ci#define E3G_CLOCK_DETECT_BIT_SPDIF96 0x0008 5658c2ecf20Sopenharmony_ci#define E3G_CLOCK_DETECT_BIT_WORD (E3G_CLOCK_DETECT_BIT_WORD96|E3G_CLOCK_DETECT_BIT_WORD48) 5668c2ecf20Sopenharmony_ci#define E3G_CLOCK_DETECT_BIT_SPDIF (E3G_CLOCK_DETECT_BIT_SPDIF48|E3G_CLOCK_DETECT_BIT_SPDIF96) 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci/* Frequency control register */ 5698c2ecf20Sopenharmony_ci#define E3G_MAGIC_NUMBER 677376000 5708c2ecf20Sopenharmony_ci#define E3G_FREQ_REG_DEFAULT (E3G_MAGIC_NUMBER / 48000 - 2) 5718c2ecf20Sopenharmony_ci#define E3G_FREQ_REG_MAX 0xffff 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_ci/* 3G external box types */ 5748c2ecf20Sopenharmony_ci#define E3G_GINA3G_BOX_TYPE 0x00 5758c2ecf20Sopenharmony_ci#define E3G_LAYLA3G_BOX_TYPE 0x10 5768c2ecf20Sopenharmony_ci#define E3G_ASIC_NOT_LOADED 0xffff 5778c2ecf20Sopenharmony_ci#define E3G_BOX_TYPE_MASK 0xf0 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_ci/* Indigo express control register values */ 5808c2ecf20Sopenharmony_ci#define INDIGO_EXPRESS_32000 0x02 5818c2ecf20Sopenharmony_ci#define INDIGO_EXPRESS_44100 0x01 5828c2ecf20Sopenharmony_ci#define INDIGO_EXPRESS_48000 0x00 5838c2ecf20Sopenharmony_ci#define INDIGO_EXPRESS_DOUBLE_SPEED 0x10 5848c2ecf20Sopenharmony_ci#define INDIGO_EXPRESS_QUAD_SPEED 0x04 5858c2ecf20Sopenharmony_ci#define INDIGO_EXPRESS_CLOCK_MASK 0x17 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_ci 5888c2ecf20Sopenharmony_ci/* 5898c2ecf20Sopenharmony_ci * 5908c2ecf20Sopenharmony_ci * Gina20 & Layla20 have input gain controls for the analog inputs; 5918c2ecf20Sopenharmony_ci * this is the magic number for the hardware that gives you 0 dB at -10. 5928c2ecf20Sopenharmony_ci * 5938c2ecf20Sopenharmony_ci */ 5948c2ecf20Sopenharmony_ci 5958c2ecf20Sopenharmony_ci#define GL20_INPUT_GAIN_MAGIC_NUMBER 0xC8 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_ci/* 5998c2ecf20Sopenharmony_ci * 6008c2ecf20Sopenharmony_ci * Defines how much time must pass between DSP load attempts 6018c2ecf20Sopenharmony_ci * 6028c2ecf20Sopenharmony_ci */ 6038c2ecf20Sopenharmony_ci 6048c2ecf20Sopenharmony_ci#define DSP_LOAD_ATTEMPT_PERIOD 1000000L /* One second */ 6058c2ecf20Sopenharmony_ci 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_ci/* 6088c2ecf20Sopenharmony_ci * 6098c2ecf20Sopenharmony_ci * Size of arrays for the comm page. MAX_PLAY_TAPS and MAX_REC_TAPS are 6108c2ecf20Sopenharmony_ci * no longer used, but the sizes must still be right for the DSP to see 6118c2ecf20Sopenharmony_ci * the comm page correctly. 6128c2ecf20Sopenharmony_ci * 6138c2ecf20Sopenharmony_ci */ 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci#define MONITOR_ARRAY_SIZE 0x180 6168c2ecf20Sopenharmony_ci#define VMIXER_ARRAY_SIZE 0x40 6178c2ecf20Sopenharmony_ci#define MIDI_OUT_BUFFER_SIZE 32 6188c2ecf20Sopenharmony_ci#define MIDI_IN_BUFFER_SIZE 256 6198c2ecf20Sopenharmony_ci#define MAX_PLAY_TAPS 168 6208c2ecf20Sopenharmony_ci#define MAX_REC_TAPS 192 6218c2ecf20Sopenharmony_ci#define DSP_MIDI_OUT_FIFO_SIZE 64 6228c2ecf20Sopenharmony_ci 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci/* sg_entry is a single entry for the scatter-gather list. The array of struct 6258c2ecf20Sopenharmony_cisg_entry struct is read by the DSP, so all values must be little-endian. */ 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci#define MAX_SGLIST_ENTRIES 512 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_cistruct sg_entry { 6308c2ecf20Sopenharmony_ci __le32 addr; 6318c2ecf20Sopenharmony_ci __le32 size; 6328c2ecf20Sopenharmony_ci}; 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_ci/**************************************************************************** 6368c2ecf20Sopenharmony_ci 6378c2ecf20Sopenharmony_ci The comm page. This structure is read and written by the DSP; the 6388c2ecf20Sopenharmony_ci DSP code is a firm believer in the byte offsets written in the comments 6398c2ecf20Sopenharmony_ci at the end of each line. This structure should not be changed. 6408c2ecf20Sopenharmony_ci 6418c2ecf20Sopenharmony_ci Any reads from or writes to this structure should be in little-endian format. 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci ****************************************************************************/ 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_cistruct comm_page { /* Base Length*/ 6468c2ecf20Sopenharmony_ci __le32 comm_size; /* size of this object 0x000 4 */ 6478c2ecf20Sopenharmony_ci __le32 flags; /* See Appendix A below 0x004 4 */ 6488c2ecf20Sopenharmony_ci __le32 unused; /* Unused entry 0x008 4 */ 6498c2ecf20Sopenharmony_ci __le32 sample_rate; /* Card sample rate in Hz 0x00c 4 */ 6508c2ecf20Sopenharmony_ci __le32 handshake; /* DSP command handshake 0x010 4 */ 6518c2ecf20Sopenharmony_ci __le32 cmd_start; /* Chs. to start mask 0x014 4 */ 6528c2ecf20Sopenharmony_ci __le32 cmd_stop; /* Chs. to stop mask 0x018 4 */ 6538c2ecf20Sopenharmony_ci __le32 cmd_reset; /* Chs. to reset mask 0x01c 4 */ 6548c2ecf20Sopenharmony_ci __le16 audio_format[DSP_MAXPIPES]; /* Chs. audio format 0x020 32*2 */ 6558c2ecf20Sopenharmony_ci struct sg_entry sglist_addr[DSP_MAXPIPES]; 6568c2ecf20Sopenharmony_ci /* Chs. Physical sglist addrs 0x060 32*8 */ 6578c2ecf20Sopenharmony_ci __le32 position[DSP_MAXPIPES]; 6588c2ecf20Sopenharmony_ci /* Positions for ea. ch. 0x160 32*4 */ 6598c2ecf20Sopenharmony_ci s8 vu_meter[DSP_MAXPIPES]; 6608c2ecf20Sopenharmony_ci /* VU meters 0x1e0 32*1 */ 6618c2ecf20Sopenharmony_ci s8 peak_meter[DSP_MAXPIPES]; 6628c2ecf20Sopenharmony_ci /* Peak meters 0x200 32*1 */ 6638c2ecf20Sopenharmony_ci s8 line_out_level[DSP_MAXAUDIOOUTPUTS]; 6648c2ecf20Sopenharmony_ci /* Output gain 0x220 16*1 */ 6658c2ecf20Sopenharmony_ci s8 line_in_level[DSP_MAXAUDIOINPUTS]; 6668c2ecf20Sopenharmony_ci /* Input gain 0x230 16*1 */ 6678c2ecf20Sopenharmony_ci s8 monitors[MONITOR_ARRAY_SIZE]; 6688c2ecf20Sopenharmony_ci /* Monitor map 0x240 0x180 */ 6698c2ecf20Sopenharmony_ci __le32 play_coeff[MAX_PLAY_TAPS]; 6708c2ecf20Sopenharmony_ci /* Gina/Darla play filters - obsolete 0x3c0 168*4 */ 6718c2ecf20Sopenharmony_ci __le32 rec_coeff[MAX_REC_TAPS]; 6728c2ecf20Sopenharmony_ci /* Gina/Darla record filters - obsolete 0x660 192*4 */ 6738c2ecf20Sopenharmony_ci __le16 midi_input[MIDI_IN_BUFFER_SIZE]; 6748c2ecf20Sopenharmony_ci /* MIDI input data transfer buffer 0x960 256*2 */ 6758c2ecf20Sopenharmony_ci u8 gd_clock_state; /* Chg Gina/Darla clock state 0xb60 1 */ 6768c2ecf20Sopenharmony_ci u8 gd_spdif_status; /* Chg. Gina/Darla S/PDIF state 0xb61 1 */ 6778c2ecf20Sopenharmony_ci u8 gd_resampler_state; /* Should always be 3 0xb62 1 */ 6788c2ecf20Sopenharmony_ci u8 filler2; /* 0xb63 1 */ 6798c2ecf20Sopenharmony_ci __le32 nominal_level_mask; /* -10 level enable mask 0xb64 4 */ 6808c2ecf20Sopenharmony_ci __le16 input_clock; /* Chg. Input clock state 0xb68 2 */ 6818c2ecf20Sopenharmony_ci __le16 output_clock; /* Chg. Output clock state 0xb6a 2 */ 6828c2ecf20Sopenharmony_ci __le32 status_clocks; /* Current Input clock state 0xb6c 4 */ 6838c2ecf20Sopenharmony_ci __le32 ext_box_status; /* External box status 0xb70 4 */ 6848c2ecf20Sopenharmony_ci __le32 cmd_add_buffer; /* Pipes to add (obsolete) 0xb74 4 */ 6858c2ecf20Sopenharmony_ci __le32 midi_out_free_count; 6868c2ecf20Sopenharmony_ci /* # of bytes free in MIDI output FIFO 0xb78 4 */ 6878c2ecf20Sopenharmony_ci __le32 unused2; /* Cyclic pipes 0xb7c 4 */ 6888c2ecf20Sopenharmony_ci __le32 control_register; 6898c2ecf20Sopenharmony_ci /* Mona, Gina24, Layla24, 3G ctrl reg 0xb80 4 */ 6908c2ecf20Sopenharmony_ci __le32 e3g_frq_register; /* 3G frequency register 0xb84 4 */ 6918c2ecf20Sopenharmony_ci u8 filler[24]; /* filler 0xb88 24*1 */ 6928c2ecf20Sopenharmony_ci s8 vmixer[VMIXER_ARRAY_SIZE]; 6938c2ecf20Sopenharmony_ci /* Vmixer levels 0xba0 64*1 */ 6948c2ecf20Sopenharmony_ci u8 midi_output[MIDI_OUT_BUFFER_SIZE]; 6958c2ecf20Sopenharmony_ci /* MIDI output data 0xbe0 32*1 */ 6968c2ecf20Sopenharmony_ci}; 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_ci#endif /* _ECHO_DSP_ */ 699