Add support for barcode scanners.

This commit is contained in:
Raviprasad V Mummidi 2012-02-08 16:17:30 -08:00
parent 3a583827ec
commit d076eb6e19
2 changed files with 31 additions and 3 deletions

View File

@ -4,6 +4,7 @@ include $(call all-subdir-makefiles)
include $(CLEAR_VARS)
LOCAL_C_FLAGS += -O3
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM)

View File

@ -158,6 +158,31 @@ CameraHAL_CopyBuffers_Hw(int srcFd, int destFd,
close(fb_fd);
}
void
CameraHAL_CopyBuffers_Sw(char *dest, char *src, int size)
{
int i;
int numWords = size / sizeof(unsigned);
unsigned *srcWords = (unsigned *)src;
unsigned *destWords = (unsigned *)dest;
for (i = 0; i < numWords; i++) {
if ((i % 8) == 0 && (i + 8) < numWords) {
__builtin_prefetch(srcWords + 8, 0, 0);
__builtin_prefetch(destWords + 8, 1, 0);
}
*destWords++ = *srcWords++;
}
if (__builtin_expect((size - (numWords * sizeof(unsigned))) > 0, 0)) {
int numBytes = size - (numWords * sizeof(unsigned));
char *destBytes = (char *)destWords;
char *srcBytes = (char *)srcWords;
for (i = 0; i < numBytes; i++) {
*destBytes++ = *srcBytes++;
}
}
}
void
CameraHAL_HandlePreviewData(const android::sp<android::IMemory>& dataPtr,
preview_stream_ops_t *mWindow,
@ -227,7 +252,8 @@ CameraHAL_GenClientData(const android::sp<android::IMemory> &dataPtr,
clientData = reqClientMemory(-1, size, 1, user);
if (clientData != NULL) {
memcpy(clientData->data, (char *)(mHeap->base()) + offset, size);
CameraHAL_CopyBuffers_Sw((char *)clientData->data,
(char *)(mHeap->base()) + offset, size);
} else {
LOGV("CameraHAL_GenClientData: ERROR allocating memory from client\n");
}
@ -245,7 +271,8 @@ CameraHAL_DataCb(int32_t msg_type, const android::sp<android::IMemory>& dataPtr,
hwParameters.getPreviewSize(&previewWidth, &previewHeight);
CameraHAL_HandlePreviewData(dataPtr, mWindow, origCamReqMemory,
previewWidth, previewHeight);
} else if (origData_cb != NULL && origCamReqMemory != NULL) {
}
if (origData_cb != NULL && origCamReqMemory != NULL) {
camera_memory_t *clientData = CameraHAL_GenClientData(dataPtr,
origCamReqMemory, user);
if (clientData != NULL) {
@ -259,7 +286,7 @@ void
CameraHAL_DataTSCb(nsecs_t timestamp, int32_t msg_type,
const android::sp<android::IMemory>& dataPtr, void *user)
{
LOGD("CameraHAL_DataTSCb: timestamp:%lld msg_type:%d user:%p\n",
LOGV("CameraHAL_DataTSCb: timestamp:%lld msg_type:%d user:%p\n",
timestamp /1000, msg_type, user);
if (origDataTS_cb != NULL && origCamReqMemory != NULL) {