fix some bugs for sd read

This commit is contained in:
wuzheng
2022-12-09 13:57:01 +08:00
parent 6fa996d132
commit 2df54e7f41
18 changed files with 2646 additions and 5 deletions

View File

@@ -3,5 +3,9 @@ menuconfig USING_K210_YOLOV2_DETECT
depends on USING_KPU_PROCESSING
default n
config CAMERA_DEV_DRIVER
string "Set camera dev path"
default "/dev/ov2640"

View File

@@ -0,0 +1,4 @@
SRC_FILES := k210_yolov2_detect.c
include $(KERNEL_ROOT)/compiler.mk

View File

@@ -1,7 +1,10 @@
#ifndef _K210_DETECT_H_
#define _K210_DETECT_H_
#include <stdio.h>
#include <string.h>
#include <transform.h>
#include "sleep.h"
void k210_detect(char *json_file_path);

View File

@@ -0,0 +1,4 @@
SRC_FILES := region_layer.c
include $(KERNEL_ROOT)/compiler.mk

View File

@@ -224,7 +224,7 @@ static void get_region_boxes(region_layer_t *rl, float *predictions, float **pro
correct_region_boxes(rl, boxes);
}
static int nms_comparator(void *pa, void *pb)
static int nms_comparator(const void *pa,const void *pb)
{
sortable_box_t a = *(sortable_box_t *)pa;
sortable_box_t b = *(sortable_box_t *)pb;

View File

@@ -0,0 +1,4 @@
SRC_FILES := json_parser.c
include $(KERNEL_ROOT)/compiler.mk

View File

@@ -1,6 +1,9 @@
#include "json_parser.h"
#include <fcntl.h>
// #include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <transform.h>
#include "cJSON.h"
@@ -31,9 +34,9 @@ yolov2_params_t param_parse(char *json_file_path)
} else {
printf("Reading config from: %s\n", json_file_path);
}
read(fin, buffer, sizeof(buffer));
close(fin);
// read json string
json_obj = cJSON_Parse(buffer);
// free(buffer);

View File

@@ -73,6 +73,12 @@ typedef int pid_t;
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
int pthread_attr_init(pthread_attr_t *attr);
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size);
int pthread_attr_setschedparam(pthread_attr_t *attr,struct sched_param const *param);
int pthread_attr_setstack(pthread_attr_t *attr,
void *stack_base,
size_t stack_size);
void pthread_exit(void *value_ptr);
int pthread_detach(pthread_t thread);
int pthread_join(pthread_t thread, void **retval);

View File

@@ -22,6 +22,10 @@
#include <stdio.h>
#include "include/pthread.h"
#define DEFAULT_STACK_SIZE 2048
#define DEFAULT_PRIORITY (KTASK_PRIORITY_MAX/2 + KTASK_PRIORITY_MAX/4)
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg)
{
@@ -55,6 +59,27 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
}
int pthread_attr_init(pthread_attr_t *attr)
{
return 0;
}
int pthread_attr_setschedparam(pthread_attr_t *attr,
struct sched_param const *param)
{
NULL_PARAM_CHECK(attr != NULL);
NULL_PARAM_CHECK(param != NULL);
attr->schedparam.sched_priority = param->sched_priority;
return 0;
}
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size)
{
return 0;
}
void pthread_exit(void *value_ptr){
//todo add exit value
UserTaskQuit();