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