Delete demo

pull/60/head
xiangbingj 2019-10-24 20:56:37 +08:00
parent 20bdb540bc
commit 5df96cd571
26 changed files with 0 additions and 4152 deletions

1
src/.gitignore vendored
View File

@ -1,3 +1,2 @@
*/
!hello_world/
!face_detect/*

View File

@ -1,4 +0,0 @@
Face Detection
=====
1.The kmodel is generated by nncase.

View File

@ -1,86 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <sys/unistd.h>
#include <devices.h>
#include "dvp_camera.h"
#include "printf.h"
enum _data_for
{
DATA_FOR_AI = 0,
DATA_FOR_DISPLAY = 1,
} ;
enum _enable
{
DISABLE = 0,
ENABLE = 1,
} ;
handle_t file_dvp;
void sensor_restart()
{
dvp_set_signal(file_dvp, DVP_SIG_POWER_DOWN, 1);
usleep(200 * 1000);
dvp_set_signal(file_dvp, DVP_SIG_POWER_DOWN, 0);
usleep(200 * 1000);
dvp_set_signal(file_dvp, DVP_SIG_RESET, 0);
usleep(200 * 1000);
dvp_set_signal(file_dvp, DVP_SIG_RESET, 1);
usleep(200 * 1000);
}
void on_irq_dvp(dvp_frame_event_t event, void* userdata)
{
camera_context_t *ctx = (camera_context_t *)userdata;
//printk("ctx->gram_mux = %d \n", ctx->gram_mux);
switch (event)
{
case VIDEO_FE_BEGIN:
dvp_enable_frame(file_dvp);
break;
case VIDEO_FE_END:
dvp_set_output_attributes(file_dvp, DATA_FOR_DISPLAY, VIDEO_FMT_RGB565, ctx->gram_mux ? ctx->lcd_image0->addr : ctx->lcd_image1->addr);
ctx->dvp_finish_flag = 1;
break;
default:
configASSERT(!"Invalid event.");
}
}
void dvp_init(camera_context_t *ctx)
{
file_dvp = io_open("/dev/dvp0");
configASSERT(file_dvp);
sensor_restart();
dvp_xclk_set_clock_rate(file_dvp, 20000000); /* 20MHz XCLK*/
dvp_config(file_dvp, DVP_WIDTH, DVP_HIGHT, DISABLE);
dvp_set_output_enable(file_dvp, DATA_FOR_AI, ENABLE);
dvp_set_output_enable(file_dvp, DATA_FOR_DISPLAY, ENABLE);
dvp_set_output_attributes(file_dvp, DATA_FOR_DISPLAY, VIDEO_FMT_RGB565, (void*)ctx->lcd_image0->addr);
dvp_set_output_attributes(file_dvp, DATA_FOR_AI, VIDEO_FMT_RGB24_PLANAR, (void*)ctx->ai_image->addr);
dvp_set_frame_event_enable(file_dvp, VIDEO_FE_END, DISABLE);
dvp_set_frame_event_enable(file_dvp, VIDEO_FE_BEGIN, DISABLE);
dvp_set_on_frame_event(file_dvp, on_irq_dvp, ctx);
dvp_set_frame_event_enable(file_dvp, VIDEO_FE_END, ENABLE);
dvp_set_frame_event_enable(file_dvp, VIDEO_FE_BEGIN, ENABLE);
}

View File

@ -1,33 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _DVPH_H
#define _DVPH_H
#include <stdio.h>
#include "image_process.h"
#define DVP_WIDTH 320
#define DVP_HIGHT 240
typedef struct
{
volatile int dvp_finish_flag;
image_t *ai_image;
image_t *lcd_image0;
image_t *lcd_image1;
volatile int gram_mux;
} camera_context_t;
void dvp_init(camera_context_t *ctx);
#endif

View File

@ -1,364 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _FONT_H_
#define _FONT_H_
#include <stdint.h>
uint8_t const ascii0816[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x81, 0xA5, 0x81, 0x81, 0xBD,
0x99, 0x81, 0x81, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xFF,
0xDB, 0xFF, 0xFF, 0xC3, 0xE7, 0xFF, 0xFF, 0x7E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6C, 0xFE, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7C, 0xFE,
0x7C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x3C, 0x3C, 0xE7, 0xE7, 0xE7, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x18, 0x18, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C,
0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC3, 0x99, 0xBD,
0xBD, 0x99, 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x1E, 0x0E,
0x1A, 0x32, 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x30,
0x30, 0x70, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x63,
0x7F, 0x63, 0x63, 0x63, 0x63, 0x67, 0xE7, 0xE6, 0xC0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0xDB, 0x3C, 0xE7, 0x3C, 0xDB, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFE, 0xF8,
0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0E,
0x1E, 0x3E, 0xFE, 0x3E, 0x1E, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xDB,
0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7C, 0xC6, 0x60, 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x38, 0x0C, 0xC6,
0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C,
0x7E, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0,
0xC0, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x28, 0x6C, 0xFE, 0x6C, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7C, 0x7C, 0xFE, 0xFE, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x7C, 0x7C,
0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C,
0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x7C, 0xC6, 0xC2, 0xC0, 0x7C, 0x06, 0x06, 0x86, 0xC6, 0x7C,
0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xC6, 0x0C, 0x18,
0x30, 0x60, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6C,
0x6C, 0x38, 0x76, 0xDC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18,
0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E,
0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xD6, 0xD6, 0xC6, 0xC6, 0x6C, 0x38,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6,
0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x3C, 0x06, 0x06, 0x06, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x1C, 0x3C, 0x6C, 0xCC, 0xFE,
0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xC0,
0xC0, 0xC0, 0xFC, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x60, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xC6, 0x06, 0x06, 0x0C, 0x18,
0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6,
0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x0C, 0x78,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00,
0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x0C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xDE, 0xDE,
0xDE, 0xDC, 0xC0, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38,
0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0,
0xC0, 0xC2, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x6C,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68,
0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66,
0xC2, 0xC0, 0xC0, 0xDE, 0xC6, 0xC6, 0x66, 0x3A, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x0C,
0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xE6, 0x66, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x66, 0xE6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60,
0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xEE,
0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE, 0xC6, 0xC6, 0xC6, 0xC6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x66,
0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xDE, 0x7C,
0x0C, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x6C,
0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6,
0xC6, 0x60, 0x38, 0x0C, 0x06, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7E, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6,
0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xD6, 0xFE, 0xEE, 0x6C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0x6C, 0x7C, 0x38, 0x38,
0x7C, 0x6C, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66,
0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFE, 0xC6, 0x86, 0x0C, 0x18, 0x30, 0x60, 0xC2, 0xC6, 0xFE,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00,
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C,
0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x60,
0x60, 0x78, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x0C, 0x0C, 0x3C, 0x6C, 0xCC,
0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60, 0x60, 0x60, 0xF0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC,
0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xCC, 0x78, 0x00, 0x00, 0x00, 0xE0, 0x60,
0x60, 0x6C, 0x76, 0x66, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0E, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0xE0, 0x60,
0x60, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xFE, 0xD6,
0xD6, 0xD6, 0xD6, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66,
0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0x0C, 0x1E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x76, 0x66, 0x60, 0x60, 0x60, 0xF0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x60,
0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30,
0x30, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66,
0x66, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC6, 0xC6, 0xD6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x38, 0x38, 0x6C, 0xC6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6,
0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFE, 0xCC, 0x18, 0x30, 0x60, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0E, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18,
0x18, 0x18, 0x0E, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6,
0xC6, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66,
0xC2, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x0C, 0x06, 0x7C, 0x00, 0x00,
0x00, 0x00, 0xCC, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x00, 0x7C, 0xC6, 0xFE,
0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C,
0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xCC, 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0C, 0x7C,
0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6C, 0x38,
0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x60, 0x66, 0x3C, 0x0C, 0x06,
0x3C, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xFE,
0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00,
0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x66,
0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6,
0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6C, 0x38, 0x00,
0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
0x18, 0x30, 0x60, 0x00, 0xFE, 0x66, 0x60, 0x7C, 0x60, 0x60, 0x66, 0xFE,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x76, 0x36,
0x7E, 0xD8, 0xD8, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x6C,
0xCC, 0xCC, 0xFE, 0xCC, 0xCC, 0xCC, 0xCC, 0xCE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00, 0x00, 0x7C, 0xC6, 0xC6,
0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18,
0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xCC, 0xCC, 0xCC,
0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00,
0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0x78, 0x00,
0x00, 0xC6, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6,
0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C,
0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60, 0x60, 0x60, 0xE6, 0xFC,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18,
0x7E, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xCC, 0xCC,
0xF8, 0xC4, 0xCC, 0xDE, 0xCC, 0xCC, 0xCC, 0xC6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0E, 0x1B, 0x18, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18,
0xD8, 0x70, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0C, 0x7C,
0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30,
0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xCC, 0xCC, 0xCC,
0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC,
0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x76, 0xDC, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE, 0xC6, 0xC6, 0xC6,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6C, 0x6C,
0x38, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xC0, 0xC6, 0xC6, 0x7C,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xC0,
0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFE, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0xC0, 0xC2, 0xC6, 0xCC, 0x18, 0x30, 0x60, 0xDC, 0x86, 0x0C,
0x18, 0x3E, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC2, 0xC6, 0xCC, 0x18, 0x30,
0x66, 0xCE, 0x9E, 0x3E, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
0x00, 0x18, 0x18, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6C, 0xD8, 0x6C, 0x36, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x6C, 0x36,
0x6C, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44,
0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x55, 0xAA, 0x55, 0xAA, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77,
0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0xF8,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0xF8,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x06, 0xF6,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0xF8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF7, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36,
0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x76, 0xDC, 0xD8, 0xD8, 0xD8, 0xDC, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0xD8, 0xCC, 0xC6, 0xC6, 0xC6, 0xCC,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC0, 0xC0, 0xC0,
0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFE, 0xC6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xC6, 0xFE,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xD8, 0xD8,
0xD8, 0xD8, 0xD8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xC0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x18, 0x3C, 0x66, 0x66,
0x66, 0x3C, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0x6C, 0x6C, 0xEE,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x30, 0x18, 0x0C, 0x3E, 0x66,
0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7E, 0xDB, 0xDB, 0xDB, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x06, 0x7E, 0xDB, 0xDB, 0xF3, 0x7E, 0x60, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x30, 0x60, 0x60, 0x7C, 0x60,
0x60, 0x60, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C,
0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18,
0x18, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x00, 0x7E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0xD8, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00,
0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6C, 0x6C,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0C, 0x0C,
0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x6C, 0x3C, 0x1C, 0x00, 0x00, 0x00, 0x00,
0x00, 0xD8, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xD8, 0x30, 0x60, 0xC8, 0xF8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
#endif

View File

@ -1,31 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "image_process.h"
#include "iomem.h"
int image_init(image_t *image)
{
image->addr = iomem_malloc(image->width * image->height * image->pixel);
if (image->addr == NULL)
return -1;
return 0;
}
void image_deinit(image_t *image)
{
iomem_free(image->addr);
}

View File

@ -1,33 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _IMAGE_PROCESS_H
#define _IMAGE_PROCESS_H
#include <stdint.h>
typedef struct
{
uint8_t *addr;
uint16_t width;
uint16_t height;
uint16_t pixel;
uint16_t format;
} image_t;
int image_init(image_t *image);
void image_deinit(image_t *image);
#endif /* _IMAGE_PROCESS_H */

View File

@ -1,314 +0,0 @@
/**
* @file incbin.h
* @author Dale Weiler
* @brief Utility for including binary files
*
* Facilities for including binary files into the current translation unit and
* making use from them externally in other translation units.
*/
#ifndef INCBIN_HDR
#define INCBIN_HDR
#include <limits.h>
# define INCBIN_ALIGNMENT_INDEX 7
/* Lookup table of (1 << n) where `n' is `INCBIN_ALIGNMENT_INDEX' */
#define INCBIN_ALIGN_SHIFT_0 1
#define INCBIN_ALIGN_SHIFT_1 2
#define INCBIN_ALIGN_SHIFT_2 4
#define INCBIN_ALIGN_SHIFT_3 8
#define INCBIN_ALIGN_SHIFT_4 16
#define INCBIN_ALIGN_SHIFT_5 32
#define INCBIN_ALIGN_SHIFT_6 64
#define INCBIN_ALIGN_SHIFT_7 128
/* Actual alignment value */
#define INCBIN_ALIGNMENT \
INCBIN_CONCATENATE( \
INCBIN_CONCATENATE(INCBIN_ALIGN_SHIFT, _), \
INCBIN_ALIGNMENT_INDEX)
/* Stringize */
#define INCBIN_STR(X) \
#X
#define INCBIN_STRINGIZE(X) \
INCBIN_STR(X)
/* Concatenate */
#define INCBIN_CAT(X, Y) \
X ## Y
#define INCBIN_CONCATENATE(X, Y) \
INCBIN_CAT(X, Y)
/* Deferred macro expansion */
#define INCBIN_EVAL(X) \
X
#define INCBIN_INVOKE(N, ...) \
INCBIN_EVAL(N(__VA_ARGS__))
/* Green Hills uses a different directive for including binary data */
#if defined(__ghs__)
# define INCBIN_MACRO "\tINCBIN"
#else
# define INCBIN_MACRO ".incbin"
#endif
#ifndef _MSC_VER
# define INCBIN_ALIGN \
__attribute__((aligned(INCBIN_ALIGNMENT)))
#else
# define INCBIN_ALIGN __declspec(align(INCBIN_ALIGNMENT))
#endif
#if defined(__arm__) || /* GNU C and RealView */ \
defined(__arm) || /* Diab */ \
defined(_ARM) /* ImageCraft */
# define INCBIN_ARM
#endif
#ifdef __GNUC__
/* Utilize .balign where supported */
# define INCBIN_ALIGN_HOST ".balign " INCBIN_STRINGIZE(INCBIN_ALIGNMENT) "\n"
# define INCBIN_ALIGN_BYTE ".balign 1\n"
#elif defined(INCBIN_ARM)
/*
* On arm assemblers, the alignment value is calculated as (1 << n) where `n' is
* the shift count. This is the value passed to `.align'
*/
# define INCBIN_ALIGN_HOST ".align" INCBIN_STRINGIZE(INCBIN_ALIGNMENT_INDEX) "\n"
# define INCBIN_ALIGN_BYTE ".align 0\n"
#else
/* We assume other inline assembler's treat `.align' as `.balign' */
# define INCBIN_ALIGN_HOST ".align" INCBIN_STRINGIZE(INCBIN_ALIGNMENT) "\n"
# define INCBIN_ALIGN_BYTE ".align 1\n"
#endif
/* INCBIN_CONST is used by incbin.c generated files */
#if defined(__cplusplus)
# define INCBIN_EXTERNAL extern "C"
# define INCBIN_CONST extern const
#else
# define INCBIN_EXTERNAL extern
# define INCBIN_CONST const
#endif
#if defined(__APPLE__)
/* The directives are different for Apple branded compilers */
# define INCBIN_SECTION ".data\n"
# define INCBIN_GLOBAL(NAME) ".globl " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME "\n"
# define INCBIN_INT ".long "
# define INCBIN_MANGLE "_"
# define INCBIN_BYTE ".byte "
# define INCBIN_TYPE(...)
#else
# define INCBIN_SECTION ".section .rodata\n"
# define INCBIN_GLOBAL(NAME) ".global " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME "\n"
# define INCBIN_INT ".int "
# if defined(__USER_LABEL_PREFIX__)
# define INCBIN_MANGLE INCBIN_STRINGIZE(__USER_LABEL_PREFIX__)
# else
# define INCBIN_MANGLE ""
# endif
# if defined(INCBIN_ARM)
/* On arm assemblers, `@' is used as a line comment token */
# define INCBIN_TYPE(NAME) ".type " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME ", %object\n"
# elif defined(__MINGW32__) || defined(__MINGW64__)
/* Mingw doesn't support this directive either */
# define INCBIN_TYPE(NAME)
# else
/* It's safe to use `@' on other architectures */
# define INCBIN_TYPE(NAME) ".type " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME ", @object\n"
# endif
# define INCBIN_BYTE ".byte "
#endif
/* List of style types used for symbol names */
#define INCBIN_STYLE_CAMEL 0
#define INCBIN_STYLE_SNAKE 1
/**
* @brief Specify the prefix to use for symbol names.
*
* By default this is `g', producing symbols of the form:
* @code
* #include "incbin.h"
* INCBIN(Foo, "foo.txt");
*
* // Now you have the following symbols:
* // const unsigned char gFooData[];
* // const unsigned char gFooEnd;
* // const unsigned int gFooSize;
* @endcode
*
* If however you specify a prefix before including: e.g:
* @code
* #define INCBIN_PREFIX incbin
* #include "incbin.h"
* INCBIN(Foo, "foo.txt");
*
* // Now you have the following symbols instead:
* // const unsigned char incbinFooData[];
* // const unsigned char incbinFooEnd;
* // const unsigned int incbinFooSize;
* @endcode
*/
#if !defined(INCBIN_PREFIX)
# define INCBIN_PREFIX g
#endif
/**
* @brief Specify the style used for symbol names.
*
* Possible options are
* - INCBIN_STYLE_CAMEL "CamelCase"
* - INCBIN_STYLE_SNAKE "snake_case"
*
* Default option is *INCBIN_STYLE_CAMEL* producing symbols of the form:
* @code
* #include "incbin.h"
* INCBIN(Foo, "foo.txt");
*
* // Now you have the following symbols:
* // const unsigned char <prefix>FooData[];
* // const unsigned char <prefix>FooEnd;
* // const unsigned int <prefix>FooSize;
* @endcode
*
* If however you specify a style before including: e.g:
* @code
* #define INCBIN_STYLE INCBIN_STYLE_SNAKE
* #include "incbin.h"
* INCBIN(foo, "foo.txt");
*
* // Now you have the following symbols:
* // const unsigned char <prefix>foo_data[];
* // const unsigned char <prefix>foo_end;
* // const unsigned int <prefix>foo_size;
* @endcode
*/
#if !defined(INCBIN_STYLE)
# define INCBIN_STYLE INCBIN_STYLE_CAMEL
#endif
/* Style lookup tables */
#define INCBIN_STYLE_0_DATA Data
#define INCBIN_STYLE_0_END End
#define INCBIN_STYLE_0_SIZE Size
#define INCBIN_STYLE_1_DATA _data
#define INCBIN_STYLE_1_END _end
#define INCBIN_STYLE_1_SIZE _size
/* Style lookup: returning identifier */
#define INCBIN_STYLE_IDENT(TYPE) \
INCBIN_CONCATENATE( \
INCBIN_STYLE_, \
INCBIN_CONCATENATE( \
INCBIN_EVAL(INCBIN_STYLE), \
INCBIN_CONCATENATE(_, TYPE)))
/* Style lookup: returning string literal */
#define INCBIN_STYLE_STRING(TYPE) \
INCBIN_STRINGIZE( \
INCBIN_STYLE_IDENT(TYPE)) \
/* Generate the global labels by indirectly invoking the macro with our style
* type and concatenating the name against them. */
#define INCBIN_GLOBAL_LABELS(NAME, TYPE) \
INCBIN_INVOKE( \
INCBIN_GLOBAL, \
INCBIN_CONCATENATE( \
NAME, \
INCBIN_INVOKE( \
INCBIN_STYLE_IDENT, \
TYPE))) \
INCBIN_INVOKE( \
INCBIN_TYPE, \
INCBIN_CONCATENATE( \
NAME, \
INCBIN_INVOKE( \
INCBIN_STYLE_IDENT, \
TYPE)))
/**
* @brief Externally reference binary data included in another translation unit.
*
* Produces three external symbols that reference the binary data included in
* another translation unit.
*
* The symbol names are a concatenation of `INCBIN_PREFIX' before *NAME*; with
* "Data", as well as "End" and "Size" after. An example is provided below.
*
* @param NAME The name given for the binary data
*
* @code
* INCBIN_EXTERN(Foo);
*
* // Now you have the following symbols:
* // extern const unsigned char <prefix>FooData[];
* // extern const unsigned char <prefix>FooEnd;
* // extern const unsigned int <prefix>FooSize;
* @endcode
*/
#define INCBIN_EXTERN(NAME) \
INCBIN_EXTERNAL INCBIN_ALIGN unsigned char \
INCBIN_CONCATENATE( \
INCBIN_CONCATENATE(INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(DATA))[]; \
INCBIN_EXTERNAL INCBIN_ALIGN unsigned char * \
INCBIN_CONCATENATE( \
INCBIN_CONCATENATE(INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(END)); \
INCBIN_EXTERNAL unsigned int \
INCBIN_CONCATENATE( \
INCBIN_CONCATENATE(INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(SIZE))
/**
* @brief Include a binary file into the current translation unit.
*
* Includes a binary file into the current translation unit, producing three symbols
* for objects that encode the data and size respectively.
*
* The symbol names are a concatenation of `INCBIN_PREFIX' before *NAME*; with
* "Data", as well as "End" and "Size" after. An example is provided below.
*
* @param NAME The name to associate with this binary data (as an identifier.)
* @param FILENAME The file to include (as a string literal.)
*
* @code
* INCBIN(Icon, "icon.png");
*
* // Now you have the following symbols:
* // const unsigned char <prefix>IconData[];
* // const unsigned char <prefix>IconEnd;
* // const unsigned int <prefix>IconSize;
* @endcode
*
* @warning This must be used in global scope
* @warning The identifiers may be different if INCBIN_STYLE is not default
*
* To externally reference the data included by this in another translation unit
* please @see INCBIN_EXTERN.
*/
#ifdef _MSC_VER
#define INCBIN(NAME, FILENAME) \
INCBIN_EXTERN(NAME)
#else
#define INCBIN(NAME, FILENAME) \
__asm__(INCBIN_SECTION \
INCBIN_GLOBAL_LABELS(NAME, DATA) \
INCBIN_ALIGN_HOST \
INCBIN_MANGLE INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING(DATA) ":\n" \
INCBIN_MACRO " \"" FILENAME "\"\n" \
INCBIN_GLOBAL_LABELS(NAME, END) \
INCBIN_ALIGN_BYTE \
INCBIN_MANGLE INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING(END) ":\n" \
INCBIN_BYTE "1\n" \
INCBIN_GLOBAL_LABELS(NAME, SIZE) \
INCBIN_ALIGN_HOST \
INCBIN_MANGLE INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING(SIZE) ":\n" \
INCBIN_INT INCBIN_MANGLE INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING(END) " - " \
INCBIN_MANGLE INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING(DATA) "\n" \
); \
INCBIN_EXTERN(NAME)
#endif
#endif

View File

@ -1,125 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <devices.h>
#include <stdio.h>
#include "project_cfg.h"
#include "jlt32009a.h"
#define SPI_CLOCK_RATE 6400000U
#define WAIT_CYCLE 0U
enum _instruction_length
{
INSTRUCTION_LEN_0 = 0,
INSTRUCTION_LEN_8 = 8,
INSTRUCTION_LEN_16 = 16,
INSTRUCTION_LEN_32 = 32,
} ;
enum _address_length
{
ADDRESS_LEN_0 = 0,
ADDRESS_LEN_8 = 8,
ADDRESS_LEN_16 = 16,
ADDRESS_LEN_32 = 32,
} ;
enum _frame_length
{
FRAME_LEN_0 = 0,
FRAME_LEN_8 = 8,
FRAME_LEN_16 = 16,
FRAME_LEN_32 = 32,
} ;
handle_t gio;
handle_t spi0;
handle_t spi_dfs8;
handle_t spi_dfs16;
handle_t spi_dfs32;
void init_dcx()
{
gio = io_open("/dev/gpio0");
configASSERT(gio);
gpio_set_drive_mode(gio, DCX_GPIONUM, GPIO_DM_OUTPUT);
gpio_set_pin_value(gio, DCX_GPIONUM, GPIO_PV_HIGH);
}
void set_dcx_control()
{
configASSERT(gio);
gpio_set_pin_value(gio, DCX_GPIONUM, GPIO_PV_LOW);
}
void set_dcx_data()
{
configASSERT(gio);
gpio_set_pin_value(gio, DCX_GPIONUM, GPIO_PV_HIGH);
}
void spi_control_init()
{
spi0 = io_open("/dev/spi0");
configASSERT(spi0);
spi_dfs8 = spi_get_device(spi0, SPI_MODE_0, SPI_FF_OCTAL, 1 << SPI_SLAVE_SELECT, FRAME_LEN_8);
spi_dev_config_non_standard(spi_dfs8, INSTRUCTION_LEN_8, ADDRESS_LEN_0, WAIT_CYCLE, SPI_AITM_AS_FRAME_FORMAT);
spi_dfs16 = spi_get_device(spi0, SPI_MODE_0, SPI_FF_OCTAL, 1 << SPI_SLAVE_SELECT, FRAME_LEN_16);
spi_dev_config_non_standard(spi_dfs16, INSTRUCTION_LEN_16, ADDRESS_LEN_0, WAIT_CYCLE, SPI_AITM_AS_FRAME_FORMAT);
spi_dfs32 = spi_get_device(spi0, SPI_MODE_0, SPI_FF_OCTAL, 1 << SPI_SLAVE_SELECT, FRAME_LEN_32);
spi_dev_config_non_standard(spi_dfs32, INSTRUCTION_LEN_0, ADDRESS_LEN_32, WAIT_CYCLE, SPI_AITM_AS_FRAME_FORMAT);
spi_dev_set_clock_rate(spi_dfs8, SPI_CLOCK_RATE);
spi_dev_set_clock_rate(spi_dfs16, SPI_CLOCK_RATE);
spi_dev_set_clock_rate(spi_dfs32, SPI_CLOCK_RATE);
}
void tft_hard_init(void)
{
init_dcx();
spi_control_init();
}
void tft_write_command(uint8_t cmd)
{
set_dcx_control();
io_write(spi_dfs8, (const uint8_t *)(&cmd), 1);
}
void tft_write_byte(uint8_t* data_buf, uint32_t length)
{
set_dcx_data();
io_write(spi_dfs8, (const uint8_t *)(data_buf), length);
}
void tft_write_half(uint16_t* data_buf, uint32_t length)
{
set_dcx_data();
io_write(spi_dfs16, (const uint8_t *)(data_buf), length * 2);
}
void tft_write_word(uint32_t* data_buf, uint32_t length)
{
set_dcx_data();
io_write(spi_dfs32, (const uint8_t *)data_buf, length * 4);
}
void tft_fill_data(uint32_t* data_buf, uint32_t length)
{
set_dcx_data();
spi_dev_fill(spi_dfs32, 0, *data_buf, *data_buf, length - 1);
}

View File

@ -1,105 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _NT35310_H_
#define _NT35310_H_
#include <stdint.h>
/* clang-format off */
#define NO_OPERATION 0x00
#define SOFTWARE_RESET 0x01
#define READ_ID 0x04
#define READ_STATUS 0x09
#define READ_POWER_MODE 0x0A
#define READ_MADCTL 0x0B
#define READ_PIXEL_FORMAT 0x0C
#define READ_IMAGE_FORMAT 0x0D
#define READ_SIGNAL_MODE 0x0E
#define READ_SELT_DIAG_RESULT 0x0F
#define SLEEP_ON 0x10
#define SLEEP_OFF 0x11
#define PARTIAL_DISPALY_ON 0x12
#define NORMAL_DISPALY_ON 0x13
#define INVERSION_DISPALY_OFF 0x20
#define INVERSION_DISPALY_ON 0x21
#define GAMMA_SET 0x26
#define DISPALY_OFF 0x28
#define DISPALY_ON 0x29
#define HORIZONTAL_ADDRESS_SET 0x2A
#define VERTICAL_ADDRESS_SET 0x2B
#define MEMORY_WRITE 0x2C
#define COLOR_SET 0x2D
#define MEMORY_READ 0x2E
#define PARTIAL_AREA 0x30
#define VERTICAL_SCROL_DEFINE 0x33
#define TEAR_EFFECT_LINE_OFF 0x34
#define TEAR_EFFECT_LINE_ON 0x35
#define MEMORY_ACCESS_CTL 0x36
#define VERTICAL_SCROL_S_ADD 0x37
#define IDLE_MODE_OFF 0x38
#define IDLE_MODE_ON 0x39
#define PIXEL_FORMAT_SET 0x3A
#define WRITE_MEMORY_CONTINUE 0x3C
#define READ_MEMORY_CONTINUE 0x3E
#define SET_TEAR_SCANLINE 0x44
#define GET_SCANLINE 0x45
#define WRITE_BRIGHTNESS 0x51
#define READ_BRIGHTNESS 0x52
#define WRITE_CTRL_DISPALY 0x53
#define READ_CTRL_DISPALY 0x54
#define WRITE_BRIGHTNESS_CTL 0x55
#define READ_BRIGHTNESS_CTL 0x56
#define WRITE_MIN_BRIGHTNESS 0x5E
#define READ_MIN_BRIGHTNESS 0x5F
#define READ_ID1 0xDA
#define READ_ID2 0xDB
#define READ_ID3 0xDC
#define RGB_IF_SIGNAL_CTL 0xB0
#define NORMAL_FRAME_CTL 0xB1
#define IDLE_FRAME_CTL 0xB2
#define PARTIAL_FRAME_CTL 0xB3
#define INVERSION_CTL 0xB4
#define BLANK_PORCH_CTL 0xB5
#define DISPALY_FUNCTION_CTL 0xB6
#define ENTRY_MODE_SET 0xB7
#define BACKLIGHT_CTL1 0xB8
#define BACKLIGHT_CTL2 0xB9
#define BACKLIGHT_CTL3 0xBA
#define BACKLIGHT_CTL4 0xBB
#define BACKLIGHT_CTL5 0xBC
#define BACKLIGHT_CTL7 0xBE
#define BACKLIGHT_CTL8 0xBF
#define POWER_CTL1 0xC0
#define POWER_CTL2 0xC1
#define VCOM_CTL1 0xC5
#define VCOM_CTL2 0xC7
#define NV_MEMORY_WRITE 0xD0
#define NV_MEMORY_PROTECT_KEY 0xD1
#define NV_MEMORY_STATUS_READ 0xD2
#define READ_ID4 0xD3
#define POSITIVE_GAMMA_CORRECT 0xE0
#define NEGATIVE_GAMMA_CORRECT 0xE1
#define DIGITAL_GAMMA_CTL1 0xE2
#define DIGITAL_GAMMA_CTL2 0xE3
#define INTERFACE_CTL 0xF6
/* clang-format on */
void tft_hard_init(void);
void tft_write_command(uint8_t cmd);
void tft_write_byte(uint8_t* data_buf, uint32_t length);
void tft_write_half(uint16_t* data_buf, uint32_t length);
void tft_write_word(uint32_t* data_buf, uint32_t length);
void tft_fill_data(uint32_t* data_buf, uint32_t length);
#endif

Binary file not shown.

View File

@ -1,15 +0,0 @@
{
"version": "0.1.0",
"files": [
{
"address": 0,
"bin": "face_detect.bin",
"sha256Prefix": true
},
{
"address": 0x00A00000,
"bin": "detect.kmodel",
"sha256Prefix": false
}
]
}

Binary file not shown.

View File

@ -1,196 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string.h>
#include <sys/unistd.h>
#include "lcd.h"
#include "font.h"
#include "jlt32009a.h"
typedef struct
{
uint8_t dir;
uint16_t width;
uint16_t height;
} lcd_ctl_t;
static lcd_ctl_t lcd_ctl;
void lcd_init(void)
{
uint8_t data;
tft_hard_init();
// soft reset
tft_write_command(SOFTWARE_RESET);
usleep(100*1000);
// exit sleep
tft_write_command(SLEEP_OFF);
usleep(100*1000);
// pixel format
tft_write_command(PIXEL_FORMAT_SET);
data = 0x55;
tft_write_byte(&data, 1);
lcd_set_direction(DIR_YX_RLUD);
tft_write_command(DISPALY_ON);
}
void lcd_set_direction(enum lcd_dir_t dir)
{
dir |= 0x08;
lcd_ctl.dir = dir;
if (dir & DIR_XY_MASK)
{
lcd_ctl.width = LCD_Y_MAX - 1;
lcd_ctl.height = LCD_X_MAX - 1;
}
else
{
lcd_ctl.width = LCD_X_MAX - 1;
lcd_ctl.height = LCD_Y_MAX - 1;
}
tft_write_command(MEMORY_ACCESS_CTL);
tft_write_byte((uint8_t*)&dir, 1);
}
void lcd_set_area(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
{
uint8_t data[4];
data[0] = (uint8_t)(x1 >> 8);
data[1] = (uint8_t)(x1);
data[2] = (uint8_t)(x2 >> 8);
data[3] = (uint8_t)(x2);
tft_write_command(HORIZONTAL_ADDRESS_SET);
tft_write_byte(data, 4);
data[0] = (uint8_t)(y1 >> 8);
data[1] = (uint8_t)(y1);
data[2] = (uint8_t)(y2 >> 8);
data[3] = (uint8_t)(y2);
tft_write_command(VERTICAL_ADDRESS_SET);
tft_write_byte(data, 4);
tft_write_command(MEMORY_WRITE);
}
void lcd_draw_point(uint16_t x, uint16_t y, uint16_t color)
{
lcd_set_area(x, y, x, y);
tft_write_half(&color, 1);
}
void lcd_draw_char(uint16_t x, uint16_t y, char c, uint16_t color)
{
uint8_t i, j, data;
for (i = 0; i < 16; i++)
{
data = ascii0816[c * 16 + i];
for (j = 0; j < 8; j++)
{
if (data & 0x80)
lcd_draw_point(x + j, y, color);
data <<= 1;
}
y++;
}
}
void lcd_draw_string(uint16_t x, uint16_t y, char* str, uint16_t color)
{
while (*str)
{
lcd_draw_char(x, y, *str, color);
str++;
x += 8;
}
}
void ram_draw_string(char* str, uint32_t* ptr, uint16_t font_color, uint16_t bg_color)
{
uint8_t i, j, data, *pdata;
uint16_t width;
uint32_t* pixel;
width = 4 * strlen(str);
while (*str)
{
pdata = (uint8_t*)&ascii0816[(*str) * 16];
for (i = 0; i < 16; i++)
{
data = *pdata++;
pixel = ptr + i * width;
for (j = 0; j < 4; j++)
{
switch (data >> 6)
{
case 0:
*pixel = ((uint32_t)bg_color << 16) | bg_color;
break;
case 1:
*pixel = ((uint32_t)bg_color << 16) | font_color;
break;
case 2:
*pixel = ((uint32_t)font_color << 16) | bg_color;
break;
case 3:
*pixel = ((uint32_t)font_color << 16) | font_color;
break;
default:
*pixel = 0;
break;
}
data <<= 2;
pixel++;
}
}
str++;
ptr += 4;
}
}
void lcd_clear(uint16_t color)
{
uint32_t data = ((uint32_t)color << 16) | (uint32_t)color;
lcd_set_area(0, 0, lcd_ctl.width, lcd_ctl.height);
tft_fill_data(&data, LCD_X_MAX * LCD_Y_MAX / 2);
}
void lcd_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t width, uint16_t color)
{
uint32_t data_buf[640];
uint32_t* p = data_buf;
uint32_t data = color;
uint32_t index;
data = (data << 16) | data;
for (index = 0; index < 160 * width; index++)
*p++ = data;
lcd_set_area(x1, y1, x2, y1 + width - 1);
tft_write_word(data_buf, ((x2 - x1 + 1) * width + 1) / 2);
lcd_set_area(x1, y2 - width + 1, x2, y2);
tft_write_word(data_buf, ((x2 - x1 + 1) * width + 1) / 2);
lcd_set_area(x1, y1, x1 + width - 1, y2);
tft_write_word(data_buf, ((y2 - y1 + 1) * width + 1) / 2);
lcd_set_area(x2 - width + 1, y1, x2, y2);
tft_write_word(data_buf, ((y2 - y1 + 1) * width + 1) / 2);
}
void lcd_draw_picture(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint32_t* ptr)
{
lcd_set_area(x1, y1, x1 + width - 1, y1 + height - 1);
tft_write_word(ptr, width * height / 2);
}

View File

@ -1,70 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LCD_H_
#define _LCD_H_
#include <stdint.h>
/* clang-format off */
#define LCD_X_MAX 240
#define LCD_Y_MAX 320
#define BLACK 0x0000
#define NAVY 0x000F
#define DARKGREEN 0x03E0
#define DARKCYAN 0x03EF
#define MAROON 0x7800
#define PURPLE 0x780F
#define OLIVE 0x7BE0
#define LIGHTGREY 0xC618
#define DARKGREY 0x7BEF
#define BLUE 0x001F
#define GREEN 0x07E0
#define CYAN 0x07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define ORANGE 0xFD20
#define GREENYELLOW 0xAFE5
#define PINK 0xF81F
#define USER_COLOR 0xAA55
/* clang-format on */
enum lcd_dir_t
{
DIR_XY_RLUD = 0x00,
DIR_YX_RLUD = 0x20,
DIR_XY_LRUD = 0x40,
DIR_YX_LRUD = 0x60,
DIR_XY_RLDU = 0x80,
DIR_YX_RLDU = 0xA0,
DIR_XY_LRDU = 0xC0,
DIR_YX_LRDU = 0xE0,
DIR_XY_MASK = 0x20,
DIR_MASK = 0xE0,
};
void lcd_init(void);
void lcd_clear(uint16_t color);
void lcd_set_direction(enum lcd_dir_t dir);
void lcd_set_area(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
void lcd_draw_point(uint16_t x, uint16_t y, uint16_t color);
void lcd_draw_string(uint16_t x, uint16_t y, char* str, uint16_t color);
void lcd_draw_picture(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint32_t* ptr);
void lcd_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t width, uint16_t color);
void ram_draw_string(char* str, uint32_t* ptr, uint16_t font_color, uint16_t bg_color);
#endif

View File

@ -1,419 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdlib.h>
#include <FreeRTOS.h>
#include <task.h>
#include <devices.h>
#include "dvp_camera.h"
#include "lcd.h"
#include "ov5640.h"
#include "region_layer.h"
#include "image_process.h"
#include "w25qxx.h"
#define INCBIN_STYLE INCBIN_STYLE_SNAKE
#define INCBIN_PREFIX
#include "incbin.h"
#include "printf.h"
#include "iomem.h"
#include <semphr.h>
#include <filesystem.h>
#include <storage/sdcard.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/lock.h>
handle_t sd0;
FILE *stream;
char buffer[320];
char msg[]="11k233333333333333333k233333333333333333k233333333333333333k233333333333333333k233333333333333333k233333333333333333k2333333333333333300";
image_t kpu_image, display_image0, display_image1;
handle_t model_context;
camera_context_t camera_ctx;
static region_layer_t face_detect_rl;
static obj_info_t face_detect_info;
#define ANCHOR_NUM 5
static float anchor[ANCHOR_NUM * 2] = {1.889,2.5245, 2.9465,3.94056, 3.99987,5.3658, 5.155437,6.92275, 6.718375,9.01025};
static volatile int task1_flag;
static volatile int task2_flag;
static char display[32];
static _lock_t flash_lock;
#define LOAD_KMODEL_FROM_FLASH 1
#if LOAD_KMODEL_FROM_FLASH
#define KMODEL_SIZE (380 * 1024)
uint8_t *model_data;
#else
INCBIN(model, "../src/face_detect/detect.kmodel");
#endif
static void draw_edge(uint32_t *gram, obj_info_t *obj_info, uint32_t index, uint16_t color)
{
uint32_t data = ((uint32_t)color << 16) | (uint32_t)color;
volatile uint32_t *addr1, *addr2, *addr3, *addr4, x1, y1, x2, y2;
x1 = obj_info->obj[index].x1;
y1 = obj_info->obj[index].y1;
x2 = obj_info->obj[index].x2;
y2 = obj_info->obj[index].y2;
if (x1 <= 0)
x1 = 1;
if (x2 >= 319)
x2 = 318;
if (y1 <= 0)
y1 = 1;
if (y2 >= 239)
y2 = 238;
addr1 = gram + (320 * y1 + x1) / 2;
addr2 = gram + (320 * y1 + x2 - 8) / 2;
addr3 = gram + (320 * (y2 - 1) + x1) / 2;
addr4 = gram + (320 * (y2 - 1) + x2 - 8) / 2;
for (uint32_t i = 0; i < 4; i++)
{
*addr1 = data;
*(addr1 + 160) = data;
*addr2 = data;
*(addr2 + 160) = data;
*addr3 = data;
*(addr3 + 160) = data;
*addr4 = data;
*(addr4 + 160) = data;
addr1++;
addr2++;
addr3++;
addr4++;
}
addr1 = gram + (320 * y1 + x1) / 2;
addr2 = gram + (320 * y1 + x2 - 2) / 2;
addr3 = gram + (320 * (y2 - 8) + x1) / 2;
addr4 = gram + (320 * (y2 - 8) + x2 - 2) / 2;
for (uint32_t i = 0; i < 8; i++)
{
*addr1 = data;
*addr2 = data;
*addr3 = data;
*addr4 = data;
addr1 += 160;
addr2 += 160;
addr3 += 160;
addr4 += 160;
}
}
#define TEST_START_ADDR (0xB00000U)
#define TEST_START_ADDR2 (0x100000U)
#define TEST_NUMBER (0x1000U)
uint8_t data_buf_send[TEST_NUMBER];
uint8_t *data_buf_recv;
handle_t spi3;
static SemaphoreHandle_t event_read;
void task_list(void *arg)
{
char buffer[2048];
for(;;)
{
vTaskDelay(10000 / portTICK_RATE_MS);
vTaskList((char *)&buffer);
printk("task_name task_state priority stack task_num\n");
printk("%s ", buffer);
printk("FreeHeapSize:%ld Byte\n", xPortGetFreeHeapSize());
printk("MinimumEverFreeHeapSize:%ld Byte\n", xPortGetMinimumEverFreeHeapSize());
printk("unused:%d\n", iomem_unused());
}
vTaskDelete(NULL);
return;
}
void vTask1()
{
int32_t index = 0;
int32_t page_addr = TEST_START_ADDR;
struct timeval get_time[2];
while (1)
{
task1_flag = 1;
//configASSERT(xSemaphoreTake(event_read, 200) == pdTRUE);
_lock_acquire_recursive(&flash_lock);
gettimeofday(&get_time[0], NULL);
#if 0
fseek(stream,0,SEEK_SET);
fwrite(msg, 1, strlen(msg)+1, stream);
#else
if(page_addr >= 0x1000000 - TEST_NUMBER)
{
page_addr = TEST_START_ADDR;
}
task1_flag = 2;
w25qxx_write_data(page_addr, data_buf_send, TEST_NUMBER);
w25qxx_read_data(page_addr, data_buf_recv, TEST_NUMBER);
for (index = 0; index < TEST_NUMBER; index++)
{
if (data_buf_recv[index] != (uint8_t)index) {
printk("task1 Read err:0x%x 0x%x\n", data_buf_recv[index], index);
index += 0x100;
}
}
page_addr += TEST_NUMBER;
task1_flag = 3;
#endif
gettimeofday(&get_time[1], NULL);;
//printf("vtask1:%f ms \n", ((get_time[1].tv_sec - get_time[0].tv_sec)*1000*1000 + (get_time[1].tv_usec - get_time[0].tv_usec))/1000.0);
//xSemaphoreGive(event_read);
_lock_release_recursive(&flash_lock);
task1_flag = 4;
vTaskDelay(50 / portTICK_PERIOD_MS);
}
}
void vTask2()
{
int32_t index = 0;
int32_t page_addr = TEST_START_ADDR2;
struct timeval get_time[2];
while (1)
{
task2_flag = 1;
//configASSERT(xSemaphoreTake(event_read, 200) == pdTRUE);
_lock_acquire_recursive(&flash_lock);
gettimeofday(&get_time[0], NULL);
#if 0
fseek(stream,0,SEEK_SET);
fwrite(msg, 1, strlen(msg)+1, stream);
#else
if(page_addr >= 0xA00000 - TEST_NUMBER)
{
page_addr = TEST_START_ADDR2;
}
task2_flag = 2;
w25qxx_write_data(page_addr, data_buf_send, TEST_NUMBER);
w25qxx_read_data(page_addr, data_buf_recv, TEST_NUMBER);
for (index = 0; index < TEST_NUMBER; index++)
{
if (data_buf_recv[index] != (uint8_t)index) {
printk("task2 Read err:0x%x 0x%x\n", data_buf_recv[index], index);
index += 0x100;
}
}
page_addr += TEST_NUMBER;
task2_flag = 3;
#endif
gettimeofday(&get_time[1], NULL);;
//printf("vtask2:%f ms \n", ((get_time[1].tv_sec - get_time[0].tv_sec)*1000*1000 + (get_time[1].tv_usec - get_time[0].tv_usec))/1000.0);
//xSemaphoreGive(event_read);
_lock_release_recursive(&flash_lock);
task2_flag = 4;
vTaskDelay(50 / portTICK_PERIOD_MS);
}
}
void vTask3()
{
int32_t index = 0;
struct timeval get_time[2];
int32_t addr = 0;
while (1)
{
//_lock_acquire_recursive(&flash_lock);
gettimeofday(&get_time[0], NULL);
if(addr < 1024*1024*10)
addr = 0;
fseek(stream,addr,SEEK_SET);
fwrite(msg, 1, strlen(msg)+1, stream);
fseek(stream,addr,SEEK_SET);
fread(buffer, 1, strlen(msg)+1, stream);
gettimeofday(&get_time[1], NULL);
for(index=0; index < strlen(msg); index++)
{
if(buffer[index] != msg[index])
{
printk("task2 sd err:0x%x 0x%x\n", buffer[index], msg[index]);
break;
}
}
addr += 100;
//printf("vtask2:%f ms \n", ((get_time[1].tv_sec - get_time[0].tv_sec)*1000*1000 + (get_time[1].tv_usec - get_time[0].tv_usec))/1000.0);
//_lock_release_recursive(&flash_lock);
vTaskDelay(50 / portTICK_PERIOD_MS);
}
}
void detect()
{
int time_count = 0;
struct timeval get_time[2];
uint64_t time_last,time_now;
gettimeofday(&get_time[0], NULL);
while (1) {
while (camera_ctx.dvp_finish_flag == 0)
;
camera_ctx.dvp_finish_flag = 0;
uint32_t *lcd_gram = camera_ctx.gram_mux ? (uint32_t *)camera_ctx.lcd_image1->addr : (uint32_t *)camera_ctx.lcd_image0->addr;
#if 1
if (kpu_run(model_context, camera_ctx.ai_image->addr) != 0) {
printf("Cannot run kmodel.\n");
exit(-1);
}
float *output;
size_t output_size;
kpu_get_output(model_context, 0, (uint8_t **)&output, &output_size);
face_detect_rl.input = output;
region_layer_run(&face_detect_rl, &face_detect_info);
for (uint32_t face_cnt = 0; face_cnt < face_detect_info.obj_number; face_cnt++) {
draw_edge(lcd_gram, &face_detect_info, face_cnt, RED);
}
#endif
if(face_detect_info.obj_number)
{
printk("=====>face detect %d \n", face_detect_info.obj_number);
if(!task1_flag)
printk("==========>%d %d \n", task1_flag, task2_flag);
if(!task2_flag)
printk("==========>>%d %d \n", task1_flag, task2_flag);
}
//sprintf(display, "task1 = %d task2 = %d", task1_flag, task2_flag);
task1_flag = 0;
task2_flag = 0;
//lcd_draw_string(50, 50, display, RED);
lcd_draw_picture(0, 0, 320, 240, lcd_gram);
camera_ctx.gram_mux ^= 0x01;
time_count ++;
if(time_count == 100)
{
gettimeofday(&get_time[1], NULL);;
printf("SPF:%fms Byte\n", ((get_time[1].tv_sec - get_time[0].tv_sec)*1000*1000 + (get_time[1].tv_usec - get_time[0].tv_usec))/1000.0/100);
memcpy(&get_time[0], &get_time[1], sizeof(struct timeval));
time_count = 0;
}
}
io_close(model_context);
image_deinit(&kpu_image);
image_deinit(&display_image0);
image_deinit(&display_image1);
}
handle_t install_sdcard()
{
handle_t spi, gpio;
configASSERT(spi = io_open("/dev/spi1"));
configASSERT(gpio = io_open("/dev/gpio0"));
handle_t sd0 = spi_sdcard_driver_install(spi, gpio, 7);
io_close(spi);
io_close(gpio);
return sd0;
}
int main(void)
{
struct timeval get_time[2];
gettimeofday(&get_time[0], NULL);
//event_read = xSemaphoreCreateMutex();
data_buf_recv = iomem_malloc(TEST_NUMBER);
for (uint32_t index = 0; index < TEST_NUMBER; index++)
{
data_buf_send[index] = (uint8_t)(index);
}
#if LOAD_KMODEL_FROM_FLASH
model_data = (uint8_t *)iomem_malloc(KMODEL_SIZE);
#endif
#if 0
printf("Hello sd\n");
sd0 = install_sdcard();
configASSERT(sd0);
configASSERT(filesystem_mount("/fs/0/", sd0) == 0);
io_close(sd0);
if((stream=fopen("/fs/0/test_syscalls.txt","w+"))==NULL)
{
fprintf(stderr,"Can not open file.\n");
exit(-1);
}
#endif
uint64_t time;
kpu_image.pixel = 3;
kpu_image.width = 320;
kpu_image.height = 240;
image_init(&kpu_image);
display_image0.pixel = 2;
display_image0.width = 320;
display_image0.height = 240;
image_init(&display_image0);
display_image1.pixel = 2;
display_image1.width = 320;
display_image1.height = 240;
image_init(&display_image1);
camera_ctx.dvp_finish_flag = 0;
camera_ctx.ai_image = &kpu_image;
camera_ctx.lcd_image0 = &display_image0;
camera_ctx.lcd_image1 = &display_image1;
camera_ctx.gram_mux = 0;
face_detect_rl.anchor_number = ANCHOR_NUM;
face_detect_rl.anchor = anchor;
face_detect_rl.threshold = 0.7;
face_detect_rl.nms_value = 0.3;
region_layer_init(&face_detect_rl, 20, 15, 30, camera_ctx.ai_image->width, camera_ctx.ai_image->height);
printf("lcd init\n");
lcd_init();
printf("DVP init\n");
dvp_init(&camera_ctx);
ov5640_init();
spi3 = io_open("/dev/spi3");
configASSERT(spi3);
w25qxx_init(spi3);
#if LOAD_KMODEL_FROM_FLASH
w25qxx_read_data(0xA00000, model_data, KMODEL_SIZE);
#endif
model_context = kpu_model_load_from_buffer(model_data);
gettimeofday(&get_time[1], NULL);
printf("Start time:%fms\n", ((get_time[1].tv_sec - get_time[0].tv_sec)*1000*1000 + (get_time[1].tv_usec - get_time[0].tv_usec))/1000.0);
printf("xTaskCreate\n");
printf("xTaskCreate\n");
printf("xTaskCreate\n");
printf("xTaskCreate\n");
xTaskCreate(detect, "detect", 2048*2, NULL, 3, NULL);
xTaskCreate(vTask1, "vTask1", 2048, NULL, 3, NULL);
xTaskCreate(vTask2, "vTask2", 2048, NULL, 3, NULL);
//xTaskCreate(vTask3, "vTask3", 2048, NULL, 3, NULL);
xTaskCreate(task_list, "task_list", 2048, NULL, 2, NULL);
vTaskDelete(NULL);
}

View File

@ -1,464 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <devices.h>
#include <sys/unistd.h>
#include "ov5640.h"
#include "dvp_camera.h"
#include "ov5640af.h"
#include "ov5640cfg.h"
static uintptr_t file_sccb;
static uintptr_t file_ov5640;
#define REGLENGTH 16
const uint16_t jpeg_size_tbl[][2] = {
{ 160, 120 }, //QQVGA
{ 176, 144 }, //QCIF
{ 320, 240 }, //QVGA
{ 400, 240 }, //WQVGA
{ 352, 288 }, //CIF
};
uint8_t OV5640_WR_Reg(uint16_t reg, uint8_t data)
{
sccb_dev_write_byte(file_ov5640, reg, data);
return 0;
}
uint8_t OV5640_RD_Reg(uint16_t reg)
{
return sccb_dev_read_byte(file_ov5640, reg);
}
void ov5640_file_init()
{
file_sccb = io_open("/dev/sccb0");
file_ov5640 = sccb_get_device(file_sccb, OV5640_ADDR, REGLENGTH);
}
void ov5640_init(void)
{
uint16_t i = 0;
uint16_t reg;
ov5640_file_init();
reg = OV5640_RD_Reg(OV5640_CHIPIDH);
reg <<= 8;
reg |= OV5640_RD_Reg(OV5640_CHIPIDL);
printf("ID: %X \r\n", reg);
if (reg != OV5640_ID)
{
configASSERT(!"ov5640 get id error.");
}
usleep(100 * 1000);
OV5640_WR_Reg(0x3103, 0X11); //system clock from pad, bit[1]
OV5640_WR_Reg(0X3008, 0X82);
usleep(100 * 1000);
for (i = 0; ov5640_config[i][0] != 0; i++)
OV5640_WR_Reg(ov5640_config[i][0], ov5640_config[i][1]);
}
void OV5640_JPEG_Mode(void)
{
uint16_t i = 0;
for (i = 0; i < (sizeof(OV5640_jpeg_reg_tbl) / 4); i++)
{
OV5640_WR_Reg(OV5640_jpeg_reg_tbl[i][0], OV5640_jpeg_reg_tbl[i][1]);
}
}
void OV5640_RGB565_Mode(void)
{
uint16_t i = 0;
for (i = 0; i < (sizeof(ov5640_rgb565_reg_tbl) / 4); i++)
{
OV5640_WR_Reg(ov5640_rgb565_reg_tbl[i][0], ov5640_rgb565_reg_tbl[i][1]);
}
}
const static uint8_t OV5640_EXPOSURE_TBL[7][6] = {
{ 0x10, 0x08, 0x10, 0x08, 0x20, 0x10 }, //-3
{ 0x20, 0x18, 0x41, 0x20, 0x18, 0x10 }, //-2
{ 0x30, 0x28, 0x61, 0x30, 0x28, 0x10 }, //-1
{ 0x38, 0x30, 0x61, 0x38, 0x30, 0x10 }, //0
{ 0x40, 0x38, 0x71, 0x40, 0x38, 0x10 }, //+1
{ 0x50, 0x48, 0x90, 0x50, 0x48, 0x20 }, //+2
{ 0x60, 0x58, 0xa0, 0x60, 0x58, 0x20 }, //+3
};
//exposure: 0 - 6,
void OV5640_Exposure(uint8_t exposure)
{
OV5640_WR_Reg(0x3212, 0x03); //start group 3
OV5640_WR_Reg(0x3a0f, OV5640_EXPOSURE_TBL[exposure][0]);
OV5640_WR_Reg(0x3a10, OV5640_EXPOSURE_TBL[exposure][1]);
OV5640_WR_Reg(0x3a1b, OV5640_EXPOSURE_TBL[exposure][2]);
OV5640_WR_Reg(0x3a1e, OV5640_EXPOSURE_TBL[exposure][3]);
OV5640_WR_Reg(0x3a11, OV5640_EXPOSURE_TBL[exposure][4]);
OV5640_WR_Reg(0x3a1f, OV5640_EXPOSURE_TBL[exposure][5]);
OV5640_WR_Reg(0x3212, 0x13); //end group 3
OV5640_WR_Reg(0x3212, 0xa3); //launch group 3
}
const static uint8_t OV5640_LIGHTMODE_TBL[5][7] = {
{ 0x04, 0X00, 0X04, 0X00, 0X04, 0X00, 0X00 }, //Auto
{ 0x06, 0X1C, 0X04, 0X00, 0X04, 0XF3, 0X01 }, //Sunny
{ 0x05, 0X48, 0X04, 0X00, 0X07, 0XCF, 0X01 }, //Office
{ 0x06, 0X48, 0X04, 0X00, 0X04, 0XD3, 0X01 }, //Cloudy
{ 0x04, 0X10, 0X04, 0X00, 0X08, 0X40, 0X01 }, //Home
};
// light mode:
// 0: auto
// 1: sunny
// 2: office
// 3: cloudy
// 4: home
void OV5640_Light_Mode(uint8_t mode)
{
uint8_t i;
OV5640_WR_Reg(0x3212, 0x03); //start group 3
for (i = 0; i < 7; i++)
OV5640_WR_Reg(0x3400 + i, OV5640_LIGHTMODE_TBL[mode][i]);
OV5640_WR_Reg(0x3212, 0x13); //end group 3
OV5640_WR_Reg(0x3212, 0xa3); //launch group 3
}
const static uint8_t OV5640_SATURATION_TBL[7][6] = {
{ 0X0C, 0x30, 0X3D, 0X3E, 0X3D, 0X01 }, //-3
{ 0X10, 0x3D, 0X4D, 0X4E, 0X4D, 0X01 }, //-2
{ 0X15, 0x52, 0X66, 0X68, 0X66, 0X02 }, //-1
{ 0X1A, 0x66, 0X80, 0X82, 0X80, 0X02 }, //+0
{ 0X1F, 0x7A, 0X9A, 0X9C, 0X9A, 0X02 }, //+1
{ 0X24, 0x8F, 0XB3, 0XB6, 0XB3, 0X03 }, //+2
{ 0X2B, 0xAB, 0XD6, 0XDA, 0XD6, 0X04 }, //+3
};
// Color Saturation:
// sat: 0 - 6
void OV5640_Color_Saturation(uint8_t sat)
{
uint8_t i;
OV5640_WR_Reg(0x3212, 0x03); //start group 3
OV5640_WR_Reg(0x5381, 0x1c);
OV5640_WR_Reg(0x5382, 0x5a);
OV5640_WR_Reg(0x5383, 0x06);
for (i = 0; i < 6; i++)
OV5640_WR_Reg(0x5384 + i, OV5640_SATURATION_TBL[sat][i]);
OV5640_WR_Reg(0x538b, 0x98);
OV5640_WR_Reg(0x538a, 0x01);
OV5640_WR_Reg(0x3212, 0x13); //end group 3
OV5640_WR_Reg(0x3212, 0xa3); //launch group 3
}
//Brightness
// bright: 0 - 8
void OV5640_Brightness(uint8_t bright)
{
uint8_t brtval;
if (bright < 4)
brtval = 4 - bright;
else
brtval = bright - 4;
OV5640_WR_Reg(0x3212, 0x03); //start group 3
OV5640_WR_Reg(0x5587, brtval << 4);
if (bright < 4)
OV5640_WR_Reg(0x5588, 0x09);
else
OV5640_WR_Reg(0x5588, 0x01);
OV5640_WR_Reg(0x3212, 0x13); //end group 3
OV5640_WR_Reg(0x3212, 0xa3); //launch group 3
}
//Contrast:
// contrast: 0 - 6
void OV5640_Contrast(uint8_t contrast)
{
uint8_t reg0val = 0X00;
uint8_t reg1val = 0X20;
switch (contrast)
{
case 0: //-3
reg1val = reg0val = 0X14;
break;
case 1: //-2
reg1val = reg0val = 0X18;
break;
case 2: //-1
reg1val = reg0val = 0X1C;
break;
case 4: //1
reg0val = 0X10;
reg1val = 0X24;
break;
case 5: //2
reg0val = 0X18;
reg1val = 0X28;
break;
case 6: //3
reg0val = 0X1C;
reg1val = 0X2C;
break;
}
OV5640_WR_Reg(0x3212, 0x03); //start group 3
OV5640_WR_Reg(0x5585, reg0val);
OV5640_WR_Reg(0x5586, reg1val);
OV5640_WR_Reg(0x3212, 0x13); //end group 3
OV5640_WR_Reg(0x3212, 0xa3); //launch group 3
}
// Sharpness:
// sharp: 0 - 33 (0: close , 33: auto , other: Sharpness)
void OV5640_Sharpness(uint8_t sharp)
{
if (sharp < 33)
{
OV5640_WR_Reg(0x5308, 0x65);
OV5640_WR_Reg(0x5302, sharp);
}
else // auto
{
OV5640_WR_Reg(0x5308, 0x25);
OV5640_WR_Reg(0x5300, 0x08);
OV5640_WR_Reg(0x5301, 0x30);
OV5640_WR_Reg(0x5302, 0x10);
OV5640_WR_Reg(0x5303, 0x00);
OV5640_WR_Reg(0x5309, 0x08);
OV5640_WR_Reg(0x530a, 0x30);
OV5640_WR_Reg(0x530b, 0x04);
OV5640_WR_Reg(0x530c, 0x06);
}
}
const static uint8_t OV5640_EFFECTS_TBL[7][3] =
{
{ 0X06, 0x40, 0X10 }, // normal
{ 0X1E, 0xA0, 0X40 },
{ 0X1E, 0x80, 0XC0 },
{ 0X1E, 0x80, 0X80 },
{ 0X1E, 0x40, 0XA0 },
{ 0X40, 0x40, 0X10 },
{ 0X1E, 0x60, 0X60 },
};
void OV5640_Special_Effects(uint8_t eft)
{
OV5640_WR_Reg(0x3212, 0x03); //start group 3
OV5640_WR_Reg(0x5580, OV5640_EFFECTS_TBL[eft][0]);
OV5640_WR_Reg(0x5583, OV5640_EFFECTS_TBL[eft][1]); // sat U
OV5640_WR_Reg(0x5584, OV5640_EFFECTS_TBL[eft][2]); // sat V
OV5640_WR_Reg(0x5003, 0x08);
OV5640_WR_Reg(0x3212, 0x13); //end group 3
OV5640_WR_Reg(0x3212, 0xa3); //launch group 3
}
// Flash Lamp
// sw: 0: off
// 1: on
void OV5640_Flash_Lamp(uint8_t sw)
{
OV5640_WR_Reg(0x3016, 0X02);
OV5640_WR_Reg(0x301C, 0X02);
if (sw)
OV5640_WR_Reg(0X3019, 0X02);
else
OV5640_WR_Reg(0X3019, 0X00);
}
// set the output size
uint8_t OV5640_OutSize_Set(uint16_t offx, uint16_t offy, uint16_t width, uint16_t height)
{
OV5640_WR_Reg(0X3212, 0X03);
OV5640_WR_Reg(0x3808, width >> 8);
OV5640_WR_Reg(0x3809, width & 0xff);
OV5640_WR_Reg(0x380a, height >> 8);
OV5640_WR_Reg(0x380b, height & 0xff);
OV5640_WR_Reg(0x3810, offx >> 8);
OV5640_WR_Reg(0x3811, offx & 0xff);
OV5640_WR_Reg(0x3812, offy >> 8);
OV5640_WR_Reg(0x3813, offy & 0xff);
OV5640_WR_Reg(0X3212, 0X13);
OV5640_WR_Reg(0X3212, 0Xa3);
return 0;
}
uint8_t OV5640_Focus_Init(void)
{
uint16_t i;
uint16_t addr = 0x8000;
uint8_t state = 0x8F;
OV5640_WR_Reg(0x3000, 0x20); //reset
for (i = 0; i < sizeof(OV5640_AF_Config); i++)
{
OV5640_WR_Reg(addr, OV5640_AF_Config[i]);
addr++;
}
OV5640_WR_Reg(0x3022, 0x00);
OV5640_WR_Reg(0x3023, 0x00);
OV5640_WR_Reg(0x3024, 0x00);
OV5640_WR_Reg(0x3025, 0x00);
OV5640_WR_Reg(0x3026, 0x00);
OV5640_WR_Reg(0x3027, 0x00);
OV5640_WR_Reg(0x3028, 0x00);
OV5640_WR_Reg(0x3029, 0x7f);
OV5640_WR_Reg(0x3000, 0x00);
i = 0;
do
{
state = OV5640_RD_Reg(0x3029);
usleep(5 * 1000);
i++;
if (i > 1000)
return 1;
} while (state != 0x70);
return 0;
}
uint8_t OV5640_Auto_Focus(void)
{
uint8_t temp = 0;
uint16_t retry = 0;
OV5640_WR_Reg(0x3023, 0x01);
OV5640_WR_Reg(0x3022, 0x08);
do
{
temp = OV5640_RD_Reg(0x3023);
retry++;
if (retry > 1000)
return 2;
usleep(5 * 1000);
} while (temp != 0x00);
OV5640_WR_Reg(0x3023, 0x01);
OV5640_WR_Reg(0x3022, 0x04);
retry = 0;
do
{
temp = OV5640_RD_Reg(0x3023);
retry++;
if (retry > 1000)
return 2;
usleep(5 * 1000);
} while (temp != 0x00);
return 0;
}
void jpeg_test(uint8_t jpg_size)
{
// HAL_DCMI_Stop(&hdcmi);
OV5640_JPEG_Mode();
OV5640_OutSize_Set(4, 0, jpeg_size_tbl[jpg_size][0], jpeg_size_tbl[jpg_size][1]);
OV5640_WR_Reg(0x3035, 0X41); // slow down OV5640 clocks
OV5640_WR_Reg(0x3036, 0x68);
//
// /* DCMI DMA DeInit */
// HAL_DMA_DeInit(&hdma_dcmi);
//
// /* DCMI DMA Init */
// /* DCMI Init */
// hdma_dcmi.Instance = DMA2_Stream1;
// hdma_dcmi.Init.Channel = DMA_CHANNEL_1;
// hdma_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;
// hdma_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;
// hdma_dcmi.Init.MemInc = DMA_MINC_ENABLE;
// hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
// hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
// hdma_dcmi.Init.Mode = DMA_CIRCULAR;
// hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;
// hdma_dcmi.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
// hdma_dcmi.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
// hdma_dcmi.Init.MemBurst = DMA_MBURST_SINGLE;
// hdma_dcmi.Init.PeriphBurst = DMA_PBURST_SINGLE;
// if (HAL_DMA_Init(&hdma_dcmi) != HAL_OK)
// {
// _Error_Handler(__FILE__, __LINE__);
// }
//
// __HAL_LINKDMA(&hdcmi,DMA_Handle,hdma_dcmi);
//
// __HAL_DCMI_ENABLE_IT(&hdcmi,DCMI_IT_FRAME);
//
// /* Start the Camera capture */
// HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_CONTINUOUS, (uint32_t)jpeg_data_buf, jpeg_buf_size/4 );
// jpeg_mode = 1;
//
while (1)
{
}
}
void rgb565_test(void)
{
// HAL_DCMI_Stop(&hdcmi);
//
// jpeg_mode = 0;
OV5640_RGB565_Mode();
OV5640_OutSize_Set(4, 0, XSIZE, YSIZE);
// BSP_LCD_Init();
// BSP_LCD_Clear(LCD_COLOR_BLACK);
//
// /* Set image position */
// ili9325_SetCursor(0, 0);
// /* Prepare to write GRAM (0x22) */
// LCD_IO_WriteReg(LCD_REG_34);
// OV5640_WR_Reg(0x3035,0X51); // slow down OV5640 clocks ,adapt to the refresh rate of the LCD
// OV5640_WR_Reg(0x3036,0X88);
//
// /* DCMI DMA DeInit */
// HAL_DMA_DeInit(&hdma_dcmi);
//
// /* DCMI DMA Init */
// /* DCMI Init */
// hdma_dcmi.Instance = DMA2_Stream1;
// hdma_dcmi.Init.Channel = DMA_CHANNEL_1;
// hdma_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;
// hdma_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;
// hdma_dcmi.Init.MemInc = DMA_MINC_DISABLE;
// hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
// hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
// hdma_dcmi.Init.Mode = DMA_CIRCULAR;
// hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;
// hdma_dcmi.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
// hdma_dcmi.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_HALFFULL;
// hdma_dcmi.Init.MemBurst = DMA_MBURST_SINGLE;
// hdma_dcmi.Init.PeriphBurst = DMA_PBURST_SINGLE;
// if (HAL_DMA_Init(&hdma_dcmi) != HAL_OK)
// {
// _Error_Handler(__FILE__, __LINE__);
// }
//
// __HAL_LINKDMA(&hdcmi,DMA_Handle,hdma_dcmi);
//
// /* Start the Camera capture */
// HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_CONTINUOUS, (uint32_t)LCD_GRAM_ADDRESS, 1);
//
// while(1)
// {
// }
}

View File

@ -1,62 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _OV5640_H
#define _OV5640_H
#include <stdint.h>
//#include "stm32f4xx.h"
#define OV5640_PWDN_Pin_RESET HAL_GPIO_WritePin(OV5640_PWDN_GPIO_Port, OV5640_PWDN_Pin, GPIO_PIN_RESET)
#define OV5640_ID 0X5640
#define OV5640_ADDR 0X78
#define OV5640_CHIPIDH 0X300A
#define OV5640_CHIPIDL 0X300B
#define USER_KEY_PRESS HAL_GPIO_ReadPin(USER_KEY_GPIO_Port, USER_KEY_Pin) == 0
#define WAKE_UP_KEY_PRESS HAL_GPIO_ReadPin(WAKE_UP_KEY_GPIO_Port, WAKE_UP_KEY_Pin) == 0
#define XSIZE 320
#define YSIZE 240
#define LCD_GRAM_ADDRESS 0x60020000 // FSMC Bank1 NOR/PSRM 1 (LCD_RS=1)
#define QQVGA_160_120 0
#define QCIF_176_144 1
#define QVGA_320_240 2
#define WQVGA_400_240 3
#define CIF_352_288 4
#define jpeg_buf_size 30 * 1024
uint8_t OV5640_WR_Reg(uint16_t reg, uint8_t data);
uint8_t OV5640_RD_Reg(uint16_t reg);
void ov5640_init(void);
void OV5640_JPEG_Mode(void);
void OV5640_RGB565_Mode(void);
void OV5640_Exposure(uint8_t exposure);
void OV5640_Light_Mode(uint8_t mode);
void OV5640_Color_Saturation(uint8_t sat);
void OV5640_Brightness(uint8_t bright);
void OV5640_Contrast(uint8_t contrast);
void OV5640_Sharpness(uint8_t sharp);
void OV5640_Special_Effects(uint8_t eft);
void OV5640_Test_Pattern(uint8_t mode);
void OV5640_Flash_Lamp(uint8_t sw);
uint8_t OV5640_OutSize_Set(uint16_t offx, uint16_t offy, uint16_t width, uint16_t height);
uint8_t OV5640_Focus_Init(void);
uint8_t OV5640_Auto_Focus(void);
void rgb565_test(void);
void jpeg_test(uint8_t jpg_size);
#endif

View File

@ -1,276 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _OV5640AF_H
#define _OV5640AF_H
// auto focus config
const unsigned char OV5640_AF_Config[] = {
0x02, 0x0f, 0xd6, 0x02, 0x0a, 0x39, 0xc2, 0x01, 0x22, 0x22, 0x00, 0x02, 0x0f, 0xb2, 0xe5, 0x1f, //0x8000,
0x70, 0x72, 0xf5, 0x1e, 0xd2, 0x35, 0xff, 0xef, 0x25, 0xe0, 0x24, 0x4e, 0xf8, 0xe4, 0xf6, 0x08, //0x8010,
0xf6, 0x0f, 0xbf, 0x34, 0xf2, 0x90, 0x0e, 0x93, 0xe4, 0x93, 0xff, 0xe5, 0x4b, 0xc3, 0x9f, 0x50, //0x8020,
0x04, 0x7f, 0x05, 0x80, 0x02, 0x7f, 0xfb, 0x78, 0xbd, 0xa6, 0x07, 0x12, 0x0f, 0x04, 0x40, 0x04, //0x8030,
0x7f, 0x03, 0x80, 0x02, 0x7f, 0x30, 0x78, 0xbc, 0xa6, 0x07, 0xe6, 0x18, 0xf6, 0x08, 0xe6, 0x78, //0x8040,
0xb9, 0xf6, 0x78, 0xbc, 0xe6, 0x78, 0xba, 0xf6, 0x78, 0xbf, 0x76, 0x33, 0xe4, 0x08, 0xf6, 0x78, //0x8050,
0xb8, 0x76, 0x01, 0x75, 0x4a, 0x02, 0x78, 0xb6, 0xf6, 0x08, 0xf6, 0x74, 0xff, 0x78, 0xc1, 0xf6, //0x8060,
0x08, 0xf6, 0x75, 0x1f, 0x01, 0x78, 0xbc, 0xe6, 0x75, 0xf0, 0x05, 0xa4, 0xf5, 0x4b, 0x12, 0x0a, //0x8070,
0xff, 0xc2, 0x37, 0x22, 0x78, 0xb8, 0xe6, 0xd3, 0x94, 0x00, 0x40, 0x02, 0x16, 0x22, 0xe5, 0x1f, //0x8080,
0xb4, 0x05, 0x23, 0xe4, 0xf5, 0x1f, 0xc2, 0x01, 0x78, 0xb6, 0xe6, 0xfe, 0x08, 0xe6, 0xff, 0x78, //0x8090,
0x4e, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0xa2, 0x37, 0xe4, 0x33, 0xf5, 0x3c, 0x90, 0x30, 0x28, 0xf0, //0x80a0,
0x75, 0x1e, 0x10, 0xd2, 0x35, 0x22, 0xe5, 0x4b, 0x75, 0xf0, 0x05, 0x84, 0x78, 0xbc, 0xf6, 0x90, //0x80b0,
0x0e, 0x8c, 0xe4, 0x93, 0xff, 0x25, 0xe0, 0x24, 0x0a, 0xf8, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0x78, //0x80c0,
0xbc, 0xe6, 0x25, 0xe0, 0x24, 0x4e, 0xf8, 0xa6, 0x04, 0x08, 0xa6, 0x05, 0xef, 0x12, 0x0f, 0x0b, //0x80d0,
0xd3, 0x78, 0xb7, 0x96, 0xee, 0x18, 0x96, 0x40, 0x0d, 0x78, 0xbc, 0xe6, 0x78, 0xb9, 0xf6, 0x78, //0x80e0,
0xb6, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x90, 0x0e, 0x8c, 0xe4, 0x93, 0x12, 0x0f, 0x0b, 0xc3, 0x78, //0x80f0,
0xc2, 0x96, 0xee, 0x18, 0x96, 0x50, 0x0d, 0x78, 0xbc, 0xe6, 0x78, 0xba, 0xf6, 0x78, 0xc1, 0xa6, //0x8100,
0x06, 0x08, 0xa6, 0x07, 0x78, 0xb6, 0xe6, 0xfe, 0x08, 0xe6, 0xc3, 0x78, 0xc2, 0x96, 0xff, 0xee, //0x8110,
0x18, 0x96, 0x78, 0xc3, 0xf6, 0x08, 0xa6, 0x07, 0x90, 0x0e, 0x95, 0xe4, 0x18, 0x12, 0x0e, 0xe9, //0x8120,
0x40, 0x02, 0xd2, 0x37, 0x78, 0xbc, 0xe6, 0x08, 0x26, 0x08, 0xf6, 0xe5, 0x1f, 0x64, 0x01, 0x70, //0x8130,
0x4a, 0xe6, 0xc3, 0x78, 0xc0, 0x12, 0x0e, 0xdf, 0x40, 0x05, 0x12, 0x0e, 0xda, 0x40, 0x39, 0x12, //0x8140,
0x0f, 0x02, 0x40, 0x04, 0x7f, 0xfe, 0x80, 0x02, 0x7f, 0x02, 0x78, 0xbd, 0xa6, 0x07, 0x78, 0xb9, //0x8150,
0xe6, 0x24, 0x03, 0x78, 0xbf, 0xf6, 0x78, 0xb9, 0xe6, 0x24, 0xfd, 0x78, 0xc0, 0xf6, 0x12, 0x0f, //0x8160,
0x02, 0x40, 0x06, 0x78, 0xc0, 0xe6, 0xff, 0x80, 0x04, 0x78, 0xbf, 0xe6, 0xff, 0x78, 0xbe, 0xa6, //0x8170,
0x07, 0x75, 0x1f, 0x02, 0x78, 0xb8, 0x76, 0x01, 0x02, 0x02, 0x4a, 0xe5, 0x1f, 0x64, 0x02, 0x60, //0x8180,
0x03, 0x02, 0x02, 0x2a, 0x78, 0xbe, 0xe6, 0xff, 0xc3, 0x78, 0xc0, 0x12, 0x0e, 0xe0, 0x40, 0x08, //0x8190,
0x12, 0x0e, 0xda, 0x50, 0x03, 0x02, 0x02, 0x28, 0x12, 0x0f, 0x02, 0x40, 0x04, 0x7f, 0xff, 0x80, //0x81a0,
0x02, 0x7f, 0x01, 0x78, 0xbd, 0xa6, 0x07, 0x78, 0xb9, 0xe6, 0x04, 0x78, 0xbf, 0xf6, 0x78, 0xb9, //0x81b0,
0xe6, 0x14, 0x78, 0xc0, 0xf6, 0x18, 0x12, 0x0f, 0x04, 0x40, 0x04, 0xe6, 0xff, 0x80, 0x02, 0x7f, //0x81c0,
0x00, 0x78, 0xbf, 0xa6, 0x07, 0xd3, 0x08, 0xe6, 0x64, 0x80, 0x94, 0x80, 0x40, 0x04, 0xe6, 0xff, //0x81d0,
0x80, 0x02, 0x7f, 0x00, 0x78, 0xc0, 0xa6, 0x07, 0xc3, 0x18, 0xe6, 0x64, 0x80, 0x94, 0xb3, 0x50, //0x81e0,
0x04, 0xe6, 0xff, 0x80, 0x02, 0x7f, 0x33, 0x78, 0xbf, 0xa6, 0x07, 0xc3, 0x08, 0xe6, 0x64, 0x80, //0x81f0,
0x94, 0xb3, 0x50, 0x04, 0xe6, 0xff, 0x80, 0x02, 0x7f, 0x33, 0x78, 0xc0, 0xa6, 0x07, 0x12, 0x0f, //0x8200,
0x02, 0x40, 0x06, 0x78, 0xc0, 0xe6, 0xff, 0x80, 0x04, 0x78, 0xbf, 0xe6, 0xff, 0x78, 0xbe, 0xa6, //0x8210,
0x07, 0x75, 0x1f, 0x03, 0x78, 0xb8, 0x76, 0x01, 0x80, 0x20, 0xe5, 0x1f, 0x64, 0x03, 0x70, 0x26, //0x8220,
0x78, 0xbe, 0xe6, 0xff, 0xc3, 0x78, 0xc0, 0x12, 0x0e, 0xe0, 0x40, 0x05, 0x12, 0x0e, 0xda, 0x40, //0x8230,
0x09, 0x78, 0xb9, 0xe6, 0x78, 0xbe, 0xf6, 0x75, 0x1f, 0x04, 0x78, 0xbe, 0xe6, 0x75, 0xf0, 0x05, //0x8240,
0xa4, 0xf5, 0x4b, 0x02, 0x0a, 0xff, 0xe5, 0x1f, 0xb4, 0x04, 0x10, 0x90, 0x0e, 0x94, 0xe4, 0x78, //0x8250,
0xc3, 0x12, 0x0e, 0xe9, 0x40, 0x02, 0xd2, 0x37, 0x75, 0x1f, 0x05, 0x22, 0x30, 0x01, 0x03, 0x02, //0x8260,
0x04, 0xc0, 0x30, 0x02, 0x03, 0x02, 0x04, 0xc0, 0x90, 0x51, 0xa5, 0xe0, 0x78, 0x93, 0xf6, 0xa3, //0x8270,
0xe0, 0x08, 0xf6, 0xa3, 0xe0, 0x08, 0xf6, 0xe5, 0x1f, 0x70, 0x3c, 0x75, 0x1e, 0x20, 0xd2, 0x35, //0x8280,
0x12, 0x0c, 0x7a, 0x78, 0x7e, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x78, 0x8b, 0xa6, 0x09, 0x18, 0x76, //0x8290,
0x01, 0x12, 0x0c, 0x5b, 0x78, 0x4e, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x78, 0x8b, 0xe6, 0x78, 0x6e, //0x82a0,
0xf6, 0x75, 0x1f, 0x01, 0x78, 0x93, 0xe6, 0x78, 0x90, 0xf6, 0x78, 0x94, 0xe6, 0x78, 0x91, 0xf6, //0x82b0,
0x78, 0x95, 0xe6, 0x78, 0x92, 0xf6, 0x22, 0x79, 0x90, 0xe7, 0xd3, 0x78, 0x93, 0x96, 0x40, 0x05, //0x82c0,
0xe7, 0x96, 0xff, 0x80, 0x08, 0xc3, 0x79, 0x93, 0xe7, 0x78, 0x90, 0x96, 0xff, 0x78, 0x88, 0x76, //0x82d0,
0x00, 0x08, 0xa6, 0x07, 0x79, 0x91, 0xe7, 0xd3, 0x78, 0x94, 0x96, 0x40, 0x05, 0xe7, 0x96, 0xff, //0x82e0,
0x80, 0x08, 0xc3, 0x79, 0x94, 0xe7, 0x78, 0x91, 0x96, 0xff, 0x12, 0x0c, 0x8e, 0x79, 0x92, 0xe7, //0x82f0,
0xd3, 0x78, 0x95, 0x96, 0x40, 0x05, 0xe7, 0x96, 0xff, 0x80, 0x08, 0xc3, 0x79, 0x95, 0xe7, 0x78, //0x8300,
0x92, 0x96, 0xff, 0x12, 0x0c, 0x8e, 0x12, 0x0c, 0x5b, 0x78, 0x8a, 0xe6, 0x25, 0xe0, 0x24, 0x4e, //0x8310,
0xf8, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x78, 0x8a, 0xe6, 0x24, 0x6e, 0xf8, 0xa6, 0x09, 0x78, 0x8a, //0x8320,
0xe6, 0x24, 0x01, 0xff, 0xe4, 0x33, 0xfe, 0xd3, 0xef, 0x94, 0x0f, 0xee, 0x64, 0x80, 0x94, 0x80, //0x8330,
0x40, 0x04, 0x7f, 0x00, 0x80, 0x05, 0x78, 0x8a, 0xe6, 0x04, 0xff, 0x78, 0x8a, 0xa6, 0x07, 0xe5, //0x8340,
0x1f, 0xb4, 0x01, 0x0a, 0xe6, 0x60, 0x03, 0x02, 0x04, 0xc0, 0x75, 0x1f, 0x02, 0x22, 0x12, 0x0c, //0x8350,
0x7a, 0x78, 0x80, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x12, 0x0c, 0x7a, 0x78, 0x82, 0xa6, 0x06, 0x08, //0x8360,
0xa6, 0x07, 0x78, 0x6e, 0xe6, 0x78, 0x8c, 0xf6, 0x78, 0x6e, 0xe6, 0x78, 0x8d, 0xf6, 0x7f, 0x01, //0x8370,
0xef, 0x25, 0xe0, 0x24, 0x4f, 0xf9, 0xc3, 0x78, 0x81, 0xe6, 0x97, 0x18, 0xe6, 0x19, 0x97, 0x50, //0x8380,
0x0a, 0x12, 0x0c, 0x82, 0x78, 0x80, 0xa6, 0x04, 0x08, 0xa6, 0x05, 0x74, 0x6e, 0x2f, 0xf9, 0x78, //0x8390,
0x8c, 0xe6, 0xc3, 0x97, 0x50, 0x08, 0x74, 0x6e, 0x2f, 0xf8, 0xe6, 0x78, 0x8c, 0xf6, 0xef, 0x25, //0x83a0,
0xe0, 0x24, 0x4f, 0xf9, 0xd3, 0x78, 0x83, 0xe6, 0x97, 0x18, 0xe6, 0x19, 0x97, 0x40, 0x0a, 0x12, //0x83b0,
0x0c, 0x82, 0x78, 0x82, 0xa6, 0x04, 0x08, 0xa6, 0x05, 0x74, 0x6e, 0x2f, 0xf9, 0x78, 0x8d, 0xe6, //0x83c0,
0xd3, 0x97, 0x40, 0x08, 0x74, 0x6e, 0x2f, 0xf8, 0xe6, 0x78, 0x8d, 0xf6, 0x0f, 0xef, 0x64, 0x10, //0x83d0,
0x70, 0x9e, 0xc3, 0x79, 0x81, 0xe7, 0x78, 0x83, 0x96, 0xff, 0x19, 0xe7, 0x18, 0x96, 0x78, 0x84, //0x83e0,
0xf6, 0x08, 0xa6, 0x07, 0xc3, 0x79, 0x8c, 0xe7, 0x78, 0x8d, 0x96, 0x08, 0xf6, 0xd3, 0x79, 0x81, //0x83f0,
0xe7, 0x78, 0x7f, 0x96, 0x19, 0xe7, 0x18, 0x96, 0x40, 0x05, 0x09, 0xe7, 0x08, 0x80, 0x06, 0xc3, //0x8400,
0x79, 0x7f, 0xe7, 0x78, 0x81, 0x96, 0xff, 0x19, 0xe7, 0x18, 0x96, 0xfe, 0x78, 0x86, 0xa6, 0x06, //0x8410,
0x08, 0xa6, 0x07, 0x79, 0x8c, 0xe7, 0xd3, 0x78, 0x8b, 0x96, 0x40, 0x05, 0xe7, 0x96, 0xff, 0x80, //0x8420,
0x08, 0xc3, 0x79, 0x8b, 0xe7, 0x78, 0x8c, 0x96, 0xff, 0x78, 0x8f, 0xa6, 0x07, 0xe5, 0x1f, 0x64, //0x8430,
0x02, 0x70, 0x69, 0x90, 0x0e, 0x91, 0x93, 0xff, 0x18, 0xe6, 0xc3, 0x9f, 0x50, 0x72, 0x12, 0x0c, //0x8440,
0x4a, 0x12, 0x0c, 0x2f, 0x90, 0x0e, 0x8e, 0x12, 0x0c, 0x38, 0x78, 0x80, 0x12, 0x0c, 0x6b, 0x7b, //0x8450,
0x04, 0x12, 0x0c, 0x1d, 0xc3, 0x12, 0x06, 0x45, 0x50, 0x56, 0x90, 0x0e, 0x92, 0xe4, 0x93, 0xff, //0x8460,
0x78, 0x8f, 0xe6, 0x9f, 0x40, 0x02, 0x80, 0x11, 0x90, 0x0e, 0x90, 0xe4, 0x93, 0xff, 0xd3, 0x78, //0x8470,
0x89, 0xe6, 0x9f, 0x18, 0xe6, 0x94, 0x00, 0x40, 0x03, 0x75, 0x1f, 0x05, 0x12, 0x0c, 0x4a, 0x12, //0x8480,
0x0c, 0x2f, 0x90, 0x0e, 0x8f, 0x12, 0x0c, 0x38, 0x78, 0x7e, 0x12, 0x0c, 0x6b, 0x7b, 0x40, 0x12, //0x8490,
0x0c, 0x1d, 0xd3, 0x12, 0x06, 0x45, 0x40, 0x18, 0x75, 0x1f, 0x05, 0x22, 0xe5, 0x1f, 0xb4, 0x05, //0x84a0,
0x0f, 0xd2, 0x01, 0xc2, 0x02, 0xe4, 0xf5, 0x1f, 0xf5, 0x1e, 0xd2, 0x35, 0xd2, 0x33, 0xd2, 0x36, //0x84b0,
0x22, 0xef, 0x8d, 0xf0, 0xa4, 0xa8, 0xf0, 0xcf, 0x8c, 0xf0, 0xa4, 0x28, 0xce, 0x8d, 0xf0, 0xa4, //0x84c0,
0x2e, 0xfe, 0x22, 0xbc, 0x00, 0x0b, 0xbe, 0x00, 0x29, 0xef, 0x8d, 0xf0, 0x84, 0xff, 0xad, 0xf0, //0x84d0,
0x22, 0xe4, 0xcc, 0xf8, 0x75, 0xf0, 0x08, 0xef, 0x2f, 0xff, 0xee, 0x33, 0xfe, 0xec, 0x33, 0xfc, //0x84e0,
0xee, 0x9d, 0xec, 0x98, 0x40, 0x05, 0xfc, 0xee, 0x9d, 0xfe, 0x0f, 0xd5, 0xf0, 0xe9, 0xe4, 0xce, //0x84f0,
0xfd, 0x22, 0xed, 0xf8, 0xf5, 0xf0, 0xee, 0x84, 0x20, 0xd2, 0x1c, 0xfe, 0xad, 0xf0, 0x75, 0xf0, //0x8500,
0x08, 0xef, 0x2f, 0xff, 0xed, 0x33, 0xfd, 0x40, 0x07, 0x98, 0x50, 0x06, 0xd5, 0xf0, 0xf2, 0x22, //0x8510,
0xc3, 0x98, 0xfd, 0x0f, 0xd5, 0xf0, 0xea, 0x22, 0xe8, 0x8f, 0xf0, 0xa4, 0xcc, 0x8b, 0xf0, 0xa4, //0x8520,
0x2c, 0xfc, 0xe9, 0x8e, 0xf0, 0xa4, 0x2c, 0xfc, 0x8a, 0xf0, 0xed, 0xa4, 0x2c, 0xfc, 0xea, 0x8e, //0x8530,
0xf0, 0xa4, 0xcd, 0xa8, 0xf0, 0x8b, 0xf0, 0xa4, 0x2d, 0xcc, 0x38, 0x25, 0xf0, 0xfd, 0xe9, 0x8f, //0x8540,
0xf0, 0xa4, 0x2c, 0xcd, 0x35, 0xf0, 0xfc, 0xeb, 0x8e, 0xf0, 0xa4, 0xfe, 0xa9, 0xf0, 0xeb, 0x8f, //0x8550,
0xf0, 0xa4, 0xcf, 0xc5, 0xf0, 0x2e, 0xcd, 0x39, 0xfe, 0xe4, 0x3c, 0xfc, 0xea, 0xa4, 0x2d, 0xce, //0x8560,
0x35, 0xf0, 0xfd, 0xe4, 0x3c, 0xfc, 0x22, 0x75, 0xf0, 0x08, 0x75, 0x82, 0x00, 0xef, 0x2f, 0xff, //0x8570,
0xee, 0x33, 0xfe, 0xcd, 0x33, 0xcd, 0xcc, 0x33, 0xcc, 0xc5, 0x82, 0x33, 0xc5, 0x82, 0x9b, 0xed, //0x8580,
0x9a, 0xec, 0x99, 0xe5, 0x82, 0x98, 0x40, 0x0c, 0xf5, 0x82, 0xee, 0x9b, 0xfe, 0xed, 0x9a, 0xfd, //0x8590,
0xec, 0x99, 0xfc, 0x0f, 0xd5, 0xf0, 0xd6, 0xe4, 0xce, 0xfb, 0xe4, 0xcd, 0xfa, 0xe4, 0xcc, 0xf9, //0x85a0,
0xa8, 0x82, 0x22, 0xb8, 0x00, 0xc1, 0xb9, 0x00, 0x59, 0xba, 0x00, 0x2d, 0xec, 0x8b, 0xf0, 0x84, //0x85b0,
0xcf, 0xce, 0xcd, 0xfc, 0xe5, 0xf0, 0xcb, 0xf9, 0x78, 0x18, 0xef, 0x2f, 0xff, 0xee, 0x33, 0xfe, //0x85c0,
0xed, 0x33, 0xfd, 0xec, 0x33, 0xfc, 0xeb, 0x33, 0xfb, 0x10, 0xd7, 0x03, 0x99, 0x40, 0x04, 0xeb, //0x85d0,
0x99, 0xfb, 0x0f, 0xd8, 0xe5, 0xe4, 0xf9, 0xfa, 0x22, 0x78, 0x18, 0xef, 0x2f, 0xff, 0xee, 0x33, //0x85e0,
0xfe, 0xed, 0x33, 0xfd, 0xec, 0x33, 0xfc, 0xc9, 0x33, 0xc9, 0x10, 0xd7, 0x05, 0x9b, 0xe9, 0x9a, //0x85f0,
0x40, 0x07, 0xec, 0x9b, 0xfc, 0xe9, 0x9a, 0xf9, 0x0f, 0xd8, 0xe0, 0xe4, 0xc9, 0xfa, 0xe4, 0xcc, //0x8600,
0xfb, 0x22, 0x75, 0xf0, 0x10, 0xef, 0x2f, 0xff, 0xee, 0x33, 0xfe, 0xed, 0x33, 0xfd, 0xcc, 0x33, //0x8610,
0xcc, 0xc8, 0x33, 0xc8, 0x10, 0xd7, 0x07, 0x9b, 0xec, 0x9a, 0xe8, 0x99, 0x40, 0x0a, 0xed, 0x9b, //0x8620,
0xfd, 0xec, 0x9a, 0xfc, 0xe8, 0x99, 0xf8, 0x0f, 0xd5, 0xf0, 0xda, 0xe4, 0xcd, 0xfb, 0xe4, 0xcc, //0x8630,
0xfa, 0xe4, 0xc8, 0xf9, 0x22, 0xeb, 0x9f, 0xf5, 0xf0, 0xea, 0x9e, 0x42, 0xf0, 0xe9, 0x9d, 0x42, //0x8640,
0xf0, 0xe8, 0x9c, 0x45, 0xf0, 0x22, 0xe8, 0x60, 0x0f, 0xec, 0xc3, 0x13, 0xfc, 0xed, 0x13, 0xfd, //0x8650,
0xee, 0x13, 0xfe, 0xef, 0x13, 0xff, 0xd8, 0xf1, 0x22, 0xe8, 0x60, 0x0f, 0xef, 0xc3, 0x33, 0xff, //0x8660,
0xee, 0x33, 0xfe, 0xed, 0x33, 0xfd, 0xec, 0x33, 0xfc, 0xd8, 0xf1, 0x22, 0xe4, 0x93, 0xfc, 0x74, //0x8670,
0x01, 0x93, 0xfd, 0x74, 0x02, 0x93, 0xfe, 0x74, 0x03, 0x93, 0xff, 0x22, 0xe6, 0xfb, 0x08, 0xe6, //0x8680,
0xf9, 0x08, 0xe6, 0xfa, 0x08, 0xe6, 0xcb, 0xf8, 0x22, 0xec, 0xf6, 0x08, 0xed, 0xf6, 0x08, 0xee, //0x8690,
0xf6, 0x08, 0xef, 0xf6, 0x22, 0xa4, 0x25, 0x82, 0xf5, 0x82, 0xe5, 0xf0, 0x35, 0x83, 0xf5, 0x83, //0x86a0,
0x22, 0xd0, 0x83, 0xd0, 0x82, 0xf8, 0xe4, 0x93, 0x70, 0x12, 0x74, 0x01, 0x93, 0x70, 0x0d, 0xa3, //0x86b0,
0xa3, 0x93, 0xf8, 0x74, 0x01, 0x93, 0xf5, 0x82, 0x88, 0x83, 0xe4, 0x73, 0x74, 0x02, 0x93, 0x68, //0x86c0,
0x60, 0xef, 0xa3, 0xa3, 0xa3, 0x80, 0xdf, 0x90, 0x38, 0x04, 0x78, 0x52, 0x12, 0x0b, 0xfd, 0x90, //0x86d0,
0x38, 0x00, 0xe0, 0xfe, 0xa3, 0xe0, 0xfd, 0xed, 0xff, 0xc3, 0x12, 0x0b, 0x9e, 0x90, 0x38, 0x10, //0x86e0,
0x12, 0x0b, 0x92, 0x90, 0x38, 0x06, 0x78, 0x54, 0x12, 0x0b, 0xfd, 0x90, 0x38, 0x02, 0xe0, 0xfe, //0x86f0,
0xa3, 0xe0, 0xfd, 0xed, 0xff, 0xc3, 0x12, 0x0b, 0x9e, 0x90, 0x38, 0x12, 0x12, 0x0b, 0x92, 0xa3, //0x8700,
0xe0, 0xb4, 0x31, 0x07, 0x78, 0x52, 0x79, 0x52, 0x12, 0x0c, 0x13, 0x90, 0x38, 0x14, 0xe0, 0xb4, //0x8710,
0x71, 0x15, 0x78, 0x52, 0xe6, 0xfe, 0x08, 0xe6, 0x78, 0x02, 0xce, 0xc3, 0x13, 0xce, 0x13, 0xd8, //0x8720,
0xf9, 0x79, 0x53, 0xf7, 0xee, 0x19, 0xf7, 0x90, 0x38, 0x15, 0xe0, 0xb4, 0x31, 0x07, 0x78, 0x54, //0x8730,
0x79, 0x54, 0x12, 0x0c, 0x13, 0x90, 0x38, 0x15, 0xe0, 0xb4, 0x71, 0x15, 0x78, 0x54, 0xe6, 0xfe, //0x8740,
0x08, 0xe6, 0x78, 0x02, 0xce, 0xc3, 0x13, 0xce, 0x13, 0xd8, 0xf9, 0x79, 0x55, 0xf7, 0xee, 0x19, //0x8750,
0xf7, 0x79, 0x52, 0x12, 0x0b, 0xd9, 0x09, 0x12, 0x0b, 0xd9, 0xaf, 0x47, 0x12, 0x0b, 0xb2, 0xe5, //0x8760,
0x44, 0xfb, 0x7a, 0x00, 0xfd, 0x7c, 0x00, 0x12, 0x04, 0xd3, 0x78, 0x5a, 0xa6, 0x06, 0x08, 0xa6, //0x8770,
0x07, 0xaf, 0x45, 0x12, 0x0b, 0xb2, 0xad, 0x03, 0x7c, 0x00, 0x12, 0x04, 0xd3, 0x78, 0x56, 0xa6, //0x8780,
0x06, 0x08, 0xa6, 0x07, 0xaf, 0x48, 0x78, 0x54, 0x12, 0x0b, 0xb4, 0xe5, 0x43, 0xfb, 0xfd, 0x7c, //0x8790,
0x00, 0x12, 0x04, 0xd3, 0x78, 0x5c, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0xaf, 0x46, 0x7e, 0x00, 0x78, //0x87a0,
0x54, 0x12, 0x0b, 0xb6, 0xad, 0x03, 0x7c, 0x00, 0x12, 0x04, 0xd3, 0x78, 0x58, 0xa6, 0x06, 0x08, //0x87b0,
0xa6, 0x07, 0xc3, 0x78, 0x5b, 0xe6, 0x94, 0x08, 0x18, 0xe6, 0x94, 0x00, 0x50, 0x05, 0x76, 0x00, //0x87c0,
0x08, 0x76, 0x08, 0xc3, 0x78, 0x5d, 0xe6, 0x94, 0x08, 0x18, 0xe6, 0x94, 0x00, 0x50, 0x05, 0x76, //0x87d0,
0x00, 0x08, 0x76, 0x08, 0x78, 0x5a, 0x12, 0x0b, 0xc6, 0xff, 0xd3, 0x78, 0x57, 0xe6, 0x9f, 0x18, //0x87e0,
0xe6, 0x9e, 0x40, 0x0e, 0x78, 0x5a, 0xe6, 0x13, 0xfe, 0x08, 0xe6, 0x78, 0x57, 0x12, 0x0c, 0x08, //0x87f0,
0x80, 0x04, 0x7e, 0x00, 0x7f, 0x00, 0x78, 0x5e, 0x12, 0x0b, 0xbe, 0xff, 0xd3, 0x78, 0x59, 0xe6, //0x8800,
0x9f, 0x18, 0xe6, 0x9e, 0x40, 0x0e, 0x78, 0x5c, 0xe6, 0x13, 0xfe, 0x08, 0xe6, 0x78, 0x59, 0x12, //0x8810,
0x0c, 0x08, 0x80, 0x04, 0x7e, 0x00, 0x7f, 0x00, 0xe4, 0xfc, 0xfd, 0x78, 0x62, 0x12, 0x06, 0x99, //0x8820,
0x78, 0x5a, 0x12, 0x0b, 0xc6, 0x78, 0x57, 0x26, 0xff, 0xee, 0x18, 0x36, 0xfe, 0x78, 0x66, 0x12, //0x8830,
0x0b, 0xbe, 0x78, 0x59, 0x26, 0xff, 0xee, 0x18, 0x36, 0xfe, 0xe4, 0xfc, 0xfd, 0x78, 0x6a, 0x12, //0x8840,
0x06, 0x99, 0x12, 0x0b, 0xce, 0x78, 0x66, 0x12, 0x06, 0x8c, 0xd3, 0x12, 0x06, 0x45, 0x40, 0x08, //0x8850,
0x12, 0x0b, 0xce, 0x78, 0x66, 0x12, 0x06, 0x99, 0x78, 0x54, 0x12, 0x0b, 0xd0, 0x78, 0x6a, 0x12, //0x8860,
0x06, 0x8c, 0xd3, 0x12, 0x06, 0x45, 0x40, 0x0a, 0x78, 0x54, 0x12, 0x0b, 0xd0, 0x78, 0x6a, 0x12, //0x8870,
0x06, 0x99, 0x78, 0x61, 0xe6, 0x90, 0x60, 0x01, 0xf0, 0x78, 0x65, 0xe6, 0xa3, 0xf0, 0x78, 0x69, //0x8880,
0xe6, 0xa3, 0xf0, 0x78, 0x55, 0xe6, 0xa3, 0xf0, 0x7d, 0x01, 0x78, 0x61, 0x12, 0x0b, 0xe9, 0x24, //0x8890,
0x01, 0x12, 0x0b, 0xa6, 0x78, 0x65, 0x12, 0x0b, 0xe9, 0x24, 0x02, 0x12, 0x0b, 0xa6, 0x78, 0x69, //0x88a0,
0x12, 0x0b, 0xe9, 0x24, 0x03, 0x12, 0x0b, 0xa6, 0x78, 0x6d, 0x12, 0x0b, 0xe9, 0x24, 0x04, 0x12, //0x88b0,
0x0b, 0xa6, 0x0d, 0xbd, 0x05, 0xd4, 0xc2, 0x0e, 0xc2, 0x06, 0x22, 0x85, 0x08, 0x41, 0x90, 0x30, //0x88c0,
0x24, 0xe0, 0xf5, 0x3d, 0xa3, 0xe0, 0xf5, 0x3e, 0xa3, 0xe0, 0xf5, 0x3f, 0xa3, 0xe0, 0xf5, 0x40, //0x88d0,
0xa3, 0xe0, 0xf5, 0x3c, 0xd2, 0x34, 0xe5, 0x41, 0x12, 0x06, 0xb1, 0x09, 0x31, 0x03, 0x09, 0x35, //0x88e0,
0x04, 0x09, 0x3b, 0x05, 0x09, 0x3e, 0x06, 0x09, 0x41, 0x07, 0x09, 0x4a, 0x08, 0x09, 0x5b, 0x12, //0x88f0,
0x09, 0x73, 0x18, 0x09, 0x89, 0x19, 0x09, 0x5e, 0x1a, 0x09, 0x6a, 0x1b, 0x09, 0xad, 0x80, 0x09, //0x8900,
0xb2, 0x81, 0x0a, 0x1d, 0x8f, 0x0a, 0x09, 0x90, 0x0a, 0x1d, 0x91, 0x0a, 0x1d, 0x92, 0x0a, 0x1d, //0x8910,
0x93, 0x0a, 0x1d, 0x94, 0x0a, 0x1d, 0x98, 0x0a, 0x17, 0x9f, 0x0a, 0x1a, 0xec, 0x00, 0x00, 0x0a, //0x8920,
0x38, 0x12, 0x0f, 0x74, 0x22, 0x12, 0x0f, 0x74, 0xd2, 0x03, 0x22, 0xd2, 0x03, 0x22, 0xc2, 0x03, //0x8930,
0x22, 0xa2, 0x37, 0xe4, 0x33, 0xf5, 0x3c, 0x02, 0x0a, 0x1d, 0xc2, 0x01, 0xc2, 0x02, 0xc2, 0x03, //0x8940,
0x12, 0x0d, 0x0d, 0x75, 0x1e, 0x70, 0xd2, 0x35, 0x02, 0x0a, 0x1d, 0x02, 0x0a, 0x04, 0x85, 0x40, //0x8950,
0x4a, 0x85, 0x3c, 0x4b, 0x12, 0x0a, 0xff, 0x02, 0x0a, 0x1d, 0x85, 0x4a, 0x40, 0x85, 0x4b, 0x3c, //0x8960,
0x02, 0x0a, 0x1d, 0xe4, 0xf5, 0x22, 0xf5, 0x23, 0x85, 0x40, 0x31, 0x85, 0x3f, 0x30, 0x85, 0x3e, //0x8970,
0x2f, 0x85, 0x3d, 0x2e, 0x12, 0x0f, 0x46, 0x80, 0x1f, 0x75, 0x22, 0x00, 0x75, 0x23, 0x01, 0x74, //0x8980,
0xff, 0xf5, 0x2d, 0xf5, 0x2c, 0xf5, 0x2b, 0xf5, 0x2a, 0x12, 0x0f, 0x46, 0x85, 0x2d, 0x40, 0x85, //0x8990,
0x2c, 0x3f, 0x85, 0x2b, 0x3e, 0x85, 0x2a, 0x3d, 0xe4, 0xf5, 0x3c, 0x80, 0x70, 0x12, 0x0f, 0x16, //0x89a0,
0x80, 0x6b, 0x85, 0x3d, 0x45, 0x85, 0x3e, 0x46, 0xe5, 0x47, 0xc3, 0x13, 0xff, 0xe5, 0x45, 0xc3, //0x89b0,
0x9f, 0x50, 0x02, 0x8f, 0x45, 0xe5, 0x48, 0xc3, 0x13, 0xff, 0xe5, 0x46, 0xc3, 0x9f, 0x50, 0x02, //0x89c0,
0x8f, 0x46, 0xe5, 0x47, 0xc3, 0x13, 0xff, 0xfd, 0xe5, 0x45, 0x2d, 0xfd, 0xe4, 0x33, 0xfc, 0xe5, //0x89d0,
0x44, 0x12, 0x0f, 0x90, 0x40, 0x05, 0xe5, 0x44, 0x9f, 0xf5, 0x45, 0xe5, 0x48, 0xc3, 0x13, 0xff, //0x89e0,
0xfd, 0xe5, 0x46, 0x2d, 0xfd, 0xe4, 0x33, 0xfc, 0xe5, 0x43, 0x12, 0x0f, 0x90, 0x40, 0x05, 0xe5, //0x89f0,
0x43, 0x9f, 0xf5, 0x46, 0x12, 0x06, 0xd7, 0x80, 0x14, 0x85, 0x40, 0x48, 0x85, 0x3f, 0x47, 0x85, //0x8a00,
0x3e, 0x46, 0x85, 0x3d, 0x45, 0x80, 0x06, 0x02, 0x06, 0xd7, 0x12, 0x0d, 0x7e, 0x90, 0x30, 0x24, //0x8a10,
0xe5, 0x3d, 0xf0, 0xa3, 0xe5, 0x3e, 0xf0, 0xa3, 0xe5, 0x3f, 0xf0, 0xa3, 0xe5, 0x40, 0xf0, 0xa3, //0x8a20,
0xe5, 0x3c, 0xf0, 0x90, 0x30, 0x23, 0xe4, 0xf0, 0x22, 0xc0, 0xe0, 0xc0, 0x83, 0xc0, 0x82, 0xc0, //0x8a30,
0xd0, 0x90, 0x3f, 0x0c, 0xe0, 0xf5, 0x32, 0xe5, 0x32, 0x30, 0xe3, 0x74, 0x30, 0x36, 0x66, 0x90, //0x8a40,
0x60, 0x19, 0xe0, 0xf5, 0x0a, 0xa3, 0xe0, 0xf5, 0x0b, 0x90, 0x60, 0x1d, 0xe0, 0xf5, 0x14, 0xa3, //0x8a50,
0xe0, 0xf5, 0x15, 0x90, 0x60, 0x21, 0xe0, 0xf5, 0x0c, 0xa3, 0xe0, 0xf5, 0x0d, 0x90, 0x60, 0x29, //0x8a60,
0xe0, 0xf5, 0x0e, 0xa3, 0xe0, 0xf5, 0x0f, 0x90, 0x60, 0x31, 0xe0, 0xf5, 0x10, 0xa3, 0xe0, 0xf5, //0x8a70,
0x11, 0x90, 0x60, 0x39, 0xe0, 0xf5, 0x12, 0xa3, 0xe0, 0xf5, 0x13, 0x30, 0x01, 0x06, 0x30, 0x33, //0x8a80,
0x03, 0xd3, 0x80, 0x01, 0xc3, 0x92, 0x09, 0x30, 0x02, 0x06, 0x30, 0x33, 0x03, 0xd3, 0x80, 0x01, //0x8a90,
0xc3, 0x92, 0x0a, 0x30, 0x33, 0x0c, 0x30, 0x03, 0x09, 0x20, 0x02, 0x06, 0x20, 0x01, 0x03, 0xd3, //0x8aa0,
0x80, 0x01, 0xc3, 0x92, 0x0b, 0x90, 0x30, 0x01, 0xe0, 0x44, 0x40, 0xf0, 0xe0, 0x54, 0xbf, 0xf0, //0x8ab0,
0xe5, 0x32, 0x30, 0xe1, 0x14, 0x30, 0x34, 0x11, 0x90, 0x30, 0x22, 0xe0, 0xf5, 0x08, 0xe4, 0xf0, //0x8ac0,
0x30, 0x00, 0x03, 0xd3, 0x80, 0x01, 0xc3, 0x92, 0x08, 0xe5, 0x32, 0x30, 0xe5, 0x12, 0x90, 0x56, //0x8ad0,
0xa1, 0xe0, 0xf5, 0x09, 0x30, 0x31, 0x09, 0x30, 0x05, 0x03, 0xd3, 0x80, 0x01, 0xc3, 0x92, 0x0d, //0x8ae0,
0x90, 0x3f, 0x0c, 0xe5, 0x32, 0xf0, 0xd0, 0xd0, 0xd0, 0x82, 0xd0, 0x83, 0xd0, 0xe0, 0x32, 0x90, //0x8af0,
0x0e, 0x7e, 0xe4, 0x93, 0xfe, 0x74, 0x01, 0x93, 0xff, 0xc3, 0x90, 0x0e, 0x7c, 0x74, 0x01, 0x93, //0x8b00,
0x9f, 0xff, 0xe4, 0x93, 0x9e, 0xfe, 0xe4, 0x8f, 0x3b, 0x8e, 0x3a, 0xf5, 0x39, 0xf5, 0x38, 0xab, //0x8b10,
0x3b, 0xaa, 0x3a, 0xa9, 0x39, 0xa8, 0x38, 0xaf, 0x4b, 0xfc, 0xfd, 0xfe, 0x12, 0x05, 0x28, 0x12, //0x8b20,
0x0d, 0xe1, 0xe4, 0x7b, 0xff, 0xfa, 0xf9, 0xf8, 0x12, 0x05, 0xb3, 0x12, 0x0d, 0xe1, 0x90, 0x0e, //0x8b30,
0x69, 0xe4, 0x12, 0x0d, 0xf6, 0x12, 0x0d, 0xe1, 0xe4, 0x85, 0x4a, 0x37, 0xf5, 0x36, 0xf5, 0x35, //0x8b40,
0xf5, 0x34, 0xaf, 0x37, 0xae, 0x36, 0xad, 0x35, 0xac, 0x34, 0xa3, 0x12, 0x0d, 0xf6, 0x8f, 0x37, //0x8b50,
0x8e, 0x36, 0x8d, 0x35, 0x8c, 0x34, 0xe5, 0x3b, 0x45, 0x37, 0xf5, 0x3b, 0xe5, 0x3a, 0x45, 0x36, //0x8b60,
0xf5, 0x3a, 0xe5, 0x39, 0x45, 0x35, 0xf5, 0x39, 0xe5, 0x38, 0x45, 0x34, 0xf5, 0x38, 0xe4, 0xf5, //0x8b70,
0x22, 0xf5, 0x23, 0x85, 0x3b, 0x31, 0x85, 0x3a, 0x30, 0x85, 0x39, 0x2f, 0x85, 0x38, 0x2e, 0x02, //0x8b80,
0x0f, 0x46, 0xe0, 0xa3, 0xe0, 0x75, 0xf0, 0x02, 0xa4, 0xff, 0xae, 0xf0, 0xc3, 0x08, 0xe6, 0x9f, //0x8b90,
0xf6, 0x18, 0xe6, 0x9e, 0xf6, 0x22, 0xff, 0xe5, 0xf0, 0x34, 0x60, 0x8f, 0x82, 0xf5, 0x83, 0xec, //0x8ba0,
0xf0, 0x22, 0x78, 0x52, 0x7e, 0x00, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0x02, 0x04, 0xc1, 0xe4, 0xfc, //0x8bb0,
0xfd, 0x12, 0x06, 0x99, 0x78, 0x5c, 0xe6, 0xc3, 0x13, 0xfe, 0x08, 0xe6, 0x13, 0x22, 0x78, 0x52, //0x8bc0,
0xe6, 0xfe, 0x08, 0xe6, 0xff, 0xe4, 0xfc, 0xfd, 0x22, 0xe7, 0xc4, 0xf8, 0x54, 0xf0, 0xc8, 0x68, //0x8bd0,
0xf7, 0x09, 0xe7, 0xc4, 0x54, 0x0f, 0x48, 0xf7, 0x22, 0xe6, 0xfc, 0xed, 0x75, 0xf0, 0x04, 0xa4, //0x8be0,
0x22, 0x12, 0x06, 0x7c, 0x8f, 0x48, 0x8e, 0x47, 0x8d, 0x46, 0x8c, 0x45, 0x22, 0xe0, 0xfe, 0xa3, //0x8bf0,
0xe0, 0xfd, 0xee, 0xf6, 0xed, 0x08, 0xf6, 0x22, 0x13, 0xff, 0xc3, 0xe6, 0x9f, 0xff, 0x18, 0xe6, //0x8c00,
0x9e, 0xfe, 0x22, 0xe6, 0xc3, 0x13, 0xf7, 0x08, 0xe6, 0x13, 0x09, 0xf7, 0x22, 0xad, 0x39, 0xac, //0x8c10,
0x38, 0xfa, 0xf9, 0xf8, 0x12, 0x05, 0x28, 0x8f, 0x3b, 0x8e, 0x3a, 0x8d, 0x39, 0x8c, 0x38, 0xab, //0x8c20,
0x37, 0xaa, 0x36, 0xa9, 0x35, 0xa8, 0x34, 0x22, 0x93, 0xff, 0xe4, 0xfc, 0xfd, 0xfe, 0x12, 0x05, //0x8c30,
0x28, 0x8f, 0x37, 0x8e, 0x36, 0x8d, 0x35, 0x8c, 0x34, 0x22, 0x78, 0x84, 0xe6, 0xfe, 0x08, 0xe6, //0x8c40,
0xff, 0xe4, 0x8f, 0x37, 0x8e, 0x36, 0xf5, 0x35, 0xf5, 0x34, 0x22, 0x90, 0x0e, 0x8c, 0xe4, 0x93, //0x8c50,
0x25, 0xe0, 0x24, 0x0a, 0xf8, 0xe6, 0xfe, 0x08, 0xe6, 0xff, 0x22, 0xe6, 0xfe, 0x08, 0xe6, 0xff, //0x8c60,
0xe4, 0x8f, 0x3b, 0x8e, 0x3a, 0xf5, 0x39, 0xf5, 0x38, 0x22, 0x78, 0x4e, 0xe6, 0xfe, 0x08, 0xe6, //0x8c70,
0xff, 0x22, 0xef, 0x25, 0xe0, 0x24, 0x4e, 0xf8, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0x22, 0x78, 0x89, //0x8c80,
0xef, 0x26, 0xf6, 0x18, 0xe4, 0x36, 0xf6, 0x22, 0x75, 0x89, 0x03, 0x75, 0xa8, 0x01, 0x75, 0xb8, //0x8c90,
0x04, 0x75, 0x34, 0xff, 0x75, 0x35, 0x0e, 0x75, 0x36, 0x15, 0x75, 0x37, 0x0d, 0x12, 0x0e, 0x9a, //0x8ca0,
0x12, 0x00, 0x09, 0x12, 0x0f, 0x16, 0x12, 0x00, 0x06, 0xd2, 0x00, 0xd2, 0x34, 0xd2, 0xaf, 0x75, //0x8cb0,
0x34, 0xff, 0x75, 0x35, 0x0e, 0x75, 0x36, 0x49, 0x75, 0x37, 0x03, 0x12, 0x0e, 0x9a, 0x30, 0x08, //0x8cc0,
0x09, 0xc2, 0x34, 0x12, 0x08, 0xcb, 0xc2, 0x08, 0xd2, 0x34, 0x30, 0x0b, 0x09, 0xc2, 0x36, 0x12, //0x8cd0,
0x02, 0x6c, 0xc2, 0x0b, 0xd2, 0x36, 0x30, 0x09, 0x09, 0xc2, 0x36, 0x12, 0x00, 0x0e, 0xc2, 0x09, //0x8ce0,
0xd2, 0x36, 0x30, 0x0e, 0x03, 0x12, 0x06, 0xd7, 0x30, 0x35, 0xd3, 0x90, 0x30, 0x29, 0xe5, 0x1e, //0x8cf0,
0xf0, 0xb4, 0x10, 0x05, 0x90, 0x30, 0x23, 0xe4, 0xf0, 0xc2, 0x35, 0x80, 0xc1, 0xe4, 0xf5, 0x4b, //0x8d00,
0x90, 0x0e, 0x7a, 0x93, 0xff, 0xe4, 0x8f, 0x37, 0xf5, 0x36, 0xf5, 0x35, 0xf5, 0x34, 0xaf, 0x37, //0x8d10,
0xae, 0x36, 0xad, 0x35, 0xac, 0x34, 0x90, 0x0e, 0x6a, 0x12, 0x0d, 0xf6, 0x8f, 0x37, 0x8e, 0x36, //0x8d20,
0x8d, 0x35, 0x8c, 0x34, 0x90, 0x0e, 0x72, 0x12, 0x06, 0x7c, 0xef, 0x45, 0x37, 0xf5, 0x37, 0xee, //0x8d30,
0x45, 0x36, 0xf5, 0x36, 0xed, 0x45, 0x35, 0xf5, 0x35, 0xec, 0x45, 0x34, 0xf5, 0x34, 0xe4, 0xf5, //0x8d40,
0x22, 0xf5, 0x23, 0x85, 0x37, 0x31, 0x85, 0x36, 0x30, 0x85, 0x35, 0x2f, 0x85, 0x34, 0x2e, 0x12, //0x8d50,
0x0f, 0x46, 0xe4, 0xf5, 0x22, 0xf5, 0x23, 0x90, 0x0e, 0x72, 0x12, 0x0d, 0xea, 0x12, 0x0f, 0x46, //0x8d60,
0xe4, 0xf5, 0x22, 0xf5, 0x23, 0x90, 0x0e, 0x6e, 0x12, 0x0d, 0xea, 0x02, 0x0f, 0x46, 0xe5, 0x40, //0x8d70,
0x24, 0xf2, 0xf5, 0x37, 0xe5, 0x3f, 0x34, 0x43, 0xf5, 0x36, 0xe5, 0x3e, 0x34, 0xa2, 0xf5, 0x35, //0x8d80,
0xe5, 0x3d, 0x34, 0x28, 0xf5, 0x34, 0xe5, 0x37, 0xff, 0xe4, 0xfe, 0xfd, 0xfc, 0x78, 0x18, 0x12, //0x8d90,
0x06, 0x69, 0x8f, 0x40, 0x8e, 0x3f, 0x8d, 0x3e, 0x8c, 0x3d, 0xe5, 0x37, 0x54, 0xa0, 0xff, 0xe5, //0x8da0,
0x36, 0xfe, 0xe4, 0xfd, 0xfc, 0x78, 0x07, 0x12, 0x06, 0x56, 0x78, 0x10, 0x12, 0x0f, 0x9a, 0xe4, //0x8db0,
0xff, 0xfe, 0xe5, 0x35, 0xfd, 0xe4, 0xfc, 0x78, 0x0e, 0x12, 0x06, 0x56, 0x12, 0x0f, 0x9d, 0xe4, //0x8dc0,
0xff, 0xfe, 0xfd, 0xe5, 0x34, 0xfc, 0x78, 0x18, 0x12, 0x06, 0x56, 0x78, 0x08, 0x12, 0x0f, 0x9a, //0x8dd0,
0x22, 0x8f, 0x3b, 0x8e, 0x3a, 0x8d, 0x39, 0x8c, 0x38, 0x22, 0x12, 0x06, 0x7c, 0x8f, 0x31, 0x8e, //0x8de0,
0x30, 0x8d, 0x2f, 0x8c, 0x2e, 0x22, 0x93, 0xf9, 0xf8, 0x02, 0x06, 0x69, 0x00, 0x00, 0x00, 0x00, //0x8df0,
0x12, 0x01, 0x17, 0x08, 0x31, 0x15, 0x53, 0x54, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x13, 0x01, //0x8e00,
0x10, 0x01, 0x56, 0x40, 0x1a, 0x30, 0x29, 0x7e, 0x00, 0x30, 0x04, 0x20, 0xdf, 0x30, 0x05, 0x40, //0x8e10,
0xbf, 0x50, 0x03, 0x00, 0xfd, 0x50, 0x27, 0x01, 0xfe, 0x60, 0x00, 0x11, 0x00, 0x3f, 0x05, 0x30, //0x8e20,
0x00, 0x3f, 0x06, 0x22, 0x00, 0x3f, 0x01, 0x2a, 0x00, 0x3f, 0x02, 0x00, 0x00, 0x36, 0x06, 0x07, //0x8e30,
0x00, 0x3f, 0x0b, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x30, 0x01, 0x40, 0xbf, 0x30, 0x01, 0x00, //0x8e40,
0xbf, 0x30, 0x29, 0x70, 0x00, 0x3a, 0x00, 0x00, 0xff, 0x3a, 0x00, 0x00, 0xff, 0x36, 0x03, 0x36, //0x8e50,
0x02, 0x41, 0x44, 0x58, 0x20, 0x18, 0x10, 0x0a, 0x04, 0x04, 0x00, 0x03, 0xff, 0x64, 0x00, 0x00, //0x8e60,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x06, 0x06, 0x00, 0x03, 0x51, 0x00, 0x7a, //0x8e70,
0x50, 0x3c, 0x28, 0x1e, 0x10, 0x10, 0x50, 0x2d, 0x28, 0x16, 0x10, 0x10, 0x02, 0x00, 0x10, 0x0c, //0x8e80,
0x10, 0x04, 0x0c, 0x6e, 0x06, 0x05, 0x00, 0xa5, 0x5a, 0x00, 0xae, 0x35, 0xaf, 0x36, 0xe4, 0xfd, //0x8e90,
0xed, 0xc3, 0x95, 0x37, 0x50, 0x33, 0x12, 0x0f, 0xe2, 0xe4, 0x93, 0xf5, 0x38, 0x74, 0x01, 0x93, //0x8ea0,
0xf5, 0x39, 0x45, 0x38, 0x60, 0x23, 0x85, 0x39, 0x82, 0x85, 0x38, 0x83, 0xe0, 0xfc, 0x12, 0x0f, //0x8eb0,
0xe2, 0x74, 0x03, 0x93, 0x52, 0x04, 0x12, 0x0f, 0xe2, 0x74, 0x02, 0x93, 0x42, 0x04, 0x85, 0x39, //0x8ec0,
0x82, 0x85, 0x38, 0x83, 0xec, 0xf0, 0x0d, 0x80, 0xc7, 0x22, 0x78, 0xbe, 0xe6, 0xd3, 0x08, 0xff, //0x8ed0,
0xe6, 0x64, 0x80, 0xf8, 0xef, 0x64, 0x80, 0x98, 0x22, 0x93, 0xff, 0x7e, 0x00, 0xe6, 0xfc, 0x08, //0x8ee0,
0xe6, 0xfd, 0x12, 0x04, 0xc1, 0x78, 0xc1, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0xd3, 0xef, 0x9d, 0xee, //0x8ef0,
0x9c, 0x22, 0x78, 0xbd, 0xd3, 0xe6, 0x64, 0x80, 0x94, 0x80, 0x22, 0x25, 0xe0, 0x24, 0x0a, 0xf8, //0x8f00,
0xe6, 0xfe, 0x08, 0xe6, 0xff, 0x22, 0xe5, 0x3c, 0xd3, 0x94, 0x00, 0x40, 0x0b, 0x90, 0x0e, 0x88, //0x8f10,
0x12, 0x0b, 0xf1, 0x90, 0x0e, 0x86, 0x80, 0x09, 0x90, 0x0e, 0x82, 0x12, 0x0b, 0xf1, 0x90, 0x0e, //0x8f20,
0x80, 0xe4, 0x93, 0xf5, 0x44, 0xa3, 0xe4, 0x93, 0xf5, 0x43, 0xd2, 0x06, 0x30, 0x06, 0x03, 0xd3, //0x8f30,
0x80, 0x01, 0xc3, 0x92, 0x0e, 0x22, 0xa2, 0xaf, 0x92, 0x32, 0xc2, 0xaf, 0xe5, 0x23, 0x45, 0x22, //0x8f40,
0x90, 0x0e, 0x5d, 0x60, 0x0e, 0x12, 0x0f, 0xcb, 0xe0, 0xf5, 0x2c, 0x12, 0x0f, 0xc8, 0xe0, 0xf5, //0x8f50,
0x2d, 0x80, 0x0c, 0x12, 0x0f, 0xcb, 0xe5, 0x30, 0xf0, 0x12, 0x0f, 0xc8, 0xe5, 0x31, 0xf0, 0xa2, //0x8f60,
0x32, 0x92, 0xaf, 0x22, 0xd2, 0x01, 0xc2, 0x02, 0xe4, 0xf5, 0x1f, 0xf5, 0x1e, 0xd2, 0x35, 0xd2, //0x8f70,
0x33, 0xd2, 0x36, 0xd2, 0x01, 0xc2, 0x02, 0xf5, 0x1f, 0xf5, 0x1e, 0xd2, 0x35, 0xd2, 0x33, 0x22, //0x8f80,
0xfb, 0xd3, 0xed, 0x9b, 0x74, 0x80, 0xf8, 0x6c, 0x98, 0x22, 0x12, 0x06, 0x69, 0xe5, 0x40, 0x2f, //0x8f90,
0xf5, 0x40, 0xe5, 0x3f, 0x3e, 0xf5, 0x3f, 0xe5, 0x3e, 0x3d, 0xf5, 0x3e, 0xe5, 0x3d, 0x3c, 0xf5, //0x8fa0,
0x3d, 0x22, 0xc0, 0xe0, 0xc0, 0x83, 0xc0, 0x82, 0x90, 0x3f, 0x0d, 0xe0, 0xf5, 0x33, 0xe5, 0x33, //0x8fb0,
0xf0, 0xd0, 0x82, 0xd0, 0x83, 0xd0, 0xe0, 0x32, 0x90, 0x0e, 0x5f, 0xe4, 0x93, 0xfe, 0x74, 0x01, //0x8fc0,
0x93, 0xf5, 0x82, 0x8e, 0x83, 0x22, 0x78, 0x7f, 0xe4, 0xf6, 0xd8, 0xfd, 0x75, 0x81, 0xcd, 0x02, //0x8fd0,
0x0c, 0x98, 0x8f, 0x82, 0x8e, 0x83, 0x75, 0xf0, 0x04, 0xed, 0x02, 0x06, 0xa5, //0x8fe0
};
#endif

View File

@ -1,673 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _OV5640CFG_H
#define _OV5640CFG_H
#include "ov5640.h"
const uint16_t OV5640_jpeg_reg_tbl[][2] = {
{ 0x4300, 0x30 }, // YUV 422, YUYV
{ 0x501f, 0x00 }, // YUV 422
// Input clock = 24Mhz
{ 0x3035, 0x21 }, // PLL
{ 0x3036, 0x69 }, // PLL
{ 0x3c07, 0x07 }, // lightmeter 1 threshold[7:0]
{ 0x3820, 0x46 }, // flip
{ 0x3821, 0x20 }, // mirror
{ 0x3814, 0x11 }, // timing X inc
{ 0x3815, 0x11 }, // timing Y inc
{ 0x3800, 0x00 }, // HS
{ 0x3801, 0x00 }, // HS
{ 0x3802, 0x00 }, // VS
{ 0x3803, 0x00 }, // VS
{ 0x3804, 0x0a }, // HW (HE)
{ 0x3805, 0x3f }, // HW (HE)
{ 0x3806, 0x07 }, // VH (VE)
{ 0x3807, 0x9f }, // VH (VE)
{ 0x3808, 0x02 }, // DVPHO
{ 0x3809, 0x80 }, // DVPHO
{ 0x380a, 0x01 }, // DVPVO
{ 0x380b, 0xe0 }, // DVPVO
{ 0x380c, 0x0b }, // HTS //
{ 0x380d, 0x1c }, // HTS
{ 0x380e, 0x07 }, // VTS //
{ 0x380f, 0xb0 }, // VTS
{ 0x3813, 0x04 }, // timing V offset 04
{ 0x3618, 0x04 },
{ 0x3612, 0x2b },
{ 0x3709, 0x12 },
{ 0x370c, 0x00 },
{ 0x3a02, 0x02 }, // 60Hz max exposure
{ 0x3a03, 0xe0 }, // 60Hz max exposure
{ 0x3a14, 0x02 }, // 50Hz max exposure
{ 0x3a15, 0xe0 }, // 50Hz max exposure
{ 0x4004, 0x06 }, // BLC line number
{ 0x3002, 0x00 }, // enable JFIFO, SFIFO, JPG
{ 0x3006, 0xff }, // enable clock of JPEG2x, JPEG
{ 0x4713, 0x03 }, // JPEG mode 3
{ 0x4407, 0x01 }, // Quantization sacle
{ 0x460b, 0x35 },
{ 0x460c, 0x22 },
{ 0x4837, 0x16 }, // MIPI global timing
{ 0x3824, 0x02 }, // PCLK manual divider
{ 0x5001, 0xA3 }, // SDE on, Scaling on, CMX on, AWB on
{ 0x3503, 0x00 }, // AEC/AGC on
};
const uint16_t ov5640_rgb565_reg_tbl[][2] = {
{ 0x4300, 0x61 },
{ 0X501F, 0x01 },
// 1280x800, 15fps
// input clock 24Mhz, PCLK 42Mhz
{ 0x3035, 0x11 }, //0x41, // PLL
{ 0x3036, 0x69 }, // PLL
{ 0x3c07, 0x07 }, // lightmeter 1 threshold[7:0]
{ 0x3820, 0x46 }, // flip
{ 0x3821, 0x00 }, // mirror
{ 0x3814, 0x31 }, // timing X inc
{ 0x3815, 0x31 }, // timing Y inc
{ 0x3800, 0x00 }, // HS
{ 0x3801, 0x00 }, // HS
{ 0x3802, 0x00 }, // VS
{ 0x3803, 0x00 }, // VS
{ 0x3804, 0x0a }, // HW (HE)
{ 0x3805, 0x3f }, // HW (HE)
{ 0x3806, 0x06 }, // VH (VE)
{ 0x3807, 0xa9 }, // VH (VE)
// 0x3808, 0x05 }, // DVPHO
// 0x3809, 0x00 }, // DVPHO
// 0x380a, 0x02 }, // DVPVO
// 0x380b, 0xd0 }, // DVPVO
{ 0x3808, (320 >> 8) }, // DVPHO
{ 0x3809, (320 & 0xff) }, // DVPHO
{ 0x380a, (240 >> 8) }, // DVPVO
{ 0x380b, (240 & 0xff) }, // DVPVO
{ 0x380c, 0x05 }, // HTS
{ 0x380d, 0xF8 }, // HTS
{ 0x380e, 0x03 }, // VTS
{ 0x380f, 0x84 }, // VTS
{ 0x3810, (4 >> 8) }, // HTS
{ 0x3811, (4 & 0xff) }, // HTS
{ 0x3812, (0 >> 8) }, // VTS
{ 0x3813, (0 & 0xff) }, // VTS
// 0x3813, 0x04, // timing V offset
{ 0x3618, 0x00 },
{ 0x3612, 0x29 },
{ 0x3709, 0x52 },
{ 0x370c, 0x03 },
{ 0x3a02, 0x02 }, // 60Hz max exposure
{ 0x3a03, 0xe0 }, // 60Hz max exposure
{ 0x3a14, 0x02 }, // 50Hz max exposure
{ 0x3a15, 0xe0 }, // 50Hz max exposure
{ 0x4004, 0x02 }, // BLC line number
{ 0x3002, 0x1c }, // reset JFIFO, SFIFO, JPG
{ 0x3006, 0xc3 }, // disable clock of JPEG2x, JPEG
{ 0x4713, 0x03 }, // JPEG mode 3
{ 0x4407, 0x04 }, // Quantization scale
{ 0x460b, 0x37 },
{ 0x460c, 0x20 },
{ 0x4837, 0x16 }, // MIPI global timing
{ 0x3824, 0x04 }, // PCLK manual divider
{ 0x5001, 0xA3 }, // SDE on, scale on, UV average off, color matrix on, AWB on
{ 0x3503, 0x00 }, // AEC/AGC on
};
const uint16_t ov5640_init_reg_tbl[][2] = {
// 24MHz input clock, 24MHz PCLK
{ 0x3008, 0x42 }, // software power down, bit[6]
{ 0x3103, 0x03 }, // system clock from PLL, bit[1]
{ 0x3017, 0xff }, // FREX, Vsync, HREF, PCLK, D[9:6] output enable
{ 0x3018, 0xff }, // D[5:0], GPIO[1:0] output enable
{ 0x3034, 0x1a }, // MIPI 10-bit
{ 0x3035, 0x11 }, //0x41, // PLL
{ 0x3036, 0x69 }, // PLL
{ 0x3037, 0x13 }, // PLL root divider, bit[4], PLL pre-divider, bit[3:0]
{ 0x3108, 0x01 }, // PCLK root divider, bit[5:4], SCLK2x root divider, bit[3:2]
// SCLK root divider, bit[1:0]
{ 0x3630, 0x36 },
{ 0x3631, 0x0e },
{ 0x3632, 0xe2 },
{ 0x3633, 0x12 },
{ 0x3621, 0xe0 },
{ 0x3704, 0xa0 },
{ 0x3703, 0x5a },
{ 0x3715, 0x78 },
{ 0x3717, 0x01 },
{ 0x370b, 0x60 },
{ 0x3705, 0x1a },
{ 0x3905, 0x02 },
{ 0x3906, 0x10 },
{ 0x3901, 0x0a },
{ 0x3731, 0x12 },
{ 0x3600, 0x08 }, // VCM control
{ 0x3601, 0x33 }, // VCM control
{ 0x302d, 0x60 }, // system control
{ 0x3620, 0x52 },
{ 0x371b, 0x20 },
{ 0x471c, 0x50 },
{ 0x3a13, 0x43 }, // pre-gain = 1.047x
{ 0x3a18, 0x00 }, // gain ceiling
{ 0x3a19, 0xf8 }, // gain ceiling = 15.5x
{ 0x3635, 0x13 },
{ 0x3636, 0x03 },
{ 0x3634, 0x40 },
{ 0x3622, 0x01 },
// 50/60Hz detection 50/60Hz
{ 0x3c01, 0x34 }, // Band auto, bit[7]
{ 0x3c04, 0x28 }, // threshold low sum
{ 0x3c05, 0x98 }, // threshold high sum
{ 0x3c06, 0x00 }, // light meter 1 threshold[15:8]
//{ 0x3c07, 0x08 }, // light meter 1 threshold[7:0]
{ 0x3c07, 0x07 }, // light meter 1 threshold[7:0]
{ 0x3c08, 0x00 }, // light meter 2 threshold[15:8]
{ 0x3c09, 0x1c }, // light meter 2 threshold[7:0]
{ 0x3c0a, 0x9c }, // sample number[15:8]
{ 0x3c0b, 0x40 }, // sample number[7:0]
{ 0x3810, 0x00 }, // Timing Hoffset[11:8]
{ 0x3811, 0x10 }, // Timing Hoffset[7:0]
{ 0x3812, 0x00 }, // Timing Voffset[10:8]
{ 0x3708, 0x64 },
{ 0x4001, 0x02 }, // BLC start from line 2
{ 0x4005, 0x1a }, // BLC always update
{ 0x3000, 0x00 }, // enable blocks
{ 0x3004, 0xff }, // enable clocks
{ 0x300e, 0x58 }, // MIPI power down, DVP enable
{ 0x302e, 0x00 },
//{ 0x4300, 0x30 }, // YUV 422, YUYV
//{ 0x501f, 0x00 }, // YUV 422
{ 0x4300, 0x61 },
{ 0X501F, 0x01 },
{ 0x3820, 0x46 }, // flip
{ 0x3821, 0x00 }, // mirror
{ 0x3814, 0x31 }, // timing X inc
{ 0x3815, 0x31 }, // timing Y inc
{ 0x3800, 0x00 }, // HS
{ 0x3801, 0x00 }, // HS
{ 0x3802, 0x00 }, // VS
{ 0x3803, 0x00 }, // VS
{ 0x3804, 0x0a }, // HW (HE)
{ 0x3805, 0x3f }, // HW (HE)
{ 0x3806, 0x06 }, // VH (VE)
{ 0x3807, 0xa9 }, // VH (VE)
{ 0x3808, (320 >> 8) }, // DVPHO
{ 0x3809, (320 & 0xff) }, // DVPHO
{ 0x380a, (240 >> 8) }, // DVPVO
{ 0x380b, (240 & 0xff) }, // DVPVO
{ 0x380c, 0x05 }, // HTS
{ 0x380d, 0xF8 }, // HTS
{ 0x380e, 0x03 }, // VTS
{ 0x380f, 0x84 }, // VTS
{ 0x3810, (4 >> 8) }, // HTS
{ 0x3811, (4 & 0xff) }, // HTS
{ 0x3812, (0 >> 8) }, // VTS
{ 0x3813, (0 & 0xff) }, // VTS
{ 0x3618, 0x00 },
{ 0x3612, 0x29 },
{ 0x3709, 0x52 },
{ 0x370c, 0x03 },
{ 0x3a02, 0x02 }, // 60Hz max exposure
{ 0x3a03, 0xe0 }, // 60Hz max exposure
{ 0x3a14, 0x02 }, // 50Hz max exposure
{ 0x3a15, 0xe0 }, // 50Hz max exposure
{ 0x4004, 0x02 }, // BLC line number
{ 0x3002, 0x1c }, // reset JFIFO, SFIFO, JPG
{ 0x3006, 0xc3 }, // disable clock of JPEG2x, JPEG
{ 0x4713, 0x03 }, // JPEG mode 3
{ 0x4407, 0x04 }, // Quantization scale
{ 0x460b, 0x37 },
{ 0x460c, 0x20 },
{ 0x4837, 0x16 }, // MIPI global timing
{ 0x3824, 0x04 }, // PCLK manual divider
{ 0x5001, 0xA3 }, // SDE on, scale on, UV average off, color matrix on, AWB on
{ 0x3503, 0x00 }, // AEC/AGC on
{ 0x440e, 0x00 },
{ 0x5000, 0xa7 }, // Lenc on, raw gamma on, BPC on, WPC on, CIP on
// AEC target
{ 0x3a0f, 0x30 }, // stable range in high
{ 0x3a10, 0x28 }, // stable range in low
{ 0x3a1b, 0x30 }, // stable range out high
{ 0x3a1e, 0x26 }, // stable range out low
{ 0x3a11, 0x60 }, // fast zone high
{ 0x3a1f, 0x14 }, // fast zone low
// Lens correction for ?
{ 0x5800, 0x23 },
{ 0x5801, 0x14 },
{ 0x5802, 0x0f },
{ 0x5803, 0x0f },
{ 0x5804, 0x12 },
{ 0x5805, 0x26 },
{ 0x5806, 0x0c },
{ 0x5807, 0x08 },
{ 0x5808, 0x05 },
{ 0x5809, 0x05 },
{ 0x580a, 0x08 },
{ 0x580b, 0x0d },
{ 0x580c, 0x08 },
{ 0x580d, 0x03 },
{ 0x580e, 0x00 },
{ 0x580f, 0x00 },
{ 0x5810, 0x03 },
{ 0x5811, 0x09 },
{ 0x5812, 0x07 },
{ 0x5813, 0x03 },
{ 0x5814, 0x00 },
{ 0x5815, 0x01 },
{ 0x5816, 0x03 },
{ 0x5817, 0x08 },
{ 0x5818, 0x0d },
{ 0x5819, 0x08 },
{ 0x581a, 0x05 },
{ 0x581b, 0x06 },
{ 0x581c, 0x08 },
{ 0x581d, 0x0e },
{ 0x581e, 0x29 },
{ 0x581f, 0x17 },
{ 0x5820, 0x11 },
{ 0x5821, 0x11 },
{ 0x5822, 0x15 },
{ 0x5823, 0x28 },
{ 0x5824, 0x46 },
{ 0x5825, 0x26 },
{ 0x5826, 0x08 },
{ 0x5827, 0x26 },
{ 0x5828, 0x64 },
{ 0x5829, 0x26 },
{ 0x582a, 0x24 },
{ 0x582b, 0x22 },
{ 0x582c, 0x24 },
{ 0x582d, 0x24 },
{ 0x582e, 0x06 },
{ 0x582f, 0x22 },
{ 0x5830, 0x40 },
{ 0x5831, 0x42 },
{ 0x5832, 0x24 },
{ 0x5833, 0x26 },
{ 0x5834, 0x24 },
{ 0x5835, 0x22 },
{ 0x5836, 0x22 },
{ 0x5837, 0x26 },
{ 0x5838, 0x44 },
{ 0x5839, 0x24 },
{ 0x583a, 0x26 },
{ 0x583b, 0x28 },
{ 0x583c, 0x42 },
{ 0x583d, 0xce }, // lenc BR offset
// AWB
{ 0x5180, 0xff }, // AWB B block
{ 0x5181, 0xf2 }, // AWB control
{ 0x5182, 0x00 }, // [7:4] max local counter, [3:0] max fast counter
{ 0x5183, 0x14 }, // AWB advanced
{ 0x5184, 0x25 },
{ 0x5185, 0x24 },
{ 0x5186, 0x09 },
{ 0x5187, 0x09 },
{ 0x5188, 0x09 },
{ 0x5189, 0x75 },
{ 0x518a, 0x54 },
{ 0x518b, 0xe0 },
{ 0x518c, 0xb2 },
{ 0x518d, 0x42 },
{ 0x518e, 0x3d },
{ 0x518f, 0x56 },
{ 0x5190, 0x46 },
{ 0x5191, 0xf8 }, // AWB top limit
{ 0x5192, 0x04 }, // AWB bottom limit
{ 0x5193, 0x70 }, // red limit
{ 0x5194, 0xf0 }, // green limit
{ 0x5195, 0xf0 }, // blue limit
{ 0x5196, 0x03 }, // AWB control
{ 0x5197, 0x01 }, // local limit
{ 0x5198, 0x04 },
{ 0x5199, 0x12 },
{ 0x519a, 0x04 },
{ 0x519b, 0x00 },
{ 0x519c, 0x06 },
{ 0x519d, 0x82 },
{ 0x519e, 0x38 }, // AWB control
// Gamma
{ 0x5480, 0x01 }, // Gamma bias plus on, bit[0]
{ 0x5481, 0x08 },
{ 0x5482, 0x14 },
{ 0x5483, 0x28 },
{ 0x5484, 0x51 },
{ 0x5485, 0x65 },
{ 0x5486, 0x71 },
{ 0x5487, 0x7d },
{ 0x5488, 0x87 },
{ 0x5489, 0x91 },
{ 0x548a, 0x9a },
{ 0x548b, 0xaa },
{ 0x548c, 0xb8 },
{ 0x548d, 0xcd },
{ 0x548e, 0xdd },
{ 0x548f, 0xea },
{ 0x5490, 0x1d },
// color matrix
{ 0x5381, 0x1e }, // CMX1 for Y
{ 0x5382, 0x5b }, // CMX2 for Y
{ 0x5383, 0x08 }, // CMX3 for Y
{ 0x5384, 0x0a }, // CMX4 for U
{ 0x5385, 0x7e }, // CMX5 for U
{ 0x5386, 0x88 }, // CMX6 for U
{ 0x5387, 0x7c }, // CMX7 for V
{ 0x5388, 0x6c }, // CMX8 for V
{ 0x5389, 0x10 }, // CMX9 for V
{ 0x538a, 0x01 }, // sign[9]
{ 0x538b, 0x98 }, // sign[8:1]
// UV adjust UV
{ 0x5580, 0x06 }, // saturation on, bit[1]
{ 0x5583, 0x40 },
{ 0x5584, 0x10 },
{ 0x5589, 0x10 },
{ 0x558a, 0x00 },
{ 0x558b, 0xf8 },
{ 0x501d, 0x40 }, // enable manual offset of contrast
// CIP
{ 0x5300, 0x08 }, // CIP sharpen MT threshold 1
{ 0x5301, 0x30 }, // CIP sharpen MT threshold 2
{ 0x5302, 0x10 }, // CIP sharpen MT offset 1
{ 0x5303, 0x00 }, // CIP sharpen MT offset 2
{ 0x5304, 0x08 }, // CIP DNS threshold 1
{ 0x5305, 0x30 }, // CIP DNS threshold 2
{ 0x5306, 0x08 }, // CIP DNS offset 1
{ 0x5307, 0x16 }, // CIP DNS offset 2
{ 0x5309, 0x08 }, // CIP sharpen TH threshold 1
{ 0x530a, 0x30 }, // CIP sharpen TH threshold 2
{ 0x530b, 0x04 }, // CIP sharpen TH offset 1
{ 0x530c, 0x06 }, // CIP sharpen TH offset 2
{ 0x5025, 0x00 },
{ 0x3008, 0x02 }, // wake up from standby, bit[6]
{ 0x4740, 0X21 }, //VSYNC active HIGH
};
const uint16_t ov5640_config[][2] = {
// 24MHz input clock, 24MHz PCLK
{0x3008, 0x42}, // software power down, bit[6]
{0x3103, 0x03}, // system clock from PLL, bit[1]
{0x3017, 0xff}, // FREX, Vsync, HREF, PCLK, D[9:6] output enable
{0x3018, 0xff}, // D[5:0], GPIO[1:0] output enable
{0x3034, 0x1a}, // MIPI 10-bit
{0x3035, 0x21},//0x41, // PLL
{0x3036, 150}, // PLL
{0x3037, 0x12},//0x13, // PLL root divider, bit[4], PLL pre-divider, bit[3:0]
{0x3108, 0x01}, // PCLK root divider, bit[5:4], SCLK2x root divider, bit[3:2], SCLK root divider, bit[1:0]
{0x3630, 0x36},
{0x3631, 0x0e},
{0x3632, 0xe2},
{0x3633, 0x12},
{0x3621, 0xe0},
{0x3704, 0xa0},
{0x3703, 0x5a},
{0x3715, 0x78},
{0x3717, 0x01},
{0x370b, 0x60},
{0x3705, 0x1a},
{0x3905, 0x02},
{0x3906, 0x10},
{0x3901, 0x0a},
{0x3731, 0x12},
{0x3600, 0x08}, // VCM control
{0x3601, 0x33}, // VCM control
{0x302d, 0x60}, // system control
{0x3620, 0x52},
{0x371b, 0x20},
{0x471c, 0x50},
{0x3a13, 0x43}, // pre-gain = 1.047x
{0x3a18, 0x00}, // gain ceiling
{0x3a19, 0xf8}, // gain ceiling = 15.5x
{0x3635, 0x13},
{0x3636, 0x03},
{0x3634, 0x40},
{0x3622, 0x01},
{0x3c01, 0x34}, // Band auto, bit[7]
{0x3c04, 0x28}, // threshold low sum
{0x3c05, 0x98}, // threshold high sum
{0x3c06, 0x00}, // light meter 1 threshold[15:8]
{0x3c07, 0x07}, // light meter 1 threshold[7:0]
{0x3c08, 0x00}, // light meter 2 threshold[15:8]
{0x3c09, 0x1c}, // light meter 2 threshold[7:0]
{0x3c0a, 0x9c}, // sample number[15:8]
{0x3c0b, 0x40}, // sample number[7:0]
{0x3810, 0x00}, // Timing Hoffset[11:8]
{0x3811, 0x10}, // Timing Hoffset[7:0]
{0x3812, 0x00}, // Timing Voffset[10:8]
{0x3708, 0x64},
{0x4001, 0x02}, // BLC start from line 2
{0x4005, 0x1a}, // BLC always update
{0x3000, 0x00}, // enable blocks
{0x3004, 0xff}, // enable clocks
{0x300e, 0x58}, // MIPI power down, DVP enable
{0x302e, 0x00},
{0x4300, 0x61},
{0X501F, 0x01},
{0x3820, 0x40}, // flip
{0x3821, 0x00}, // mirror
{0x3814, 0x71}, // timing X inc
{0x3815, 0x35}, // timing Y inc
{0x3800, 0x00}, // HS
{0x3801, 0x00}, // HS
{0x3802, 0x00}, // VS
{0x3803, 0x00}, // VS
{0x3804, 0x0a}, // HW (HE)
{0x3805, 0x3f}, // HW (HE)
{0x3806, 0x07}, // VH (VE)
{0x3807, 0x9f}, // VH (VE)
{0x3808, (320 >> 8)}, // DVPHO
{0x3809, (320 & 0xff)}, // DVPHO
{0x380a, (240 >> 8)}, // DVPVO
{0x380b, (240 & 0xff)}, // DVPVO
{0x380c, 0x07}, // HTS
{0x380d, 0x58}, // HTS
{0x380e, 0x01}, // VTS
{0x380f, 0xf0}, // VTS
{0x3810, 0x00}, // HTS
{0x3811, 0x08}, // HTS
{0x3812, 0x00}, // VTS
{0x3813, 0x02}, // VTS
{0x3618, 0x00},
{0x3612, 0x29},
{0x3709, 0x52},
{0x370c, 0x03},
{0x3a02, 0x02}, // 60Hz max exposure
{0x3a03, 0xe0}, // 60Hz max exposure
{0x3a14, 0x02}, // 50Hz max exposure
{0x3a15, 0xe0}, // 50Hz max exposure
{0x4004, 0x02}, // BLC line number
{0x3002, 0x1c}, // reset JFIFO, SFIFO, JPG
{0x3006, 0xc3}, // disable clock of JPEG2x, JPEG
{0x4713, 0x03}, // JPEG mode 3
{0x4407, 0x04}, // Quantization scale
{0x460b, 0x37},
{0x460c, 0x20},
{0x4837, 0x16}, // MIPI global timing
{0x3824, 0x04}, // PCLK manual divider
{0x5001, 0xA3}, // SDE on, scale on, UV average off, color matrix on, AWB on
{0x3503, 0x00}, // AEC/AGC on
{0x440e, 0x00},
{0x5000, 0xa7}, // Lenc on, raw gamma on, BPC on, WPC on, CIP on
{0x3a0f, 0x30}, // stable range in high
{0x3a10, 0x28}, // stable range in low
{0x3a1b, 0x30}, // stable range out high
{0x3a1e, 0x26}, // stable range out low
{0x3a11, 0x60}, // fast zone high
{0x3a1f, 0x14}, // fast zone low
{0x5800, 0x23},
{0x5801, 0x14},
{0x5802, 0x0f},
{0x5803, 0x0f},
{0x5804, 0x12},
{0x5805, 0x26},
{0x5806, 0x0c},
{0x5807, 0x08},
{0x5808, 0x05},
{0x5809, 0x05},
{0x580a, 0x08},
{0x580b, 0x0d},
{0x580c, 0x08},
{0x580d, 0x03},
{0x580e, 0x00},
{0x580f, 0x00},
{0x5810, 0x03},
{0x5811, 0x09},
{0x5812, 0x07},
{0x5813, 0x03},
{0x5814, 0x00},
{0x5815, 0x01},
{0x5816, 0x03},
{0x5817, 0x08},
{0x5818, 0x0d},
{0x5819, 0x08},
{0x581a, 0x05},
{0x581b, 0x06},
{0x581c, 0x08},
{0x581d, 0x0e},
{0x581e, 0x29},
{0x581f, 0x17},
{0x5820, 0x11},
{0x5821, 0x11},
{0x5822, 0x15},
{0x5823, 0x28},
{0x5824, 0x46},
{0x5825, 0x26},
{0x5826, 0x08},
{0x5827, 0x26},
{0x5828, 0x64},
{0x5829, 0x26},
{0x582a, 0x24},
{0x582b, 0x22},
{0x582c, 0x24},
{0x582d, 0x24},
{0x582e, 0x06},
{0x582f, 0x22},
{0x5830, 0x40},
{0x5831, 0x42},
{0x5832, 0x24},
{0x5833, 0x26},
{0x5834, 0x24},
{0x5835, 0x22},
{0x5836, 0x22},
{0x5837, 0x26},
{0x5838, 0x44},
{0x5839, 0x24},
{0x583a, 0x26},
{0x583b, 0x28},
{0x583c, 0x42},
{0x583d, 0xce}, // lenc BR offset
{0x5180, 0xff}, // AWB B block
{0x5181, 0xf2}, // AWB control
{0x5182, 0x00}, // [7:4] max local counter, [3:0] max fast counter
{0x5183, 0x14}, // AWB advanced
{0x5184, 0x25},
{0x5185, 0x24},
{0x5186, 0x09},
{0x5187, 0x09},
{0x5188, 0x09},
{0x5189, 0x75},
{0x518a, 0x54},
{0x518b, 0xe0},
{0x518c, 0xb2},
{0x518d, 0x42},
{0x518e, 0x3d},
{0x518f, 0x56},
{0x5190, 0x46},
{0x5191, 0xf8}, // AWB top limit
{0x5192, 0x04}, // AWB bottom limit
{0x5193, 0x70}, // red limit
{0x5194, 0xf0}, // green limit
{0x5195, 0xf0}, // blue limit
{0x5196, 0x03}, // AWB control
{0x5197, 0x01}, // local limit
{0x5198, 0x04},
{0x5199, 0x12},
{0x519a, 0x04},
{0x519b, 0x00},
{0x519c, 0x06},
{0x519d, 0x82},
{0x519e, 0x38}, // AWB control
{0x5480, 0x01}, // Gamma bias plus on, bit[0]
{0x5481, 0x08},
{0x5482, 0x14},
{0x5483, 0x28},
{0x5484, 0x51},
{0x5485, 0x65},
{0x5486, 0x71},
{0x5487, 0x7d},
{0x5488, 0x87},
{0x5489, 0x91},
{0x548a, 0x9a},
{0x548b, 0xaa},
{0x548c, 0xb8},
{0x548d, 0xcd},
{0x548e, 0xdd},
{0x548f, 0xea},
{0x5490, 0x1d},
{0x5381, 0x1e}, // CMX1 for Y
{0x5382, 0x5b}, // CMX2 for Y
{0x5383, 0x08}, // CMX3 for Y
{0x5384, 0x0a}, // CMX4 for U
{0x5385, 0x7e}, // CMX5 for U
{0x5386, 0x88}, // CMX6 for U
{0x5387, 0x7c}, // CMX7 for V
{0x5388, 0x6c}, // CMX8 for V
{0x5389, 0x10}, // CMX9 for V
{0x538a, 0x01}, // sign[9]
{0x538b, 0x98}, // sign[8:1]
{0x5580, 0x06}, // saturation on, bit[1]
{0x5583, 0x40},
{0x5584, 0x10},
{0x5589, 0x10},
{0x558a, 0x00},
{0x558b, 0xf8},
{0x501d, 0x40}, // enable manual offset of contrast
{0x5300, 0x08}, // CIP sharpen MT threshold 1
{0x5301, 0x30}, // CIP sharpen MT threshold 2
{0x5302, 0x10}, // CIP sharpen MT offset 1
{0x5303, 0x00}, // CIP sharpen MT offset 2
{0x5304, 0x08}, // CIP DNS threshold 1
{0x5305, 0x30}, // CIP DNS threshold 2
{0x5306, 0x08}, // CIP DNS offset 1
{0x5307, 0x16}, // CIP DNS offset 2
{0x5309, 0x08}, // CIP sharpen TH threshold 1
{0x530a, 0x30}, // CIP sharpen TH threshold 2
{0x530b, 0x04}, // CIP sharpen TH offset 1
{0x530c, 0x06}, // CIP sharpen TH offset 2
{0x5025, 0x00},
{0x3008, 0x02}, // wake up from standby, bit[6]
{0x4740, 0X21}, //VSYNC active HIGH
{0x0000, 0x00}
};
#endif

View File

@ -1,64 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _PROJECT_CFG_H_
#define _PROJECT_CFG_H_
#include <pin_cfg.h>
#define SPI_CHANNEL 0
#define SPI_SLAVE_SELECT 3
#define __SPI_SYSCTL(x, y) SYSCTL_##x##_SPI##y
#define _SPI_SYSCTL(x, y) __SPI_SYSCTL(x, y)
#define SPI_SYSCTL(x) _SPI_SYSCTL(x, SPI_CHANNEL)
#define __SPI_SS(x, y) FUNC_SPI##x##_SS##y
#define _SPI_SS(x, y) __SPI_SS(x, y)
#define SPI_SS _SPI_SS(SPI_CHANNEL, SPI_SLAVE_SELECT)
#define __SPI(x, y) FUNC_SPI##x##_##y
#define _SPI(x, y) __SPI(x, y)
#define SPI(x) _SPI(SPI_CHANNEL, x)
#define DCX_IO (8)
#define DCX_GPIONUM (2)
#define TF_CS_GPIONUM 7
const fpioa_cfg_t g_fpioa_cfg =
{
.version = PIN_CFG_VERSION,
.functions_count = 11 + 4,
.functions =
{
{DCX_IO, FUNC_GPIOHS0 + DCX_GPIONUM},
{6, SPI_SS},
{7, SPI(SCLK)},
{11, FUNC_CMOS_RST},
{13, FUNC_CMOS_PWDN},
{10, FUNC_SCCB_SCLK},
{9, FUNC_SCCB_SDA},
{14, FUNC_CMOS_XCLK},
{12, FUNC_CMOS_VSYNC},
{17, FUNC_CMOS_HREF},
{15, FUNC_CMOS_PCLK},
{32, FUNC_GPIOHS0 + TF_CS_GPIONUM},
{29, FUNC_SPI1_SCLK},
{30, FUNC_SPI1_D0},
{31, FUNC_SPI1_D1}
}
};
const pin_cfg_t g_pin_cfg =
{
.version = PIN_CFG_VERSION,
.set_spi0_dvp_data = 1
};
#endif

View File

@ -1,381 +0,0 @@
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "region_layer.h"
typedef struct
{
float x;
float y;
float w;
float h;
} box_t;
typedef struct
{
int index;
int class;
float **probs;
} sortable_box_t;
int region_layer_init(region_layer_t *rl, int width, int height, int channels, int origin_width, int origin_height)
{
int flag = 0;
rl->coords = 4;
rl->image_width = 320;
rl->image_height = 240;
rl->classes = channels / 5 - 5;
rl->net_width = origin_width;
rl->net_height = origin_height;
rl->layer_width = width;
rl->layer_height = height;
rl->boxes_number = (rl->layer_width * rl->layer_height * rl->anchor_number);
rl->output_number = (rl->boxes_number * (rl->classes + rl->coords + 1));
rl->output = malloc(rl->output_number * sizeof(float));
if (rl->output == NULL)
{
flag = -1;
goto malloc_error;
}
rl->boxes = malloc(rl->boxes_number * sizeof(box_t));
if (rl->boxes == NULL)
{
flag = -2;
goto malloc_error;
}
rl->probs_buf = malloc(rl->boxes_number * (rl->classes + 1) * sizeof(float));
if (rl->probs_buf == NULL)
{
flag = -3;
goto malloc_error;
}
rl->probs = malloc(rl->boxes_number * sizeof(float *));
if (rl->probs == NULL)
{
flag = -4;
goto malloc_error;
}
for (uint32_t i = 0; i < rl->boxes_number; i++)
rl->probs[i] = &(rl->probs_buf[i * (rl->classes + 1)]);
return 0;
malloc_error:
free(rl->output);
free(rl->boxes);
free(rl->probs_buf);
free(rl->probs);
return flag;
}
void region_layer_deinit(region_layer_t *rl)
{
free(rl->output);
free(rl->boxes);
free(rl->probs_buf);
free(rl->probs);
}
static inline float sigmoid(float x)
{
return 1.f / (1.f + expf(-x));
}
static void activate_array(region_layer_t *rl, int index, int n)
{
float *output = &rl->output[index];
float *input = &rl->input[index];
for (int i = 0; i < n; ++i)
output[i] = sigmoid(input[i]);
}
static int entry_index(region_layer_t *rl, int location, int entry)
{
int wh = rl->layer_width * rl->layer_height;
int n = location / wh;
int loc = location % wh;
return n * wh * (rl->coords + rl->classes + 1) + entry * wh + loc;
}
static void softmax(region_layer_t *rl, float *input, int n, int stride, float *output)
{
int i;
float diff;
float e;
float sum = 0;
float largest_i = input[0];
for (i = 0; i < n; ++i)
{
if (input[i * stride] > largest_i)
largest_i = input[i * stride];
}
for (i = 0; i < n; ++i) {
diff = input[i * stride] - largest_i;
e = expf(diff);
sum += e;
output[i * stride] = e;
}
for (i = 0; i < n; ++i)
output[i * stride] /= sum;
}
static void softmax_cpu(region_layer_t *rl, float *input, int n, int batch, int batch_offset, int groups, int stride, float *output)
{
int g, b;
for (b = 0; b < batch; ++b) {
for (g = 0; g < groups; ++g)
softmax(rl, input + b * batch_offset + g, n, stride, output + b * batch_offset + g);
}
}
static void forward_region_layer(region_layer_t *rl)
{
int index;
for (index = 0; index < rl->output_number; index++)
rl->output[index] = rl->input[index];
for (int n = 0; n < rl->anchor_number; ++n)
{
index = entry_index(rl, n * rl->layer_width * rl->layer_height, 0);
activate_array(rl, index, 2 * rl->layer_width * rl->layer_height);
index = entry_index(rl, n * rl->layer_width * rl->layer_height, 4);
activate_array(rl, index, rl->layer_width * rl->layer_height);
}
index = entry_index(rl, 0, rl->coords + 1);
softmax_cpu(rl, rl->input + index, rl->classes, rl->anchor_number,
rl->output_number / rl->anchor_number, rl->layer_width * rl->layer_height,
rl->layer_width * rl->layer_height, rl->output + index);
}
static void correct_region_boxes(region_layer_t *rl, box_t *boxes)
{
uint32_t net_width = rl->net_width;
uint32_t net_height = rl->net_height;
uint32_t image_width = rl->image_width;
uint32_t image_height = rl->image_height;
uint32_t boxes_number = rl->boxes_number;
int new_w = 0;
int new_h = 0;
if (((float)net_width / image_width) <
((float)net_height / image_height)) {
new_w = net_width;
new_h = (image_height * net_width) / image_width;
} else {
new_h = net_height;
new_w = (image_width * net_height) / image_height;
}
for (int i = 0; i < boxes_number; ++i) {
box_t b = boxes[i];
b.x = (b.x - (net_width - new_w) / 2. / net_width) /
((float)new_w / net_width);
b.y = (b.y - (net_height - new_h) / 2. / net_height) /
((float)new_h / net_height);
b.w *= (float)net_width / new_w;
b.h *= (float)net_height / new_h;
boxes[i] = b;
}
}
static box_t get_region_box(float *x, float *biases, int n, int index, int i, int j, int w, int h, int stride)
{
volatile box_t b;
b.x = (i + x[index + 0 * stride]) / w;
b.y = (j + x[index + 1 * stride]) / h;
b.w = expf(x[index + 2 * stride]) * biases[2 * n] / w;
b.h = expf(x[index + 3 * stride]) * biases[2 * n + 1] / h;
return b;
}
static void get_region_boxes(region_layer_t *rl, float *predictions, float **probs, box_t *boxes)
{
uint32_t layer_width = rl->layer_width;
uint32_t layer_height = rl->layer_height;
uint32_t anchor_number = rl->anchor_number;
uint32_t classes = rl->classes;
uint32_t coords = rl->coords;
float threshold = rl->threshold;
for (int i = 0; i < layer_width * layer_height; ++i)
{
int row = i / layer_width;
int col = i % layer_width;
for (int n = 0; n < anchor_number; ++n)
{
int index = n * layer_width * layer_height + i;
for (int j = 0; j < classes; ++j)
probs[index][j] = 0;
int obj_index = entry_index(rl, n * layer_width * layer_height + i, coords);
int box_index = entry_index(rl, n * layer_width * layer_height + i, 0);
float scale = predictions[obj_index];
boxes[index] = get_region_box(predictions, rl->anchor, n, box_index, col, row,
layer_width, layer_height, layer_width * layer_height);
float max = 0;
for (int j = 0; j < classes; ++j)
{
int class_index = entry_index(rl, n * layer_width * layer_height + i, coords + 1 + j);
float prob = scale * predictions[class_index];
probs[index][j] = (prob > threshold) ? prob : 0;
if (prob > max)
max = prob;
}
probs[index][classes] = max;
}
}
correct_region_boxes(rl, boxes);
}
static int nms_comparator(void *pa, void *pb)
{
sortable_box_t a = *(sortable_box_t *)pa;
sortable_box_t b = *(sortable_box_t *)pb;
float diff = a.probs[a.index][b.class] - b.probs[b.index][b.class];
if (diff < 0)
return 1;
else if (diff > 0)
return -1;
return 0;
}
static float overlap(float x1, float w1, float x2, float w2)
{
float l1 = x1 - w1/2;
float l2 = x2 - w2/2;
float left = l1 > l2 ? l1 : l2;
float r1 = x1 + w1/2;
float r2 = x2 + w2/2;
float right = r1 < r2 ? r1 : r2;
return right - left;
}
static float box_intersection(box_t a, box_t b)
{
float w = overlap(a.x, a.w, b.x, b.w);
float h = overlap(a.y, a.h, b.y, b.h);
if (w < 0 || h < 0)
return 0;
return w * h;
}
static float box_union(box_t a, box_t b)
{
float i = box_intersection(a, b);
float u = a.w * a.h + b.w * b.h - i;
return u;
}
static float box_iou(box_t a, box_t b)
{
return box_intersection(a, b) / box_union(a, b);
}
static void do_nms_sort(region_layer_t *rl, box_t *boxes, float **probs)
{
uint32_t boxes_number = rl->boxes_number;
uint32_t classes = rl->classes;
float nms_value = rl->nms_value;
int i, j, k;
sortable_box_t s[boxes_number];
for (i = 0; i < boxes_number; ++i)
{
s[i].index = i;
s[i].class = 0;
s[i].probs = probs;
}
for (k = 0; k < classes; ++k)
{
for (i = 0; i < boxes_number; ++i)
s[i].class = k;
qsort(s, boxes_number, sizeof(sortable_box_t), nms_comparator);
for (i = 0; i < boxes_number; ++i)
{
if (probs[s[i].index][k] == 0)
continue;
box_t a = boxes[s[i].index];
for (j = i + 1; j < boxes_number; ++j)
{
box_t b = boxes[s[j].index];
if (box_iou(a, b) > nms_value)
probs[s[j].index][k] = 0;
}
}
}
}
static int max_index(float *a, int n)
{
int i, max_i = 0;
float max = a[0];
for (i = 1; i < n; ++i)
{
if (a[i] > max)
{
max = a[i];
max_i = i;
}
}
return max_i;
}
static void region_layer_output(region_layer_t *rl, obj_info_t *obj_info)
{
uint32_t obj_number = 0;
uint32_t image_width = rl->image_width;
uint32_t image_height = rl->image_height;
uint32_t boxes_number = rl->boxes_number;
float threshold = rl->threshold;
box_t *boxes = (box_t *)rl->boxes;
for (int i = 0; i < rl->boxes_number; ++i)
{
int class = max_index(rl->probs[i], rl->classes);
float prob = rl->probs[i][class];
if (prob > threshold)
{
box_t *b = boxes + i;
obj_info->obj[obj_number].x1 = b->x * image_width - (b->w * image_width / 2);
obj_info->obj[obj_number].y1 = b->y * image_height - (b->h * image_height / 2);
obj_info->obj[obj_number].x2 = b->x * image_width + (b->w * image_width / 2);
obj_info->obj[obj_number].y2 = b->y * image_height + (b->h * image_height / 2);
obj_info->obj[obj_number].class_id = class;
obj_info->obj[obj_number].prob = prob;
obj_number++;
}
}
obj_info->obj_number = obj_number;
}
void region_layer_run(region_layer_t *rl, obj_info_t *obj_info)
{
forward_region_layer(rl);
get_region_boxes(rl, rl->output, rl->probs, rl->boxes);
do_nms_sort(rl, rl->boxes, rl->probs);
region_layer_output(rl, obj_info);
}

View File

@ -1,47 +0,0 @@
#ifndef _REGION_LAYER
#define _REGION_LAYER
#include <stdint.h>
typedef struct
{
uint32_t obj_number;
struct
{
uint32_t x1;
uint32_t y1;
uint32_t x2;
uint32_t y2;
uint32_t class_id;
float prob;
} obj[10];
} obj_info_t;
typedef struct
{
float threshold;
float nms_value;
uint32_t coords;
uint32_t anchor_number;
float *anchor;
uint32_t image_width;
uint32_t image_height;
uint32_t classes;
uint32_t net_width;
uint32_t net_height;
uint32_t layer_width;
uint32_t layer_height;
uint32_t boxes_number;
uint32_t output_number;
void *boxes;
float *input;
float *output;
float *probs_buf;
float **probs;
} region_layer_t;
int region_layer_init(region_layer_t *rl, int width, int height, int channels, int origin_width, int origin_height);
void region_layer_deinit(region_layer_t *rl);
void region_layer_run(region_layer_t *rl, obj_info_t *obj_info);
#endif // _REGION_LAYER

View File

@ -1,303 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <devices.h>
#include "w25qxx.h"
#include "printf.h"
#include "iomem.h"
uintptr_t spi_adapter;
uintptr_t spi_stand;
static SemaphoreHandle_t event;
static enum w25qxx_status_t w25qxx_receive_data(uint8_t* cmd_buff, uint8_t cmd_len, uint8_t* rx_buff, uint32_t rx_len)
{
//xSemaphoreTake(event, portMAX_DELAY);
spi_dev_transfer_sequential(spi_stand, (uint8_t *)cmd_buff, cmd_len, (uint8_t *)rx_buff, rx_len);
//xSemaphoreGive(event);
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_receive_data_enhanced(uint32_t* cmd_buff, uint8_t cmd_len, uint8_t* rx_buff, uint32_t rx_len)
{
//xSemaphoreTake(event, portMAX_DELAY);
memcpy(rx_buff, cmd_buff, cmd_len);
io_read(spi_adapter, (uint8_t *)rx_buff, rx_len);
//xSemaphoreGive(event);
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_send_data(uintptr_t file, uint8_t* cmd_buff, uint8_t cmd_len, uint8_t* tx_buff, uint32_t tx_len)
{
configASSERT(cmd_len);
//xSemaphoreTake(event, portMAX_DELAY);
uint8_t* tmp_buf = iomem_malloc(cmd_len + tx_len);
memcpy(tmp_buf, cmd_buff, cmd_len);
if (tx_len)
memcpy(tmp_buf + cmd_len, tx_buff, tx_len);
io_write(file, (uint8_t *)tmp_buf, cmd_len + tx_len);
iomem_free(tmp_buf);
//xSemaphoreGive(event);
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_write_enable(void)
{
uint8_t cmd[1] = {WRITE_ENABLE};
w25qxx_send_data(spi_stand, cmd, 1, 0, 0);
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_read_status_reg1(uint8_t* reg_data)
{
uint8_t cmd[1] = {READ_REG1};
uint8_t data[1];
w25qxx_receive_data(cmd, 1, data, 1);
*reg_data = data[0];
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_read_status_reg2(uint8_t* reg_data)
{
uint8_t cmd[1] = {READ_REG2};
uint8_t data[1];
w25qxx_receive_data(cmd, 1, data, 1);
*reg_data = data[0];
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_write_status_reg(uint8_t reg1_data, uint8_t reg2_data)
{
uint8_t cmd[3] = {WRITE_REG1, reg1_data, reg2_data};
w25qxx_write_enable();
w25qxx_send_data(spi_stand, cmd, 3, 0, 0);
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_enable_quad_mode(void)
{
uint8_t reg_data;
w25qxx_read_status_reg2(&reg_data);
if (!(reg_data & REG2_QUAL_MASK))
{
reg_data |= REG2_QUAL_MASK;
w25qxx_write_status_reg(0x00, reg_data);
}
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_is_busy(void)
{
uint8_t status;
w25qxx_read_status_reg1(&status);
if (status & REG1_BUSY_MASK)
return W25QXX_BUSY;
return W25QXX_OK;
}
enum w25qxx_status_t w25qxx_sector_erase(uint32_t addr)
{
uint8_t cmd[4] = {SECTOR_ERASE};
cmd[1] = (uint8_t)(addr >> 16);
cmd[2] = (uint8_t)(addr >> 8);
cmd[3] = (uint8_t)(addr);
w25qxx_write_enable();
w25qxx_send_data(spi_stand, cmd, 4, 0, 0);
return W25QXX_OK;
}
enum w25qxx_status_t w25qxx_read_id(uint8_t *manuf_id, uint8_t *device_id)
{
uint8_t cmd[4] = {READ_ID, 0x00, 0x00, 0x00};
uint8_t data[2] = {0};
w25qxx_receive_data(cmd, 4, data, 2);
*manuf_id = data[0];
*device_id = data[1];
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_read_data_less_64kb(uint32_t addr, uint8_t* data_buf, uint32_t length)
{
uint32_t cmd[2];
switch (WORK_TRANS_MODE)
{
case SPI_FF_DUAL:
*(((uint8_t*)cmd) + 0) = FAST_READ_DUAL_OUTPUT;
*(((uint8_t*)cmd) + 1) = (uint8_t)(addr >> 0);
*(((uint8_t*)cmd) + 2) = (uint8_t)(addr >> 8);
*(((uint8_t*)cmd) + 3) = (uint8_t)(addr >> 16);
w25qxx_receive_data_enhanced(cmd, 4, data_buf, length);
break;
case SPI_FF_QUAD:
*(((uint8_t*)cmd) + 0) = FAST_READ_QUAL_OUTPUT;
*(((uint8_t*)cmd) + 1) = (uint8_t)(addr >> 0);
*(((uint8_t*)cmd) + 2) = (uint8_t)(addr >> 8);
*(((uint8_t*)cmd) + 3) = (uint8_t)(addr >> 16);
w25qxx_receive_data_enhanced(cmd, 4, data_buf, length);
break;
case SPI_FF_STANDARD:
default:
*(((uint8_t*)cmd) + 0) = READ_DATA;
*(((uint8_t*)cmd) + 1) = (uint8_t)(addr >> 16);
*(((uint8_t*)cmd) + 2) = (uint8_t)(addr >> 8);
*(((uint8_t*)cmd) + 3) = (uint8_t)(addr >> 0);
w25qxx_receive_data((uint8_t*)cmd, 4, data_buf, length);
break;
}
return W25QXX_OK;
}
enum w25qxx_status_t w25qxx_read_data(uint32_t addr, uint8_t* data_buf, uint32_t length)
{
uint32_t len;
while (length)
{
len = length >= 0x010000 ? 0x010000 : length;
w25qxx_read_data_less_64kb(addr, data_buf, len);
addr += len;
data_buf += len;
length -= len;
}
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_page_program(uint32_t addr, uint8_t* data_buf, uint32_t length)
{
uint32_t cmd[2];
w25qxx_write_enable();
if (WORK_TRANS_MODE == SPI_FF_QUAD)
{
*(((uint8_t*)cmd) + 0) = QUAD_PAGE_PROGRAM;
*(((uint8_t*)cmd) + 1) = (uint8_t)(addr >> 0);
*(((uint8_t*)cmd) + 2) = (uint8_t)(addr >> 8);
*(((uint8_t*)cmd) + 3) = (uint8_t)(addr >> 16);
w25qxx_send_data(spi_adapter, (uint8_t*)cmd, 4, data_buf, length);
}
else
{
*(((uint8_t*)cmd) + 0) = PAGE_PROGRAM;
*(((uint8_t*)cmd) + 1) = (uint8_t)(addr >> 16);
*(((uint8_t*)cmd) + 2) = (uint8_t)(addr >> 8);
*(((uint8_t*)cmd) + 3) = (uint8_t)(addr >> 0);
w25qxx_send_data(spi_stand, (uint8_t*)cmd, 4, data_buf, length);
}
while (w25qxx_is_busy() == W25QXX_BUSY)
;
return W25QXX_OK;
}
static enum w25qxx_status_t w25qxx_sector_program(uint32_t addr, uint8_t* data_buf)
{
uint8_t index;
for (index = 0; index < w25qxx_FLASH_PAGE_NUM_PER_SECTOR; index++)
{
w25qxx_page_program(addr, data_buf, w25qxx_FLASH_PAGE_SIZE);
addr += w25qxx_FLASH_PAGE_SIZE;
data_buf += w25qxx_FLASH_PAGE_SIZE;
}
return W25QXX_OK;
}
enum w25qxx_status_t w25qxx_write_data(uint32_t addr, uint8_t* data_buf, uint32_t length)
{
uint32_t sector_addr, sector_offset, sector_remain, write_len, index;
uint8_t *swap_buf = (uint8_t *)iomem_malloc(w25qxx_FLASH_SECTOR_SIZE);
uint8_t *pread, *pwrite;
while (length)
{
sector_addr = addr & (~(w25qxx_FLASH_SECTOR_SIZE - 1));
sector_offset = addr & (w25qxx_FLASH_SECTOR_SIZE - 1);
sector_remain = w25qxx_FLASH_SECTOR_SIZE - sector_offset;
write_len = length < sector_remain ? length : sector_remain;
w25qxx_read_data(sector_addr, swap_buf, w25qxx_FLASH_SECTOR_SIZE);
pread = swap_buf + sector_offset;
pwrite = data_buf;
for (index = 0; index < write_len; index++)
{
if ((*pwrite) != ((*pwrite) & (*pread)))
{
w25qxx_sector_erase(sector_addr);
while (w25qxx_is_busy() == W25QXX_BUSY)
;
break;
}
pwrite++;
pread++;
}
if (write_len == w25qxx_FLASH_SECTOR_SIZE)
w25qxx_sector_program(sector_addr, data_buf);
else
{
pread = swap_buf + sector_offset;
pwrite = data_buf;
for (index = 0; index < write_len; index++)
*pread++ = *pwrite++;
w25qxx_sector_program(sector_addr, swap_buf);
}
length -= write_len;
addr += write_len;
data_buf += write_len;
}
iomem_free(swap_buf);
return W25QXX_OK;
}
enum w25qxx_status_t w25qxx_init(uintptr_t spi_in)
{
uint8_t manuf_id, device_id;
event = xSemaphoreCreateMutex();
spi_stand = spi_get_device(spi_in, SPI_MODE_0, SPI_FF_STANDARD, CHIP_SELECT, FRAME_LENGTH);
spi_dev_set_clock_rate(spi_stand, 25000000);
w25qxx_read_id(&manuf_id, &device_id);
if ((manuf_id != 0xEF && manuf_id != 0xC8) || (device_id != 0x17 && device_id != 0x16))
{
printf("manuf_id:0x%02x, device_id:0x%02x\n", manuf_id, device_id);
}
printf("manuf_id:0x%02x, device_id:0x%02x\n", manuf_id, device_id);
switch (WORK_TRANS_MODE)
{
case SPI_FF_DUAL:
spi_adapter = spi_get_device(spi_in, SPI_MODE_0, SPI_FF_DUAL, CHIP_SELECT, FRAME_LENGTH);
spi_dev_config_non_standard(spi_adapter, INSTRUCTION_LENGTH, ADDRESS_LENGTH, WAIT_CYCLE, SPI_AITM_STANDARD);
break;
case SPI_FF_QUAD:
spi_adapter = spi_get_device(spi_in, SPI_MODE_0, SPI_FF_QUAD, CHIP_SELECT, FRAME_LENGTH);
spi_dev_config_non_standard(spi_adapter, INSTRUCTION_LENGTH, ADDRESS_LENGTH, WAIT_CYCLE, SPI_AITM_STANDARD);
w25qxx_enable_quad_mode();
break;
case SPI_FF_STANDARD:
default:
spi_adapter = spi_stand;
break;
}
return W25QXX_OK;
}

View File

@ -1,86 +0,0 @@
/* Copyright 2018 Canaan Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _W25QXX_H
#define _W25QXX_H
#include <stdint.h>
/* clang-format off */
#define WORK_TRANS_MODE SPI_FF_STANDARD
/* #define WORK_TRANS_MODE SPI_FF_DUAL */
/* #define WORK_TRANS_MODE SPI_FF_QUAD */
#define CHIP_SELECT 1
#define WAIT_CYCLE 8
#define FRAME_LENGTH 8
#define INSTRUCTION_LENGTH 8
#define ADDRESS_LENGTH 24
#define SPI_SLAVE_SELECT (0x01)
#define w25qxx_FLASH_PAGE_SIZE 256
#define w25qxx_FLASH_SECTOR_SIZE 4096
#define w25qxx_FLASH_PAGE_NUM_PER_SECTOR 16
#define w25qxx_FLASH_CHIP_SIZE (16777216 UL)
#define WRITE_ENABLE 0x06
#define WRITE_DISABLE 0x04
#define READ_REG1 0x05
#define READ_REG2 0x35
#define READ_REG3 0x15
#define WRITE_REG1 0x01
#define WRITE_REG2 0x31
#define WRITE_REG3 0x11
#define READ_DATA 0x03
#define FAST_READ 0x0B
#define FAST_READ_DUAL_OUTPUT 0x3B
#define FAST_READ_QUAL_OUTPUT 0x6B
#define FAST_READ_DUAL_IO 0xBB
#define FAST_READ_QUAL_IO 0xEB
#define DUAL_READ_RESET 0xFFFF
#define QUAL_READ_RESET 0xFF
#define PAGE_PROGRAM 0x02
#define QUAD_PAGE_PROGRAM 0x32
#define SECTOR_ERASE 0x20
#define BLOCK_32K_ERASE 0x52
#define BLOCK_64K_ERASE 0xD8
#define CHIP_ERASE 0x60
#define READ_ID 0x90
#define ENABLE_QPI 0x38
#define EXIT_QPI 0xFF
#define ENABLE_RESET 0x66
#define RESET_DEVICE 0x99
#define REG1_BUSY_MASK 0x01
#define REG2_QUAL_MASK 0x02
#define LETOBE(x) ((x >> 24) | ((x & 0x00FF0000) >> 8) | ((x & 0x0000FF00) << 8) | (x << 24))
/* clang-format on */
/**
* @brief w25qxx operating status enumerate
*/
enum w25qxx_status_t
{
W25QXX_OK = 0,
W25QXX_BUSY,
W25QXX_ERROR,
};
enum w25qxx_status_t w25qxx_init(uintptr_t spi_in);
enum w25qxx_status_t w25qxx_write_data(uint32_t addr, uint8_t* data_buf, uint32_t length);
enum w25qxx_status_t w25qxx_read_data(uint32_t addr, uint8_t* data_buf, uint32_t length);
#endif