codexclear

Signed-off-by: xxxxyang <xiaoyang75@huawei.com>
This commit is contained in:
xxxxyang
2022-03-08 15:35:34 +08:00
parent a3b199bcb2
commit 6d6b866040
10 changed files with 30 additions and 29 deletions
+22 -13
View File
@@ -58,7 +58,6 @@ uint32_t AudioBytesToFrames(uint32_t frameBits, uint32_t size)
int32_t AudioDataBigEndianChange(char *srcData, uint32_t audioLen, enum DataBitWidth bitWidth)
{
uint64_t i;
uint16_t framesize;
char *changeData;
@@ -477,14 +476,9 @@ static int32_t MmapWriteData(struct PlatformData *data, char *tmpBuf)
return HDF_SUCCESS;
}
static int32_t AudioMmapWriteTransfer(const struct AudioCard *card)
static int32_t AudioPlatformDataInit(struct PlatformData *data, uint32_t *totalSize, uint32_t *lastBuffSize,
uint32_t *loopTimes)
{
uint32_t timeout = 0;
uint32_t totalSize;
uint32_t lastBuffSize;
uint32_t loopTimes;
char *tmpBuf;
struct PlatformData *data = PlatformDataFromCard(card);
if (data == NULL) {
AUDIO_DRIVER_LOG_ERR("PlatformDataFromCard failed.");
return HDF_FAILURE;
@@ -494,11 +488,26 @@ static int32_t AudioMmapWriteTransfer(const struct AudioCard *card)
return HDF_FAILURE;
}
totalSize = (uint32_t)data->mmapData.totalBufferFrames * data->renderPcmInfo.frameSize;
lastBuffSize = ((totalSize % MIN_PERIOD_SIZE) == 0) ? MIN_PERIOD_SIZE : (totalSize % MIN_PERIOD_SIZE);
loopTimes = (lastBuffSize == MIN_PERIOD_SIZE) ?
(totalSize / MIN_PERIOD_SIZE) : (totalSize / MIN_PERIOD_SIZE + 1);
*totalSize = (uint32_t)data->mmapData.totalBufferFrames * data->renderPcmInfo.frameSize;
*lastBuffSize = ((*totalSize % MIN_PERIOD_SIZE) == 0) ? MIN_PERIOD_SIZE : (*totalSize % MIN_PERIOD_SIZE);
*loopTimes = (*lastBuffSize == MIN_PERIOD_SIZE) ?
(*totalSize / MIN_PERIOD_SIZE) : (*totalSize / MIN_PERIOD_SIZE + 1);
data->mmapLoopCount = 0;
return HDF_SUCCESS;
}
static int32_t AudioMmapWriteTransfer(const struct AudioCard *card)
{
uint32_t timeout = 0;
uint32_t totalSize;
uint32_t lastBuffSize;
uint32_t loopTimes;
char *tmpBuf;
struct PlatformData *data = PlatformDataFromCard(card);
if (AudioPlatformDataInit(data, &totalSize, &lastBuffSize, &loopTimes) == HDF_FAILURE) {
return HDF_FAILURE;
}
tmpBuf = OsalMemCalloc(MIN_PERIOD_SIZE);
if (tmpBuf == NULL) {
AUDIO_DRIVER_LOG_ERR("tmpBuf is null.");
@@ -515,8 +524,8 @@ static int32_t AudioMmapWriteTransfer(const struct AudioCard *card)
AUDIO_DRIVER_LOG_DEBUG("dma buff status ENUM_CIR_BUFF_FULL.");
timeout++;
if (timeout >= TIME_OUT_CONST) {
AUDIO_DRIVER_LOG_ERR("timeout failed.");
OsalMemFree(tmpBuf);
AUDIO_DRIVER_LOG_ERR("timeout failed.");
return HDF_FAILURE;
}
continue;
+1 -1
View File
@@ -6,8 +6,8 @@
* See the LICENSE file in the root of this repository for complete details.
*/
#include "audio_common_test.h"
#include <gtest/gtest.h>
#include "audio_common_test.h"
#include "hdf_uhdf_test.h"
using namespace testing::ext;
+1 -1
View File
@@ -6,8 +6,8 @@
* See the LICENSE file in the root of this repository for complete details.
*/
#include "audio_common_test.h"
#include <gtest/gtest.h>
#include "audio_common_test.h"
#include "hdf_uhdf_test.h"
using namespace testing::ext;
+1 -1
View File
@@ -13,7 +13,7 @@
const int32_t g_testAudioType = 701; // 701 is TEST_AUDIO_TYPE
enum {
enum HDFAudioTestCommonCmd {
TESTI2CREADWRITE = 48,
TESTREGBITSREAD,
TESTREGBITSUPDATE,
+1 -1
View File
@@ -6,8 +6,8 @@
* See the LICENSE file in the root of this repository for complete details.
*/
#include "audio_common_test.h"
#include <gtest/gtest.h>
#include "audio_common_test.h"
#include "hdf_uhdf_test.h"
using namespace testing::ext;
+1 -1
View File
@@ -6,8 +6,8 @@
* See the LICENSE file in the root of this repository for complete details.
*/
#include "audio_common_test.h"
#include <gtest/gtest.h>
#include "audio_common_test.h"
#include "hdf_uhdf_test.h"
using namespace testing::ext;
+1 -1
View File
@@ -6,8 +6,8 @@
* See the LICENSE file in the root of this repository for complete details.
*/
#include "audio_common_test.h"
#include <gtest/gtest.h>
#include "audio_common_test.h"
#include "hdf_uhdf_test.h"
using namespace testing::ext;
+1 -1
View File
@@ -6,8 +6,8 @@
* See the LICENSE file in the root of this repository for complete details.
*/
#include "audio_common_test.h"
#include <gtest/gtest.h>
#include "audio_common_test.h"
#include "hdf_uhdf_test.h"
using namespace testing::ext;
@@ -301,7 +301,6 @@ static int32_t HwParamsDataAnalysis(struct HdfSBuf *reqData, struct AudioPcmHwPa
ADM_LOG_ERR(" input param is NULL.");
return HDF_FAILURE;
}
if (!HdfSbufReadUint32(reqData, &params->streamType)) {
ADM_LOG_ERR("read request streamType failed!");
return HDF_FAILURE;
@@ -334,37 +333,30 @@ static int32_t HwParamsDataAnalysis(struct HdfSBuf *reqData, struct AudioPcmHwPa
HDF_LOGE("read request perid failed!");
return HDF_FAILURE;
}
if (!HdfSbufReadUint32(reqData, &params->frameSize)) {
HDF_LOGE("read request frameSize failed!");
return HDF_FAILURE;
}
if (!HdfSbufReadUint32(reqData, (uint32_t *)&params->isBigEndian)) {
HDF_LOGE("read request isBigEndian failed!");
return HDF_FAILURE;
}
if (!HdfSbufReadUint32(reqData, (uint32_t *)&params->isSignedData)) {
HDF_LOGE("read request isSignedData failed!");
return HDF_FAILURE;
}
if (!HdfSbufReadUint32(reqData, &params->startThreshold)) {
HDF_LOGE("read request startThreshold failed!");
return HDF_FAILURE;
}
if (!HdfSbufReadUint32(reqData, &params->stopThreshold)) {
HDF_LOGE("read request stopThreshold failed!");
return HDF_FAILURE;
}
if (!HdfSbufReadUint32(reqData, &params->silenceThreshold)) {
HDF_LOGE("read request silenceThreshold failed!");
return HDF_FAILURE;
}
return HDF_SUCCESS;
}
@@ -7,7 +7,6 @@
*/
#include "hdf_log.h"
#include "hdf_audio_test.h"
#include "audio_host_test.h"
#include "audio_core_test.h"
#include "audio_parse_test.h"
@@ -18,6 +17,7 @@
#include "audio_codec_base_test.h"
#include "audio_platform_base_test.h"
#include "audio_accessory_base_test.h"
#include "hdf_audio_test.h"
#define HDF_LOG_TAG hdf_audio_test