本文整理汇总了C++中ALOGD函数的典型用法代码示例。如果您正苦于以下问题:C++ ALOGD函数的具体用法?C++ ALOGD怎么用?C++ ALOGD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ALOGD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ALOGD
void AudioFtm::SetVibSpkRampControl(uint8_t rampcontrol)
{
ALOGD("%s()", __FUNCTION__);
AudioVIBSPKControl::getInstance()->VibSpkRampControl(rampcontrol);
}
示例2: ALOGD
/**
* a basic function fo AnalogClose, ckose analog power
* @param DeviceType analog part power
* @return status_t
*/
status_t AudioPlatformDevice::AnalogClose(AudioAnalogType::DEVICE_TYPE DeviceType)
{
ALOGD("AudioPlatformDevice AnalogClose DeviceType = %s", kAudioAnalogDeviceTypeName[DeviceType]);
mLock.lock();
mBlockAttribute[DeviceType].mEnable = false;
// here to open pmic digital part
switch (DeviceType)
{
case AudioAnalogType::DEVICE_OUT_EARPIECER:
case AudioAnalogType::DEVICE_OUT_EARPIECEL:
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0001); // turn off DL
// TopCtlChangeTrigger();
break;
case AudioAnalogType::DEVICE_OUT_HEADSETR:
case AudioAnalogType::DEVICE_OUT_HEADSETL:
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0001); // turn off DL
TopCtlChangeTrigger();
ALOGD("AnalogClose Reset mHpRightDcCalibration/mHpLeftDcCalibration from [0x%x] [0x%x]", mHpRightDcCalibration, mHpLeftDcCalibration);
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON3, 0, 0xffff); // LCH cancel DC
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON4, 0, 0xffff); // RCH cancel DC
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON10, 0x0000, 0x0001); // enable DC cpmpensation
DCChangeTrigger();//Trigger DC compensation
break;
case AudioAnalogType::DEVICE_OUT_SPEAKERR:
case AudioAnalogType::DEVICE_OUT_SPEAKERL:
#ifdef USING_EXTAMP_HP
mLock.unlock();
AnalogClose(AudioAnalogType::DEVICE_OUT_HEADSETR);
mLock.lock();
#else
mLock.unlock();
AnalogClose(AudioAnalogType::DEVICE_OUT_EARPIECER);
mLock.lock();
#endif
break;
case AudioAnalogType::DEVICE_OUT_SPEAKER_HEADSET_R:
case AudioAnalogType::DEVICE_OUT_SPEAKER_HEADSET_L:
mLock.unlock();
AnalogClose(AudioAnalogType::DEVICE_OUT_HEADSETR);
mLock.lock();
break;
case AudioAnalogType::DEVICE_IN_ADC1:
case AudioAnalogType::DEVICE_IN_ADC2:
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0002); // turn off UL
// TopCtlChangeTrigger();
break;
case AudioAnalogType::DEVICE_IN_DIGITAL_MIC:
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON9, 0x0000, 0x0010); // disable digital mic
mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0002); // turn off UL
// TopCtlChangeTrigger();
break;
case AudioAnalogType::DEVICE_2IN1_SPK:
if (IsAudioSupportFeature(AUDIO_SUPPORT_2IN1_SPEAKER))
{
mLock.unlock();
AnalogClose(AudioAnalogType::DEVICE_OUT_EARPIECER);
mLock.lock();
}
break;
}
if (!GetDownLinkStatus() && !GetULinkStatus())
{
mAudioAnalogReg->SetAnalogReg(TOP_CKPDN1_SET, 0x0100, 0x0100); // AUD 26M clock power down
ALOGD("AudioPlatformDevice AnalogClose Power Down TOP_CKPDN1_SET");
}
else
{
ALOGD("AudioPlatformDevice AnalogClose No Power Down TOP_CKPDN1_SET");
}
mLock.unlock();
return NO_ERROR;
}
示例3: fastiva_Dalvik_java_lang_System_arraycopy
void fastiva_Dalvik_java_lang_System_arraycopy(java_lang_Object_p arg0, jint srcPos, java_lang_Object_p arg2, jint dstPos, jint length) {
ArrayObject* srcArray = (ArrayObject*) arg0;
ArrayObject* dstArray = (ArrayObject*) arg2;
#endif
/* Check for null pointers. */
if (srcArray == NULL) {
dvmThrowNullPointerException("src == null");
THROW_VOID();
}
if (dstArray == NULL) {
dvmThrowNullPointerException("dst == null");
THROW_VOID();
}
/* Make sure source and destination are arrays. */
if (!dvmIsArray(srcArray)) {
dvmThrowArrayStoreExceptionNotArray(((Object*)srcArray)->clazz, "source");
THROW_VOID();
}
if (!dvmIsArray(dstArray)) {
dvmThrowArrayStoreExceptionNotArray(((Object*)dstArray)->clazz, "destination");
THROW_VOID();
}
/* avoid int overflow */
if (srcPos < 0 || dstPos < 0 || length < 0 ||
srcPos > (int) srcArray->length - length ||
dstPos > (int) dstArray->length - length)
{
dvmThrowExceptionFmt(gDvm.exArrayIndexOutOfBoundsException,
"src.length=%d srcPos=%d dst.length=%d dstPos=%d length=%d",
srcArray->length, srcPos, dstArray->length, dstPos, length);
THROW_VOID();
}
ClassObject* srcClass = srcArray->clazz;
ClassObject* dstClass = dstArray->clazz;
char srcType = srcClass->descriptor[1];
char dstType = dstClass->descriptor[1];
/*
* If one of the arrays holds a primitive type, the other array must
* hold the same type.
*/
bool srcPrim = (srcType != '[' && srcType != 'L');
bool dstPrim = (dstType != '[' && dstType != 'L');
if (srcPrim || dstPrim) {
if (srcPrim != dstPrim || srcType != dstType) {
dvmThrowArrayStoreExceptionIncompatibleArrays(srcClass, dstClass);
THROW_VOID();
}
if (false) ALOGD("arraycopy prim[%c] dst=%p %d src=%p %d len=%d",
srcType, dstArray->contents, dstPos,
srcArray->contents, srcPos, length);
switch (srcType) {
case 'B':
case 'Z':
/* 1 byte per element */
memmove((u1*) dstArray->contents + dstPos,
(const u1*) srcArray->contents + srcPos,
length);
break;
case 'C':
case 'S':
/* 2 bytes per element */
move16((u1*) dstArray->contents + dstPos * 2,
(const u1*) srcArray->contents + srcPos * 2,
length * 2);
break;
case 'F':
case 'I':
/* 4 bytes per element */
move32((u1*) dstArray->contents + dstPos * 4,
(const u1*) srcArray->contents + srcPos * 4,
length * 4);
break;
case 'D':
case 'J':
/*
* 8 bytes per element. We don't need to guarantee atomicity
* of the entire 64-bit word, so we can use the 32-bit copier.
*/
move32((u1*) dstArray->contents + dstPos * 8,
(const u1*) srcArray->contents + srcPos * 8,
length * 8);
break;
default: /* illegal array type */
ALOGE("Weird array type '%s'", srcClass->descriptor);
dvmAbort();
}
} else {
/*
* Neither class is primitive. See if elements in "src" are instances
* of elements in "dst" (e.g. copy String to String or String to
* Object).
*/
const int width = sizeof(Object*);
//.........这里部分代码省略.........
示例4: ALOGD
status_t AudioAnalogControl::SetAnalogMute(AudioAnalogType::VOLUME_TYPE VoleumType, bool mute)
{
ALOGD("SetAnalogMute VoleumType = %d mute = %d \n", VoleumType, mute);
mAudioMachineDevice->SetAnalogMute(VoleumType, mute);
return NO_ERROR;
}
示例5: dvmCreateReflectMethodObject
/*
* ´´½¨Ò»¸öÐ嵀 java/lang/reflect/Method¶ÔÏó,ʹÓÃ'meth'ÄÚÈÝÈ¥¹¹ÔìËü.
*
*/
Object* dvmCreateReflectMethodObject(const Method* meth)
{
Object* result = NULL;
ArrayObject* params = NULL;
ArrayObject* exceptions = NULL;
StringObject* nameObj = NULL;
Object* methObj;
ClassObject* returnType;
DexStringCache mangle;
char* cp;
int slot;
if (dvmCheckException(dvmThreadSelf())) {
ALOGW("WARNING: dvmCreateReflectMethodObject called with "
"exception pending");
return NULL;
}
dexStringCacheInit(&mangle);
/* parent should guarantee init so we don't have to check on every call */
assert(dvmIsClassInitialized(gDvm.classJavaLangReflectMethod));
methObj = dvmAllocObject(gDvm.classJavaLangReflectMethod, ALLOC_DEFAULT);
if (methObj == NULL)
goto bail;
/*
* Convert the signature string into an array of classes representing
* the arguments, and a class for the return type.
*/
cp = dvmCopyDescriptorStringFromMethod(meth, &mangle);
params = convertSignatureToClassArray(&cp, meth->clazz);
if (params == NULL)
goto bail;
assert(*cp == ')');
cp++;
returnType = convertSignaturePartToClass(&cp, meth->clazz);
if (returnType == NULL)
goto bail;
/*
* Create an array with one entry for every exception that the class
* is declared to throw.
*/
exceptions = dvmGetMethodThrows(meth);
if (dvmCheckException(dvmThreadSelf()))
goto bail;
/* method name */
nameObj = dvmCreateStringFromCstr(meth->name);
if (nameObj == NULL)
goto bail;
slot = methodToSlot(meth);
JValue unused;
dvmCallMethod(dvmThreadSelf(), gDvm.methJavaLangReflectMethod_init,
methObj, &unused, meth->clazz, params, exceptions, returnType,
nameObj, slot);
if (dvmCheckException(dvmThreadSelf())) {
ALOGD("Method class init threw exception");
goto bail;
}
result = methObj;
bail:
dexStringCacheRelease(&mangle);
if (result == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
}
dvmReleaseTrackedAlloc((Object*) nameObj, NULL);
dvmReleaseTrackedAlloc((Object*) params, NULL);
dvmReleaseTrackedAlloc((Object*) exceptions, NULL);
if (result == NULL)
dvmReleaseTrackedAlloc(methObj, NULL);
return result;
}
示例6: com_android_nfc_NativeLlcpConnectionlessSocket_doReceiveFrom
static jobject com_android_nfc_NativeLlcpConnectionlessSocket_doReceiveFrom(JNIEnv *e, jobject o, jint linkMiu)
{
NFCSTATUS ret;
struct timespec ts;
uint8_t ssap;
jobject llcpPacket = NULL;
phLibNfc_Handle hRemoteDevice;
phLibNfc_Handle hLlcpSocket;
phNfc_sData_t sReceiveBuffer;
jclass clsLlcpPacket;
jfieldID f;
jbyteArray receivedData = NULL;
struct nfc_jni_callback_data cb_data;
/* Create the local semaphore */
if (!nfc_cb_data_init(&cb_data, NULL))
{
goto clean_and_return;
}
/* Create new LlcpPacket object */
if(nfc_jni_cache_object(e,"com/android/nfc/LlcpPacket",&(llcpPacket)) == -1)
{
ALOGE("Find LlcpPacket class error");
goto clean_and_return;
}
/* Get NativeConnectionless class object */
clsLlcpPacket = e->GetObjectClass(llcpPacket);
if(e->ExceptionCheck())
{
ALOGE("Get Object class error");
goto clean_and_return;
}
/* Retrieve handles */
hRemoteDevice = nfc_jni_get_p2p_device_handle(e,o);
hLlcpSocket = nfc_jni_get_nfc_socket_handle(e,o);
TRACE("phLibNfc_Llcp_RecvFrom(), Socket Handle = 0x%02x, Link LIU = %d", hLlcpSocket, linkMiu);
sReceiveBuffer.buffer = (uint8_t*)malloc(linkMiu);
sReceiveBuffer.length = linkMiu;
REENTRANCE_LOCK();
ret = phLibNfc_Llcp_RecvFrom(hRemoteDevice,
hLlcpSocket,
&sReceiveBuffer,
nfc_jni_receive_callback,
&cb_data);
REENTRANCE_UNLOCK();
if(ret != NFCSTATUS_PENDING && ret != NFCSTATUS_SUCCESS)
{
ALOGE("phLibNfc_Llcp_RecvFrom() returned 0x%04x[%s]", ret, nfc_jni_get_status_name(ret));
goto clean_and_return;
}
TRACE("phLibNfc_Llcp_RecvFrom() returned 0x%04x[%s]", ret, nfc_jni_get_status_name(ret));
/* Wait for callback response */
if(sem_wait(&cb_data.sem))
{
ALOGE("Failed to wait for semaphore (errno=0x%08x)", errno);
goto clean_and_return;
}
if(cb_data.status != NFCSTATUS_SUCCESS)
{
goto clean_and_return;
}
ssap = (uint32_t)cb_data.pContext;
TRACE("Data Received From SSAP = %d\n, length = %d", ssap, sReceiveBuffer.length);
/* Set Llcp Packet remote SAP */
f = e->GetFieldID(clsLlcpPacket, "mRemoteSap", "I");
e->SetIntField(llcpPacket, f,(jbyte)ssap);
/* Set Llcp Packet Buffer */
ALOGD("Set LlcpPacket Data Buffer\n");
f = e->GetFieldID(clsLlcpPacket, "mDataBuffer", "[B");
receivedData = e->NewByteArray(sReceiveBuffer.length);
e->SetByteArrayRegion(receivedData, 0, sReceiveBuffer.length,(jbyte *)sReceiveBuffer.buffer);
e->SetObjectField(llcpPacket, f, receivedData);
clean_and_return:
nfc_cb_data_deinit(&cb_data);
return llcpPacket;
}
开发者ID:TeamNyx,项目名称:packages_apps_Nfc,代码行数:87,代码来源:com_android_nfc_NativeLlcpConnectionlessSocket.cpp
示例7: IsWiredMode_Enable
/*******************************************************************************
**
** Function: IsWiredMode_Enable
**
** Description: Provides the connection status of EE
**
** Returns: True if ok.
**
*******************************************************************************/
bool IsWiredMode_Enable()
{
static const char fn [] = "DwpChannel::IsWiredMode_Enable";
ALOGD ("%s: enter", fn);
SecureElement &se = SecureElement::getInstance();
tNFA_STATUS stat = NFA_STATUS_FAILED;
static const int MAX_NUM_EE = 5;
UINT16 meSE =0x4C0;
UINT8 mActualNumEe;
tNFA_EE_INFO EeInfo[MAX_NUM_EE];
mActualNumEe = MAX_NUM_EE;
#if 0
if(mIsInit == false)
{
ALOGD ("%s: JcopOs Dwnld is not initialized", fn);
goto TheEnd;
}
#endif
stat = NFA_EeGetInfo(&mActualNumEe, EeInfo);
if(stat == NFA_STATUS_OK)
{
for(int xx = 0; xx < mActualNumEe; xx++)
{
ALOGE("xx=%d, ee_handle=0x0%x, status=0x0%x", xx, EeInfo[xx].ee_handle,EeInfo[xx].ee_status);
if (EeInfo[xx].ee_handle == meSE)
{
if(EeInfo[xx].ee_status == 0x00)
{
stat = NFA_STATUS_OK;
ALOGD ("%s: status = 0x%x", fn, stat);
break;
}
else if(EeInfo[xx].ee_status == 0x01)
{
ALOGE("%s: Enable eSE-mode set ON", fn);
se.SecEle_Modeset(0x01);
usleep(2000 * 1000);
stat = NFA_STATUS_OK;
break;
}
else
{
stat = NFA_STATUS_FAILED;
break;
}
}
else
{
stat = NFA_STATUS_FAILED;
}
}
}
//TheEnd: /*commented to eliminate the label defined but not used warning*/
ALOGD("%s: exit; status = 0x%X", fn, stat);
if(stat == NFA_STATUS_OK)
return true;
else
return false;
}
示例8: createConstructorObject
/*
* ʹÓÃ'meth'ÄÚÈÝÈ¥´´½¨Ò»¸öÐ嵀 java/lang/reflect/Constructor¶ÔÏó£¬
*/
static Object* createConstructorObject(Method* meth)
{
Object* result = NULL;
ArrayObject* params = NULL;
ArrayObject* exceptions = NULL;
Object* consObj;
DexStringCache mangle;
char* cp;
int slot;
dexStringCacheInit(&mangle);
/* parent should guarantee init so we don't have to check on every call */
assert(dvmIsClassInitialized(gDvm.classJavaLangReflectConstructor));
consObj = dvmAllocObject(gDvm.classJavaLangReflectConstructor,
ALLOC_DEFAULT);
if (consObj == NULL)
goto bail;
/*
* Convert the signature string into an array of classes representing
* the arguments.
*/
cp = dvmCopyDescriptorStringFromMethod(meth, &mangle);
params = convertSignatureToClassArray(&cp, meth->clazz);
if (params == NULL)
goto bail;
assert(*cp == ')');
assert(*(cp+1) == 'V');
/*
* Create an array with one entry for every exception that the class
* is declared to throw.
*/
exceptions = dvmGetMethodThrows(meth);
if (dvmCheckException(dvmThreadSelf()))
goto bail;
slot = methodToSlot(meth);
JValue unused;
dvmCallMethod(dvmThreadSelf(), gDvm.methJavaLangReflectConstructor_init,
consObj, &unused, meth->clazz, params, exceptions, slot);
if (dvmCheckException(dvmThreadSelf())) {
ALOGD("Constructor class init threw exception");
goto bail;
}
result = consObj;
bail:
dexStringCacheRelease(&mangle);
dvmReleaseTrackedAlloc((Object*) params, NULL);
dvmReleaseTrackedAlloc((Object*) exceptions, NULL);
if (result == NULL) {
assert(dvmCheckException(dvmThreadSelf()));
dvmReleaseTrackedAlloc(consObj, NULL);
}
/* caller must dvmReleaseTrackedAlloc(result) */
return result;
}
示例9: memset
/*===========================================================================
* FUNCTION : allocate
*
* DESCRIPTION: allocate requested number of buffers of certain size
*
* PARAMETERS :
* @count : number of buffers to be allocated
* @size : lenght of the buffer to be allocated
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int QCameraGrallocMemory::allocate(int count, int /*size*/)
{
int err = 0;
status_t ret = NO_ERROR;
int gralloc_usage = 0;
struct ion_fd_data ion_info_fd;
memset(&ion_info_fd, 0, sizeof(ion_info_fd));
ALOGI(" %s : E ", __FUNCTION__);
if (!mWindow) {
ALOGE("Invalid native window");
return INVALID_OPERATION;
}
// Increment buffer count by min undequeued buffer.
err = mWindow->get_min_undequeued_buffer_count(mWindow,&mMinUndequeuedBuffers);
if (err != 0) {
ALOGE("get_min_undequeued_buffer_count failed: %s (%d)",
strerror(-err), -err);
ret = UNKNOWN_ERROR;
goto end;
}
count += mMinUndequeuedBuffers;
err = mWindow->set_buffer_count(mWindow, count);
if (err != 0) {
ALOGE("set_buffer_count failed: %s (%d)",
strerror(-err), -err);
ret = UNKNOWN_ERROR;
goto end;
}
err = mWindow->set_buffers_geometry(mWindow, mWidth, mHeight, mFormat);
if (err != 0) {
ALOGE("%s: set_buffers_geometry failed: %s (%d)",
__func__, strerror(-err), -err);
ret = UNKNOWN_ERROR;
goto end;
}
gralloc_usage = GRALLOC_USAGE_PRIVATE_IOMMU_HEAP;
err = mWindow->set_usage(mWindow, gralloc_usage);
if(err != 0) {
/* set_usage error out */
ALOGE("%s: set_usage rc = %d", __func__, err);
ret = UNKNOWN_ERROR;
goto end;
}
ALOGD("%s: usage = %d, geometry: %p, %d, %d, %d",
__func__, gralloc_usage, mWindow, mWidth, mHeight, mFormat);
//Allocate cnt number of buffers from native window
for (int cnt = 0; cnt < count; cnt++) {
int stride;
err = mWindow->dequeue_buffer(mWindow, &mBufferHandle[cnt], &stride);
if(!err) {
ALOGV("dequeue buf hdl =%p", mBufferHandle[cnt]);
mLocalFlag[cnt] = BUFFER_OWNED;
} else {
mLocalFlag[cnt] = BUFFER_NOT_OWNED;
ALOGE("%s: dequeue_buffer idx = %d err = %d", __func__, cnt, err);
}
ALOGV("%s: dequeue buf: %p\n", __func__, mBufferHandle[cnt]);
if(err != 0) {
ALOGE("%s: dequeue_buffer failed: %s (%d)",
__func__, strerror(-err), -err);
ret = UNKNOWN_ERROR;
for(int i = 0; i < cnt; i++) {
if(mLocalFlag[i] != BUFFER_NOT_OWNED) {
err = mWindow->cancel_buffer(mWindow, mBufferHandle[i]);
ALOGD("%s: cancel_buffer: hdl =%p", __func__, (*mBufferHandle[i]));
}
mLocalFlag[i] = BUFFER_NOT_OWNED;
mBufferHandle[i] = NULL;
}
memset(&mMemInfo, 0, sizeof(mMemInfo));
goto end;
}
mPrivateHandle[cnt] =
(struct private_handle_t *)(*mBufferHandle[cnt]);
mMemInfo[cnt].main_ion_fd = open("/dev/ion", O_RDONLY);
if (mMemInfo[cnt].main_ion_fd < 0) {
ALOGE("%s: failed: could not open ion device", __func__);
//.........这里部分代码省略.........
示例10: load_config
int load_config(const char *path, hash_map < string, module_info * >*modules, list < module_info * >*clients) {
char module[1024] = { 0, };
char line[1024] = { 0, };
char indicator = '=';
module_info *cur_mod = NULL;
FILE *file = fopen(path, "r");
if(file == NULL) {
ALOGE("%s open failed\n", path);
return CONFIG_NOT_FOUND_ERR;
}
modules->clear();
clients->clear();
ALOGD("Loading config: %s\n", path);
while(fgets(line, sizeof(line), file) != NULL) {
char name[1024] = { 0, }, value[1024] = {
0,};
if(line[0] == '#')
continue;
if(line[0] == '[') {
parse_module(line, module, sizeof(module));
cur_mod = new module_info(module);
// add module into global list
(*modules)[(string) module] = cur_mod;
clients->push_back(cur_mod);
ALOGD("[%s]\n", module);
continue;
}
if(module[0] != '\0') {
parse_value(line, indicator, name, sizeof(name), value, sizeof(value));
char *pname = trim(name);
char *pvalue = trim(value);
if(*pname != '\0' && *pvalue != '\0') {
/*Initial language */
if(!strcmp(pname, KEY_STR_LANGUAGE)) {
load_lang(pvalue);
}
/*initial font size */
if(!strcmp(pname, KEY_FONTSIZE)) {
set_font_size(pvalue);
}
cur_mod->config_list[(string) pname] = (string) pvalue;
ALOGI("[%s] %s:%s \n", module, pname, pvalue);
}
}
}
fclose(file);
return CONFIG_SUCCESS;
}
示例11: skip_padding
status_t
BackupDataReader::ReadNextHeader(bool *done, int *type) {
*done = m_done;
if (m_status != NO_ERROR) {
return m_status;
}
int amt;
amt = skip_padding();
if (amt == EIO) {
*done = m_done = true;
return NO_ERROR;
} else if (amt != NO_ERROR) {
return amt;
}
amt = read(m_fd, &m_header, sizeof(m_header));
*done = m_done = (amt == 0);
if (*done) {
return NO_ERROR;
}
CHECK_SIZE(amt, sizeof(m_header));
m_pos += sizeof(m_header);
if (type) {
*type = m_header.type;
}
// validate and fix up the fields.
m_header.type = fromlel(m_header.type);
switch (m_header.type) {
case BACKUP_HEADER_ENTITY_V1: {
m_header.entity.keyLen = fromlel(m_header.entity.keyLen);
if (m_header.entity.keyLen <= 0) {
ALOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int) m_pos,
(int) m_header.entity.keyLen);
m_status = EINVAL;
}
m_header.entity.dataSize = fromlel(m_header.entity.dataSize);
m_entityCount++;
// read the rest of the header (filename)
size_t size = m_header.entity.keyLen;
char *buf = m_key.lockBuffer(size);
if (buf == NULL) {
m_status = ENOMEM;
return m_status;
}
int amt = read(m_fd, buf, size + 1);
CHECK_SIZE(amt, (int) size + 1);
m_key.unlockBuffer(size);
m_pos += size + 1;
SKIP_PADDING();
m_dataEndPos = m_pos + m_header.entity.dataSize;
break;
}
default:
ALOGD("Chunk header at %d has invalid type: 0x%08x",
(int) (m_pos - sizeof(m_header)), (int) m_header.type);
m_status = EINVAL;
}
return m_status;
}
示例12: Audio_Record_thread
static void * Audio_Record_thread(void *mPtr)
{
struct mVibrator *hds = (struct mVibrator *)mPtr;
ALOGD(TAG "%s: Start", __FUNCTION__);
usleep(100000);
bool dumpFlag = 0; // read_preferred_recorddump() = 0
// dumpFlag=true;//for test
int magLower = 0,magUpper = 0;
//read_preferred_magnitude(hds->i4OutputType,&magUpper,&magLower);
//int freqOfRingtone = read_preferred_ringtone_freq();
magLower = 1000;
magUpper = 1000000000;
int freqOfRingtone = 200;
int lowFreq = freqOfRingtone * (1-0.1);
int highFreq = freqOfRingtone * (1+0.1);
short pbuffer[8192]={0};
short pbufferL[4096]={0};
short pbufferR[4096]={0};
unsigned int freqDataL[3]={0},magDataL[3]={0};
unsigned int freqDataR[3]={0},magDataR[3]={0};
int checkCnt = 0;
return_data.vibrator.freq = 0;
return_data.vibrator.ampl = 0;
recordInit(hds->recordDevice);
while (1) {
memset(pbuffer,0,sizeof(pbuffer));
memset(pbufferL,0,sizeof(pbufferL));
memset(pbufferR,0,sizeof(pbufferR));
int readSize = readRecordData(pbuffer,8192*2);
int i;
for(i = 0 ; i < 4096 ; i++)
{
pbufferL[i] = pbuffer[2 * i];
pbufferR[i] = pbuffer[2 * i + 1];
}
if(dumpFlag)
{
char filenameL[]="/data/record_dataL.pcm";
char filenameR[]="/data/record_dataR.pcm";
FILE * fpL= fopen(filenameL, "wb+");
FILE * fpR= fopen(filenameR, "wb+");
if(fpL!=NULL)
{
fwrite(pbufferL,readSize/2,1,fpL);
fclose(fpL);
}
if(fpR!=NULL)
{
fwrite(pbufferR,readSize/2,1,fpR);
fclose(fpR);
}
}
memset(freqDataL,0,sizeof(freqDataL));
memset(freqDataR,0,sizeof(freqDataR));
memset(magDataL,0,sizeof(magDataL));
memset(magDataR,0,sizeof(magDataR));
ApplyFFT256(48000,pbufferL,0,freqDataL,magDataL);
ApplyFFT256(48000,pbufferR,0,freqDataR,magDataR);
/*int j;
for(j = 0;j < 3 ;j ++)
{
ALOGD("freqDataL[%d]:%d,magDataL[%d]:%d",j,freqDataL[j],j,magDataL[j]);
ALOGD("freqDataR[%d]:%d,magDataR[%d]:%d",j,freqDataR[j],j,magDataR[j]);
}*/
if (((freqDataL[0] <= highFreq && freqDataL[0] >= lowFreq) && (magDataL[0] <= magUpper && magDataL[0] >= magLower))&&((freqDataR[0] <= highFreq && freqDataR[0] >= lowFreq) && (magDataR[0] <= magUpper && magDataR[0] >= magLower)))
{
checkCnt ++;
if(checkCnt >= 5)
{
sprintf(hds->info + strlen(hds->info),"Check freq pass.\n");
ALOGD(" @ info : %s",hds->info);
break;
}
}
else
checkCnt = 0;
if (hds->exit_thd){
break;
}
}
return_data.vibrator.freq = freqDataL[0];
return_data.vibrator.ampl = magDataL[0];
ALOGD(TAG "VIBRATOR FFT: FreqL = %d, FreqR = %d, AmpL = %d, AmpR = %d", freqDataL[0], freqDataR[0], magDataL[0], magDataR[0]);
ALOGD(TAG "%s: Stop", __FUNCTION__);
pthread_exit(NULL); // thread exit
return NULL;
}
示例13: vibrator_autotest_entry
int vibrator_autotest_entry(struct ftm_param *param, void *priv)
{
char *ptr;
int chosen;
bool exit = false;
struct mVibrator *mc = (struct mVibrator *)priv;
struct textview *tv;
struct itemview *iv;
ALOGD(TAG "--------mAudio_receiver_entry-----------------------\n" );
ALOGD(TAG "%s\n", __FUNCTION__);
init_text(&mc->title, param->name, COLOR_YELLOW);
init_text(&mc->text, "", COLOR_YELLOW);
init_text(&mc->left_btn, uistr_key_fail, COLOR_YELLOW);
init_text(&mc->center_btn, uistr_key_pass, COLOR_YELLOW);
init_text(&mc->right_btn, uistr_key_back, COLOR_YELLOW);
// init Audio
Common_Audio_init();
mc->exit_thd = false;
vibrator_test_exit = false;
// ui start
if (!mc->iv) {
iv = ui_new_itemview();
if (!iv) {
ALOGD(TAG "No memory");
return -1;
}
mc->iv = iv;
}
iv = mc->iv;
iv->set_title(iv, &mc->title);
iv->set_items(iv, items_auto, 0);
iv->set_text(iv, &mc->text);
iv->start_menu(iv,0);
iv->redraw(iv);
memset(mc->info, 0, sizeof(mc->info) / sizeof(*(mc->info)));
mc->i4Playtime = 5*1000;//ms //read_preferred_ringtone_time() = 5
mc->recordDevice = WIRED_HEADSET;
pthread_create(&mc->hHeadsetThread, NULL, update_vibrator_thread, priv);
pthread_create(&mc->hRecordThread, NULL, Audio_Record_thread, priv);
int play_time = mc->i4Playtime;
mc->mod->test_result = FTM_TEST_FAIL;
int i;
for(i = 0; i < 100 ; i ++)
{
//ALOGD("check mc info:%d",i);
if (strstr(mc->info, "Check freq pass"))
{
mc->mod->test_result = FTM_TEST_PASS;
ALOGD("Check freq pass");
break;
}
usleep(play_time * 10);
}
if(mc->mod->test_result == FTM_TEST_FAIL)
ALOGD("Check freq fail");
if(mc->mod->test_result == FTM_TEST_PASS)
usleep(2000000);
mc->exit_thd = true;
vibrator_test_exit = true;
pthread_join(mc->hRecordThread, NULL);
pthread_join(mc->hHeadsetThread, NULL);
Common_Audio_deinit();
LOGD(TAG "%s: End\n", __FUNCTION__);
return 0;
}
示例14: ALOGV
status_t QCameraStream_Rdi::processRdiFrame(
mm_camera_ch_data_buf_t *frame)
{
ALOGV("%s",__func__);
int err = 0;
int msgType = 0;
int i;
camera_memory_t *data = NULL;
Mutex::Autolock lock(mStopCallbackLock);
if(!mActive) {
ALOGE("RDI Streaming Stopped. Returning callback");
return NO_ERROR;
}
if(mHalCamCtrl==NULL) {
ALOGE("%s: X: HAL control object not set",__func__);
/*Call buf done*/
return BAD_VALUE;
}
mHalCamCtrl->mRdiMemoryLock.lock();
mNotifyBuffer[frame->def.idx] = *frame;
mHalCamCtrl->mRdiMemoryLock.unlock();
mHalCamCtrl->mCallbackLock.lock();
camera_data_callback pcb = mHalCamCtrl->mDataCb;
mHalCamCtrl->mCallbackLock.unlock();
ALOGD("Message enabled = 0x%x", mHalCamCtrl->mMsgEnabled);
mHalCamCtrl->dumpFrameToFile(frame->def.frame, HAL_DUMP_FRM_RDI);
#ifdef USE_ION
struct ion_flush_data cache_inv_data;
int ion_fd;
cache_inv_data.vaddr = (void *)frame->def.frame->buffer;
cache_inv_data.fd = frame->def.frame->fd;
cache_inv_data.handle = frame->def.frame->fd_data.handle;
cache_inv_data.length = frame->def.frame->ion_alloc.len;
ion_fd = frame->def.frame->ion_dev_fd;
if (mHalCamCtrl->cache_ops(ion_fd, &cache_inv_data, ION_IOC_CLEAN_CACHES) < 0)
ALOGE("%s: Cache clean for RDI buffer %p fd = %d failed", __func__,
cache_inv_data.vaddr, cache_inv_data.fd);
#endif
if (pcb != NULL) {
//Sending rdi callback if corresponding Msgs are enabled
if(mHalCamCtrl->mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME) {
msgType |= CAMERA_MSG_PREVIEW_FRAME;
data = mHalCamCtrl->mRdiMemory.camera_memory[frame->def.idx];
} else {
data = NULL;
}
if(msgType) {
mStopCallbackLock.unlock();
if(mActive)
pcb(msgType, data, 0, NULL, mHalCamCtrl->mCallbackCookie);
}
ALOGD("end of cb");
}
if(MM_CAMERA_OK != cam_evt_buf_done(mCameraId, &mNotifyBuffer[frame->def.idx])) {
ALOGE("BUF DONE FAILED");
}
return NO_ERROR;
}
示例15: debug_sys
static inline void debug_sys(const char* debuginfo)
{
ALOGD("%s(%s)\n", debuginfo, strerror(errno));
}