2acc0ac542
later. We still need to hunt down snippets used that are not. 1324 modified files... http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
141 lines
3.5 KiB
C
141 lines
3.5 KiB
C
/***************************************************************************
|
|
* __________ __ ___.
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
* \/ \/ \/ \/ \/
|
|
* $Id$
|
|
*
|
|
* Implementation of MAS35xx audiohw api driver.
|
|
*
|
|
* Copyright (C) 2007 by Christian Gmeiner
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* 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 */
|