shithub: lwext4

Download patch

ref: ac6fcab1c1a68360b188db76c3f6674e2adee3d7
parent: 4a2f38e4d6ec0871e0e7077d6b322b20549e648f
author: gkostka <kostka.grzegorz@gmail.com>
date: Sun Dec 28 09:16:34 EST 2014

Names refactoring

--- a/demos/stm32f429_disco/hw_init.c
+++ b/demos/stm32f429_disco/hw_init.c
@@ -170,18 +170,18 @@
     on ? BSP_LED_On(LED3) : BSP_LED_Off(LED3);
 }
 
-uint32_t hw_get_ms(void)
+uint32_t tim_get_ms(void)
 {
     return HAL_GetTick();
 }
 
-uint64_t hw_get_us(void)
+uint64_t tim_get_us(void)
 {
     return (uint64_t)HAL_GetTick() * 1000 +
             ((SysTick->LOAD - SysTick->VAL) * 1000) / SysTick->LOAD;
 }
 
-void hw_wait_ms(uint32_t ms)
+void tim_wait_ms(uint32_t ms)
 {
     volatile uint32_t t = HAL_GetTick();
 
--- a/demos/stm32f429_disco/hw_init.h
+++ b/demos/stm32f429_disco/hw_init.h
@@ -42,8 +42,8 @@
 void hw_led_red(bool on);
 void hw_led_green(bool on);
 
-uint32_t hw_get_ms(void);
-uint64_t hw_get_us(void);
-void hw_wait_ms(uint32_t ms);
+uint32_t tim_get_ms(void);
+uint64_t tim_get_us(void);
+void tim_wait_ms(uint32_t ms);
 
 #endif /* HW_INIT_H_ */
--- a/demos/stm32f429_disco/main.c
+++ b/demos/stm32f429_disco/main.c
@@ -191,12 +191,12 @@
 
 static clock_t get_ms(void)
 {
-    return hw_get_ms();
+    return tim_get_ms();
 }
 
 static void printf_io_timings(clock_t diff)
 {
-    const struct ext4_io_stats *stats = ext4_io_timings_get(diff);
+    const struct ext4_io_stats *stats = io_timings_get(diff);
     printf("io_timings:\n");
     printf("  io_read: %.3f%%\n", stats->io_read);
     printf("  io_write: %.3f%%\n", stats->io_write);
@@ -214,7 +214,7 @@
     clock_t start;
 
     printf("dir_test: %d\n", len);
-    ext4_io_timings_clear();
+    io_timings_clear();
     start = get_ms();
 
     printf("directory create: /mp/dir1\n");
@@ -264,7 +264,7 @@
     r = ext4_fclose(&f);
 
 
-    ext4_io_timings_clear();
+    io_timings_clear();
     start = get_ms();
     r = ext4_fopen(&f, "/mp/test1", "wb");
     if(r != EOK){
@@ -299,7 +299,7 @@
     r = ext4_fclose(&f);
 
 
-    ext4_io_timings_clear();
+    io_timings_clear();
     start = get_ms();
     r = ext4_fopen(&f, "/mp/test1", "r+");
     if(r != EOK){
@@ -352,7 +352,7 @@
 
 
     printf("remove /mp/dir1\n");
-    ext4_io_timings_clear();
+    io_timings_clear();
     start = get_ms();
     ext4_dir_rm("/mp/dir1");
     stop = get_ms();
@@ -431,41 +431,41 @@
     printf("  cache mode: %s\n", cache_mode ? "dynamic" : "static");
 
 
-    hw_wait_ms(TEST_DELAY_MS);
+    tim_wait_ms(TEST_DELAY_MS);
     if(!mount())
         return EXIT_FAILURE;
 
-    hw_wait_ms(TEST_DELAY_MS);
+    tim_wait_ms(TEST_DELAY_MS);
 
     ext4_cache_write_back("/mp/", 1);
     cleanup();
 
     if(sbstat){
-        hw_wait_ms(TEST_DELAY_MS);
+        tim_wait_ms(TEST_DELAY_MS);
         mp_stats();
     }
 
-    hw_wait_ms(TEST_DELAY_MS);
+    tim_wait_ms(TEST_DELAY_MS);
     dir_ls("/mp/");
     if(!dir_test(dir_cnt))
         return EXIT_FAILURE;
 
-    hw_wait_ms(TEST_DELAY_MS);
+    tim_wait_ms(TEST_DELAY_MS);
     if(!file_test())
         return EXIT_FAILURE;
 
     if(sbstat){
-        hw_wait_ms(TEST_DELAY_MS);
+        tim_wait_ms(TEST_DELAY_MS);
         mp_stats();
     }
 
     if(cleanup_flag){
-        hw_wait_ms(TEST_DELAY_MS);
+        tim_wait_ms(TEST_DELAY_MS);
         cleanup();
     }
 
     if(bstat){
-        hw_wait_ms(TEST_DELAY_MS);
+        tim_wait_ms(TEST_DELAY_MS);
         block_stats();
     }
 
@@ -476,9 +476,9 @@
     printf("press RESET button to restart\n");
 
     while (1) {
-        hw_wait_ms(500);
+        tim_wait_ms(500);
         hw_led_green(1);
-        hw_wait_ms(500);
+        tim_wait_ms(500);
         hw_led_green(0);
 
     }
--- a/demos/stm32f429_disco/usb_msc_lwext4.c
+++ b/demos/stm32f429_disco/usb_msc_lwext4.c
@@ -78,12 +78,12 @@
 static struct usb_msc_io_timings io_timings;
 
 
-void ext4_io_timings_clear(void)
+void io_timings_clear(void)
 {
     memset(&io_timings, 0, sizeof(struct usb_msc_io_timings));
 }
 
-const struct ext4_io_stats * ext4_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;
 
@@ -155,7 +155,7 @@
 {
     uint8_t status;
 
-    uint64_t v = hw_get_us();
+    uint64_t v = tim_get_us();
 
     if(!hw_usb_connected())
         return EIO;
@@ -167,7 +167,7 @@
     if(status != USBH_OK)
         return EIO;
 
-    io_timings.acc_bread += hw_get_us() - v;
+    io_timings.acc_bread += tim_get_us() - v;
     io_timings.cnt_bread++;
     io_timings.av_bread = io_timings.acc_bread / io_timings.cnt_bread;
 
@@ -180,7 +180,7 @@
 {
     uint8_t status;
 
-    uint64_t v = hw_get_us();
+    uint64_t v = tim_get_us();
 
     if(!hw_usb_connected())
         return EIO;
@@ -192,7 +192,7 @@
     if(status != USBH_OK)
         return EIO;
 
-    io_timings.acc_bwrite += hw_get_us() - v;
+    io_timings.acc_bwrite += tim_get_us() - v;
     io_timings.cnt_bwrite++;
     io_timings.av_bwrite = io_timings.acc_bwrite / io_timings.cnt_bwrite;
 
--- a/demos/stm32f429_disco/usb_msc_lwext4.h
+++ b/demos/stm32f429_disco/usb_msc_lwext4.h
@@ -48,8 +48,8 @@
     float cpu;
 };
 
-void ext4_io_timings_clear(void);
-const struct ext4_io_stats * ext4_io_timings_get(uint32_t time_sum_ms);
+void io_timings_clear(void);
+const struct ext4_io_stats * io_timings_get(uint32_t time_sum_ms);