ref: f00a435587022e07764166b6efee6cf1aead7fed
parent: eeb7150b0e4ee24bdbf8c351ea2ffe481510f5f7
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue Jun 16 07:10:58 EDT 2015
clang-format: demos/chibios/common
--- a/demos/chibios/common/sdc_lwext4.c
+++ b/demos/chibios/common/sdc_lwext4.c
@@ -42,26 +42,28 @@
#include "timings.h"
/**@brief Block size.*/
-#define SDC_BLOCK_SIZE 512
+#define SDC_BLOCK_SIZE 512
/**@brief MBR_block ID*/
-#define MBR_BLOCK_ID 0
-#define MBR_PART_TABLE_OFF 446
+#define MBR_BLOCK_ID 0
+#define MBR_PART_TABLE_OFF 446
-struct part_tab_entry {
- uint8_t status;
- uint8_t chs1[3];
- uint8_t type;
- uint8_t chs2[3];
+struct part_tab_entry
+{
+ uint8_t status;
+ uint8_t chs1[3];
+ uint8_t type;
+ uint8_t chs2[3];
uint32_t first_lba;
uint32_t sectors;
-}__attribute__((packed));
+} __attribute__((packed));
/**@brief Partition block offset*/
static uint32_t part_offset;
/**@brief IO timings*/
-struct sdc_io_timings {
+struct sdc_io_timings
+{
uint64_t acc_bread;
uint64_t acc_bwrite;
@@ -79,7 +81,7 @@
memset(&io_timings, 0, sizeof(struct sdc_io_timings));
}
-const struct ext4_io_stats * io_timings_get(uint32_t time_sum_ms)
+const struct ext4_io_stats *io_timings_get(uint32_t time_sum_ms)
{
static struct ext4_io_stats s;
@@ -86,7 +88,7 @@
s.io_read = (((float)io_timings.acc_bread * 100.0) / time_sum_ms);
s.io_read /= 1000.0;
- s.io_write= (((float)io_timings.acc_bwrite * 100.0) / time_sum_ms);
+ s.io_write = (((float)io_timings.acc_bwrite * 100.0) / time_sum_ms);
s.io_write /= 1000.0;
s.cpu = 100.0 - s.io_read - s.io_write;
@@ -94,29 +96,21 @@
return &s;
}
-
/**********************BLOCKDEV INTERFACE**************************************/
static int sdc_open(struct ext4_blockdev *bdev);
static int sdc_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
- uint32_t blk_cnt);
+ uint32_t blk_cnt);
static int sdc_bwrite(struct ext4_blockdev *bdev, const void *buf,
- uint64_t blk_id, uint32_t blk_cnt);
-static int sdc_close(struct ext4_blockdev *bdev);
+ uint64_t blk_id, uint32_t blk_cnt);
+static int sdc_close(struct ext4_blockdev *bdev);
-
/******************************************************************************/
-EXT4_BLOCKDEV_STATIC_INSTANCE(
- _sdc,
- SDC_BLOCK_SIZE,
- 0,
- sdc_open,
- sdc_bread,
- sdc_bwrite,
- sdc_close
-);
+EXT4_BLOCKDEV_STATIC_INSTANCE(_sdc, SDC_BLOCK_SIZE, 0, sdc_open, sdc_bread,
+ sdc_bwrite, sdc_close);
/******************************************************************************/
-EXT4_BCACHE_STATIC_INSTANCE(_sdc_cache, CONFIG_BLOCK_DEV_CACHE_SIZE, EXT_LOGICAL_BLOCK_SIZE);
+EXT4_BCACHE_STATIC_INSTANCE(_sdc_cache, CONFIG_BLOCK_DEV_CACHE_SIZE,
+ EXT_LOGICAL_BLOCK_SIZE);
/******************************************************************************/
@@ -132,13 +126,11 @@
if (sdcConnect(&SDCD1) != HAL_SUCCESS)
return EIO;
-
if (sdcRead(&SDCD1, 0, mbr, 1) != HAL_SUCCESS)
return EIO;
part0 = (struct part_tab_entry *)(mbr + MBR_PART_TABLE_OFF);
-
part_offset = part0->first_lba;
_sdc.ph_bcnt = SDCD1.capacity * SDC_BLOCK_SIZE;
@@ -146,7 +138,7 @@
}
static int sdc_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
- uint32_t blk_cnt)
+ uint32_t blk_cnt)
{
(void)bdev;
bool status;
@@ -153,7 +145,7 @@
uint64_t v = tim_get_us();
status = sdcRead(&SDCD1, blk_id, buf, blk_cnt);
- if(status != HAL_SUCCESS)
+ if (status != HAL_SUCCESS)
return EIO;
io_timings.acc_bread += tim_get_us() - v;
@@ -161,11 +153,10 @@
io_timings.av_bread = io_timings.acc_bread / io_timings.cnt_bread;
return EOK;
-
}
static int sdc_bwrite(struct ext4_blockdev *bdev, const void *buf,
- uint64_t blk_id, uint32_t blk_cnt)
+ uint64_t blk_id, uint32_t blk_cnt)
{
(void)bdev;
bool status;
@@ -172,7 +163,7 @@
uint64_t v = tim_get_us();
status = sdcWrite(&SDCD1, blk_id, buf, blk_cnt);
- if(status != HAL_SUCCESS)
+ if (status != HAL_SUCCESS)
return EIO;
io_timings.acc_bwrite += tim_get_us() - v;
@@ -182,7 +173,7 @@
return EOK;
}
-static int sdc_close(struct ext4_blockdev *bdev)
+static int sdc_close(struct ext4_blockdev *bdev)
{
(void)bdev;
return EOK;
@@ -190,14 +181,6 @@
/******************************************************************************/
-struct ext4_bcache* sdc_cache_get(void)
-{
- return &_sdc_cache;
-}
+struct ext4_bcache *sdc_cache_get(void) { return &_sdc_cache; }
-
-struct ext4_blockdev* sdc_bdev_get(void)
-{
- return &_sdc;
-}
-
+struct ext4_blockdev *sdc_bdev_get(void) { return &_sdc; }
--- a/demos/chibios/common/sdc_lwext4.h
+++ b/demos/chibios/common/sdc_lwext4.h
@@ -36,12 +36,13 @@
#include <stdbool.h>
/**@brief SDC cache get.*/
-struct ext4_bcache* sdc_cache_get(void);
+struct ext4_bcache *sdc_cache_get(void);
/**@brief SDC blockdev get.*/
-struct ext4_blockdev* sdc_bdev_get(void);
+struct ext4_blockdev *sdc_bdev_get(void);
-struct ext4_io_stats {
+struct ext4_io_stats
+{
float io_read;
float io_write;
float cpu;
@@ -48,6 +49,6 @@
};
void io_timings_clear(void);
-const struct ext4_io_stats * io_timings_get(uint32_t time_sum_ms);
+const struct ext4_io_stats *io_timings_get(uint32_t time_sum_ms);
#endif /* CHIBI_SDC_LWEXT4_H_ */
--- a/demos/chibios/common/spi_lwext4.c
+++ b/demos/chibios/common/spi_lwext4.c
@@ -46,26 +46,28 @@
#endif
/**@brief Block size.*/
-#define SPI_BLOCK_SIZE 512
+#define SPI_BLOCK_SIZE 512
/**@brief MBR_block ID*/
-#define MBR_BLOCK_ID 0
-#define MBR_PART_TABLE_OFF 446
+#define MBR_BLOCK_ID 0
+#define MBR_PART_TABLE_OFF 446
-struct part_tab_entry {
- uint8_t status;
- uint8_t chs1[3];
- uint8_t type;
- uint8_t chs2[3];
+struct part_tab_entry
+{
+ uint8_t status;
+ uint8_t chs1[3];
+ uint8_t type;
+ uint8_t chs2[3];
uint32_t first_lba;
uint32_t sectors;
-}__attribute__((packed));
+} __attribute__((packed));
/**@brief Partition block offset*/
static uint32_t part_offset;
/**@brief IO timings*/
-struct spi_io_timings {
+struct spi_io_timings
+{
uint64_t acc_bread;
uint64_t acc_bwrite;
@@ -83,7 +85,7 @@
memset(&io_timings, 0, sizeof(struct spi_io_timings));
}
-const struct ext4_io_stats * io_timings_get(uint32_t time_sum_ms)
+const struct ext4_io_stats *io_timings_get(uint32_t time_sum_ms)
{
static struct ext4_io_stats s;
@@ -90,7 +92,7 @@
s.io_read = (((float)io_timings.acc_bread * 100.0) / time_sum_ms);
s.io_read /= 1000.0;
- s.io_write= (((float)io_timings.acc_bwrite * 100.0) / time_sum_ms);
+ s.io_write = (((float)io_timings.acc_bwrite * 100.0) / time_sum_ms);
s.io_write /= 1000.0;
s.cpu = 100.0 - s.io_read - s.io_write;
@@ -98,29 +100,21 @@
return &s;
}
-
/**********************BLOCKDEV INTERFACE**************************************/
static int spi_open(struct ext4_blockdev *bdev);
static int spi_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
- uint32_t blk_cnt);
+ uint32_t blk_cnt);
static int spi_bwrite(struct ext4_blockdev *bdev, const void *buf,
- uint64_t blk_id, uint32_t blk_cnt);
-static int spi_close(struct ext4_blockdev *bdev);
+ uint64_t blk_id, uint32_t blk_cnt);
+static int spi_close(struct ext4_blockdev *bdev);
-
/******************************************************************************/
-EXT4_BLOCKDEV_STATIC_INSTANCE(
- _spi,
- SPI_BLOCK_SIZE,
- 0,
- spi_open,
- spi_bread,
- spi_bwrite,
- spi_close
-);
+EXT4_BLOCKDEV_STATIC_INSTANCE(_spi, SPI_BLOCK_SIZE, 0, spi_open, spi_bread,
+ spi_bwrite, spi_close);
/******************************************************************************/
-EXT4_BCACHE_STATIC_INSTANCE(_spi_cache, CONFIG_BLOCK_DEV_CACHE_SIZE, EXT_LOGICAL_BLOCK_SIZE);
+EXT4_BCACHE_STATIC_INSTANCE(_spi_cache, CONFIG_BLOCK_DEV_CACHE_SIZE,
+ EXT_LOGICAL_BLOCK_SIZE);
/******************************************************************************/
@@ -127,8 +121,6 @@
static int spi_open(struct ext4_blockdev *bdev)
{
-
-
(void)bdev;
static uint8_t mbr[512];
@@ -148,7 +140,6 @@
part0 = (struct part_tab_entry *)(mbr + MBR_PART_TABLE_OFF);
-
part_offset = part0->first_lba;
_spi.ph_bcnt = MMCD1.capacity * SPI_BLOCK_SIZE;
@@ -156,7 +147,7 @@
}
static int spi_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
- uint32_t blk_cnt)
+ uint32_t blk_cnt)
{
(void)bdev;
uint64_t v = tim_get_us();
@@ -164,7 +155,7 @@
if (mmcStartSequentialRead(&MMCD1, blk_id) != HAL_SUCCESS)
return EIO;
- while(blk_cnt){
+ while (blk_cnt) {
if (mmcSequentialRead(&MMCD1, buf) != HAL_SUCCESS)
return EIO;
@@ -180,11 +171,10 @@
io_timings.av_bread = io_timings.acc_bread / io_timings.cnt_bread;
return EOK;
-
}
static int spi_bwrite(struct ext4_blockdev *bdev, const void *buf,
- uint64_t blk_id, uint32_t blk_cnt)
+ uint64_t blk_id, uint32_t blk_cnt)
{
(void)bdev;
uint64_t v = tim_get_us();
@@ -192,7 +182,7 @@
if (mmcStartSequentialWrite(&MMCD1, blk_id) != HAL_SUCCESS)
return EIO;
- while(blk_cnt){
+ while (blk_cnt) {
if (mmcSequentialWrite(&MMCD1, buf) != HAL_SUCCESS)
return EIO;
@@ -210,7 +200,7 @@
return EOK;
}
-static int spi_close(struct ext4_blockdev *bdev)
+static int spi_close(struct ext4_blockdev *bdev)
{
(void)bdev;
return EOK;
@@ -218,14 +208,6 @@
/******************************************************************************/
-struct ext4_bcache* spi_cache_get(void)
-{
- return &_spi_cache;
-}
+struct ext4_bcache *spi_cache_get(void) { return &_spi_cache; }
-
-struct ext4_blockdev* spi_bdev_get(void)
-{
- return &_spi;
-}
-
+struct ext4_blockdev *spi_bdev_get(void) { return &_spi; }
--- a/demos/chibios/common/spi_lwext4.h
+++ b/demos/chibios/common/spi_lwext4.h
@@ -16,12 +16,13 @@
#include <stdbool.h>
/**@brief SPI cache get.*/
-struct ext4_bcache* spi_cache_get(void);
+struct ext4_bcache *spi_cache_get(void);
/**@brief SPI blockdev get.*/
-struct ext4_blockdev* spi_bdev_get(void);
+struct ext4_blockdev *spi_bdev_get(void);
-struct ext4_io_stats {
+struct ext4_io_stats
+{
float io_read;
float io_write;
float cpu;
@@ -28,7 +29,6 @@
};
void io_timings_clear(void);
-const struct ext4_io_stats * io_timings_get(uint32_t time_sum_ms);
-
+const struct ext4_io_stats *io_timings_get(uint32_t time_sum_ms);
#endif /* SPI_LWEXT4_H_ */
--- a/demos/chibios/common/test_lwext4.c
+++ b/demos/chibios/common/test_lwext4.c
@@ -37,7 +37,6 @@
#include "timings.h"
#include "test_lwext4.h"
-
/**@brief Read-write size*/
#define READ_MAX_WRITE_SZIZE 1024 * 8
@@ -48,12 +47,11 @@
static struct ext4_blockdev *bd;
/**@brief Block cache handle.*/
-static struct ext4_bcache *bc;
+static struct ext4_bcache *bc;
-
-static char* entry_to_str(uint8_t type)
+static char *entry_to_str(uint8_t type)
{
- switch(type){
+ switch (type) {
case EXT4_DIRENTRY_UNKNOWN:
return "[unk] ";
case EXT4_DIRENTRY_REG_FILE:
@@ -76,10 +74,7 @@
return "[???]";
}
-static clock_t get_ms(void)
-{
- return tim_get_ms();
-}
+static clock_t get_ms(void) { return tim_get_ms(); }
static void printf_io_timings(clock_t diff)
{
@@ -101,7 +96,7 @@
ext4_dir_open(&d, path);
de = ext4_dir_entry_next(&d);
- while(de){
+ while (de) {
memcpy(sss, de->name, de->name_length);
sss[de->name_length] = 0;
printf(" %s%s\n", entry_to_str(de->inode_type), sss);
@@ -117,14 +112,15 @@
printf("********************\n");
printf("ext4_mount_point_stats\n");
- printf("inodes_count = %"PRIu32"\n", stats.inodes_count);
- printf("free_inodes_count = %"PRIu32"\n", stats.free_inodes_count);
- printf("blocks_count = %"PRIu32"\n", (uint32_t)stats.blocks_count);
- printf("free_blocks_count = %"PRIu32"\n", (uint32_t)stats.free_blocks_count);
- printf("block_size = %"PRIu32"\n", stats.block_size);
- printf("block_group_count = %"PRIu32"\n", stats.block_group_count);
- printf("blocks_per_group= %"PRIu32"\n", stats.blocks_per_group);
- printf("inodes_per_group = %"PRIu32"\n", stats.inodes_per_group);
+ printf("inodes_count = %" PRIu32 "\n", stats.inodes_count);
+ printf("free_inodes_count = %" PRIu32 "\n", stats.free_inodes_count);
+ printf("blocks_count = %" PRIu32 "\n", (uint32_t)stats.blocks_count);
+ printf("free_blocks_count = %" PRIu32 "\n",
+ (uint32_t)stats.free_blocks_count);
+ printf("block_size = %" PRIu32 "\n", stats.block_size);
+ printf("block_group_count = %" PRIu32 "\n", stats.block_group_count);
+ printf("blocks_per_group= %" PRIu32 "\n", stats.blocks_per_group);
+ printf("inodes_per_group = %" PRIu32 "\n", stats.inodes_per_group);
printf("volume_name = %s\n", stats.volume_name);
printf("********************\n");
}
@@ -131,41 +127,39 @@
void test_lwext4_block_stats(void)
{
- if(!bd)
+ if (!bd)
return;
printf("********************\n");
printf("ext4 blockdev stats\n");
- printf("bdev->bread_ctr = %"PRIu32"\n", bd->bread_ctr);
- printf("bdev->bwrite_ctr = %"PRIu32"\n", bd->bwrite_ctr);
+ printf("bdev->bread_ctr = %" PRIu32 "\n", bd->bread_ctr);
+ printf("bdev->bwrite_ctr = %" PRIu32 "\n", bd->bwrite_ctr);
- printf("bcache->ref_blocks = %"PRIu32"\n", bc->ref_blocks);
- printf("bcache->max_ref_blocks = %"PRIu32"\n", bc->max_ref_blocks);
- printf("bcache->lru_ctr = %"PRIu32"\n", bc->lru_ctr);
+ printf("bcache->ref_blocks = %" PRIu32 "\n", bc->ref_blocks);
+ printf("bcache->max_ref_blocks = %" PRIu32 "\n", bc->max_ref_blocks);
+ printf("bcache->lru_ctr = %" PRIu32 "\n", bc->lru_ctr);
printf("\n");
uint32_t i;
for (i = 0; i < bc->cnt; ++i) {
- printf("bcache->refctr[%"PRIu32"]= %"PRIu32"\n",
- i, bc->refctr[i]);
+ printf("bcache->refctr[%" PRIu32 "]= %" PRIu32 "\n", i, bc->refctr[i]);
}
printf("\n");
for (i = 0; i < bc->cnt; ++i) {
- printf("bcache->lru_id[%"PRIu32"] = %"PRIu32"\n",
- i, bc->lru_id[i]);
+ printf("bcache->lru_id[%" PRIu32 "] = %" PRIu32 "\n", i, bc->lru_id[i]);
}
printf("\n");
for (i = 0; i < bc->cnt; ++i) {
- printf("bcache->free_delay[%"PRIu32"] = %d\n",
- i, bc->free_delay[i]);
+ printf("bcache->free_delay[%" PRIu32 "] = %d\n", i, bc->free_delay[i]);
}
printf("\n");
for (i = 0; i < bc->cnt; ++i) {
- printf("bcache->lba[%"PRIu32"] = %"PRIu32"\n", i, (uint32_t)bc->lba[i]);
+ printf("bcache->lba[%" PRIu32 "] = %" PRIu32 "\n", i,
+ (uint32_t)bc->lba[i]);
}
printf("********************\n");
@@ -174,8 +168,8 @@
bool test_lwext4_dir_test(int len)
{
ext4_file f;
- int r;
- int i;
+ int r;
+ int i;
char path[64];
clock_t diff;
clock_t stop;
@@ -187,7 +181,7 @@
printf("directory create: /mp/dir1\n");
r = ext4_dir_mk("/mp/dir1");
- if(r != EOK){
+ if (r != EOK) {
printf("ext4_dir_mk: rc = %d\n", r);
return false;
}
@@ -196,13 +190,13 @@
for (i = 0; i < len; ++i) {
sprintf(path, "/mp/dir1/f%d", i);
r = ext4_fopen(&f, path, "wb");
- if(r != EOK){
+ if (r != EOK) {
printf("ext4_fopen: rc = %d\n", r);
return false;
}
}
- stop = get_ms();
+ stop = get_ms();
diff = stop - start;
test_lwext4_dir_ls("/mp/dir1");
printf("test_lwext4_dir_test: time: %d ms\n", (int)diff);
@@ -211,12 +205,11 @@
return true;
}
-static int verify_buf(const unsigned char *b, size_t len,
- unsigned char c)
+static int verify_buf(const unsigned char *b, size_t len, unsigned char c)
{
size_t i;
for (i = 0; i < len; ++i) {
- if(b[i] != c)
+ if (b[i] != c)
return c - b[i];
}
@@ -226,7 +219,7 @@
bool test_lwext4_file_test(uint32_t rw_szie, uint32_t rw_count)
{
int r;
- uint32_t size;
+ uint32_t size;
uint32_t i;
clock_t start;
clock_t stop;
@@ -237,8 +230,8 @@
ext4_file f;
printf("file_test:\n");
- printf(" rw size: %"PRIu32"\n", rw_szie);
- printf(" rw count: %"PRIu32"\n", rw_count);
+ printf(" rw size: %" PRIu32 "\n", rw_szie);
+ printf(" rw count: %" PRIu32 "\n", rw_count);
/*Add hello world file.*/
r = ext4_fopen(&f, "/mp/hello.txt", "wb");
@@ -245,16 +238,15 @@
r = ext4_fwrite(&f, "Hello World !\n", strlen("Hello World !\n"), 0);
r = ext4_fclose(&f);
-
io_timings_clear();
start = get_ms();
r = ext4_fopen(&f, "/mp/test1", "wb");
- if(r != EOK){
+ if (r != EOK) {
printf("ext4_fopen ERROR = %d\n", r);
return false;
}
- printf("ext4_write: %"PRIu32" * %"PRIu32" ...\n" , rw_szie, rw_count);
+ printf("ext4_write: %" PRIu32 " * %" PRIu32 " ...\n", rw_szie, rw_count);
for (i = 0; i < rw_count; ++i) {
memset(rw_buff, i % 10 + '0', rw_szie);
@@ -261,12 +253,12 @@
r = ext4_fwrite(&f, rw_buff, rw_szie, &size);
- if((r != EOK) || (size != rw_szie))
+ if ((r != EOK) || (size != rw_szie))
break;
}
- if(i != rw_count){
- printf(" file_test: rw_count = %"PRIu32"\n", i);
+ if (i != rw_count) {
+ printf(" file_test: rw_count = %" PRIu32 "\n", i);
return false;
}
@@ -276,33 +268,32 @@
size_bytes = (size_bytes * 1000) / 1024;
kbps = (size_bytes) / (diff + 1);
printf(" write time: %d ms\n", (int)diff);
- printf(" write speed: %"PRIu32" KB/s\n", kbps);
+ printf(" write speed: %" PRIu32 " KB/s\n", kbps);
printf_io_timings(diff);
r = ext4_fclose(&f);
-
io_timings_clear();
start = get_ms();
r = ext4_fopen(&f, "/mp/test1", "r+");
- if(r != EOK){
+ if (r != EOK) {
printf("ext4_fopen ERROR = %d\n", r);
return false;
}
- printf("ext4_read: %"PRIu32" * %"PRIu32" ...\n" , rw_szie, rw_count);
+ printf("ext4_read: %" PRIu32 " * %" PRIu32 " ...\n", rw_szie, rw_count);
for (i = 0; i < rw_count; ++i) {
r = ext4_fread(&f, rw_buff, rw_szie, &size);
- if((r != EOK) || (size != rw_szie))
+ if ((r != EOK) || (size != rw_szie))
break;
- if(verify_buf(rw_buff, rw_szie, i % 10 + '0'))
+ if (verify_buf(rw_buff, rw_szie, i % 10 + '0'))
break;
}
- if(i != rw_count){
- printf(" file_test: rw_count = %"PRIu32"\n", i);
+ if (i != rw_count) {
+ printf(" file_test: rw_count = %" PRIu32 "\n", i);
return false;
}
@@ -317,7 +308,6 @@
r = ext4_fclose(&f);
return true;
-
}
void test_lwext4_cleanup(void)
{
@@ -331,7 +321,6 @@
printf("remove /mp/test1\n");
ext4_fremove("/mp/test1");
-
printf("remove /mp/dir1\n");
io_timings_clear();
start = get_ms();
@@ -342,9 +331,7 @@
printf_io_timings(diff);
}
-
-bool test_lwext4_mount(struct ext4_blockdev *bdev,
- struct ext4_bcache *bcache)
+bool test_lwext4_mount(struct ext4_blockdev *bdev, struct ext4_bcache *bcache)
{
int r;
@@ -351,7 +338,7 @@
bc = bcache;
bd = bdev;
- if(!bd){
+ if (!bd) {
printf("test_lwext4_mount: no block device\n");
return false;
}
@@ -359,13 +346,13 @@
ext4_dmask_set(EXT4_DEBUG_ALL);
r = ext4_device_register(bd, bc ? bc : 0, "ext4_fs");
- if(r != EOK){
+ if (r != EOK) {
printf("ext4_device_register: rc = %d\n", r);
return false;
}
r = ext4_mount("ext4_fs", "/mp/");
- if(r != EOK){
+ if (r != EOK) {
printf("ext4_mount: rc = %d\n", r);
return false;
}
@@ -378,12 +365,9 @@
{
ext4_cache_write_back("/mp/", 0);
int r = ext4_umount("/mp/");
- if(r != EOK){
+ if (r != EOK) {
printf("ext4_umount: fail %d", r);
return false;
}
return true;
}
-
-
-
--- a/demos/chibios/common/test_lwext4.h
+++ b/demos/chibios/common/test_lwext4.h
@@ -40,9 +40,7 @@
bool test_lwext4_file_test(uint32_t rw_szie, uint32_t rw_count);
void test_lwext4_cleanup(void);
-bool test_lwext4_mount(struct ext4_blockdev *bdev,
- struct ext4_bcache *bcache);
+bool test_lwext4_mount(struct ext4_blockdev *bdev, struct ext4_bcache *bcache);
bool test_lwext4_umount(void);
-
#endif /* TEST_LWEXT4_H_ */
--- a/demos/chibios/common/timings.c
+++ b/demos/chibios/common/timings.c
@@ -33,12 +33,8 @@
#include "timings.h"
+void tim_wait_ms(uint32_t v) { chThdSleepMilliseconds(v); }
-void tim_wait_ms(uint32_t v)
-{
- chThdSleepMilliseconds(v);
-}
-
uint64_t tim_get_us(void)
{
uint64_t v = chVTGetSystemTimeX();
@@ -50,5 +46,3 @@
uint32_t v = chVTGetSystemTimeX();
return ST2MS(v);
}
-
-
--- a/demos/chibios/common/timings.h
+++ b/demos/chibios/common/timings.h
@@ -36,5 +36,4 @@
uint32_t tim_get_ms(void);
uint64_t tim_get_us(void);
-
#endif /* TIMINGS_H_ */