1 /*
2 ** =============================================================================
3 ** Copyright (c) 2016 Texas Instruments Inc.
4 **
5 ** This program is free software; you can redistribute it and/or modify it under
6 ** the terms of the GNU General Public License as published by the Free Software
7 ** Foundation; version 2.
8 **
9 ** This program is distributed in the hope that it will be useful, but WITHOUT
10 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 ** FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 **
13 ** You should have received a copy of the GNU General Public License along with
14 ** this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 ** Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 **
17 ** File:
18 ** ti_audio.h
19 **
20 ** Description:
21 ** header file for the test program of TAS2555 Android Linux drivers
22 **
23 ** =============================================================================
24 */
25 #include <stdlib.h>
26 #include <string.h>
28 #define TIAUDIO_VERSION "Version : 3.2 (10th, August, 2016)"
29 #define TI_AUDIO_NAME "/dev/tas2555s"
31 #define MAX_INT_STR "4294967295"
33 #define SR_STR_48K "48000"
34 #define SR_STR_44K "44100"
35 #define SR_STR_16K "16000"
36 #define SR_NUM_48K 48000
37 #define SR_NUM_44K 44100
38 #define SR_NUM_16K 16000
40 #define LEFT_CHANNEL_STR "L"
41 #define RIGHT_CHANNEL_STR "R"
42 #define BOTH_CHANNELS_STR "L R"
44 #define FW_NAME_SIZE 64
45 #define FW_DESCRIPTION_SIZE 256
46 #define PROGRAM_BUF_SIZE (2 + FW_NAME_SIZE + FW_DESCRIPTION_SIZE)
47 #define CONFIGURATION_BUF_SIZE (8 + FW_NAME_SIZE + FW_DESCRIPTION_SIZE)
49 #define TIAUDIO_CMD_REG_WITE 1
50 #define TIAUDIO_CMD_REG_READ 2
51 #define TIAUDIO_CMD_DEBUG_ON 3
52 #define TIAUDIO_CMD_PROGRAM 4
53 #define TIAUDIO_CMD_CONFIGURATION 5
54 #define TIAUDIO_CMD_FW_TIMESTAMP 6
55 #define TIAUDIO_CMD_CALIBRATION 7
56 #define TIAUDIO_CMD_SAMPLERATE 8
57 #define TIAUDIO_CMD_BITRATE 9
58 #define TIAUDIO_CMD_DACVOLUME 10
59 #define TIAUDIO_CMD_SPEAKER 11
60 #define TIAUDIO_CMD_FW_RELOAD 12
62 #define TAS2555_REG(book, page, reg) (((book * 256 * 128) + \
63 (page * 128)) + reg)
65 #define TAS2555_BOOK_ID(reg) (reg / (256 * 128))
66 #define TAS2555_PAGE_ID(reg) ((reg % (256 * 128)) / 128)
67 #define TAS2555_BOOK_REG(reg) (reg % (256 * 128))
68 #define TAS2555_PAGE_REG(reg) ((reg % (256 * 128)) % 128)
70 #define ARRAY_LEN(x) ((int)(sizeof(x)/sizeof((x)[0])))