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