RAM Disk function using Mbed os5 standard library

Please refer following my Notebook page.
/users/kenjiArai/notebook/sd-card-control-new/#

Revision:
4:6650958e6eae
Parent:
3:c31e9e43554b
--- a/main.cpp	Fri Dec 27 03:00:50 2019 +0000
+++ b/main.cpp	Sat May 02 03:45:31 2020 +0000
@@ -2,11 +2,11 @@
  * Mbed Application program
  *  RAM Disck function with FatFs on Mbed-os5
  *
- * Copyright (c) 2018,'19 Kenji Arai / JH1PJL
- *  http://www.page.sannet.ne.jp/kenjia/index.html
+ * Copyright (c) 2018,'19,'20 Kenji Arai / JH1PJL
+ *  http://www7b.biglobe.ne.jp/~kenjia/
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    April      7th, 2018
- *      Revised:    December  27th, 2019
+ *      Revised:    May        2nd, 2020
  */
 
 //  Include --------------------------------------------------------------------
@@ -69,10 +69,15 @@
 //  ROM / Constant data --------------------------------------------------------
 const char *const opening_msg0 = "RAM Disk (use Heap area) test program";
 const char *const opening_msg1 = " -> run on Mbed OS-5\r\n";
+const char *const opening_msg2 = "microSD Card is ready for use\r\n";
+const char *const opening_msg3 = "Please hit any key to start!\r\n";
 
 //  Function prototypes --------------------------------------------------------
 void return_error (int ret_val);
 void errno_error (void* ret_val);
+extern void print_revision(void);
+extern uint32_t get_disk_freespace(void);
+extern uint32_t get_data_file_size(const char *const file_name);
 
 //------------------------------------------------------------------------------
 //  Control Program
@@ -87,14 +92,12 @@
     uint32_t data4 = 50000U;
     uint32_t data5 = 60000U;
 
-    if (user_sw == USER_SW_ON) {
-        mon();
-    }
+    pc.printf("\r\n\r\n");
+    print_revision();
     DBG("line:%d\r\n", __LINE__);
     pc.printf("\r\nStart\r\n");
     int error = 0;
     pc.printf("Welcome to the filesystem example.\r\n");
-    pc.printf("Mounting the filesystem on \"/fs\". \r\n");
     pc.printf("Formatting a FAT, RAM-backed filesystem.\r\n");
     error = FATFileSystem::format(&bd);
     return_error(error);
@@ -107,14 +110,14 @@
     if (fp != 0) {
         pc.printf("%s%s",  opening_msg0, opening_msg1);
         fprintf(fp,"%s%s", opening_msg0, opening_msg1);
+        pc.printf("%s",  opening_msg2);
         fclose(fp);
     } else {
         pc.printf("ERROR\r\n");
     }
-    while (pc.readable()) {
-        char c = pc.getc(); // dummy read
-        mon();
-    }
+    pc.printf("%s",  opening_msg3);
+    while (pc.readable() == 0) { ;}
+    char c = pc.getc(); // dummy read
     while (true) {
         DBG("line:%3d\r\n", __LINE__);
         tmr.reset();
@@ -143,7 +146,6 @@
         } else {
             pc.printf("ERROR\r\n");
         }
-        DBG("line:%3d\r\n", __LINE__);
         uint32_t time_sd = tmr.read_ms();
         pc.printf("time[ms]:%3d ,", time_sd);
         ThisThread::sleep_for(20);