symbian-qemu-0.9.1-12/model-libraries/nvmemmory/NVMemory_HowTo.txt
branchnvmemory
changeset 74 eb3d0111f868
equal deleted inserted replaced
73:b6aa150091ee 74:eb3d0111f868
       
     1 ========================================================================
       
     2     NVMEMORY.DLL - A simple non volatile sector addressed memory device
       
     3                 - An example of a portable high abstraction model architecture. 
       
     4                     This DLL is created to serve in multiple different modeling 
       
     5                     environments and tools. Model portability should be taken into 
       
     6                     account when further developing and maintaining this device.
       
     7 ========================================================================
       
     8 
       
     9 ========================================================================
       
    10     USAGE       nvmemory.dll
       
    11                 Example usage provided by syborg_nvmemorydevice.py    
       
    12     
       
    13                 1 - Create an instance of SyborgNVMemory class. 
       
    14                     This can be performed either by instantiating the C++ class directly 
       
    15                     by calling the constructor "new SyborgNVMemory( a_sectorsize );".
       
    16                     Or by using the C API to create an instance "nvmem_create( sector_size )".
       
    17                     As you can see you need to set the sector size for your device when you create it.
       
    18                     
       
    19                     In fact each of the API functions are provided in form of both C and C++ API functions.
       
    20                     From this on only the C API is explained.
       
    21                     
       
    22                 2 - Reset the device by calling "nvmem_reset( self.obj )". 
       
    23                     This function clears any information stored by the device instance except the sector size.
       
    24                     
       
    25                     Note that for the C API you always need to specify the object which you wish to command.
       
    26                     
       
    27                 3 - Create handle to your image file by calling "nvmem_open( self.obj, imagepath )". 
       
    28                     Image is opened in binary mode. Store the handle.
       
    29                     
       
    30                     Note that you need to have an image stored to a path on your PC before you can call this function. 
       
    31                     You must provide the image name and path when calling.
       
    32                     
       
    33                     Note also that there is a service provided by this DLL which can create an image for you. 
       
    34                     NVMEMORY_API int32_t nvmem_create_image( SyborgNVMemory* a_syborg_nvmemory, char* a_memoryarrayname, uint32_t a_sectorcount, uint32_t a_sectorsize = NVMEM_DEFAULT_SECTORSIZE_IN_BYTES );
       
    35                     nvmem_create_image function probably needs further development. You may also create image in your wrapper as done in example usage file.
       
    36                     
       
    37                     You may get your memory device size by calling nvmem_get_sector_count( self.obj, nvmemhandle ). 
       
    38                     nvmemhandle is the handle you got when calling nvmem_open. 
       
    39                     nvmem_get_sector_count is handy in cases where you have provided a readymade image for the device. 
       
    40                     In this case you don't need to go and hardcode the image size each time in your wrapper.
       
    41                 
       
    42                 4 - Initialize callback. Provide a callback function for the device by calling "nvmem_set_callback( self.obj, nvmem_callback )". 
       
    43                     Where the callback is a function pointer of a type "int (*i_NVMemCallBack)(int);". 
       
    44                     Callback is called by DLL when read and write operations are finished. Parameter is the amount of sectors succesfully read or written.
       
    45                     
       
    46                 5 - Start using your device.
       
    47                     nvmem_read(  self.obj, nvmemory_sharedmemory_host_address, nvmemhandle, transaction_offset, transaction_size )
       
    48                     nvmem_write(  self.obj, nvmemory_sharedmemory_host_address, nvmemhandle, transaction_offset, transaction_size )
       
    49                     
       
    50                 See syborg_nvmemorydevice.py to learn more about device usage. 
       
    51                     
       
    52 ========================================================================
       
    53 
       
    54 
       
    55 ========================================================================
       
    56     DYNAMIC LINK LIBRARY : nvmemmory Project Overview
       
    57 ========================================================================
       
    58 
       
    59 Summary of what you will find in each of the files that
       
    60 make up your nvmemmory application.
       
    61 
       
    62 nvmemmory.vcproj
       
    63     This is the main project file for VC++ projects generated using an Application Wizard. 
       
    64     It contains information about the version of Visual C++ that generated the file, and 
       
    65     information about the platforms, configurations, and project features selected with the
       
    66     Application Wizard.
       
    67 
       
    68 nvmemmory.cpp
       
    69     This is the main DLL source file.
       
    70 
       
    71 nvmemmory.h
       
    72     This file contains a class declaration.
       
    73