b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * All Rights Reserved |
| 3 | * |
| 4 | * MARVELL CONFIDENTIAL |
| 5 | * Copyright 2012 Marvell International Ltd All Rights Reserved. |
| 6 | * The source code contained or described herein and all documents related to |
| 7 | * the source code ("Material") are owned by Marvell International Ltd or its |
| 8 | * suppliers or licensors. Title to the Material remains with Marvell International Ltd |
| 9 | * or its suppliers and licensors. The Material contains trade secrets and |
| 10 | * proprietary and confidential information of Marvell or its suppliers and |
| 11 | * licensors. The Material is protected by worldwide copyright and trade secret |
| 12 | * laws and treaty provisions. No part of the Material may be used, copied, |
| 13 | * reproduced, modified, published, uploaded, posted, transmitted, distributed, |
| 14 | * or disclosed in any way without Marvell's prior express written permission. |
| 15 | * |
| 16 | * No license under any patent, copyright, trade secret or other intellectual |
| 17 | * property right is granted to or conferred upon you by disclosure or delivery |
| 18 | * of the Materials, either expressly, by implication, inducement, estoppel or |
| 19 | * otherwise. Any license under such intellectual property rights must be |
| 20 | * express and approved by Marvell in writing. |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #ifndef DIAG_AUDIO_H |
| 25 | #define DIAG_AUDIO_H |
| 26 | #define AC_TEST |
| 27 | #include <sys/socket.h> |
| 28 | #include <sys/un.h> |
| 29 | |
| 30 | #if 0 |
| 31 | |
| 32 | #ifndef AUDIO_CALIBRATION_DIR |
| 33 | #define AUDIO_CALIBRATION_DIR "/data/misc/audio" |
| 34 | #endif |
| 35 | |
| 36 | #endif |
| 37 | |
| 38 | #define AUDIO_CALIBRATION_DIR "/system/etc" |
| 39 | |
| 40 | #define ACM_CALIBRATION_SOCKET AUDIO_CALIBRATION_DIR "/audio_calibration_ACM" |
| 41 | #define NVM_CALIBRATION_SOCKET AUDIO_CALIBRATION_DIR "/nvm_calibration_ACM" |
| 42 | |
| 43 | #define QLEN 10 |
| 44 | //#define AC_BUFFER_SIZE 16384 |
| 45 | #define AC_BUFFER_SIZE 52 |
| 46 | #define PATH_STATUS_SIZE 6 |
| 47 | #define XML_APPENDIX_SIZE 3 |
| 48 | #define PHY_VERSION_LEN 36 |
| 49 | #define SW_VERSION_LEN 36 |
| 50 | |
| 51 | typedef enum |
| 52 | { |
| 53 | AUDIO_PHY_GetVersion = 0x01, |
| 54 | AUDIO_PHY_GetCurrentConfigure, |
| 55 | AUDIO_PHY_GetGainConfigure, |
| 56 | AUDIO_PHY_GetPathList, |
| 57 | AUDIO_PHY_GetPathStatus, |
| 58 | AUDIO_PHY_GetAudioMode, |
| 59 | AUDIO_PHY_ReloadCalibrationData, |
| 60 | AUDIO_PHY_SetPathVolume, |
| 61 | AUDIO_PHY_EnablePath, |
| 62 | AUDIO_PHY_DisablePath, |
| 63 | AUDIO_PHY_MutePath, |
| 64 | AUDIO_PHY_SwitchPath, |
| 65 | AUDIO_PHY_SendVEtoADSP, |
| 66 | AUDIO_NVM_GetGainConfigure, |
| 67 | AUDIO_NVM_GetVEConfigure, |
| 68 | AUDIO_NVM_ReloadCalibrationData, |
| 69 | |
| 70 | AUDIO_SW_GetGainConfigure = 0x91, |
| 71 | AUDIO_SW_GetPathStatus, |
| 72 | AUDIO_SW_ReloadCalibrationData, |
| 73 | AUDIO_SW_SetVolume, |
| 74 | AUDIO_SW_MutePath, |
| 75 | AUDIO_SW_GetVersion, |
| 76 | |
| 77 | AUDIO_AE_ReloadCalibrationData = 0x100, |
| 78 | |
| 79 | AUDIO_AE_SendCmd = 0x200, // For voip AEC calibration |
| 80 | AUDIO_AE_GetDeviceStatus, |
| 81 | AUDIO_AE_ReloadFDI, |
| 82 | AUDIO_AE_GetCurrentProfile, |
| 83 | AUDIO_AE_GetVersion, |
| 84 | } AC_IPC_Type; |
| 85 | |
| 86 | typedef struct |
| 87 | { |
| 88 | unsigned short d1; |
| 89 | unsigned short d2; |
| 90 | unsigned short d3; |
| 91 | unsigned short d4; |
| 92 | uint32_t d5; |
| 93 | uint32_t d6; |
| 94 | uint32_t d7; |
| 95 | uint32_t d8; |
| 96 | } AC_IPC_Package_Body; |
| 97 | |
| 98 | typedef struct { |
| 99 | AC_IPC_Type type; |
| 100 | AC_IPC_Package_Body body; |
| 101 | void *ptr; |
| 102 | } AC_IPC_Package; |
| 103 | |
| 104 | typedef struct { |
| 105 | unsigned int ac_version; |
| 106 | char ac_xml_appendix[XML_APPENDIX_SIZE]; |
| 107 | } AC_CONFIG_VERSION; |
| 108 | |
| 109 | typedef struct { |
| 110 | unsigned char path_direction_Rx; |
| 111 | signed int digital_gain_Rx; |
| 112 | unsigned char volume_Rx; |
| 113 | |
| 114 | unsigned char path_direction_Tx; |
| 115 | signed int digital_gain_Tx; |
| 116 | unsigned char volume_Tx; |
| 117 | |
| 118 | unsigned char path_direction_SideTone; |
| 119 | signed int digital_gain_SideTone; |
| 120 | unsigned char volume_SideTone; |
| 121 | } AC_Digital_Gain; |
| 122 | |
| 123 | typedef struct { |
| 124 | AC_Digital_Gain gain; |
| 125 | unsigned char status; |
| 126 | } AC_Digital_Gain_Status; |
| 127 | |
| 128 | /* ICAT Exported Functions */ |
| 129 | void PHY_GetVersion(void); //Audio, ACM, AUDIO_PHY_GetVersion |
| 130 | void PHY_GetCurrentConfigure(void); //Audio, ACM, AUDIO_PHY_GetCurrentConfigure |
| 131 | void PHY_GetGainConfigure(void); //Audio, ACM, AUDIO_PHY_GetGainConfigure |
| 132 | void PHY_GetPathStatus(void); //Audio, ACM, AUDIO_PHY_GetPathStatus |
| 133 | void PHY_ReloadCalibrationData(void); //Audio, ACM, AUDIO_PHY_ReloadCalibrationData |
| 134 | void PHY_SetPathVolume(void *data); //Audio, ACM, AUDIO_PHY_SetPathVolume |
| 135 | void PHY_EnablePath(void *data); //Audio, ACM, AUDIO_PHY_EnablePath |
| 136 | void PHY_DisablePath(void *data); //Audio, ACM, AUDIO_PHY_DisablePath |
| 137 | void PHY_MutePath(void *data); //Audio, ACM, AUDIO_PHY_MutePath |
| 138 | void PHY_SwitchPath(void *data); //Audio, ACM, AUDIO_PHY_SwitchPath |
| 139 | #endif /*DIAG_AUDIO_H */ |