Home | History | Annotate | Line # | Download | only in dev
uda1341.h revision 1.1
      1  1.1  ichiro /*	$NetBSD: uda1341.h,v 1.1 2001/07/15 08:34:36 ichiro Exp $	*/
      2  1.1  ichiro 
      3  1.1  ichiro /*-
      4  1.1  ichiro  * Copyright (c) 2001 The NetBSD Foundation, Inc.  All rights reserved.
      5  1.1  ichiro  *
      6  1.1  ichiro  * This code is derived from software contributed to The NetBSD Foundation
      7  1.1  ichiro  * by Ichiro FUKUHARA (ichiro (at) ichiro.org).
      8  1.1  ichiro  *
      9  1.1  ichiro  * Redistribution and use in source and binary forms, with or without
     10  1.1  ichiro  * modification, are permitted provided that the following conditions
     11  1.1  ichiro  * are met:
     12  1.1  ichiro  * 1. Redistributions of source code must retain the above copyright
     13  1.1  ichiro  *    notice, this list of conditions and the following disclaimer.
     14  1.1  ichiro  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  ichiro  *    notice, this list of conditions and the following disclaimer in the
     16  1.1  ichiro  *    documentation and/or other materials provided with the distribution.
     17  1.1  ichiro  * 3. All advertising materials mentioning features or use of this software
     18  1.1  ichiro  *    must display the following acknowledgement:
     19  1.1  ichiro  *	This product includes software developed by the NetBSD
     20  1.1  ichiro  *	Foundation, Inc. and its contributors.
     21  1.1  ichiro  * 4. Neither the name of The NetBSD Foundation nor the names of its
     22  1.1  ichiro  *    contributors may be used to endorse or promote products derived
     23  1.1  ichiro  *    from this software without specific prior written permission.
     24  1.1  ichiro  *
     25  1.1  ichiro  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     26  1.1  ichiro  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.1  ichiro  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.1  ichiro  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     29  1.1  ichiro  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.1  ichiro  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.1  ichiro  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.1  ichiro  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.1  ichiro  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.1  ichiro  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.1  ichiro  * POSSIBILITY OF SUCH DAMAGE.
     36  1.1  ichiro  */
     37  1.1  ichiro 
     38  1.1  ichiro /*
     39  1.1  ichiro  * Philips UDA1341 L3 type
     40  1.1  ichiro  */
     41  1.1  ichiro 
     42  1.1  ichiro /*
     43  1.1  ichiro  * Microcontroller L3-interface timing (MIN)
     44  1.1  ichiro  * expressed in micro-second
     45  1.1  ichiro  */
     46  1.1  ichiro #define L3_DATA_SETUP	1	/* 190 nsec */
     47  1.1  ichiro #define L3_DATA_HOLD	1	/*  30 nsec */
     48  1.1  ichiro #define L3_MODE_SETUP	1	/* 190 nsec */
     49  1.1  ichiro #define L3_MODE_HOLD	1	/* 190 nsec */
     50  1.1  ichiro #define L3_CLK_HIGH	1	/* 250 nsec */
     51  1.1  ichiro #define L3_CLK_LOW	1	/* 250 nsec */
     52  1.1  ichiro #define L3_HALT		1	/* 190 nsec */
     53  1.1  ichiro 
     54  1.1  ichiro /*
     55  1.1  ichiro  * Philips UDA1341 L3 address and command types
     56  1.1  ichiro  */
     57  1.1  ichiro #define L3_ADDRESS_COM		5
     58  1.1  ichiro #define L3_ADDRESS_DATA0	0
     59  1.1  ichiro #define L3_ADDRESS_DATA1	1
     60  1.1  ichiro #define L3_ADDRESS_STATUS	2
     61  1.1  ichiro 
     62  1.1  ichiro /*
     63  1.1  ichiro  * Philips UDA1341 Status control
     64  1.1  ichiro  */
     65  1.1  ichiro #define STATUS0_RST		(1<<0)	/* UDA1341 Reset */
     66  1.1  ichiro #define STATUS0_SC_512		(0<<4)	/* System clock freq.
     67  1.1  ichiro 					   512fs */
     68  1.1  ichiro #define STATUS0_SC_384		(1<<4)	/* 384fs */
     69  1.1  ichiro #define STATUS0_SC_256		(2<<4)	/* 256fs */
     70  1.1  ichiro #define STATUS0_IF_I2S		(0<<1)	/* Data Input format
     71  1.1  ichiro 					   I2C */
     72  1.1  ichiro #define STATUS0_IF_LSB16	(1<<1)	/* LSB 16 bits */
     73  1.1  ichiro #define STATUS0_IF_LSB18	(2<<1)	/* LSB 18 bits */
     74  1.1  ichiro #define STATUS0_IF_LSB20	(3<<1)	/* LSB 20 bits */
     75  1.1  ichiro #define STATUS0_IF_MSB		(4<<1)	/* MSB */
     76  1.1  ichiro #define STATUS0_IF_MSB16	(5<<1)	/* LSB 16 bits and MSB-output */
     77  1.1  ichiro #define STATUS0_IF_MSB18	(6<<1)	/* LSB 18 bits and MSB-output */
     78  1.1  ichiro #define STATUS0_IF_MSB20	(7<<1)	/* LSB 20 bits and MSB-output */
     79  1.1  ichiro #define STATUS0_DC		(1<<0)	/* UDA1341 DC-filter ON */
     80  1.1  ichiro 
     81  1.1  ichiro #define STATUS1_OGS		(1<<6)	/* UDA1341 DAC Gain switch */
     82  1.1  ichiro #define STATUS1_IGS		(1<<5)	/* UDA1341 ADC Gain switch */
     83  1.1  ichiro #define STATUS1_PAD		(1<<4)	/* Polarity of ADC is inverting */
     84  1.1  ichiro #define STATUS1_PDA		(1<<3)	/* Polarity of DAC is inverting */
     85  1.1  ichiro #define STATUS1_DS		(1<<2)	/* double speed playback */
     86  1.1  ichiro #define STATUS1_PC_OFF		(0<<0)	/* ADC:off DAC:off */
     87  1.1  ichiro #define STATUS1_PC_DAC		(1<<0)	/* ADC:off DAC:on */
     88  1.1  ichiro #define STATUS1_PC_ADC		(2<<0)	/* ADC:on  DAC:off */
     89  1.1  ichiro #define STATUS1_PC_ON		(3<<0)	/* ADC:on  DAC:on */
     90  1.1  ichiro 
     91  1.1  ichiro /*
     92  1.1  ichiro  * Philips UDA1341 DATA0 control
     93  1.1  ichiro  */
     94  1.1  ichiro /* Data0 direct programming registers (8 bits) */
     95  1.1  ichiro #define DATA0_VC(val)		(63 - (((val)+1) * 63) / 100)
     96  1.1  ichiro 					/* Volume control val=(0<->100) */
     97  1.1  ichiro #define DATA0_COMMON		(0<<6)	/* DATA0_0 common bits(6-7) */
     98  1.1  ichiro 
     99  1.1  ichiro #define DATA1_BB(val)		(((((val)+1) * 15) / 100) << 3)
    100  1.1  ichiro 					/* Bass Boost control val=(0<->100) */
    101  1.1  ichiro #define DATA1_TR(val)		((((val)+1) * 3) / 100)
    102  1.1  ichiro 					/* Treble control val=(0<->100) */
    103  1.1  ichiro #define DATA1_COMMON		(1<<6)	/* DATA0_1 common bits(6-7) */
    104  1.1  ichiro 
    105  1.1  ichiro #define DATA2_MODE_FLAT		(0<<0)	/* Mode filter is flat */
    106  1.1  ichiro #define DATA2_MODE_MIN		(2<<0)	/* Mode filter is minimum */
    107  1.1  ichiro #define DATA2_MODE_MAX		(3<<0)	/* Mode filter is maximum */
    108  1.1  ichiro #define DATA2_MUTE		(1<<2)	/* Mute on */
    109  1.1  ichiro #define DATA2_COMMON		(2<<6)	/* DATA0_2 common bits(6-7) */
    110  1.1  ichiro 
    111  1.1  ichiro /* Data0 extended programming registers (16 bits) */
    112  1.1  ichiro #define EXT_ADDR_COMMON		(3<<14)	/* Extended Address Common bits */
    113  1.1  ichiro # define EXT_ADDR_E0		(0<<8)	/* Extended Address of E0 */
    114  1.1  ichiro # define EXT_ADDR_E1		(1<<8)	/* Extended Address of E1 */
    115  1.1  ichiro # define EXT_ADDR_E2		(2<<8)	/* Extended Address of E2 */
    116  1.1  ichiro # define EXT_ADDR_E3		(4<<8)	/* Extended Address of E3 */
    117  1.1  ichiro # define EXT_ADDR_E4		(5<<8)	/* Extended Address of E4 */
    118  1.1  ichiro # define EXT_ADDR_E5		(6<<8)	/* Extended Address of E5 */
    119  1.1  ichiro 
    120  1.1  ichiro #define EXT_DATA_COMMN		(7<<13) /* Extended Data Common bits */
    121  1.1  ichiro #define DATA_E0_MA(val)		((((val) + 1) * 31) / 100)
    122  1.1  ichiro 					/* mixer gain control val=(0<->100) */
    123  1.1  ichiro #define DATA_E1_MB(val)		((((val) + 1) * 31) / 100)
    124  1.1  ichiro 					/* mixer gain control val=(0<->100) */
    125  1.1  ichiro #define DATA_E2_MS(val)		(((((val) + 1) * 6) / 100) << 3)
    126  1.1  ichiro 					/* MIC sensitivity control val=(0<->100) */
    127  1.1  ichiro #define DATA_E2_MM0		0	/* Double differential mode */
    128  1.1  ichiro #define DATA_E2_MM1		1	/* input channel 1 select */
    129  1.1  ichiro #define DATA_E2_MM2		2	/* input channel 2 select */
    130  1.1  ichiro #define DATA_E2_MM3		3	/* digital mixer mode */
    131  1.1  ichiro 
    132  1.1  ichiro #define DATA_E3_AG		(1<<4)	/* AGC control ON */
    133  1.1  ichiro #define DATA_E3_IG_L(val)	(((val * 127) / 100) & 3)
    134  1.1  ichiro 					/* Input AMP-Gain control (low 2 bits) */
    135  1.1  ichiro #define DATA_E4_IG_H(val)	(((val * 127) / 100) >> 2)
    136  1.1  ichiro 					/* Input AMP-Gain control (high 5 bits) */
    137  1.1  ichiro #define DATA_E5_AL(val)		(((val + 1) * 3) / 100)
    138  1.1  ichiro 					/* AGC output level val=(0<->100) */
    139  1.1  ichiro /* end of uda1341.h */
    140