project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
131 lines
2.8 KiB
C
131 lines
2.8 KiB
C
/*
|
|
* File : writespeed.c
|
|
* This file is part of RT-TestCase in RT-Thread RTOS
|
|
* COPYRIGHT (C) 2010, RT-Thread Development Team
|
|
*
|
|
* The license and distribution terms for this file may be
|
|
* found in the file LICENSE in this distribution or at
|
|
* http://www.rt-thread.org/license/LICENSE
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2010-02-10 Bernard first version
|
|
*/
|
|
#include <rtthread.h>
|
|
#include <dfs_posix.h>
|
|
|
|
void ranw_speed(const char* filename, int total_length, int block_size)
|
|
{
|
|
int fd, index, length;
|
|
char *buff_ptr;
|
|
rt_tick_t tick;
|
|
|
|
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0);
|
|
if (fd < 0)
|
|
{
|
|
rt_kprintf("open file:%s failed\n", filename);
|
|
return;
|
|
}
|
|
|
|
buff_ptr = rt_malloc(block_size);
|
|
if (buff_ptr == RT_NULL)
|
|
{
|
|
rt_kprintf("no memory\n");
|
|
close(fd);
|
|
|
|
return;
|
|
}
|
|
|
|
/* prepare write data */
|
|
for (index = 0; index < block_size; index++)
|
|
{
|
|
buff_ptr[index] = index;
|
|
}
|
|
index = 0;
|
|
|
|
/* get the beginning tick */
|
|
tick = rt_tick_get();
|
|
while (index < total_length / block_size)
|
|
{
|
|
lseek(fd, rand() % (total_length - block_size), SEEK_SET);
|
|
length = write(fd, buff_ptr, block_size);
|
|
if (length != block_size)
|
|
{
|
|
rt_kprintf("write failed\n");
|
|
break;
|
|
}
|
|
|
|
index ++;
|
|
}
|
|
tick = rt_tick_get() - tick;
|
|
|
|
/* close file and release memory */
|
|
close(fd);
|
|
rt_free(buff_ptr);
|
|
|
|
/* calculate write speed */
|
|
rt_kprintf("File write speed: %d byte/s\n", total_length / tick * RT_TICK_PER_SECOND);
|
|
}
|
|
|
|
#ifdef RT_USING_FINSH
|
|
#include <finsh.h>
|
|
FINSH_FUNCTION_EXPORT(ranw_speed, perform file write test);
|
|
#endif
|
|
|
|
void seqw_speed(const char* filename, int total_length, int block_size)
|
|
{
|
|
int fd, index, length;
|
|
char *buff_ptr;
|
|
rt_tick_t tick;
|
|
|
|
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0);
|
|
if (fd < 0)
|
|
{
|
|
rt_kprintf("open file:%s failed\n", filename);
|
|
return;
|
|
}
|
|
|
|
buff_ptr = rt_malloc(block_size);
|
|
if (buff_ptr == RT_NULL)
|
|
{
|
|
rt_kprintf("no memory\n");
|
|
close(fd);
|
|
|
|
return;
|
|
}
|
|
|
|
/* prepare write data */
|
|
for (index = 0; index < block_size; index++)
|
|
{
|
|
buff_ptr[index] = index;
|
|
}
|
|
index = 0;
|
|
|
|
/* get the beginning tick */
|
|
tick = rt_tick_get();
|
|
while (index < total_length / block_size)
|
|
{
|
|
length = write(fd, buff_ptr, block_size);
|
|
if (length != block_size)
|
|
{
|
|
rt_kprintf("write failed\n");
|
|
break;
|
|
}
|
|
|
|
index ++;
|
|
}
|
|
tick = rt_tick_get() - tick;
|
|
|
|
/* close file and release memory */
|
|
close(fd);
|
|
rt_free(buff_ptr);
|
|
|
|
/* calculate write speed */
|
|
rt_kprintf("File write speed: %d byte/s\n", total_length / tick * RT_TICK_PER_SECOND);
|
|
}
|
|
|
|
#ifdef RT_USING_FINSH
|
|
#include <finsh.h>
|
|
FINSH_FUNCTION_EXPORT(seqw_speed, perform file write test);
|
|
#endif
|