GR-MANGO sample using mbed-os library from my repository.
sample_programs/sample_20_drp_dynamic_loading.cpp@0:b4c1e32627f2, 2020-10-12 (annotated)
- Committer:
- RyoheiHagimoto
- Date:
- Mon Oct 12 02:25:49 2020 +0000
- Revision:
- 0:b4c1e32627f2
replaced mbed-os library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| RyoheiHagimoto | 0:b4c1e32627f2 | 1 | /******************************************************************************* |
| RyoheiHagimoto | 0:b4c1e32627f2 | 2 | * DISCLAIMER |
| RyoheiHagimoto | 0:b4c1e32627f2 | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
| RyoheiHagimoto | 0:b4c1e32627f2 | 4 | * intended for use with Renesas products. No other uses are authorized. This |
| RyoheiHagimoto | 0:b4c1e32627f2 | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
| RyoheiHagimoto | 0:b4c1e32627f2 | 6 | * all applicable laws, including copyright laws. |
| RyoheiHagimoto | 0:b4c1e32627f2 | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
| RyoheiHagimoto | 0:b4c1e32627f2 | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
| RyoheiHagimoto | 0:b4c1e32627f2 | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
| RyoheiHagimoto | 0:b4c1e32627f2 | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
| RyoheiHagimoto | 0:b4c1e32627f2 | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
| RyoheiHagimoto | 0:b4c1e32627f2 | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
| RyoheiHagimoto | 0:b4c1e32627f2 | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
| RyoheiHagimoto | 0:b4c1e32627f2 | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
| RyoheiHagimoto | 0:b4c1e32627f2 | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
| RyoheiHagimoto | 0:b4c1e32627f2 | 16 | * Renesas reserves the right, without notice, to make changes to this software |
| RyoheiHagimoto | 0:b4c1e32627f2 | 17 | * and to discontinue the availability of this software. By using this software, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 18 | * you agree to the additional terms and conditions found by accessing the |
| RyoheiHagimoto | 0:b4c1e32627f2 | 19 | * following link: |
| RyoheiHagimoto | 0:b4c1e32627f2 | 20 | * http://www.renesas.com/disclaimer |
| RyoheiHagimoto | 0:b4c1e32627f2 | 21 | * |
| RyoheiHagimoto | 0:b4c1e32627f2 | 22 | * Copyright (C) 2019 Renesas Electronics Corporation. All rights reserved. |
| RyoheiHagimoto | 0:b4c1e32627f2 | 23 | *******************************************************************************/ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 24 | #include "sample_select.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 25 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 26 | #if (SAMPLE_PROGRAM_NO == 20) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 27 | // SAMPLE_PROGRAM_NO 20 : DRP Dynamic Loading Sample |
| RyoheiHagimoto | 0:b4c1e32627f2 | 28 | // |
| RyoheiHagimoto | 0:b4c1e32627f2 | 29 | // Detects the edges of the input image from MIPI camera by Canny method using DRP and outputs to display. |
| RyoheiHagimoto | 0:b4c1e32627f2 | 30 | // Please refer to the document for details. (RZ_A2M_Mbed\drp-for-mbed\r_drp\doc) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 31 | // |
| RyoheiHagimoto | 0:b4c1e32627f2 | 32 | // Please set the value of "camera-type" in "mbed_app.json" to null or "CAMERA_RASPBERRY_PI". |
| RyoheiHagimoto | 0:b4c1e32627f2 | 33 | // |
| RyoheiHagimoto | 0:b4c1e32627f2 | 34 | // "camera-type":{ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 35 | // "help": "Please see EasyAttach_CameraAndLCD/README.md", |
| RyoheiHagimoto | 0:b4c1e32627f2 | 36 | // "value": null |
| RyoheiHagimoto | 0:b4c1e32627f2 | 37 | // }, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 38 | // |
| RyoheiHagimoto | 0:b4c1e32627f2 | 39 | // or |
| RyoheiHagimoto | 0:b4c1e32627f2 | 40 | // |
| RyoheiHagimoto | 0:b4c1e32627f2 | 41 | // "camera-type":{ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 42 | // "help": "Please see EasyAttach_CameraAndLCD/README.md", |
| RyoheiHagimoto | 0:b4c1e32627f2 | 43 | // "value": "CAMERA_RASPBERRY_PI" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 44 | // }, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 45 | // |
| RyoheiHagimoto | 0:b4c1e32627f2 | 46 | // Requirements |
| RyoheiHagimoto | 0:b4c1e32627f2 | 47 | // RZ/A2M Evaluation Board Kit : Display Output Board |
| RyoheiHagimoto | 0:b4c1e32627f2 | 48 | // SBEV-RZ/A2M : LVDS To HDMI Board |
| RyoheiHagimoto | 0:b4c1e32627f2 | 49 | // SEMB1402 : LVDS To HDMI Board |
| RyoheiHagimoto | 0:b4c1e32627f2 | 50 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 51 | #if !defined(TARGET_RZ_A2XX) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 52 | #error "DRP and MIPI are not supported." |
| RyoheiHagimoto | 0:b4c1e32627f2 | 53 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 54 | #if MBED_CONF_APP_CAMERA_TYPE != CAMERA_RASPBERRY_PI |
| RyoheiHagimoto | 0:b4c1e32627f2 | 55 | #error Please set the value of "camera-type" in "mbed_app.json" to "CAMERA_RASPBERRY_PI" and build. |
| RyoheiHagimoto | 0:b4c1e32627f2 | 56 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 57 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 58 | #include "mbed.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 59 | #include "EasyAttach_CameraAndLCD.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 60 | #include "dcache-control.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 61 | #include "AsciiFont.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 62 | #include "r_dk2_if.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 63 | #include "r_drp_bayer2grayscale.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 64 | #include "r_drp_median_blur.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 65 | #include "r_drp_canny_calculate.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 66 | #include "r_drp_canny_hysterisis.h" |
| RyoheiHagimoto | 0:b4c1e32627f2 | 67 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 68 | #define RAM_TABLE_DYNAMIC_LOADING 1 |
| RyoheiHagimoto | 0:b4c1e32627f2 | 69 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 70 | /*! Frame buffer stride: Frame buffer stride should be set to a multiple of 32 or 128 |
| RyoheiHagimoto | 0:b4c1e32627f2 | 71 | in accordance with the frame buffer burst transfer mode. */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 72 | #define VIDEO_PIXEL_HW (640) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 73 | #define VIDEO_PIXEL_VW (480) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 74 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 75 | #define DATA_SIZE_PER_PIC (1u) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 76 | #define FRAME_BUFFER_STRIDE (((VIDEO_PIXEL_HW * DATA_SIZE_PER_PIC) + 31u) & ~31u) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 77 | #define FRAME_BUFFER_HEIGHT (VIDEO_PIXEL_VW) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 78 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 79 | #define DRP_FLG_TILE_ALL (R_DK2_TILE_0 | R_DK2_TILE_1 | R_DK2_TILE_2 | R_DK2_TILE_3 | R_DK2_TILE_4 | R_DK2_TILE_5) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 80 | #define DRP_FLG_CAMER_IN (0x00000100) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 81 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 82 | static DisplayBase Display; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 83 | static uint8_t fbuf_bayer[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((aligned(128))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 84 | static uint8_t fbuf_work0[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 85 | static uint8_t fbuf_work1[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 86 | static uint8_t fbuf_clat8[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 87 | static uint8_t fbuf_overlay[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((section("NC_BSS"),aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 88 | static uint8_t drp_work_buf[((FRAME_BUFFER_STRIDE * ((FRAME_BUFFER_HEIGHT / 3) + 2)) * 2) * 3]__attribute((section("NC_BSS"))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 89 | static uint8_t nc_memory[512] __attribute((section("NC_BSS"))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 90 | static uint8_t drp_lib_id[R_DK2_TILE_NUM] = {0}; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 91 | static Thread drpTask(osPriorityHigh); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 92 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 93 | #if RAM_TABLE_DYNAMIC_LOADING |
| RyoheiHagimoto | 0:b4c1e32627f2 | 94 | static uint8_t ram_drp_lib_bayer2grayscale[sizeof(g_drp_lib_bayer2grayscale)]__attribute((aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 95 | static uint8_t ram_drp_lib_median_blur[sizeof(g_drp_lib_median_blur)]__attribute((aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 96 | static uint8_t ram_drp_lib_canny_calculate[sizeof(g_drp_lib_canny_calculate)]__attribute((aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 97 | static uint8_t ram_drp_lib_canny_hysterisis[sizeof(g_drp_lib_canny_hysterisis)]__attribute((aligned(32))); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 98 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 99 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 100 | static const uint32_t clut_data_resut[] = {0x00000000, 0xff00ff00}; // ARGB8888 |
| RyoheiHagimoto | 0:b4c1e32627f2 | 101 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 102 | static void IntCallbackFunc_Vfield(DisplayBase::int_type_t int_type) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 103 | drpTask.flags_set(DRP_FLG_CAMER_IN); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 104 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 105 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 106 | static void cb_drp_finish(uint8_t id) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 107 | uint32_t tile_no; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 108 | uint32_t set_flgs = 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 109 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 110 | // Change the operation state of the DRP library notified by the argument to finish |
| RyoheiHagimoto | 0:b4c1e32627f2 | 111 | for (tile_no = 0; tile_no < R_DK2_TILE_NUM; tile_no++) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 112 | if (drp_lib_id[tile_no] == id) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 113 | set_flgs |= (1 << tile_no); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 114 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 115 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 116 | drpTask.flags_set(set_flgs); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 117 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 118 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 119 | static void Start_Video_Camera(void) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 120 | // Video capture setting (progressive form fixed) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 121 | Display.Video_Write_Setting( |
| RyoheiHagimoto | 0:b4c1e32627f2 | 122 | DisplayBase::VIDEO_INPUT_CHANNEL_0, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 123 | DisplayBase::COL_SYS_NTSC_358, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 124 | (void *)fbuf_bayer, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 125 | FRAME_BUFFER_STRIDE, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 126 | DisplayBase::VIDEO_FORMAT_RAW8, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 127 | DisplayBase::WR_RD_WRSWA_NON, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 128 | VIDEO_PIXEL_VW, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 129 | VIDEO_PIXEL_HW |
| RyoheiHagimoto | 0:b4c1e32627f2 | 130 | ); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 131 | EasyAttach_CameraStart(Display, DisplayBase::VIDEO_INPUT_CHANNEL_0); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 132 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 133 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 134 | static void Start_LCD_Display(void) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 135 | DisplayBase::rect_t rect; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 136 | DisplayBase::clut_t clut_param; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 137 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 138 | rect.vs = 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 139 | rect.vw = VIDEO_PIXEL_VW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 140 | rect.hs = 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 141 | rect.hw = VIDEO_PIXEL_HW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 142 | Display.Graphics_Read_Setting( |
| RyoheiHagimoto | 0:b4c1e32627f2 | 143 | DisplayBase::GRAPHICS_LAYER_0, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 144 | (void *)fbuf_clat8, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 145 | FRAME_BUFFER_STRIDE, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 146 | DisplayBase::GRAPHICS_FORMAT_CLUT8, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 147 | DisplayBase::WR_RD_WRSWA_32_16_8BIT, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 148 | &rect |
| RyoheiHagimoto | 0:b4c1e32627f2 | 149 | ); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 150 | Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_0); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 151 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 152 | memset(fbuf_overlay, 0, sizeof(fbuf_overlay)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 153 | clut_param.color_num = sizeof(clut_data_resut) / sizeof(uint32_t); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 154 | clut_param.clut = clut_data_resut; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 155 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 156 | rect.vs = 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 157 | rect.vw = VIDEO_PIXEL_VW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 158 | rect.hs = 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 159 | rect.hw = VIDEO_PIXEL_HW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 160 | Display.Graphics_Read_Setting( |
| RyoheiHagimoto | 0:b4c1e32627f2 | 161 | DisplayBase::GRAPHICS_LAYER_2, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 162 | (void *)fbuf_overlay, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 163 | FRAME_BUFFER_STRIDE, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 164 | DisplayBase::GRAPHICS_FORMAT_CLUT8, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 165 | DisplayBase::WR_RD_WRSWA_32_16_8BIT, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 166 | &rect, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 167 | &clut_param |
| RyoheiHagimoto | 0:b4c1e32627f2 | 168 | ); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 169 | Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_2); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 170 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 171 | ThisThread::sleep_for(50); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 172 | EasyAttach_LcdBacklight(true); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 173 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 174 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 175 | static void drp_task(void) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 176 | uint32_t idx; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 177 | uint32_t drp_time[8]; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 178 | char str[64]; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 179 | Timer t; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 180 | AsciiFont ascii_font(fbuf_overlay, VIDEO_PIXEL_HW, VIDEO_PIXEL_VW, FRAME_BUFFER_STRIDE, DATA_SIZE_PER_PIC); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 181 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 182 | EasyAttach_Init(Display); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 183 | Start_LCD_Display(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 184 | // Interrupt callback function setting (Field end signal for recording function in scaler 0) |
| RyoheiHagimoto | 0:b4c1e32627f2 | 185 | Display.Graphics_Irq_Handler_Set(DisplayBase::INT_TYPE_S0_VFIELD, 0, IntCallbackFunc_Vfield); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 186 | Start_Video_Camera(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 187 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 188 | #if RAM_TABLE_DYNAMIC_LOADING |
| RyoheiHagimoto | 0:b4c1e32627f2 | 189 | // Copy to RAM to increase the speed of dynamic loading. |
| RyoheiHagimoto | 0:b4c1e32627f2 | 190 | memcpy(ram_drp_lib_bayer2grayscale, g_drp_lib_bayer2grayscale, sizeof(ram_drp_lib_bayer2grayscale)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 191 | memcpy(ram_drp_lib_median_blur, g_drp_lib_median_blur, sizeof(ram_drp_lib_median_blur)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 192 | memcpy(ram_drp_lib_canny_calculate, g_drp_lib_canny_calculate, sizeof(ram_drp_lib_canny_calculate)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 193 | memcpy(ram_drp_lib_canny_hysterisis, g_drp_lib_canny_hysterisis, sizeof(ram_drp_lib_canny_hysterisis)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 194 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 195 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 196 | R_DK2_Initialize(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 197 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 198 | t.start(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 199 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 200 | while (true) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 201 | ThisThread::flags_wait_all(DRP_FLG_CAMER_IN); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 202 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 203 | /* Load DRP Library */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 204 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 205 | /* tile 0 | Bayer2Grayscale | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 206 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 207 | /* tile 1 | Bayer2Grayscale | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 208 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 209 | /* tile 2 | Bayer2Grayscale | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 210 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 211 | /* tile 3 | Bayer2Grayscale | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 212 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 213 | /* tile 4 | Bayer2Grayscale | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 214 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 215 | /* tile 5 | Bayer2Grayscale | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 216 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 217 | /* fbuf_bayer -> fbuf_work0 */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 218 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 219 | R_DK2_Load( |
| RyoheiHagimoto | 0:b4c1e32627f2 | 220 | #if RAM_TABLE_DYNAMIC_LOADING |
| RyoheiHagimoto | 0:b4c1e32627f2 | 221 | ram_drp_lib_bayer2grayscale, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 222 | #else |
| RyoheiHagimoto | 0:b4c1e32627f2 | 223 | g_drp_lib_bayer2grayscale, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 224 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 225 | R_DK2_TILE_0 | R_DK2_TILE_1 | R_DK2_TILE_2 | R_DK2_TILE_3 | R_DK2_TILE_4 | R_DK2_TILE_5, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 226 | R_DK2_TILE_PATTERN_1_1_1_1_1_1, NULL, &cb_drp_finish, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 227 | R_DK2_Activate(0, 0); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 228 | drp_time[0] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 229 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 230 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 231 | r_drp_bayer2grayscale_t * param_b2g = (r_drp_bayer2grayscale_t *)nc_memory; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 232 | for (idx = 0; idx < R_DK2_TILE_NUM; idx++) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 233 | param_b2g[idx].src = (uint32_t)fbuf_bayer + (VIDEO_PIXEL_HW * (VIDEO_PIXEL_VW / R_DK2_TILE_NUM) * idx); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 234 | param_b2g[idx].dst = (uint32_t)fbuf_work0 + (VIDEO_PIXEL_HW * (VIDEO_PIXEL_VW / R_DK2_TILE_NUM) * idx); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 235 | param_b2g[idx].width = VIDEO_PIXEL_HW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 236 | param_b2g[idx].height = VIDEO_PIXEL_VW / R_DK2_TILE_NUM; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 237 | param_b2g[idx].top = (idx == 0) ? 1 : 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 238 | param_b2g[idx].bottom = (idx == 5) ? 1 : 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 239 | R_DK2_Start(drp_lib_id[idx], (void *)¶m_b2g[idx], sizeof(r_drp_bayer2grayscale_t)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 240 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 241 | ThisThread::flags_wait_all(DRP_FLG_TILE_ALL); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 242 | R_DK2_Unload(0, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 243 | drp_time[1] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 244 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 245 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 246 | /* Load DRP Library */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 247 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 248 | /* tile 0 | MedianBlur | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 249 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 250 | /* tile 1 | MedianBlur | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 251 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 252 | /* tile 2 | MedianBlur | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 253 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 254 | /* tile 3 | MedianBlur | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 255 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 256 | /* tile 4 | MedianBlur | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 257 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 258 | /* tile 5 | MedianBlur | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 259 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 260 | /* fbuf_work0 -> fbuf_work1 */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 261 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 262 | R_DK2_Load( |
| RyoheiHagimoto | 0:b4c1e32627f2 | 263 | #if RAM_TABLE_DYNAMIC_LOADING |
| RyoheiHagimoto | 0:b4c1e32627f2 | 264 | ram_drp_lib_median_blur, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 265 | #else |
| RyoheiHagimoto | 0:b4c1e32627f2 | 266 | g_drp_lib_median_blur, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 267 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 268 | R_DK2_TILE_0 | R_DK2_TILE_1 | R_DK2_TILE_2 | R_DK2_TILE_3 | R_DK2_TILE_4 | R_DK2_TILE_5, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 269 | R_DK2_TILE_PATTERN_1_1_1_1_1_1, NULL, &cb_drp_finish, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 270 | R_DK2_Activate(0, 0); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 271 | drp_time[2] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 272 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 273 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 274 | r_drp_median_blur_t * param_median = (r_drp_median_blur_t *)nc_memory; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 275 | for (idx = 0; idx < R_DK2_TILE_NUM; idx++) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 276 | param_median[idx].src = (uint32_t)fbuf_work0 + (VIDEO_PIXEL_HW * (VIDEO_PIXEL_VW / R_DK2_TILE_NUM) * idx); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 277 | param_median[idx].dst = (uint32_t)fbuf_work1 + (VIDEO_PIXEL_HW * (VIDEO_PIXEL_VW / R_DK2_TILE_NUM) * idx); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 278 | param_median[idx].width = VIDEO_PIXEL_HW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 279 | param_median[idx].height = VIDEO_PIXEL_VW / R_DK2_TILE_NUM; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 280 | param_median[idx].top = (idx == 0) ? 1 : 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 281 | param_median[idx].bottom = (idx == 5) ? 1 : 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 282 | R_DK2_Start(drp_lib_id[idx], (void *)¶m_median[idx], sizeof(r_drp_median_blur_t)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 283 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 284 | ThisThread::flags_wait_all(DRP_FLG_TILE_ALL); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 285 | R_DK2_Unload(0, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 286 | drp_time[3] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 287 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 288 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 289 | /* Load DRP Library */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 290 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 291 | /* tile 0 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 292 | /* + CannyCalculate + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 293 | /* tile 1 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 294 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 295 | /* tile 2 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 296 | /* + CannyCalculate + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 297 | /* tile 3 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 298 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 299 | /* tile 4 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 300 | /* + CannyCalculate + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 301 | /* tile 5 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 302 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 303 | /* fbuf_work1 -> fbuf_work0 */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 304 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 305 | R_DK2_Load( |
| RyoheiHagimoto | 0:b4c1e32627f2 | 306 | #if RAM_TABLE_DYNAMIC_LOADING |
| RyoheiHagimoto | 0:b4c1e32627f2 | 307 | ram_drp_lib_canny_calculate, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 308 | #else |
| RyoheiHagimoto | 0:b4c1e32627f2 | 309 | g_drp_lib_canny_calculate, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 310 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 311 | R_DK2_TILE_0 | R_DK2_TILE_2 | R_DK2_TILE_4, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 312 | R_DK2_TILE_PATTERN_2_2_2, NULL, &cb_drp_finish, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 313 | R_DK2_Activate(0, 0); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 314 | drp_time[4] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 315 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 316 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 317 | r_drp_canny_calculate_t * param_canny_cal = (r_drp_canny_calculate_t *)nc_memory; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 318 | for (idx = 0; idx < 3; idx++) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 319 | param_canny_cal[idx].src = (uint32_t)fbuf_work1 + (VIDEO_PIXEL_HW * (VIDEO_PIXEL_VW / 3) * idx); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 320 | param_canny_cal[idx].dst = (uint32_t)fbuf_work0 + (VIDEO_PIXEL_HW * (VIDEO_PIXEL_VW / 3) * idx); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 321 | param_canny_cal[idx].width = VIDEO_PIXEL_HW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 322 | param_canny_cal[idx].height = (VIDEO_PIXEL_VW / 3); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 323 | param_canny_cal[idx].top = ((idx * 2) == 0) ? 1 : 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 324 | param_canny_cal[idx].bottom = ((idx * 2) == 4) ? 1 : 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 325 | param_canny_cal[idx].work = (uint32_t)&drp_work_buf[((VIDEO_PIXEL_HW * ((VIDEO_PIXEL_VW / 3) + 2)) * 2) * idx]; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 326 | param_canny_cal[idx].threshold_high = 0x28; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 327 | param_canny_cal[idx].threshold_low = 0x18; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 328 | R_DK2_Start(drp_lib_id[(idx * 2)], (void *)¶m_canny_cal[idx], sizeof(r_drp_canny_calculate_t)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 329 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 330 | ThisThread::flags_wait_all(DRP_FLG_TILE_ALL); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 331 | R_DK2_Unload(0, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 332 | drp_time[5] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 333 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 334 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 335 | /* Load DRP Library */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 336 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 337 | /* tile 0 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 338 | /* + + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 339 | /* tile 1 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 340 | /* + + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 341 | /* tile 2 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 342 | /* + CannyHysterisis + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 343 | /* tile 3 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 344 | /* + + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 345 | /* tile 4 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 346 | /* + + */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 347 | /* tile 5 | | */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 348 | /* +------------------+ */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 349 | /* fbuf_work0 -> fbuf_clat8 */ |
| RyoheiHagimoto | 0:b4c1e32627f2 | 350 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 351 | R_DK2_Load( |
| RyoheiHagimoto | 0:b4c1e32627f2 | 352 | #if RAM_TABLE_DYNAMIC_LOADING |
| RyoheiHagimoto | 0:b4c1e32627f2 | 353 | ram_drp_lib_canny_hysterisis, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 354 | #else |
| RyoheiHagimoto | 0:b4c1e32627f2 | 355 | g_drp_lib_canny_hysterisis, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 356 | #endif |
| RyoheiHagimoto | 0:b4c1e32627f2 | 357 | R_DK2_TILE_0, |
| RyoheiHagimoto | 0:b4c1e32627f2 | 358 | R_DK2_TILE_PATTERN_6, NULL, &cb_drp_finish, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 359 | R_DK2_Activate(0, 0); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 360 | drp_time[6] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 361 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 362 | t.reset(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 363 | r_drp_canny_hysterisis_t * param_canny_hyst = (r_drp_canny_hysterisis_t *)nc_memory; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 364 | param_canny_hyst[0].src = (uint32_t)fbuf_work0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 365 | param_canny_hyst[0].dst = (uint32_t)fbuf_clat8; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 366 | param_canny_hyst[0].width = VIDEO_PIXEL_HW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 367 | param_canny_hyst[0].height = VIDEO_PIXEL_VW; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 368 | param_canny_hyst[0].work = (uint32_t)drp_work_buf; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 369 | param_canny_hyst[0].iterations = 2; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 370 | R_DK2_Start(drp_lib_id[0], (void *)¶m_canny_hyst[0], sizeof(r_drp_canny_hysterisis_t)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 371 | ThisThread::flags_wait_all(DRP_FLG_TILE_ALL); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 372 | R_DK2_Unload(0, drp_lib_id); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 373 | drp_time[7] = t.read_us(); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 374 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 375 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 376 | // Display DRP time |
| RyoheiHagimoto | 0:b4c1e32627f2 | 377 | sprintf(str, "Bayer2Grayscale : Load %2.1fms + Run %2.1fms", |
| RyoheiHagimoto | 0:b4c1e32627f2 | 378 | (float_t)drp_time[0] / 1000, (float_t)drp_time[1] / 1000); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 379 | ascii_font.DrawStr(str, 5, 5 + (AsciiFont::CHAR_PIX_HEIGHT + 1) * 0, 1, 2); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 380 | sprintf(str, "MedianBlur : Load %2.1fms + Run %2.1fms", |
| RyoheiHagimoto | 0:b4c1e32627f2 | 381 | (float_t)drp_time[2] / 1000, (float_t)drp_time[3] / 1000); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 382 | ascii_font.DrawStr(str, 5, 5 + (AsciiFont::CHAR_PIX_HEIGHT + 1) * 2, 1, 2); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 383 | sprintf(str, "CannyCalculate : Load %2.1fms + Run %2.1fms", |
| RyoheiHagimoto | 0:b4c1e32627f2 | 384 | (float_t)drp_time[4] / 1000, (float_t)drp_time[5] / 1000); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 385 | ascii_font.DrawStr(str, 5, 5 + (AsciiFont::CHAR_PIX_HEIGHT + 1) * 4, 1, 2); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 386 | sprintf(str, "CannyHysterisis : Load %2.1fms + Run %2.1fms", |
| RyoheiHagimoto | 0:b4c1e32627f2 | 387 | (float_t)drp_time[6] / 1000, (float_t)drp_time[7] / 1000); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 388 | ascii_font.DrawStr(str, 5, 5 + (AsciiFont::CHAR_PIX_HEIGHT + 1) * 6, 1, 2); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 389 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 390 | uint32_t time_sum = 0; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 391 | for (int i = 0; i < 8; i++) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 392 | time_sum += drp_time[i]; |
| RyoheiHagimoto | 0:b4c1e32627f2 | 393 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 394 | sprintf(str, "Total : %2.1fms", (float_t)time_sum / 1000); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 395 | ascii_font.DrawStr(str, 5, 5 + (AsciiFont::CHAR_PIX_HEIGHT + 1) * 8, 1, 2); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 396 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 397 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 398 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 399 | int main(void) { |
| RyoheiHagimoto | 0:b4c1e32627f2 | 400 | // Start DRP task |
| RyoheiHagimoto | 0:b4c1e32627f2 | 401 | drpTask.start(callback(drp_task)); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 402 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 403 | ThisThread::sleep_for(osWaitForever); |
| RyoheiHagimoto | 0:b4c1e32627f2 | 404 | } |
| RyoheiHagimoto | 0:b4c1e32627f2 | 405 | |
| RyoheiHagimoto | 0:b4c1e32627f2 | 406 | #endif |