Home | History | Annotate | Line # | Download | only in dev
      1  1.3  martin /*	$NetBSD: uda1341.h,v 1.3 2008/04/28 20:23:21 martin 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  *
     18  1.1  ichiro  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19  1.1  ichiro  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20  1.1  ichiro  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21  1.1  ichiro  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22  1.1  ichiro  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23  1.1  ichiro  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24  1.1  ichiro  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25  1.1  ichiro  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26  1.1  ichiro  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27  1.1  ichiro  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28  1.1  ichiro  * POSSIBILITY OF SUCH DAMAGE.
     29  1.1  ichiro  */
     30  1.1  ichiro 
     31  1.1  ichiro /*
     32  1.1  ichiro  * Philips UDA1341 L3 type
     33  1.1  ichiro  */
     34  1.1  ichiro 
     35  1.1  ichiro /*
     36  1.1  ichiro  * Microcontroller L3-interface timing (MIN)
     37  1.1  ichiro  * expressed in micro-second
     38  1.1  ichiro  */
     39  1.1  ichiro #define L3_DATA_SETUP	1	/* 190 nsec */
     40  1.1  ichiro #define L3_DATA_HOLD	1	/*  30 nsec */
     41  1.1  ichiro #define L3_MODE_SETUP	1	/* 190 nsec */
     42  1.1  ichiro #define L3_MODE_HOLD	1	/* 190 nsec */
     43  1.1  ichiro #define L3_CLK_HIGH	1	/* 250 nsec */
     44  1.1  ichiro #define L3_CLK_LOW	1	/* 250 nsec */
     45  1.1  ichiro #define L3_HALT		1	/* 190 nsec */
     46  1.1  ichiro 
     47  1.1  ichiro /*
     48  1.1  ichiro  * Philips UDA1341 L3 address and command types
     49  1.1  ichiro  */
     50  1.1  ichiro #define L3_ADDRESS_COM		5
     51  1.1  ichiro #define L3_ADDRESS_DATA0	0
     52  1.1  ichiro #define L3_ADDRESS_DATA1	1
     53  1.1  ichiro #define L3_ADDRESS_STATUS	2
     54  1.1  ichiro 
     55  1.1  ichiro /*
     56  1.1  ichiro  * Philips UDA1341 Status control
     57  1.1  ichiro  */
     58  1.1  ichiro #define STATUS0_RST		(1<<0)	/* UDA1341 Reset */
     59  1.1  ichiro #define STATUS0_SC_512		(0<<4)	/* System clock freq.
     60  1.1  ichiro 					   512fs */
     61  1.1  ichiro #define STATUS0_SC_384		(1<<4)	/* 384fs */
     62  1.1  ichiro #define STATUS0_SC_256		(2<<4)	/* 256fs */
     63  1.1  ichiro #define STATUS0_IF_I2S		(0<<1)	/* Data Input format
     64  1.1  ichiro 					   I2C */
     65  1.1  ichiro #define STATUS0_IF_LSB16	(1<<1)	/* LSB 16 bits */
     66  1.1  ichiro #define STATUS0_IF_LSB18	(2<<1)	/* LSB 18 bits */
     67  1.1  ichiro #define STATUS0_IF_LSB20	(3<<1)	/* LSB 20 bits */
     68  1.1  ichiro #define STATUS0_IF_MSB		(4<<1)	/* MSB */
     69  1.1  ichiro #define STATUS0_IF_MSB16	(5<<1)	/* LSB 16 bits and MSB-output */
     70  1.1  ichiro #define STATUS0_IF_MSB18	(6<<1)	/* LSB 18 bits and MSB-output */
     71  1.1  ichiro #define STATUS0_IF_MSB20	(7<<1)	/* LSB 20 bits and MSB-output */
     72  1.1  ichiro #define STATUS0_DC		(1<<0)	/* UDA1341 DC-filter ON */
     73  1.1  ichiro 
     74  1.1  ichiro #define STATUS1_OGS		(1<<6)	/* UDA1341 DAC Gain switch */
     75  1.1  ichiro #define STATUS1_IGS		(1<<5)	/* UDA1341 ADC Gain switch */
     76  1.1  ichiro #define STATUS1_PAD		(1<<4)	/* Polarity of ADC is inverting */
     77  1.1  ichiro #define STATUS1_PDA		(1<<3)	/* Polarity of DAC is inverting */
     78  1.1  ichiro #define STATUS1_DS		(1<<2)	/* double speed playback */
     79  1.1  ichiro #define STATUS1_PC_OFF		(0<<0)	/* ADC:off DAC:off */
     80  1.1  ichiro #define STATUS1_PC_DAC		(1<<0)	/* ADC:off DAC:on */
     81  1.1  ichiro #define STATUS1_PC_ADC		(2<<0)	/* ADC:on  DAC:off */
     82  1.1  ichiro #define STATUS1_PC_ON		(3<<0)	/* ADC:on  DAC:on */
     83  1.1  ichiro 
     84  1.1  ichiro /*
     85  1.1  ichiro  * Philips UDA1341 DATA0 control
     86  1.1  ichiro  */
     87  1.1  ichiro /* Data0 direct programming registers (8 bits) */
     88  1.1  ichiro #define DATA0_VC(val)		(63 - (((val)+1) * 63) / 100)
     89  1.1  ichiro 					/* Volume control val=(0<->100) */
     90  1.1  ichiro #define DATA0_COMMON		(0<<6)	/* DATA0_0 common bits(6-7) */
     91  1.1  ichiro 
     92  1.1  ichiro #define DATA1_BB(val)		(((((val)+1) * 15) / 100) << 3)
     93  1.1  ichiro 					/* Bass Boost control val=(0<->100) */
     94  1.1  ichiro #define DATA1_TR(val)		((((val)+1) * 3) / 100)
     95  1.1  ichiro 					/* Treble control val=(0<->100) */
     96  1.1  ichiro #define DATA1_COMMON		(1<<6)	/* DATA0_1 common bits(6-7) */
     97  1.1  ichiro 
     98  1.1  ichiro #define DATA2_MODE_FLAT		(0<<0)	/* Mode filter is flat */
     99  1.1  ichiro #define DATA2_MODE_MIN		(2<<0)	/* Mode filter is minimum */
    100  1.1  ichiro #define DATA2_MODE_MAX		(3<<0)	/* Mode filter is maximum */
    101  1.1  ichiro #define DATA2_MUTE		(1<<2)	/* Mute on */
    102  1.2  ichiro #define DATA2_PP		(1<<5)	/* Peak Detection */
    103  1.1  ichiro #define DATA2_COMMON		(2<<6)	/* DATA0_2 common bits(6-7) */
    104  1.1  ichiro 
    105  1.1  ichiro /* Data0 extended programming registers (16 bits) */
    106  1.2  ichiro #define EXT_ADDR_COMMON		(3<<6)	/* Extended Address Common bits */
    107  1.2  ichiro # define EXT_ADDR_E0		0	/* Extended Address of E0 */
    108  1.2  ichiro # define EXT_ADDR_E1		1	/* Extended Address of E1 */
    109  1.2  ichiro # define EXT_ADDR_E2		2	/* Extended Address of E2 */
    110  1.2  ichiro # define EXT_ADDR_E3		4	/* Extended Address of E3 */
    111  1.2  ichiro # define EXT_ADDR_E4		5	/* Extended Address of E4 */
    112  1.2  ichiro # define EXT_ADDR_E5		6	/* Extended Address of E5 */
    113  1.1  ichiro 
    114  1.2  ichiro #define EXT_DATA_COMMN		(7<<5) /* Extended Data Common bits */
    115  1.1  ichiro #define DATA_E0_MA(val)		((((val) + 1) * 31) / 100)
    116  1.1  ichiro 					/* mixer gain control val=(0<->100) */
    117  1.1  ichiro #define DATA_E1_MB(val)		((((val) + 1) * 31) / 100)
    118  1.1  ichiro 					/* mixer gain control val=(0<->100) */
    119  1.1  ichiro #define DATA_E2_MS(val)		(((((val) + 1) * 6) / 100) << 3)
    120  1.1  ichiro 					/* MIC sensitivity control val=(0<->100) */
    121  1.1  ichiro #define DATA_E2_MM0		0	/* Double differential mode */
    122  1.1  ichiro #define DATA_E2_MM1		1	/* input channel 1 select */
    123  1.1  ichiro #define DATA_E2_MM2		2	/* input channel 2 select */
    124  1.1  ichiro #define DATA_E2_MM3		3	/* digital mixer mode */
    125  1.1  ichiro 
    126  1.1  ichiro #define DATA_E3_AG		(1<<4)	/* AGC control ON */
    127  1.1  ichiro #define DATA_E3_IG_L(val)	(((val * 127) / 100) & 3)
    128  1.1  ichiro 					/* Input AMP-Gain control (low 2 bits) */
    129  1.1  ichiro #define DATA_E4_IG_H(val)	(((val * 127) / 100) >> 2)
    130  1.1  ichiro 					/* Input AMP-Gain control (high 5 bits) */
    131  1.1  ichiro #define DATA_E5_AL(val)		(((val + 1) * 3) / 100)
    132  1.1  ichiro 					/* AGC output level val=(0<->100) */
    133  1.1  ichiro /* end of uda1341.h */
    134