# HG changeset patch # User Gareth Stockwell # Date 1285182653 -3600 # Node ID b842c0cb760ee54558f748c1d064af631ffa01da # Parent b6c206049d8a9536742a06229736a2e650c63df7 Backed out changeset b6c206049d8a The nvmemmory library depends on a modification to qemu; this change is therefore backed out in order to allow NVM functionality to be merged into graphics-phase-3 by transplanting individual commits. diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/Makefile --- a/symbian-qemu-0.9.1-12/model-libraries/Makefile Wed Sep 22 17:06:27 2010 +0100 +++ b/symbian-qemu-0.9.1-12/model-libraries/Makefile Wed Sep 22 20:10:53 2010 +0100 @@ -14,7 +14,7 @@ .phony: all clean install distclean # Append new model library dirs here. -subdirs := nvmemmory syborg-graphicswrapper +subdirs := syborg-graphicswrapper/ all clean install distclean: for d in $(subdirs); do $(MAKE) -C $$d $@; done diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Debug/BuildLog.htm Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Debug/BuildLog.htm has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Debug/app.res Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Debug/app.res has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Makefile --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Makefile Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -# Copyright (c) 2010 Symbian Foundation. -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Mike Kinghan, mikek@symbian.org, for Symbian Foundation - Initial contribution -# -# Description: -# Toplevel Makefile to build libnvmemmory.so in either debug or release mode - -.phony: all clean install distclean - - -# Ensure DEBUG_LIBS is defined to make a debug build -ifneq ($(DEBUG_LIBS),) -build_dir=Debug -else -build_dir=Release -endif - -all clean install distclean: - $(MAKE) -C $(build_dir) $@ -f ../target.mak - - diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/NVMemory_HowTo.txt --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/NVMemory_HowTo.txt Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -======================================================================== - NVMEMORY.DLL - A simple non volatile sector addressed memory device - - An example of a portable high abstraction model architecture. - This DLL is created to serve in multiple different modeling - environments and tools. Model portability should be taken into - account when further developing and maintaining this device. -======================================================================== - -======================================================================== - USAGE nvmemory.dll - Example usage provided by syborg_nvmemorydevice.py - - 1 - Create an instance of SyborgNVMemory class. - This can be performed either by instantiating the C++ class directly - by calling the constructor "new SyborgNVMemory( a_sectorsize );". - Or by using the C API to create an instance "nvmem_create( sector_size )". - As you can see you need to set the sector size for your device when you create it. - - In fact each of the API functions are provided in form of both C and C++ API functions. - From this on only the C API is explained. - - 2 - Reset the device by calling "nvmem_reset( self.obj )". - This function clears any information stored by the device instance except the sector size. - - Note that for the C API you always need to specify the object which you wish to command. - - 3 - Create handle to your image file by calling "nvmem_open( self.obj, imagepath )". - Image is opened in binary mode. Store the handle. - - Note that you need to have an image stored to a path on your PC before you can call this function. - You must provide the image name and path when calling. - - Note also that there is a service provided by this DLL which can create an image for you. - 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 ); - nvmem_create_image function probably needs further development. You may also create image in your wrapper as done in example usage file. - - You may get your memory device size by calling nvmem_get_sector_count( self.obj, nvmemhandle ). - nvmemhandle is the handle you got when calling nvmem_open. - nvmem_get_sector_count is handy in cases where you have provided a readymade image for the device. - In this case you don't need to go and hardcode the image size each time in your wrapper. - - 4 - Initialize callback. Provide a callback function for the device by calling "nvmem_set_callback( self.obj, nvmem_callback )". - Where the callback is a function pointer of a type "int (*i_NVMemCallBack)(int);". - Callback is called by DLL when read and write operations are finished. Parameter is the amount of sectors succesfully read or written. - - 5 - Start using your device. - nvmem_read( self.obj, nvmemory_sharedmemory_host_address, nvmemhandle, transaction_offset, transaction_size ) - nvmem_write( self.obj, nvmemory_sharedmemory_host_address, nvmemhandle, transaction_offset, transaction_size ) - - See syborg_nvmemorydevice.py to learn more about device usage. - -======================================================================== - - -======================================================================== - DYNAMIC LINK LIBRARY : nvmemmory Project Overview -======================================================================== - -Summary of what you will find in each of the files that -make up your nvmemmory application. - -nvmemmory.vcproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -nvmemmory.cpp - This is the main DLL source file. - -nvmemmory.h - This file contains a class declaration. - diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/BuildLog.htm Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/BuildLog.htm has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/RCa03000 Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/RCa03000 has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/mt.dep --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/mt.dep Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Manifest resource last updated at 14:11:35.93 on 26.05.2010 diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.dll Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.dll has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.dll.intermediate.manifest --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.dll.intermediate.manifest Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.exp Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.exp has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.lib Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.lib has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.obj Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.obj has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.pdb Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/nvmemmory.pdb has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/vc80.idb Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/vc80.idb has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/vc80.pdb Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/Release/vc80.pdb has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/app.ico Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/app.ico has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/app.rc --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/app.rc Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon placed first or with lowest ID value becomes application icon - -LANGUAGE 9, 1 -#pragma code_page(1252) -1 ICON "app.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" - "\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\0" -END - -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.cpp --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.cpp Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* Simple non volatile memory device. nvmemmory.cpp -* -*/ - -extern "C" - { -#include - } -#include "nvmemmory.h" - -SyborgNVMemory::SyborgNVMemory( uint32_t a_sectorsize ): - iNVMemSectorSizeInBytes( a_sectorsize ) - { - for( int32_t index = 0; index < NVMEM_MAX_STREAMHANDLES; index += 1 ) - { - i_filestream[index] = NULL; - } - } - -SyborgNVMemory::~SyborgNVMemory() - { - NVMemReset(); - } - -int32_t SyborgNVMemory::NVMemReset( ) - { - /*Initialize the file array*/ - for( int32_t index = 0; index < NVMEM_MAX_STREAMHANDLES; index += 1 ) - { - if( i_filestream[index] != NULL ) - { - fclose( i_filestream[index] ); - i_filestream[index] = NULL; - } - } - return 0; - } - -int32_t SyborgNVMemory::NVMemCreateImage( char* a_memoryarrayname, uint32_t a_sectorcount, uint32_t a_sectorsize ) - { - /* Create a temporary MByte buffer array for image creation purpose */ - const uint32_t tempbufsize = 1024 * 1024; - uint8_t tempbuf[ tempbufsize ]; - uint32_t index = 0; - FILE *filestream = NULL; - char mode1[4] = {"rb"}; - char mode2[4] = {"wb"}; - int32_t ret = NVMEM_ERROR_CREATE; - uint32_t temparraysectorcount = tempbufsize / a_sectorsize; - iNVMemSectorSizeInBytes = a_sectorsize; - - /* Try to open the specified file. If it exists we do not create a new one */ - filestream = fopen( a_memoryarrayname, &mode1[0] ); - if( filestream == NULL ) - { - /* Fill MBR with zeroes */ - for( index = 0; index < iNVMemSectorSizeInBytes; index += 1 ) - { - tempbuf[index] = 0; - } - /* Open a temporary file handle. Create the file*/ - filestream = fopen( a_memoryarrayname, &mode2[0] ); - - if( ret != NULL ) - { - ret = NVMEM_OK; - for( index = 0; (index < a_sectorcount) && (ret == NVMEM_OK); index += temparraysectorcount ) - { - /* Print one array of zeroes to our temporary buffer */ - if( fwrite( tempbuf, iNVMemSectorSizeInBytes, temparraysectorcount, filestream ) < 0 ) - { - ret = NVMEM_ERROR_FWRITE; - } - } - fclose( filestream ); - } - else - { - ret = NVMEM_ERROR_FOPEN; - } - } - return ret; - } - -int32_t SyborgNVMemory::NVMemOpen( char* a_memoryarrayname ) - { - char mode[4] = {"rb+"}; - int32_t handle = NVMEM_ERROR_OUT_OF_FREE_STREAMHANDLES; - /* Search for a free handle position and assign if found */ - int32_t index = 0; - for( ; index < NVMEM_MAX_STREAMHANDLES; index += 1 ) - { - if( i_filestream[index] == NULL ) - { - i_filestream[index] = fopen( a_memoryarrayname, &mode[0] ); - if( i_filestream[index] != NULL ) - { - handle = index; - printf("handle created: %d\n", index); - } - else - { - handle = NVMEM_ERROR_FOPEN; - } - break; - } - } - return handle; - } - -int32_t SyborgNVMemory::NVMemClose( int32_t a_memoryarrayhandle ) - { - int32_t result = NVMEM_ERROR_FCLOSE; - if( fclose( i_filestream[a_memoryarrayhandle] ) == 0 ) - { - result = NVMEM_OK; - } - return result; - } - -int32_t SyborgNVMemory::NVMemFlush( int32_t a_memoryarrayhandle ) - { - int32_t result = NVMEM_ERROR_FFLUSH; - if( fflush( i_filestream[a_memoryarrayhandle] ) == 0 ) - { - result = NVMEM_OK; - } - return result; - } - -void SyborgNVMemory::NVMemRead( uint32_t *a_client_targetmemoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarraysectoroffset, uint32_t a_sectorcount ) - { - //printf("SyborgNVMemory::NVMemRead: sectorpos:%d sectorcount:%d hostaddr: 0x%08x handle: %d\n", a_memoryarraysectoroffset, a_sectorcount, a_client_targetmemoryaddr, a_memoryarrayhandle ); - uint32_t items_read = 0; - long streamoffset = a_memoryarraysectoroffset * iNVMemSectorSizeInBytes; - int32_t result = fseek( i_filestream[a_memoryarrayhandle], streamoffset, SEEK_SET ); - if( result == 0 ) - { - items_read = fread( a_client_targetmemoryaddr, iNVMemSectorSizeInBytes, a_sectorcount, i_filestream[a_memoryarrayhandle] ); - /*Check that everything is read*/ - if( items_read != a_sectorcount ) - { - result = NVMEM_ERROR_FREAD; - } - else - { - result = items_read; - } - } - else /*error*/ - { - result = NVMEM_ERROR_FSEEK; - } - i_NVMemCallBack( result ); - } - -void SyborgNVMemory::NVMemWrite( uint32_t *a_client_sourcememoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarraysectoroffset, uint32_t a_sectorcount ) - { - //printf("SyborgNVMemory::NVMemWrite: sectorpos:%d sectorcount:%d hostaddr: 0x%08x\n", a_memoryarraysectoroffset, a_sectorcount, a_client_sourcememoryaddr ); - uint32_t items_written = 0; - long streamoffset = a_memoryarraysectoroffset * iNVMemSectorSizeInBytes; - int32_t result = fseek( i_filestream[a_memoryarrayhandle], streamoffset, SEEK_SET ); - if( result == 0 ) - { - items_written = fwrite( a_client_sourcememoryaddr, iNVMemSectorSizeInBytes, a_sectorcount, i_filestream[a_memoryarrayhandle] ); - /*Check that everything is written*/ - if( items_written != a_sectorcount ) - { - result = NVMEM_ERROR_FWRITE; - } - else - { - result = items_written; - } - } - else /*error*/ - { - result = NVMEM_ERROR_FSEEK; - } - i_NVMemCallBack( result ); - } - -uint32_t SyborgNVMemory::NVMemGetSectorCount( int32_t a_memoryarrayhandle ) - { - long byte_size = 0; - uint32_t sector_count = 0; - printf("use handle: %d\n", a_memoryarrayhandle); - fseek( i_filestream[a_memoryarrayhandle], 0, SEEK_END ); - byte_size = ftell( i_filestream[a_memoryarrayhandle] ); - sector_count = byte_size / iNVMemSectorSizeInBytes; - return sector_count; - } - -int32_t SyborgNVMemory::NVMemSetCallback( int (*aNVMemCallBack) (int) ) - { - i_NVMemCallBack = aNVMemCallBack; - return 0; - } - - -extern "C" - { - NVMEMORY_API SyborgNVMemory * nvmem_create( uint32_t a_sectorsize ) - { - return new SyborgNVMemory( a_sectorsize ); - } - - NVMEMORY_API int32_t nvmem_reset( SyborgNVMemory* a_syborg_nvmemory ) - { - return a_syborg_nvmemory->NVMemReset(); - } - - NVMEMORY_API int32_t nvmem_create_image( SyborgNVMemory* a_syborg_nvmemory, char* a_memoryarrayname, uint32_t a_sectorcount, uint32_t a_sectorsize ) - { - return a_syborg_nvmemory->NVMemCreateImage( a_memoryarrayname, a_sectorcount, a_sectorsize ); - } - - NVMEMORY_API int32_t nvmem_open( SyborgNVMemory* a_syborg_nvmemory, char* a_memoryarrayname ) - { - return a_syborg_nvmemory->NVMemOpen( a_memoryarrayname ); - } - - NVMEMORY_API int32_t nvmem_close( SyborgNVMemory* a_syborg_nvmemory, int32_t a_memoryarrayhandle ) - { - return a_syborg_nvmemory->NVMemClose( a_memoryarrayhandle ); - } - - NVMEMORY_API int32_t nvmem_flush( SyborgNVMemory* a_syborg_nvmemory, int32_t a_memoryarrayhandle ) - { - return a_syborg_nvmemory->NVMemFlush( a_memoryarrayhandle ); - } - - NVMEMORY_API void nvmem_read( SyborgNVMemory* a_syborg_nvmemory, uint32_t *a_client_targetmemoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarraysectoroffset, uint32_t a_sectorcount ) - { - a_syborg_nvmemory->NVMemRead( a_client_targetmemoryaddr, a_memoryarrayhandle, a_memoryarraysectoroffset, a_sectorcount ); - } - - NVMEMORY_API void nvmem_write( SyborgNVMemory* a_syborg_nvmemory, uint32_t *a_client_sourcememoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarraysectoroffset, uint32_t a_sectorcount ) - { - a_syborg_nvmemory->NVMemWrite( a_client_sourcememoryaddr, a_memoryarrayhandle, a_memoryarraysectoroffset, a_sectorcount ); - } - - NVMEMORY_API uint32_t nvmem_get_sector_count( SyborgNVMemory* a_syborg_nvmemory, int32_t a_memoryarrayhandle ) - { - return a_syborg_nvmemory->NVMemGetSectorCount( a_memoryarrayhandle ); - } - - NVMEMORY_API int32_t nvmem_set_callback( SyborgNVMemory* a_syborg_nvmemory, int (*aGraphicsCallBack) (int) ) - { - return a_syborg_nvmemory->NVMemSetCallback( aGraphicsCallBack ); - } - } diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.h --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.h Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* Simple non volatile memory device. nvmemmory.h -* -*/ - -#ifndef _NVMEMORY_H -#define _NVMEMORY_H - -#pragma once - -/*! \brief -NVMEMORY.DLL -- A simple non volatile sector addressed memory device -- An example of a portable high abstraction model architecture. - This DLL is created to serve in multiple different modeling - environments and tools. Model portability should be taken into - account when further developing and maintaining this device. - -USAGE -nvmemory.dll Example usage provided by syborg_nvmemorydevice.py. -1 - Create an instance of SyborgNVMemory class. - This can be performed either by instantiating the C++ class directly - by calling the constructor "new SyborgNVMemory( a_sectorsize );". - Or by using the C API to create an instance "nvmem_create( sector_size )". - As you can see you need to set the sector size for your device when you create it. - - In fact each of the API functions are provided in form of both C and C++ API functions. - From this on only the C API is explained. - -2 - Reset the device by calling "nvmem_reset( self.obj )". - This function clears any information stored by the device instance except the sector size. - Note that for the C API you always need to specify the object which you wish to command. - -3 - Create handle to your image file by calling "nvmem_open( self.obj, imagepath )". - Image is opened in binary mode. Store the handle. - - Note that you need to have an image stored to a path on your PC before you can call this function. - You must provide the image name and path when calling. - - Note also that there is a service provided by this DLL which can create an image for you. - 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 ); - nvmem_create_image function probably needs further development. You may also create image in your wrapper as done in example usage file. - - You may get your memory device size by calling nvmem_get_sector_count( self.obj, nvmemhandle ). - nvmemhandle is the handle you got when calling nvmem_open. - nvmem_get_sector_count is handy in cases where you have provided a readymade image for the device. - In this case you don't need to go and hardcode the image size each time in your wrapper. - -4 - Initialize callback. Provide a callback function for the device by calling "nvmem_set_callback( self.obj, nvmem_callback )". - Where the callback is a function pointer of a type "int (*i_NVMemCallBack)(int);". - Callback is called by DLL when read and write operations are finished. Parameter is the amount of sectors succesfully read or written. - -5 - Start using your device. - nvmem_read( self.obj, nvmemory_sharedmemory_host_address, nvmemhandle, transaction_offset, transaction_size ) - nvmem_write( self.obj, nvmemory_sharedmemory_host_address, nvmemhandle, transaction_offset, transaction_size ) - - See syborg_nvmemorydevice.py to learn more about device usage. -*/ - -#include "platformtypes.h" - -#ifdef WIN32 -#ifdef NVMEMORY_EXPORTS -#define NVMEMORY_API __declspec(dllexport) -#else -#define NVMEMORY_API __declspec(dllimport) -#endif -#else -#define NVMEMORY_API -#endif - -class NVMEMORY_API SyborgNVMemory; - -extern "C" - { - const int32_t NVMEM_DEFAULT_SECTORSIZE_IN_BYTES = 512; - const int32_t NVMEM_MAX_STREAMHANDLES = 16; - - /*Nvmemory error codes*/ - const int32_t NVMEM_OK = 0; - const int32_t NVMEM_ERROR_OUT_OF_FREE_STREAMHANDLES = -1; - const int32_t NVMEM_ERROR_FOPEN = -2; - const int32_t NVMEM_ERROR_FCLOSE = -3; - const int32_t NVMEM_ERROR_FFLUSH = -4; - const int32_t NVMEM_ERROR_FSEEK = -5; - const int32_t NVMEM_ERROR_FREAD = -6; - const int32_t NVMEM_ERROR_FWRITE = -7; - const int32_t NVMEM_ERROR_SETVBUF = -8; - const int32_t NVMEM_ERROR_CREATE = -9; - const int32_t NVMEM_ERROR_FPRINTF = -10; - - /** - * Reset the device - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @return TODO an error if fails - */ - NVMEMORY_API int32_t nvmem_reset( SyborgNVMemory* a_syborg_nvmemory ); - - /** - * Create a non volatile memory array object. - * - * @param a_sectorsize Size for the sector. - * @return An object of class SyborgNVMemory. - */ - NVMEMORY_API SyborgNVMemory * nvmem_create( uint32_t a_sectorsize = NVMEM_DEFAULT_SECTORSIZE_IN_BYTES); - - /** - * Create a non volatile memory array. A raw image will be created to host filesystem which will - * act as a non volatile memory device in client point of view. - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param a_memoryarrayname Name for the image to be created. - * @param a_sectorcount Image size in sectors. - * @param a_sectorsize size for the sector. - * @return An error code. - */ - 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 ); - - /** - * Create handle to an image - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param a_memoryarrayname Name and path for the image to be opened. - * @return Handle to a non volatile memory array. - */ - NVMEMORY_API int32_t nvmem_open( SyborgNVMemory* a_syborg_nvmemory, char* a_memoryarrayname ); - - /** - * Close handle to a non volatile memory array - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param a_memoryarrayhandle Handle to be closed. - * @return Error code. - */ - NVMEMORY_API int32_t nvmem_close( SyborgNVMemory* a_syborg_nvmemory, int32_t a_memoryarrayhandle ); - - /** - * Flush possible cached content of a non volatile memory array - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param a_memoryarrayhandle Handle pointing to stream which is flushed to a file. - * @return Error code. - */ - NVMEMORY_API int32_t nvmem_flush( SyborgNVMemory* a_syborg_nvmemory, int32_t a_memoryarrayhandle ); - - /** - * Read from a non volatile memory array to a guest os application memory space - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param a_client_targetmemoryaddr Host OS address pointing to a place to where the data read should be returned. - * @param a_memoryarrayhandle Handle to the device image. - * @param a_memoryarrayoffset Sector offset to a position from where the data is to be read. - * @param a_sectorcount Amount of sectors to be read. - * @return Error code. - */ - NVMEMORY_API void nvmem_read( SyborgNVMemory* a_syborg_nvmemory, uint32_t *a_client_targetmemoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarrayoffset, uint32_t a_sectorcount ); - - /** - * Write to a non volatile memory array from a guest os application memory space - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param a_client_sourcememoryaddr Host OS address pointing to a place to where to get the data for write operation. - * @param a_memoryarrayhandle Handle to the device image. - * @param a_memoryarrayoffset Sector offset to a position to where the data is to be written. - * @param a_sectorcount Amount of sectors to be written. - * @return Error code. - */ - NVMEMORY_API void nvmem_write( SyborgNVMemory* a_syborg_nvmemory, uint32_t *a_client_sourcememoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarrayoffset, uint32_t a_sectorcount ); - - /** - * Get the size of a non volatile memory array - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param a_memoryarrayhandle Handle to the device image. - * @return Total amount of sectors of the device. - */ - NVMEMORY_API uint32_t nvmem_get_sector_count( SyborgNVMemory* a_syborg_nvmemory, int32_t a_memoryarrayhandle ); - - /** - * Store callback - * - * @param a_syborg_nvmemory an object of class SyborgNVMemory. - * @param aGraphicsCallBack pointer to a callback function. - * @return TODO an error if fails. - */ - NVMEMORY_API int32_t nvmem_set_callback( SyborgNVMemory* a_syborg_nvmemory, int (*aGraphicsCallBack) (int) ); - } - -class NVMEMORY_API SyborgNVMemory - { - public: - - SyborgNVMemory( uint32_t a_sectorsize = NVMEM_DEFAULT_SECTORSIZE_IN_BYTES ); - ~SyborgNVMemory( ); - - /** - * Reset the device - */ - int32_t NVMemReset( ); - /** - * Create a non volatile memory array. A raw image will be created to host filesystem which will - * act as a non volatile memory device in client point of view. - */ - int32_t NVMemCreateImage( char* a_memoryarrayname, uint32_t a_sectorcount, uint32_t a_sectorsize = NVMEM_DEFAULT_SECTORSIZE_IN_BYTES ); - /** - * Return handle to a non volatile memory array - */ - int32_t NVMemOpen( char* a_memoryarrayname ); - /** - * Close handle to a non volatile memory array - */ - int32_t NVMemClose( int32_t a_memoryarrayhandle ); - /** - * Flush possible cached content of a non volatile memory array - */ - int32_t NVMemFlush( int32_t a_memoryarrayhandle ); - /** - * Read from a non volatile memory array to a guest os application memory space - */ - void NVMemRead( uint32_t *a_client_targetmemoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarrayoffset, uint32_t a_sectorcount ); - /** - * Write to a non volatile memory array from a guest os application memory space - */ - void NVMemWrite( uint32_t *a_client_sourcememoryaddr, int32_t a_memoryarrayhandle, uint32_t a_memoryarrayoffset, uint32_t a_sectorcount ); - /** - * Get the size of a non volatile memory array - */ - uint32_t NVMemGetSectorCount( int32_t a_memoryarrayhandle ); - /** - * Store callback - */ - int32_t NVMemSetCallback( int (*aNVMemCallBack) (int) ); - - private: - FILE *i_filestream[NVMEM_MAX_STREAMHANDLES]; - uint32_t iNVMemSectorSizeInBytes; - int (*i_NVMemCallBack)(int); - }; - -#endif // _NVMEMORY_H diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.ncb Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.ncb has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.sln --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.sln Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nvmemmory", "nvmemmory.vcproj", "{F42A5A5B-9267-46F9-89C5-9D83F96A6B36}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F42A5A5B-9267-46F9-89C5-9D83F96A6B36}.Debug|Win32.ActiveCfg = Debug|Win32 - {F42A5A5B-9267-46F9-89C5-9D83F96A6B36}.Debug|Win32.Build.0 = Debug|Win32 - {F42A5A5B-9267-46F9-89C5-9D83F96A6B36}.Release|Win32.ActiveCfg = Release|Win32 - {F42A5A5B-9267-46F9-89C5-9D83F96A6B36}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.suo Binary file symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.suo has changed diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.vcproj --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.vcproj Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.vcproj.NOE.jahyvone.user --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/nvmemmory.vcproj.NOE.jahyvone.user Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ - - - - - - - - - - - diff -r b6c206049d8a -r b842c0cb760e symbian-qemu-0.9.1-12/model-libraries/nvmemmory/target.mak --- a/symbian-qemu-0.9.1-12/model-libraries/nvmemmory/target.mak Wed Sep 22 17:06:27 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -# Copyright (c) 2010 Symbian Foundation. -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Mike Kinghan, mikek@symbian.org, for Symbian Foundation - Initial contribution -# -# Description: -# Bottom level Makefile to build libnvmemmory.so in the current directory - -include ../../../qemu-symbian-svp/config-host.mak - -sources := nvmemmory.cpp -objs := nvmemmory.o -libname := libnvmemmory.so -soname := $(libname).1 -targ := $(soname).0 - -.phony: all build clean install distclean uninstall - -cflags=-DHAVE_STDINT_H -DNVMEMORY_EXPORTS -ifneq ($(DEBUG_LIBS),) -cflags+="-O0 -g" -else -cflags+=-O2 -endif - -vpath %.cpp .. - -all: $(targ) - -%.o : %.cpp - g++ $(cflags) -fPIC -I../../commoninc -c -o $@ $< - -$(objs): $(sources) - -$(targ): $(objs) - g++ $(cflags) -shared -Wl,-soname,$(soname) -Wl,-l,stdc++ -o $@ $(objs) - -clean: - rm -f $(objs) $(targ) - -install: $(targ) - if [ ! -d "$(DESTDIR)$(libdir)" ]; then mkdir -p "$(DESTDIR)$(libdir)"; fi && \ - $(INSTALL) -m 755 $(targ) "$(DESTDIR)$(libdir)" && \ - rm -f "$(DESTDIR)$(libdir)/$(libname)" && \ - ln -s "$(DESTDIR)$(libdir)/$(targ)" "$(DESTDIR)$(libdir)/$(libname)" - -distclean: clean -# Nothing for distclean - -uninstall: - rm -f "$(DESTDIR)$(libdir)/$(libname)" "$(DESTDIR)$(libdir)/$(targ)" && \ - files=`ls -A "$(DESTDIR)$(libdir)"` && \ - if [ -z "$$files" ]; then rmdir "$(DESTDIR)$(libdir)"; fi - - -