v1.1.1
@@ -8,5 +8,6 @@ source "packages/artinchip/ota/Kconfig"
|
||||
source "packages/artinchip/burn-in/Kconfig"
|
||||
source "packages/artinchip/aic-authorization/Kconfig"
|
||||
source "packages/artinchip/ipmanager/Kconfig"
|
||||
source "packages/artinchip/barcode/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -7,7 +7,7 @@ cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
prio = ['ota', 'aic-startup-ui', 'lvgl-ui']
|
||||
prio = ['env', 'aic-startup-ui', 'lvgl-ui']
|
||||
remain_dirs = [d for d in list if d not in prio]
|
||||
|
||||
for d in prio:
|
||||
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image0.jpg
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image1.jpg
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image10.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image11.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image12.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image2.jpg
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image3.jpg
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image4.jpg
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image5.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image6.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image7.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image8.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
packages/artinchip/aic-startup-ui/assets_480x272/image9.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
@@ -29,9 +29,24 @@
|
||||
#include "stddef.h"
|
||||
|
||||
#define PATH_MAX 1024
|
||||
|
||||
#ifdef LPKG_CHERRYUSB_DEVICE_DISPLAY_TEMPLATE
|
||||
#define AIC_STARTUP_UI_SHOW_LVGL_LOGO
|
||||
|
||||
#ifdef AIC_LVGL_USB_OSD_DEMO
|
||||
#error "Not support turn on LVGL USB OSD DEMO and Startup UI at the same time"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef AIC_STARTUP_UI_SHOW_LVGL_LOGO
|
||||
#define IMAGE_EXTENSION ".png"
|
||||
#define IMAGE_CATALOG "/data/lvgl_data"
|
||||
#define IMAGE_PATH_ROOT "/data/lvgl_data/logo.png"
|
||||
#else
|
||||
#define IMAGE_EXTENSION ".jpg"
|
||||
#define IMAGE_CATALOG "/data"
|
||||
#define IMAGE_PATH_ROOT "/data/image"
|
||||
#endif
|
||||
|
||||
#ifdef AIC_STARTUP_UI_POS_X
|
||||
#define IMAGE_SCREEN_POS_X AIC_STARTUP_UI_POS_X
|
||||
@@ -132,7 +147,6 @@ static struct frame_allocator *allocator_open(u8 *buf, u32 x, u32 y)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef USE_VE_FILL_FB
|
||||
static int ge_bitblt(struct ge_bitblt *blt)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -164,11 +178,13 @@ static int ge_bitblt(struct ge_bitblt *blt)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (AIC_PAN_DISPLAY) && !defined(USE_VE_FILL_FB)
|
||||
#ifdef AIC_PAN_DISPLAY
|
||||
static u32 fb_copy_index = 0;
|
||||
#ifndef USE_VE_FILL_FB
|
||||
static u32 startup_fb_buf_index = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static struct aicfb_screeninfo *get_screen_info(void)
|
||||
{
|
||||
@@ -263,6 +279,52 @@ static void render_frame(struct mpp_fb* fb, struct mpp_frame* frame,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AIC_PAN_DISPLAY
|
||||
static void framebuffer_copy(int buffer_index)
|
||||
{
|
||||
struct ge_bitblt blt;
|
||||
struct aicfb_screeninfo *info = NULL;;
|
||||
|
||||
info = get_screen_info();
|
||||
if (info == NULL)
|
||||
return;
|
||||
|
||||
u32 fb0_buf_addr0 = (u32)(unsigned long)info->framebuffer;;
|
||||
u32 fb0_buf_addr1 = fb0_buf_addr0 + info->smem_len;;
|
||||
|
||||
memset(&blt, 0, sizeof(struct ge_bitblt));
|
||||
|
||||
if (buffer_index == 0) {
|
||||
blt.src_buf.phy_addr[0] = fb0_buf_addr0;
|
||||
} else {
|
||||
blt.src_buf.phy_addr[0] = fb0_buf_addr1;
|
||||
}
|
||||
blt.src_buf.buf_type = MPP_PHY_ADDR;
|
||||
blt.src_buf.format = info->format;
|
||||
blt.src_buf.stride[0] = info->stride;
|
||||
blt.src_buf.size.width = info->width;
|
||||
blt.src_buf.size.height = info->height;
|
||||
blt.src_buf.crop_en = 0;
|
||||
|
||||
if (buffer_index == 0) {
|
||||
blt.dst_buf.phy_addr[0] = fb0_buf_addr1;
|
||||
} else {
|
||||
blt.dst_buf.phy_addr[0] = fb0_buf_addr0;
|
||||
}
|
||||
blt.dst_buf.buf_type = MPP_PHY_ADDR;
|
||||
blt.dst_buf.format = info->format;
|
||||
blt.dst_buf.stride[0] = info->stride;
|
||||
blt.dst_buf.size.width = info->width;
|
||||
blt.dst_buf.size.height = info->height;
|
||||
blt.dst_buf.crop_en = 0;
|
||||
|
||||
logi("phy_addr: %x, stride: %d", blt.src_buf.phy_addr[0], blt.src_buf.stride[0]);
|
||||
logi("width: %d, height: %d, format: %d", blt.src_buf.size.width, blt.src_buf.size.height, blt.src_buf.format);
|
||||
|
||||
ge_bitblt(&blt);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int decode_pic_from_path(const char *path, u32 offset_x, u32 offset_y,
|
||||
u32 width, u32 height, u32 layer_id, bool is_first_img)
|
||||
{
|
||||
@@ -308,11 +370,18 @@ static int decode_pic_from_path(const char *path, u32 offset_x, u32 offset_y,
|
||||
#ifdef USE_VE_FILL_FB
|
||||
config.pix_fmt = info->format;
|
||||
#else
|
||||
config.pix_fmt = MPP_FMT_RGB_565;
|
||||
config.pix_fmt = MPP_FMT_NV12;
|
||||
#endif
|
||||
|
||||
if (pic[0] == 0xff && pic[1] == 0xd8) {
|
||||
dec = mpp_decoder_create(MPP_CODEC_VIDEO_DECODER_MJPEG);
|
||||
} else if (pic[1] == 'P' || pic[2] == 'N' || pic[3] == 'G') {
|
||||
if (config.pix_fmt == MPP_FMT_RGB_565 || config.pix_fmt == MPP_FMT_BGR_565) {
|
||||
loge("PNG decode does nor support RGB565\n");
|
||||
free(pic);
|
||||
return -1;
|
||||
}
|
||||
dec = mpp_decoder_create(MPP_CODEC_VIDEO_DECODER_PNG);
|
||||
} else {
|
||||
loge("Unsupported or invalid image format\n");
|
||||
free(pic);
|
||||
@@ -398,7 +467,12 @@ static int count_images(const char *directoryPath)
|
||||
|
||||
static void construct_imagepath(char *outputBuffer, int image_number)
|
||||
{
|
||||
#ifdef AIC_STARTUP_UI_SHOW_LVGL_LOGO
|
||||
(void)image_number;
|
||||
snprintf(outputBuffer, PATH_MAX, "%s", IMAGE_PATH_ROOT);
|
||||
#else
|
||||
snprintf(outputBuffer, PATH_MAX, "%s%d%s", IMAGE_PATH_ROOT, image_number, IMAGE_EXTENSION);
|
||||
#endif
|
||||
}
|
||||
|
||||
int startup_ui_show(void)
|
||||
@@ -437,6 +511,15 @@ int startup_ui_show(void)
|
||||
decode_pic_from_path(image_path, IMAGE_SCREEN_POS_X, IMAGE_SCREEN_POS_Y, 0, 0, AICFB_LAYER_TYPE_UI, false);
|
||||
}
|
||||
}
|
||||
#ifdef AIC_PAN_DISPLAY
|
||||
if ((image_count % 2) == 0) {
|
||||
/* frame buffer copy */
|
||||
framebuffer_copy(!fb_copy_index);
|
||||
/* switch to frame buffer 0 */
|
||||
mpp_fb_ioctl(startup_ui->startup_fb, AICFB_PAN_DISPLAY, &fb_copy_index);
|
||||
mpp_fb_ioctl(startup_ui->startup_fb, AICFB_WAIT_FOR_VSYNC, NULL);
|
||||
}
|
||||
#endif
|
||||
free(startup_ui);
|
||||
|
||||
return 0;
|
||||
|
||||
3
packages/artinchip/barcode/Kconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
menuconfig AIC_USING_BARCODE_DEMO
|
||||
bool "ArtInChip Barcode Demo"
|
||||
default n
|
||||
17
packages/artinchip/barcode/SConscript
Executable file
@@ -0,0 +1,17 @@
|
||||
Import('AIC_ROOT')
|
||||
Import('PRJ_KERNEL')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = []
|
||||
src = []
|
||||
|
||||
LIBS = ['decoder.a']
|
||||
LIBPATH = [cwd + "/lib/"]
|
||||
|
||||
if GetDepend('AIC_USING_BARCODE_DEMO'):
|
||||
src = Glob('*.c')
|
||||
|
||||
group = DefineGroup('aic_barcode_demo', src, depend = ['AIC_USING_BARCODE_DEMO'], CPPPATH = CPPPATH, LIBS=LIBS, LIBPATH=LIBPATH)
|
||||
|
||||
Return('group')
|
||||
525
packages/artinchip/barcode/barcode.c
Normal file
@@ -0,0 +1,525 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: matteo <duanmt@artinchip.com>
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <posix/string.h>
|
||||
#include <drivers/pin.h>
|
||||
|
||||
#include "aic_core.h"
|
||||
#include "aic_log.h"
|
||||
#include "aic_osal.h"
|
||||
#include "aic_drv_gpio.h"
|
||||
#include "include/yydecoder.h"
|
||||
#include "include/video_font_data.h"
|
||||
|
||||
#include "mpp_vin.h"
|
||||
#include "drv_camera.h"
|
||||
#include "artinchip_fb.h"
|
||||
#include "mpp_fb.h"
|
||||
#include "mpp_ge.h"
|
||||
|
||||
#define BARCODE_DEMO_SUCCESS 1
|
||||
#define BUFFER_SIZE 180 * 1024
|
||||
#define VID_BUF_NUM 3
|
||||
#define VID_BUF_PLANE_NUM 2
|
||||
#define VID_SCALE_OFFSET 0
|
||||
#define VIDEO_FONT_HEIGHT 32
|
||||
|
||||
#define ALIGN_DOWM(x, align) ((x) & ~(align - 1))
|
||||
|
||||
struct aic_dvp_data {
|
||||
int w;
|
||||
int h;
|
||||
int frame_size;
|
||||
int frame_cnt;
|
||||
int rotation;
|
||||
int dst_fmt; // output format
|
||||
struct mpp_video_fmt src_fmt;
|
||||
uint32_t num_buffers;
|
||||
struct vin_video_buf binfo;
|
||||
};
|
||||
|
||||
struct aic_decode_data {
|
||||
bool dready;
|
||||
int w;
|
||||
int h;
|
||||
unsigned char *in_buffer;
|
||||
unsigned char out_buffer[256];
|
||||
};
|
||||
|
||||
static struct mpp_fb *g_fb = NULL;
|
||||
static struct aicfb_screeninfo g_fb_info = {0};
|
||||
|
||||
static struct aic_dvp_data g_vdata = {0};
|
||||
static struct aic_decode_data g_ddata = {0};
|
||||
static bool g_dvp_running = true;
|
||||
static bool g_running = true;
|
||||
unsigned char g_last_barcode[128] = {0};
|
||||
|
||||
static int dvp_cfg(int width, int height, int format)
|
||||
{
|
||||
int ret = 0;
|
||||
struct dvp_out_fmt f = {0};
|
||||
|
||||
f.width = g_vdata.src_fmt.width;
|
||||
f.height = g_vdata.src_fmt.height;
|
||||
f.pixelformat = format;
|
||||
f.num_planes = VID_BUF_PLANE_NUM;
|
||||
|
||||
ret = mpp_dvp_ioctl(DVP_OUT_S_FMT, &f);
|
||||
if (ret < 0) {
|
||||
pr_err("ioctl() failed! err -%d\n", -ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvp_subdev_set_fmt(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = mpp_dvp_ioctl(DVP_IN_S_FMT, &g_vdata.src_fmt);
|
||||
if (ret < 0) {
|
||||
pr_err("ioctl() failed! err -%d\n", -ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_get_fmt(void)
|
||||
{
|
||||
int ret = 0;
|
||||
struct mpp_video_fmt f = {0};
|
||||
|
||||
ret = mpp_dvp_ioctl(DVP_IN_G_FMT, &f);
|
||||
if (ret < 0) {
|
||||
pr_err("ioctl() failed! err -%d\n", -ret);
|
||||
// return -1;
|
||||
}
|
||||
|
||||
g_vdata.src_fmt = f;
|
||||
g_vdata.w = g_vdata.src_fmt.width;
|
||||
g_vdata.h = g_vdata.src_fmt.height;
|
||||
pr_info("Sensor format: w %d h %d, code 0x%x, bus 0x%x, colorspace 0x%x\n",
|
||||
f.width, f.height, f.code, f.bus_type, f.colorspace);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvp_request_buf(struct vin_video_buf *vbuf)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (mpp_dvp_ioctl(DVP_REQ_BUF, (void *)vbuf) < 0) {
|
||||
pr_err("ioctl() failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pr_info("Buf Plane[0] size Plane[1] size\n");
|
||||
for (i = 0; i < vbuf->num_buffers; i++) {
|
||||
pr_info("%3d 0x%x %8d 0x%x %8d\n", i,
|
||||
vbuf->planes[i * vbuf->num_planes].buf,
|
||||
vbuf->planes[i * vbuf->num_planes].len,
|
||||
vbuf->planes[i * vbuf->num_planes + 1].buf,
|
||||
vbuf->planes[i * vbuf->num_planes + 1].len);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dvp_release_buf(int num)
|
||||
{
|
||||
#if 0
|
||||
int i;
|
||||
struct video_buf_info *binfo = NULL;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
binfo = &g_vdata.binfo[i];
|
||||
if (binfo->vaddr) {
|
||||
munmap(binfo->vaddr, binfo->len);
|
||||
binfo->vaddr = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int dvp_queue_buf(int index)
|
||||
{
|
||||
if (mpp_dvp_ioctl(DVP_Q_BUF, (void *)(ptr_t)index) < 0) {
|
||||
pr_err("ioctl() failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvp_dequeue_buf(int *index)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = mpp_dvp_ioctl(DVP_DQ_BUF, (void *)index);
|
||||
if (ret < 0) {
|
||||
pr_err("ioctl() failed! err -%d\n", -ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvp_start(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = mpp_dvp_ioctl(DVP_STREAM_ON, NULL);
|
||||
if (ret < 0) {
|
||||
pr_err("ioctl() failed! err -%d\n", -ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvp_stop(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = mpp_dvp_ioctl(DVP_STREAM_OFF, NULL);
|
||||
if (ret < 0) {
|
||||
pr_err("ioctl() failed! err -%d\n", -ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void barcode_copy_buffer(struct aic_dvp_data *vdata, int index)
|
||||
{
|
||||
struct vin_video_buf *binfo = &vdata->binfo;
|
||||
unsigned long buf = binfo->planes[index * VID_BUF_PLANE_NUM].buf;
|
||||
int len = binfo->planes[index * VID_BUF_PLANE_NUM].len;
|
||||
|
||||
aicos_memcpy(g_ddata.in_buffer, (void *)buf, len);
|
||||
g_ddata.dready = true;
|
||||
}
|
||||
|
||||
static int barcode_showvideo_tolcd(struct aic_dvp_data *vdata, int index)
|
||||
{
|
||||
int i;
|
||||
struct aicfb_layer_data layer = {0};
|
||||
struct vin_video_buf *binfo = &vdata->binfo;
|
||||
|
||||
layer.layer_id = AICFB_LAYER_TYPE_VIDEO;
|
||||
layer.enable = 1;
|
||||
|
||||
layer.scale_size.width = g_fb_info.width - VID_SCALE_OFFSET * 2;
|
||||
layer.scale_size.height = g_fb_info.height - VID_SCALE_OFFSET * 2;
|
||||
layer.pos.x = VID_SCALE_OFFSET;
|
||||
layer.pos.y = VID_SCALE_OFFSET;
|
||||
|
||||
layer.buf.size.width = vdata->w;
|
||||
layer.buf.size.height = vdata->h;
|
||||
layer.buf.format = MPP_FMT_NV12;
|
||||
|
||||
layer.buf.buf_type = MPP_PHY_ADDR;
|
||||
|
||||
for (i = 0; i < VID_BUF_PLANE_NUM; i++) {
|
||||
layer.buf.stride[i] = layer.buf.size.width;
|
||||
layer.buf.phy_addr[i] = binfo->planes[index * VID_BUF_PLANE_NUM + i].buf;
|
||||
}
|
||||
|
||||
if (mpp_fb_ioctl(g_fb, AICFB_UPDATE_LAYER_CONFIG, &layer) < 0) {
|
||||
pr_err("ioctl() failed!\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void aicfb_lcd_putc(unsigned int x, unsigned int y, char ch)
|
||||
{
|
||||
unsigned long dcache_size, dcache_start;
|
||||
int pbytes = g_fb_info.bits_per_pixel / 8;
|
||||
int i, row;
|
||||
void *line;
|
||||
|
||||
line = (unsigned char *)(g_fb_info.framebuffer + y * g_fb_info.stride + x * pbytes);
|
||||
dcache_start = ALIGN_DOWM((unsigned long)line, ARCH_DMA_MINALIGN);
|
||||
|
||||
for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
|
||||
unsigned int idx = (ch - 32) * VIDEO_FONT_HEIGHT + row;
|
||||
uint32_t bits = video_fontdata[idx];
|
||||
|
||||
uint16_t *dst = line;
|
||||
|
||||
for (i = 0; i < VIDEO_FONT_WIDTH; i++) {
|
||||
*dst++ = (bits & 0x80000000) ? 0xFFFF : 0x0000;
|
||||
bits <<= 1;
|
||||
}
|
||||
|
||||
line += g_fb_info.stride;
|
||||
}
|
||||
|
||||
dcache_size = ALIGN_UP((unsigned long)line - dcache_start,
|
||||
ARCH_DMA_MINALIGN);
|
||||
aicos_dcache_clean_range((unsigned long *)dcache_start, dcache_size);
|
||||
}
|
||||
|
||||
static int barcode_set_ui_layer_alpha(int val)
|
||||
{
|
||||
int ret = BARCODE_DEMO_SUCCESS;
|
||||
struct aicfb_alpha_config alpha = {0};
|
||||
|
||||
alpha.layer_id = AICFB_LAYER_TYPE_UI;
|
||||
alpha.enable = 1;
|
||||
alpha.mode = 1;
|
||||
alpha.value = val;
|
||||
ret = mpp_fb_ioctl(g_fb, AICFB_UPDATE_ALPHA_CONFIG, &alpha);
|
||||
if (ret < 0)
|
||||
pr_err("ioctl() failed! errno: -%d\n", -ret);
|
||||
return BARCODE_DEMO_SUCCESS;
|
||||
}
|
||||
|
||||
static int show_barcode_tolcd(int len)
|
||||
{
|
||||
int font_width = 32;
|
||||
int i,startx;
|
||||
startx = 10;
|
||||
if(strcmp((char *)g_last_barcode, (char *)(g_ddata.out_buffer)) == 0){
|
||||
//pr_info("same, not shshow !\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(g_fb_info.framebuffer,0, g_fb_info.smem_len);
|
||||
aicos_dcache_clean_range(g_fb_info.framebuffer, g_fb_info.smem_len);
|
||||
|
||||
for (i = 0; i < len; i ++)
|
||||
aicfb_lcd_putc(startx + (i * font_width), 60, g_ddata.out_buffer[i]);
|
||||
|
||||
strcpy((char *)g_last_barcode, (char *)(g_ddata.out_buffer));
|
||||
|
||||
pr_info("GetDecoderResult %d [%s] \n", len, g_ddata.out_buffer);
|
||||
return BARCODE_DEMO_SUCCESS;
|
||||
}
|
||||
|
||||
static void show_duration_tolcd(char* buf, int len)
|
||||
{
|
||||
int font_width = 30;
|
||||
int i,startx;
|
||||
startx = 10;
|
||||
|
||||
for (i = 0; i < len -1; i ++)
|
||||
aicfb_lcd_putc(startx + (i * font_width), 150, buf[i]);
|
||||
|
||||
pr_info("duration %d [%s] \n", buf);
|
||||
}
|
||||
|
||||
static void barcode_shotting_thread()
|
||||
{
|
||||
int index = 0;
|
||||
int i;
|
||||
|
||||
if (dvp_request_buf(&g_vdata.binfo) < 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < VID_BUF_NUM; i++) {
|
||||
if (dvp_queue_buf(i) < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dvp_start() < 0)
|
||||
return;
|
||||
|
||||
g_dvp_running = true;
|
||||
while (g_dvp_running) {
|
||||
if (dvp_dequeue_buf(&index) < 0)
|
||||
break;
|
||||
|
||||
barcode_showvideo_tolcd(&g_vdata, index);
|
||||
|
||||
if( !g_ddata.dready)
|
||||
barcode_copy_buffer(&g_vdata, index);
|
||||
|
||||
dvp_queue_buf(index);
|
||||
}
|
||||
|
||||
g_running = false;
|
||||
dvp_stop();
|
||||
dvp_release_buf(g_vdata.binfo.num_buffers);
|
||||
mpp_vin_deinit();
|
||||
}
|
||||
|
||||
static void barcode_decode_thread()
|
||||
{
|
||||
int ret;
|
||||
int len = 0;
|
||||
struct timespec begin, end;
|
||||
char str_duration[64] = {0};
|
||||
float diff_duration;
|
||||
g_running = true;
|
||||
|
||||
while(g_running){
|
||||
|
||||
if( g_ddata.dready){
|
||||
gettimespec(&begin);
|
||||
ret = Decoding_Image(g_ddata.in_buffer, g_ddata.w, g_ddata.h);
|
||||
//pr_info("Decoding_Image with %d [%d, %d] \n", ret, g_ddata.w, g_ddata.h);
|
||||
|
||||
len = GetResultLength();
|
||||
//pr_info("GetResultLength with %d\n", len);
|
||||
|
||||
ret = GetDecoderResult(g_ddata.out_buffer);
|
||||
//pr_info("GetDecoderResult with %d \n", ret);
|
||||
if(len > 0){
|
||||
gettimespec(&end);
|
||||
//show_timespec_diff("decode", NULL, &begin, &end);
|
||||
if(show_barcode_tolcd(len) == BARCODE_DEMO_SUCCESS){
|
||||
diff_duration = timespec_diff(&begin, &end);
|
||||
sprintf(str_duration, "Time: %d ms\n", (u32)(diff_duration * MS_PER_SEC) % MS_PER_SEC);
|
||||
show_duration_tolcd(str_duration, strlen(str_duration));
|
||||
memset(str_duration, 0, sizeof(str_duration));
|
||||
}
|
||||
}
|
||||
}
|
||||
g_ddata.dready = false;
|
||||
aicos_msleep(500);
|
||||
}
|
||||
|
||||
if (g_fb) {
|
||||
mpp_fb_close(g_fb);
|
||||
g_fb = NULL;
|
||||
}
|
||||
aicos_free(MEM_CMA, g_ddata.in_buffer);
|
||||
ret = 0;
|
||||
pr_info("exit with ret = %d \n", ret);
|
||||
}
|
||||
|
||||
static int init_dvp_device()
|
||||
{
|
||||
memset(&g_vdata, 0, sizeof(struct aic_dvp_data));
|
||||
g_vdata.dst_fmt = MPP_FMT_NV12;
|
||||
g_vdata.frame_cnt = 1;
|
||||
|
||||
if (mpp_vin_init(CAMERA_DEV_NAME))
|
||||
return -1;
|
||||
|
||||
if (sensor_get_fmt() < 0)
|
||||
goto error_out;
|
||||
|
||||
if (dvp_subdev_set_fmt() < 0)
|
||||
goto error_out;
|
||||
|
||||
g_vdata.frame_size = (g_vdata.w * g_vdata.h * 3) >> 1;
|
||||
|
||||
if (dvp_cfg(g_vdata.w, g_vdata.h, g_vdata.dst_fmt) < 0)
|
||||
goto error_out;
|
||||
|
||||
g_vdata.num_buffers = VID_BUF_NUM;
|
||||
|
||||
return BARCODE_DEMO_SUCCESS;
|
||||
|
||||
error_out:
|
||||
mpp_vin_deinit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int init_screen_fb()
|
||||
{
|
||||
int ret = 0;
|
||||
g_fb = mpp_fb_open();
|
||||
|
||||
ret = mpp_fb_ioctl(g_fb, AICFB_GET_SCREENINFO, &g_fb_info);
|
||||
if (ret < 0){
|
||||
pr_err("ioctl() failed! errno: -%d\n", -ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(g_fb_info.framebuffer,0, g_fb_info.smem_len);
|
||||
aicos_dcache_clean_range(g_fb_info.framebuffer, g_fb_info.smem_len);
|
||||
|
||||
ret = mpp_fb_ioctl(g_fb, AICFB_POWERON, &g_fb_info);
|
||||
if (ret < 0){
|
||||
pr_err("ioctl() failed! errno: -%d\n", -ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pr_info("Screen width: %d, height %d\n", g_fb_info.width, g_fb_info.height);
|
||||
|
||||
return BARCODE_DEMO_SUCCESS;
|
||||
}
|
||||
|
||||
static void cmd_barcode_demo(int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
aicos_thread_t thid = NULL;
|
||||
|
||||
ret = init_screen_fb();
|
||||
if(ret != BARCODE_DEMO_SUCCESS){
|
||||
pr_info("init_screen_fb failed with %d \n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = barcode_set_ui_layer_alpha(64);
|
||||
if(ret != BARCODE_DEMO_SUCCESS){
|
||||
pr_info("set_ui_layer_alpha failed with %d \n", ret);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
ret = init_dvp_device();
|
||||
if(ret != BARCODE_DEMO_SUCCESS){
|
||||
pr_info("init_dvp_device failed with %d \n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
g_ddata.w = g_vdata.w;
|
||||
g_ddata.h = g_vdata.h;
|
||||
g_ddata.dready = false;
|
||||
g_running = true;
|
||||
|
||||
g_ddata.in_buffer = aicos_malloc(MEM_CMA, g_ddata.w * g_ddata.w * 2);
|
||||
|
||||
ret = Initial_Decoder();
|
||||
if(ret != BARCODE_DEMO_SUCCESS){
|
||||
pr_info("Initial_Decoder failed with %d \n", ret);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i <= 13; i++) {
|
||||
Set_Donfig_Decoder(i, 1);
|
||||
}
|
||||
|
||||
|
||||
thid = aicos_thread_create("shoting_thead", 8192, 0, barcode_shotting_thread, NULL);
|
||||
if (thid == NULL) {
|
||||
pr_err("Failed to create DVP thread\n");
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
thid = aicos_thread_create("barcode_thread", 1024 * 32, 0, barcode_decode_thread, NULL);
|
||||
if (thid == NULL) {
|
||||
pr_err("Failed to create decode thread\n");
|
||||
goto error_out;
|
||||
}
|
||||
return;
|
||||
|
||||
error_out:
|
||||
if (g_fb) {
|
||||
mpp_fb_close(g_fb);
|
||||
g_fb = NULL;
|
||||
}
|
||||
aicos_free(MEM_CMA, g_ddata.in_buffer);
|
||||
}
|
||||
static int barcode_demo()
|
||||
{
|
||||
cmd_barcode_demo(0, NULL);
|
||||
return 0;
|
||||
}
|
||||
INIT_LATE_APP_EXPORT (barcode_demo);
|
||||
|
||||
9818
packages/artinchip/barcode/include/video_font_data.h
Normal file
8
packages/artinchip/barcode/include/yydecoder.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
unsigned int Initial_Decoder();
|
||||
int Decoding_Image(unsigned char* img_buffer, int width, int height);
|
||||
unsigned int GetResultLength();
|
||||
int GetDecoderResult(unsigned char * result);
|
||||
void Set_Donfig_Decoder(int type, int tag);
|
||||
BIN
packages/artinchip/barcode/lib/libdecoder.a
Normal file
5
packages/artinchip/env/SConscript
vendored
@@ -8,7 +8,10 @@ CPPPATH = [cwd]
|
||||
src = []
|
||||
|
||||
if GetDepend('AIC_ENV_INTERFACE'):
|
||||
src = Glob('*.c')
|
||||
src += Glob('env.c')
|
||||
|
||||
if GetDepend('AIC_AB_SYSTEM_INTERFACE') and not GetDepend('AIC_BOOTLOADER'):
|
||||
src += Glob('absystem_os.c')
|
||||
|
||||
group = DefineGroup('env', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <aic_core.h>
|
||||
#include <env.h>
|
||||
#include <absystem.h>
|
||||
#include <absystem_os.h>
|
||||
#include <dfs.h>
|
||||
#include <dfs_fs.h>
|
||||
#include <boot_param.h>
|
||||
@@ -6,8 +6,8 @@
|
||||
* Authors: xuan.wen <xuan.wen@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef __ABSYSTEM_H__
|
||||
#define __ABSYSTEM_H__
|
||||
#ifndef __ABSYSTEM_OS_H__
|
||||
#define __ABSYSTEM_OS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -86,9 +86,9 @@ static void camera_ui_cb(lv_event_t * e)
|
||||
#if defined(AIC_CHIP_D12X)
|
||||
if (LV_HOR_RES == 480)
|
||||
return;
|
||||
#endif
|
||||
if (LV_HOR_RES == 1024)
|
||||
return;
|
||||
#endif
|
||||
app_entrance(APP_CAMERA, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
cc_flages = ""
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
cc_flages += " -DAIC_LVGL_QC_TEST_DEMO "
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH, CFLAGS = cc_flages)
|
||||
|
||||
Return('group')
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_board.h"
|
||||
|
||||
#if AIC_1603
|
||||
#if QC_BOARD_D133B
|
||||
char *board_script = "Board: D133BXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"D133BAS",
|
||||
"D133BBS",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_D133C == 1
|
||||
char *board_script = "Board: D133CXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"D133CBS",
|
||||
"D133CCS1",
|
||||
"D133CCS2",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_D133E == 1
|
||||
char *board_script = "Board: D133EXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"D133EBS",
|
||||
"D133ECS1",
|
||||
"D133ECS2",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_D132E == 1
|
||||
char *board_script = "Board: D132EXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"D132ENS",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_G730C == 1
|
||||
char *board_script = "Board: G730CXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"G730CES",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_G730E == 1
|
||||
char *board_script = "Board: G730CXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"G730EES",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_G730B == 1
|
||||
char *board_script = "Board: G730BXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"G730BDU",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_M6801 == 1
|
||||
char *board_script = "Board: M6801XX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"M6801SPCS",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_M6806 == 1
|
||||
char *board_script = "Board: M6806XX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"M6806SPES",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_DR128 == 1
|
||||
char *board_script = "Board: DR128XX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"DR128",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_JYX68 == 1
|
||||
char *board_script = "Board: JYX68XX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"JYX68",
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* AIC_1603 */
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
|
||||
#if QC_BOARD_D133B
|
||||
#define BOARD_NAME "D133B"
|
||||
|
||||
extern qc_res_t d133b_gpai_0_test(void *param);
|
||||
extern qc_res_t d133b_gpai_1_test(void *param);
|
||||
extern qc_res_t d133b_gpai_4_test(void *param);
|
||||
extern qc_res_t d133b_gpai_5_test(void *param);
|
||||
|
||||
qc_mod_init_base_t board_init_base[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", NULL, 0},
|
||||
{"GPIO", "GPIO R-W comparison", NULL, 0},
|
||||
{"GPAI", "GPAI Read comparison", NULL, 0},
|
||||
{"CARD", "CARD R-W comparison", NULL, 0},
|
||||
{"DSPK", "DISP Write comparison", NULL, 0},
|
||||
{"UART", "UART R-W comparison", NULL, 0},
|
||||
{"SAVE", "SAVE Results to Sd card", NULL, 0},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
qc_mod_init_list_pos_t board_init_list_pos[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", 0, NULL, common_compare_chip_intel_module,QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"GPIO", "GROUP2", 0, "test_gpio -t 10 -i PB.8 -o PB.9", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP2", 0, "test_gpio -t 10 -i PB.9 -o PB.8", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP5", 1, "test_gpio -t 10 -i PB.10 -o PB.11", NULL,QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP5", 1, "test_gpio -t 10 -i PB.11 -o PB.10", NULL,QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP6", 2, "test_gpio -t 10 -i PB.6 -o PB.7", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP6", 2, "test_gpio -t 10 -i PB.7 -o PB.6", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"GPAI", "GPAI0", 0, NULL, d133b_gpai_0_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI1", 1, NULL, d133b_gpai_1_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI4", 2, NULL, d133b_gpai_4_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI5", 3, NULL, d133b_gpai_5_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"CARD", "CARD", 0, NULL, common_sdcard_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"DSPK", "DSPK", 0, "aplay sound0 /data/lvgl_data/qc-test/assets/commond/du.wav", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"UART", "UART1", 0, NULL, common_uart_test, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"SAVE", "SAVE Udisk", 0, NULL, common_qc_save_chip, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{NULL, NULL, 0, NULL, NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
qc_exec_ops_order_init_t board_exec_order[] = {
|
||||
{"SID", 0},
|
||||
{"GPIO", 0}, {"GPIO", 1}, {"GPIO", 2},
|
||||
{"GPAI", 0}, {"GPAI", 1}, {"GPAI", 2}, {"GPAI", 3},
|
||||
{"CARD", 0},
|
||||
{"DSPK", 0},
|
||||
{"UART", 0},
|
||||
{"SAVE", 0},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
qc_save_init_t board_save_list[] = {
|
||||
{"/sdcard/qc_save/"BOARD_NAME"/", SDCARD_DEV, 0},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
qc_env_init_list_t board_list_env[] = {
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
#endif
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
|
||||
#if QC_BOARD_D133B
|
||||
#if QC_OS_RT_THREAD
|
||||
static qc_res_t d133b_gpai_0_cmp(int msh_result);
|
||||
static qc_res_t d133b_gpai_1_cmp(int msh_result);
|
||||
static qc_res_t d133b_gpai_4_cmp(int msh_result);
|
||||
static qc_res_t d133b_gpai_5_cmp(int msh_result);
|
||||
|
||||
qc_res_t d133b_gpai_0_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 0 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133b_gpai_0_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133b_gpai_1_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 1 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133b_gpai_1_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133b_gpai_4_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 4 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133b_gpai_4_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133b_gpai_5_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 5 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133b_gpai_5_cmp(msh_result);
|
||||
}
|
||||
|
||||
static qc_res_t d133b_gpai_0_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 2.0, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133b_gpai_1_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 1.5, 0.015);
|
||||
}
|
||||
|
||||
static qc_res_t d133b_gpai_4_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 1.0, 0.015);
|
||||
}
|
||||
|
||||
static qc_res_t d133b_gpai_5_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 0.5, 0.065);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_LINUX == 0
|
||||
qc_res_t d133b_gpai_0_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133b_gpai_1_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133b_gpai_4_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133b_gpai_5_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
#if QC_BOARD_D133C
|
||||
#define BOARD_NAME "D133C"
|
||||
|
||||
extern qc_res_t d133c_gpai_0_test(void *param);
|
||||
extern qc_res_t d133c_gpai_1_test(void *param);
|
||||
extern qc_res_t d133c_gpai_2_test(void *param);
|
||||
extern qc_res_t d133c_gpai_3_test(void *param);
|
||||
extern qc_res_t d133c_gpai_4_test(void *param);
|
||||
extern qc_res_t d133c_gpai_5_test(void *param);
|
||||
|
||||
qc_mod_init_base_t board_init_base[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", NULL, 0},
|
||||
{"GPIO", "GPIO R-W comparison", NULL, 0},
|
||||
{"GPAI", "GPAI Read comparison", NULL, 0},
|
||||
{"CARD", "CARD R-W comparison", NULL, 0},
|
||||
{"DSPK", "DSPK Write comparison", NULL, 0},
|
||||
{"UART", "UART R-W comparison", NULL, 0},
|
||||
{"MAC", "MAC R-W comparison", NULL, 0},
|
||||
{"RTC", "RTC R-W comparison", NULL, 0},
|
||||
{"USB", "USB R-W comparison", NULL, 0},
|
||||
{"SAVE", "SAVE Results to Udisk", NULL, 0},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
qc_mod_init_list_pos_t board_init_list_pos[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", 0, NULL, common_compare_chip_intel_module, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"GPIO", "GROUP0", 0, "test_gpio -t 10 -i PB.8 -o PB.9", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP0", 0, "test_gpio -t 10 -i PB.9 -o PB.8", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP1", 1, "test_gpio -t 10 -i PD.9 -o PD.10", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP1", 1, "test_gpio -t 10 -i PD.10 -o PD.9", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP2", 2, "test_gpio -t 10 -i PD.11 -o PD.12", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP2", 2, "test_gpio -t 10 -i PD.12 -o PD.11", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP3", 3, "test_gpio -t 10 -i PD.13 -o PD.14", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP3", 3, "test_gpio -t 10 -i PD.14 -o PD.13", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP4", 4, "test_gpio -t 10 -i PD.15 -o PD.16", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP4", 4, "test_gpio -t 10 -i PD.16 -o PD.15", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP5", 5, "test_gpio -t 10 -i PE.12 -o PE.13", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP5", 5, "test_gpio -t 10 -i PE.13 -o PE.12", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"GPAI", "GPAI0", 0, NULL, d133c_gpai_0_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI1", 1, NULL, d133c_gpai_1_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI2", 2, NULL, d133c_gpai_2_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI3", 3, NULL, d133c_gpai_3_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI4", 4, NULL, d133c_gpai_4_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI5", 5, NULL, d133c_gpai_5_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"CARD", "CARD", 0, NULL, common_sdcard_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"DSPK", "DSPK", 0, "aplay sound0 /data/lvgl_data/qc-test/assets/commond/du.wav", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"RTC", "RTC", 0, NULL, common_rtc_module_test_start, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"RTC", "RTC", 1, NULL, common_rtc_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"UART", "UART0", 0, "test_uart -u uart0 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"UART", "UART2", 1, "test_uart -u uart2 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"UART", "UART5", 2, "test_uart -u uart5 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"UART", "UART7", 3, "test_uart -u uart7 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"MAC", "MAC", 0, NULL, common_mac_test_disp_testing, QC_MOD_NOT_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"MAC", "MAC", 0, NULL, common_mac_wait_start_up, QC_MOD_NOT_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"MAC", "MAC", 0, "test_eth -d 10 -n 10", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"USB", "USB", 0, NULL, common_usb_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"SAVE", "SAVE Udisk", 0, NULL, common_qc_save_chip, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{NULL, NULL, 0, NULL, NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
qc_exec_ops_order_init_t board_exec_order[] = {
|
||||
{"SID", 0},
|
||||
{"RTC", 0},
|
||||
{"GPIO", 0}, {"GPIO", 1}, {"GPIO", 2}, {"GPIO", 3}, {"GPIO", 4}, {"GPIO", 5},
|
||||
{"GPAI", 0}, {"GPAI", 1}, {"GPAI", 2}, {"GPAI", 3}, {"GPAI", 4}, {"GPAI", 5},
|
||||
{"CARD", 0},
|
||||
{"DSPK", 0},
|
||||
{"UART", 0}, {"UART", 1}, {"UART", 2}, {"UART", 3},
|
||||
{"MAC", 0},
|
||||
{"RTC", 1},
|
||||
{"USB", 0},
|
||||
{"SAVE", 0},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
qc_save_init_t board_save_list[] = {
|
||||
{"/udisk/qc_save/"BOARD_NAME"/", USB_DEV, 0},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
qc_env_init_list_t board_list_env[] = {
|
||||
{NULL, common_rtc_module_test_init, 0},
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
#endif
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
|
||||
#if QC_BOARD_D133C
|
||||
#if QC_OS_RT_THREAD
|
||||
static qc_res_t d133c_gpai_0_cmp(int msh_result);
|
||||
static qc_res_t d133c_gpai_1_cmp(int msh_result);
|
||||
static qc_res_t d133c_gpai_2_cmp(int msh_result);
|
||||
static qc_res_t d133c_gpai_3_cmp(int msh_result);
|
||||
static qc_res_t d133c_gpai_4_cmp(int msh_result);
|
||||
static qc_res_t d133c_gpai_5_cmp(int msh_result);
|
||||
|
||||
qc_res_t d133c_gpai_0_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 0 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133c_gpai_0_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_1_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 1 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133c_gpai_1_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_2_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 2 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133c_gpai_2_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_3_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 3 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133c_gpai_3_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_4_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 4 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133c_gpai_4_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_5_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 5 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133c_gpai_5_cmp(msh_result);
|
||||
}
|
||||
|
||||
static qc_res_t d133c_gpai_0_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 2.14, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133c_gpai_1_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 1.79, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133c_gpai_2_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 1.43, 0.015);
|
||||
}
|
||||
|
||||
static qc_res_t d133c_gpai_3_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 1.07, 0.015);
|
||||
}
|
||||
|
||||
static qc_res_t d133c_gpai_4_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 0.71, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133c_gpai_5_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 0.36, 0.065);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_LINUX == 0
|
||||
qc_res_t d133c_gpai_0_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_1_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_2_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_3_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_4_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133c_gpai_5_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
#if QC_BOARD_D133E
|
||||
#define BOARD_NAME "D133E"
|
||||
|
||||
extern qc_res_t d133e_gpai_0_test(void *param);
|
||||
extern qc_res_t d133e_gpai_1_test(void *param);
|
||||
extern qc_res_t d133e_gpai_2_test(void *param);
|
||||
extern qc_res_t d133e_gpai_3_test(void *param);
|
||||
extern qc_res_t d133e_gpai_4_test(void *param);
|
||||
extern qc_res_t d133e_gpai_5_test(void *param);
|
||||
extern qc_res_t d133e_gpai_6_test(void *param);
|
||||
extern qc_res_t d133e_gpai_7_test(void *param);
|
||||
|
||||
qc_mod_init_base_t board_init_base[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", NULL, 0},
|
||||
{"GPIO", "GPIO R-W comparison", NULL, 0},
|
||||
{"GPAI", "GPAI Read comparison", NULL, 0},
|
||||
{"CARD", "CARD R-W comparison", NULL, 0},
|
||||
{"CAN", "CAN R-W comparison", NULL, 0},
|
||||
{"DSPK", "DSPK Write comparison", NULL, 0},
|
||||
{"UART", "UART R-W comparison", NULL, 0},
|
||||
{"MAC", "MAC R-W comparison", NULL, 0},
|
||||
{"RTC", "RTC R-W comparison", NULL, 0},
|
||||
{"USB", "USB R-W comparison", NULL, 0},
|
||||
{"SAVE", "SAVE Results to Udisk", NULL, 0},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
qc_mod_init_list_pos_t board_init_list_pos[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", 0, NULL, common_compare_chip_intel_module, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"GPIO", "GROUP0", 0, "test_gpio -t 10 -i PB.8 -o PB.9", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP0", 0, "test_gpio -t 10 -i PB.9 -o PB.8", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP1", 1, "test_gpio -t 10 -i PD.9 -o PD.10", NULL,QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP1", 1, "test_gpio -t 10 -i PD.10 -o PD.9", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP2", 2, "test_gpio -t 10 -i PD.11 -o PD.12", NULL,QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP2", 2, "test_gpio -t 10 -i PD.12 -o PD.11", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP3", 3, "test_gpio -t 10 -i PD.13 -o PD.14", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP3", 3, "test_gpio -t 10 -i PD.14 -o PD.13", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP4", 4, "test_gpio -t 10 -i PD.15 -o PD.16", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP4", 4, "test_gpio -t 10 -i PD.16 -o PD.15", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP5", 5, "test_gpio -t 10 -i PE.12 -o PE.13", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP5", 5, "test_gpio -t 10 -i PE.13 -o PE.12", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP6", 6, "test_gpio -t 10 -i PE.16 -o PE.17", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP6", 6, "test_gpio -t 10 -i PE.17 -o PE.16", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP7", 7, "test_gpio -t 10 -i PC.7 -o PE.11", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP7", 7, "test_gpio -t 10 -i PE.11 -o PC.7", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"GPAI", "GPAI0", 0, NULL, d133e_gpai_0_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI1", 1, NULL, d133e_gpai_1_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI2", 2, NULL, d133e_gpai_2_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI3", 3, NULL, d133e_gpai_3_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI4", 4, NULL, d133e_gpai_4_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI5", 5, NULL, d133e_gpai_5_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI6", 6, NULL, d133e_gpai_6_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI7", 7, NULL, d133e_gpai_7_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"CARD", "CARD", 0, NULL, common_sdcard_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"CAN", "CARD0", 0, "test_can can0 1a3#11.22.9a.88.ef.00", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"CAN", "CARD1", 1, "test_can can1 1a3#11.22.33.44.55.66.77.88", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"DSPK", "DSPK", 0, "aplay sound0 /data/lvgl_data/qc-test/assets/commond/du.wav", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"RTC", "RTC", 0, NULL, common_rtc_module_test_start, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"RTC", "RTC", 1, NULL, common_rtc_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"UART", "UART0", 0, "test_uart -u uart0 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"UART", "UART2", 1, "test_uart -u uart2 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"UART", "UART5", 2, "test_uart -u uart5 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"UART", "UART6", 3, "test_uart -u uart6 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"UART", "UART7", 4, "test_uart -u uart7 -t 2000", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"MAC", "MAC", 0, NULL, common_mac_test_disp_testing, QC_MOD_NOT_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"MAC", "MAC", 0, NULL, common_mac_wait_start_up, QC_MOD_NOT_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"MAC", "MAC", 0, "test_eth -d 10 -n 10", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"USB", "USB", 0, NULL, common_usb_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"SAVE", "SAVE Udisk", 0, NULL, common_qc_save_chip, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{NULL, NULL, 0, NULL, NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
qc_exec_ops_order_init_t board_exec_order[] = {
|
||||
{"SID", 0},
|
||||
{"RTC", 0},
|
||||
{"GPIO", 0}, {"GPIO", 1}, {"GPIO", 2}, {"GPIO", 3}, {"GPIO", 4}, {"GPIO", 5}, {"GPIO", 6}, {"GPIO", 7},
|
||||
{"GPAI", 0}, {"GPAI", 1}, {"GPAI", 2}, {"GPAI", 3}, {"GPAI", 4}, {"GPAI", 5}, {"GPAI", 6}, {"GPAI", 7},
|
||||
{"CARD", 0},
|
||||
{"CAN", 0}, {"CAN", 1},
|
||||
{"DSPK", 0},
|
||||
{"UART", 0}, {"UART", 1}, {"UART", 2}, {"UART", 3}, {"UART", 4},
|
||||
{"MAC", 0},
|
||||
{"RTC", 1},
|
||||
{"USB", 0},
|
||||
{"SAVE", 0},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
qc_save_init_t board_save_list[] = {
|
||||
{"/udisk/qc_save/"BOARD_NAME"/", USB_DEV, 0},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
qc_env_init_list_t board_list_env[] = {
|
||||
{NULL, common_rtc_module_test_init, 0},
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
#endif
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
#if QC_BOARD_D133E
|
||||
#if QC_OS_RT_THREAD
|
||||
static qc_res_t d133e_gpai_0_cmp(int msh_result);
|
||||
static qc_res_t d133e_gpai_1_cmp(int msh_result);
|
||||
static qc_res_t d133e_gpai_2_cmp(int msh_result);
|
||||
static qc_res_t d133e_gpai_3_cmp(int msh_result);
|
||||
static qc_res_t d133e_gpai_4_cmp(int msh_result);
|
||||
static qc_res_t d133e_gpai_5_cmp(int msh_result);
|
||||
static qc_res_t d133e_gpai_6_cmp(int msh_result);
|
||||
static qc_res_t d133e_gpai_7_cmp(int msh_result);
|
||||
|
||||
qc_res_t d133e_gpai_0_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 0 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_0_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_1_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 1 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_1_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_2_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 2 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_2_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_3_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 3 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_3_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_4_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 4 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_4_cmp(msh_result);
|
||||
}
|
||||
qc_res_t d133e_gpai_5_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 5 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_5_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_6_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 6 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_6_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_7_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 7 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d133e_gpai_7_cmp(msh_result);
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_0_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 2.1429, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_1_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 1.7857, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_2_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 1.4268, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_3_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 1.0714, 0.015);
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_4_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 0.7143, 0.015);;
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_5_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 0.3571, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_6_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 1.6667, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d133e_gpai_7_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 0.8333, 0.065);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_LINUX == 0
|
||||
|
||||
qc_res_t d133e_gpai_0_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_1_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_2_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_3_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_4_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
qc_res_t d133e_gpai_5_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_6_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d133e_gpai_7_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_board.h"
|
||||
|
||||
#if AIC_1605
|
||||
#if QC_BOARD_D12XX
|
||||
char *board_script = "Board: D12XXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"D121BAV",
|
||||
"D121BBV",
|
||||
"D122BAV",
|
||||
"D122BBV",
|
||||
"D122BCV1",
|
||||
"D122BCV2",
|
||||
"TR230",
|
||||
"JYX58",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_D121B == 1
|
||||
char *board_script = "Board: D121BXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"D121BAV",
|
||||
"D121BBV",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_D122B == 1
|
||||
char *board_script = "Board: D122BXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"D122BAV",
|
||||
"D122BBV",
|
||||
"D122BCV1",
|
||||
"D122BCV2",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_TR23X == 1
|
||||
char *board_script = "Board: TR23XX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"TR230",
|
||||
NULL
|
||||
};
|
||||
#elif QC_BOARD_JYX58 == 1
|
||||
char *board_script = "Board: JYXXX";
|
||||
char *board_chip_intel_list[] = {
|
||||
"JYX58",
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* AIC_1605 */
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
#if QC_BOARD_D12XX
|
||||
#define BOARD_NAME "D12XX"
|
||||
|
||||
extern qc_res_t d12xx_gpai_0_test(void *param);
|
||||
extern qc_res_t d12xx_gpai_1_test(void *param);
|
||||
extern qc_res_t d12xx_gpai_4_test(void *param);
|
||||
extern qc_res_t d12xx_gpai_5_test(void *param);
|
||||
|
||||
qc_mod_init_base_t board_init_base[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", NULL, 0},
|
||||
{"GPIO", "GPIO R-W comparison", NULL, 0},
|
||||
{"GPAI", "GPAI Read comparison", NULL, 0},
|
||||
{"CARD", "CARD R-W comparison", NULL, 0},
|
||||
{"DSPK", "DISP Write comparison", NULL, 0},
|
||||
{"UART", "UART R-W comparison", NULL, 0},
|
||||
{"SAVE", "SAVE Results to Udisk", NULL, 0},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
qc_mod_init_list_pos_t board_init_list_pos[] = {
|
||||
{"SID", BOARD_NAME"XX R comparison", 0, NULL, common_compare_chip_intel_module, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"GPIO", "GROUP0", 0, "test_gpio -t 10 -i PB.6 -o PB.7", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP0", 0, "test_gpio -t 10 -i PB.7 -o PB.6", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP1", 1, "test_gpio -t 10 -i PB.8 -o PB.9", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP1", 1, "test_gpio -t 10 -i PB.9 -o PB.8", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP2", 2, "test_gpio -t 10 -i PB.10 -o PB.11", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
{"GPIO", "GROUP2", 2, "test_gpio -t 10 -i PB.11 -o PB.10", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"GPAI", "GPAI0", 0, NULL, d12xx_gpai_0_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI1", 1, NULL, d12xx_gpai_1_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI4", 2, NULL, d12xx_gpai_4_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
{"GPAI", "GPAI5", 3, NULL, d12xx_gpai_5_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"CARD", "CARD", 0, NULL, common_sdcard_module_test, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{"DSPK", "DSPK", 0, "aplay sound0 /data/lvgl_data/qc-test/assets/commond/du.wav", NULL, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"UART", "UART1", 0, NULL, common_uart_test, QC_MOD_RECORD, QC_MOD_NOT_RECORD, 0},
|
||||
|
||||
{"SAVE", "SAVE Udisk", 0, NULL, common_qc_save_chip, QC_MOD_NOT_RECORD, QC_MOD_RECORD, 0},
|
||||
|
||||
{NULL, NULL, 0, NULL, NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
qc_exec_ops_order_init_t board_exec_order[] = {
|
||||
{"SID", 0},
|
||||
{"GPIO", 0}, {"GPIO", 1}, {"GPIO", 2},
|
||||
{"GPAI", 0}, {"GPAI", 1}, {"GPAI", 2}, {"GPAI", 3},
|
||||
{"CARD", 0},
|
||||
{"DSPK", 0},
|
||||
{"UART", 0},
|
||||
{"SAVE", 0},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
qc_save_init_t board_save_list[] = {
|
||||
{"/sdcard/qc_save/"BOARD_NAME"/", SDCARD_DEV, 0},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
qc_env_init_list_t board_list_env[] = {
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
#endif
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_board.h"
|
||||
#include "../common/common_test.h"
|
||||
#if QC_BOARD_D12XX
|
||||
#if QC_OS_RT_THREAD
|
||||
static qc_res_t d12xx_gpai_0_cmp(int msh_result);
|
||||
static qc_res_t d12xx_gpai_1_cmp(int msh_result);
|
||||
static qc_res_t d12xx_gpai_4_cmp(int msh_result);
|
||||
static qc_res_t d12xx_gpai_5_cmp(int msh_result);
|
||||
|
||||
qc_res_t d12xx_gpai_0_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 0 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d12xx_gpai_0_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d12xx_gpai_1_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 1 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d12xx_gpai_1_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d12xx_gpai_4_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 4 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d12xx_gpai_4_cmp(msh_result);
|
||||
}
|
||||
|
||||
qc_res_t d12xx_gpai_5_test(void *param)
|
||||
{
|
||||
int msh_result;
|
||||
|
||||
msh_result = qc_cmd_exec_ex("test_gpai -n 1 -c 5 -t 2.5", NULL, 0, 0, NULL, NULL);
|
||||
return d12xx_gpai_5_cmp(msh_result);
|
||||
}
|
||||
|
||||
static qc_res_t d12xx_gpai_0_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 2.0, 0.065);
|
||||
}
|
||||
|
||||
static qc_res_t d12xx_gpai_1_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 1.5, 0.015);
|
||||
}
|
||||
|
||||
static qc_res_t d12xx_gpai_4_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_percentage_error_voltage(input_mv, 1.0, 0.015);
|
||||
}
|
||||
|
||||
static qc_res_t d12xx_gpai_5_cmp(int msh_result)
|
||||
{
|
||||
float input_mv = (float)msh_result;
|
||||
return gpai_calculate_range_error_voltage(input_mv, 0.5, 0.065);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_LINUX == 0
|
||||
qc_res_t d12xx_gpai_0_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d12xx_gpai_1_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d12xx_gpai_4_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t d12xx_gpai_5_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,246 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "common_test.h"
|
||||
|
||||
#define AIC_GPAI_VOLTAGE_ACCURACY 10000
|
||||
#define AIC_GPAI_VOLITAGE_REFERENCE 2.5
|
||||
#define RTC_TEST_TIME 5
|
||||
|
||||
static char write_buff[512];
|
||||
#if QC_OS_RT_THREAD
|
||||
#include <sys/stat.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
qc_res_t gpai_calculate_range_error_voltage(float input_voltage, float reference_voltage, float voltage)
|
||||
{
|
||||
if (abs(input_voltage - (reference_voltage * AIC_GPAI_VOLTAGE_ACCURACY)) > (voltage * AIC_GPAI_VOLTAGE_ACCURACY)) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t gpai_calculate_percentage_error_voltage(float input_voltage, float reference_voltage, float percentage)
|
||||
{
|
||||
if (abs(input_voltage - (reference_voltage * AIC_GPAI_VOLTAGE_ACCURACY)) / AIC_GPAI_VOLITAGE_REFERENCE > (percentage * AIC_GPAI_VOLTAGE_ACCURACY)) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_sdcard_module_test(void *param)
|
||||
{
|
||||
const char *file_name = "/sdcard/sd_text.txt";
|
||||
return qc_block_dev_test(file_name, write_buff, sizeof(write_buff));
|
||||
}
|
||||
|
||||
qc_res_t common_usb_module_test(void *param)
|
||||
{
|
||||
const char *file_name = "/udisk/udisk_text.txt";
|
||||
return qc_block_dev_test(file_name, write_buff, sizeof(write_buff));
|
||||
}
|
||||
|
||||
qc_res_t common_qc_save_chip(void *param)
|
||||
{
|
||||
struct qc_board_config *board = (struct qc_board_config *)(param);
|
||||
|
||||
return qc_save_write(board);
|
||||
}
|
||||
|
||||
qc_res_t common_compare_chip_intel_module(void *param)
|
||||
{
|
||||
char chip_intel_module[DESC_LEN] = {0};
|
||||
qc_board_config_t *board_config = (qc_board_config_t *)param;
|
||||
|
||||
qc_read_chip_intel_model(chip_intel_module, sizeof(chip_intel_module));
|
||||
if (strncmp(chip_intel_module, board_config->chip_intel_module, DESC_LEN - 1) == 0)
|
||||
return QC_RES_OK;
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
#ifdef AIC_RTC_DRV
|
||||
static int last_hour = 0;
|
||||
static int last_min = 0;
|
||||
static int last_sec = 0;
|
||||
|
||||
qc_res_t common_rtc_module_test_init(void *param)
|
||||
{
|
||||
if (set_date(2024, 3, 20) != RT_EOK) {
|
||||
printf("set RTC date failed");
|
||||
return QC_RES_INV;
|
||||
}
|
||||
rt_thread_mdelay(1);
|
||||
if (set_time(00, 00, 00) != RT_EOK) {
|
||||
printf("set RTC time failed");
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_rtc_module_test_start(void *param)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *local_time;
|
||||
|
||||
now = time(RT_NULL);
|
||||
local_time = localtime(&now);
|
||||
last_hour = local_time->tm_hour;
|
||||
last_min = local_time->tm_min;
|
||||
last_sec = local_time->tm_sec;
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_rtc_module_test(void *param)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *local_time;
|
||||
|
||||
now = time(RT_NULL);
|
||||
local_time = localtime(&now);
|
||||
if (abs(local_time->tm_year + 1900 - 2024) > 0 ||
|
||||
abs(local_time->tm_mon + 1 - 3) > 0 ||
|
||||
abs(local_time->tm_mday - 20) > 0) {
|
||||
return QC_RES_INV;
|
||||
} else {
|
||||
int now_seconds = local_time->tm_hour *3600 + local_time->tm_min * 60 + local_time->tm_sec;
|
||||
int last_seconds = last_hour * 3600 + last_min * 60 + last_sec;
|
||||
if (abs(last_seconds - now_seconds) > RTC_TEST_TIME) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
}
|
||||
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#else
|
||||
qc_res_t common_rtc_module_test_init(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_rtc_module_test_start(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_rtc_module_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AIC_USING_GMAC0
|
||||
#include "lwip/netif.h"
|
||||
qc_res_t common_mac_test_disp_testing(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_mac_wait_start_up(void *param)
|
||||
{
|
||||
int timeout = 1000;
|
||||
while ((!netif_is_link_up(netif_default)) || (timeout > 0)) {
|
||||
rt_thread_mdelay(50);
|
||||
timeout -= 50;
|
||||
if (timeout < 0)
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#else
|
||||
qc_res_t common_mac_test_disp_testing(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_mac_wait_start_up(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
qc_res_t common_uart_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
#else
|
||||
qc_res_t gpai_calculate_range_error_voltage(float input_voltage, float reference_voltage, float voltage)
|
||||
{
|
||||
if (abs(input_voltage - (reference_voltage * AIC_GPAI_VOLTAGE_ACCURACY)) > (voltage * AIC_GPAI_VOLTAGE_ACCURACY)) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t gpai_calculate_percentage_error_voltage(float input_voltage, float reference_voltage, float percentage)
|
||||
{
|
||||
if (abs(input_voltage - (reference_voltage * AIC_GPAI_VOLTAGE_ACCURACY)) / AIC_GPAI_VOLITAGE_REFERENCE > (percentage * AIC_GPAI_VOLTAGE_ACCURACY)) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_sdcard_module_test(void *param)
|
||||
{
|
||||
const char *file_name = "./sd_text.txt";
|
||||
return qc_block_dev_test(file_name, write_buff, sizeof(write_buff));
|
||||
}
|
||||
|
||||
qc_res_t common_usb_module_test(void *param)
|
||||
{
|
||||
const char *file_name = "./udisk_text.txt";
|
||||
return qc_block_dev_test(file_name, write_buff, sizeof(write_buff));
|
||||
}
|
||||
|
||||
qc_res_t common_qc_save_chip(void *param)
|
||||
{
|
||||
struct qc_board_config *board = (struct qc_board_config *)(param);
|
||||
|
||||
return qc_save_write(board);
|
||||
}
|
||||
|
||||
qc_res_t common_compare_chip_intel_module(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_rtc_module_test_init(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_rtc_module_test_start(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_rtc_module_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_mac_test_disp_testing(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_mac_wait_start_up(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t common_uart_test(void *param)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_board.h"
|
||||
|
||||
qc_res_t gpai_calculate_range_error_voltage(float input_voltage, float reference_voltage, float voltage);
|
||||
qc_res_t gpai_calculate_percentage_error_voltage(float input_voltage, float reference_voltage, float percentage);
|
||||
|
||||
qc_res_t common_sdcard_module_test(void *param);
|
||||
qc_res_t common_usb_module_test(void *param);
|
||||
qc_res_t common_rtc_module_test_init(void *param);
|
||||
qc_res_t common_rtc_module_test_start(void *param);
|
||||
qc_res_t common_rtc_module_test(void *param);
|
||||
qc_res_t common_mac_test_disp_testing(void *param);
|
||||
qc_res_t common_mac_wait_start_up(void *param);
|
||||
qc_res_t common_uart_test(void *param);
|
||||
qc_res_t common_qc_save_chip(void *param);
|
||||
qc_res_t common_compare_chip_intel_module(void *param);
|
||||
@@ -1,222 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "qc_board.h"
|
||||
|
||||
static qc_res_t qc_board_get_chip_id(char *buf, int buf_len);
|
||||
static qc_module_t *name_to_module(qc_module_t *module_list[], int module_list_num, char *name);
|
||||
static void _qc_board_env_init(qc_env_init_list_t *list_env);
|
||||
static qc_board_config_t* _qc_board_tests_create(char *board_describe,
|
||||
char *chip_intel_list[],
|
||||
qc_mod_init_base_t *base,
|
||||
qc_mod_init_list_pos_t *list_pos);
|
||||
static qc_res_t _qc_board_ops_push(qc_board_config_t* board, qc_exec_ops_order_init_t *order);
|
||||
|
||||
extern char *board_script;
|
||||
extern char *board_chip_intel_list[];
|
||||
extern qc_env_init_list_t board_list_env[];
|
||||
extern qc_mod_init_base_t board_init_base[];
|
||||
extern qc_mod_init_list_pos_t board_init_list_pos[];
|
||||
extern qc_exec_ops_order_init_t board_exec_order[];
|
||||
|
||||
qc_board_config_t* qc_board_tests_create(void)
|
||||
{
|
||||
_qc_board_env_init(board_list_env);
|
||||
return _qc_board_tests_create(board_script, board_chip_intel_list, board_init_base, board_init_list_pos);
|
||||
}
|
||||
|
||||
qc_res_t qc_board_ops_push(qc_board_config_t* board)
|
||||
{
|
||||
return _qc_board_ops_push(board, board_exec_order);
|
||||
}
|
||||
|
||||
qc_res_t qc_board_ops_clear(qc_board_config_t* board)
|
||||
{
|
||||
return qc_manager_clear_status(board->manager);
|
||||
}
|
||||
|
||||
static qc_module_t *name_to_module(qc_module_t *module_list[], int module_list_num, char *name)
|
||||
{
|
||||
for (int i = 0; i < module_list_num; i++) {
|
||||
if (strncmp(name, module_list[i]->name, strlen(name)) == 0) {
|
||||
return module_list[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static qc_board_config_t* _qc_board_tests_create(char *board_describe,
|
||||
char *chip_intel_list[],
|
||||
qc_mod_init_base_t *base,
|
||||
qc_mod_init_list_pos_t *list_pos)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
qc_board_config_t* board = NULL;
|
||||
board = (qc_board_config_t *)malloc(sizeof(qc_board_config_t));
|
||||
if (board == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
memset(board, 0, sizeof(qc_board_config_t));
|
||||
|
||||
int module_num = 0;
|
||||
while (1) {
|
||||
if (base[module_num].name != NULL)
|
||||
module_num++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
qc_module_t **module_list = (qc_module_t **)malloc(sizeof(qc_module_t) * module_num);
|
||||
if (module_list == NULL)
|
||||
return NULL;
|
||||
memset(module_list, 0, sizeof(qc_module_t) * module_num);
|
||||
|
||||
qc_manager_t *mgr = qc_manager_create();
|
||||
if (mgr == NULL) {
|
||||
free(board);
|
||||
free(module_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* init chip id */
|
||||
qc_board_get_chip_id(board->chip_id, 64);
|
||||
|
||||
/* init chip intel module */
|
||||
int chip_list_num = 0;
|
||||
while (1) {
|
||||
if (chip_intel_list[chip_list_num] != NULL)
|
||||
chip_list_num++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < chip_list_num; i++) {
|
||||
strncpy(board->chip_intel_module_list[i], chip_intel_list[i], DESC_LEN - 1);
|
||||
board->chip_intel_module_list_num++;
|
||||
}
|
||||
if (qc_read_chip_intel_model_file(board->chip_intel_module, DESC_LEN - 1) == QC_RES_INV) {
|
||||
strncpy(board->chip_intel_module, chip_intel_list[0], DESC_LEN - 1);
|
||||
qc_write_chip_intel_module_file(board->chip_intel_module);
|
||||
}
|
||||
|
||||
/* init base */
|
||||
for (i = 0; i < module_num; i++) {
|
||||
module_list[i] = qc_module_create();
|
||||
qc_module_set_name(module_list[i], base[i].name);
|
||||
qc_module_set_desc(module_list[i], base[i].desc);
|
||||
qc_module_set_log(module_list[i], base[i].log_buf, base[i].log_buf_len);
|
||||
if ((strncmp(list_pos[i].name, "SID", strlen("SID")) == 0)) {
|
||||
char sid_list_ops_desc[64] = {0};
|
||||
snprintf(sid_list_ops_desc, sizeof(sid_list_ops_desc), "%s R comparison", board->chip_intel_module);
|
||||
qc_module_set_desc(module_list[i], sid_list_ops_desc);
|
||||
}
|
||||
}
|
||||
|
||||
/* init list pos */
|
||||
qc_module_t *mod = NULL;
|
||||
int list_pos_num = 0;
|
||||
while (1) {
|
||||
if (list_pos[list_pos_num].name != NULL)
|
||||
list_pos_num++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < list_pos_num; i++) {
|
||||
mod = name_to_module(module_list, module_num, list_pos[i].name);
|
||||
qc_module_list_ops_set_desc(mod, list_pos[i].list_pos, list_pos[i].list_ops_desc);
|
||||
qc_module_list_ops_cmd_append(mod, list_pos[i].list_pos, list_pos[i].list_ops_cmd, list_pos[i].list_ops_cmd_record,
|
||||
NULL, NULL);
|
||||
qc_module_list_ops_set_runtime(mod, list_pos[i].list_pos, list_pos[i].list_ops_runtime);
|
||||
/* qc_save special deal with */
|
||||
if (strncmp(list_pos[i].name, "SAVE", strlen("SAVE")) == 0 || strncmp(list_pos[i].name, "SID", strlen("SID")) == 0)
|
||||
qc_module_list_ops_func_append(mod, list_pos[i].list_pos, list_pos[i].list_ops_func, board,
|
||||
list_pos[i].list_ops_func_record, NULL, NULL);
|
||||
else
|
||||
qc_module_list_ops_func_append(mod, list_pos[i].list_pos, list_pos[i].list_ops_func, NULL,
|
||||
list_pos[i].list_ops_func_record, NULL, NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < module_num; i++) {
|
||||
qc_manager_module_append(mgr, module_list[i]);
|
||||
qc_module_delete(module_list[i]);
|
||||
}
|
||||
|
||||
board->board_describe = board_describe;
|
||||
board->manager = mgr;
|
||||
|
||||
return board;
|
||||
}
|
||||
|
||||
static void _qc_board_env_init(qc_env_init_list_t *list_env)
|
||||
{
|
||||
int env_list_num = 0, i = 0;
|
||||
while (1) {
|
||||
if (list_env[env_list_num].cmd == NULL && list_env[env_list_num].func == NULL)
|
||||
break;
|
||||
else
|
||||
env_list_num++;
|
||||
}
|
||||
|
||||
qc_list_ops_func_t func = NULL;
|
||||
for (i = 0; i < env_list_num; i++) {
|
||||
if (list_env[i].cmd != NULL)
|
||||
qc_cmd_exec(list_env[i].cmd, NULL, 0, list_env[i].cmd_runtime);
|
||||
if (list_env[i].func != NULL) {
|
||||
func = list_env[i].func;
|
||||
func(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static qc_res_t _qc_board_ops_push(qc_board_config_t* board, qc_exec_ops_order_init_t *order)
|
||||
{
|
||||
int exec_order_num = 0;
|
||||
while (1) {
|
||||
if (order[exec_order_num].name != NULL)
|
||||
exec_order_num++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < exec_order_num; i++) {
|
||||
qc_exec_ops_set_append(board->manager, order[i].name, order[i].order);
|
||||
}
|
||||
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
static qc_res_t qc_board_get_chip_id(char *buf, int buf_len)
|
||||
{
|
||||
#if QC_OS_RT_THREAD
|
||||
extern qc_res_t qc_read_chip_id_rtos(char *buf, int buf_len);
|
||||
return qc_read_chip_id_rtos(buf, buf_len);
|
||||
#endif
|
||||
|
||||
#if QC_OS_RT_LINUX
|
||||
extern qc_res_t qc_read_chip_id_linux(char *buf);
|
||||
return qc_read_chip_id_linux(buf, buf_len);
|
||||
#endif
|
||||
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_RT_LINUX == 0
|
||||
strncpy(buf, "XXX", buf_len);
|
||||
return QC_RES_OK;
|
||||
#endif
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
void qc_board_debug(qc_board_config_t *board, qc_debug_t flag)
|
||||
{
|
||||
if (board == NULL)
|
||||
return;
|
||||
printf("board describe = %s\n", board->board_describe);
|
||||
if (flag & QC_DEBUG_BASE) {
|
||||
printf("chip id = %s, chip intel model = %s\n", board->chip_id, board->chip_intel_module);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef _QC_BOARD_H_
|
||||
#define _QC_BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "../qc_config.h"
|
||||
#include "../core/qc_core.h"
|
||||
#include "../misc/qc_misc.h"
|
||||
|
||||
typedef struct _qc_board_config
|
||||
{
|
||||
char chip_id[64 + 4]; /* chip id fmt:44-80-ce-b8-52-2f-c0-0c-06-0c-11-18-09-00-30-04 */
|
||||
char chip_intel_module[DESC_LEN];
|
||||
char chip_intel_module_list[LIST_OPS_NUM][DESC_LEN];
|
||||
int chip_intel_module_list_num;
|
||||
|
||||
char *board_describe;
|
||||
qc_manager_t *manager;
|
||||
} qc_board_config_t;
|
||||
|
||||
typedef struct _qc_mod_init_base {
|
||||
char *name;
|
||||
char *desc;
|
||||
char *log_buf;
|
||||
int log_buf_len;
|
||||
} qc_mod_init_base_t;
|
||||
|
||||
typedef struct _qc_mod_init_list_pos {
|
||||
char *name;
|
||||
char *list_ops_desc;
|
||||
int list_pos;
|
||||
char *list_ops_cmd;
|
||||
qc_list_ops_func_t list_ops_func;
|
||||
qc_mod_record_t list_ops_cmd_record;
|
||||
qc_mod_record_t list_ops_func_record;
|
||||
unsigned int list_ops_runtime;
|
||||
} qc_mod_init_list_pos_t;
|
||||
|
||||
typedef struct _qc_exec_ops_order_init {
|
||||
char *name;
|
||||
int order;
|
||||
} qc_exec_ops_order_init_t;
|
||||
|
||||
typedef struct _qc_env_init_list {
|
||||
char *cmd;
|
||||
qc_list_ops_func_t func;
|
||||
unsigned int cmd_runtime;
|
||||
} qc_env_init_list_t;
|
||||
|
||||
enum {
|
||||
USB_DEV = 0,
|
||||
SDCARD_DEV,
|
||||
};
|
||||
typedef int qc_save_dev_t;
|
||||
|
||||
typedef struct _qc_save_init {
|
||||
const char *path;
|
||||
qc_save_dev_t dev;
|
||||
int blk_num;
|
||||
} qc_save_init_t;
|
||||
|
||||
qc_board_config_t* qc_board_tests_create(void);
|
||||
qc_res_t qc_board_ops_push(qc_board_config_t* board);
|
||||
qc_res_t qc_board_ops_clear(qc_board_config_t* board);
|
||||
void qc_board_tests_del(qc_board_config_t* board_cfg);
|
||||
void qc_board_debug(qc_board_config_t *board, qc_debug_t flag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _QC_BOARD_CFG_H_ */
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_core.h"
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_LINUX == 0
|
||||
#include <string.h>
|
||||
|
||||
void qc_module_list_ops_exec_cmd_common(qc_module_t *module, int list_ops, int list_ops_num, int *cmd_res_list)
|
||||
{
|
||||
char cmd[256] = {0};
|
||||
int cmd_return = 0;
|
||||
int cmd_result = 0;
|
||||
qc_cap_cmp_int_t cmp_int;
|
||||
|
||||
for (int i = 0; i < list_ops_num; i++) {
|
||||
strncpy(cmd, module->list_ops_cmd[list_ops][i], sizeof(cmd) - 1);
|
||||
cmp_int = module->list_ops_cmp_int[list_ops][i];
|
||||
|
||||
cmd_return = qc_cmd_exec(cmd, NULL, 0, 0);
|
||||
cmd_result = cmp_int(cmd_return);
|
||||
|
||||
/* save command run results */
|
||||
if (module->list_ops_cmd_record[list_ops][i] == QC_MOD_RECORD) {
|
||||
cmd_res_list[i] = cmd_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#if QC_OS_LINUX
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
#include "../qc_core.h"
|
||||
|
||||
static int _popen_close_and_get_status(FILE *fp);
|
||||
static void _kill_process(char *command);
|
||||
static int _qc_cmd_exec_linux(char *command, char *buf,
|
||||
int buf_len, unsigned int runtime,
|
||||
qc_cap_cmp_str_t cmp_str, qc_res_t *cmd_res);
|
||||
|
||||
int qc_cmd_exec_linux(char *command, char *buf,
|
||||
int buf_len, unsigned int runtime)
|
||||
{
|
||||
int _runtime = runtime;
|
||||
qc_res_t cmd_res = QC_RES_INV;
|
||||
|
||||
return _qc_cmd_exec_linux(command, buf, buf_len, &_runtime, NULL, &cmd_res);
|
||||
}
|
||||
|
||||
int qc_cmd_exec_linux_ex(char *command, char *buf,
|
||||
int buf_len, unsigned int runtime,
|
||||
qc_cap_cmp_str_t cmp_str, qc_res_t *cmd_res)
|
||||
{
|
||||
int _runtime = runtime;
|
||||
qc_res_t cmd_res = QC_RES_INV;
|
||||
|
||||
return _qc_cmd_exec_linux(command, buf, buf_len, &_runtime, cmp_str, &cmd_res);
|
||||
}
|
||||
|
||||
qc_res_t qc_module_list_ops_exec_cmd_linux(qc_module_t *module, int list_ops, int list_pos_num, int *cmd_res_list)
|
||||
{
|
||||
qc_res_t cmd_str_res = QC_RES_INV;
|
||||
qc_cmp_int_t cmp_int = NULL;
|
||||
qc_cmp_str_t cmp_str = NULL;
|
||||
qc_list_ops_cmd_t cmd[128] = {0};
|
||||
int cmd_return = 0;
|
||||
int cmd_result = 0;
|
||||
int runtime = -1;
|
||||
|
||||
runtime = module->list_ops_runtime[list_ops];
|
||||
for (int i = 0; i < list_pos_func_num; i++) {
|
||||
strncpy(cmd, module->list_ops_cmd[list_ops][i], sizeof(cmd));
|
||||
cmp_int = module->list_ops_cmp_int[list_ops][i];
|
||||
cmp_str = module->list_ops_cmp_str[list_ops][i];
|
||||
|
||||
cmd_return = _qc_cmd_exec_linux(cmd, module->log_buf, module->log_buf_len, &runtime, cmp_str, &cmd_str_res);
|
||||
if (cmd_str_res != QC_RES_OK)
|
||||
cmd_result = cmp_int(cmd_return);
|
||||
|
||||
/* save command run results */
|
||||
if (module->list_ops_cmd_record[list_ops][i] == QC_MOD_RECORD) {
|
||||
/* due to abnormal process shutdown, the return value is uncertain and
|
||||
* the command is not used to return the value.
|
||||
*/
|
||||
cmd_res_list[i] = cmd_str_res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int _popen_close_and_get_status(FILE *fp)
|
||||
{
|
||||
int status;
|
||||
int exit_status;
|
||||
if (fp)
|
||||
status = pclose(fp);
|
||||
|
||||
if (_WIFEXITED(status)) {
|
||||
exit_status = _WEXITSTATUS(status);
|
||||
} else {
|
||||
exit_status = _WTERMSIG(status);
|
||||
}
|
||||
return exit_status;
|
||||
}
|
||||
|
||||
static void _kill_process(char *command)
|
||||
{
|
||||
char kill_cmd[256] = {0};
|
||||
snprintf(kill_cmd, sizeof(kill_cmd), "pkill -f \"*%s\"", command);
|
||||
system(kill_cmd);
|
||||
}
|
||||
|
||||
static int _qc_cmd_exec_linux(char *command, char *buf,
|
||||
int buf_len, unsigned int *runtime,
|
||||
qc_cap_cmp_str_t cmp_str, qc_res_t *cmd_res)
|
||||
{
|
||||
if (strlen(command) == 0)
|
||||
return QC_RES_INV;
|
||||
|
||||
*cmd_res = QC_RES_INV;
|
||||
int *remain_time_ms = runtime;
|
||||
int loop = 0;
|
||||
if (*remain_time_ms <= 0)
|
||||
loop = 1;
|
||||
|
||||
FILE *fp = popen(command, "r");
|
||||
if (fp == NULL)
|
||||
return QC_RES_INV;
|
||||
|
||||
int fd = fileno(fp);
|
||||
int flags = fcntl(fd, F_GETFL, 0);
|
||||
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
||||
if (fd < 0) {
|
||||
pclose(fp);
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
char buffer[256] = {0};
|
||||
int remain_buf_len = buf_len;
|
||||
while(1) {
|
||||
struct timeval start, end;
|
||||
gettimeofday(&start, NULL);
|
||||
|
||||
fd_set read_fds;
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(fd, &read_fds);
|
||||
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 50000;
|
||||
int result = select(fd + 1, &read_fds, NULL, NULL, &timeout);
|
||||
if (result) {
|
||||
if (fgets(buffer, sizeof(buffer), fp) != NULL) {
|
||||
if (buf != NULL && remain_buf_len > 0)
|
||||
strncat(buf, buffer, buf_len);
|
||||
remain_buf_len -= strlen(buffer);
|
||||
if (cmp_str != NULL && cmp_str(buffer) == QC_RES_OK) {
|
||||
*cmd_res = QC_RES_OK;
|
||||
return _popen_close_and_get_status();
|
||||
}
|
||||
}
|
||||
} else if (result == -1) {
|
||||
break;
|
||||
} /* result == 0, timeout */
|
||||
|
||||
if (loop == 1)
|
||||
continue;
|
||||
|
||||
gettimeofday(&end, NULL);
|
||||
int timeout_ms = (end.tv_sec - start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000;
|
||||
*remain_time_ms -= (int)timeout_ms;
|
||||
if (*remain_time_ms <= 0) {
|
||||
_kill_process(command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _popen_close_and_get_status();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef _QC_OPS_CORE_H_
|
||||
#define _QC_OPS_CORE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "qc_list.h"
|
||||
#include "../qc_config.h"
|
||||
|
||||
#define NAME_LEN 30
|
||||
#define DESC_LEN 30
|
||||
|
||||
#define LIST_OPS_NUM 8
|
||||
#define OPS_NUM 5
|
||||
#define OPS_LEN 100
|
||||
|
||||
enum {
|
||||
QC_RES_INV = -1,
|
||||
QC_RES_OK,
|
||||
};
|
||||
typedef int qc_res_t;
|
||||
|
||||
enum {
|
||||
QC_MOD_NOT_RECORD = 0,
|
||||
QC_MOD_RECORD,
|
||||
};
|
||||
typedef int qc_mod_record_t;
|
||||
|
||||
enum {
|
||||
QC_MOD_UNEXECUTED,
|
||||
QC_MOD_EXECUTING,
|
||||
QC_MOD_SUCCESS,
|
||||
QC_MOD_FAILURE,
|
||||
};
|
||||
typedef int qc_mod_status_t;
|
||||
|
||||
enum {
|
||||
QC_DEBUG_BASE = 1,
|
||||
QC_DEBUG_CORE = 2,
|
||||
QC_DEBUG_DETAIL= 4,
|
||||
QC_DEBUG_ALL = 7
|
||||
};
|
||||
typedef int qc_debug_t;
|
||||
|
||||
typedef qc_res_t (*qc_cap_cmp_int_t)(int);
|
||||
typedef qc_res_t (*qc_cap_cmp_str_t)(char *);
|
||||
typedef qc_res_t (*qc_list_ops_func_t)(void *);
|
||||
typedef void (*qc_lock_t)(void);
|
||||
|
||||
typedef struct _qc_module
|
||||
{
|
||||
/* base */
|
||||
unsigned int id;
|
||||
char name[NAME_LEN];
|
||||
char desc[DESC_LEN];
|
||||
qc_mod_status_t status;
|
||||
|
||||
/* core */
|
||||
char list_ops_desc[LIST_OPS_NUM][DESC_LEN];
|
||||
char list_ops_cmd[LIST_OPS_NUM][OPS_NUM][OPS_LEN];
|
||||
qc_list_ops_func_t list_ops_func[LIST_OPS_NUM][OPS_NUM];
|
||||
void *list_ops_func_para[LIST_OPS_NUM][OPS_NUM];
|
||||
qc_cap_cmp_int_t list_ops_cmp_int[LIST_OPS_NUM][OPS_NUM]; /* in the form of a function, there is no need to use a comparision function */
|
||||
qc_cap_cmp_str_t list_ops_cmp_str[LIST_OPS_NUM][OPS_NUM];
|
||||
qc_mod_record_t list_ops_cmd_record[LIST_OPS_NUM][OPS_NUM];
|
||||
qc_mod_record_t list_ops_func_record[LIST_OPS_NUM][OPS_NUM];
|
||||
int list_ops_runtime[LIST_OPS_NUM]; /* only used for executing commands on linux */
|
||||
qc_mod_status_t list_ops_status[LIST_OPS_NUM];
|
||||
|
||||
/* log relative */
|
||||
char *log_buf;
|
||||
int log_buf_len;
|
||||
void *reserve;
|
||||
|
||||
struct qc_list list;
|
||||
} qc_module_t;
|
||||
|
||||
typedef struct _qc_manager
|
||||
{
|
||||
/* base */
|
||||
char name[NAME_LEN];
|
||||
int progress;
|
||||
int success_num;
|
||||
int failure_num;
|
||||
int success_rate;
|
||||
int module_num;
|
||||
int exec_num;
|
||||
int disp_num;
|
||||
void *reserve;
|
||||
|
||||
/* list */
|
||||
struct qc_list mod_head;
|
||||
struct qc_list exec_head;
|
||||
struct qc_list disp_head;
|
||||
|
||||
qc_lock_t lock; /* the way to access a mutex in a blocking manager */
|
||||
qc_lock_t un_lock; /* the way to access a mutex in a blocking manager */
|
||||
} qc_manager_t;
|
||||
|
||||
typedef struct _qc_exec_t
|
||||
{
|
||||
char module_name[NAME_LEN];
|
||||
int list_ops_pos;
|
||||
|
||||
struct qc_list list;
|
||||
} qc_exec_t;
|
||||
|
||||
typedef struct _qc_disp_data_t
|
||||
{
|
||||
/* module data */
|
||||
char mod_name[NAME_LEN];
|
||||
char mod_desc[DESC_LEN];
|
||||
qc_mod_status_t mod_status;
|
||||
qc_mod_status_t list_ops_status[LIST_OPS_NUM];
|
||||
char list_ops_desc[LIST_OPS_NUM][DESC_LEN];
|
||||
|
||||
/* manager data */
|
||||
char mgr_name[NAME_LEN];
|
||||
int mgr_status;
|
||||
int mgr_progress;
|
||||
int mgr_success_num;
|
||||
int mgr_failure_num;
|
||||
int mgr_success_rate;
|
||||
|
||||
struct qc_list list;
|
||||
} qc_disp_data_t;
|
||||
|
||||
int qc_cmd_exec(char *command, char *buf, int buf_len, unsigned int runtime); /* capture output and return result */
|
||||
int qc_cmd_exec_ex(char *command, char *buf,
|
||||
int buf_len, unsigned int runtime,
|
||||
qc_cap_cmp_str_t cmp_str, qc_res_t *cmd_res);
|
||||
qc_module_t *qc_module_create(void);
|
||||
qc_res_t qc_module_clear_status(qc_module_t *module);
|
||||
qc_res_t qc_module_delete(qc_module_t *module);
|
||||
|
||||
qc_res_t qc_module_set_name(qc_module_t *module, char *name);
|
||||
qc_res_t qc_module_set_desc(qc_module_t *module, char *desc);
|
||||
qc_res_t qc_module_set_log(qc_module_t *module, char *log_buf, int buf_len);
|
||||
qc_res_t qc_module_list_ops_set_desc(qc_module_t *module, int list_pos, char *list_desc);
|
||||
qc_res_t qc_module_list_ops_set_runtime(qc_module_t *module, int list_ops, int runtime); /* unit: ms, after will exec */
|
||||
qc_res_t qc_module_list_ops_cmd_append(qc_module_t *module, int list_pos, char *cmd,
|
||||
qc_mod_record_t ops_record, qc_cap_cmp_int_t int_cmp, qc_cap_cmp_str_t str_cmp);
|
||||
qc_res_t qc_module_list_ops_func_append(qc_module_t *module, int list_ops, qc_list_ops_func_t ops, void *para,
|
||||
qc_mod_record_t ops_record, qc_cap_cmp_int_t int_cmp, qc_cap_cmp_str_t str_cmp);
|
||||
qc_res_t qc_module_list_ops_exec(qc_module_t *module, int list_ops); /* execute in a blocking manner */
|
||||
|
||||
qc_manager_t *qc_manager_create(void);
|
||||
qc_res_t qc_manager_clear_status(qc_manager_t *manager);
|
||||
qc_res_t qc_manager_delete(qc_manager_t *manager);
|
||||
qc_res_t qc_manager_set_lock(qc_manager_t *manager, qc_lock_t lock, qc_lock_t un_lock);
|
||||
qc_res_t qc_manager_lock(qc_manager_t *manager);
|
||||
qc_res_t qc_manager_unlock(qc_manager_t *manager);
|
||||
|
||||
qc_res_t qc_manager_module_append(qc_manager_t *manager, qc_module_t *module);
|
||||
qc_res_t qc_manager_module_get(qc_manager_t *manager, qc_module_t *back, char *name);
|
||||
qc_res_t qc_manager_module_get_index(qc_manager_t *manager, qc_module_t *back, int index); /* search by index, 0 is the first to be added */
|
||||
qc_res_t qc_manager_module_del(qc_manager_t *manager, char *name);
|
||||
qc_res_t qc_manager_module_sync(qc_manager_t *manager, qc_module_t *module);
|
||||
qc_res_t qc_manager_update(qc_manager_t *manager, qc_module_t *module);
|
||||
|
||||
qc_exec_t *qc_exec_create(void);
|
||||
qc_res_t qc_exec_delete(qc_exec_t *exec);
|
||||
qc_res_t qc_exec_set(qc_exec_t *exec, char *mod_name, int list_ops_pos);
|
||||
qc_res_t qc_exec_append(qc_exec_t *exec, qc_manager_t *mgr);
|
||||
qc_res_t qc_exec_append_left(qc_exec_t *exec, qc_manager_t *mgr);
|
||||
qc_res_t qc_exec_pop(qc_exec_t *exec, qc_manager_t *mgr);
|
||||
qc_res_t qc_exec_ops_set_append(qc_manager_t *mgr, char *mod_name, int list);
|
||||
|
||||
qc_disp_data_t *qc_disp_data_create(void);
|
||||
qc_res_t qc_disp_data_delete(qc_disp_data_t *disp_data);
|
||||
qc_res_t qc_disp_data_set(qc_disp_data_t *disp_data, qc_manager_t *manager, qc_module_t *module);
|
||||
qc_res_t qc_disp_data_append(qc_disp_data_t *disp_data, qc_manager_t *manager);
|
||||
qc_res_t qc_disp_data_append_left(qc_disp_data_t *disp_data, qc_manager_t *manager);
|
||||
qc_res_t qc_disp_data_pop(qc_disp_data_t *disp_data, qc_manager_t *manager);
|
||||
qc_res_t qc_disp_data_set_append(qc_disp_data_t *disp_data, qc_manager_t *manager, qc_module_t *module);
|
||||
|
||||
void qc_module_debug(qc_module_t *module, qc_debug_t flag);
|
||||
void qc_manager_debug(qc_manager_t *manager, qc_debug_t flag);
|
||||
void qc_exec_debug(qc_exec_t *exec, qc_debug_t debug_flag);
|
||||
void qc_disp_data_debug(qc_disp_data_t *disp, qc_debug_t debug_flag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _QC_OPS_CORE_H_ */
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef _QC_TEST_LIST_H_
|
||||
#define _QC_TEST_LIST_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct qc_list;
|
||||
|
||||
struct qc_list {
|
||||
struct qc_list *next;
|
||||
struct qc_list *prev;
|
||||
};
|
||||
|
||||
static inline void qc_list_init(struct qc_list *list) {
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
static inline void qc_list_add_head(struct qc_list *elem,
|
||||
struct qc_list *head) {
|
||||
assert(elem != NULL);
|
||||
assert(head != NULL);
|
||||
|
||||
struct qc_list *prev = head;
|
||||
struct qc_list *next = head->next;
|
||||
|
||||
next->prev = elem;
|
||||
elem->next = next;
|
||||
elem->prev = prev;
|
||||
prev->next = elem;
|
||||
}
|
||||
|
||||
static inline void qc_list_add_tail(struct qc_list *elem,
|
||||
struct qc_list *head) {
|
||||
assert(elem != NULL);
|
||||
assert(head != NULL);
|
||||
|
||||
struct qc_list *prev = head->prev;
|
||||
struct qc_list *next = head;
|
||||
|
||||
next->prev = elem;
|
||||
elem->next = next;
|
||||
elem->prev = prev;
|
||||
prev->next = elem;
|
||||
}
|
||||
|
||||
static inline void qc_list_del(struct qc_list *elem) {
|
||||
assert(elem != NULL);
|
||||
|
||||
struct qc_list *prev = elem->prev;
|
||||
struct qc_list *next = elem->next;
|
||||
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
elem->next = NULL;
|
||||
elem->prev = NULL;
|
||||
}
|
||||
|
||||
static inline void qc_list_del_init(struct qc_list *entry) {
|
||||
assert(entry != NULL);
|
||||
|
||||
struct qc_list *prev = entry->prev;
|
||||
struct qc_list *next = entry->next;
|
||||
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
entry->next = entry;
|
||||
entry->prev = entry;
|
||||
}
|
||||
|
||||
static inline int qc_list_empty(struct qc_list *head) {
|
||||
assert(head != NULL);
|
||||
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
#define qc_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#ifndef container_of
|
||||
#define container_of(ptr, type, member) ( { \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - qc_offsetof(type,member) ); } )
|
||||
#endif
|
||||
|
||||
#define qc_list_entry(ptr, type, member) \
|
||||
container_of(ptr, type, member)
|
||||
|
||||
#define qc_list_first_entry(ptr, type, member) \
|
||||
qc_list_entry((ptr)->next, type, member)
|
||||
|
||||
#define qc_list_first_entry_or_null(ptr, type, member) ({ \
|
||||
struct qc_list *head__ = (ptr); \
|
||||
struct qc_list *pos__ = head__->next; \
|
||||
pos__ != head__ ? qc_list_entry(pos__, type, member) : NULL; \
|
||||
})
|
||||
|
||||
#define qc_list_next_entry(pos, member) \
|
||||
qc_list_entry((pos)->member.next, typeof(*(pos)), member)
|
||||
|
||||
#define qc_list_entry_is_head(pos, head, member) \
|
||||
(&pos->member == (head))
|
||||
|
||||
#define qc_list_for_each_entry(pos, head, member) \
|
||||
for (pos = qc_list_first_entry(head, typeof(*pos), member); \
|
||||
!qc_list_entry_is_head(pos, head, member); \
|
||||
pos = qc_list_next_entry(pos, member))
|
||||
|
||||
#define qc_list_for_each_entry_safe(pos, n, head, member) \
|
||||
for (pos = qc_list_first_entry(head, typeof(*pos), member), \
|
||||
n = qc_list_next_entry(pos, member); \
|
||||
!qc_list_entry_is_head(pos, head, member); \
|
||||
pos = n, n = qc_list_next_entry(n, member))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _QC_TEST_LIST_H_ */
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_core.h"
|
||||
#if QC_OS_RT_THREAD
|
||||
#include <rtdef.h>
|
||||
#include <rtconfig.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int msh_exec(char *cmd, rt_size_t length);
|
||||
|
||||
int qc_cmd_exec_rtos(char *command)
|
||||
{
|
||||
static char cmd[256] = {0};
|
||||
|
||||
strncpy(cmd, command, sizeof(cmd) - 1);
|
||||
cmd[sizeof(cmd) - 1] = '\0';
|
||||
return msh_exec(cmd, strlen(cmd));
|
||||
}
|
||||
|
||||
qc_res_t qc_cmd_exec_rtos_ex(char *command)
|
||||
{
|
||||
return qc_cmd_exec_rtos(command);
|
||||
}
|
||||
|
||||
void qc_module_list_ops_exec_cmd_rtos(qc_module_t *module, int list_ops, int list_ops_num, int *cmd_res_list)
|
||||
{
|
||||
char cmd[256] = {0};
|
||||
int cmd_return = 0;
|
||||
int cmd_result = 0;
|
||||
qc_cap_cmp_int_t cmp_int;
|
||||
|
||||
for (int i = 0; i < list_ops_num; i++) {
|
||||
strncpy(cmd, module->list_ops_cmd[list_ops][i], sizeof(cmd) - 1);
|
||||
cmp_int = module->list_ops_cmp_int[list_ops][i];
|
||||
|
||||
cmd_return = qc_cmd_exec_rtos(cmd);
|
||||
cmd_result = cmp_int(cmd_return);
|
||||
|
||||
/* save command run results */
|
||||
if (module->list_ops_cmd_record[list_ops][i] == QC_MOD_RECORD) {
|
||||
cmd_res_list[i] = cmd_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "qc_misc_common.h"
|
||||
|
||||
qc_res_t qc_block_dev_test_common(const char *filename, const char *content, int content_len)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(filename, "wb");
|
||||
if (fp == NULL) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
if (fwrite(content, 1, content_len, fp) != content_len) {
|
||||
fclose(fp);
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
if (fclose(fp) != 0) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
if (remove(filename) != 0) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_misc.h"
|
||||
#include "../../board/qc_board.h"
|
||||
|
||||
qc_res_t qc_block_dev_test_common(const char *file, const char *content, int content_len);
|
||||
qc_res_t qc_save_result_common(qc_board_config_t *board, const char *path);
|
||||
qc_res_t qc_read_chip_intel_model_file_common(char *chip_model, int len, const char *file);
|
||||
qc_res_t qc_write_chip_intel_module_file_common(char *chip_model, const char *file);
|
||||
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "qc_misc_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define PATH_LEN 256
|
||||
#define CHIP_ID_PREFIX "ID_"
|
||||
|
||||
static char* extract_directory(const char* path);
|
||||
static void set_status(char *status, int failure_num)
|
||||
{
|
||||
if (failure_num == 0) {
|
||||
strcpy(status, "SUCCESS");
|
||||
} else {
|
||||
strcpy(status, "FAILURE");
|
||||
}
|
||||
}
|
||||
|
||||
static qc_res_t create_dir(const char *path)
|
||||
{
|
||||
struct stat st = {0};
|
||||
char temp_path[PATH_LEN + 1] = {0};
|
||||
char *ptr = NULL;
|
||||
|
||||
if (path == NULL) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
strncpy(temp_path, path, PATH_LEN);
|
||||
ptr = temp_path;
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
while ((ptr = strchr(ptr, '\\')) != NULL) {
|
||||
*ptr = '\0';
|
||||
if (stat(temp_path, &st) != 0) {
|
||||
if (mkdir(temp_path) != 0) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
}
|
||||
*ptr++ = '\\';
|
||||
}
|
||||
#else
|
||||
while ((ptr = strchr(ptr, '/')) != NULL) {
|
||||
*ptr = '\0';
|
||||
if (stat(temp_path, &st) != 0) {
|
||||
if (mkdir(temp_path, 0755) != 0) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
}
|
||||
*ptr++ = '/';
|
||||
}
|
||||
#endif
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t qc_save_result_common(qc_board_config_t *board, const char *path)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
char file_name[PATH_LEN] = {0};
|
||||
char file_path[PATH_LEN] = {0};
|
||||
char status[20] = {0};
|
||||
|
||||
if (board == NULL || path == NULL) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
snprintf(file_path, sizeof(file_path), "%s%s\\", path, board->chip_intel_module);
|
||||
#else
|
||||
snprintf(file_path, sizeof(file_path), "%s%s/", path, board->chip_intel_module);
|
||||
#endif
|
||||
/* get save file name */
|
||||
snprintf(file_name, sizeof(file_name), "%s%s%s.csv", file_path, CHIP_ID_PREFIX, board->chip_id);
|
||||
|
||||
/* check if the file is exist */
|
||||
struct stat buffer;
|
||||
int file_exist = 0;
|
||||
if (stat(file_name, &buffer) == 0) {
|
||||
file_exist = 1;
|
||||
}
|
||||
|
||||
char *extract_path = extract_directory(file_path);
|
||||
create_dir(extract_path);
|
||||
|
||||
if (file_exist == 0) {
|
||||
fp = fopen(file_name, "w");
|
||||
} else {
|
||||
fp = fopen(file_name, "a");
|
||||
}
|
||||
if (fp == NULL) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
/* write version */
|
||||
if (file_exist == 0)
|
||||
fprintf(fp, "Version: %s\n\n", QC_TEST_TOOL_VERSION);
|
||||
else
|
||||
fprintf(fp, "\n\n");
|
||||
/* write head */
|
||||
fprintf(fp, "The actual results are as follows:\n");
|
||||
|
||||
/* write head */
|
||||
qc_manager_t *mgr = board->manager;
|
||||
set_status(status, mgr->failure_num);
|
||||
fprintf(fp, "chip_id,status,success_rate,success_num,failure_num,module_num\n");
|
||||
fprintf(fp, "%s,%s,%d,%d,%d,%d\n\n",
|
||||
board->chip_id, status, mgr->success_rate, mgr->success_num, mgr->failure_num, mgr->module_num);
|
||||
|
||||
/* write module */
|
||||
fprintf(fp, "module_name,status\n");
|
||||
qc_module_t *mod = qc_module_create();
|
||||
for (int i = 0; i < mgr->module_num; i++) {
|
||||
qc_manager_module_get_index(mgr, mod, i);
|
||||
set_status(status, mod->status != QC_MOD_SUCCESS);
|
||||
fprintf(fp, "%s,%s\n", mod->name, status);
|
||||
}
|
||||
|
||||
fflush(fp);
|
||||
fclose(fp);
|
||||
qc_module_delete(mod);
|
||||
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t qc_read_chip_intel_model_file_common(char *chip_model, int len, const char *file)
|
||||
{
|
||||
FILE *fp = fopen(file, "r");
|
||||
if (fp == NULL) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
if (fgets(chip_model, len, fp) != NULL) {
|
||||
size_t n = strlen(chip_model);
|
||||
if (n > 0 && chip_model[n-1] == '\n') {
|
||||
chip_model[n-1] = '\0';
|
||||
}
|
||||
fclose(fp);
|
||||
return 0;
|
||||
} else {
|
||||
fclose(fp);
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t qc_write_chip_intel_module_file_common(char *chip_model, const char *file)
|
||||
{
|
||||
char *path = extract_directory(file);
|
||||
create_dir(path);
|
||||
|
||||
FILE *fp = fopen(file, "w");
|
||||
if (fp == NULL) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
if (fprintf(fp, "%s", chip_model) >= 0) {
|
||||
fclose(fp);
|
||||
return QC_RES_OK;
|
||||
} else {
|
||||
fclose(fp);
|
||||
return QC_RES_INV;
|
||||
}
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
static char* extract_directory(const char* path)
|
||||
{
|
||||
const char* last_slash = strrchr(path, '/');
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
const char* last_backslash = strrchr(path, '\\');
|
||||
if (last_backslash && (!last_slash || last_backslash > last_slash)) {
|
||||
last_slash = last_backslash;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (last_slash) {
|
||||
return (char*)path + (path - path) / sizeof(char) * (last_slash - path + 1);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../qc_misc.h"
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#if QC_OS_LINUX
|
||||
#include <string.h>
|
||||
#include "qc_misc_linux.h"
|
||||
|
||||
/*
|
||||
* file.csv name:chipid.csv
|
||||
* file.csv context:
|
||||
* chip_id,status,success_rate,success_num,failure_num,module_num
|
||||
* XXXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX
|
||||
*
|
||||
* module_name,status
|
||||
* XXXXXX,XXXXX
|
||||
* XXXXXX,XXXXX
|
||||
* XXXXXX,XXXXX
|
||||
* XXXXXX,XXXXX
|
||||
*
|
||||
*/
|
||||
|
||||
enum {
|
||||
USB_DEV = 0,
|
||||
SDCARD_DEV,
|
||||
};
|
||||
typedef int qc_save_dev_t;
|
||||
|
||||
typedef struct _qc_save {
|
||||
qc_board_config_t *board;
|
||||
const char *path;
|
||||
qc_save_dev_t dev;
|
||||
int blk_num;
|
||||
} qc_save_t;
|
||||
|
||||
qc_save_t save_list[] = {
|
||||
#if QC_BOARD_D133C
|
||||
{NULL, "udisk/qc_save/d13c/", USB_DEV, 0},
|
||||
#endif
|
||||
|
||||
#if QC_BOARD_D213C
|
||||
{NULL, "udisk/qc_save/d21c/", USB_DEV, 0},
|
||||
{NULL, "udisk/qc_save/d21c/", USB_DEV, 1},
|
||||
#endif
|
||||
{NULL, NULL, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
qc_res_t _qc_save_write_linux(qc_board_config_t *board, const char *path, qc_save_dev_t dev, int blk_num)
|
||||
{
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
qc_res_t qc_save_write_linux(qc_board_config_t *board)
|
||||
{
|
||||
int save_time = 0;
|
||||
while(1) {
|
||||
if (strlen(save_list[save_time]) != 0) {
|
||||
save_time++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int failure_time = 0;
|
||||
for (int i = 0;i < save_time; i++) {
|
||||
if (_qc_save_write_linux(board, save_list[i].path, save_list[i].dev, save_list[i].blk_num) == QC_RES_INV)
|
||||
failure_time++;
|
||||
}
|
||||
|
||||
if (failure_time)
|
||||
return QC_RES_INV;
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "qc_misc.h"
|
||||
#include "./common/qc_misc_common.h"
|
||||
#include "../board/qc_board.h"
|
||||
#if QC_OS_RT_THREAD
|
||||
#include "./rtos/qc_misc_rtos.h"
|
||||
#endif
|
||||
#if QC_OS_LINUX
|
||||
#include "./rtos/qc_misc_linux.h"
|
||||
#endif
|
||||
|
||||
qc_res_t qc_save_write(void *board)
|
||||
{
|
||||
#if QC_OS_RT_THREAD
|
||||
return qc_save_result_rtos(board);
|
||||
#endif
|
||||
#if QC_OS_LINUX
|
||||
return qc_save_result_linux(board);
|
||||
#endif
|
||||
|
||||
return qc_save_result_common(board, "result");
|
||||
}
|
||||
|
||||
qc_res_t qc_read_chip_id(char *chip_id, int len)
|
||||
{
|
||||
#if QC_OS_RT_THREAD
|
||||
return qc_read_chip_id_rtos(chip_id, len);
|
||||
#endif
|
||||
#if QC_OS_LINUX
|
||||
return qc_read_chip_id_linux(chip_id, len);
|
||||
#endif
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
qc_res_t qc_read_chip_intel_model(char *chip_model, int len)
|
||||
{
|
||||
#if QC_OS_RT_THREAD
|
||||
return qc_read_chip_intel_model_rtos(chip_model, len);
|
||||
#endif
|
||||
#if QC_OS_LINUX
|
||||
return qc_read_chip_intel_model_linux(chip_model, len);
|
||||
#endif
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
qc_res_t qc_read_chip_intel_model_file(char *chip_model, int len)
|
||||
{
|
||||
#if QC_OS_RT_THREAD
|
||||
return qc_read_chip_intel_model_file_common(chip_model, len, "/data/chip_model.txt");
|
||||
#endif
|
||||
#if QC_OS_LINUX
|
||||
return qc_read_chip_intel_model_file_linux(chip_model, len, "tmp/chip_model.txt");
|
||||
#endif
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_LINUX == 0
|
||||
return qc_read_chip_intel_model_file_common(chip_model, len, "chip_model.txt");
|
||||
#endif
|
||||
}
|
||||
|
||||
qc_res_t qc_write_chip_intel_module_file(char *chip_model)
|
||||
{
|
||||
#if QC_OS_RT_THREAD
|
||||
return qc_write_chip_intel_module_file_common(chip_model, "/data/chip_model.txt");
|
||||
#endif
|
||||
#if QC_OS_LINUX
|
||||
return qc_write_chip_intel_module_file_linux(chip_model, "data/chip_model.txt");
|
||||
#endif
|
||||
#if QC_OS_RT_THREAD == 0 && QC_OS_LINUX == 0
|
||||
return qc_write_chip_intel_module_file_common(chip_model, "chip_model.txt");
|
||||
#endif
|
||||
}
|
||||
|
||||
qc_res_t qc_block_dev_test(const char *file, const char *content, int content_len)
|
||||
{
|
||||
return qc_block_dev_test_common(file, content, content_len);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef _QC_TEST_OPS_H_
|
||||
#define _QC_TEST_OPS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "../qc_config.h"
|
||||
#include "../core/qc_core.h"
|
||||
|
||||
qc_res_t qc_block_dev_test(const char *file, const char *content, int content_len);
|
||||
|
||||
qc_res_t qc_read_chip_id(char *chip_id, int len);
|
||||
qc_res_t qc_read_chip_intel_model(char *chip_model, int len); /* read the actual model */
|
||||
qc_res_t qc_read_chip_intel_model_file(char *chip_model, int len); /* read the from the save */
|
||||
qc_res_t qc_write_chip_intel_module_file(char *chip_model);
|
||||
|
||||
qc_res_t qc_save_write(void *board);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _QC_BOARD_CFG_H_ */
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,347 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "qc_chip_info_rtos.h"
|
||||
#if QC_OS_RT_THREAD
|
||||
|
||||
#define DEBUG_CHIP_INFO 0
|
||||
|
||||
typedef unsigned long u32;
|
||||
|
||||
static void bin_to_hex_str(unsigned char byte, char hex_str[2]);
|
||||
static u32 get_efuse_sid_offset(u32 addr);
|
||||
static u32 efuse_read_sid(u32 addr);
|
||||
|
||||
#ifdef AIC_1603
|
||||
static void get_aic_1603_burn_info(aic_1603_burn_rule_t *rule);
|
||||
static qc_res_t compare_aic_1603_burn_info(aic_1603_burn_rule_t *rule, int *rule_table_index);
|
||||
|
||||
static aic_1603_burn_rule_t aic_1603_rule_table[] = {
|
||||
{"D133BAS", 0x01, 0xB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x78},
|
||||
{"D133BBS", 0x02, 0xB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x78},
|
||||
{"D133CBS", 0x03, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"D133CCS1", 0x06, 0xC, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"D133CCS2", 0x06, 0xC, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"D133EBS", 0x04, 0xE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"D133ECS1", 0x07, 0xE, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"D133ECS2", 0x07, 0xE, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"D132ENS", 0x05, 0xE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"G730CES", 0x21, 0xC, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0},
|
||||
{"G730EES", 0x22, 0xE, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0},
|
||||
{"G730BDU", 0x23, 0xB, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0},
|
||||
{"M6801SPCS", 0x31, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x78},
|
||||
{"M6806SPES", 0x32, 0x3, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x0},
|
||||
{"DR128", 0XA1, 0xB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
{"JYX68", 0XA2, 0xB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef AIC_1605
|
||||
static void get_aic_1605_burn_info(aic_1605_burn_rule_t *rule);
|
||||
static qc_res_t compare_aic_1605_burn_info(aic_1605_burn_rule_t *rule, int *rule_table_index);
|
||||
|
||||
static aic_1605_burn_rule_t aic_1605_rule_table[] = {
|
||||
{"D121BAV", 0x03, 0xB, 0x0, 0x00, 0x1, 0x1, 0x1},
|
||||
{"D121BBV", 0x04, 0xB, 0x0, 0x00, 0x1, 0x1, 0x1},
|
||||
{"D122BAV", 0x01, 0xB, 0x0, 0x00, 0x1, 0x0, 0x0},
|
||||
{"D122BBV", 0x02, 0xB, 0x0, 0x00, 0x1, 0x0, 0x0},
|
||||
{"D122BCV1", 0x05, 0xB, 0x1, 0x00, 0x1, 0x0, 0x0},
|
||||
{"D122BCV2", 0x05, 0xB, 0x2, 0x00, 0x1, 0x0, 0x0},
|
||||
{"TR230", 0xA1, 0xB, 0x0, 0x00, 0x0, 0x0, 0x0},
|
||||
{"JYX58", 0xB1, 0xB, 0x0, 0x00, 0x1, 0x0, 0x0}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
qc_res_t qc_read_chip_intel_model_rtos(char *chip_model, int len)
|
||||
{
|
||||
#ifdef AIC_1603
|
||||
int rule_table_index = -1;
|
||||
aic_1603_burn_rule_t burn_rule = {0};
|
||||
|
||||
get_aic_1603_burn_info(&burn_rule);
|
||||
if (compare_aic_1603_burn_info(&burn_rule, &rule_table_index) == QC_RES_INV) {
|
||||
strncpy(chip_model, "Unkown chip model", len);
|
||||
return QC_RES_INV;
|
||||
}
|
||||
strncpy(chip_model, aic_1603_rule_table[rule_table_index].intel_model, len);
|
||||
return QC_RES_OK;
|
||||
#endif
|
||||
|
||||
#ifdef AIC_1605
|
||||
int rule_table_index = -1;
|
||||
aic_1605_burn_rule_t burn_rule = {0};
|
||||
|
||||
get_aic_1605_burn_info(&burn_rule);
|
||||
if (compare_aic_1605_burn_info(&burn_rule, &rule_table_index) == QC_RES_INV) {
|
||||
strncpy(chip_model, "Unkown chip model", len);
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
strncpy(chip_model, aic_1605_rule_table[rule_table_index].intel_model, len);
|
||||
return QC_RES_OK;
|
||||
#endif
|
||||
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
qc_res_t qc_read_chip_intel_model_file_rtos(char *chip_model, int len, const char *file)
|
||||
{
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
qc_res_t qc_write_chip_intel_module_file_rtos(char *chip_model, const char *file)
|
||||
{
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
qc_res_t qc_read_chip_id_rtos(char *chip_id, int len)
|
||||
{
|
||||
static unsigned char chip_id_context[128 / 8] = {0};
|
||||
char cmd[128] = {0};
|
||||
int i = 0, pos = 0, chip_id_len = 128 / 8;
|
||||
|
||||
if (len < chip_id_len) {
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "efuse read %p 10 0x20", (void *)chip_id_context);
|
||||
qc_cmd_exec(cmd, NULL, 0, 0);
|
||||
|
||||
/* the chip_id buf context is
|
||||
* 44-80-ce-b8-52-2f-c0-0c-06-0c-11-18-09-00-30-04
|
||||
*/
|
||||
for (i = 0; i < chip_id_len; i++) {
|
||||
bin_to_hex_str(chip_id_context[i], (chip_id + pos));
|
||||
pos = ((i + 1) * 2) + i;
|
||||
chip_id[pos] = '-';
|
||||
pos++;
|
||||
}
|
||||
chip_id[pos - 1] = '\0';
|
||||
|
||||
printf("chip_id = %s\n", chip_id);
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
static void bin_to_hex_str(unsigned char byte, char hex_str[2])
|
||||
{
|
||||
static const char *hex_digits = "0123456789abcdef";
|
||||
|
||||
hex_str[0] = hex_digits[(byte >> 4) & 0xF];
|
||||
hex_str[1] = hex_digits[byte & 0xF];
|
||||
}
|
||||
|
||||
static u32 get_efuse_sid_offset(u32 addr)
|
||||
{
|
||||
u32 offset = 0;
|
||||
|
||||
#ifdef AIC_1603
|
||||
switch (addr) {
|
||||
case 0x19010210: /* CHIPID_MAIN_NVM1 or CHIID_MAIN_BASE */
|
||||
offset = 0x10;
|
||||
break;
|
||||
case 0x19010214: /* CHIPID_MAIN_NVM2 */
|
||||
offset = 0x14;
|
||||
break;
|
||||
case 0x19010218: /* CHIPID_MAIN_NVM3 */
|
||||
offset = 0x18;
|
||||
break;
|
||||
case 0x1901021C: /* CHIPID_MAIN_NVM4 */
|
||||
offset = 0x1C;
|
||||
break;
|
||||
case 0x19010220: /* CHIP_LOCK_NVM1 or CHIP_LOCK_BASE */
|
||||
offset = 0x20;
|
||||
break;
|
||||
case 0x19010224: /* CHIP_LOCK_NVM2 */
|
||||
offset = 0x24;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AIC_1605
|
||||
switch (addr) {
|
||||
case 0x19010210: /* CHIPID_MAIN_NVM1 or CHIID_MAIN_BASE */
|
||||
offset = 0x10;
|
||||
break;
|
||||
case 0x19010214: /* CHIPID_MAIN_NVM2 */
|
||||
offset = 0x14;
|
||||
break;
|
||||
case 0x19010218: /* CHIPID_MAIN_NVM3 */
|
||||
offset = 0x18;
|
||||
break;
|
||||
case 0x1901021C: /* CHIPID_MAIN_NVM4 */
|
||||
offset = 0x1C;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static u32 efuse_read_sid(u32 addr)
|
||||
{
|
||||
static unsigned char efuse_context[32 / 8] = {0};
|
||||
char cmd[128] = {0};
|
||||
|
||||
u32 efuse_offset = get_efuse_sid_offset(addr);
|
||||
if (efuse_offset == 0)
|
||||
return 0;
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "efuse read %p %lx 0x4", (void *)efuse_context, efuse_offset);
|
||||
qc_cmd_exec(cmd, NULL, 0, 0);
|
||||
u32 result = efuse_context[3] << 24 |
|
||||
efuse_context[2] << 16 |
|
||||
efuse_context[1] << 8 |
|
||||
efuse_context[0];
|
||||
#if DEBUG_CHIP_INFO
|
||||
printf("cmd = %s, result = 0x%x 0x%x 0x%x 0x%x\n", cmd, efuse_context[3], efuse_context[2], efuse_context[1], efuse_context[0]);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef AIC_1603
|
||||
static void get_aic_1603_burn_info(aic_1603_burn_rule_t *rule)
|
||||
{
|
||||
u32 chipid_main_nvm3 = 0;
|
||||
u32 chip_lock_nvm1 = 0;
|
||||
u32 chip_lock_nvm2 = 0;
|
||||
|
||||
chipid_main_nvm3 = efuse_read_sid(CHIPID_MAIN_NVM3);
|
||||
chip_lock_nvm1 = efuse_read_sid(CHIP_LOCK_NVM1);
|
||||
chip_lock_nvm2 = efuse_read_sid(CHIP_LOCK_NVM2);
|
||||
|
||||
rule->mark_id = (((chipid_main_nvm3 & MARK_ID_MASK) >> 0) & 0xff);
|
||||
rule->package_id = (((chipid_main_nvm3 & PACKAGE_ID_MASK) >> 8) & 0xff);
|
||||
rule->psram_id = (((chip_lock_nvm2 & PSRAM_ID_MASK) >> 20) & 0xff);
|
||||
rule->flash_iomap = (((chip_lock_nvm2 & FLASH_IOMAP_MASK) >> 24) & 0xff);
|
||||
rule->pwmcs_dis = (((chip_lock_nvm1 & PWMCS_DIS_MASK) >> 17) & 0xff);
|
||||
rule->spi_enc_dis = (((chip_lock_nvm1 & SPI_ENC_DIS_MASK) >> 16) & 0xff);
|
||||
rule->ce_dis = (((chip_lock_nvm1 & CE_DIS_MASK) >> 15) & 0xff);
|
||||
rule->can1_dis = (((chip_lock_nvm1 & CAN1_DIS_MASK) >> 14) & 0xff);
|
||||
rule->can0_dis = (((chip_lock_nvm1 & CAN0_DIS_MASK) >> 13) & 0xff);
|
||||
rule->emac_dis = (((chip_lock_nvm1 & EMAC_DIS_MASK) >> 12) & 0xff);
|
||||
rule->dvp_dis = (((chip_lock_nvm1 & DVP_DIS_MASK) >> 11) & 0xff);
|
||||
rule->mipi_dis = (((chip_lock_nvm1 & MIPI_DIS_MASK) >> 10) & 0xff);
|
||||
rule->de_dis = (((chip_lock_nvm1 & DE_DIS_MASK) >> 8) & 0xff);
|
||||
rule->sram_dis = (((chip_lock_nvm1 & SRAM_DIS_MASK) >> 0) & 0xff);
|
||||
|
||||
#if DEBUG_CHIP_INFO
|
||||
printf("mark_id = 0x%x\n", rule->mark_id);
|
||||
printf("package_id = 0x%x\n", rule->package_id);
|
||||
printf("psram_id = 0x%x\n", rule->psram_id);
|
||||
printf("flash_iomap = 0x%x\n", rule->flash_iomap);
|
||||
printf("pwmcs_dis = 0x%x\n", rule->pwmcs_dis);
|
||||
printf("ce_dis = 0x%x\n", rule->ce_dis);
|
||||
printf("can1_dis = 0x%x\n", rule->can1_dis);
|
||||
printf("can0_dis = 0x%x\n", rule->can0_dis);
|
||||
printf("emac_dis = 0x%x\n", rule->emac_dis);
|
||||
printf("dvp_dis = 0x%x\n", rule->dvp_dis);
|
||||
printf("mipi_dis = 0x%x\n", rule->mipi_dis);
|
||||
printf("de_dis = 0x%x\n", rule->de_dis);
|
||||
printf("sram_dis = 0x%x\n", rule->sram_dis);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int compare_aic_1603_burn_info(aic_1603_burn_rule_t *rule, int *rule_table_index)
|
||||
{
|
||||
int rule_table_len = sizeof(aic_1603_rule_table) / sizeof(aic_1603_rule_table[0]);
|
||||
int i = -1;
|
||||
|
||||
for (i = 0; i < rule_table_len; i++) {
|
||||
if (rule->mark_id != aic_1603_rule_table[i].mark_id ||
|
||||
rule->package_id != aic_1603_rule_table[i].package_id ||
|
||||
rule->psram_id != aic_1603_rule_table[i].psram_id ||
|
||||
rule->flash_iomap != aic_1603_rule_table[i].flash_iomap ||
|
||||
rule->pwmcs_dis != aic_1603_rule_table[i].pwmcs_dis ||
|
||||
rule->spi_enc_dis != aic_1603_rule_table[i].spi_enc_dis ||
|
||||
rule->ce_dis != aic_1603_rule_table[i].ce_dis ||
|
||||
rule->can1_dis != aic_1603_rule_table[i].can1_dis ||
|
||||
rule->can0_dis != aic_1603_rule_table[i].can0_dis ||
|
||||
rule->emac_dis != aic_1603_rule_table[i].emac_dis ||
|
||||
rule->dvp_dis != aic_1603_rule_table[i].dvp_dis ||
|
||||
rule->mipi_dis != aic_1603_rule_table[i].mipi_dis ||
|
||||
rule->lvds_dis != aic_1603_rule_table[i].lvds_dis ||
|
||||
rule->de_dis != aic_1603_rule_table[i].de_dis ||
|
||||
rule->sram_dis != aic_1603_rule_table[i].sram_dis) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == rule_table_len)
|
||||
return QC_RES_INV;
|
||||
|
||||
*rule_table_index = i;
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef AIC_1605
|
||||
static void get_aic_1605_burn_info(aic_1605_burn_rule_t *rule)
|
||||
{
|
||||
u32 chipid_main_nvm3 = 0;
|
||||
u32 chipid_main_nvm4 = 0;
|
||||
|
||||
chipid_main_nvm3 = efuse_read_sid(CHIPID_MAIN_NVM3);
|
||||
chipid_main_nvm4 = efuse_read_sid(CHIPID_MAIN_NVM4);
|
||||
|
||||
rule->mark_id = (((chipid_main_nvm3 & MARK_ID_MASK) >> 0) & 0xff);
|
||||
rule->package_id = (((chipid_main_nvm3 & PACKAGE_ID_MASK) >> 8) & 0xff);
|
||||
rule->psram_id = (((chipid_main_nvm4 & PSRAM_ID_MASK) >> 4) & 0xff);
|
||||
rule->flash_iomap = (((chipid_main_nvm4 & FLASH_IOMAP_MASK) >> 8) & 0xff);
|
||||
rule->mdi_dis = (((chipid_main_nvm4 & MDI_DIS) >> 2) & 0xff);
|
||||
rule->can1_dis = (((chipid_main_nvm4 & CAN1_DIS_MASK) >> 1) & 0xff);
|
||||
rule->can0_dis = (((chipid_main_nvm4 & CAN0_DIS_MASK) >> 0) & 0xff);
|
||||
|
||||
#if DEBUG_CHIP_INFO
|
||||
printf("mark_id = 0x%x\n", rule->mark_id);
|
||||
printf("package_id = 0x%x\n", rule->package_id);
|
||||
printf("psram_id = 0x%x\n", rule->psram_id);
|
||||
printf("flash_iomap = 0x%x\n", rule->flash_iomap);
|
||||
printf("mdi_dis = 0x%x\n", rule->mdi_dis);
|
||||
printf("can1_dis = 0x%x\n", rule->can1_dis);
|
||||
printf("can0_dis = 0x%x\n", rule->can0_dis);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int compare_aic_1605_burn_info(aic_1605_burn_rule_t *rule, int *rule_table_index)
|
||||
{
|
||||
int rule_table_len = sizeof(aic_1605_rule_table) / sizeof(aic_1605_rule_table[0]);
|
||||
int i = -1;
|
||||
|
||||
for (i = 0; i < rule_table_len; i++) {
|
||||
if (rule->mark_id != aic_1605_rule_table[i].mark_id ||
|
||||
rule->package_id != aic_1605_rule_table[i].package_id ||
|
||||
rule->psram_id != aic_1605_rule_table[i].psram_id ||
|
||||
rule->flash_iomap != aic_1605_rule_table[i].flash_iomap ||
|
||||
rule->mdi_dis != aic_1605_rule_table[i].mdi_dis ||
|
||||
rule->can1_dis != aic_1605_rule_table[i].can1_dis ||
|
||||
rule->can0_dis != aic_1605_rule_table[i].can0_dis) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == rule_table_len)
|
||||
return QC_RES_INV;
|
||||
|
||||
*rule_table_index = i;
|
||||
return QC_RES_OK;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef _QC_CHIP_BURN_OPS_H_
|
||||
#define _QC_CHIP_BURN_OPS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "qc_misc_rtos.h"
|
||||
|
||||
#define BITS_PER_LONG 32
|
||||
#define BIT(s) (1U << (s))
|
||||
#define GENMASK(h, l) (((~(0U)) - ((1U) << (l)) + 1) & \
|
||||
(~(0U) >> (BITS_PER_LONG - 1 - (h))))
|
||||
|
||||
#ifdef AIC_1603
|
||||
#define CHIID_MAIN_BASE 0x19010210
|
||||
#define CHIP_LOCK_BASE 0x19010220
|
||||
|
||||
#define CHIPID_MAIN_NVM1 (CHIID_MAIN_BASE + 0X0)
|
||||
#define CHIPID_MAIN_NVM2 (CHIID_MAIN_BASE + 0X4)
|
||||
#define CHIPID_MAIN_NVM3 (CHIID_MAIN_BASE + 0X8)
|
||||
#define CHIPID_MAIN_NVM4 (CHIID_MAIN_BASE + 0XC)
|
||||
|
||||
#define CHIP_LOCK_NVM1 (CHIP_LOCK_BASE + 0X0)
|
||||
#define CHIP_LOCK_NVM2 (CHIP_LOCK_BASE + 0X4)
|
||||
|
||||
#define PACKAGE_ID_MASK GENMASK(15, 8)
|
||||
#define MARK_ID_MASK GENMASK(7, 0)
|
||||
#define PSRAM_ID_MASK GENMASK(23, 20)
|
||||
#define FLASH_IOMAP_MASK (GENMASK(30, 24) & (~BIT(27))) /* bit 27 is reserved */
|
||||
#define PWMCS_DIS_MASK BIT(17)
|
||||
#define SPI_ENC_DIS_MASK BIT(16)
|
||||
#define CE_DIS_MASK BIT(15)
|
||||
#define CAN1_DIS_MASK BIT(14)
|
||||
#define CAN0_DIS_MASK BIT(13)
|
||||
#define EMAC_DIS_MASK BIT(12)
|
||||
#define DVP_DIS_MASK BIT(11)
|
||||
#define MIPI_DIS_MASK BIT(10)
|
||||
#define LVDS_DIS_MASK BIT(9)
|
||||
#define DE_DIS_MASK BIT(8)
|
||||
#define SRAM_DIS_MASK GENMASK(6, 0)
|
||||
#endif
|
||||
|
||||
#ifdef AIC_1605
|
||||
#define CHIID_MAIN_BASE 0x19010210
|
||||
|
||||
#define CHIPID_MAIN_NVM1 (CHIID_MAIN_BASE + 0X0)
|
||||
#define CHIPID_MAIN_NVM2 (CHIID_MAIN_BASE + 0X4)
|
||||
#define CHIPID_MAIN_NVM3 (CHIID_MAIN_BASE + 0X8)
|
||||
#define CHIPID_MAIN_NVM4 (CHIID_MAIN_BASE + 0XC)
|
||||
|
||||
#define PACKAGE_ID_MASK GENMASK(11, 8)
|
||||
#define MARK_ID_MASK GENMASK(7, 0)
|
||||
#define PSRAM_ID_MASK GENMASK(7, 4)
|
||||
#define FLASH_IOMAP_MASK (GENMASK(14, 8) & (~BIT(11)))
|
||||
#define MDI_DIS BIT(2)
|
||||
#define CAN1_DIS_MASK BIT(1)
|
||||
#define CAN0_DIS_MASK BIT(0)
|
||||
#endif
|
||||
|
||||
typedef struct _aic_1603_chip_burn_rule {
|
||||
char intel_model[64];
|
||||
unsigned char mark_id;
|
||||
unsigned char package_id;
|
||||
unsigned char psram_id;
|
||||
unsigned char flash_iomap;
|
||||
unsigned char pwmcs_dis;
|
||||
unsigned char spi_enc_dis;
|
||||
unsigned char ce_dis;
|
||||
unsigned char can1_dis;
|
||||
unsigned char can0_dis;
|
||||
unsigned char emac_dis;
|
||||
unsigned char dvp_dis;
|
||||
unsigned char mipi_dis;
|
||||
unsigned char lvds_dis;
|
||||
unsigned char de_dis;
|
||||
unsigned char sram_dis;
|
||||
} aic_1603_burn_rule_t;
|
||||
|
||||
typedef struct _aic_1605_chip_burn_rule {
|
||||
char intel_model[64];
|
||||
unsigned char mark_id;
|
||||
unsigned char package_id;
|
||||
unsigned char psram_id;
|
||||
unsigned char flash_iomap;
|
||||
unsigned char mdi_dis;
|
||||
unsigned char can1_dis;
|
||||
unsigned char can0_dis;
|
||||
} aic_1605_burn_rule_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _QC_BOARD_CFG_H_ */
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "../../board/qc_board.h"
|
||||
#include "../qc_misc.h"
|
||||
|
||||
qc_res_t qc_save_result_rtos(qc_board_config_t *board);
|
||||
qc_res_t qc_read_chip_id_rtos(char *chip_id, int len);
|
||||
qc_res_t qc_read_chip_intel_model_rtos(char *chip_model, int len);
|
||||
qc_res_t qc_read_chip_intel_model_file_rtos(char *chip_model, int len, const char *file);
|
||||
qc_res_t qc_write_chip_intel_module_file_rtos(char *chip_model, const char *file);
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "qc_misc_rtos.h"
|
||||
|
||||
/*
|
||||
* file.csv name:chipid.csv
|
||||
* file.csv context:
|
||||
* chip_id,status,success_rate,success_num,QC_RES_INV_num,module_num
|
||||
* XXXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX,XXXXX
|
||||
*
|
||||
* module_name,status
|
||||
* XXXXXX,XXXXX
|
||||
* XXXXXX,XXXXX
|
||||
* XXXXXX,XXXXX
|
||||
* XXXXXX,XXXXX
|
||||
*
|
||||
*/
|
||||
#if QC_OS_RT_THREAD
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define PATH_LEN 256
|
||||
#define CHIP_ID_PREFIX "ID_"
|
||||
|
||||
extern qc_save_init_t board_save_list[];
|
||||
|
||||
extern qc_res_t qc_save_result_common(qc_board_config_t *board, const char *path);
|
||||
|
||||
qc_res_t qc_save_result_rtos(qc_board_config_t *board)
|
||||
{
|
||||
int i = 0;
|
||||
int failure_time = 0;
|
||||
|
||||
while (board_save_list[i].path != NULL) {
|
||||
if (qc_save_result_common(board, board_save_list[i].path) == QC_RES_INV)
|
||||
failure_time++;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (failure_time)
|
||||
return QC_RES_INV;
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#define QC_TEST_TOOL_VERSION "V2.1.3"
|
||||
|
||||
/* Only one item can be selected from a large category */
|
||||
|
||||
/* operating system */
|
||||
#define QC_OS_RT_THREAD 1
|
||||
#define QC_OS_LINUX 0
|
||||
|
||||
/* AIC_1605 */
|
||||
#define QC_BOARD_D12XX 0
|
||||
|
||||
/* AIC_1603 */
|
||||
#define QC_BOARD_D133B 1
|
||||
#define QC_BOARD_D133C 0
|
||||
#define QC_BOARD_D133E 0
|
||||
#define QC_BOARD_D132E 0
|
||||
#define QC_BOARD_G730C 0
|
||||
#define QC_BOARD_G730E 0
|
||||
#define QC_BOARD_G730B 0
|
||||
#define QC_BOARD_M6801 0
|
||||
#define QC_BOARD_M6806 0
|
||||
#define QC_BOARD_DR128 0
|
||||
#define QC_BOARD_JYX68 0
|
||||
|
||||
/* auto config */
|
||||
#if QC_BOARD_D133B || QC_BOARD_D133C || QC_BOARD_D132E || QC_BOARD_G730B || \
|
||||
QC_BOARD_D133E || QC_BOARD_G730C || QC_BOARD_G730E || QC_BOARD_M6801 || \
|
||||
QC_BOARD_M6806 || QC_BOARD_DR128 || QC_BOARD_JYX68
|
||||
#define AIC_1603 1
|
||||
#endif
|
||||
|
||||
#if QC_BOARD_D121B || QC_BOARD_TR230 || QC_BOARD_D122B || QC_BOARD_D12XX
|
||||
#define AIC_1605 1
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
#include "qc_config.h"
|
||||
#include "board/qc_board.h"
|
||||
#include "core/qc_core.h"
|
||||
#include "misc/qc_misc.h"
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "qc_demo.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
extern void lv_qc_test_init(void);
|
||||
|
||||
void qc_test_init()
|
||||
{
|
||||
lv_qc_test_init();
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#ifndef QC_DEMO_UI_H
|
||||
#define QC_DEMO_UI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "aic_ui.h"
|
||||
|
||||
void qc_test_init();
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif //LAUNCHER_UI_H
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,18 +0,0 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if (GetDepend('AIC_FS_IMAGE_DIR_1')) and "qc_test" in GetConfigValue('AIC_FS_IMAGE_DIR_1').lower():
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -1,902 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#if QC_OS_LINUX
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#if QC_OS_RT_THREAD
|
||||
#include <rtconfig.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#endif
|
||||
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "aic_ui.h"
|
||||
|
||||
#include "../../module/qc_test.h"
|
||||
|
||||
LV_FONT_DECLARE(lv_font_montserrat_24_cp);
|
||||
|
||||
static void mgr_lock(void);
|
||||
static void mgr_un_lock(void);
|
||||
static void qc_mdelay(int delay_ms);
|
||||
|
||||
static int qc_ops_create(void);
|
||||
|
||||
static int module_name_to_table_row(char *name);
|
||||
static void table_cell_update(qc_disp_data_t *disp);
|
||||
static void mgr_result_label_update(qc_disp_data_t *disp);
|
||||
static void arc_update(qc_disp_data_t *disp);
|
||||
static void start_btn_update(int progress);
|
||||
|
||||
static void table_init(void);
|
||||
static void title_init(void);
|
||||
static void start_btn_init(void);
|
||||
static void cut_line_init(void);
|
||||
static void progress_arc_init(void);
|
||||
static void mgr_result_label_init();
|
||||
static void top_windows_create(lv_obj_t *parent);
|
||||
|
||||
static void table_status_clear(void);
|
||||
static void arc_status_clear(void);
|
||||
static void mgr_result_label_clear(void);
|
||||
|
||||
static void draw_table_event_cb(lv_event_t * e);
|
||||
static void reverse_btn_status_cb(lv_timer_t *lv_timer);
|
||||
static void start_btn_handler(lv_event_t * e);
|
||||
static void del_top_window_cb(lv_event_t * e);
|
||||
static void get_chip_intel_model_cb(lv_event_t * e);
|
||||
static void create_top_window_cb(lv_event_t * e);
|
||||
|
||||
static void disable_unused_obj(void);
|
||||
|
||||
static void sys_time_update(lv_timer_t *lv_timer);
|
||||
|
||||
#if QC_OS_RT_THREAD || QC_OS_LINUX
|
||||
static void qc_exec_task(void *arg);
|
||||
#else
|
||||
static void qc_exec_task(lv_timer_t *lv_timer);
|
||||
#endif
|
||||
static void qc_draw_task(lv_timer_t *lv_timer);
|
||||
|
||||
#if QC_OS_LINUX
|
||||
static pthread_mutex_t *mgr_mutex;
|
||||
#elif QC_OS_RT_THREAD
|
||||
#define QC_TASK_THREAD_STACK_SIZE 4096
|
||||
static rt_mutex_t mgr_mutex = NULL;
|
||||
static struct rt_thread qc_task_thread;
|
||||
static rt_uint8_t qc_task_thread_stack[QC_TASK_THREAD_STACK_SIZE];
|
||||
#else
|
||||
static lv_timer_t *exec_timer;
|
||||
#endif
|
||||
|
||||
static qc_board_config_t *board;
|
||||
static qc_manager_t *mgr;
|
||||
|
||||
static lv_obj_t *start_label;
|
||||
static lv_obj_t *start_btn;
|
||||
static lv_obj_t *choose_btn;
|
||||
|
||||
static lv_style_t arc_style_main;
|
||||
static lv_style_t arc_style_indicate;
|
||||
static lv_style_t arc_style_pass_indicate;
|
||||
static lv_style_t arc_style_err_indicate;
|
||||
static lv_obj_t *arc_label;
|
||||
static lv_obj_t *arc;
|
||||
static lv_anim_t arc_anim;
|
||||
|
||||
static lv_obj_t * table;
|
||||
static lv_obj_t *mgr_result_label;
|
||||
|
||||
static lv_obj_t * rtc_time;
|
||||
static lv_timer_t *sys_timer;
|
||||
|
||||
void lv_qc_test_init(void)
|
||||
{
|
||||
if (qc_ops_create() == QC_RES_INV)
|
||||
return;
|
||||
|
||||
/* set the active layer background to white */
|
||||
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_white(), 0);
|
||||
|
||||
lv_obj_clear_flag(lv_scr_act(), LV_OBJ_FLAG_SCROLLABLE);
|
||||
/* set header title */
|
||||
title_init();
|
||||
|
||||
table_init();
|
||||
|
||||
start_btn_init();
|
||||
|
||||
mgr_result_label_init();
|
||||
|
||||
cut_line_init();
|
||||
|
||||
progress_arc_init();
|
||||
|
||||
sys_timer = lv_timer_create(sys_time_update, 1000, NULL);
|
||||
lv_timer_ready(sys_timer);
|
||||
|
||||
lv_timer_t *draw_timer = lv_timer_create(qc_draw_task, 50, NULL);
|
||||
lv_timer_ready(draw_timer);
|
||||
|
||||
lv_timer_create(reverse_btn_status_cb, 100, NULL);
|
||||
|
||||
#if QC_OS_RT_THREAD
|
||||
mgr_mutex = rt_mutex_create("qc_mutex", RT_IPC_FLAG_PRIO);
|
||||
if (mgr_mutex == NULL) {
|
||||
printf("rt mutex create failed\n");
|
||||
}
|
||||
|
||||
rt_err_t err;
|
||||
err = rt_thread_init(&qc_task_thread, "qc_task",
|
||||
qc_exec_task, (void *)NULL,
|
||||
&qc_task_thread_stack[0], sizeof(qc_task_thread_stack),
|
||||
LPKG_LVGL_THREAD_PRIO, 0);
|
||||
if (err != RT_EOK) {
|
||||
printf("failed to create qc task thread");
|
||||
return;
|
||||
}
|
||||
(void)err;
|
||||
rt_thread_startup(&qc_task_thread);
|
||||
#elif QC_OS_LINUX
|
||||
pthread_t task_thread;
|
||||
pthread_create(&task_thread, NULL, qc_exec_task, NULL);
|
||||
mgr_mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
|
||||
if (mgr_mutex == NULL) {
|
||||
printf("pthread mutex create failed\n");
|
||||
}
|
||||
pthread_mutex_init(mgr_mutex, NULL);
|
||||
#else
|
||||
exec_timer = lv_timer_create(qc_exec_task, 300, NULL);
|
||||
#endif
|
||||
|
||||
disable_unused_obj();
|
||||
}
|
||||
|
||||
#if QC_OS_LINUX
|
||||
static void mgr_lock(void)
|
||||
{
|
||||
if (mgr_mutex) {
|
||||
pthread_mutex_lock(mgr_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static void mgr_un_lock(void)
|
||||
{
|
||||
if (mgr_mutex) {
|
||||
pthread_mutex_unlock(mgr_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static void qc_mdelay(int delay_ms)
|
||||
{
|
||||
usleep(delay_ms * 1000);
|
||||
}
|
||||
#elif QC_OS_RT_THREAD
|
||||
static void mgr_lock(void)
|
||||
{
|
||||
if (mgr_mutex)
|
||||
rt_mutex_take(mgr_mutex, RT_WAITING_FOREVER);
|
||||
}
|
||||
|
||||
static void mgr_un_lock(void)
|
||||
{
|
||||
if (mgr_mutex)
|
||||
rt_mutex_release(mgr_mutex);
|
||||
}
|
||||
static void qc_mdelay(int delay_ms)
|
||||
{
|
||||
rt_thread_mdelay(delay_ms);
|
||||
}
|
||||
#else
|
||||
static void mgr_lock(void) {;}
|
||||
static void mgr_un_lock(void) {;}
|
||||
static void qc_mdelay(int delay_ms) {;}
|
||||
#endif
|
||||
|
||||
static int qc_ops_create(void)
|
||||
{
|
||||
board = qc_board_tests_create();
|
||||
if (board == NULL) {
|
||||
printf("qc_board_tests_create failed\n");
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
mgr = board->manager;
|
||||
|
||||
qc_manager_set_lock(mgr, mgr_lock, mgr_un_lock);
|
||||
|
||||
return QC_RES_OK;
|
||||
}
|
||||
|
||||
static int module_name_to_table_row(char *name)
|
||||
{
|
||||
int num_modules = mgr->module_num;
|
||||
static qc_module_t *temp_module = NULL;
|
||||
if (temp_module == NULL)
|
||||
temp_module = qc_module_create();
|
||||
|
||||
for (int i = 0; i < num_modules; i++) {
|
||||
if (qc_manager_module_get_index(mgr, temp_module, i) == QC_RES_INV)
|
||||
return -1;
|
||||
|
||||
if (strncmp(name, temp_module->name, strlen(name)) == 0) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void table_cell_update(qc_disp_data_t *disp)
|
||||
{
|
||||
int table_row_pos = -1;
|
||||
char failure_item[128] = {0};
|
||||
|
||||
table_row_pos = module_name_to_table_row(disp->mod_name);
|
||||
if (table_row_pos > 0) {
|
||||
if (disp->mod_status == QC_MOD_EXECUTING) {
|
||||
lv_table_set_cell_value(table, table_row_pos, 3, "Testing");
|
||||
} else if (disp->mod_status == QC_MOD_SUCCESS) {
|
||||
lv_table_set_cell_value(table, table_row_pos, 3, "Success");
|
||||
} else if (disp->mod_status == QC_MOD_FAILURE) {
|
||||
lv_table_set_cell_value(table, table_row_pos, 3, "Failure");
|
||||
}
|
||||
|
||||
lv_table_set_cell_value(table, table_row_pos, 1, disp->mod_desc);
|
||||
|
||||
for (int i = 0; i < LIST_OPS_NUM; i++) {
|
||||
if (disp->list_ops_status[i] == QC_MOD_FAILURE) {
|
||||
strcat(failure_item, disp->list_ops_desc[i]);
|
||||
strcat(failure_item, " failure\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* clear the line break on the last line */
|
||||
int len = strlen(failure_item);
|
||||
if (len > 0) {
|
||||
*(failure_item + len - 1) = '\0';
|
||||
lv_table_set_cell_value(table, table_row_pos, 2, failure_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mgr_result_label_update(qc_disp_data_t *disp)
|
||||
{
|
||||
char mgr_result_context[100] = {0};
|
||||
|
||||
if (disp->mgr_success_num != 0 || disp->mgr_failure_num != 0) {
|
||||
snprintf(mgr_result_context, sizeof(mgr_result_context),
|
||||
"Passed items: %d Failed items: %d",
|
||||
disp->mgr_success_num, disp->mgr_failure_num);
|
||||
lv_label_set_text(mgr_result_label, mgr_result_context);
|
||||
}
|
||||
}
|
||||
|
||||
static void arc_update(qc_disp_data_t *disp)
|
||||
{
|
||||
static int last_progress = 0;
|
||||
|
||||
lv_anim_set_values(&arc_anim, last_progress, disp->mgr_progress);
|
||||
lv_anim_start(&arc_anim);
|
||||
|
||||
last_progress = disp->mgr_progress;
|
||||
|
||||
if (lv_obj_has_flag(arc_label, LV_OBJ_FLAG_HIDDEN))
|
||||
lv_obj_clear_flag(arc_label, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
if (disp->mgr_progress == 100) {
|
||||
if (disp->mgr_failure_num != 0) {
|
||||
lv_obj_add_style(arc, &arc_style_err_indicate,
|
||||
LV_PART_INDICATOR);
|
||||
lv_anim_set_values(&arc_anim, disp->mgr_progress, disp->mgr_progress);
|
||||
lv_anim_start(&arc_anim);
|
||||
|
||||
lv_label_set_text(arc_label, "#f44336 Failure #"); /* main red */
|
||||
} else {
|
||||
lv_obj_add_style(arc, &arc_style_pass_indicate,
|
||||
LV_PART_INDICATOR);
|
||||
lv_anim_set_values(&arc_anim, disp->mgr_progress, disp->mgr_progress);
|
||||
lv_anim_start(&arc_anim);
|
||||
|
||||
lv_label_set_text(arc_label, "#4caf50 Success #"); /* main gree */
|
||||
}
|
||||
} else if (disp->mgr_progress > 0 && disp->mgr_progress < 100) {
|
||||
lv_label_set_text(arc_label, "#2196f3 Testing#"); /* main blue */
|
||||
}
|
||||
}
|
||||
|
||||
static void start_btn_update(int progress)
|
||||
{
|
||||
if (progress == 100) {
|
||||
lv_label_set_text(start_label, "Restart");
|
||||
} else if (progress > 0 && progress < 100) {
|
||||
lv_label_set_text(start_label, "Testing");
|
||||
}
|
||||
}
|
||||
|
||||
static void title_init(void)
|
||||
{
|
||||
lv_obj_t * top_bg = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_style_bg_color(top_bg, lv_palette_darken(LV_PALETTE_BLUE, 2), 0);
|
||||
lv_obj_set_pos(top_bg, 0, 0);
|
||||
lv_obj_set_size(top_bg, 1024, 54);
|
||||
lv_obj_clear_flag(top_bg, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t * title = lv_label_create(top_bg);
|
||||
lv_obj_set_style_text_color(title, lv_palette_lighten(LV_PALETTE_BLUE, 5), 0);
|
||||
lv_label_set_text_fmt(title, "ArtInChip QC Test Tool %s", QC_TEST_TOOL_VERSION);
|
||||
lv_obj_set_align(title, LV_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t * chip_version = lv_label_create(top_bg);
|
||||
lv_obj_set_style_text_color(chip_version, lv_palette_lighten(LV_PALETTE_BLUE, 5), 0);
|
||||
|
||||
lv_label_set_text(chip_version, board->board_describe);
|
||||
lv_obj_set_align(chip_version, LV_ALIGN_TOP_LEFT);
|
||||
|
||||
rtc_time = lv_label_create(top_bg);
|
||||
lv_obj_set_style_text_color(rtc_time, lv_palette_lighten(LV_PALETTE_BLUE, 5), 0);
|
||||
lv_obj_set_align(rtc_time, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(rtc_time, " ");
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
qc_module_t *temp_module = {0};
|
||||
int table_row_pos = {0};
|
||||
int table_row_cnt = mgr->module_num;
|
||||
|
||||
table = lv_table_create(lv_scr_act());
|
||||
lv_obj_set_scroll_dir(table, LV_DIR_TOP | LV_DIR_BOTTOM | LV_DIR_VER);
|
||||
lv_obj_set_scrollbar_mode(table, LV_SCROLLBAR_MODE_OFF);
|
||||
lv_obj_set_pos(table, 0, 54);
|
||||
lv_obj_set_size(table, 680, 544);
|
||||
lv_table_set_row_cnt(table, table_row_cnt);
|
||||
lv_table_set_col_cnt(table, 4);
|
||||
lv_table_set_col_width(table, 0, 113);
|
||||
lv_table_set_col_width(table, 1, 227);
|
||||
lv_table_set_col_width(table, 2, 227);
|
||||
lv_table_set_col_width(table, 3, 113);
|
||||
|
||||
lv_table_set_cell_value(table, 0, 0, "Module");
|
||||
lv_table_set_cell_value(table, 0, 1, "Testing item");
|
||||
lv_table_set_cell_value(table, 0, 2, "Failure item");
|
||||
lv_table_set_cell_value(table, 0, 3, "Status");
|
||||
|
||||
temp_module = qc_module_create();
|
||||
if (temp_module == NULL) {
|
||||
printf("qc module create failed, can't create temp module\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < table_row_cnt; i++) {
|
||||
qc_res_t ret = qc_manager_module_get_index(mgr, temp_module, i);
|
||||
if (ret == QC_RES_OK) {
|
||||
table_row_pos = i + 1;
|
||||
lv_table_set_cell_value(table, table_row_pos, 0, temp_module->name);
|
||||
lv_table_set_cell_value(table, table_row_pos, 1, temp_module->desc);
|
||||
}
|
||||
}
|
||||
|
||||
qc_module_delete(temp_module);
|
||||
/*Add an event callback to to apply some custom drawing*/
|
||||
lv_obj_add_event_cb(table, draw_table_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
|
||||
}
|
||||
|
||||
static void table_status_clear()
|
||||
{
|
||||
/* due to the unique nature of the table object, delete and recreate the table
|
||||
* object to force a refresh of the table.
|
||||
*/
|
||||
if (table) {
|
||||
lv_obj_del(table);
|
||||
}
|
||||
table_init();
|
||||
}
|
||||
|
||||
static void arc_status_clear()
|
||||
{
|
||||
lv_obj_add_style(arc, &arc_style_indicate, LV_PART_INDICATOR);
|
||||
|
||||
lv_anim_set_time(&arc_anim, 0);
|
||||
lv_anim_set_values(&arc_anim, 0, 0);
|
||||
lv_anim_start(&arc_anim);
|
||||
lv_anim_set_time(&arc_anim, 1000);
|
||||
|
||||
lv_obj_add_flag(arc_label, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
static void mgr_result_label_clear()
|
||||
{
|
||||
char mgr_result_context[100];
|
||||
|
||||
snprintf(mgr_result_context, sizeof(mgr_result_context),
|
||||
"Passed items: %s Failed items: %s",
|
||||
"--", "--");
|
||||
lv_label_set_text(mgr_result_label, mgr_result_context);
|
||||
}
|
||||
|
||||
static void start_btn_init(void)
|
||||
{
|
||||
static lv_style_t start_btn_style;
|
||||
|
||||
start_btn = lv_btn_create(lv_scr_act());
|
||||
lv_obj_clear_flag(start_btn, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_pos(start_btn, 690, 60);
|
||||
lv_obj_set_size(start_btn, 323, 83);
|
||||
|
||||
lv_obj_add_event_cb(start_btn, start_btn_handler, LV_EVENT_ALL, NULL);
|
||||
lv_style_init(&start_btn_style);
|
||||
lv_style_set_bg_color(&start_btn_style, lv_palette_main(LV_PALETTE_BLUE));
|
||||
lv_obj_add_style(start_btn, &start_btn_style, 0);
|
||||
|
||||
start_label = lv_label_create(start_btn);
|
||||
lv_obj_clear_flag(start_label, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_label_set_text(start_label, "Start");
|
||||
lv_obj_set_style_text_font(start_label, &lv_font_montserrat_24_cp, 0);
|
||||
lv_obj_center(start_label);
|
||||
|
||||
choose_btn = lv_btn_create(lv_scr_act());
|
||||
lv_obj_clear_flag(choose_btn, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_pos(choose_btn, 690, 150);
|
||||
lv_obj_set_size(choose_btn, 323, 83);
|
||||
|
||||
lv_obj_t *choose_label = lv_label_create(choose_btn);
|
||||
lv_obj_clear_flag(choose_label, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_label_set_text(choose_label, "Choose Model");
|
||||
lv_obj_set_style_text_font(choose_label, &lv_font_montserrat_24_cp, 0);
|
||||
lv_obj_center(choose_label);
|
||||
|
||||
lv_obj_add_event_cb(start_btn, start_btn_handler, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(choose_btn, create_top_window_cb, LV_EVENT_ALL, NULL);
|
||||
}
|
||||
|
||||
static void cut_line_init(void)
|
||||
{
|
||||
static lv_point_t cut_line_point[] = {{680, 245}, {1020, 245}};
|
||||
static lv_style_t cut_line_style;
|
||||
|
||||
lv_style_init(&cut_line_style);
|
||||
lv_style_set_line_width(&cut_line_style, 2);
|
||||
lv_style_set_line_color(&cut_line_style, lv_palette_main(LV_PALETTE_GREY));
|
||||
lv_style_set_line_opa(&cut_line_style, LV_OPA_20);
|
||||
lv_style_set_line_rounded(&cut_line_style, false);
|
||||
|
||||
static lv_obj_t *cut_line;
|
||||
cut_line = lv_line_create(lv_scr_act());
|
||||
lv_line_set_points(cut_line, cut_line_point, 2);
|
||||
lv_obj_add_style(cut_line, &cut_line_style, 0);
|
||||
lv_obj_set_align(cut_line, LV_ALIGN_TOP_LEFT);
|
||||
}
|
||||
|
||||
static void set_arc_value(void *obj, int32_t v)
|
||||
{
|
||||
lv_arc_set_value(obj, v);
|
||||
}
|
||||
|
||||
static void progress_arc_init(void)
|
||||
{
|
||||
lv_style_init(&arc_style_main);
|
||||
lv_style_set_arc_width(&arc_style_main, 20);
|
||||
lv_style_set_arc_color(&arc_style_main, lv_palette_main(LV_PALETTE_GREY));
|
||||
lv_style_set_arc_opa(&arc_style_main, LV_OPA_20);
|
||||
|
||||
lv_style_init(&arc_style_indicate);
|
||||
lv_style_set_arc_width(&arc_style_indicate, 20);
|
||||
lv_style_set_arc_color(&arc_style_indicate, lv_palette_main(LV_PALETTE_BLUE));
|
||||
lv_style_set_arc_opa(&arc_style_indicate, LV_OPA_COVER);
|
||||
|
||||
lv_style_init(&arc_style_pass_indicate);
|
||||
lv_style_set_arc_width(&arc_style_pass_indicate, 20);
|
||||
lv_style_set_arc_color(&arc_style_pass_indicate, lv_palette_main(LV_PALETTE_GREEN));
|
||||
lv_style_set_arc_opa(&arc_style_pass_indicate, LV_OPA_COVER);
|
||||
|
||||
lv_style_init(&arc_style_err_indicate);
|
||||
lv_style_set_arc_width(&arc_style_err_indicate, 20);
|
||||
lv_style_set_arc_color(&arc_style_err_indicate, lv_palette_main(LV_PALETTE_RED));
|
||||
lv_style_set_arc_opa(&arc_style_err_indicate, LV_OPA_COVER);
|
||||
|
||||
arc = lv_arc_create(lv_scr_act());
|
||||
lv_obj_add_style(arc, &arc_style_main, LV_PART_MAIN);
|
||||
lv_obj_add_style(arc, &arc_style_indicate, LV_PART_INDICATOR);
|
||||
|
||||
lv_arc_set_rotation(arc, 270);
|
||||
lv_arc_set_bg_angles(arc, 0, 360);
|
||||
|
||||
lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
|
||||
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
|
||||
lv_obj_set_pos(arc, 705, 290);
|
||||
lv_obj_set_size(arc, 295, 350);
|
||||
lv_obj_set_align(arc, LV_ALIGN_TOP_LEFT);
|
||||
|
||||
lv_obj_set_style_anim_time(arc, 1000, 0);
|
||||
lv_arc_set_mode(arc, LV_ARC_MODE_NORMAL);
|
||||
|
||||
lv_arc_set_range(arc, 0, 100);
|
||||
|
||||
lv_anim_init(&arc_anim);
|
||||
lv_anim_set_var(&arc_anim, arc);
|
||||
lv_anim_set_exec_cb(&arc_anim, set_arc_value);
|
||||
lv_anim_set_time(&arc_anim, 1000);
|
||||
|
||||
arc_label = lv_label_create(arc);
|
||||
lv_label_set_recolor(arc_label, true);
|
||||
lv_label_set_text(arc_label, " "); /* main blue */
|
||||
lv_obj_set_style_text_font(arc_label, &lv_font_montserrat_24_cp, 0);
|
||||
lv_obj_set_size(arc_label, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_pos(arc_label, 0, -25);
|
||||
lv_obj_set_align(arc_label, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(arc_label, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
static void mgr_result_label_init()
|
||||
{
|
||||
char mgr_result_context[100];
|
||||
mgr_result_label = lv_label_create(lv_scr_act());
|
||||
snprintf(mgr_result_context, sizeof(mgr_result_context),
|
||||
"Passed items: %s Failed items: %s",
|
||||
"--", "--");
|
||||
|
||||
lv_label_set_text(mgr_result_label, mgr_result_context);
|
||||
lv_obj_set_pos(mgr_result_label, 690, 250);
|
||||
}
|
||||
|
||||
static void top_windows_create(lv_obj_t *parent)
|
||||
{
|
||||
lv_obj_t *mask = lv_obj_create(lv_layer_top());
|
||||
lv_obj_remove_style_all(mask);
|
||||
lv_obj_set_size(mask, 1024, 600);
|
||||
lv_obj_set_style_bg_color(mask, lv_palette_main(LV_PALETTE_GREY), 0);
|
||||
lv_obj_set_style_bg_opa(mask, LV_OPA_50, 0);
|
||||
|
||||
lv_obj_t *windows = lv_obj_create(mask);
|
||||
lv_obj_clear_flag(windows, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_size(windows, 480, 300);
|
||||
lv_obj_set_style_clip_corner(windows, 40, 0);
|
||||
lv_obj_set_style_bg_color(windows, lv_color_hex(0xffffff), 0);
|
||||
lv_obj_set_style_bg_opa(windows, LV_OPA_100, 0);
|
||||
lv_obj_set_style_border_color(windows, lv_palette_main(LV_PALETTE_GREY), 0);
|
||||
lv_obj_set_style_border_width(windows, 2, 0);
|
||||
lv_obj_center(windows);
|
||||
|
||||
lv_obj_t *title = lv_label_create(windows);
|
||||
lv_label_set_text(title, "Choose Chip Model");
|
||||
lv_obj_set_size(title, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_align(title, LV_ALIGN_TOP_MID);
|
||||
lv_obj_set_pos(title, 0, 10);
|
||||
lv_obj_set_style_text_font(title, &lv_font_montserrat_24_cp, 0);
|
||||
lv_label_set_recolor(title, true);
|
||||
lv_obj_set_style_text_color(title, lv_color_hex(0x393939), 0);
|
||||
|
||||
lv_obj_t *prompt_desc = lv_label_create(windows);
|
||||
lv_obj_set_size(prompt_desc, 200, 53);
|
||||
lv_label_set_long_mode(prompt_desc, LV_LABEL_LONG_WRAP);
|
||||
lv_label_set_text(prompt_desc, "Please select the internal model of the current test chip.");
|
||||
lv_obj_set_align(prompt_desc, LV_ALIGN_TOP_LEFT);
|
||||
lv_obj_set_pos(prompt_desc, 13, 53);
|
||||
lv_label_set_recolor(prompt_desc, true);
|
||||
|
||||
lv_obj_t *chip_model_desc = lv_label_create(windows);
|
||||
lv_obj_set_size(chip_model_desc, 200, 53);
|
||||
lv_label_set_long_mode(chip_model_desc, LV_LABEL_LONG_WRAP);
|
||||
lv_label_set_text_fmt(chip_model_desc, "Please select the internal model of the current #76CB1D %s. #", board->chip_intel_module);
|
||||
lv_obj_set_align(chip_model_desc, LV_ALIGN_TOP_LEFT);
|
||||
lv_obj_set_pos(chip_model_desc, 13, 120);
|
||||
lv_label_set_recolor(chip_model_desc, true);
|
||||
|
||||
lv_obj_t *btn = lv_btn_create(windows);
|
||||
lv_obj_set_size(btn, 150, 67);
|
||||
lv_obj_set_pos(btn, 13, 191);
|
||||
|
||||
lv_obj_t *btn_label = lv_label_create(btn);
|
||||
lv_label_set_text(btn_label, "Apply");
|
||||
lv_obj_set_align(btn_label, LV_ALIGN_CENTER);
|
||||
lv_obj_set_style_text_font(btn_label, &lv_font_montserrat_24_cp, 0);
|
||||
|
||||
char roller_text[256] = {0};
|
||||
for (int i = 0; i < board->chip_intel_module_list_num; i++) {
|
||||
strncat(roller_text, board->chip_intel_module_list[i], sizeof(roller_text) - 1);
|
||||
if (i != board->chip_intel_module_list_num - 1)
|
||||
strncat(roller_text, "\n", sizeof(roller_text) - 1);
|
||||
}
|
||||
lv_obj_t *roller = lv_roller_create(windows);
|
||||
lv_roller_set_options(roller, roller_text, LV_ROLLER_MODE_NORMAL);
|
||||
lv_obj_set_size(roller, 190, 205);
|
||||
lv_obj_set_pos(roller, 250, 53);
|
||||
int set_select = 0;
|
||||
for (int i = 0; i < board->chip_intel_module_list_num; i++) {
|
||||
if (strncmp(board->chip_intel_module, board->chip_intel_module_list[i], DESC_LEN) == 0)
|
||||
set_select = i;
|
||||
}
|
||||
lv_roller_set_selected(roller, set_select, LV_ANIM_OFF);
|
||||
|
||||
lv_obj_add_event_cb(roller, get_chip_intel_model_cb, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(btn, del_top_window_cb, LV_EVENT_ALL, mask);
|
||||
|
||||
lv_event_send(roller, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
}
|
||||
|
||||
static void sys_time_disabled(void)
|
||||
{
|
||||
lv_obj_add_flag(rtc_time, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_timer_pause(sys_timer);
|
||||
}
|
||||
|
||||
static void chip_select_disable(void)
|
||||
{
|
||||
lv_obj_clear_flag(choose_btn, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_style_bg_color(choose_btn, lv_palette_lighten(LV_PALETTE_GREY, 2), 0);
|
||||
}
|
||||
|
||||
static void disable_unused_obj(void)
|
||||
{
|
||||
qc_module_t *module = qc_module_create();
|
||||
if (qc_manager_module_get(mgr, module, "RTC") == QC_RES_INV) {
|
||||
sys_time_disabled();
|
||||
}
|
||||
|
||||
if (qc_manager_module_get(mgr, module, "SID") == QC_RES_INV) {
|
||||
chip_select_disable();
|
||||
}
|
||||
qc_module_delete(module);
|
||||
}
|
||||
|
||||
static void sys_time_update(lv_timer_t *lv_timer)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *local_time;
|
||||
|
||||
now = time(NULL);
|
||||
local_time = localtime(&now);
|
||||
|
||||
lv_label_set_text_fmt(rtc_time, "%04d-%02d-%02d %02d:%02d:%02d", local_time->tm_year+1900, local_time->tm_mon+1, local_time->tm_mday, local_time->tm_hour, local_time->tm_min, local_time->tm_sec);
|
||||
}
|
||||
|
||||
static void reverse_btn_status_cb(lv_timer_t *lv_timer)
|
||||
{
|
||||
if (mgr->progress == 0 || mgr->progress == 100) {
|
||||
if (lv_obj_has_flag(choose_btn, LV_OBJ_FLAG_CLICKABLE) == false) {
|
||||
lv_obj_add_flag(choose_btn, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_style_bg_color(choose_btn, lv_palette_lighten(LV_PALETTE_BLUE, 1), 0);
|
||||
}
|
||||
|
||||
if (lv_obj_has_flag(start_btn, LV_OBJ_FLAG_CLICKABLE) == false) {
|
||||
lv_obj_add_flag(start_btn, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_style_bg_color(start_btn, lv_palette_lighten(LV_PALETTE_BLUE, 1), 0);
|
||||
}
|
||||
} else {
|
||||
if (lv_obj_has_flag(choose_btn, LV_OBJ_FLAG_CLICKABLE) == true) {
|
||||
lv_obj_clear_flag(choose_btn, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_style_bg_color(choose_btn, lv_palette_lighten(LV_PALETTE_GREY, 2), 0);
|
||||
}
|
||||
|
||||
if (lv_obj_has_flag(start_btn, LV_OBJ_FLAG_CLICKABLE) == true) {
|
||||
lv_obj_clear_flag(start_btn, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_style_bg_color(start_btn, lv_palette_lighten(LV_PALETTE_GREY, 2), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_table_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
|
||||
/* If the cells are drawn... */
|
||||
if(dsc->part == LV_PART_ITEMS) {
|
||||
uint32_t row = dsc->id / lv_table_get_col_cnt(obj);
|
||||
|
||||
/* Make the texts in the first cell center aligned */
|
||||
dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER;
|
||||
if(row == 0) {
|
||||
dsc->rect_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_BLUE), dsc->rect_dsc->bg_color, LV_OPA_20);
|
||||
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
|
||||
}
|
||||
|
||||
/* MAke every 2nd row grayish */
|
||||
if((row != 0 && row % 2) == 0) {
|
||||
dsc->rect_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_GREY), dsc->rect_dsc->bg_color, LV_OPA_10);
|
||||
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void start_btn_handler(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
|
||||
if (code == LV_EVENT_PRESSED) {
|
||||
if (mgr->exec_num == 0 && mgr->progress == 100) {
|
||||
table_status_clear();
|
||||
arc_status_clear();
|
||||
mgr_result_label_clear();
|
||||
qc_board_ops_clear(board);
|
||||
qc_board_ops_push(board);
|
||||
} else if (mgr->exec_num == 0 && mgr->progress == 0) {
|
||||
qc_board_ops_push(board);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void del_top_window_cb(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t *mask = lv_event_get_user_data(e);
|
||||
char sid_desc[256]= {0};
|
||||
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
qc_module_t *tmp = qc_module_create();
|
||||
qc_disp_data_t *disp = qc_disp_data_create();
|
||||
|
||||
lv_obj_del(mask);
|
||||
|
||||
qc_write_chip_intel_module_file(board->chip_intel_module);
|
||||
|
||||
qc_manager_module_get(mgr, tmp, "SID");
|
||||
snprintf(sid_desc, sizeof(sid_desc) - 1, "%s R comparison", board->chip_intel_module);
|
||||
qc_module_set_desc(tmp, sid_desc);
|
||||
qc_manager_module_sync(mgr, tmp);
|
||||
|
||||
qc_disp_data_set(disp, mgr, tmp);
|
||||
disp->mod_status = QC_MOD_UNEXECUTED;
|
||||
qc_disp_data_append(disp, mgr);
|
||||
|
||||
qc_disp_data_delete(disp);
|
||||
qc_module_delete(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
static void get_chip_intel_model_cb(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
lv_obj_t *roller = lv_event_get_target(e);
|
||||
char intel_model[DESC_LEN - 1] = {0};
|
||||
|
||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||
lv_roller_get_selected_str(roller, intel_model, sizeof(intel_model) - 1);
|
||||
strncpy(board->chip_intel_module, intel_model, DESC_LEN - 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void create_top_window_cb(lv_event_t * e)
|
||||
{
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
top_windows_create(lv_layer_top());
|
||||
}
|
||||
}
|
||||
|
||||
static qc_res_t is_the_final_module(qc_exec_t *exec, qc_module_t *module)
|
||||
{
|
||||
if (strncmp(exec->module_name, "SAVE", strlen("SAVE")) == 0) {
|
||||
return QC_RES_OK;
|
||||
}
|
||||
return QC_RES_INV;
|
||||
}
|
||||
|
||||
static void assuming_the_final_test_is_successful(qc_exec_t *exec, qc_module_t *module)
|
||||
{
|
||||
module->list_ops_status[exec->list_ops_pos] = QC_RES_OK;
|
||||
module->status = QC_MOD_SUCCESS;
|
||||
qc_manager_update(mgr, module);
|
||||
module->status = QC_MOD_UNEXECUTED;
|
||||
}
|
||||
|
||||
static void the_final_test_special_handing(qc_module_t *module)
|
||||
{
|
||||
/* execution result do not match expectations */
|
||||
if (module->status == QC_MOD_FAILURE) {
|
||||
qc_manager_lock(mgr);
|
||||
mgr->success_num -= 1;
|
||||
qc_manager_unlock(mgr);
|
||||
|
||||
module->status = QC_MOD_EXECUTING;
|
||||
qc_manager_module_sync(mgr, module); /* forcefully overwrite the original test results */
|
||||
module->status = QC_MOD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
#if QC_OS_RT_THREAD || QC_OS_LINUX
|
||||
static void qc_exec_task(void *arg)
|
||||
{
|
||||
qc_disp_data_t *disp = qc_disp_data_create();
|
||||
qc_exec_t *exec = qc_exec_create();
|
||||
qc_module_t *module = qc_module_create();
|
||||
|
||||
while(1) {
|
||||
if (qc_exec_pop(exec, mgr) == QC_RES_OK) {
|
||||
int ret = qc_manager_module_get(mgr, module, exec->module_name);
|
||||
if (ret != QC_RES_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* pre final test successful */
|
||||
if (is_the_final_module(exec, module) == QC_RES_OK) {
|
||||
assuming_the_final_test_is_successful(exec, module);
|
||||
}
|
||||
|
||||
qc_module_list_ops_exec(module, exec->list_ops_pos);
|
||||
if (module->list_ops_status[exec->list_ops_pos] == QC_MOD_EXECUTING) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_the_final_module(exec, module) == QC_RES_OK) {
|
||||
the_final_test_special_handing(module);
|
||||
}
|
||||
|
||||
qc_manager_update(mgr, module);
|
||||
qc_disp_data_set(disp, mgr, module);
|
||||
qc_disp_data_append(disp, mgr);
|
||||
}
|
||||
qc_mdelay(10);
|
||||
}
|
||||
|
||||
qc_disp_data_delete(disp);
|
||||
qc_exec_delete(exec);
|
||||
qc_module_delete(module);
|
||||
}
|
||||
#else
|
||||
static void qc_exec_task(lv_timer_t *lv_timer)
|
||||
{
|
||||
static qc_disp_data_t *disp = NULL;
|
||||
static qc_exec_t *exec = NULL;
|
||||
static qc_module_t *module = NULL;
|
||||
static int init = 0;
|
||||
if (!init) {
|
||||
disp = qc_disp_data_create();
|
||||
exec = qc_exec_create();
|
||||
module = qc_module_create();
|
||||
init = 1;
|
||||
}
|
||||
|
||||
if (qc_exec_pop(exec, mgr) == QC_RES_OK) {
|
||||
int ret = qc_manager_module_get(mgr, module, exec->module_name);
|
||||
if (ret != QC_RES_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* pre final test successful */
|
||||
if (is_the_final_module(exec, module) == QC_RES_OK) {
|
||||
assuming_the_final_test_is_successful(exec, module);
|
||||
}
|
||||
|
||||
qc_module_list_ops_exec(module, exec->list_ops_pos);
|
||||
if (module->list_ops_status[exec->list_ops_pos] == QC_MOD_EXECUTING) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_the_final_module(exec, module) == QC_RES_OK) {
|
||||
the_final_test_special_handing(module);
|
||||
}
|
||||
|
||||
qc_manager_update(mgr, module);
|
||||
qc_disp_data_set(disp, mgr, module);
|
||||
qc_disp_data_append(disp, mgr);
|
||||
}
|
||||
qc_mdelay(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void qc_draw_task(lv_timer_t *lv_timer)
|
||||
{
|
||||
qc_disp_data_t draw_disp = {0};
|
||||
|
||||
if (qc_disp_data_pop(&draw_disp, mgr) == QC_RES_OK) {
|
||||
table_cell_update(&draw_disp);
|
||||
mgr_result_label_update(&draw_disp);
|
||||
arc_update(&draw_disp);
|
||||
start_btn_update(draw_disp.mgr_progress);
|
||||
}
|
||||
}
|
||||
@@ -576,13 +576,16 @@ static lv_obj_t * creat_screen_blank_delay_dropdown(lv_obj_t * parent)
|
||||
return dd;
|
||||
}
|
||||
|
||||
static void lv_mpp_fb_open(void)
|
||||
{
|
||||
g_fb = mpp_fb_open();
|
||||
}
|
||||
|
||||
static void lv_bg_dark_set(lv_obj_t * parent)
|
||||
{
|
||||
struct aicfb_screeninfo info;
|
||||
char bg_dark[256];
|
||||
|
||||
g_fb = mpp_fb_open();
|
||||
|
||||
mpp_fb_ioctl(g_fb, AICFB_GET_SCREENINFO, &info);
|
||||
snprintf(bg_dark, 255, "L:/%dx%d_%d_%08x.fake",\
|
||||
info.width, info.height, 0, 0x00000000);
|
||||
@@ -624,12 +627,37 @@ static unsigned int lv_calculate_pictures_count(void)
|
||||
return image_count;
|
||||
}
|
||||
|
||||
static void lv_menu_set_style(lv_obj_t * menu)
|
||||
{
|
||||
struct aicfb_screeninfo info;
|
||||
u32 height = USB_OSD_MENU_HEIGHT;
|
||||
u32 width = USB_OSD_MENU_WIDTH;
|
||||
|
||||
mpp_fb_ioctl(g_fb, AICFB_GET_SCREENINFO, &info);
|
||||
|
||||
static lv_style_t menu_style;
|
||||
lv_style_init(&menu_style);
|
||||
lv_style_set_bg_opa(&menu_style, LV_OPA_90);
|
||||
|
||||
if (info.width < width)
|
||||
width = info.width * 0.8;
|
||||
if (height > info.height)
|
||||
height = info.height * 0.8;
|
||||
|
||||
lv_style_set_width(&menu_style, width);
|
||||
lv_style_set_height(&menu_style, height);
|
||||
lv_style_set_align(&menu_style, LV_ALIGN_BOTTOM_MID);
|
||||
|
||||
lv_obj_add_style(menu, &menu_style, 0);
|
||||
}
|
||||
|
||||
lv_obj_t * lv_settings_screen_creat(void)
|
||||
{
|
||||
lv_obj_t * settings_screen = lv_obj_create(NULL);
|
||||
lv_obj_clear_flag(settings_screen, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_add_event_cb(settings_screen, menu_event_cb, LV_EVENT_ALL, NULL);
|
||||
|
||||
lv_mpp_fb_open();
|
||||
lv_bg_dark_set(settings_screen);
|
||||
lv_logo_image_create(settings_screen);
|
||||
|
||||
@@ -644,11 +672,7 @@ lv_obj_t * lv_settings_screen_creat(void)
|
||||
menu = lv_menu_create(settings_screen);
|
||||
lv_obj_add_event_cb(menu, menu_event_handler, LV_EVENT_ALL, menu);
|
||||
lv_timer_create(menu_hide_callback, USB_OSD_MENU_HIDE_TIME_MS, 0);
|
||||
|
||||
static lv_style_t menu_style;
|
||||
lv_style_init(&menu_style);
|
||||
lv_style_set_bg_opa(&menu_style, LV_OPA_90);
|
||||
lv_obj_add_style(menu, &menu_style, 0);
|
||||
lv_menu_set_style(menu);
|
||||
|
||||
lv_color_t bg_color = lv_obj_get_style_bg_color(menu, 0);
|
||||
if(lv_color_brightness(bg_color) > 127)
|
||||
@@ -656,9 +680,6 @@ lv_obj_t * lv_settings_screen_creat(void)
|
||||
else
|
||||
lv_obj_set_style_bg_color(menu, lv_color_darken(lv_obj_get_style_bg_color(menu, 0), 50), 0);
|
||||
|
||||
lv_obj_set_size(menu, USB_OSD_MENU_WIDTH, USB_OSD_MENU_HEIGHT);
|
||||
lv_obj_align(menu, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||
|
||||
/* Create sub pages */
|
||||
lv_obj_t * cont;
|
||||
lv_obj_t * section;
|
||||
|
||||
@@ -66,11 +66,6 @@ void aic_ui_init()
|
||||
dashboard_ui_init();
|
||||
#endif
|
||||
|
||||
#ifdef AIC_LVGL_DASHBOARD_SMALL_DEMO
|
||||
extern lv_obj_t* dashboard_ui_init(void);
|
||||
dashboard_ui_init();
|
||||
#endif
|
||||
|
||||
#ifdef AIC_LVGL_DEMO_HUB_DEMO
|
||||
extern void demo_hub_init(void);
|
||||
demo_hub_init();
|
||||
@@ -118,11 +113,6 @@ void aic_ui_init()
|
||||
image_ui_init();
|
||||
#endif
|
||||
|
||||
#ifdef AIC_LVGL_86BOX_DEMO
|
||||
extern void a_86_box_ui_init(void);
|
||||
a_86_box_ui_init();
|
||||
#endif
|
||||
|
||||
#ifdef AIC_USE_TOUCH_MONKEY_TEST
|
||||
use_touch_monkey_test();
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2024, ArtInChip Technology Co., Ltd
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Authors: Zequan Liang <zequan.liang@artinchip.com>
|
||||
* Ning Fang <ning.fang@artinchip.com>
|
||||
*/
|
||||
|
||||
#include "aic_lv_ffmpeg.h"
|
||||
|
||||
#if LV_USE_FFMPEG == 0 && defined(AIC_MPP_PLAYER_INTERFACE)
|
||||
@@ -450,7 +459,7 @@ static void lv_ffmpeg_player_protect_disp_area(lv_obj_t *obj, lv_point_t *pos,
|
||||
}
|
||||
|
||||
if (pos->y + *height > LV_VER_RES) {
|
||||
*height = (LV_HOR_RES - pos->y);
|
||||
*height = (LV_VER_RES - pos->y);
|
||||
LV_LOG_ERROR("lv obj height too large!");
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,15 @@
|
||||
#include <dfs_fs.h>
|
||||
#include "aic_time.h"
|
||||
|
||||
void lv_user_gui_init(void)
|
||||
void lv_wait_sdcard_mounted(void)
|
||||
{
|
||||
// wait sdcard mounted
|
||||
if (!strcmp(LVGL_STORAGE_PATH, "/sdcard")) {
|
||||
aicos_msleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_user_gui_init(void)
|
||||
{
|
||||
aic_ui_init();
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ static lv_res_t jpeg_decoder_info(lv_img_decoder_t *decoder, const void *src, lv
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
#if MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE == 1
|
||||
#if defined(MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE)
|
||||
int shift = jpeg_size_limit(width, height);
|
||||
header->w = width >> shift;
|
||||
header->h = height >> shift;
|
||||
@@ -694,7 +694,7 @@ static lv_res_t aic_decoder_open(lv_img_decoder_t *decoder, lv_img_decoder_dsc_t
|
||||
alloc_frame->buf.buf_type = MPP_PHY_ADDR;
|
||||
|
||||
int size_shift = 0;
|
||||
#if MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE == 1
|
||||
#if defined(MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE)
|
||||
if (type == MPP_CODEC_VIDEO_DECODER_MJPEG)
|
||||
size_shift = jpeg_size_limit(width, height);
|
||||
#endif
|
||||
|
||||
@@ -13,15 +13,22 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <stdint.h>
|
||||
#include <mpp_list.h>
|
||||
#include "lvgl.h"
|
||||
|
||||
#ifndef MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE
|
||||
#define MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE 0
|
||||
#define MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE
|
||||
#endif
|
||||
|
||||
#ifndef MPP_JPEG_DEC_MAX_OUT_WIDTH
|
||||
#define MPP_JPEG_DEC_MAX_OUT_WIDTH 2048
|
||||
#endif
|
||||
|
||||
#ifndef MPP_JPEG_DEC_MAX_OUT_HEIGHT
|
||||
#define MPP_JPEG_DEC_MAX_OUT_HEIGHT 2048
|
||||
#endif
|
||||
|
||||
static inline int jpeg_width_limit(int width)
|
||||
{
|
||||
|
||||
@@ -91,6 +91,16 @@ int fbdev_get_size(int *width, int *height)
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int fbdev_get_screen_width()
|
||||
{
|
||||
return g_info.width;
|
||||
}
|
||||
|
||||
unsigned int fbdev_get_screen_height()
|
||||
{
|
||||
return g_info.height;
|
||||
}
|
||||
|
||||
enum mpp_pixel_format fbdev_get_fmt(void)
|
||||
{
|
||||
if (g_info.bits_per_pixel == 32)
|
||||
|
||||