This sample code is to show the users about how to use the memory library's API.


How to build the sample code
===========On EIC7X board===========
If the environment for building the sample code is EIC7X board(i.e, RISC-V architecture),
just directly run the build.sh script.
$./build.sh
===============On x86===============
If the environment for building the sample code is x86, please modify the build.sh script to
specify the RISC-V cross compile toolchain path:
1.Edit the build.sh, change the path of the STAGING_DIR with your actual path where the lib
  and header are stored.
  The libes_memory.so should be stored under STAGING_DIR/usr/lib/essdk/
  The es_type.h, es_sys_memory.h and es_vb_memory.h should be stored under STAGING_DIR/usr/include/essdk/
  The es_vb_user.h which come from linux kernel should be stored under STAGING_DIR/usr/include/linux/
2.Edit the build.sh, change the CROSS_COMPILE with your actual path of the cross compile tool
2.Run "./build.sh"
  The executable program file named sample_memory will be generated under the sample folder.

Run the program
===============notice==================
1.The samples of memory use "system" "linux,cma" and "mmz_nid_0_part_0" memory regions.
  Please ensure that the dts file has corresponding memory nodes, otherwise the cases that use these memory regions cannot be executed properly.
2.If run the case "4.VB mod IOVA case", the driver of encoder(es_venc.ko) and decoder(es_vdec) must be insmoded,
  otherwise the case cannot be executed properly.
=======================================
[root@eswin-os:/opt/eswin/bin]$ ./sample_memory [case_num]

$ ./sample_memory 1
[I][MEM_TEST]  main: 1136 case_total_num=8
[I][MEM_TEST]  main: 1160 -----------------case(1.common memory case)---------------
[I][MEM_TEST]  comm_mem_case:  129 =====================sys mem test mem_len:0x1000 item_num:0===============
[I][MEM_TEST]  comm_mem_case:  143 fd 0x1540000000c mem node is:0
[I][MEM_TEST]  comm_mem_case:  154 pVirAddr 0x0x7fffab682000x mem node is:0
[I][MEM_TEST]  comm_mem_case:  159 flush cache!
[I][MEM_TEST]  comm_mem_case:  176 free memFd(1540000000c)
[I][MEM_TEST]  comm_mem_case:  129 =====================sys mem test mem_len:0x1000 item_num:1===============
[I][MEM_TEST]  comm_mem_case:  143 fd 0x1540000000c mem node is:0
[I][MEM_TEST]  comm_mem_case:  154 pVirAddr 0x0x7fffab682000x mem node is:0
[I][MEM_TEST]  comm_mem_case:  159 flush cache!
[I][MEM_TEST]  comm_mem_case:  176 free memFd(1540000000c)
[I][MEM_TEST]  comm_mem_case:  129 =====================sys mem test mem_len:0x1000 item_num:2===============
[I][MEM_TEST]  comm_mem_case:  143 fd 0x1540000000c mem node is:0
[I][MEM_TEST]  comm_mem_case:  154 pVirAddr 0x0x7fffab682000x mem node is:0
[I][MEM_TEST]  comm_mem_case:  176 free memFd(1540000000c)
[I][MEM_TEST]  comm_mem_case:  129 =====================sys mem test mem_len:0x1000 item_num:3===============
[I][MEM_TEST]  comm_mem_case:  143 fd 0x1540000000c mem node is:0
[I][MEM_TEST]  comm_mem_case:  154 pVirAddr 0x0x7fffab682000x mem node is:0
[I][MEM_TEST]  comm_mem_case:  176 free memFd(1540000000c)
[I][MEM_TEST]  comm_mem_case:  129 =====================sys mem test mem_len:0x1000 item_num:4===============
[I][MEM_TEST]  comm_mem_case:  143 fd 0x1540000000c mem node is:0
[I][MEM_TEST]  comm_mem_case:  154 pVirAddr 0x0x7fffab682000x mem node is:0
[I][MEM_TEST]  comm_mem_case:  176 free memFd(1540000000c)
[I][MEM_TEST]  main: 1166 -----------case(1.common memory case) test success!--------

