diff --git a/Pcie40Applications/main_pcie40_b2slc.cpp b/Pcie40Applications/main_pcie40_b2slc.cpp
index 20a5dc229b6833c19a756f7597609e9a048f4bd7..68d2042ea9d4dc2b6e621fb7083831eb321e8923 100644
--- a/Pcie40Applications/main_pcie40_b2slc.cpp
+++ b/Pcie40Applications/main_pcie40_b2slc.cpp
@@ -1,17 +1,108 @@
+
+/*-------------------------------------------------------------------------------*\
+  pcie40_b2slc: From PCIe40 board to access register of FEE through belle2link
+
+  Auther: Qi-Dong Zhou, KEK
+
+  2020.03.06  0.01 first version
+
+\*--------------------------------------------------------------------------------*/
 #include "pcie40_b2slc.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <iostream>
 
 extern "C" int  ecs_open(int dev, int bar);
 extern "C" void ecs_close(int dev, int bar);
+//#define PCIE_DEV     0
+#define MAX_NUM_CH   48
+#define MAX_SLOT     3
+#define SLC_BAR      2
+int dev_slot         = -1;
+int ch               = -1;
+unsigned int addr    = 0;
+unsigned int data    = 0;
+bool USE_FEE8        = false;
+bool USE_FEE32       = false;
+bool READ_ONLY       = false;
+bool WRITE           = false;
+bool STREAM          = false;
+char *filename;
+
+
+void argument(int argc, char **argv){
+
+  for(int i=1;i<argc;i++){
+    std::string ss = argv[i];
+    if(ss=="--dev"){
+      dev_slot = atoi(argv[++i]);
+      if( dev_slot<0 || dev_slot >= MAX_SLOT){
+	fprintf(stderr, "Invalid device slot %d, Valid slot [0, %d]\n", dev_slot, MAX_SLOT);
+      }
+    }
+    if(ss=="--ch"){
+      ch = atoi(argv[++i]);
+      if( ch<0 || ch >= MAX_NUM_CH){
+	fprintf(stderr, "Invalid channel ID %d, Valid ID [0, %d]\n", ch, MAX_NUM_CH);
+      }
+    }
+    if(ss=="--fee8"){
+      USE_FEE8 = true;
+    } 
+    if(ss=="--fee32"){
+      USE_FEE32 = true;
+    } 
+    if(ss=="--r" || ss=="--read"){
+      READ_ONLY = true;
+      addr = strtoul(argv[++i], 0, 16);
+    } 
+    if(ss=="--w" || ss=="--write"){
+      WRITE = true;
+      addr = strtoul(argv[++i], 0, 16);
+      data = strtoul(argv[++i], 0, 16);
+      //printf("add = %02x  data = %08x\n", addr, data);
+    } 
+    if(ss=="--stream"){
+      STREAM = true;
+      filename = argv[++i];
+    } 
+    if(ss=="--h" || ss=="-help"){
+      fprintf(stderr, "pcie40_b2slc\n"
+                       "--dev   xx              #device slot number which installed PCIe40\n" 
+                       "--ch    xx              #link channel number\n" 
+                       "--r     xx              #read register with address xx\n"
+                       "--w     xx  xx          #write register with address xx parameter xx\n"
+                       "--fee8                  #use A7D8 for access register\n"
+                       "--fee32                 #use A16D32 for access register\n"
+                       "--stream /path/filename #streaming a file by using stream file method\n");
+      return;
+    }
+  }
+}
 
-int main(int argc, char *argv[]) { 
-  ecs_open( 0 , 2 ) ;
 
-  int result = pcie40_readfee32( 0 , 1 , 0x12 ) ;
+int main(int argc, char** argv){
   
-  ecs_close( 0 , 2 ) ;
+  argument(argc, argv);
+
 
-  printf( "Value = %X\n" , result ) ;
+  ecs_open( dev_slot , SLC_BAR );
+  
+  if(USE_FEE8 && READ_ONLY)
+    pcie40_readfee8( dev_slot , ch , addr );
+  else if(USE_FEE8 && WRITE)
+    pcie40_writefee8( dev_slot , ch , addr, data );
+  else if(USE_FEE32 && READ_ONLY)
+    pcie40_readfee32( dev_slot , ch , addr );
+  else if(USE_FEE8 && WRITE)
+    pcie40_writefee32( dev_slot , ch , addr, data );
+  else if(STREAM)
+    pcie40_writestream( dev_slot , ch , filename ) ;
+    //std::cout << filename << std::endl;  
+  ecs_close( dev_slot , SLC_BAR) ;
 
   return 0 ;
 }
+
+