rockbox/firmware/export/mas35xx.h

140 lines
3.4 KiB
C
Raw Normal View History

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Implementation of MAS35xx audiohw api driver.
*
* Copyright (C) 2007 by Christian Gmeiner
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _MAS35XX_H
#define _MAS35XX_H
#include "config.h"
#if CONFIG_CODEC == MAS3507D
#define VOLUME_MIN -780
#define VOLUME_MAX 180
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP)
#else /* CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F */
/* MAS3587F and MAS3539F handle clipping prevention internally so we do not need
* the prescaler -> CLIPPING_CAP
*/
#define VOLUME_MIN -400
#define VOLUME_MAX 600
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BALANCE_CAP | CLIPPING_CAP)
#endif
#if CONFIG_CODEC == MAS3507D
static const unsigned int bass_table[] =
{
0x9e400, /* -15dB */
0xa2800, /* -14dB */
0xa7400, /* -13dB */
0xac400, /* -12dB */
0xb1800, /* -11dB */
0xb7400, /* -10dB */
0xbd400, /* -9dB */
0xc3c00, /* -8dB */
0xca400, /* -7dB */
0xd1800, /* -6dB */
0xd8c00, /* -5dB */
0xe0400, /* -4dB */
0xe8000, /* -3dB */
0xefc00, /* -2dB */
0xf7c00, /* -1dB */
0,
0x800, /* 1dB */
0x10000, /* 2dB */
0x17c00, /* 3dB */
0x1f800, /* 4dB */
0x27000, /* 5dB */
0x2e400, /* 6dB */
0x35800, /* 7dB */
0x3c000, /* 8dB */
0x42800, /* 9dB */
0x48800, /* 10dB */
0x4e400, /* 11dB */
0x53800, /* 12dB */
0x58800, /* 13dB */
0x5d400, /* 14dB */
0x61800 /* 15dB */
};
static const unsigned int treble_table[] =
{
0xb2c00, /* -15dB */
0xbb400, /* -14dB */
0xc1800, /* -13dB */
0xc6c00, /* -12dB */
0xcbc00, /* -11dB */
0xd0400, /* -10dB */
0xd5000, /* -9dB */
0xd9800, /* -8dB */
0xde000, /* -7dB */
0xe2800, /* -6dB */
0xe7e00, /* -5dB */
0xec000, /* -4dB */
0xf0c00, /* -3dB */
0xf5c00, /* -2dB */
0xfac00, /* -1dB */
0,
0x5400, /* 1dB */
0xac00, /* 2dB */
0x10400, /* 3dB */
0x16000, /* 4dB */
0x1c000, /* 5dB */
0x22400, /* 6dB */
0x28400, /* 7dB */
0x2ec00, /* 8dB */
0x35400, /* 9dB */
0x3c000, /* 10dB */
0x42c00, /* 11dB */
0x49c00, /* 12dB */
0x51800, /* 13dB */
0x58400, /* 14dB */
0x5f800 /* 15dB */
};
static const unsigned int prescale_table[] =
{
0x80000, /* 0db */
0x8e000, /* 1dB */
0x9a400, /* 2dB */
0xa5800, /* 3dB */
0xaf400, /* 4dB */
0xb8000, /* 5dB */
0xbfc00, /* 6dB */
0xc6c00, /* 7dB */
0xcd000, /* 8dB */
0xd25c0, /* 9dB */
0xd7800, /* 10dB */
0xdc000, /* 11dB */
0xdfc00, /* 12dB */
0xe3400, /* 13dB */
0xe6800, /* 14dB */
0xe9400 /* 15dB */
};
#endif /*CONFIG_CODEC == MAS3507D*/
#endif /* _MAS35XX_H */