# HG changeset patch # User William Roberts # Date 1249378103 -3600 # Node ID d55eb581a87cc8c27e95a4b3f43a9b0d83f3684a # Parent 2fb8b9db1c869843bf431640c43230b8d986acd6 Move syborg baseport from old src/cedar/generic layout to baseport/syborg diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/armv5.mbc --- a/baseport/src/cedar/generic/base/syborg/armv5.mbc Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -SECTION_COMMANDS - -bldmake bldfiles armv5 -abld export - -abld makefile armv5 -abld reallyclean armv5 - -bldmake bldfiles armv5 -abld export - -abld makefile armv5 -abld library armv5 -abld -k target armv5 - -SECTION_DIRS -..\e32utils\group -..\e32 -..\e32\compsupp -..\f32\group -..\hal -..\syborg -..\domain\group - -..\e32\drivers\pbus\mmc\sdcard\sdcard3c -..\e32\drivers\pbus\mmc\sdcard\sdcard4c - -..\e32\drivers\usbho -..\e32\drivers\usbho\usbd - -..\e32\drivers\bsp -..\e32\drivers\debug -..\e32\drivers\ecomm -..\e32\drivers\esound -..\e32\drivers\ethernet -..\e32\drivers\locmedia -..\e32\drivers\media -..\e32\drivers\trace -..\e32\drivers\usbc -..\e32\euser -..\e32\ewsrv - -..\f32\estart -..\f32\etshell -..\f32\iso9660 -..\f32\ntfs -..\f32\scomp -..\f32\sfat -..\f32\sfat32 -..\f32\sftl -..\f32\slffs -..\f32\smassstorage -..\f32\srofs -..\f32\srom - -..\e32test\group -..\syborg\test diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/armv5test.mbc --- a/baseport/src/cedar/generic/base/syborg/armv5test.mbc Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -SECTION_COMMANDS - -bldmake bldfiles armv5 -abld export -abld test export - -abld makefile armv5 -abld test makefile armv5 -abld reallyclean armv5 -abld test reallyclean armv5 - -bldmake bldfiles armv5 -abld export - -abld makefile armv5 -abld test makefile armv5 -abld library armv5 -abld test library armv5 -abld -k target armv5 -abld test -k target armv5 - -SECTION_DIRS -..\e32test\group -..\syborg\test diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/base.iby --- a/baseport/src/cedar/generic/base/syborg/base.iby Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __BASE_IBY__ -#define __BASE_IBY__ - -REM Base operating system, including all assp-specific files - -#if defined(__MISA__) -#include -#elif defined(__MI920__) -#include -#elif defined(__NI1136__) -#include -#elif defined(__MCOT__) -#include -#elif defined(__TEMPLATE__) -#include -#elif defined(__MOMAP16XX_H2__) -#include -#elif defined(__MOMAP24XX_H4HRP__) -#include -#elif defined(__X86PCHRP__) -#include -#elif defined(__NE1_TB__) -#include -#elif defined(__SYBORG__) -#include -#endif - -#include - -file=ABI_DIR\DEBUG_DIR\EUSER_DLL \sys\bin\EUser.dll -file=ABI_DIR\DEBUG_DIR\RPIPE.DLL \sys\bin\rpipe.dll - -file=ABI_DIR\DEBUG_DIR\ektran.dll \sys\bin\EKTran.dll -file=ABI_DIR\DEBUG_DIR\HAL_DLL \sys\bin\Hal.dll - -#ifndef SYMBIAN_EXCLUDE_KEYMAP -file=ABI_DIR\DEBUG_DIR\KEYMAP_FILE.dll \sys\bin\EKData.dll -#endif //SYMBIAN_EXCLUDE_KEYMAP - -secondary=ABI_DIR\DEBUG_DIR\efile.exe \sys\bin\efile.exe FIXED HEAPMAX(0x40000) -file=ABI_DIR\DEBUG_DIR\efsrv.dll \sys\bin\EFSrv.dll - -#ifndef CUSTOM_ELOCAL -#ifdef WITH_FAT32 -file=ABI_DIR\DEBUG_DIR\efat32.fsy \sys\bin\ELocal.fsy -#else -file=ABI_DIR\DEBUG_DIR\elocal.fsy \sys\bin\ELocal.fsy -#endif -#endif - -#ifdef WITH_LFFS -file=ABI_DIR\DEBUG_DIR\elffs.fsy \sys\bin\ELffs.fsy -#endif - -#ifdef WITH_NAND -file=ABI_DIR\BUILD_DIR\nandftl.fxt \sys\bin\nandftl.fxt -file=ABI_DIR\BUILD_DIR\ecomp.fsy \sys\bin\ecomp.fsy -file=ABI_DIR\BUILD_DIR\erofs.fsy \sys\bin\erofs.fsy -#endif - -#ifdef WITH_NAND2 -file=ABI_DIR\BUILD_DIR\ecomp.fsy \sys\bin\ecomp.fsy -file=ABI_DIR\BUILD_DIR\erofs.fsy \sys\bin\erofs.fsy -#endif - -#ifdef WITH_ISO9660 -file=ABI_DIR\DEBUG_DIR\iso9660.fsy \sys\bin\Iso9660.fsy -#endif - -#ifdef WITH_NTFS -file=ABI_DIR\DEBUG_DIR\ntfs.fsy \sys\bin\Ntfs.fsy -#endif - -#ifdef WITH_MASS_STORAGE -file=ABI_DIR\DEBUG_DIR\msfs.fsy \sys\bin\msfs.fsy -#endif - -file=ABI_DIR\DEBUG_DIR\ESTART_EXE \sys\bin\EStart.exe HEAPMAX(0x10000) - -file=ABI_DIR\DEBUG_DIR\domainSrv.exe \sys\bin\domainSrv.exe -file=ABI_DIR\DEBUG_DIR\domainCli.dll \sys\bin\domainCli.dll -file=ABI_DIR\DEBUG_DIR\domainPolicy.dll \sys\bin\domainPolicy.dll - -#if defined(_NAND) || defined(_NAND2) -#if !defined PAGED_ROM || defined EFFICIENT_ROM_PAGING || defined CODE_PAGING_FROM_ROFS -REM Start of ROFS image -ROM_IMAGE[1] { -#endif -#endif - -#ifndef SYMBIAN_EXCLUDE_D_EXC -file=ABI_DIR\DEBUG_DIR\d_exc.exe \sys\bin\d_exc.exe -#endif //SYMBIAN_EXCLUDE_D_EXC - -#ifndef SYMBIAN_EXCLUDE_SCDV -file=ABI_DIR\DEBUG_DIR\SCDV_DLL \sys\bin\ScDv.dll -#endif // SYMBIAN_EXCLUDE_SCDV - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/bld.inf --- a/baseport/src/cedar/generic/base/syborg/bld.inf Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_PLATFORMS -ARMV5 - -PRJ_EXPORTS -syborg.oby \epoc32\rom\include\ // -base.iby \epoc32\rom\include\ // -rom\base_syborg.iby \epoc32\rom\include\ // -rom\header.iby \epoc32\rom\syborg\ // -rom\kernel.iby \epoc32\rom\syborg\ // -specific\syborg.cfg \epoc32\rom\syborg\ // -estart.txt \epoc32\rom\syborg\ // -trk_l1.ini \epoc32\data\Z\trk\trk_syborg.ini - -PRJ_EXTENSIONS -start extension base/genexec -option EXTRA_SRC_PATH $(TO_BLDINF)/../e32/kernel -end - -PRJ_MMPFILES -..\e32\kernel\ekern -..\e32\kernel\kc_exe -..\e32\kernel\exmoncommon -..\e32\drivers\medint\medint -..\f32\etshell\eshell -..\e32\drivers\trace\btracex -..\e32\euser\variant_euser - -// SYBORG components -kasyborg // Variant library -serial\serial // Serial / UART ports -fb\fb // Framebuffer -keyboard\keyboard // Keyboard -pointer\pointer // Pointer -monitor\monap // Crash Debugger output - -keymap\keymap // Key mapping library - -// platform device library - for flattened device tree (FDT) -svpplatform\fdt - -//Host Filesystem -svphostfs\svphostfs -svphostfs\svphostfsdriver -svphostfs\svphostfsstart -svphostfs\svphostfsy - -//Snap Device -svpsnapdriver\svpsnapdriver -svpsnapdriver\snapapp - -PRJ_EXTENSIONS -start extension base/config -option PREFIX _syborg_ -option HALPATH $(TO_BLDINF)/.. -option SOURCE $(TO_BLDINF)/hal -end - -PRJ_MMPFILES -hal\hal - -PRJ_EXTENSIONS -start extension base/bootstrap -option NAME _syborg_bootloader_bootrom -option MEMMODEL multiple -//option MEMMODEL flexible -//option MEMMODEL moving -option SOURCES syborg.s -option INCLUDES config.inc syborg.inc -option E32PATH $(TO_BLDINF)/.. -option EXTRA_INC_PATH $(TO_BLDINF)/bootstrap -option EXTRA_SRC_PATH $(TO_BLDINF)/bootstrap -end diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/bootstrap/syborg.inc --- a/baseport/src/cedar/generic/base/syborg/bootstrap/syborg.inc Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -;/* -;* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -;* 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: -;* Nokia Corporation - initial contribution. -;* -;* Contributors: -;* -;* Description: -;* -;*/ - -;--------------------------------------------------------------------------- -; Physical Addresses of Memory -;--------------------------------------------------------------------------- - -KHwRamBaseAddr EQU 0x00000000 -KHwRamSizeMb EQU 128 ; 128MB - -KHwNorFlashBaseAddr EQU 0x40000000 -KHwNorFlashSize EQU 0x04000000 ; 64MB -KHwNorFlashCodeSize EQU 0x02000000 ; 32MB for code, 32MB for LFFS - -;--------------------------------------------------------------------------- -; Physical Addresses of Peripherals -;--------------------------------------------------------------------------- - -KHwBaseRegisters EQU 0xC0000000 - -KHwBaseSic EQU KHwBaseRegisters + 0x00000 -KHwBaseRtc EQU KHwBaseRegisters + 0x01000 -KHwBaseTimer EQU KHwBaseRegisters + 0x02000 -KHwBaseKmiKeyboard EQU KHwBaseRegisters + 0x03000 -KHwBaseKmiPointer EQU KHwBaseRegisters + 0x04000 -KHwBaseClcd EQU KHwBaseRegisters + 0x05000 -KHwBaseUart0 EQU KHwBaseRegisters + 0x06000 -KHwBaseUart1 EQU KHwBaseRegisters + 0x07000 -KHwBaseUart2 EQU KHwBaseRegisters + 0x08000 -KHwBaseUart3 EQU KHwBaseRegisters + 0x09000 -KHwBaseHostFs EQU KHwBaseRegisters + 0x0a000 -KHwBaseSnap EQU KHwBaseRegisters + 0x0b000 -KHwBaseNet EQU KHwBaseRegisters + 0x0c000 -KHwBaseNand EQU KHwBaseRegisters + 0x0d000 -KHwBaseAudio EQU KHwBaseRegisters + 0x0e000 -KHwBasePlatform EQU KHwBaseRegisters + 0x0f000 -;----------------------------------------------------------------------------- -; Module linear bases -;----------------------------------------------------------------------------- - -; Register group linear separation: 4K -KHwLinSeparation EQU 0x1000 - -KHwLinBaseRegisters EQU KPrimaryIOBase - -KHwLinBaseSic EQU KHwLinBaseRegisters + 0x00*KHwLinSeparation -KHwLinBaseRtc EQU KHwLinBaseRegisters + 0x01*KHwLinSeparation -KHwLinBaseTimer EQU KHwLinBaseRegisters + 0x02*KHwLinSeparation -KHwLinBaseKmiKeyboard EQU KHwLinBaseRegisters + 0x03*KHwLinSeparation -KHwLinBaseKmiPointer EQU KHwLinBaseRegisters + 0x04*KHwLinSeparation -KHwLinBaseClcd EQU KHwLinBaseRegisters + 0x05*KHwLinSeparation -KHwLinBaseUart0 EQU KHwLinBaseRegisters + 0x06*KHwLinSeparation -KHwLinBaseUart1 EQU KHwLinBaseRegisters + 0x07*KHwLinSeparation -KHwLinBaseUart2 EQU KHwLinBaseRegisters + 0x08*KHwLinSeparation -KHwLinBaseUart3 EQU KHwLinBaseRegisters + 0x09*KHwLinSeparation -KHwLinBaseHostFs EQU KHwLinBaseRegisters + 0x0a*KHwLinSeparation -KHwLinBaseSnap EQU KHwLinBaseRegisters + 0x0b*KHwLinSeparation -KHwLinBaseNet EQU KHwLinBaseRegisters + 0x0c*KHwLinSeparation -KHwLinBaseNand EQU KHwLinBaseRegisters + 0x0d*KHwLinSeparation -KHwLinBaseAudio EQU KHwLinBaseRegisters + 0x0e*KHwLinSeparation -KHwLinBasePlatform EQU KHwLinBaseRegisters + 0x0f*KHwLinSeparation - - END diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/bootstrap/syborg.s --- a/baseport/src/cedar/generic/base/syborg/bootstrap/syborg.s Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,603 +0,0 @@ -;/* -;* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -;* 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: -;* Nokia Corporation - initial contribution. -;* -;* Contributors: -;* -;* Description: -;* -;*/ - - GBLL __VARIANT_S__ ; indicates that this is platform-specific code - GBLL __SYBORG_S__ ; indicates which source file this is - - INCLUDE bootcpu.inc - INCLUDE syborg.inc -; -;******************************************************************************* -; - IMPORT ResetEntry -; -;******************************************************************************* -; - AREA |Boot$$Code|, CODE, READONLY, ALIGN=6 -; -;******************************************************************************* -; Initialise Hardware -; Determine the hardware configuration -; Determine the reset reason. If it is wakeup from a low power mode, perform -; whatever reentry sequence is required and jump back to the kernel. -; Set up the memory controller so that at least some RAM is available -; Set R10 to point to the super page or to a temporary version of the super page -; with at least the following fields valid: -; iBootTable, iCodeBase, iActiveVariant, iCpuId -; Initialise the debug serial port -; -; Enter with: -; R12 points to TRomHeader -; NO STACK -; R14 = return address (as usual) -; -; All registers may be modified by this call -;******************************************************************************* - EXPORT InitialiseHardware -InitialiseHardware ROUT - mov r13, lr ; save return address - - adrl r1, ParameterTable ; pass address of parameter table - bl InitCpu ; initialise CPU/MMU registers - -;******************************************************************************* -; DoInitialise Hardware -; Initialise CPU registers -; Determine the hardware configuration -; Determine the reset reason. If it is wakeup from a low power mode, perform -; whatever reentry sequence is required and jump back to the kernel. -; Set up the memory controller so that at least some RAM is available -; Set R10 to point to the super page or to a temporary version of the super page -; with at least the following fields valid: -; iBootTable, iCodeBase, iActiveVariant, iCpuId -; In debug builds initialise the debug serial port -; -; Enter with: -; R12 points to TRomHeader -; NO STACK -; R13 = return address (as usual) -; -; All registers may be modified by this call -;******************************************************************************* -DoInitialiseHardware ROUT - -; Hardware memory size is 128MB - 32MB reserved for bootloader - mov r4, #KHwRamSizeMb - - bl InitDebugPort - - ldr r7, =CFG_HWVD ; variant number - - lsl r10, r4, #20 ; R10 = top of RAM - sub r10, #0x2000 ; put super page at end for now - -; Set up the required super page values - str r7, [r10, #SSuperPageBase_iActiveVariant] - - mov r1, #0 - str r1, [r10, #SSuperPageBase_iHwStartupReason] ; reset reason (from hardware) - - add r1, r10, #CpuPageOffset - str r1, [r10, #SSuperPageBase_iMachineData] - bl GetBootTableAddress - str r0, [r10, #SSuperPageBase_iBootTable] ; set the boot function table - str r12, [r10, #SSuperPageBase_iCodeBase] ; set the base address of bootstrap code - mrc p15, 0, r0, c0, c0, 0 ; read CPU ID from CP15 (remove if no CP15) - str r0, [r10, #SSuperPageBase_iCpuId] - - mov r0, r13 - add sp, r10, #CpuBootStackTop ; set up a boot stack - push {r0} ; save return address - bl DoInitHw2 ; any extra CPU-dependent stuff - - ldr r7, [r10, #SSuperPageBase_iActiveVariant] - DWORD r7, "ActiveVariant" - - pop {pc} ; return - -;******************************************************************************* -DoInitHw2 ROUT - mrc p15, 0, r0, c0, c0, 0 - DWORD r0, "MMUID" - mrc p15, 0, r0, c0, c0, 1 - DWORD r0, "CacheType" - mrc p15, 0, r0, c0, c0, 2 - DWORD r0, "TCMType" - mrc p15, 0, r0, c0, c0, 3 - DWORD r0, "TLBType" - bx lr - -;******************************************************************************* -; Get a pointer to the list of hardware banks -; -; The pointer returned should point to a list of hardware banks declared with -; the HW_MAPPING and/or HW_MAPPING_EXT macros. A zero word terminates the list. -; For the direct memory model, all hardware on the system should be mapped here -; and the mapping will set linear address = physical address. -; For the moving or multiple model, only the hardware required to boot the kernel -; and do debug tracing needs to be mapped here. The linear addresses used will -; start at KPrimaryIOBase and step up as required with the order of banks in -; the list being maintained in the linear addresses used. -; -; HW_MAPPING PB, SIZE, MULT -; This declares a block of I/O with physical base PB and address range SIZE -; blocks each of which has a size determined by MULT. The page size used for -; the mapping is determined by MULT. The linear address base of the mapping -; will be the next free linear address rounded up to the size specified by -; MULT. -; The permissions used for the mapping are the standard I/O permissions (BTP_Hw). -; -; HW_MAPPING_EXT PB, SIZE, MULT -; This declares a block of I/O with physical base PB and address range SIZE -; blocks each of which has a size determined by MULT. The page size used for -; the mapping is determined by MULT. The linear address base of the mapping -; will be the next free linear address rounded up to the size specified by -; MULT. -; The permissions used for the mapping are determined by a BTP_ENTRY macro -; immediately following this macro in the HW bank list or by a DCD directive -; specifying a different standard permission type. -; -; Configurations without an MMU need not implement this function. -; -; Enter with : -; R10 points to super page -; R12 points to ROM header -; R13 points to valid stack -; -; Leave with : -; R0 = pointer -; Nothing else modified -;******************************************************************************* - EXPORT GetHwBanks -GetHwBanks ROUT - adr r0, %FT1 - bx lr -1 - HW_MAPPING KHwBaseSic, 1, HW_MULT_4K - HW_MAPPING KHwBaseRtc, 1, HW_MULT_4K - HW_MAPPING KHwBaseTimer, 1, HW_MULT_4K - HW_MAPPING KHwBaseKmiKeyboard, 1, HW_MULT_4K - HW_MAPPING KHwBaseKmiPointer, 1, HW_MULT_4K - HW_MAPPING KHwBaseClcd, 1, HW_MULT_4K - HW_MAPPING KHwBaseUart0, 1, HW_MULT_4K - HW_MAPPING KHwBaseUart1, 1, HW_MULT_4K - HW_MAPPING KHwBaseUart2, 1, HW_MULT_4K - HW_MAPPING KHwBaseUart3, 1, HW_MULT_4K - HW_MAPPING KHwBaseHostFs, 1, HW_MULT_4K - HW_MAPPING KHwBaseSnap, 1, HW_MULT_4K - HW_MAPPING KHwBaseNet, 1, HW_MULT_4K - HW_MAPPING KHwBaseNand, 1, HW_MULT_4K - HW_MAPPING KHwBaseAudio, 1, HW_MULT_4K - HW_MAPPING KHwBasePlatform, 8, HW_MULT_4K - - DCD 0 ; terminator - -;******************************************************************************* -; Notify an unrecoverable error during the boot process -; -; Enter with: -; R14 = address at which fault detected -; -; Don't return -;******************************************************************************* - EXPORT Fault -Fault ROUT - b BasicFaultHandler ; generic handler dumps registers via debug - ; serial port - -;******************************************************************************* -; Reboot the system -; -; Enter with: -; R0 = reboot reason code -; -; Don't return (of course) -;******************************************************************************* - ALIGN 32, 0 - EXPORT RestartEntry -RestartEntry ROUT - -; Save R0 parameter in HW dependent register which is preserved over reset -; Put HW specific code here to reset system - GETCPSR r1 - orr r1, #0xC0 - SETCPSR r1 ; disable interrupts - - ldr r10, =KSuperPageLinAddr - adr r0, Run_Physical - bl RomLinearToPhysical ; physical address in r0 - -; Disable MMU - mrc p15, 0, r1, c1, c0, 0 ; get MMUCR - bic r1, #MMUCR_M ; clear M bit - mcr p15, 0, r1, c1, c0, 0 ; set MMUCR - bx r0 ; jump to the physical address - -; Now running from physical address - -Run_Physical - mov r3, #KHwNorFlashBaseAddr ; r3 = NOR flash image base - -; Jump to the NOR flash image - bx r3 - -;******************************************************************************* -; Get a pointer to the list of RAM banks -; -; The pointer returned should point to a list of {BASE; MAXSIZE;} pairs, where -; BASE is the physical base address of the bank and MAXSIZE is the maximum -; amount of RAM which may be present in that bank. MAXSIZE should be a power of -; 2 and BASE should be a multiple of MAXSIZE. The generic code will examine the -; specified range of addresses and determine the actual amount of RAM if any -; present in the bank. The list is terminated by an entry with zero size. -; -; The pointer returned will usually be to constant data, but could equally well -; point to RAM if dynamic determination of the list is required. -; -; Enter with : -; R10 points to super page -; R12 points to ROM header -; R13 points to valid stack -; -; Leave with : -; R0 = pointer -; Nothing else modified -;******************************************************************************* - EXPORT GetRamBanks -GetRamBanks ROUT - push {r1-r3,lr} - mov r0, #KHwRamSizeMb - lsl r2, r0, #20 ; R2 = RAM size in bytes - mov r1, #KHwRamBaseAddr ; R1 = base address of usable RAM area - sub r2, r1 ; R2 = size of usable RAM area - orr r1, #RAM_VERBATIM ; prevent testing (overlay would break it) - mov r3, #0 - mov lr, #0 ; terminator - add r0, r10, #CpuPageOffset ; - stm r0, {r1-r3,lr} ; store single bank descriptor and terminator - pop {r1-r3,pc} - -;******************************************************************************* -; Get a pointer to the list of ROM banks -; -; The pointer returned should point to a list of entries of SRomBank structures, -; usually declared with the ROM_BANK macro. -; The list is terminated by a zero size entry (four zero words) -; -; ROM_BANK PB, SIZE, LB, W, T, RS, SS -; PB = physical base address of bank -; SIZE = size of bank -; LB = linear base if override required - usually set this to 0 -; W = bus width (ROM_WIDTH_8, ROM_WIDTH_16, ROM_WIDTH_32) -; T = type (see TRomType enum in kernboot.h) -; RS = random speed -; SS = sequential speed -; -; Only PB, SIZE, LB are used by the rest of the bootstrap. -; The information given here can be modified by the SetupRomBank call, if -; dynamic detection and sizing of ROMs is required. -; -; Enter with : -; R10 points to super page -; R12 points to ROM header -; R13 points to valid stack -; -; Leave with : -; R0 = pointer -; Nothing else modified -;******************************************************************************* - EXPORT GetRomBanks -GetRomBanks ROUT - adr r0, RomBanksFlashTable ; NOR flash - bx lr - -RomBanksFlashTable - ROM_BANK KHwNorFlashBaseAddr, KHwNorFlashCodeSize, 0, ROM_WIDTH_32, ERomTypeXIPFlash, 0, 0 - DCD 0,0,0,0 ; terminator - -;******************************************************************************* -; Set up RAM bank -; -; Do any additional RAM controller initialisation for each RAM bank which wasn't -; done by InitialiseHardware. -; Called twice for each RAM bank :- -; First with R3 = 0xFFFFFFFF before bank has been probed -; Then, if RAM is present, with R3 indicating validity of each byte lane, ie -; R3 bit 0=1 if D0-7 are valid, bit1=1 if D8-15 are valid etc. -; For each call R1 specifies the bank physical base address. -; -; Enter with : -; R10 points to super page -; R12 points to ROM header -; R13 points to stack -; R1 = physical base address of bank -; R3 = width (bottom 4 bits indicate validity of byte lanes) -; 0xffffffff = preliminary initialise -; -; Leave with : -; No registers modified -;******************************************************************************* - EXPORT SetupRamBank -SetupRamBank ROUT - bx lr - -;******************************************************************************* -; Set up ROM bank -; -; Do any required autodetection and autosizing of ROMs and any additional memory -; controller initialisation for each ROM bank which wasn't done by -; InitialiseHardware. -; -; The first time this function is called R11=0 and R0 points to the list of -; ROM banks returned by the BTF_RomBanks call. This allows any preliminary setup -; before autodetection begins. -; -; This function is subsequently called once for each ROM bank with R11 pointing -; to the current information held about that ROM bank (SRomBank structure). -; The structure pointed to by R11 should be updated with the size and width -; determined. The size should be set to zero if there is no ROM present in the -; bank. -; -; Enter with : -; R10 points to super page -; R12 points to ROM header -; R13 points to stack -; R11 points to SRomBank info for this bank -; R11 = 0 for preliminary initialise (all banks) -; -; Leave with : -; Update SRomBank info with detected size/width -; Set the size field to 0 if the ROM bank is absent -; Can modify R0-R4 but not other registers -; -;******************************************************************************* - EXPORT SetupRomBank -SetupRomBank ROUT ; only get here if running from ROM - cmp r11, #0 - bxeq lr ; don't do anything for preliminary - ldm r11, {r0,r1} ; r0 = base, r1 = size - lsr r0, pc, #20 - lsl r0, #20 ; r0 = image base - ldr r1, [r12, #TRomHeader_iRomSize] ; r1 = size of ROM block - stm r11, {r0,r1} - bx lr - -;******************************************************************************* -; Reserve physical memory -; -; Reserve any physical RAM needed for platform-specific purposes before the -; bootstrap begins allocating RAM for page tables/kernel data etc. -; -; There are two methods for this: -; 1. The function ExciseRamArea may be used. This will remove a contiguous -; region of physical RAM from the RAM bank list. That region will never -; again be identified as RAM. -; 2. A list of excluded physical address ranges may be written at [R11]. -; This should be a list of (base,size) pairs terminated by a (0,0) entry. -; This RAM will still be identified as RAM by the kernel but will not -; be allocated by the bootstrap and will subsequently be marked as -; allocated by the kernel immediately after boot. -; -; Enter with : -; R10 points to super page -; R11 indicates where preallocated RAM list should be written. -; R12 points to ROM header -; R13 points to stack -; -; Leave with : -; R0-R3 may be modified. Other registers should be preserved. -;******************************************************************************* - EXPORT ReservePhysicalMemory -ReservePhysicalMemory ROUT - bx lr - -;******************************************************************************* -; Do final platform-specific initialisation before booting the kernel -; -; Typical uses for this call would be: -; 1. Mapping cache flushing areas -; 2. Setting up pointers to routines in the bootstrap which are used by -; the variant or drivers (eg idle code). -; -; Enter with : -; R10 points to super page -; R11 points to TRomImageHeader for the kernel -; R12 points to ROM header -; R13 points to stack -; -; Leave with : -; R0-R9 may be modified. Other registers should be preserved. -; -;******************************************************************************* - EXPORT FinalInitialise -FinalInitialise ROUT - bx lr - -;******************************************************************************* -; Debug port write routine associated with debug port in the super page -; Enter with : -; R0 character to be written -; R12 points to rom header -; R13 points to valid stack -; -; Leave with : -; nothing modified -;******************************************************************************* - EXPORT DoWriteC -DoWriteC ROUT - IF CFG_DebugBootRom - push {r1,lr} - bl GetDebugPortBase ; r1 = base address of UART registers - - str r0, [r1, #4] ; Store to data register - - pop {r1,pc} - ELSE - bx lr - ENDIF - -;******************************************************************************* -; Initialise the debug port -; -; Enter with : -; R12 points to ROM header -; There is no valid stack -; -; Leave with : -; R0-R2 modified -; Other registers unmodified -;******************************************************************************* -InitDebugPort ROUT - GET_ADDRESS r1, KHwBaseUart0, KHwLinBaseUart0 - ldr r0,[r1, #0] - bx lr - -;******************************************************************************* -; Get the base address of the debug UART -; -; Enter with : -; R12 points to ROM header -; There may be no stack -; -; Leave with : -; R1 = base address of port, 0 for JTAG -; Z flag set for JTAG, clear for non-JTAG -; No other registers modified -;******************************************************************************* -GetDebugPortBase ROUT - ldr r1, [r12, #TRomHeader_iDebugPort] - cmp r1, #42 ; JTAG? - movseq r1, #0 - bxeq lr ; yes - return 0 and set Z - cmp r1, #1 - blo GetUartPort0 - beq GetUartPort1 - cmp r1, #3 - blo GetUartPort2 - beq GetUartPort3 -GetUartPort0 - GET_ADDRESS r1, KHwBaseUart0, KHwLinBaseUart0 - movs r1, r1 ; clear Z - bx lr - -GetUartPort1 - GET_ADDRESS r1, KHwBaseUart1, KHwLinBaseUart1 - movs r1, r1 ; clear Z - bx lr - -GetUartPort2 - GET_ADDRESS r1, KHwBaseUart2, KHwLinBaseUart2 - movs r1, r1 ; clear Z - bx lr - -GetUartPort3 - GET_ADDRESS r1, KHwBaseUart3, KHwLinBaseUart3 - movs r1, r1 ; clear Z - bx lr - -;******************************************************************************* -; Return parameter specified by R0 (see TBootParam enum) -; -; Enter with : -; R0 = parameter number -; -; Leave with : -; If parameter value is supplied, R0 = value and N flag clear -; If parameter value is not supplied, N flag set. In this case the -; parameter may be defaulted or the system may fault. -; R0, R1 modified. No other registers modified. -; -;******************************************************************************* -GetParameters ROUT - adr r1, ParameterTable - b FindParameter - -ParameterTable - DCD -1 ; terminator - -;******************************************************************************* -; BOOT FUNCTION TABLE -;******************************************************************************* -GetBootTableAddress ROUT - adr r0, SyborgBootTable - bx lr - -SyborgBootTable - DCD DoWriteC ; output a debug character - DCD GetRamBanks ; get list of RAM banks - DCD SetupRamBank ; set up a RAM bank - DCD GetRomBanks ; get list of ROM banks - DCD SetupRomBank ; set up a ROM bank - DCD GetHwBanks ; get list of HW banks - DCD ReservePhysicalMemory ; reserve physical RAM if required - DCD GetParameters ; get addresses for direct memory model - DCD FinalInitialise ; Final initialisation before booting the kernel - DCD HandleAllocRequest ; allocate memory (usually in generic code) - DCD GetPdeValue ; usually in generic code - DCD GetPteValue ; usually in generic code - DCD PageTableUpdate ; usually in generic code - DCD EnableMmu ; Enable the MMU (usually in generic code) - -; These entries specify the standard MMU permissions for various areas - - IF CFG_MMMultiple -; IF CFG_MMFlexible - IF CFG_ARMV7 - BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, MEMORY_FULLY_CACHED, 1, 1, 0, 0 ; ROM - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; kernel data/stack/heap - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; super page/CPU page - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; page directory/tables - BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, MEMORY_FULLY_CACHED, 1, 1, 0, 0 ; exception vectors - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_STRONGLY_ORDERED, 0, 1, 0, 0 ; hardware registers - DCD 0 ; unused (minicache flush) - DCD 0 ; unused (maincache flush) - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; page table info - BTP_ENTRY CLIENT_DOMAIN, PERM_RWRW, MEMORY_FULLY_CACHED, 1, 1, 0, 0 ; user RAM - BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, MEMORY_STRONGLY_ORDERED, 1, 1, 0, 0 ; temporary identity mapping - BTP_ENTRY CLIENT_DOMAIN, UNC_PERM, MEMORY_STRONGLY_ORDERED, 0, 1, 0, 0 ; uncached - ENDIF - IF CFG_ARMV6 - BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_WBWA, 1, 1, 0, 0 ; ROM - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; kernel data/stack/heap - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; super page/CPU page - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; page directory/tables - BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, CACHE_WTRA, 1, 1, 0, 0 ; exception vectors - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_SO, 0, 1, 0, 0 ; hardware registers - DCD 0 ; unused (minicache flush) - DCD 0 ; unused (maincache flush) - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; page table info - BTP_ENTRY CLIENT_DOMAIN, PERM_RWRW, CACHE_WBWA, 1, 1, 0, 0 ; user RAM - BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, CACHE_SO, 1, 1, 0, 0 ; temporary identity mapping - BTP_ENTRY CLIENT_DOMAIN, UNC_PERM, CACHE_SO, 0, 1, 0, 0 ; uncached - ENDIF - ENDIF - IF CFG_MMMoving - BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_WT ; ROM - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WB ; kernel data/stack/heap - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WB ; super page/CPU page - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WT ; page directory/tables - BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_WT ; exception vectors - BTP_ENTRY CLIENT_DOMAIN, PERM_RWRO, CACHE_NCNB ; hardware registers - DCD 0 ; unused (minicache flush) - DCD 0 ; unused (maincache flush) - BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WB ; page table info - BTP_ENTRY CLIENT_DOMAIN, PERM_RWRW, CACHE_WB ; user RAM - BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_NCNB ; temporary identity mapping - BTP_ENTRY CLIENT_DOMAIN, UNC_PERM, CACHE_NCNB ; uncached - ENDIF - - END diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/config.inc --- a/baseport/src/cedar/generic/base/syborg/config.inc Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -;/* -;* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -;* 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: -;* Nokia Corporation - initial contribution. -;* -;* Contributors: -;* -;* Description: -;* -;*/ - -; Include to enable tracing -; GBLL CFG_DebugBootRom - -; Include one of these to select the CPU -; GBLL CFG_CPU_ARM926J -; GBLL CFG_CPU_ARM1136 - GBLL CFG_CPU_CORTEX_A8N -; GBLL CFG_CPU_ARM1136_ERRATUM_399234_FIXED -; GBLL CFG_CPU_ARM1136_ERRATUM_411920_FIXED -; Include the following lines if this is a bootloader bootstrap -; GBLL CFG_BootLoader - -; If you want to supply a custom set of initial vectors (including reset vector) include the following line -; GBLL CFG_CustomVectors -; -; and provide a custom_vectors.inc file - -; On ARM architecture 6 processors, include the following line to override the threshold -; on total physical RAM size at which the multiple memory model switches into large address space mode -; i.e. size>threshold -> 2Gb per process, size<=threshold -> 1Gb per process -; Defaults to 32Mb. -; INIT_NUMERIC_CONSTANT CFG_ARMV6_LARGE_CONFIG_THRESHOLD, - -; For the direct memory model only, include the following line if you wish the exception vectors at the -; start of the bootstrap to be used at all times. This is only relevant if an MMU is present - this option -; is mandatory if not. -; GBLL CFG_UseBootstrapVectors -; -; If the above option is in use (including if no MMU is present) the following symbol should be defined -; to specify the offset from the bootstrap to the kernel image. -; INIT_NUMERIC_CONSTANT KernelCodeOffset, 0x4000 - -; Include the following line if you wish to include the ROM autodetection code based on data bus -; capacitance and image repeats. -; GBLL CFG_AutoDetectROM - -; Include the following line to minimise the initial kernel heap size -; On the direct memory model the size of the kernel data area (super page to end of kernel heap) -; is rounded up to the next 1Mb if this is not included, 4K if it is. -; On the moving and multiple models, the size of the initial kernel heap area is rounded up to -; the next 64K if this is not included, 4K if it is. -; GBLL CFG_MinimiseKernelHeap - -; On the moving or multiple memory models, include either or both of the following lines to -; specify the size of the initial kernel heap -; INIT_NUMERIC_CONSTANT CFG_KernelHeapMultiplier, -; INIT_NUMERIC_CONSTANT CFG_KernelHeapBaseSize, -; -; The initial kernel heap size is MAX( + * N / 16, value specified in ROMBUILD ) -; where N is the total physical RAM size in pages. -; defaults to 24K and defaults to 9*16 (ie 9 bytes per page). - -; Specific stuff for integrator -; GBLL CFG_Integrator_DontSetClock - INIT_NUMERIC_CONSTANT CFG_HWVD, 0x0B0A0001 - -; Copy NOR Flash image to SDRAM - GBLL CFG_CopyFlashToRam - - - END diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/eabi/kasyborg.def --- a/baseport/src/cedar/generic/base/syborg/eabi/kasyborg.def Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -EXPORTS - _Z17VariantInitialisev @ 1 NONAME - _Z14AsicInitialisev @ 2 NONAME - _ZN6Syborg11DebugOutputEj @ 3 NONAME - _ZN6Syborg12MsTickPeriodEv @ 4 NONAME - _ZN6Syborg13StartupReasonEv @ 5 NONAME - _ZN6Syborg27SystemTimeInSecondsFrom2000ERi @ 6 NONAME - _ZN6Syborg30SetSystemTimeInSecondsFrom2000Ei @ 7 NONAME - _ZN6Syborg5Init1Ev @ 8 NONAME - _ZN6Syborg5Init3Ev @ 9 NONAME - _ZN6Syborg9DebugInitEv @ 10 NONAME - _ZN6SyborgC1Ev @ 11 NONAME - _ZN6SyborgC2Ev @ 12 NONAME - _ZN7TSyborg10DisableIntEj @ 13 NONAME - _ZN7TSyborg10TimerValueEj @ 14 NONAME - _ZN7TSyborg11EnableTimerEjNS_6TStateE @ 15 NONAME - _ZN7TSyborg12SetTimerLoadEjm @ 16 NONAME - _ZN7TSyborg12SetTimerModeEjNS_10TTimerModeE @ 17 NONAME - _ZN7TSyborg12VideoRamPhysEv @ 18 NONAME - _ZN7TSyborg12VideoRamSizeEv @ 19 NONAME - _ZN7TSyborg13ClearTimerIntEj @ 20 NONAME - _ZN7TSyborg13DebugPortAddrEv @ 21 NONAME - _ZN7TSyborg14IsTimerEnabledEj @ 22 NONAME - _ZN7TSyborg16MarkDebugPortOffEv @ 23 NONAME - _ZN7TSyborg18VideoRamPhysSecureEv @ 24 NONAME - _ZN7TSyborg20EnableTimerInterruptEj @ 25 NONAME - _ZN7TSyborg21DisableTimerInterruptEj @ 26 NONAME - _ZN7TSyborg9EnableIntEj @ 27 NONAME - _ZN7TSyborg9TimerLoadEj @ 28 NONAME - _ZN7TSyborg9TimerModeEj @ 29 NONAME - _ZN9Interrupt11SetPriorityEii @ 30 NONAME - _ZN9Interrupt4BindEiPFvPvES0_ @ 31 NONAME - _ZN9Interrupt5ClearEi @ 32 NONAME - _ZN9Interrupt6EnableEi @ 33 NONAME - _ZN9Interrupt6UnbindEi @ 34 NONAME - _ZN9Interrupt7DisableEi @ 35 NONAME - _ZTI6Syborg @ 36 NONAME - _ZTV6Syborg @ 37 NONAME - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/estart.txt --- a/baseport/src/cedar/generic/base/syborg/estart.txt Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -C: 0 ELOCAL FAT 0 FS_FORMAT_COLD,FS_SYNC_DRIVE # IRAM diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/ethernet/pdd/enet.mmp --- a/baseport/src/cedar/generic/base/syborg/ethernet/pdd/enet.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "kernel\kern_ext.mmh" - -TARGET VariantTarget(ethernet,pdd) -TARGETTYPE pdd -ROMTARGET ethernet.pdd - -SYSTEMINCLUDE \epoc32\include\drivers -SYSTEMINCLUDE AsspNKernIncludePath -SOURCEPATH . - -SOURCE ethernet.cpp ethernet_device.cpp - -LIBRARY PlatformLib - -UID 0x100039d0 0x1000015c -VENDORID 0x70000001 - -CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/ethernet/pdd/ethernet.cpp --- a/baseport/src/cedar/generic/base/syborg/ethernet/pdd/ethernet.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "ethernet_device.h" - -#pragma diag_suppress 1441 - -_LIT(KEthPddName, "Ethernet.Syborg"); - -// needs ldd version.. -const TInt KMinimumLddMajorVersion = 1; -const TInt KMinimumLddMinorVersion = 0; -const TInt KMinimumLddBuild = 122; - -// -// Class to identify the driver as PDD -// -class DDriverEthernet : public DPhysicalDevice -{ -public: - DDriverEthernet(); - - // - // Functions that we must implement as we are inheriting from abstract base class - // - virtual TInt Install(); - virtual void GetCaps(TDes8 &aDes) const; - virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); - virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); -}; - -////////////////////////////////////////// -// Implementation of DDriverEthernet class -////////////////////////////////////////// - -DDriverEthernet::DDriverEthernet() -{ - DP("** (PDD) DDriverEthernet::DDriverEthernet()"); - __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::DDriverEthernet()")); - - iUnitsMask=0x1; - iVersion=TVersion(KEthernetMajorVersionNumber, - KEthernetMinorVersionNumber, - KEthernetBuildVersionNumber); -} - -TInt DDriverEthernet::Install() -{ - DP("** (PDD) DDriverEthernet::Install()"); - __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Install()")); - - return SetName(&KEthPddName); -} - -void DDriverEthernet::GetCaps(TDes8 &aDes) const -{ - DP("** (PDD) DDriverEthernet::GetCaps"); - __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::GetCaps")); - - TEthernetCaps capsBuf; - - aDes.FillZ(aDes.MaxLength()); - aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength())); -} - -TInt DDriverEthernet::Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) -{ - DP("** (PDD) DDriverEthernet::Create"); - __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Create")); - - TInt r = KErrNoMemory; - - EthernetDevice *VirtioEthernet = new EthernetDevice; - if(VirtioEthernet) - { - DP("** (PDD) DDriverEthernet:: EthernetDevice created successfully"); - r = VirtioEthernet->DoCreate(aUnit, anInfo); - } - aChannel = VirtioEthernet; - return r; -} - -TInt DDriverEthernet::Validate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) -{ - DP("** (PDD) DDriverEthernet::Validate"); - __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Validate")); - - if((!Kern::QueryVersionSupported(iVersion,aVer)) || - (!Kern::QueryVersionSupported(aVer,TVersion(KMinimumLddMajorVersion, - KMinimumLddMinorVersion, - KMinimumLddBuild)))) - { - return KErrNotSupported; - } - if(aUnit != 0) - { - return KErrNotSupported; - } - return KErrNone; -} - -DECLARE_STANDARD_PDD() -{ - DP("** (DPhysicalDevice) Ethernet PDD Factory created"); - return new DDriverEthernet; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/ethernet/pdd/ethernet_device.cpp --- a/baseport/src/cedar/generic/base/syborg/ethernet/pdd/ethernet_device.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,411 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "ethernet_device.h" - -// Constants specific to this file -const TInt K1000mSecDelay = 1000; - -///////////////////////////////////////// -// Implementation of EthernetDevice class -///////////////////////////////////////// - -EthernetDevice::EthernetDevice() : iRxDfc(RxDfc, this) -{ - DP("** (PDD) EthernetDevice()"); - - iInterruptId=-1; - iCreated = FALSE; - iStarted = FALSE; - iRxDfc.SetDfcQ(Kern::DfcQue0()); -} - -EthernetDevice::~EthernetDevice() -{ - DP("** (PDD) ~EthernetDevice()"); - DP("** (PDD) ~EthernetDevice Unbind Interrupt"); - Interrupt::Unbind(EIntNet0); -} - -void EthernetDevice::GetConfig(TEthernetConfigV01 &aConfig) const -{ - DP("** (PDD) EthernetDevice::GetConfig"); - aConfig = iDefaultConfig; -} - -TInt EthernetDevice::ValidateConfig(const TEthernetConfigV01 &aConfig) const -{ - DP("** (PDD) EthernetDevice::ValidateConfig"); - - switch(aConfig.iEthSpeed) - { - case KEthSpeedUnknown: - return KErrNotSupported; - default: - break; - } - - switch(aConfig.iEthDuplex) - { - case KEthDuplexUnknown: - return KErrNotSupported; - default: - break; - } - - return KErrNone; -} - -void EthernetDevice::Caps(TDes8 &aCaps) const -{ - DP("** (PDD) EthernetDevice::Caps"); - TEthernetCaps capsBuf; - - aCaps.FillZ(aCaps.MaxLength()); - aCaps=capsBuf.Left(Min(capsBuf.Length(),aCaps.MaxLength())); -} - -TDfcQue* EthernetDevice::DfcQ(TInt aUnit) -{ - DP("** (PDD) EthernetDevice::DfcQ"); - return Kern::DfcQue0(); -} - -TInt EthernetDevice::DisableIrqs() -{ - DP("** (PDD) EthernetDevice::DisableIrqs"); - return NKern::DisableInterrupts(1); -} - -void EthernetDevice::RestoreIrqs(TInt aLevel) -{ - DP("** (PDD) EthernetDevice::RestoreIrqs"); - NKern::RestoreInterrupts(aLevel); -} - -// -// Enable Ethernet interrupt line, allocate memory for Rx/Tx paths and send QEMU frames for Rx transmission. -// -TInt EthernetDevice::DoCreate(TInt aUnit, const TDesC8* anInfo) -{ - DP("** (PDD) Enter: EthernetDevice::DoCreate"); - - if(iCreated) - return KErrNone; - - // Bind to Ethernet interrupt - Interrupt::Bind(EIntNet0,Isr,this); - SetMacAddress(); - - DP("** (PDD) EthernetDevice::DoCreate - VNET[VIRTIO_STATUS]"); - - VNET[VIRTIO_STATUS] = VIRTIO_CONFIG_S_ACKNOWLEDGE - | VIRTIO_CONFIG_S_DRIVER; - - AllocRings(); - VNET[VIRTIO_STATUS] |= VIRTIO_CONFIG_S_DRIVER_OK; - AddRx(); - VNET[VIRTIO_INT_ENABLE] = 1; - - iCreated = TRUE; - - DP("** (PDD) Exit: EthernetDevice::DoCreate"); - - return KErrNone; -} - -TInt EthernetDevice::Start() -{ - DP("** (PDD) EthernetDevice::Start()"); - - if(iStarted) - return KErrNone; - - // wait for 1 sec as negotiation is going on... hopefully auto-neg completes by then - NKern::Sleep(K1000mSecDelay); - Interrupt::Enable(EIntNet0); - - iStarted = TRUE; - - return KErrNone; -} - -void EthernetDevice::Stop(TStopMode aMode) -{ - DP("** (PDD) EthernetDevice::Stop(TStopMode aMode)"); - - switch (aMode) - { - case EStopNormal: - case EStopEmergency: - iRxDfc.Cancel(); - //Should we disable QEMU interrupts here? - break; - default: - break; - } - - iStarted = FALSE; - Interrupt::Disable(EIntNet0); -} - -// -// Transmit Tx data to QEMU and increment iTxAvail idx counter to indicate to QEMU that a new frame is available. -// -TInt EthernetDevice::Send(TBuf8 &aBuffer) -{ - DP("** (PDD) EthernetDevice::Send"); - - TInt err = KErrNone; - TUint32 length = aBuffer.Length(); - iTxBuffer = aBuffer; - - DP ("** (PDD) Value of iTxAvail->idx = %d\n", iTxAvail->idx); - TInt ring_slot = iTxAvail->idx & (tx_ring_size - 1); - DP ("** (PDD) Value of ring_slot = %d\n", ring_slot); - - memset(&tx_header, 0, sizeof(tx_header)); - - iTxDesc[0].addr = Epoc::LinearToPhysical((TUint32)&tx_header); - iTxDesc[0].len = sizeof(tx_header); - iTxDesc[0].flags = VRING_DESC_F_NEXT; - iTxDesc[0].next = 1; - iTxDesc[1].addr = Epoc::LinearToPhysical((TUint32) iTxBuffer.Ptr()); - iTxDesc[1].len = length; - iTxDesc[1].flags = 0; - iTxAvail->ring[ring_slot] = 0; - - iTxAvail->idx++; - DP ("** (PDD)iTxAvail->idx = %x, rx_last_used=%d\n", iTxAvail->idx, rx_last_used); - - VNET[VIRTIO_QUEUE_NOTIFY] = TX_QUEUE; - - DP ("** (PDD) iTxDesc[0].addr = %x\n", iTxDesc[0].addr); - DP ("** (PDD) iTxDesc[0].len = %d\n", iTxDesc[0].len); - DP ("** (PDD) iTxDesc[0].flags = %d\n", iTxDesc[0].flags); - DP ("** (PDD) iTxDesc[0].next = %d\n", iTxDesc[0].next); - DP ("** (PDD) iTxDesc[1].addr = %x\n", iTxDesc[1].addr); - DP ("** (PDD) iTxDesc[1].len = %d\n", iTxDesc[1].len); - DP ("** (PDD) iTxDesc[1].flags = %d\n", iTxDesc[1].flags); - - return err; -} - -TInt EthernetDevice::ReceiveFrame(TBuf8 &aBuffer, - TBool okToUse) -{ - DP("** (PDD) EthernetDevice::ReceiveFrame"); - - //If no buffer available dump frame - if (!okToUse) - { - DP("** (PDD) EthernetDevice::ReceiveFrame - dumping frame"); - return KErrGeneral; - } - - aBuffer.Copy(iRxBuffer.Ptr(), ETHERNET_PAYLOAD_SIZE); - AddRx(); - - return KErrNone; -} - -void EthernetDevice::Isr(TAny* aPtr) -{ - DP("** (PDD) EthernetDevice::Isr(TAny* aPtr)"); - - Interrupt::Clear(EIntNet0); - VNET[VIRTIO_INT_STATUS] = 1; - EthernetDevice& d=*(EthernetDevice*)aPtr; - d.iRxDfc.Add(); -} - -void EthernetDevice::RxDfc(TAny* aPtr) -{ - DP("** (PDD) EthernetDevice::RxDfc"); - EthernetDevice& d=*(EthernetDevice*)aPtr; - - TInt x = VNET[VIRTIO_INT_STATUS]; - DP("** (PDD) EthernetDevice::RxDfc - value of x=%d", x); - - TInt ring_slot = d.iRxUsed->idx & (d.rx_ring_size - 1); - - DP("**(PDD) RxDfc (d.iTxAvail->idx) = %d (d.iRxAvail->idx) = %d", d.iTxAvail->idx, d.iRxAvail->idx); - DP("**(PDD) RxDfc (d.iRxUsed->idx) = %d ", d.iRxUsed->idx); - DP("**(PDD) RxDfc ring_slot=%d, (d.iRxUsed->ring[%d].id) = %d", ring_slot, ring_slot, d.iRxUsed->ring[ring_slot].id); - DP("**(PDD) RxDfc d.iRxDesc[1].next = %d", d.iRxDesc[1].next); - - //check to see if this is a Rx or Tx - if (d.iRxUsed->idx != d.rx_last_used) - { - DP("** (PDD) Received Rx Interrupt"); - d.rx_last_used++; - DP("** (PDD) Value of rx_last_used=%d", d.rx_last_used); - d.ReceiveIsr(); - } -} - -void EthernetDevice::MacConfigure(TEthernetConfigV01 &aConfig) -{ - DP("** (PDD) EthernetDevice::MacConfigure"); - - iDefaultConfig.iEthAddress[0] = aConfig.iEthAddress[0]; - iDefaultConfig.iEthAddress[1] = aConfig.iEthAddress[1]; - iDefaultConfig.iEthAddress[2] = aConfig.iEthAddress[2]; - iDefaultConfig.iEthAddress[3] = aConfig.iEthAddress[3]; - iDefaultConfig.iEthAddress[4] = aConfig.iEthAddress[4]; - iDefaultConfig.iEthAddress[5] = aConfig.iEthAddress[5]; - - DP ("** (PDD) macaddr %02x:%02x:%02x:%02x:%02x:%02x\n", - iDefaultConfig.iEthAddress[0], - iDefaultConfig.iEthAddress[1], - iDefaultConfig.iEthAddress[2], - iDefaultConfig.iEthAddress[3], - iDefaultConfig.iEthAddress[4], - iDefaultConfig.iEthAddress[5]); -} - -//Descriptor list and vring_used must start on a 4k page boundary. -TAny * EthernetDevice::AllocAligned(TUint16 size) -{ - DP("** (PDD) Enter: EthernetDevice::alloc_aligned"); - DP("** (PDD) size=%d",size); - - TAny * p = Kern::Alloc(size + 4095); - - DP("** (PDD) BEFORE: p=%x",p); - p = (TAny *)(((TUint32)p + 4095) & ~4095); - DP("** (PDD) AFTER: p=%x",p); - - DP("** (PDD) Exit: EthernetDevice::alloc_aligned"); - - return p; -} - -TAny EthernetDevice::AllocRings() -{ - DP("** (PDD) Enter: EthernetDevice::AllocRings"); - - TUint size; - TUint used_offset; - TUint32 p; - - VNET[VIRTIO_QUEUE_SEL] = TX_QUEUE; - tx_ring_size = VNET[VIRTIO_QUEUE_NUM]; - - DP ("** (PDD) tx_ring_size = %d\n", tx_ring_size); - - size = (tx_ring_size * (16 + 2)) + 4; - used_offset = (size + 4095) & ~1024; - DP ("** (PDD) used_offset = %d", used_offset); - size = used_offset + 4 + (tx_ring_size * 8); - DP ("** (PDD) size = %d", size); - - p = (TUint32)AllocAligned(size); - DP ("** (PDD) p = %x\n", p); - - VNET[VIRTIO_QUEUE_BASE] = Epoc::LinearToPhysical(p); - - iTxDesc = reinterpret_cast(p); - iTxAvail = reinterpret_cast(p + tx_ring_size * 16); - iTxUsed = reinterpret_cast(p + used_offset); - - DP ("** (PDD) iTxDesc = %x", iTxDesc); - DP ("** (PDD) iTxAvail = %x", iTxAvail); - DP ("** (PDD) iTxUsed = %x", iTxUsed); - - VNET[VIRTIO_QUEUE_SEL] = RX_QUEUE; - rx_ring_size = VNET[VIRTIO_QUEUE_NUM]; - - size = (rx_ring_size * (16 + 2)) + 4; - used_offset = (size + 4095) & ~4095; - size = used_offset + 4 + (rx_ring_size * 8); - p = (TUint32)AllocAligned(size); - DP ("** (PDD) p = %x\n", p); - VNET[VIRTIO_QUEUE_BASE] = Epoc::LinearToPhysical(p); - - iRxDesc = reinterpret_cast(p); - iRxAvail = reinterpret_cast(p + rx_ring_size * 16); - iRxUsed = reinterpret_cast(p + used_offset); - - DP ("** (PDD) iRxDesc = %x", iRxDesc); - DP ("** (PDD) iRxAvail = %x", iRxAvail); - DP ("** (PDD) iRxUsed = %x", iRxUsed); - - DP("** (PDD) Exit: EthernetDevice::AllocRings"); -} - -void EthernetDevice::AddRx() -{ - DP("** (PDD) Enter: EthernetDevice::AddRx"); - - TInt n = iRxAvail->idx & (rx_ring_size - 1); - memset(&rx_header, 0, sizeof(rx_header)); - iRxDesc[0].addr = Epoc::LinearToPhysical((TUint32)&rx_header); - iRxDesc[0].len = sizeof(rx_header); - iRxDesc[0].flags = VRING_DESC_F_NEXT | VRING_DESC_F_WRITE; - iRxDesc[0].next = 1; - iRxDesc[1].addr = Epoc::LinearToPhysical((TUint32) iRxBuffer.Ptr()); - iRxDesc[1].len = ETHERNET_PAYLOAD_SIZE; - iRxDesc[1].flags = VRING_DESC_F_WRITE; - iRxAvail->ring[n] = 0; - iRxAvail->idx++; - VNET[VIRTIO_QUEUE_NOTIFY] = RX_QUEUE; - - DP("** (PDD) Exit: EthernetDevice::AddRx"); -} - - - -void EthernetDevice::SetMacAddress(void) - { - DP("** (PDD) Enter: EthernetDevice::SetMacAddress"); - - iDefaultConfig.iEthAddress[0] = VNET_MAC[0]; - iDefaultConfig.iEthAddress[1] = VNET_MAC[1]; - iDefaultConfig.iEthAddress[2] = VNET_MAC[2]; - iDefaultConfig.iEthAddress[3] = VNET_MAC[3]; - iDefaultConfig.iEthAddress[4] = VNET_MAC[4]; - iDefaultConfig.iEthAddress[5] = VNET_MAC[5]; - - DP ("** (PDD) macaddr %02x:%02x:%02x:%02x:%02x:%02x\n", - iDefaultConfig.iEthAddress[0], - iDefaultConfig.iEthAddress[1], - iDefaultConfig.iEthAddress[2], - iDefaultConfig.iEthAddress[3], - iDefaultConfig.iEthAddress[4], - iDefaultConfig.iEthAddress[5]); - - DP("** (PDD) Exit: EthernetDevice::SetMacAddress"); - } - -// -// Functions that are just stubs -// - -void EthernetDevice::CheckConfig(TEthernetConfigV01& aConfig) -{ - DP("** (PDD) EthernetDevice::CheckConfig"); -} - -TInt EthernetDevice::Configure(TEthernetConfigV01 &aConfig) -{ - DP("** (PDD) EthernetDevice::Configure"); - return KErrNone; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/ethernet/pdd/ethernet_device.h --- a/baseport/src/cedar/generic/base/syborg/ethernet/pdd/ethernet_device.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Register definitions and base classes for Ethernet Virtio. -* -*/ - -#ifndef __QEMUETHERNET_ -#define __QEMUETHERNET_ - -#include -#include - -#define SVPDBG -#ifdef SVPDBG -#define DP(format...) Kern::Printf(format) -#else -#define DP(format...) -#endif - -#define ETHERNET_PAYLOAD_SIZE 1500 - -#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 -#define VIRTIO_CONFIG_S_DRIVER 2 -#define VIRTIO_CONFIG_S_DRIVER_OK 4 -#define VIRTIO_CONFIG_S_FAILED 0x80 - -/* This marks a buffer as continuing via the next field. */ -#define VRING_DESC_F_NEXT 1 -/* This marks a buffer as write-only (otherwise read-only). */ -#define VRING_DESC_F_WRITE 2 - -#define TX_QUEUE 1 -#define RX_QUEUE 0 - -#define VNET_MAC ((volatile TUint8 *)(0xc600c000 + 0x100)) -#define VNET ((volatile TUint32 *)0xc600c000) - -enum { - VIRTIO_ID = 0, - VIRTIO_DEVTYPE = 1, - VIRTIO_HOST_FEATURES = 2, - VIRTIO_GUEST_FEATURES = 3, - VIRTIO_QUEUE_BASE = 4, - VIRTIO_QUEUE_NUM = 5, - VIRTIO_QUEUE_SEL = 6, - VIRTIO_QUEUE_NOTIFY = 7, - VIRTIO_STATUS = 8, - VIRTIO_INT_ENABLE = 9, - VIRTIO_INT_STATUS = 10 -}; - -typedef struct -{ -#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset - TUint8 flags; -#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame -#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) -#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) -#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP -#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set - TUint8 gso_type; - TUint16 hdr_len; - TUint16 gso_size; - TUint16 csum_start; - TUint16 csum_offset; -} virtio_net_hdr; - -typedef struct -{ - TUint64 addr; - TUint32 len; - TUint16 flags; - TUint16 next; -} vring_desc; - -typedef struct -{ - TUint16 flags; - TUint16 idx; - TUint16 ring[16]; - -} vring_avail; - -typedef struct -{ - TUint16 flags; - TUint16 idx; - struct { - TUint32 id; - TUint32 len; - } ring[16]; -} vring_used; - - -// -// Class to identify the device as ethernet device for Symbian -// -class EthernetDevice : public DEthernet -{ -public: - EthernetDevice(); - ~EthernetDevice(); - TInt DoCreate(TInt aUnit, const TDesC8* anInfo); - static void Isr(TAny* aPtr); - - // - // Functions that we must implement as we are inheriting from abstract base class - // - virtual TInt Start(); - virtual void Stop(TStopMode aMode); - virtual void GetConfig(TEthernetConfigV01 &aConfig) const; - virtual TInt ValidateConfig(const TEthernetConfigV01 &aConfig) const; - virtual void CheckConfig(TEthernetConfigV01 &aConfig); - virtual TInt Configure(TEthernetConfigV01 &aConfig); - virtual void MacConfigure(TEthernetConfigV01 &aConfig); - virtual void Caps(TDes8 &aCaps) const; - virtual TInt DisableIrqs(); - virtual void RestoreIrqs(TInt aIrq); - virtual TDfcQue* DfcQ(TInt aUnit); - virtual TInt Send(TBuf8 &aBuffer); - virtual TInt ReceiveFrame(TBuf8 &aBuffer, TBool okToUse); - -private: - - TEthernetConfigV01 iDefaultConfig; - TInt iInterruptId; - TDfc iRxDfc; - TUint32 iCreated; - TUint32 iStarted; - - //Virtio structs for transmitting data to QEMU. - volatile vring_desc *iTxDesc; - volatile vring_avail *iTxAvail; - volatile vring_used *iTxUsed; - //Ring size hardcoded in QEMU. - TUint tx_ring_size; - - //Virtio structs for receiving data from QEMU. - volatile vring_desc *iRxDesc; - volatile vring_avail *iRxAvail; - volatile vring_used *iRxUsed; - - TUint rx_ring_size; - TUint rx_last_used; - - //Virtio packet header definitions. - virtio_net_hdr rx_header; - virtio_net_hdr tx_header; - - //Buffers for Rx/Tx transmission. - TBuf8 iTxBuffer; - TBuf8 iRxBuffer; - - static void RxDfc(TAny* aPtr); - - //QEMU specific member functions - void AllocRings(); - void* AllocAligned(TUint16 size); - void AddRx(); - void SetMacAddress(void); -}; - -#endif // __QEMUETHERNET_ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/ethernet/test/ethernet_test.cpp --- a/baseport/src/cedar/generic/base/syborg/ethernet/test/ethernet_test.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include - -LOCAL_D RTest test(_L("DRIVER1_TEST")); - -_LIT(KDriver1LddFileName,"enet"); -_LIT(KDriver1PddFileName,"ethernet"); - -_LIT8(KTestSendData,"abcdefghijklmnopqrstuvwxyz"); -_LIT8(KTestLargeSendData,"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); - -GLDEF_C TInt E32Main() - { - test.Title(); - - TInt r; - RDebug::Printf(">>>>>>E32Main()"); - - test.Start(_L("Load Physical Device")); - r=User::LoadPhysicalDevice(KDriver1PddFileName); - if (r != KErrNone) - RDebug::Printf("LoadPhysicalDevice: value of error =%d", r); - test(r==KErrNone || r==KErrAlreadyExists); - - test.Next(_L("Load Logical Device")); - r=User::LoadLogicalDevice(KDriver1LddFileName); - if (r != KErrNone) - RDebug::Printf("LoadLogicalDevice: value of error =%d", r); - test(r==KErrNone || r==KErrAlreadyExists); - - __KHEAP_MARK; - - test.Next(_L("Open Logical Channel")); - RBusDevEthernet ldd; - - r=ldd.Open(0); - RDebug::Printf("Value returned from ldd.Open()=%d", r); - test(r==KErrNone); - - test.Next(_L("SendData")); - TRequestStatus status; - ldd.Write(status,KTestSendData); - - test.Next(_L("SendDataCancel")); - ldd.WriteCancel(); - User::WaitForRequest(status); - r=status.Int(); - //test(r==KErrCancel); - - test.Next(_L("SendData")); - ldd.Write(status,KTestSendData); - User::WaitForRequest(status); - r=status.Int(); - //test(r==KErrNone); - - test.Next(_L("ReceiveData")); - TBuf8<256> buffer; - ldd.Read(status,buffer); - - test.Next(_L("ReceiveDataCancel")); - ldd.ReadCancel(); - User::WaitForRequest(status); - r=status.Int(); - test(r==KErrCancel); - - test.Next(_L("Close Logical Channel")); - ldd.Close(); - - __KHEAP_MARKEND; - - test.End(); - - return(0); - - } - - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/ethernet/test/ethernet_test.mmp --- a/baseport/src/cedar/generic/base/syborg/ethernet/test/ethernet_test.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -target ethernet_testapp.exe -targettype exe -source ethernet_test.cpp -library euser.lib -systeminclude /epoc32/include - -CAPABILITY all -tcb - -SMPSAFE diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/fb/fb.mmp --- a/baseport/src/cedar/generic/base/syborg/fb/fb.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "kernel\kern_ext.mmh" - -TARGET VariantTarget(lcd,dll) -TARGETTYPE kext - -SYSTEMINCLUDE AsspNKernIncludePath -SYSTEMINCLUDE . - -SOURCEPATH . -SOURCE syborg_fb.cpp - -LIBRARY PlatformLib - -EPOCALLOWDLLDATA - -UID 0x1000008d 0x100039e8 -VENDORID 0x70000001 - -ROMTARGET lcd.dll - -CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/fb/syborg_fb.cpp --- a/baseport/src/cedar/generic/base/syborg/fb/syborg_fb.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,487 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic frame buffer driver -* -*/ - -#include -#include "syborg_fb.h" - -TPhysAddr Syborg::VideoRamPhys; -TPhysAddr Syborg::VideoRamPhysSecure; // Secure display memory - -TPhysAddr TSyborg::VideoRamPhys() -{ - __KTRACE_OPT(KEXTENSION,Kern::Printf("TSyborg::VideoRamPhys: VideoRamPhys=0x%x", Syborg::VideoRamPhys)); - return Syborg::VideoRamPhys; -} - -TPhysAddr TSyborg::VideoRamPhysSecure() -{ - return Syborg::VideoRamPhysSecure; -} - -LOCAL_C TInt DoHalFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) -{ - DLcdPowerHandler* pH=(DLcdPowerHandler*)aPtr; - return pH->HalFunction(aFunction,a1,a2); -} - -static void rxMsg(TAny* aPtr) -{ - DLcdPowerHandler& h=*(DLcdPowerHandler*)aPtr; - TMessageBase* pM = h.iMsgQ.iMessage; - if(pM) - h.HandleMsg(pM); -} - -static void power_up_dfc(TAny* aPtr) -{ - ((DLcdPowerHandler*)aPtr)->PowerUpDfc(); -} - -void power_down_dfc(TAny* aPtr) -{ - ((DLcdPowerHandler*)aPtr)->PowerDownDfc(); -} - -void DLcdPowerHandler::DisplayOn() -{ - PowerUpLcd(iSecureDisplay); - iDisplayOn = ETrue; -} - -void DLcdPowerHandler::DisplayOff() -{ - PowerDownLcd(); - iDisplayOn = EFalse; -} - -void DLcdPowerHandler::SwitchDisplay(TBool aSecure) - { - if(aSecure) - { - if(!iSecureDisplay) - { - DisplayOff(); - iSecureDisplay = ETrue; - DisplayOn(); - } - } - else - { - if(iSecureDisplay) - { - DisplayOff(); - iSecureDisplay = EFalse; - DisplayOn(); - } - } - } - -void DLcdPowerHandler::PowerUpDfc() -{ - DisplayOn(); - PowerUpDone(); -} - -void DLcdPowerHandler::PowerDownDfc() -{ - DisplayOff(); - PowerDownDone(); -} - -void DLcdPowerHandler::PowerDown(TPowerState) -{ - iPowerDownDfc.Enque(); -} - -void DLcdPowerHandler::PowerUp() -{ - iPowerUpDfc.Enque(); -} - -void DLcdPowerHandler::PowerUpLcd(TBool aSecure) -{ -#if 1 - WriteReg(iPortAddr, FB_ENABLED, 0); - WriteReg(iPortAddr, FB_BASE, aSecure ? iSecurevRamPhys : ivRamPhys); - WriteReg(iPortAddr, FB_WIDTH, iVideoInfo.iSizeInPixels.iWidth); - WriteReg(iPortAddr, FB_BLANK, 0); - WriteReg(iPortAddr, FB_BPP, 32); - WriteReg(iPortAddr, FB_COLOR_ORDER, 0); - WriteReg(iPortAddr, FB_BYTE_ORDER, 0); - WriteReg(iPortAddr, FB_PIXEL_ORDER, 0); - WriteReg(iPortAddr, FB_INT_MASK, 0); - WriteReg(iPortAddr, FB_ENABLED, 1); - WriteReg(iPortAddr, FB_HEIGHT, iVideoInfo.iSizeInPixels.iHeight); -#endif -} - -void DLcdPowerHandler::PowerDownLcd() -{ - WriteReg(iPortAddr, FB_BLANK, 1); -} - -DLcdPowerHandler::DLcdPowerHandler() - : DPowerHandler(KLitLcd), - iMsgQ(rxMsg,this,NULL,1), - iPowerUpDfc(&power_up_dfc,this,6), - iPowerDownDfc(&power_down_dfc,this,7) -{ -} - -void DLcdPowerHandler::ScreenInfo(TScreenInfoV01& anInfo) -{ - anInfo.iWindowHandleValid = EFalse; - anInfo.iWindowHandle = NULL; - anInfo.iScreenAddressValid = ETrue; - anInfo.iScreenAddress = (TAny *)(iChunk->LinearAddress()); - anInfo.iScreenSize.iWidth = iVideoInfo.iSizeInPixels.iWidth; - anInfo.iScreenSize.iHeight = iVideoInfo.iSizeInPixels.iHeight; -} - -void DLcdPowerHandler::HandleMsg(TMessageBase* aMsg) -{ - if(aMsg->iValue) - DisplayOn(); - else - DisplayOff(); - aMsg->Complete(KErrNone,ETrue); -} - -void DLcdPowerHandler::WsSwitchOnScreen() -{ - TThreadMessage& m = Kern::Message(); - m.iValue = ETrue; - m.SendReceive(&iMsgQ); -} - -void DLcdPowerHandler::WsSwitchOffScreen() -{ - TThreadMessage& m = Kern::Message(); - m.iValue = EFalse; - m.SendReceive(&iMsgQ); -} - -TInt DLcdPowerHandler::GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure) -{ - NKern::FMWait(&iLock); - if(aSecure) - aInfo = iSecureVideoInfo; - else - aInfo = iVideoInfo; - NKern::FMSignal(&iLock); - return KErrNone; -} - -TInt DLcdPowerHandler::GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo) -{ - if(aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes) - return KErrArgument; - - NKern::FMWait(&iLock); - aInfo = iVideoInfo; - NKern::FMSignal(&iLock); - - if(aMode != aInfo.iDisplayMode) - { - aInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; - aInfo.iIsPalettized = KConfigIsPalettized; - aInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; - aInfo.iBitsPerPixel = KConfigBitsPerPixel; - } - return KErrNone; -} - -TInt DLcdPowerHandler::AllocateFrameBuffer() -{ - // Allocate physical RAM for video - TInt vSize = TSyborg::VideoRamSize(); - - NKern::ThreadEnterCS(); - TInt r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhys); - if (r != KErrNone) - { - NKern::ThreadLeaveCS(); - Kern::Fault("AllocVideoRam",r); - } - - // Map the video RAM - ivRamPhys = TSyborg::VideoRamPhys(); - - r = DPlatChunkHw::New(iChunk,ivRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); - - NKern::ThreadLeaveCS(); - - if(r != KErrNone) - return r; - - TUint* pV = (TUint*)iChunk->LinearAddress(); - - // Allocate physical RAM for secure display - NKern::ThreadEnterCS(); - r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhysSecure); - if (r != KErrNone) - { - NKern::ThreadLeaveCS(); - Kern::Fault("AllocVideoRam 2",r); - } - iSecurevRamPhys = ivRamPhys + vSize; - TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); - - NKern::ThreadLeaveCS(); - - if(r2 != KErrNone) - return r2; - - TUint* pV2 = (TUint*)iSecureChunk->LinearAddress(); - - iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth; - iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight; - iVideoInfo.iDisplayMode = KConfigLcdDisplayMode; - iVideoInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; - iVideoInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; - iVideoInfo.iIsPalettized = KConfigIsPalettized; - iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel; - iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips; - iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips; - iVideoInfo.iIsMono = KConfigIsMono; - iVideoInfo.iVideoAddress = (TInt)pV; - iVideoInfo.iIsPixelOrderLandscape = KConfigPixelOrderLandscape; - iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB; - - iSecureVideoInfo = iVideoInfo; - iSecureVideoInfo.iVideoAddress = (TInt)pV2; - -#if 0 - WriteReg(iPortAddr, FB_ENABLED, 0); - WriteReg(IPortAddr, FB_INT_MASK, 0); - WriteReg(iPortAddr, FB_BASE, iSecureDisplay ? iSecurevRamPhys : ivRamPhys); - WriteReg(iPortAddr, FB_WIDTH, iVideoInfo.iSizeInPixels.iWidth); - WriteReg(iPortAddr, FB_HEIGHT, iVideoInfo.iSizeInPixels.iHeight); - WriteReg(iPortAddr, FB_BLANK, 0); - WriteReg(iPortAddr, FB_ENABLED, 1); -#endif - - return KErrNone; -} - - -TInt DLcdPowerHandler::SetDisplayMode(TInt aMode) -{ - if(aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes) - return KErrArgument; - - // store the current mode - iVideoInfo.iDisplayMode = aMode; - - // store the current mode for secure screen - iSecureVideoInfo.iDisplayMode = aMode; - - return KErrNone; -} - -TInt DLcdPowerHandler::HalFunction(TInt aFunction, TAny* a1, TAny* a2) -{ - TInt r=KErrNone; - switch(aFunction) - { - case EDisplayHalScreenInfo: - { - TPckgBuf vPckg; - ScreenInfo(vPckg()); - Kern::InfoCopy(*(TDes8*)a1,vPckg); - break; - } - case EDisplayHalWsRegisterSwitchOnScreenHandling: - { - iWsSwitchOnScreen=(TBool)a1; - break; - } - case EDisplayHalWsSwitchOnScreen: - { - WsSwitchOnScreen(); - break; - } - case EDisplayHalModeCount: - { - TInt ndm = KConfigLcdNumberOfDisplayModes; - kumemput32(a1, &ndm, sizeof(ndm)); - break; - } - case EDisplayHalSetMode: - { - __KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetMode")); - __SECURE_KERNEL( - if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetMode"))) - return KErrPermissionDenied; - ) - r = SetDisplayMode((TInt)a1); - break; - } - case EDisplayHalMode: - { - kumemput32(a1, &iVideoInfo.iDisplayMode, sizeof(iVideoInfo.iDisplayMode)); - r = KErrNone; - break; - } - case EDisplayHalSetPaletteEntry: - { - __SECURE_KERNEL( - if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetPaletteEntry"))) - return KErrPermissionDenied; - ) - r = KErrNotSupported; - break; - } - case EDisplayHalPaletteEntry: - { - TInt entry; - kumemget32(&entry, a1, sizeof(TInt)); - r = KErrNotSupported; - break; - } - case EDisplayHalSetState: - { - __SECURE_KERNEL( - if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState"))) - return KErrPermissionDenied; - ) - if((TBool)a1) - WsSwitchOnScreen(); - else - WsSwitchOffScreen(); - break; - } - case EDisplayHalState: - { - kumemput32(a1, &iDisplayOn, sizeof(TBool)); - break; - } - case EDisplayHalColors: - { - TInt mdc = 1<<24; - kumemput32(a1, &mdc, sizeof(mdc)); - break; - } - case EDisplayHalCurrentModeInfo: - { - TPckgBuf vPckg; - r = GetCurrentDisplayModeInfo(vPckg(), (TBool)a2); - if(KErrNone == r) - Kern::InfoCopy(*(TDes8*)a1,vPckg); - break; - } - case EDisplayHalSpecifiedModeInfo: - { - TPckgBuf vPckg; - TInt mode; - kumemget32(&mode, a1, sizeof(mode)); - r = GetSpecifiedDisplayModeInfo(mode, vPckg()); - if(KErrNone == r) - Kern::InfoCopy(*(TDes8*)a2,vPckg); - break; - } - case EDisplayHalSecure: - { - kumemput32(a1, &iSecureDisplay, sizeof(TBool)); - break; - } - case EDisplayHalSetSecure: - { - __SECURE_KERNEL( - if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetSecure"))) - return KErrPermissionDenied; - ) - SwitchDisplay((TBool)a1); - break; - } - default: - { - r = KErrNotSupported; - break; - } - } - return r; -} - -TInt DLcdPowerHandler::Create() -{ - iDfcQ = Kern::DfcQue0(); // use low priority DFC queue for this driver - - iPortAddr = KHwBaseClcd; - - // !@! -#if 0 - // Map the video RAM - TInt vSize = TSyborg::VideoRamSize(); - ivRamPhys = TSyborg::VideoRamPhys(); - - TInt r = DPlatChunkHw::New(iChunk,ivRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); - if(r != KErrNone) - return r; - - TUint* pV = (TUint*)iChunk->LinearAddress(); - - iSecurevRamPhys = ivRamPhys + vSize; - TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); - if(r2 != KErrNone) - return r2; - - TUint* pV2 = (TUint*)iSecureChunk->LinearAddress(); -#endif - - iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth; - iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight; - iVideoInfo.iDisplayMode = KConfigLcdDisplayMode; - iVideoInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; - iVideoInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; - iVideoInfo.iIsPalettized = KConfigIsPalettized; - iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel; - iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips; - iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips; - iVideoInfo.iIsMono = KConfigIsMono; - // !@! iVideoInfo.iVideoAddress = (TInt)pV; - iVideoInfo.iIsPixelOrderLandscape = KConfigPixelOrderLandscape; - iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB; - - iSecureVideoInfo = iVideoInfo; - // !@! iSecureVideoInfo.iVideoAddress = (TInt)pV2; - - AllocateFrameBuffer(); - TInt r = Kern::AddHalEntry(EHalGroupDisplay,DoHalFunction,this); - if(r != KErrNone) - return r; - - iPowerUpDfc.SetDfcQ(iDfcQ); - iPowerDownDfc.SetDfcQ(iDfcQ); - iMsgQ.SetDfcQ(iDfcQ); - iMsgQ.Receive(); - - Add(); - DisplayOn(); - - return KErrNone; -} - -DECLARE_STANDARD_EXTENSION() -{ - TInt r = KErrNoMemory; - DLcdPowerHandler* pH=new DLcdPowerHandler; - if(pH) - r = pH->Create(); - - return r; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/fb/syborg_fb.h --- a/baseport/src/cedar/generic/base/syborg/fb/syborg_fb.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic frame buffer driver -* -*/ - -#ifndef _SYBORG_FB_H -#define _SYBORG_FB_H - -#include -#include -#include -#include -#include - -_LIT(KLitLcd,"SYBORG_FB"); - -const TUint KConfigLcdWidth = 640; -const TUint KConfigLcdHeight = 480; -const TInt KConfigLcdWidthInTwips = 9638; -const TInt KConfigLcdHeightInTwips = 7370; -const TBool KConfigIsMono = 0; -const TBool KConfigIsPalettized = 0; -const TInt KCOnfigOffsetToFirstPixel = 0; -const TBool KConfigPixelOrderRGB = 0; -const TBool KConfigPixelOrderLandscape = 1; -const TInt KConfigLcdDisplayMode = 2; -//const TInt KConfigLcdDisplayMode = 1; -const TInt KConfigLcdNumberOfDisplayModes = 3; - - -const TInt KConfigBitsPerPixel = 24; -const TInt KCOnfigOffsetBetweenLines = 2560; - -class DLcdPowerHandler : public DPowerHandler -{ -public: // from DPowerHandler - void PowerDown(TPowerState); - void PowerUp(); -public: // to prevent a race condition with WServer trying to power up/down at the same time - void PowerUpDfc(); - void PowerDownDfc(); -public: - DLcdPowerHandler(); - TInt Create(); - void DisplayOn(); - void DisplayOff(); - TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2); - - void PowerUpLcd(TBool aSecure); - void PowerDownLcd(); - - void ScreenInfo(TScreenInfoV01& aInfo); - void WsSwitchOnScreen(); - void WsSwitchOffScreen(); - void HandleMsg(TMessageBase* aMsg); - void SwitchDisplay(TBool aSecure); - -private: - TInt GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure); - TInt GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo); - TInt SetDisplayMode(TInt aMode); - TInt AllocateFrameBuffer(); - - TBool iDisplayOn; - DPlatChunkHw* iChunk; - DPlatChunkHw* iSecureChunk; - TBool iWsSwitchOnScreen; - TBool iSecureDisplay; - -public: - TDfcQue* iDfcQ; - TMessageQue iMsgQ; // to prevent a race condition with Power Manager trying to power up/down at the same time - TDfc iPowerUpDfc; - TDfc iPowerDownDfc; - -private: - TVideoInfoV01 iVideoInfo; - TVideoInfoV01 iSecureVideoInfo; - NFastMutex iLock; - TPhysAddr ivRamPhys; - TPhysAddr iSecurevRamPhys; - -public: - TLinAddr iPortAddr; - -enum { - FB_ID = 0, - FB_BASE = 1, - FB_HEIGHT = 2, - FB_WIDTH = 3, - FB_ORIENTATION = 4, - FB_BLANK = 5, - FB_INT_MASK = 6, - /* begin new interface */ - FB_INTERRUPT_CAUSE = 7, - FB_BPP = 8, - FB_COLOR_ORDER = 9, - FB_BYTE_ORDER = 10, - FB_PIXEL_ORDER = 11, - FB_ROW_PITCH = 12, - FB_ENABLED = 13, - FB_PALETTE_START = 0x400 >> 2, - FB_PALETTE_END = FB_PALETTE_START+256-1, - /* end new interface */ -}; - -#define FB_INT_VSYNC (1U << 0) -#define FB_INT_BASE_UPDATE_DONE (1U << 1) - -}; - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/hal/config.hcf --- a/baseport/src/cedar/generic/base/syborg/hal/config.hcf Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -EManufacturer=0 -EManufacturerHardwareRev=0 -EManufacturerSoftwareRev=0 -EManufacturerSoftwareBuild=0 -EModel=0 -EMachineUid=0 -EDeviceFamily=0 -EDeviceFamilyRev=0 -ECPU=0 -ECPUArch=0 -ECPUABI=0 -ECPUSpeed = GetCPUSpeed -ESystemStartupReason = GetSystemStartupReason -ESystemException = GetSystemException -ESystemTickPeriod=0 -EMemoryRAM = GetRAMSize -EMemoryRAMFree = GetFreeRAM -EMemoryROM = GetROMSize -EMemoryPageSize=0 -EPowerGood=0 -EPowerBackup=0 -EPowerExternal=0 -EKeyboard=0 -EKeyboardDeviceKeys=0 -EKeyboardAppKeys=0 -EKeyboardClick=0 -EDisplayXPixels=ProcessDisplayCurrentModeInfo -EDisplayYPixels=ProcessDisplayCurrentModeInfo -EDisplayXTwips=ProcessDisplayCurrentModeInfo -EDisplayYTwips=ProcessDisplayCurrentModeInfo -EDisplayColors=ProcessDisplayColors -EDisplayState : set = ProcessDisplayState -EDisplayContrast : set = ProcessDisplayContrast -EDisplayContrastMax=ProcessDisplayMaxContrast -EBacklight=0 -EBacklightState :set = ProcessBacklightState -EPen=0 -EPenX=0 -EPenY=0 -EPenDisplayOn : set = ProcessPenDisplayOnState -EPenClick=0 -EMouse=0 -EMouseState : set = ProcessMouseState -EMouseSpeed : set = ProcessMouseSpeed -EMouseAcceleration : set = ProcessMouseAcceleration -EMouseButtons=0 -EMouseButtonState = GetMouseButtonState -ECaseSwitch=0 -ELEDs=0 -ELEDmask : set = ProcessLEDMask -ESwitches=GetSwitches -EIntegratedPhone=0 -EDisplayBrightness : set = ProcessDisplayBrightness -EDisplayBrightnessMax=ProcessDisplayMaxBrightness -ELanguageIndex : set = 0 -EDisplayIsMono=ProcessDisplaySpecifiedModeInfo -EDisplayIsPalettized=ProcessDisplaySpecifiedModeInfo -EDisplayBitsPerPixel=ProcessDisplaySpecifiedModeInfo -EDisplayNumModes = ProcessDisplayNumModes -EDisplayMemoryAddress=ProcessDisplayCurrentModeInfo -EDisplayOffsetToFirstPixel=ProcessDisplaySpecifiedModeInfo -EDisplayOffsetBetweenLines=ProcessDisplaySpecifiedModeInfo -EDisplayPaletteEntry : set = ProcessDisplayPaletteEntry -EDisplayIsPixelOrderRGB=ProcessDisplayCurrentModeInfo -EDisplayIsPixelOrderLandscape=ProcessDisplayCurrentModeInfo -EDisplayMode : set = ProcessDisplayMode -EDebugPort : set = ProcessDebugPort -EClipboardDrive=0 -ESystemDrive : set = 0 -EDisplayNumberOfScreens=0 -ENanoTickPeriod=0 -EFastCounterFrequency=0 -EFastCounterCountsUp=0 -EHardwareFloatingPoint = GetHardwareFloatingPoint - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/hal/hal.mmp --- a/baseport/src/cedar/generic/base/syborg/hal/hal.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -TARGET VariantTarget(hal,dll) -TARGETTYPE dll -LINKAS hal.dll -NOEXPORTLIBRARY - -SOURCEPATH ..\..\hal\src -SOURCE hal_main.cpp userhal.cpp - -SOURCEPATH \epoc32\build\generatedcpp\hal -SOURCE VariantTarget(values,cpp) VariantTarget(config,cpp) - -SYSTEMINCLUDE \epoc32\include \epoc32\include\kernel - -LIBRARY euser.lib -DEFFILE ..\..\hal\~\hal.def - -UID 0x1000008d 0x100039e8 -VENDORID 0x70000001 - -CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/hal/values.hda --- a/baseport/src/cedar/generic/base/syborg/hal/values.hda Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -EManufacturer=intel -EManufacturerHardwareRev=0x1 -EManufacturerSoftwareRev=0x100 -EManufacturerSoftwareBuild=0x250 -EModel=0x42525453 -EMachineUid=OmapH4 -EDeviceFamily=crystal -EDeviceFamilyRev=0x001 -ECPU=arm -ECPUArch=0x400 -ECPUABI=arm5 -ECPUSpeed=0 -ESystemStartupReason=cold -ESystemException=0 -ESystemTickPeriod=15625 -EMemoryRAM=4 -EMemoryRAMFree=2 -EMemoryROM=12 -EMemoryPageSize=0x1000 -EPowerGood=1 -EPowerExternal=1 -EMouse=1 -EMouseState=1 -EMouseSpeed=1 -EMouseAcceleration=1 -EMouseButtons=2 -EMouseButtonState=0 -EMouseX=640 -EMouseY=480 -ECaseSwitch=0 -EIntegratedPhone=0 -ELanguageIndex=0 -EDebugPort=0 -EClipboardDrive=2 -ESystemDrive=0xffff -EDisplayNumberOfScreens=1 -ENanoTickPeriod=1000 -EFastCounterFrequency=1000000 -EFastCounterCountsUp=1 - - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/kasyborg.mmp --- a/baseport/src/cedar/generic/base/syborg/kasyborg.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "kernel\kern_ext.mmh" - -TARGET VariantTarget(kasyborg,dll) -TARGETTYPE var - -EXPORTLIBRARY kasyborg -LINKAS kasyborg.dll - -SYSTEMINCLUDE .\specific - -SOURCEPATH .\specific -SOURCE syborg.cpp interrupts.cpp assp.cpp -SOURCE syborg.cia interrupts.cia - -// now specified in kern_ext.lib -//LIBRARY ekern.lib - -DEFFILE .\~\kasyborg.def - -NOSTRICTDEF - -EPOCALLOWDLLDATA - -UID 0x1000008d 0x100039e8 -VENDORID 0x70000001 - -CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/keyboard/keyboard.mmp --- a/baseport/src/cedar/generic/base/syborg/keyboard/keyboard.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "kernel\kern_ext.mmh" - -TARGET VariantTarget(ekeyb,dll) -TARGETTYPE kext -ROMTARGET ekeyb.dll - -SYSTEMINCLUDE AsspNKernIncludePath - -SOURCEPATH . -SOURCE syborg_keyboard.cpp - -//LIBRARY ekern.lib -LIBRARY PlatformLib - -//NOEXPORTLIBRARY - -//DEFFILE ..\e32\~\empty.def -//DEFFILE .\~\exkey.def - -//NOSTRICTDEF - -UID 0x100039cf 0x100000db -VENDORID 0x70000001 - -CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/keyboard/syborg_keyboard.cpp --- a/baseport/src/cedar/generic/base/syborg/keyboard/syborg_keyboard.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic keyboard driver -* -*/ - -//#define DEBUG - -#include "syborg_keyboard.h" - -LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) -{ - DKeyboardPs2Soc* pH=(DKeyboardPs2Soc*)aPtr; - return pH->HalFunction(aFunction,a1,a2); -} - -void rxMsg(TAny* aPtr) -{ - DKeyboardPs2Soc& h=*(DKeyboardPs2Soc*)aPtr; - TMessageBase* pM=h.iMsgQ.iMessage; - if (pM) - h.HandleMsg(pM); -} - -TInt DKeyboardPs2Soc::FifoPop(void) -{ - TInt val = iKeyFifo[iFifoPos]; - iFifoPos++; - iFifoCount--; - - if (iFifoPos == FIFO_SIZE) - iFifoPos = 0; - - return val; -} - -void DKeyboardPs2Soc::FifoPush(TInt val) -{ - TInt slot; - - if (iFifoCount == FIFO_SIZE) - return; - - slot = iFifoPos + iFifoCount; - if (slot >= FIFO_SIZE) - slot -= FIFO_SIZE; - iKeyFifo[slot] = val; - iFifoCount++; -} - -void DKeyboardPs2Soc::Isr(TAny* aPtr) -{ - __DEBUG_PRINT("DKeyboardPs2Soc::Isr"); - DKeyboardPs2Soc& k = *(DKeyboardPs2Soc*)aPtr; - - // Is now auto-clearing - while(ReadReg(KHwBaseKmiKeyboard, KBD_FIFO_COUNT)!=0) - k.FifoPush(ReadReg(KHwBaseKmiKeyboard, KBD_DATA)); - - //WriteReg(KHwBaseKmiKeyboard,KBD_CLEAR_INT, 0); - Interrupt::Clear(EIntKeyboard); - k.iRxDfc.Add(); -} - -DKeyboardPs2Soc::DKeyboardPs2Soc() - : DPowerHandler(KLitKeyboard), - iRxDfc(RxDfc,this,Kern::DfcQue0(),1), - iMsgQ(rxMsg,this,NULL,1) -{ - iKeyboardOn = ETrue; - iFifoPos = 0; - iFifoCount = 0; -} - -TInt DKeyboardPs2Soc::Create() -{ - __DEBUG_PRINT("DKeyboardPs2Soc::Create"); - - TInt r=KErrNone; - iDfcQ=Kern::DfcQue0(); - - iFifoPos = iFifoCount = 0; - - r=Kern::AddHalEntry(EHalGroupKeyboard,halFunction,this); - if (r!=KErrNone) - return r; - - iMsgQ.SetDfcQ(iDfcQ); - iMsgQ.Receive(); - - r=Interrupt::Bind(EIntKeyboard,Isr,this); - if (r==KErrNone) { - Add(); - KeyboardOn(); - } - return r; -} - -void DKeyboardPs2Soc::PowerUp() -{ - PowerUpDone(); -} - -void DKeyboardPs2Soc::PowerDown(TPowerState) -{ - PowerDownDone(); -} - -void DKeyboardPs2Soc::KeyboardOn() -{ - __DEBUG_PRINT("DKeyboardPs2Soc::KeyboardOn"); - TInt reg = ReadReg(KHwBaseKmiKeyboard,KBD_ID); - - Interrupt::Enable(EIntKeyboard); - WriteReg(KHwBaseKmiKeyboard,KBD_INT_ENABLE,1); -} - -void DKeyboardPs2Soc::KeyboardOff() -{ - __DEBUG_PRINT("DKeyboardPs2Soc::KeyboardOff"); - Interrupt::Disable(EIntKeyboard); - WriteReg(KHwBaseKmiKeyboard,KBD_INT_ENABLE,0); -} - -void DKeyboardPs2Soc::HandleMsg(TMessageBase* aMsg) -{ - __DEBUG_PRINT("DKeyboardPs2Soc::HandleMsg"); - if (aMsg->iValue) - KeyboardOn(); - else - KeyboardOff(); - aMsg->Complete(KErrNone,ETrue); -} - -void DKeyboardPs2Soc::KeyboardInfo(TKeyboardInfoV01& aInfo) -{ - aInfo.iKeyboardType=KConfigKeyboardType; - aInfo.iDeviceKeys=KConfigKeyboardDeviceKeys; - aInfo.iAppsKeys=KConfigKeyboardAppsKeys; -} - -TInt DKeyboardPs2Soc::HalFunction(TInt aFunction, TAny* a1, TAny* a2) -{ - TInt r=KErrNone; - - __DEBUG_PRINT("DKeyboardPs2Soc::HalFunction"); - switch(aFunction) - { - case EKeyboardHalKeyboardInfo: - { - TPckgBuf kPckg; - KeyboardInfo(kPckg()); - Kern::InfoCopy(*(TDes8*)a1,kPckg); - break; - } - // UIKLAF Silent running/power management - case EKeyboardHalSetKeyboardState: - { - if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EKeyboardHalSetKeyboardState"))) - return KErrPermissionDenied; - if ((TBool)a1) - { - TThreadMessage& m=Kern::Message(); - m.iValue = ETrue; - m.SendReceive(&iMsgQ); - } - else - { - TThreadMessage& m=Kern::Message(); - m.iValue = EFalse; - m.SendReceive(&iMsgQ); - } - } - break; - case EKeyboardHalKeyboardState: - kumemput32(a1, &iKeyboardOn, sizeof(TBool)); - break; - default: - r=KErrNotSupported; - break; - } - return r; -} - -void DKeyboardPs2Soc::RxDfc(TAny* aPtr) -{ - TRawEvent e; - DKeyboardPs2Soc& k = *(DKeyboardPs2Soc*)aPtr; - - while(k.iFifoCount>0) { - int keycode = k.FifoPop(); - int dwn = (keycode & 0x80000000) ? 0 : 1; - __DEBUG_PRINT("DKeyboardPs2Soc::RxDfc %d %d", keycode, dwn); - - keycode &= ~(0x80000000); - if (dwn) { - __DEBUG_PRINT("kbd EKeyDown:%d",keycode); - e.Set(TRawEvent::EKeyDown,KConvertCode[keycode],0); - } - else { - __DEBUG_PRINT("kbd EKeyUp:%d",keycode); - e.Set(TRawEvent::EKeyUp,KConvertCode[keycode],0); - } - Kern::AddEvent(e); - } -} - -DECLARE_STANDARD_EXTENSION() -{ - TInt r=KErrNoMemory; - DKeyboardPs2Soc* pK=new DKeyboardPs2Soc; - if (pK) - r=pK->Create(); - __KTRACE_OPT(KEXTENSION,__DEBUG_PRINT("Returns %d",r)); - return r; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/keyboard/syborg_keyboard.h --- a/baseport/src/cedar/generic/base/syborg/keyboard/syborg_keyboard.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,337 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic keyboard driver -* -*/ - -#ifndef _SYBORG_KEYBOARD_H -#define _SYBORG_KEYBOARD_H - -#include -#include -#include - -#ifdef DEBUG -#define __DEBUG_PRINT(format...) Kern::Printf(format) -#else -#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) -#endif - -#define FIFO_SIZE 16 - -_LIT(KLitKeyboard,"Syborg Keyboard"); -const TKeyboard KConfigKeyboardType = EKeyboard_Full; -const TInt KConfigKeyboardDeviceKeys = 0; -const TInt KConfigKeyboardAppsKeys = 0; - -class DKeyboardPs2Soc : public DPowerHandler -{ -public: - DKeyboardPs2Soc(); - TInt Create(); - TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2); - void KeyboardInfo(TKeyboardInfoV01& aInfo); - void KeyboardOn(); - void KeyboardOff(); - void PowerUp(); - void PowerDown(TPowerState); - void HandleMsg(TMessageBase* aMsg); - -private: - static void Isr(TAny* aPtr); - static void RxDfc(TAny* aPtr); - - private: - TInt FifoPop(void); - void FifoPush(TInt val); - - TInt iKeyFifo[FIFO_SIZE]; - TInt iFifoPos; - TInt iFifoCount; - -private: - TDfc iRxDfc; - TBool iKeyboardOn; - -public: - TDfcQue* iDfcQ; - TMessageQue iMsgQ; - - enum { - KBD_ID = 0, - KBD_DATA = 1, - KBD_FIFO_COUNT = 2, - KBD_INT_ENABLE = 3 - }; -}; - -const TUint8 KConvertCode[] = - { - /*00*/ EStdKeyNull, - /*01*/ EStdKeyEscape, - /*02*/ '1', - /*03*/ '2', - /*04*/ '3', - /*05*/ '4', - /*06*/ '5', - /*07*/ '6', - /*08*/ '7', - /*09*/ '8', - /*0a*/ '9', - /*0b*/ '0', - /*0c*/ EStdKeyMinus, - /*0d*/ EStdKeyEquals, - /*0e*/ EStdKeyBackspace, - /*0f*/ EStdKeyTab, - - /*10*/ 'Q', - /*11*/ 'W', - /*12*/ 'E', - /*13*/ 'R', - /*14*/ 'T', - /*15*/ 'Y', - /*16*/ 'U', - /*17*/ 'I', - /*18*/ 'O', - /*19*/ 'P', - /*1a*/ EStdKeySquareBracketLeft, - /*1b*/ EStdKeySquareBracketRight, - /*1c*/ EStdKeyEnter, - /*1d*/ EStdKeyLeftCtrl, - /*1e*/ 'A', - /*1f*/ 'S', - - /*20*/ 'D', - /*21*/ 'F', - /*22*/ 'G', - /*23*/ 'H', - /*24*/ 'J', - /*25*/ 'K', - /*26*/ 'L', - /*27*/ EStdKeySemiColon, - /*28*/ EStdKeySingleQuote, - /*29*/ EStdKeyNull, - /*2a*/ EStdKeyLeftShift, - /*2b*/ EStdKeyHash, - /*2c*/ 'Z', - /*2d*/ 'X', - /*2e*/ 'C', - /*2f*/ 'V', - - /*30*/ 'B', - /*31*/ 'N', - /*32*/ 'M', - /*33*/ EStdKeyComma, - /*34*/ EStdKeyFullStop, - /*35*/ EStdKeyForwardSlash, - /*36*/ EStdKeyRightShift, - /*37*/ EStdKeyPrintScreen, - /*38*/ EStdKeyLeftAlt, - /*39*/ EStdKeySpace, - /*3a*/ EStdKeyCapsLock, - /*3b*/ EStdKeyMenu, // EStdKeyF1, - /*3c*/ EStdKeyF2, - /*3d*/ EStdKeyF3, - /*3e*/ EStdKeyF4, - /*3f*/ EStdKeyF5, - - /*40*/ EStdKeyF6, - /*41*/ EStdKeyF7, - /*42*/ EStdKeyF8, - /*43*/ EStdKeyF9, - /*44*/ EStdKeyF10, - /*45*/ EStdKeyNull, - /*46*/ EStdKeyScrollLock, - /*47*/ EStdKeyHome, - /*48*/ EStdKeyUpArrow, - /*49*/ EStdKeyPageUp, - /*4a*/ EStdKeyNull, - /*4b*/ EStdKeyLeftArrow, - /*4c*/ EStdKeyNull, - /*4d*/ EStdKeyRightArrow, - /*4e*/ EStdKeyNull, - /*4f*/ EStdKeyNull, - - /*50*/ EStdKeyDownArrow, - /*51*/ EStdKeyPageDown, - /*52*/ EStdKeyInsert, - /*53*/ EStdKeyDelete, - /*54*/ EStdKeyNull, - /*55*/ EStdKeyNull, - /*56*/ EStdKeyBackSlash, - /*57*/ EStdKeyF11, - /*58*/ EStdKeyF12, - /*59*/ EStdKeyNull, - /*5a*/ EStdKeyNull, - /*5b*/ EStdKeyNull, - /*5c*/ EStdKeyNull, - /*5d*/ EStdKeyNull, - /*5e*/ EStdKeyNull, - /*5f*/ EStdKeyNull, - - /*60*/ EStdKeyNull, - /*61*/ EStdKeyNull, - /*62*/ EStdKeyNull, - /*63*/ EStdKeyNull, - /*64*/ EStdKeyNull, - /*65*/ EStdKeyNull, - /*66*/ EStdKeyNull, - /*67*/ EStdKeyNull, - /*68*/ EStdKeyNull, - /*69*/ EStdKeyNull, - /*6a*/ EStdKeyNull, - /*6b*/ EStdKeyNull, - /*6c*/ EStdKeyNull, - /*6d*/ EStdKeyNull, - /*6e*/ EStdKeyNull, - /*6f*/ EStdKeyNull, - - /*70*/ EStdKeyNull, - /*71*/ EStdKeyNull, - /*72*/ EStdKeyNull, - /*73*/ EStdKeyNull, - /*74*/ EStdKeyNull, - /*75*/ EStdKeyNull, - /*76*/ EStdKeyNull, - /*77*/ EStdKeyNull, - /*78*/ EStdKeyNull, - /*79*/ EStdKeyNull, - /*7a*/ EStdKeyNull, - /*7b*/ EStdKeyNull, - /*7c*/ EStdKeyNull, - /*7d*/ EStdKeyNull, - /*7e*/ EStdKeyNull, - /*7f*/ EStdKeyNull, - - /*80*/ EStdKeyNull, - /*81*/ EStdKeyNull, - /*82*/ EStdKeyNull, - /*83*/ EStdKeyNull, - /*84*/ EStdKeyNull, - /*85*/ EStdKeyNull, - /*86*/ EStdKeyNull, - /*87*/ EStdKeyNull, - /*88*/ EStdKeyNull, - /*89*/ EStdKeyNull, - /*8a*/ EStdKeyNull, - /*8b*/ EStdKeyNull, - /*8c*/ EStdKeyNull, - /*8d*/ EStdKeyNull, - /*8e*/ EStdKeyNull, - /*8f*/ EStdKeyNull, - - /*90*/ EStdKeyNull, - /*91*/ EStdKeyNull, - /*92*/ EStdKeyNull, - /*93*/ EStdKeyNull, - /*94*/ EStdKeyNull, - /*95*/ EStdKeyNull, - /*96*/ EStdKeyNull, - /*97*/ EStdKeyNull, - /*98*/ EStdKeyNull, - /*99*/ EStdKeyNull, - /*9a*/ EStdKeyNull, - /*9b*/ EStdKeyNull, - /*9c*/ EStdKeyNull, - /*9d*/ EStdKeyNull, - /*9e*/ EStdKeyNull, - /*9f*/ EStdKeyNull, - - /*a0*/ EStdKeyNull, - /*a1*/ EStdKeyNull, - /*a2*/ EStdKeyNull, - /*a3*/ EStdKeyNull, - /*a4*/ EStdKeyNull, - /*a5*/ EStdKeyNull, - /*a6*/ EStdKeyNull, - /*a7*/ EStdKeyNull, - /*a8*/ EStdKeyNull, - /*a9*/ EStdKeyNull, - /*aa*/ EStdKeyNull, - /*ab*/ EStdKeyNull, - /*ac*/ EStdKeyNull, - /*ad*/ EStdKeyNull, - /*ae*/ EStdKeyNull, - /*af*/ EStdKeyNull, - - /*b0*/ EStdKeyNull, - /*b1*/ EStdKeyNull, - /*b2*/ EStdKeyNull, - /*b3*/ EStdKeyNull, - /*b4*/ EStdKeyNull, - /*b5*/ EStdKeyNull, - /*b6*/ EStdKeyNull, - /*b7*/ EStdKeyNull, - /*b8*/ EStdKeyNull, - /*b9*/ EStdKeyNull, - /*ba*/ EStdKeyNull, - /*bb*/ EStdKeyNull, - /*bc*/ EStdKeyNull, - /*bd*/ EStdKeyNull, - /*be*/ EStdKeyNull, - /*bf*/ EStdKeyNull, - - /*c0*/ EStdKeyNull, - /*c1*/ EStdKeyNull, - /*c2*/ EStdKeyNull, - /*c3*/ EStdKeyNull, - /*c4*/ EStdKeyNull, - /*c5*/ EStdKeyNull, - /*c6*/ EStdKeyNull, - /*c7*/ EStdKeyNull, - /*c8*/ EStdKeyNull, - /*c9*/ EStdKeyNull, - /*ca*/ EStdKeyNull, - /*cb*/ EStdKeyNull, - /*cc*/ EStdKeyNull, - /*cd*/ EStdKeyNull, - /*ce*/ EStdKeyNull, - /*cf*/ EStdKeyNull, - - /*d0*/ EStdKeyNull, - /*d1*/ EStdKeyNull, - /*d2*/ EStdKeyNull, - /*d3*/ EStdKeyNull, - /*d4*/ EStdKeyNull, - /*d5*/ EStdKeyNull, - /*d6*/ EStdKeyNull, - /*d7*/ EStdKeyNull, - /*d8*/ EStdKeyNull, - /*d9*/ EStdKeyNull, - /*da*/ EStdKeyNull, - /*db*/ EStdKeyNull, - /*dc*/ EStdKeyNull, - /*dd*/ EStdKeyNull, - /*de*/ EStdKeyNull, - /*df*/ EStdKeyNull, - - /*e0*/ EStdKeyNull, - /*e1*/ EStdKeyNull, - /*e2*/ EStdKeyNull, - /*e3*/ EStdKeyNull, - /*e4*/ EStdKeyNull, - /*e5*/ EStdKeyNull, - /*e6*/ EStdKeyNull, - /*e7*/ EStdKeyNull, - /*e8*/ EStdKeyNull, - /*e9*/ EStdKeyNull, - /*ea*/ EStdKeyNull, - /*eb*/ EStdKeyNull, - /*ec*/ EStdKeyNull, - /*ed*/ EStdKeyNull, - /*ee*/ EStdKeyNull, - /*ef*/ EStdKeyNull, -}; - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/keymap/keymap.cpp --- a/baseport/src/cedar/generic/base/syborg/keymap/keymap.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1952 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This is for a UK Keyboard -* -*/ - -#include - -//#define US_KEYBOARD - -// the "array" parameter must be a true array and not a pointer -#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0])) - -#define TABLE_ENTRY_ANOTHER_CTRL_DIGIT \ - { \ - { \ - EModifierKeyUp|EModifierFunc, \ - 0 \ - }, \ - { \ - EKeyNull, \ - EAnyDigitGivenRadix \ - }, \ - { \ - EStateCtrlDigits, \ - EAddOnCtrlDigit, \ - 0 \ - } \ - } - -// This table is searched for a match if a match has not been -// found in the current state's table - -LOCAL_D const SFuncTableEntry defaultTable[]= - { - { // prevent key up events generating keycodes - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyNull, - EAnyKey - }, - { - EStateUnchanged, - EDoNothing, - 0 - } - }, - { // prevent any modifer key from changing state - { - 0, - 0 - }, - { - EKeyNull, - EAnyModifierKey - }, - { - EStateUnchanged, - EDoNothing, - 0 - } - }, - { // filter out any unprocessed codes??? - { - 0, - 0 - }, - { - EKeyNull, - EAnyKey - }, - { - EStateNormal, - EDoNothing, - 0 - } - } - }; - -// The table indicating which keys change which modifiers; -// the state field in this table is ignored -LOCAL_D const SFuncTableEntry modifierTable[]= - { - { - { - EModifierKeyUp, - 0 - }, - { - EKeyCapsLock, - EMatchKey - }, - { - EStateUnchanged, - EToggleModifier, - EModifierCapsLock - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyNumLock, - EMatchKey - }, - { - EStateUnchanged, - EToggleModifier, - EModifierNumLock - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyScrollLock, - EMatchKey - }, - { - EStateUnchanged, - EToggleModifier, - EModifierScrollLock - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyLeftAlt, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierAlt|EModifierLeftAlt - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyLeftAlt, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierLeftAlt - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyLeftFunc, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierFunc|EModifierLeftFunc - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyLeftFunc, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierLeftFunc - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyLeftShift, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierShift|EModifierLeftShift - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyLeftShift, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierLeftShift - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyLeftCtrl, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierCtrl|EModifierLeftCtrl - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyLeftCtrl, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierLeftCtrl - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyRightAlt, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierAlt|EModifierRightAlt - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyRightAlt, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierRightAlt - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyRightFunc, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierFunc|EModifierRightFunc - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyRightFunc, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierRightFunc - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyRightShift, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierShift|EModifierRightShift - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyRightShift, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierRightShift - } - }, - { - { - EModifierKeyUp, - 0 - }, - { - EKeyRightCtrl, - EMatchKey - }, - { - EStateUnchanged, - ETurnOnModifier, - EModifierCtrl|EModifierRightCtrl - } - }, - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyRightCtrl, - EMatchKey - }, - { - EStateUnchanged, - ETurnOffModifier, - EModifierRightCtrl - } - } - }; - -// table0 to table12 are the tables corresponding to states -// 0 to 12 respectively - -//LOCAL_D const SFuncTableEntry table0[]= -// { -// TABLE_ENTRY_ANOTHER_CTRL_DIGIT -// }; - -LOCAL_D const SFuncTableEntry table1[]= - { - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'e', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcAe - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'c', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcCcedilla - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 's', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1EsTset - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'o', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcOslash - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'd', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcThorn - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 't', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcSoftTh - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'l', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LeftChevron - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'r', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1RightChevron - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'x', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1InvExclam - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'q', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1InvQuest - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'a', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcAo - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'p', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1Pound - } - }, - TABLE_ENTRY_ANOTHER_CTRL_DIGIT - }; - -LOCAL_D const SFuncTableEntry table2[]= - { - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'a', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcAumlaut - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'e', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcEumlaut - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'i', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcIumlaut - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'o', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcOumlaut - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'u', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcUumlaut - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'y', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcYumlaut - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - ' ', - EMatchKey - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1SpaceUmlaut - } - }, - TABLE_ENTRY_ANOTHER_CTRL_DIGIT - }; - -LOCAL_D const SFuncTableEntry table3[]= - { - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'a', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcAgrave - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'e', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcEgrave - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'i', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcIgrave - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'o', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcOgrave - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'u', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcUgrave - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - ' ', - EMatchKey - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1SpaceGrave - } - }, - TABLE_ENTRY_ANOTHER_CTRL_DIGIT - }; - -LOCAL_D const SFuncTableEntry table4[]= - { - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'a', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcAacute - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'e', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcEacute - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'i', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcIacute - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'o', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcOacute - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'u', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcUacute - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'y', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcYacute - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - ' ', - EMatchKey - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcSpaceAcute - } - }, - TABLE_ENTRY_ANOTHER_CTRL_DIGIT - }; - -LOCAL_D const SFuncTableEntry table5[]= - { - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'a', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcAtilde - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'n', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcNtilde - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'o', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcOtilde - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - ' ', - EMatchKey - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcSpaceTilde - } - }, - TABLE_ENTRY_ANOTHER_CTRL_DIGIT - }; - -LOCAL_D const SFuncTableEntry table6[]= - { - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'a', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcAcirc - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'e', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcEcirc - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'i', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcIcirc - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'o', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcOcirc - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - 'u', - EMatchKeyCaseInsens - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcUcirc - } - }, - { - { - EModifierFunc|EModifierKeyUp, - 0 - }, - { - ' ', - EMatchKey - }, - { - EStateNormal, - EPassSpecialKeyThru, - ELatin1LcSpaceCirc - } - }, - TABLE_ENTRY_ANOTHER_CTRL_DIGIT - }; - -//LOCAL_D const SFuncTableEntry table7[]= -// { -// TABLE_ENTRY_ANOTHER_CTRL_DIGIT -// }; - -//LOCAL_D const SFuncTableEntry table8[]= -// { -// TABLE_ENTRY_ANOTHER_CTRL_DIGIT -// }; - -//LOCAL_D const SFuncTableEntry table9[]= -// { -// TABLE_ENTRY_ANOTHER_CTRL_DIGIT -// }; - -LOCAL_D const SFuncTableEntry table10[]= - { - { // filter out up key strokes - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyNull, - EAnyKey - }, - { - EStateUnchanged, - EDoNothing, - 0 - } - }, - { // check for ctrl-number presses - { - EModifierCtrl|EModifierFunc|EModifierKeyUp, - EModifierCtrl - }, - { - EKeyNull, - EAnyDecimalDigit - }, - { - EStateDerivedFromDigitEntered, - EAddOnCtrlDigit, - 0 - } - }, - { // pass thru any keys which can't be state control keys - { - EModifierFunc, - 0, - }, - { - EKeyNull, - EAnyKey - }, - { - EStateUnchanged, - EPassKeyThru, - 0 - } - }, - { // pass thru any keys which can't be state control keys - { - EModifierCtrl, - EModifierCtrl, - }, - { - EKeyNull, - EAnyKey - }, - { - EStateUnchanged, - EPassKeyThru, - 0 - } - }, - { // check for FN-q - { - EModifierCtrl|EModifierFunc|EModifierKeyUp, - EModifierFunc - }, - { - 'q', - EMatchKeyCaseInsens - }, - { - 1, - EDoNothing, - 0 - } - }, - { // check for FN-z - { - EModifierCtrl|EModifierFunc|EModifierKeyUp, - EModifierFunc - }, - { - 'z', - EMatchKeyCaseInsens - }, - { - 2, - EDoNothing, - 0 - } - }, - { // check for FN-x - { - EModifierCtrl|EModifierFunc|EModifierKeyUp, - EModifierFunc - }, - { - 'x', - EMatchKeyCaseInsens - }, - { - 3, - EDoNothing, - 0 - } - }, - { // check for FN-c - { - EModifierCtrl|EModifierFunc|EModifierKeyUp, - EModifierFunc - }, - { - 'c', - EMatchKeyCaseInsens - }, - { - 4, - EDoNothing, - 0 - } - }, - { // check for FN-v - { - EModifierCtrl|EModifierFunc|EModifierKeyUp, - EModifierFunc - }, - { - 'v', - EMatchKeyCaseInsens - }, - { - 5, - EDoNothing, - 0 - } - }, - { // check for FN-b - { - EModifierCtrl|EModifierFunc|EModifierKeyUp, - EModifierFunc - }, - { - 'b', - EMatchKeyCaseInsens - }, - { - 6, - EDoNothing, - 0 - } - }, - { // pass thru any non-processed keys - { - 0, - 0 - }, - { - EKeyNull, - EAnyKey - }, - { - EStateUnchanged, - EPassKeyThru, - 0 - } - } - }; - -//LOCAL_D const SFuncTableEntry table11[]= -// { -// TABLE_ENTRY_ANOTHER_CTRL_DIGIT -// }; - -LOCAL_D const SFuncTableEntry table12[]= - { - { - { - EModifierKeyUp, - EModifierKeyUp - }, - { - EKeyLeftCtrl, - EMatchLeftOrRight - }, - { - EStateNormal, - EPassCtrlDigitsThru, - 0 - } - }, - TABLE_ENTRY_ANOTHER_CTRL_DIGIT - }; - -LOCAL_D const SFuncTable genFuncTables[]= - { - { - 0, - NULL - }, - { - ARRAY_LENGTH(table1), - &table1[0] - }, - { - ARRAY_LENGTH(table2), - &table2[0] - }, - { - ARRAY_LENGTH(table3), - &table3[0] - }, - { - ARRAY_LENGTH(table4), - &table4[0] - }, - { - ARRAY_LENGTH(table5), - &table5[0] - }, - { - ARRAY_LENGTH(table6), - &table6[0] - }, - { - 0, - NULL - }, - { - 0, - NULL - }, - { - 0, - NULL - }, - { - ARRAY_LENGTH(table10), - &table10[0] - }, - { - 0, - NULL - }, - { - ARRAY_LENGTH(table12), - &table12[0] - } - }; - -LOCAL_D const SFuncTables FuncTables= - { - { - ARRAY_LENGTH(defaultTable), - &defaultTable[0] - }, - { - ARRAY_LENGTH(modifierTable), - &modifierTable[0] - }, - ARRAY_LENGTH(genFuncTables), - &genFuncTables[0] - }; - -LOCAL_D const SScanCodeBlock scanCodeBlock_unmodifiable[]= - { - {EStdKeyLeftShift, EStdKeyScrollLock} - }; - -LOCAL_D const TUint16 convKeyCodes_unmodifiable[]= - { - EKeyLeftShift, - EKeyRightShift, - EKeyLeftAlt, - EKeyRightAlt, - EKeyLeftCtrl, - EKeyRightCtrl, - EKeyLeftFunc, - EKeyRightFunc, - EKeyCapsLock, - EKeyNumLock, - EKeyScrollLock - }; - -// base: this table traps all of the keyboard's scanCodes except those in convKeyCodes_unmodifiable -LOCAL_D const SScanCodeBlock scanCodeBlock_base[]= - { - {EStdKeyNull, EStdKeyDownArrow}, - {'0', '9'}, - {'A', 'Z'}, - {EStdKeyF1, EStdKeyDictaphoneRecord}, - }; - -LOCAL_D const TUint16 convKeyCodes_base[]= - { - EKeyNull, - EKeyBackspace, - EKeyTab, - EKeyEnter, - EKeyEscape, - ' ', - EKeyPrintScreen, - EKeyPause, - EKeyHome, - EKeyEnd, - EKeyPageUp, - EKeyPageDown, - EKeyInsert, - EKeyDelete, - EKeyLeftArrow, - EKeyRightArrow, - EKeyUpArrow, - EKeyDownArrow, - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - 'h', - 'i', - 'j', - 'k', - 'l', - 'm', - 'n', - 'o', - 'p', - 'q', - 'r', - 's', - 't', - 'u', - 'v', - 'w', - 'x', - 'y', - 'z', - EKeyF1, - EKeyF2, - EKeyF3, - EKeyF4, - EKeyF5, - EKeyF6, - EKeyF7, - EKeyF8, - EKeyF9, - EKeyF10, - EKeyF11, - EKeyF12, - EKeyF13, - EKeyF14, - EKeyF15, - EKeyF16, - EKeyF17, - EKeyF18, - EKeyF19, - EKeyF20, - EKeyF21, - EKeyF22, - EKeyF23, - EKeyF24, - '`', - ',', - '.', - '/', - '\\', - ';', - '\'', -#ifndef US_KEYBOARD - '#', -#else - '\\', -#endif - '[', - ']', - '-', - '=', - '/', - '*', - '-', - '+', - EKeyEnter, - EKeyEnd, - EKeyDownArrow, - EKeyPageDown, - EKeyLeftArrow, - EKeyNull, // numeric keypad '5' - EKeyRightArrow, - EKeyHome, - EKeyUpArrow, - EKeyPageUp, - EKeyInsert, - EKeyDelete, - EKeyMenu, - EKeyBacklightOn, - EKeyBacklightOff, - EKeyBacklightToggle, - EKeyIncContrast, - EKeyDecContrast, - EKeySliderDown, - EKeySliderUp, - EKeyDictaphonePlay, - EKeyDictaphoneStop, - EKeyDictaphoneRecord, - }; - -// caps-lock: this table traps those scanCodes which are affected by caps-lock -LOCAL_D const SScanCodeBlock scanCodeBlock_capsLock[]= - { - {'A', 'Z'} - }; - -LOCAL_D const TUint16 convKeyCodes_capsLock[]= - { - 'A', - 'B', - 'C', - 'D', - 'E', - 'F', - 'G', - 'H', - 'I', - 'J', - 'K', - 'L', - 'M', - 'N', - 'O', - 'P', - 'Q', - 'R', - 'S', - 'T', - 'U', - 'V', - 'W', - 'X', - 'Y', - 'Z' - }; - -// shift: this table traps those scanCodes which are affected -// by shift EXCEPT for those scanCodes affected by caps-lock -LOCAL_D const SScanCodeBlock scanCodeBlock_shift[]= - { - {'0', '9'}, - {EStdKeyXXX, EStdKeyEquals}, - }; - -LOCAL_D const TUint16 convKeyCodes_shift[]= - { - ')', - '!', - '"', - ELatin1Pound, - '$', - '%', - '^', - '&', - '*', - '(', - ELatin1LogicNot, - '<', - '>', - '?', - '|', - ':', - '@', - '~', - '{', - '}', - '_', - '+' - }; - -// numlock: this table traps those scanCodes which are affected by numlock -LOCAL_D const SScanCodeBlock scanCodeBlock_numLock[]= - { - {EStdKeyNkpForwardSlash, EStdKeyNkpFullStop} - }; - -LOCAL_D const TUint16 convKeyCodes_numLock[]= - { - '/', - '*', - '-', - '+', - EKeyEnter, - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '0', - '.' - }; - -// func: this table traps those scanCodes which are affected -// by func but not shift -LOCAL_D const SScanCodeBlock scanCodeBlock_func[]= - { - {'0', '9'}, - {'K', 'L'}, - {'U', 'U'}, - {'I', 'I'}, - {'O', 'P'}, - {EStdKeySingleQuote, EStdKeySingleQuote}, - {EStdKeyLeftArrow, EStdKeyDownArrow}, - {EStdKeyTab, EStdKeyTab}, - {EStdKeyEscape, EStdKeyEscape}, - {'M', 'M'}, - {EStdKeyComma, EStdKeyFullStop}, - {EStdKeySpace, EStdKeySpace}, - {EStdKeyMenu, EStdKeyMenu}, - }; - -LOCAL_D const TUint16 convKeyCodes_func[]= - { - '}', - '_', - '#', - '\\', - '@', - '<', - '>', - '[', - ']', - '{', - '~', - ';', - '/', - '*', - '-', - '+', - ':', - EKeyHome, - EKeyEnd, - EKeyPageUp, - EKeyPageDown, - EKeyCapsLock, - EKeyOff, - EKeyDecContrast, - EKeyHelp, - EKeyIncContrast, - EKeyBacklightToggle, - EKeyDial, - }; - -// func: this table traps those scanCodes which are affected -// by func and shift - lower case entries -LOCAL_D const SScanCodeBlock scanCodeBlock_funcUnshifted[]= - { - {'E', 'E'}, - }; - -LOCAL_D const TUint16 convKeyCodes_funcUnshifted[]= - { - ELatin1LcEacute, - }; - -// func: this table traps those scanCodes which are affected -// by func and shift - upper case entries -LOCAL_D const SScanCodeBlock scanCodeBlock_funcShifted[]= - { - {'E', 'E'}, - }; - -LOCAL_D const TUint16 convKeyCodes_funcShifted[]= - { - ELatin1UcEacute, - }; - -// ctrl: this table traps those scanCodes which are affected by ctrl -LOCAL_D const SScanCodeBlock scanCodeBlock_ctrl[]= - { -// The space key gets handled else where, otherwise it gets -// thrown away as a NULL key -// {EStdKeySpace, EStdKeySpace}, - - {'A', 'Z'} - }; - -LOCAL_D const TUint16 convKeyCodes_ctrl[]= - { -// 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26 - }; - -LOCAL_D const SConvSubTable - convSubTable_unmodifiable= - { - &convKeyCodes_unmodifiable[0], - { - ARRAY_LENGTH(scanCodeBlock_unmodifiable), - &scanCodeBlock_unmodifiable[0] - } - }, - convSubTable_base= - { - &convKeyCodes_base[0], - { - ARRAY_LENGTH(scanCodeBlock_base), - &scanCodeBlock_base[0] - } - }, - convSubTable_capsLock= - { - &convKeyCodes_capsLock[0], - { - ARRAY_LENGTH(scanCodeBlock_capsLock), - &scanCodeBlock_capsLock[0] - } - }, - convSubTable_shift= - { - &convKeyCodes_shift[0], - { - ARRAY_LENGTH(scanCodeBlock_shift), - &scanCodeBlock_shift[0] - } - }, - convSubTable_numLock= - { - &convKeyCodes_numLock[0], - { - ARRAY_LENGTH(scanCodeBlock_numLock), - &scanCodeBlock_numLock[0] - } - }, - convSubTable_func= - { - &convKeyCodes_func[0], - { - ARRAY_LENGTH(scanCodeBlock_func), - &scanCodeBlock_func[0] - } - }, - convSubTable_funcUnshifted= - { - &convKeyCodes_funcUnshifted[0], - { - ARRAY_LENGTH(scanCodeBlock_funcUnshifted), - &scanCodeBlock_funcUnshifted[0] - } - }, - convSubTable_funcShifted= - { - &convKeyCodes_funcShifted[0], - { - ARRAY_LENGTH(scanCodeBlock_funcShifted), - &scanCodeBlock_funcShifted[0] - } - }, - convSubTable_ctrl= - { - &convKeyCodes_ctrl[0], - { - ARRAY_LENGTH(scanCodeBlock_ctrl), - &scanCodeBlock_ctrl[0] - } - }; - -// Some modifiers, e.g. shift, may required more than one table (other than "base") -// to be searched; therefore arrays of tables are required -LOCAL_D const SConvSubTable - * const convSubTableArray_unmodifiable[]={&convSubTable_unmodifiable}, - * const convSubTableArray_base[]={&convSubTable_base}, - * const convSubTableArray_capsLock[]={&convSubTable_capsLock}, - * const convSubTableArray_shift[]={&convSubTable_capsLock, &convSubTable_shift}, - * const convSubTableArray_capsLockShift[]={&convSubTable_shift}, - * const convSubTableArray_numLock[]={&convSubTable_numLock}, - * const convSubTableArray_func[]={&convSubTable_func,&convSubTable_funcUnshifted}, - * const convSubTableArray_funcShift[]={&convSubTable_func,&convSubTable_funcShifted}, - * const convSubTableArray_ctrl[]={&convSubTable_ctrl}; - -// The order of these nodes is VITAL, as the scanCode/modifiers are -// searched for a match in this order -LOCAL_D const SConvTableNode convTableNodes[]= - { - { - { - 0, - 0 - }, - ARRAY_LENGTH(convSubTableArray_unmodifiable), - &convSubTableArray_unmodifiable[0] - }, - { - { - EModifierCtrl, - EModifierCtrl - }, - ARRAY_LENGTH(convSubTableArray_ctrl), - &convSubTableArray_ctrl[0] - }, - { - { - EModifierNumLock, - EModifierNumLock - }, - ARRAY_LENGTH(convSubTableArray_numLock), - &convSubTableArray_numLock[0] - }, - { - { - EModifierFunc|EModifierShift|EModifierCapsLock, - EModifierFunc - }, - ARRAY_LENGTH(convSubTableArray_func), - &convSubTableArray_func[0] - }, - { - { - EModifierFunc|EModifierShift|EModifierCapsLock, - EModifierFunc|EModifierShift|EModifierCapsLock - }, - ARRAY_LENGTH(convSubTableArray_func), - &convSubTableArray_func[0] - }, - { - { - EModifierFunc|EModifierShift|EModifierCapsLock, - EModifierFunc|EModifierShift - }, - ARRAY_LENGTH(convSubTableArray_funcShift), - &convSubTableArray_funcShift[0] - }, - { - { - EModifierFunc|EModifierShift|EModifierCapsLock, - EModifierFunc|EModifierCapsLock - }, - ARRAY_LENGTH(convSubTableArray_funcShift), - &convSubTableArray_funcShift[0] - }, - { - { - EModifierCapsLock|EModifierShift, - EModifierCapsLock - }, - ARRAY_LENGTH(convSubTableArray_capsLock), - &convSubTableArray_capsLock[0] - }, - { - { - EModifierShift|EModifierCapsLock, - EModifierShift - }, - ARRAY_LENGTH(convSubTableArray_shift), - &convSubTableArray_shift[0] - }, - { - { - EModifierCapsLock|EModifierShift, - EModifierCapsLock|EModifierShift - }, - ARRAY_LENGTH(convSubTableArray_capsLockShift), - &convSubTableArray_capsLockShift[0] - }, - { - { - 0, - 0 - }, - ARRAY_LENGTH(convSubTableArray_base), - &convSubTableArray_base[0] - } - }; - -// The top-level exported data structure of all the conversion tables -LOCAL_D const SConvTable ConvTable= - { - ARRAY_LENGTH(convTableNodes), - &convTableNodes[0] - }; - -// The list of scan-codes on the numeric keypad -LOCAL_D const SScanCodeBlock keypadScanCodeBlockArray[]= - { - {EStdKeyNumLock, EStdKeyNumLock}, - {EStdKeyNkpForwardSlash, EStdKeyNkpFullStop} - }; - -LOCAL_D const SScanCodeBlockList ConvTableKeypadScanCodes= - { - ARRAY_LENGTH(keypadScanCodeBlockArray), - &keypadScanCodeBlockArray[0] - }; - -// The list of non-autorepeating key-codes -LOCAL_D const TUint16 nonAutorepKeyCodeArray[]= - { - EKeyEscape, - EKeyPrintScreen, - EKeyPause, - EKeyInsert, - EKeyLeftShift, - EKeyRightShift, - EKeyLeftAlt, - EKeyRightAlt, - EKeyLeftCtrl, - EKeyRightCtrl, - EKeyLeftFunc, - EKeyRightFunc, - EKeyCapsLock, - EKeyNumLock, - EKeyScrollLock, - EKeyMenu, - EKeyDictaphonePlay, - EKeyDictaphoneStop, - EKeyDictaphoneRecord - }; - -LOCAL_D const SKeyCodeList ConvTableNonAutorepKeyCodes= - { - ARRAY_LENGTH(nonAutorepKeyCodeArray), - &nonAutorepKeyCodeArray[0] - }; - -EXPORT_C void KeyDataSettings(TRadix &aRadix,TCtrlDigitsTermination &aCtrlDigitsTermination,TInt &aDefaultCtrlDigitsMaxCount, - TInt &aMaximumCtrlDigitsMaxCount) - { - aRadix=EDecimal; - aCtrlDigitsTermination=ETerminationByCtrlUp; - aDefaultCtrlDigitsMaxCount=3; - aMaximumCtrlDigitsMaxCount=10; - } - -EXPORT_C void KeyDataFuncTable(SFuncTables &aFuncTables) - { - aFuncTables=FuncTables; - } - -EXPORT_C void KeyDataConvTable(SConvTable &aConvTable, TUint &aConvTableFirstScanCode,TUint &aConvTableLastScanCode, - SScanCodeBlockList &aKeypadScanCode,SKeyCodeList &aNonAutorepKeyCodes) - { - aConvTable=ConvTable; - aConvTableFirstScanCode=scanCodeBlock_base[0].firstScanCode; - aConvTableLastScanCode=scanCodeBlock_base[ARRAY_LENGTH(scanCodeBlock_base)-1].lastScanCode; - aKeypadScanCode=ConvTableKeypadScanCodes; - aNonAutorepKeyCodes=ConvTableNonAutorepKeyCodes; - } - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/keymap/keymap.mmp --- a/baseport/src/cedar/generic/base/syborg/keymap/keymap.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -TARGET VariantTarget(ekdata,dll) -TARGETTYPE dll -LINKAS ekdata.dll - -SYSTEMINCLUDE \epoc32\include - -SOURCE keymap.cpp - -LIBRARY euser.lib - -DEFFILE ..\..\e32\~\ekdata.def - -NOSTRICTDEF - -UID 0x1000008d 0x100039e0 -VENDORID 0x70000001 - -CAPABILITY all -MACRO __SECURE_API__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/monitor/monap.mmp --- a/baseport/src/cedar/generic/base/syborg/monitor/monap.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#define __MONAP_MMP__ - -#include -#include "..\..\e32\kernel\exmondebug.mmp" - -TARGET VariantTarget(exmondebug,dll) - -SYSTEMINCLUDE \epoc32\include\drivers -SYSTEMINCLUDE ..\serial - -SOURCEPATH . -SOURCE monitor.cpp - -LIBRARY PlatformLib - -CAPABILITY all - -VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/monitor/monitor.cpp --- a/baseport/src/cedar/generic/base/syborg/monitor/monitor.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "syborg_serial.h" - -void CrashDebugger::InitUart() -{ - TUint32 debugPortBase = VARIANT_INTERFACE::DebugPortAddr(); - TUint8 res = ReadReg(debugPortBase, 0); - WriteReg(debugPortBase,DCommSyborgSoc::SERIAL_INT_ENABLE,0); -} - -void CrashDebugger::UartOut(TUint aChar) -{ - TUint32 debugPortBase = VARIANT_INTERFACE::DebugPortAddr(); - WriteReg(debugPortBase,DCommSyborgSoc::SERIAL_DATA,aChar); -} - -TUint8 CrashDebugger::UartIn() -{ - TUint32 debugPortBase = VARIANT_INTERFACE::DebugPortAddr(); - while (ReadReg(debugPortBase,DCommSyborgSoc::SERIAL_FIFO_COUNT)==0) - ; - - return ReadReg(debugPortBase,DCommSyborgSoc::SERIAL_DATA); -} - -TBool CrashDebugger::CheckPower() -{ - return EFalse; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/pointer/pointer.mmp --- a/baseport/src/cedar/generic/base/syborg/pointer/pointer.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "kernel\kern_ext.mmh" - -TARGET VariantTarget(epointer,dll) -TARGETTYPE kext -LINKAS epointer.dll - -SYSTEMINCLUDE . -SYSTEMINCLUDE AsspNKernIncludePath - -SOURCEPATH . -SOURCE syborg_pointer.cpp - -//LIBRARY ekern.lib -LIBRARY PlatformLib - -//NOEXPORTLIBRARY - -//DEFFILE ..\e32\~\empty.def -//DEFFILE .\~\cmse.def - -//NOSTRICTDEF - -UID 0x100039cf 0x100000db -VENDORID 0x70000001 - -CAPABILITY all - - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/pointer/syborg_pointer.cpp --- a/baseport/src/cedar/generic/base/syborg/pointer/syborg_pointer.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,276 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic pointer driver -* -*/ - -//#define DEBUG - -#include -#include "syborg_pointer.h" - -TPointerRv::TPointerRv(): - iRxDfc(RxDfc,this,Kern::DfcQue0(),1) -{ - __DEBUG_PRINT("TPointerRv::TPointerRv()"); - TInt r = Interrupt::Bind(EIntPointer,Isr,this); - if(r != KErrNone) - __KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::TPointerRv() Interrupt::Bind(%d)=%d", - EIntPointer, r)); - iPointerOn = ETrue; - iLastBut = 0; - - Interrupt::Enable(EIntPointer); -} - -TPointerRv::~TPointerRv() -{ -} - -struct TPointerRv::PData* TPointerRv::FifoPop(void) -{ - struct TPointerRv::PData* val = &iPDataFifo[iFifoPos]; - iFifoPos++; - iFifoCount--; - - if (iFifoPos == FIFO_SIZE) - iFifoPos = 0; - - return val; -} - -void TPointerRv::FifoPush(struct TPointerRv::PData* val) -{ - TInt slot; - - if (iFifoCount == FIFO_SIZE) - return; - - slot = iFifoPos + iFifoCount; - if (slot >= FIFO_SIZE) - slot -= FIFO_SIZE; - iPDataFifo[slot] = *val; - iFifoCount++; - - // __DEBUG_PRINT("TPointerRv::FifoPush %d %d %d %d",val->x, val->y, val->z, val->but); - // __DEBUG_PRINT("TPointerRv::FifoPush %d %d %d %d",iPDataFifo[slot].x, iPDataFifo[slot].y, iPDataFifo[slot].z, iPDataFifo[slot].but); - -} - -void TPointerRv::Init3() -{ - __DEBUG_PRINT("TPointerRv::Init3"); - - TInt reg = ReadReg(KHwBaseKmiPointer,POINTER_ID); - WriteReg(KHwBaseKmiPointer,POINTER_INT_ENABLE,1); - - TInt r = Kern::AddHalEntry(EHalGroupMouse,DoPointerHalFunction,this); - if(r != KErrNone) - __KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::AddHalEntry()=%d", r)); - - // Get information about the screen display mode - TPckgBuf buf; - TVideoInfoV01& videoInfo = buf(); - - r = Kern::HalFunction(EHalGroupDisplay, EDisplayHalCurrentModeInfo, (TAny*)&buf, NULL); - if(r != KErrNone) - __KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::HalFunction(EDisplayHalCurrentModeInfo)=%d", r)); - - iScreenWidth = videoInfo.iSizeInPixels.iWidth; - iScreenHeight = videoInfo.iSizeInPixels.iHeight; - iDisplayMode = videoInfo.iDisplayMode; - ix = iy = 0; - - iXFactor = Fixed(iScreenWidth) / Fixed(0x8000); - iYFactor = Fixed(iScreenHeight) / Fixed(0x8000); - - iFifoPos = iFifoCount = 0; -} - - -void TPointerRv::Process(TPointerRv *i, struct TPointerRv::PData *pd) -{ - TRawEvent e; - - // __DEBUG_PRINT("Event: X=%d Y=%d Point %d", pd->x, pd->y, pd->but); - // __DEBUG_PRINT(" Last X=%d Y=%d Point %d", i->ix, i->iy, i->iLastBut); - - // i->ix += pd->x; - // i->iy += pd->y; - - i->ix = int(Fixed(pd->x) * i->iXFactor); - i->iy = int(Fixed(pd->y) * i->iYFactor); - - switch(pd->but) - { - case 0: // Button released - switch(i->iLastBut) - { - case 0: - if( (pd->x!=0) || (pd->y!=0) ) { - e.Set(TRawEvent::EPointerMove, i->ix, i->iy); - __DEBUG_PRINT("1 EPointerMove (x:%d y:%d)", i->ix, i->iy); - } - goto fin; - case 1: // Left - e.Set(TRawEvent::EButton1Up, i->ix, i->iy); - __DEBUG_PRINT("2 EButton1UP (x:%d y:%d)", i->ix, i->iy); - goto fin; - case 2: // Right - e.Set(TRawEvent::EButton2Up, i->ix, i->iy); - __DEBUG_PRINT("3 EButton2UP (x:%d y:%d)", i->ix, i->iy); - goto fin; - } - case 1: // Left - if (i->iLastBut == 0) { - e.Set(TRawEvent::EButton1Down, i->ix, i->iy); - __DEBUG_PRINT("4 EButton1Down (x:%d y:%d)", i->ix, i->iy); - } - else if( (pd->x!=0) || (pd->y!=0) ) { - e.Set(TRawEvent::EPointerMove, i->ix, i->iy); - __DEBUG_PRINT("5 EPointerMove (x:%d y:%d)", i->ix, i->iy); - } - break; - case 2: // Right - if (i->iLastBut == 0) { - e.Set(TRawEvent::EButton2Down, i->ix, i->iy); - __DEBUG_PRINT("6 EButton2Down (x:%d y:%d)", i->ix, i->iy); - } - else if( (pd->x!=0) || (pd->y!=0) ) { - e.Set(TRawEvent::EPointerMove, i->ix, i->iy); - __DEBUG_PRINT("7 EPointerMove (x:%d y:%d)", i->ix, i->iy); - } - break; - - } - fin: - Kern::AddEvent(e); - i->iLastBut = pd->but; -} - -void TPointerRv::RxDfc(TAny* aPtr) -{ - __DEBUG_PRINT("TPointerRv::RxDfc"); - - TPointerRv* i = static_cast(aPtr); - - while(i->iFifoCount>0) { - struct TPointerRv::PData *pd= i->FifoPop(); - Process(i,pd); - } -} - -void TPointerRv::Isr(TAny* aPtr) -{ - __DEBUG_PRINT("TPointerRv::Isr"); - - TPointerRv& k = *(TPointerRv*)aPtr; - // interrupts are now auto clear - - while(ReadReg(KHwBaseKmiPointer, POINTER_FIFO_COUNT)!=0) { - struct TPointerRv::PData pd; - pd.x = ReadReg(KHwBaseKmiPointer,POINTER_X); - pd.y = ReadReg(KHwBaseKmiPointer,POINTER_Y); - pd.z = ReadReg(KHwBaseKmiPointer,POINTER_Z); - pd.but = ReadReg(KHwBaseKmiPointer,POINTER_BUTTONS); - k.FifoPush(&pd); - WriteReg(KHwBaseKmiPointer,POINTER_LATCH,0); - } - - // WriteReg(KHwBaseKmiPointer,POINTER_CLEAR_INT,0); - Interrupt::Clear(EIntPointer); - k.iRxDfc.Add(); -} - -TInt TPointerRv::DoPointerHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2) -{ - return static_cast(aThis)->PointerHalFunction(aFunction,a1,a2); -} - -TInt TPointerRv::PointerHalFunction(TInt aFunction, TAny* a1, TAny* /*a2*/) -{ - __DEBUG_PRINT("TPointerRv::PointerHalFunction"); - - TInt r=KErrNone; - - switch(aFunction) - { - case EMouseHalMouseState: - { - kumemput32(a1, (TBool*)&iPointerOn, sizeof(TBool)); - break; - } - case EMouseHalSetMouseState: - { - __SECURE_KERNEL( - if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, - __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseState"))) - return KErrPermissionDenied; - ); - if(((TBool)a1 == HAL::EMouseState_Visible) && (iPointerOn == (TBool)EFalse)) - { - iPointerOn=(TBool)ETrue; - } - else if(((TBool)a1 == HAL::EMouseState_Invisible) && (iPointerOn==(TBool)ETrue)) - { - iPointerOn=(TBool)EFalse; - } - break; - } - case EMouseHalMouseInfo: - { - TPckgBuf vPckg; - TMouseInfoV01& xyinfo = vPckg(); - xyinfo.iMouseButtons = 2; - xyinfo.iMouseAreaSize.iWidth = iScreenWidth; - xyinfo.iMouseAreaSize.iHeight = iScreenHeight; - xyinfo.iOffsetToDisplay.iX = 0; - xyinfo.iOffsetToDisplay.iY = 0; - Kern::InfoCopy(*(TDes8*)a1,vPckg); - break; - } - case EMouseHalSetMouseSpeed: - { - __SECURE_KERNEL( - if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, - __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseSpeed"))) - return KErrPermissionDenied; - ); - // fall thru to NotSupported - } - case EMouseHalSetMouseAcceleration: - { - __SECURE_KERNEL( - if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, - __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseAcceleration"))) - return KErrPermissionDenied; - ); - // fall thru to NotSupported - } - default: - { - r = KErrNotSupported; - break; - } - } - return r; -} - -DECLARE_STANDARD_EXTENSION() -{ - __DEBUG_PRINT("DECLARE_STANDARD_EXTENSION"); - TPointerRv *d = new TPointerRv; - d->Init3(); - return KErrNone; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/pointer/syborg_pointer.h --- a/baseport/src/cedar/generic/base/syborg/pointer/syborg_pointer.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic pointer driver -* -*/ - -#ifndef _SYBORG_POINTER_H -#define _SYBORG_POINTER_H - -#include -#include -#include -#include - -#define FIFO_SIZE 16 - -#ifdef DEBUG -#define __DEBUG_PRINT(format...) Kern::Printf(format) -#else -#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) -#endif - -class TPointerRv -{ -public: - TPointerRv(); - virtual ~TPointerRv(); - static TInt DoPointerHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2); - TInt PointerHalFunction(TInt aFunction, TAny* a1, TAny* a2); - void Init3(); - - private: - struct PData { - TInt x; - TInt y; - TInt z; - TInt but; - }; - - struct PData* FifoPop(void); - void FifoPush(struct PData*); - - struct PData iPDataFifo[FIFO_SIZE]; - TInt iFifoPos; - TInt iFifoCount; - - private: - static void Isr(TAny* aPtr); - static void RxDfc(TAny* aPtr ); - static void Process(TPointerRv *i, struct PData *); - - TDfc iRxDfc; - - TBool iPointerOn; // cursor visiability - TInt iScreenWidth; - TInt iScreenHeight; - TInt iDisplayMode; - - TInt ix,iy; - TInt iLastBut; - - - public: - - enum { - POINTER_ID = 0, - POINTER_LATCH = 1, - POINTER_FIFO_COUNT = 2, - POINTER_X = 3, - POINTER_Y = 4, - POINTER_Z = 5, - POINTER_BUTTONS = 6, - POINTER_INT_ENABLE = 7 - }; - - private: - // Fixed point maths - class Fixed { - - private: - int g; - const static int BP = 8; - const static int BP2 = BP*2; - enum FixedRaw { RAW }; - Fixed(FixedRaw, int guts) : g(guts) {} - - public: - Fixed() : g(0) {} - Fixed(const Fixed& a) : g( a.g ) {} - Fixed(int a) : g( a << BP ) {} - operator int() { return g>>BP; } - Fixed operator +() const { return Fixed(RAW,g); } - Fixed operator -() const { return Fixed(RAW,-g); } - Fixed operator +(const Fixed& a) const { return Fixed(RAW, g + a.g); } - Fixed operator -(const Fixed& a) const { return Fixed(RAW, g - a.g); } - Fixed operator *(const Fixed& a) const { return Fixed(RAW, (int)( ((long long)g * (long long)a.g ) >> BP)); } - Fixed operator /(const Fixed& a) const { return Fixed(RAW, int( (((long long)g << BP2) / (long long)(a.g)) >> BP) ); } - }; - - Fixed iXFactor; - Fixed iYFactor; -}; - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/rom/base_syborg.iby --- a/baseport/src/cedar/generic/base/syborg/rom/base_syborg.iby Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Used by techview roms -* -*/ - -#ifndef __BASE_SYBORG_IBY__ -#define __BASE_SYBORG_IBY__ - -#define HEAPMAX(x) -//#define FIXED fixed -#define FIXED - -kerneltrace 0x80000000 - -memmodel multiple 0x100000 -//memmodel flexible 0x100000 0x1000 -0x4000 -//dlldatatop 0x7f000000 - -multikernel -bootbinary= KERNEL_DIR\_PLATFORM_NAME_bootloader_bootrom.bin - -debugport 0 -romsize=0x2000000 -romlinearbase=0x80000000 -romalign=0x10 -kerneldataaddress=0xC8000000 -kernelheapmin=0x08000 // calculated at boot time -kernelheapmax=0x00FFC000 -dataaddress=0x400000 -defaultstackreserve=0x200000 -romchecksum=0x12345678 - -// Must align kernel to 16K boundary since exception vectors will be mapped at 0xFFFF0000 -primary[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_ekern.exe \sys\bin\ekern.exe code-align 0x4000 - -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_btracex.ldd \sys\bin\btracex.ldd -file= ABI_DIR\DEBUG_DIR\btracec.dll \sys\bin\btracec.dll - -define BTRACEX_LDD _PLATFORM_NAME_btracex.ldd - -variant[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_kasyborg.dll \sys\bin\kasyborg.dll - -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_exmoncommon.dll \sys\bin\exmoncommon.dll -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_exmondebug.dll \sys\bin\exmondebug.dll - -extension[VARID]= KERNEL_DIR\DEBUG_DIR\kdebug.dll \sys\bin\kdebug.dll - -#ifdef RMDEBUG -#include "..\include\trk.iby" -#endif - -// IEEE-mode VFP support -extension[VARID]= KERNEL_DIR\DEBUG_DIR\evfp.dll \sys\bin\evfp.dll - -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_lcd.dll \sys\bin\lcd.dll - -device[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_eserial.pdd \sys\bin\euart1.pdd -device[VARID]= KERNEL_DIR\DEBUG_DIR\ecomm.ldd \sys\bin\ecomm.ldd - -extension[VARID]= KERNEL_DIR\DEBUG_DIR\elocd.ldd \sys\bin\elocd.ldd - -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_epointer.dll \sys\bin\epointer.dll -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_medint.pdd \sys\bin\medint.pdd - -extension[VARID]= KERNEL_DIR\DEBUG_DIR\exstart.dll \sys\bin\exstart.dll - -// Keyboard driver -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_ekeyb.dll \sys\bin\ekeyb.dll - -// Kernel pipe -device[VARID]= KERNEL_DIR\DEBUG_DIR\pipelib.ldd \sys\bin\pipelib.ldd - -// Host Filesystem -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_svphostfsdriver.ldd sys\bin\svphostfsdriver.ldd -file= KERNEL_DIR\DEBUG_DIR\svphostfsy.fsy sys\bin\svphostfsy.fsy -file= KERNEL_DIR\DEBUG_DIR\svphostfs.exe sys\bin\svphostfs.exe -file= KERNEL_DIR\DEBUG_DIR\svphostfsstart.exe sys\bin\sysstart.exe - -// file= KERNEL_DIR\DEBUG_DIR\stdnew.dll sys\bin\stdnew.dll - -// Snap Driver -extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_svpsnapdriver.ldd sys\bin\svpsnapdriver.ldd -file= KERNEL_DIR\DEBUG_DIR\snapapp.exe sys\bin\snapapp.exe - -// Estart drive mapping setup files. -data= EPOCROOT##epoc32\rom\syborg\estart.txt \sys\data\estart.txt - -define HAL_DLL _PLATFORM_NAME_hal.dll -define ESTART_EXE e32strt.exe -define KEYMAP_FILE _PLATFORM_NAME_ekdata -#define SCDV_DLL _PLATFORM_NAME_scdv.dll -#define EUSER_DLL _PLATFORM_NAME_euser.dll - -#endif // __BASE_SYBORG_IBY__ - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/rom/header.iby --- a/baseport/src/cedar/generic/base/syborg/rom/header.iby Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#define HEAPMAX(x) - -#define VARID 0x0b0a0001 -#define MAGIC 0x0b0a0001 -#define ALL 0x0b0a0001 -#define FIXED - -kerneltrace 0x80000000 - -memmodel multiple 0x100000 -//memmodel flexible 0x100000 0x1000 -0x4000 -//dlldatatop 0x7f000000 - -trace 0x10 -collapse arm gcc 0 -multikernel - -version=0.01 -bootbinary=\epoc32\release\##MAIN##\_syborg_bootloader_bootrom.bin - -debugport 0 -romsize=0x2000000 -romlinearbase=0x80000000 -romalign=0x10 -kerneldataaddress=0xC8000000 -kernelheapmin=0x08000 // calculated at boot time -kernelheapmax=0x00FFF000 -dataaddress=0x400000 -defaultstackreserve=0x200000 -romchecksum=0x12345678 - -nowrapper // no rom header - -#ifdef UNICODE -unicode -#endif - -#define VARIANT_PATH syborg diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/rom/kernel.iby --- a/baseport/src/cedar/generic/base/syborg/rom/kernel.iby Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Used by textshell roms -* -*/ - -//#define USE_AUTOEXEC - -#define EUSER_DLL _##VARIANT##_EUSER.DLL - -// Must align kernel to 16K boundary since exception vectors will be mapped at 0xFFFF0000 -primary[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EKERN.EXE \sys\bin\EKERN.EXE code-align 0x4000 -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_BTRACEX.LDD \sys\bin\BTRACEX.LDD -variant[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_KASYBORG.DLL \sys\bin\KASYBORG.DLL - -// IEEE-mode VFP support -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\EVFP.DLL \sys\bin\EVFP.DLL - -// Common monitor support. Must be before both interactive debugger and automatic logger. -extension[VARID]= \Epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EXMONCOMMON.DLL \sys\bin\EXMONCOMMON.DLL -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EXMONDEBUG.DLL \sys\bin\EXMONDEBUG.DLL - -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\KDEBUG.DLL \sys\bin\KDEBUG.DLL - -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_LCD.DLL \sys\bin\LCD.DLL -device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_ESERIAL.PDD \sys\bin\ESERIAL.PDD -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\ELOCD.LDD \sys\bin\ELOCD.LDD - -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EPOINTER.DLL \sys\bin\EPOINTER.DLL - -device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\ECOMM.LDD \sys\bin\ECOMM.LDD -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\EXSTART.DLL \sys\bin\EXSTART.DLL - -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EKEYB.DLL \sys\bin\EKEYB.DLL - -file[VARID]= \epoc32\release\##MAIN##\##BUILD##\_##VARIANT##_EKDATA.DLL \sys\bin\EKDATA.DLL - -// Kernel pipe -device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\PIPELIB.LDD \sys\bin\PIPELIB.LDD - -// Host Filesystem -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_svphostfsdriver.ldd \sys\bin\svphostfsdriver.ldd -file= \epoc32\release\##KMAIN##\##BUILD##\svphostfsy.fsy \sys\bin\svphostfsy.fsy -file= \epoc32\release\##KMAIN##\##BUILD##\svphostfs.exe \sys\bin\svphostfs.exe -file= \epoc32\release\##KMAIN##\##BUILD##\svphostfsstart.exe \sys\bin\sysstart.exe - -// Snap Driver -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_svpsnapdriver.ldd \sys\bin\svpsnapdriver.ldd -file= \epoc32\release\##KMAIN##\##BUILD##\snapapp.exe \sys\bin\snapapp.exe - -// Estart -data= \epoc32\rom\syborg\ESTART.TXT \sys\data\ESTART.TXT - -#ifdef USE_AUTOEXEC -data= \epoc32\rom\##VARIANT##\AUTOEXEC.BAT AUTOEXEC.BAT -#endif - -extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_MEDINT.PDD \sys\bin\MEDINT.PDD -//device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\D_DEBUG.LDD \sys\bin\D_DEBUG.LDD diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/serial/serial.mmp --- a/baseport/src/cedar/generic/base/syborg/serial/serial.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "kernel\kern_ext.mmh" - -TARGET VariantTarget(eserial,pdd) -TARGETTYPE pdd - -SYSTEMINCLUDE \epoc32\include\drivers -SYSTEMINCLUDE AsspNKernIncludePath - -SOURCEPATH . -SOURCE syborg_serial.cpp - -LIBRARY PlatformLib - -EPOCALLOWDLLDATA - -UID 0 0x1000015b -VENDORID 0x70000001 - -ROMTARGET eserial.pdd - -CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/serial/syborg_serial.cpp --- a/baseport/src/cedar/generic/base/syborg/serial/syborg_serial.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,252 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic serial driver -* -* TODO: Handle multiple Units, hardcoded FIFO Size -*/ - -#include "syborg_serial.h" - -//#define DPRINT(x) Kern::Printf(x) -//#define DPRINT2(x,y) Kern::Printf(x,y) - -#define DPRINT(x) -#define DPRINT2(x,y) - -// --------------------------------------------------------------- -// --------------------------------------------------------------- - -DDriverSyborgComm::DDriverSyborgComm() -{ - iVersion=TVersion(KCommsMajorVersionNumber,KCommsMinorVersionNumber,KCommsBuildVersionNumber); -} - -TInt DDriverSyborgComm::Install() -{ - DPRINT("DDriverSyborgComm::Install"); - return SetName(&KPddName); -} - -void DDriverSyborgComm::GetCaps(TDes8 &aDes) const -{ - DPRINT("DDriverSyborgComm::GetCaps"); - - TCommCaps3 capsBuf; - TCommCapsV03 &c=capsBuf(); - c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400; - c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8; - c.iStopBits=KCapsStop1|KCapsStop2; - c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd; - c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported; - c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported; - c.iSIR=0; - c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported; - c.iFifo=KCapsHasFifo; - c.iRoleCaps=0; - c.iFlowControlCaps=0; - c.iBreakSupported=ETrue; - aDes.FillZ(aDes.MaxLength()); - aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength())); -} - -TInt DDriverSyborgComm::Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) -{ - DPRINT("DDriverSyborgComm::Create"); - - DCommSyborgSoc* pD=new DCommSyborgSoc; - aChannel=pD; - TInt r=KErrNoMemory; - if (pD) - r=pD->DoCreate(aUnit,anInfo); - return r; -} - -TInt DDriverSyborgComm::Validate(TInt aUnit, const TDesC8* /*anInfo*/, const TVersion& aVer) -{ - DPRINT("DDriverSyborgComm::Validate"); - if ((!Kern::QueryVersionSupported(iVersion,aVer)) || - (!Kern::QueryVersionSupported(aVer,TVersion(KMinimumLddMajorVersion,KMinimumLddMinorVersion,KMinimumLddBuild)))) - return KErrNotSupported; - return KErrNone; -} - -// --------------------------------------------------------------- -// --------------------------------------------------------------- - -DCommSyborgSoc::DCommSyborgSoc() -{ -} - -DCommSyborgSoc::~DCommSyborgSoc() -{ - Interrupt::Unbind(iIrq); -} - -TInt DCommSyborgSoc::DoCreate(TInt aUnit, const TDesC8* /*anInfo*/) -{ - DPRINT2("DCommSyborgSoc::DoCreate %d",aUnit); - switch(aUnit) - { - case 0: - iPortAddr = KHwBaseUart0; - iIrq = EIntSerial0; - break; - case 1: - iPortAddr = KHwBaseUart1; - iIrq = EIntSerial1; - break; - case 2: - iPortAddr = KHwBaseUart2; - iIrq = EIntSerial2; - break; - case 3: - iPortAddr = KHwBaseUart3; - iIrq = EIntSerial3; - break; - default: - iPortAddr = KHwBaseUart0; - iIrq = EIntSerial0; - break; - } - - Interrupt::Bind(EIntSerial0,Isr,this); - - return KErrNone; - -} - -TInt DCommSyborgSoc::Start() -{ - DPRINT("DCommSyborgSoc::Start"); - WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x1); - Interrupt::Enable(iIrq); - return KErrNone; -} - -void DCommSyborgSoc::Stop(TStopMode aMode) -{ - DPRINT("DCommSyborgSoc::Stop"); - WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x0); - Interrupt::Disable(iIrq); -} - -void DCommSyborgSoc::Break(TBool aState) -{ - DPRINT("DCommSyborgSoc::Break"); -} - -void DCommSyborgSoc::EnableTransmit() -{ - DPRINT("DCommSyborgSoc::EnableTransmit"); - while (Kern::PowerGood()) - { - TInt r=TransmitIsr(); - if (r<0) - break; - WriteReg(iPortAddr, SERIAL_DATA, r); - } -} - -TUint DCommSyborgSoc::Signals() const -{ - DPRINT("DCommSyborgSoc::Signals"); - return(0); -} - -void DCommSyborgSoc::SetSignals(TUint aSetMask, TUint aClearMask) -{ - DPRINT("DCommSyborgSoc::SetSignals"); -} - -TInt DCommSyborgSoc::ValidateConfig(const TCommConfigV01 &aConfig) const -{ - DPRINT("DCommSyborgSoc::ValidateConfig"); - return KErrNone; -} - -void DCommSyborgSoc::Configure(TCommConfigV01 &aConfig) -{ - DPRINT("DCommSyborgSoc::Configure"); -} - -void DCommSyborgSoc::Caps(TDes8 &aCaps) const -{ - DPRINT("DCommSyborgSoc::Caps"); - TCommCaps3 capsBuf; - TCommCapsV03 &c=capsBuf(); - c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400; - c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8; - c.iStopBits=KCapsStop1|KCapsStop2; - c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd; - c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported; - c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported; - c.iSIR=0; - c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported; - c.iFifo=KCapsHasFifo; - c.iRoleCaps=0; - c.iFlowControlCaps=0; - c.iBreakSupported=ETrue; - aCaps.FillZ(aCaps.MaxLength()); - aCaps=capsBuf.Left(Min(capsBuf.Length(),aCaps.MaxLength())); -} - -TInt DCommSyborgSoc::DisableIrqs() -{ - DPRINT("DCommSyborgSoc::DisableIrqs"); - return NKern::DisableAllInterrupts(); -} - -void DCommSyborgSoc::RestoreIrqs(TInt aIrq) -{ - DPRINT("DCommSyborgSoc::RestoreIrqs"); - NKern::RestoreInterrupts(aIrq); -} - -TDfcQue* DCommSyborgSoc::DfcQ(TInt /*aUnit*/) -{ - return Kern::DfcQue0(); -} - -void DCommSyborgSoc::CheckConfig(TCommConfigV01& aConfig) -{ - DPRINT("DCommSyborgSoc::CheckConfig"); -} - -void DCommSyborgSoc::Isr(TAny* aPtr) -{ - DCommSyborgSoc& d=*(DCommSyborgSoc*)aPtr; - TUint rx[32]; - TInt rxi=0; - - DPRINT2("DCommSyborgSoc::Isr %x",d.iIrq); - - // Is now auto clear - // WriteReg(d.iPortAddr, SERIAL_CLEAR_INT, 0x0); // clear interrupts - - while(ReadReg(d.iPortAddr, SERIAL_FIFO_COUNT)!=0) { - TUint ch = ReadReg(d.iPortAddr, SERIAL_DATA); - rx[rxi++]=ch; - } - d.ReceiveIsr(rx,rxi,0); -} - -// --------------------------------------------------------------- -// --------------------------------------------------------------- - -DECLARE_STANDARD_PDD() -{ - DPRINT("DECLARE_STANDARD_PDD()"); - return new DDriverSyborgComm; -} - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/serial/syborg_serial.h --- a/baseport/src/cedar/generic/base/syborg/serial/syborg_serial.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Minimalistic serial driver -* -*/ - -#ifndef _SYBORG_SERIAL_H -#define _SYBORG_SERIAL_H - -#include -#include -#include "system.h" - -const TInt KMinimumLddMajorVersion=1; -const TInt KMinimumLddMinorVersion=1; -const TInt KMinimumLddBuild=1; - -class DDriverSyborgComm : public DPhysicalDevice -{ -public: - DDriverSyborgComm(); - virtual TInt Install(); - virtual void GetCaps(TDes8 &aDes) const; - virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); - virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); -}; - -class DCommSyborgSoc : public DComm -{ -public: - DCommSyborgSoc(); - ~DCommSyborgSoc(); - TInt DoCreate(TInt aUnit, const TDesC8* anInfo); -public: - virtual TInt Start(); - virtual void Stop(TStopMode aMode); - virtual void Break(TBool aState); - virtual void EnableTransmit(); - virtual TUint Signals() const; - virtual void SetSignals(TUint aSetMask, TUint aClearMask); - virtual TInt ValidateConfig(const TCommConfigV01 &aConfig) const; - virtual void Configure(TCommConfigV01 &aConfig); - virtual void Caps(TDes8 &aCaps) const; - virtual TInt DisableIrqs(); - virtual void RestoreIrqs(TInt aIrq); - virtual TDfcQue* DfcQ(TInt aUnit); - virtual void CheckConfig(TCommConfigV01& aConfig); - static void Isr(TAny* aPtr); - -public: - TLinAddr iPortAddr; - TInt iIrq; - - enum { - SERIAL_ID = 0, - SERIAL_DATA = 1, - SERIAL_FIFO_COUNT = 2, - SERIAL_INT_ENABLE = 3, - SERIAL_DMA_TX_ADDR = 4, - SERIAL_DMA_TX_COUNT = 5, /* triggers dma */ - SERIAL_DMA_RX_ADDR = 6, - SERIAL_DMA_RX_COUNT = 7 /* triggers dma */ - }; -}; - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/assp.cpp --- a/baseport/src/cedar/generic/base/syborg/specific/assp.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,279 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: implementation of class Syborg -* -*/ - -#include -#include - -#ifdef __EMI_SUPPORT__ -#include -#endif - -//#define ASSP_DEBUG - -#ifdef ASSP_DEBUG -#define __DEBUG_PRINT(format...) Kern::Printf(format) -#else -#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) -#endif - -Syborg* Syborg::Variant=NULL; -// !@! -#if 0 -TPhysAddr Syborg::VideoRamPhys; -TPhysAddr Syborg::VideoRamPhysSecure; // Secure display memory -#endif - -GLDEF_D Syborg TheVariant; - -// Wait for interrupt idle routine -extern TInt SyborgWFIIdle(); - -DECLARE_STANDARD_ASSP() - -EXPORT_C Asic* VariantInitialise() -{ - return &TheVariant; -} - -void Syborg::Idle() -{ - // Use the basic Wait For Interrupt call to idle - TInt irq = NKern::DisableAllInterrupts(); -#ifdef __EMI_SUPPORT__ - EMI::EnterIdle(); -#endif - SyborgWFIIdle(); -#ifdef __EMI_SUPPORT__ - EMI::LeaveIdle(); -#endif - NKern::RestoreInterrupts(irq); -} - -TUint32 Syborg::NanoWaitCalibration() -{ - return 17; // 2 cycles approx 17ns at 125MHz -} - -TInt Syborg::VariantHal(TInt aFunction, TAny* a1, TAny* a2) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Syborg::VariantHal(%d, %0x, %0x)",aFunction,a1,a2)); - - switch(aFunction) - { - case EVariantHalVariantInfo: - { - TVariantInfoV01Buf infoBuf; - TVariantInfoV01& info = infoBuf(); - TUint clock=0; - info.iRomVersion = Epoc::RomHeader().iVersion; - info.iMachineUniqueId = (TInt64(HALData::EMachineUid_OmapH4)<<32); - info.iLedCapabilities = (8<<16) + KLedMaskGreen1; - info.iProcessorClockInKHz = clock; - info.iSpeedFactor = clock/25; - Kern::InfoCopy(*(TDes8*)a1,infoBuf); - break; - } - case EVariantHalDebugPortSet: - { - TUint32 thePort = (TUint32)a1; - switch(thePort) // Accept UART(0-3) - { - case 0: - case 1: - case 2: - case 3: - { - TSyborg::MarkDebugPortOff(); // mark port is not initialised - Kern::SuperPage().iDebugPort = thePort; // update the super page - Syborg::DebugInit(); // init debug port - break; - } - case (TUint32)KNullDebugPort: // debug output supressed - { - TSyborg::MarkDebugPortOff(); // mark port is not initialised - Kern::SuperPage().iDebugPort = thePort; // update the super page - break; - } - default: - return KErrNotSupported; - } - break; - } - case EVariantHalDebugPortGet: - { - TUint32 thePort = Kern::SuperPage().iDebugPort; - kumemput32(a1, &thePort, sizeof(TUint32)); - break; - } - case EVariantHalSwitches: - { - TUint32 x = 0; //Register32(KHwBaseSystemReg+KHoRoSystemSw); - kumemput32(a1, &x, sizeof(x)); - break; - } - case EVariantHalLedMaskSet: - { - //SetRegister32(KHwBaseSystemReg+KHoRwSystemLed, (TUint32)a1 & 0xFF); - break; - } - case EVariantHalLedMaskGet: - { - TUint32 x = 0; //Register32(KHwBaseSystemReg+KHoRwSystemLed); - kumemput32(a1, &x, sizeof(x)); - break; - } - case EVariantHalCustomRestartReason: - { - // Restart reason is stored in super page - TInt x = (Kern::SuperPage().iHwStartupReason); // & KmRestartCustomReasons) >> KsRestartCustomReasons; - kumemput32(a1, &x, sizeof(TInt)); - break; - } - case EVariantHalCustomRestart: - { - __KERNEL_CAPABILITY_CHECK( - if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt, - __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EVariantHalCustomRestart"))) - return KErrPermissionDenied; - ) - Kern::Restart(0); - break; - } - default: - { - return KErrNotSupported; - } - } - return KErrNone; -} - -TPtr8 Syborg::MachineConfiguration() -{ - return TPtr8((TUint8*)&Kern::MachineConfig(),40,40); -} - -EXPORT_C Syborg::Syborg() -{ - iDebugPortBase = TSyborg::DebugPortAddr(); // initialised in bootstrap -} - -EXPORT_C TMachineStartupType Syborg::StartupReason() -{ - TUint s = Kern::SuperPage().iHwStartupReason; - __DEBUG_PRINT("Syborg::StartupReason CPU page value 0x%08X", s); - return EStartupColdReset; -} - -EXPORT_C void Syborg::Init1() -{ - __DEBUG_PRINT("Syborg::Init1()"); - - // Enable the CLCD in the System registers - SyborgInterrupt::Init1(); -} - -EXPORT_C void Syborg::Init3() -{ - NTimerQ& m = *(NTimerQ*)NTimerQ::TimerAddress(); - m.iRounding = -5; - - TInt r = Interrupt::Bind(EIntTimer1,SyborgInterrupt::MsTimerTick,&m); - if (r != KErrNone) - { - Kern::Fault("BindMsTick",r); - } - - TSyborg::Init3(); - TSyborg::ClearTimerInt(KHwBaseCounterTimer); - - r = Interrupt::Enable(EIntTimer1); - if (r != KErrNone) - { - Kern::Fault("EnbMsTick",r); - } - - TSyborg::SetTimerLoad(KHwBaseCounterTimer, K1000HzTickMatchLoad); - // TSyborg::SetTimerLoad(KHwBaseCounterTimer, 1000000); - TSyborg::SetTimerMode(KHwBaseCounterTimer, TSyborg::ETimerModePeriodic); - TSyborg::EnableTimerInterrupt(KHwBaseCounterTimer); - TSyborg::EnableTimer(KHwBaseCounterTimer, TSyborg::EEnable); - - SyborgInterrupt::Init3(); - - // !@! -#if 0 - // Allocate physical RAM for video - TInt vSize = TSyborg::VideoRamSize(); - - r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhys); - if (r != KErrNone) - { - Kern::Fault("AllocVideoRam",r); - } - - // Allocate physical RAM for secure display - r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhysSecure); - if (r != KErrNone) - { - Kern::Fault("AllocVideoRam 2",r); - } -#endif - __DEBUG_PRINT("Finished Syborg::Init3()"); -} - -EXPORT_C void Syborg::DebugInit() -{ - iDebugPortBase = TSyborg::DebugPortAddr(); - - if(iDebugPortBase != (TUint32)KNullDebugPort) // supress debug output - { - TUint8 res = ReadReg(iDebugPortBase, 0); - } -} - -// -// Output a character to the debug port -// -EXPORT_C void Syborg::DebugOutput(TUint aLetter) -{ - if(!iDebugPortBase) - { - DebugInit(); - } - - if(iDebugPortBase != (TUint32)KNullDebugPort) // supress debug output - { - WriteReg(iDebugPortBase,1,aLetter); - } -} - -EXPORT_C TInt Syborg::MsTickPeriod() -{ - return 1000; -} - -EXPORT_C TInt Syborg::SystemTimeInSecondsFrom2000(TInt& aTime) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("RTC READ: %d",aTime)); - return KErrNone; -} - -EXPORT_C TInt Syborg::SetSystemTimeInSecondsFrom2000(TInt aTime) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Set RTC: %d",aTime)); // do this here to allow the value to be loaded... - return KErrNone; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/highrestimer.h --- a/baseport/src/cedar/generic/base/syborg/specific/highrestimer.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -/** - * @file - * @internalTechnology - * - * The highrestimer.h header file defines how to access the high resoltion - * timer, if one is supported. This file is used by default if the variant does - * not export one to \epoc32\include\nkern. - */ - -#ifndef __HIGHRESTIMER_H__ -#define __HIGHRESTIMER_H__ -// -// Copyright (c) 2008 Symbian Ltd. All rights reserved. -// - -#include - -/** - * Macro indicating that a high resolution timer is supported. - */ -#define HAS_HIGH_RES_TIMER - -/** - * Assembler macro to get the the current value of the high res timer and place - * it in the specified register. - * Reads the 32-bit value from a free-running counter that represents the current time. - * Syborg timers have 'microsecond resolution'. NB. This value comes from the host clock - * and so there is a good chance that the kernels tick based notion of time (elapsed) and that - * measured by the free running timer will get out of kilter. This affects t_cputime from e32test - * amongst other things. - */ -//#define GET_HIGH_RES_TICK_COUNT(Rd) asm("nop"); -// Hi-jacking r10 for tmp, not good if Rd is R10 -- grepping the the kernel shows it's not (for now) -#define GET_HIGH_RES_TICK_COUNT(Rd) \ - asm("push {r10}"); \ - asm("mov r10, #2"); \ - asm("ldr "#Rd", =%a0" : : "i" (KHwBaseRtc + 4)); \ - asm("str r10, ["#Rd", #%a0]" : : "i" (0)); \ - asm("pop {r10}"); \ - asm("ldr "#Rd", =%a0" : : "i" (KHwBaseRtc + 8)); \ - asm("ldr "#Rd", ["#Rd", #%a0]" : : "i" (0)); - -/** - * The frequency of the timer in Hz. - */ -const TInt KHighResTimerFrequency = 1000000; - -/** - * Macro indicating that the timer counts up if defined. - */ -#define HIGH_RES_TIMER_COUNTS_UP - -#endif // __HIGHRESTIMER_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/interrupts.cia --- a/baseport/src/cedar/generic/base/syborg/specific/interrupts.cia Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Syborg interrupt control and dispatch -* -*/ - -#include -#include -#include - -// CIA symbols for ASSP code? -#if defined(__GCC32__) -// CIA symbol macros for Gcc98r2 -#define CSM_ZN7NTimerQ4TickEv " Tick__7NTimerQ" -#elif defined(__ARMCC__) -// CIA symbol macros for RVCT -#define CSM_ZN7NTimerQ4TickEv " __cpp(NTimerQ::Tick)" -#else -// CIA symbol macros for EABI assemblers -#define CSM_ZN7NTimerQ4TickEv " _ZN7NTimerQ4TickEv" -#endif - -/******************************************************************** - * Wait for interrupt idle routine which does not disable interrupts - ********************************************************************/ - -__NAKED__ void SyborgWFIIdle() -{ - // Enter an idle state and wait for interrupts - asm("mov r0, #0"); - asm("mcr p15, 0, r0, c7, c0, 4"); - asm("bx lr"); -} - -/******************************************************************** - * Service 1ms tick interrupt & timer 1 interrupt - ********************************************************************/ - -__NAKED__ void SyborgInterrupt::MsTimerTick(TAny* /*aPtr*/) -{ - // Service 1ms tick interrupt - asm("ldr r1, __KHwCounterTimer"); - asm("push {r0}"); - asm("mov r0, #1"); - asm("str r0, [r1, #24]"); - asm("pop {r0}"); - asm("b "CSM_ZN7NTimerQ4TickEv); - asm("bx lr"); - - asm("__KHwCounterTimer:"); - asm(".word %a0" : : "i" ((TInt)KHwBaseCounterTimer)); -} - -/******************************************************************** - * Interrupt handling/dispatch - ********************************************************************/ -// IRQ dispatcher -// Enter with r0-r3, r12 and return address on IRQ stack -// Must preserve r4-r11 -// Uses r4,r5,r12 -__NAKED__ void SyborgInterrupt::IrqDispatch() -{ - asm("push {r4,r5,lr} "); - asm("ldr r4, __KHwBaseSic"); - asm("ldr r12, __SicHandlerStart"); - asm("ldr r5, [r4, #8]"); // r5 - pending interrupt - asm("adr lr, Clear"); - asm("add r12, r5, lsl #3"); - asm("ldm r12, {r0, pc}"); - - asm("Clear:"); - // asm("str r5, [r4, #16]"); // TODO: error - asm("pop {r4,r5,pc}"); - - asm("__KHwBaseSic:"); - asm(".word %a0" : : "i" ((TInt)KHwBaseSic)); - asm("__SicHandlerStart:"); - asm(".word %a0" : : "i" ((TInt)&Handlers[0])); -} - -__NAKED__ void SyborgInterrupt::FiqDispatch() -{ - // FIQ dispatcher - // Enter with return address on FIQ stack - // We may use r8-r12, but must preserve other registers - // NOTE: STACK IS MISALIGNED ON ENTRY (1 WORD PUSHED) - asm("push {r0-r3,lr}"); - // FIQ Handler to go in here. - // Not needed because no FIQs are currently used - asm("pop {r0-r3,pc}"); -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/interrupts.cpp --- a/baseport/src/cedar/generic/base/syborg/specific/interrupts.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Syborg interrupt control and dispatch -* -*/ - -#include - -SInterruptHandler SyborgInterrupt::Handlers[KNumSyborgInts]; - -void SyborgInterrupt::DisableAndClearAll() -{ - WriteReg(KHwBaseSic, 3, 0); -} - -void SyborgInterrupt::Init1() -{ - __KTRACE_OPT(KBOOT,Kern::Printf("SyborgInterrupt::Init1()")); - - for(TUint i = 0; i < KNumSyborgInts; i++) - { - Handlers[i].iPtr = (TAny*)i; - Handlers[i].iIsr = Spurious; - } - - DisableAndClearAll(); - - Arm::SetIrqHandler((TLinAddr)SyborgInterrupt::IrqDispatch); - Arm::SetFiqHandler((TLinAddr)SyborgInterrupt::FiqDispatch); -} - -void SyborgInterrupt::Init3() -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("SyborgInterrupt::Init3()")); -} - -void SyborgInterrupt::Spurious(TAny* anId) -{ - // Handle an unexpected interrupt - Kern::Fault("SpuriousInt", (TInt)anId); -} - -EXPORT_C TInt Interrupt::Bind(TInt anId, TIsr anIsr, TAny* aPtr) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Bind(anId=%d anIsr=0x%X aPtr=0x%X)",anId,anIsr,aPtr)); - if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) - { - SInterruptHandler& h = SyborgInterrupt::Handlers[anId]; - TInt irq = NKern::DisableAllInterrupts(); - TInt r; - if(h.iIsr != SyborgInterrupt::Spurious) - { - r = KErrInUse; - } - else - { - h.iPtr = aPtr; - h.iIsr = anIsr; - r = KErrNone; - } - NKern::RestoreInterrupts(irq); - return r; - } - return KErrArgument; -} - -EXPORT_C TInt Interrupt::Unbind(TInt anId) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Unbind(%d)",anId)); - if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) - { - SInterruptHandler& h = SyborgInterrupt::Handlers[anId]; - TInt irq = NKern::DisableAllInterrupts(); - TInt r; - if(h.iIsr == SyborgInterrupt::Spurious) - { - r = KErrGeneral; - } - else - { - // Reset pointer to handler back to default - h.iPtr = (TAny*)anId; - h.iIsr = SyborgInterrupt::Spurious; - // Disable the interrupt - TSyborg::DisableInt(anId); - r = KErrNone; - } - NKern::RestoreInterrupts(irq); - return r; - } - return KErrArgument; -} - -EXPORT_C TInt Interrupt::Enable(TInt anId) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Enable(%d)",anId)); - if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) - { - if(SyborgInterrupt::Handlers[anId].iIsr == SyborgInterrupt::Spurious) - { - return KErrNotReady; - } - else - { - TSyborg::EnableInt(anId); - return KErrNone; - } - } - return KErrArgument; -} - -EXPORT_C TInt Interrupt::Disable(TInt anId) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Disable(%d)",anId)); - if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) - { - TSyborg::DisableInt(anId); - return KErrNone; - } - return KErrArgument; -} - -EXPORT_C TInt Interrupt::Clear(TInt anId) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Clear(%d)",anId)); - if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) - { - return KErrNone; - } - return KErrArgument; -} - -EXPORT_C TInt Interrupt::SetPriority(TInt anId, TInt aPriority) -{ - __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::SetPriority(anId=%d aPriority=0x%X)",anId,aPriority)); - return KErrNotSupported; -} - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/syborg.cfg --- a/baseport/src/cedar/generic/base/syborg/specific/syborg.cfg Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2348 +0,0 @@ -############################################################ -## AUTO-GENERATED CONFIGURATION FILE -## CommDB Database Dump Utility -## 1.1 -############################################################ - -############################################################ -## Network -## -[Network] -ADD_SECTION -# COMMDB_ID = 1 - Name=Intranet - FIELD_COUNT=1 -END_ADD - -ADD_SECTION -# COMMDB_ID = 2 - Name=mRouter - FIELD_COUNT=1 -END_ADD - - -############################################################ -## ModemBearer -## -[ModemBearer] -ADD_TEMPLATE - Name=Default Modem - Agent=CSD.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=0 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - Name=Null Modem 115200bps - Agent=CSD.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=52 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 3 - Name=US Robotics Sportster - Agent=CSD.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=57600 - Handshaking=244 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=AFTERDIALUNTILANSWER - SpeakerVolPref=QUIET - ModemInitString=AT&F1 - DataInitString=AT - FaxInitString=AT&d2 - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 4 - Name=Dacom Surfer - Agent=CSD.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=57600 - Handshaking=244 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=AFTERDIALUNTILANSWER - SpeakerVolPref=QUIET - ModemInitString=AT&F - DataInitString=AT - FaxInitString=AT&d2 - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 5 - Name=GSM Mobile Phone via Infrared - Agent=CSD.agt - IfName=PPP - PortName=IRCOMM::0 - TSYName=MM - CSYName=IRCOMM - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=196 - SpecialRate=0 - XonChar=17 - XoffChar=19 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=ATZ - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 6 - Name=GSM Mobile Phone via Serial - Agent=CSD.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=19200 - Handshaking=196 - SpecialRate=0 - XonChar=17 - XoffChar=19 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=ATZ - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 7 - Name=GPRS Ericsson R520m via IR - Agent=PSD.agt - IfName=PPP - PortName=IRCOMM::0 - TSYName=MM - CSYName=IRCOMM - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=4 - SpecialRate=0 - XonChar=17 - XoffChar=19 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=ATZ - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 8 - Name=GPRS Ericsson R520m/T68i via Serial - Agent=PSD.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=19200 - Handshaking=4 - SpecialRate=0 - XonChar=17 - XoffChar=19 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=ATZ - DataInitString=AT - FaxInitString=AT - IspInitString=*99***1# - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=70 -END_ADD - -ADD_SECTION -# COMMDB_ID = 9 - Name=GPRS Motorola Mobile Phone via Serial - Agent=PSD.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=57600 - Handshaking=4 - SpecialRate=0 - XonChar=17 - XoffChar=19 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=ATZ - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 10 - Name=WinTunnel Modem - Agent=null.agt - IfName=PPP - PortName=COMM::6 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=52 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 11 - Name=mRouterWinsBearer - Agent=mRouterAgent.agt - IfName=PPP - PortName=WINS::0 - TSYName=MM - CSYName=WINSCSY - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=52 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=9999 - LastSessionClosedTimeout=180 - LastSocketClosedTimeout=30 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 12 - Name=mRouterRs232Bearer - Agent=mRouterAgent.agt - IfName=PPP - PortName=COMM::0 - TSYName=MM - CSYName=ECUART - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=52 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=9999 - LastSessionClosedTimeout=180 - LastSocketClosedTimeout=30 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 13 - Name=mRouterIrBearer - Agent=mRouterAgent.agt - IfName=PPP - PortName=IRCOMM::0 - TSYName=MM - CSYName=IRCOMM - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=52 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=9999 - LastSessionClosedTimeout=180 - LastSocketClosedTimeout=30 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 14 - Name=mRouterBtBearer - Agent=mRouterAgent.agt - IfName=PPP - PortName=BTCOMM::0 - TSYName=MM - CSYName=BTCOMM - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=52 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=9999 - LastSessionClosedTimeout=180 - LastSocketClosedTimeout=30 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - -ADD_SECTION -# COMMDB_ID = 15 - Name=mRouterUsbBearer - Agent=mRouterAgent.agt - IfName=PPP - PortName=ACM::0 - TSYName=MM - CSYName=ECACM - DataBits=8 - StopBits=1 - Parity=NONE - Rate=115200 - Handshaking=52 - SpecialRate=0 - XonChar=0 - XoffChar=0 - FaxClassPref=AUTO - SpeakerPref=NEVER - SpeakerVolPref=QUIET - ModemInitString=AT - DataInitString=AT - FaxInitString=AT - DialPauseLength=S8= - SpeakerVolContorlLow=L0 - SpeakerVolControlMedium=L1 - SpeakerVolControlHigh=L2 - SpeakerAlwaysOff=M0 - SpeakerOnUntilCarrier=M1 - SpeakerAlwaysOn=M2 - SpeakerOnAfterUntilCarrier=M3 - DialToneWaitModifier=W - CallProgress1=X1 - CallProgress2=X2 - CallProgress3=X3 - CallProgress4=X4 - EchoOff=E0 - VerboseText=V1 - QuietOn=Q1 - QuietOff=Q0 - DialCommandStateModifier=; - OnLine=O - ResetConfiguration=Z - ReturnToFactoryDefs=&F - DCDOnDuringLink=&C1 - DTRHangUp=&D2 - DSRAlwaysOn=&S0 - RTSCTSHandshake=&K3 - XonXoffHandshake=&K4 - EscapeCharacter=+ - EscapeGuardPeriod=S12 - NoDialTone=NO DIAL TONE - Busy=BUSY - NoAnswer=NO ANSWER - Carrier=CARRIER - Connect=CONNECT - CompressionClass5=COMPRESSION:CLASS 5 - CompressionV42bis=COMPRESSION:V.42 bis - CompressionNone=COMPRESSION:NONE - ProtocolLAPD=PROTOCOL:LAPD - ProtocolALT=PROTOCOL:ALT - ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR - ProtocolNone=PROTOCOL:NONE - MessageCentreNumber=+44123456789 - MessageValidityPeriod=1440 - MessageDeliveryReport=FALSE - MinimumSignalLevel=9905 - LastSocketActivityTimeout=9999 - LastSessionClosedTimeout=180 - LastSocketClosedTimeout=30 - SIRSettings=0 - CommRole=0 - FIELD_COUNT=69 -END_ADD - - -############################################################ -## LANBearer -## -[LANBearer] -ADD_SECTION -# COMMDB_ID = 1 - Name=EKA1 Assabet on-board Ethernet - Agent=nullagt.agt - IfName=ethint - LDDFilename=ethercard - LDDName=EtherCard - PDDFilename=EtherSmc - PDDName=EtherCard.Smc - PacketDriverName=EtherPkt.drv - LastSocketActivityTimeout=-1 - LastSessionClosedTimeout=-1 - LastSocketClosedTimeout=-1 - FIELD_COUNT=11 -END_ADD - -ADD_SECTION -# COMMDB_ID = 2 - Name=EKA2 Assabet on-board Ethernet - Agent=nullagt.agt - IfName=ethint - LDDFilename=enet - LDDName=Ethernet - PDDFilename=ethernet - PDDName=Ethernet.Assabet - PacketDriverName=EtherPkt.drv - LastSocketActivityTimeout=-1 - LastSessionClosedTimeout=-1 - LastSocketClosedTimeout=-1 - FIELD_COUNT=11 -END_ADD - -ADD_SECTION -# COMMDB_ID = 3 - Name=EKA1 emulator Ethernet - Agent=nullagt.agt - IfName=ethint - LDDFilename=ethercard - LDDName=Ethercard - PDDFilename=etherwins - PDDName=Ethercard.wins - PacketDriverName=EtherPkt.drv - LastSocketActivityTimeout=-1 - LastSessionClosedTimeout=-1 - LastSocketClosedTimeout=-1 - FIELD_COUNT=11 -END_ADD - -ADD_SECTION -# COMMDB_ID = 4 - Name=EKA2 emulator Ethernet - Agent=nullagt.agt - IfName=ethint - LDDFilename=enet - LDDName=Ethernet - PDDFilename=ethernet - PDDName=Ethernet.Wins - PacketDriverName=EtherPkt.drv - LastSocketActivityTimeout=-1 - LastSessionClosedTimeout=-1 - LastSocketClosedTimeout=-1 - FIELD_COUNT=11 -END_ADD - -ADD_SECTION -# COMMDB_ID = 5 - Name=EKA2 SYBORG on-board Ethernet - Agent=nullagt.agt - IfName=ethint - LDDFilename=enet - LDDName=Ethernet - PDDFilename=ethernet - PDDName=Ethernet.SYBORG - PacketDriverName=EtherPkt.drv - LastSocketActivityTimeout=-1 - LastSessionClosedTimeout=-1 - LastSocketClosedTimeout=-1 - FIELD_COUNT=11 -END_ADD - -############################################################ -## Location -## -[Location] -ADD_TEMPLATE - Name=Default Location - IntlPrefixCode=+ - NatPrefixCode=0 - NatCode=44 - Mobile=TRUE - UsePulseDial=FALSE - WaitForDialTone=FALSE - PauseAfterDialout=0 - FIELD_COUNT=8 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - Name=Office - IntlPrefixCode=00 - NatPrefixCode=0 - NatCode=44 - AreaCode=171 - DialOutCode=9, - Mobile=FALSE - UsePulseDial=FALSE - WaitForDialTone=FALSE - PauseAfterDialout=0 - FIELD_COUNT=10 -END_ADD - -ADD_SECTION -# COMMDB_ID = 3 - Name=Office Direct Dial - IntlPrefixCode=00 - NatPrefixCode=0 - NatCode=44 - AreaCode=171 - Mobile=FALSE - UsePulseDial=FALSE - WaitForDialTone=FALSE - PauseAfterDialout=0 - FIELD_COUNT=9 -END_ADD - -ADD_SECTION -# COMMDB_ID = 4 - Name=Mobile - IntlPrefixCode=+ - NatPrefixCode=0 - NatCode=44 - Mobile=TRUE - UsePulseDial=FALSE - WaitForDialTone=FALSE - PauseAfterDialout=0 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 5 - Name=Home - IntlPrefixCode=00 - NatPrefixCode=0 - NatCode=44 - AreaCode=181 - Mobile=FALSE - UsePulseDial=TRUE - WaitForDialTone=TRUE - PauseAfterDialout=0 - FIELD_COUNT=9 -END_ADD - - -############################################################ -## Chargecard -## -[Chargecard] -ADD_SECTION -# COMMDB_ID = 1 - Name=Dummy BT Chargecard - AccountNumber=144,12345678 - Pin=0000 - LocalRule=HG - NatRule=HFG - IntlRule=HEFG - FIELD_COUNT=6 -END_ADD - -ADD_SECTION -# COMMDB_ID = 2 - Name=Dummy Mercury Chargecard - AccountNumber=0500800800,,12345678 - Pin=**** - LocalRule=HG - NatRule=J,K,0FG - IntlRule=HEFG - FIELD_COUNT=6 -END_ADD - - -############################################################ -## GlobalSettings -## -[GlobalSettings] -ADD_SECTION - WAPAccessPoint=1 - RedialAttempts=3 - SmsBearer=1 - SmsReceiveMode=2 - GPRSAttachMode=1 - AcceptIncomingGprs=1 - GPRSClassCBearer=GSM - ConnectionAttempts=2 - ModemForDataAndFax=2 - ModemForPhoneServicesAndSMS=2 - LocationForDataAndFax=2 - LocationForPhoneServicesAndSMS=2 - DefaultNetwork=1 - BearerAvailabilityCheckTSY=mm - FIELD_COUNT=14 -END_ADD - - -############################################################ -## DialOutISP -## -[DialOutISP] -ADD_TEMPLATE - Name=Default Dial Out ISP - DialResolution=TRUE - UseLoginScript=FALSE - PromptForLogin=TRUE - DisplayPCT=FALSE - IfPromptForAuth=TRUE - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=28 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - Name=NT RAS - Description=Test - Type=INTERNETONLY - DialResolution=TRUE - UseLoginScript=TRUE - LoginScript=CHARMAP \[windows-1252\]\nLOOP 10\n{\nSEND "CLIENT"+<0x0d>\nWAIT 3\n{\n"SERVER" OK\n}\n}\nEXIT KErrNoAnswer$\n\nOK:\nEXIT\n - PromptForLogin=FALSE - DisplayPCT=FALSE - IfNetworks=ip - IfPromptForAuth=FALSE - IfAuthName=RasUser - IfAuthPass=pass - AuthRetries=0 - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=35 -END_ADD - -ADD_SECTION -# COMMDB_ID = 3 - Name=ISP01 - Description=PlaceHolder for ISP01 - Type=INTERNETONLY - DialResolution=TRUE - UseLoginScript=FALSE - PromptForLogin=FALSE - DisplayPCT=FALSE - IfNetworks=ip - IfPromptForAuth=TRUE - IfAuthName=xxx - IfAuthPass=yyy - AuthRetries=0 - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=34 -END_ADD - -ADD_SECTION -# COMMDB_ID = 4 - Name=ISP02 - Description=PlaceHolder for ISP02 - Type=INTERNETONLY - DialResolution=TRUE - UseLoginScript=FALSE - PromptForLogin=FALSE - DisplayPCT=FALSE - IfNetworks=ip - IfPromptForAuth=TRUE - IfAuthName=xxx - IfAuthPass=yyy - AuthRetries=0 - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=34 -END_ADD - -ADD_SECTION -# COMMDB_ID = 5 - Name=ISP03 - Description=PlaceHolder for ISP03 - Type=INTERNETONLY - DialResolution=TRUE - UseLoginScript=FALSE - PromptForLogin=FALSE - DisplayPCT=FALSE - IfNetworks=ip - IfPromptForAuth=TRUE - IfAuthName=xxx - IfAuthPass=yyy - AuthRetries=0 - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=34 -END_ADD - -ADD_SECTION -# COMMDB_ID = 6 - Name=ISP04 - Description=PlaceHolder for ISP04 - Type=INTERNETONLY - DialResolution=TRUE - UseLoginScript=FALSE - PromptForLogin=FALSE - DisplayPCT=FALSE - IfNetworks=ip - IfPromptForAuth=TRUE - IfAuthName=xxx - IfAuthPass=yyy - AuthRetries=0 - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=34 -END_ADD - -ADD_SECTION -# COMMDB_ID = 7 - Name=ISP05 - Description=PlaceHolder for ISP05 - Type=INTERNETONLY - DialResolution=TRUE - UseLoginScript=FALSE - PromptForLogin=FALSE - DisplayPCT=FALSE - IfNetworks=ip - IfPromptForAuth=TRUE - IfAuthName=xxx - IfAuthPass=yyy - AuthRetries=0 - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=34 -END_ADD - -ADD_SECTION -# COMMDB_ID = 8 - Name=mRouterDialOutIsp - Description=mRouterDialOutIsp - Type=INTERNETONLY - DialResolution=TRUE - UseLoginScript=FALSE - PromptForLogin=FALSE - DisplayPCT=FALSE - IfNetworks=ip - IfPromptForAuth=FALSE - IfAuthName=IfAuthPass= - IfAuthPass=AuthRetries=0 - AuthRetries=0 - IfCallbackEnabled=FALSE - CallbackTimeout=0 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - BearerService=0 - BearerProtocol=UNSPECIFIED - RlpVersion=0 - IwfToMs=0 - MsToIwf=0 - AckTimer=0 - RetransmissionAttempts=0 - ResequencePeriod=0 - V42Compression=0 - V42Codewords=0 - V42MaxLength=0 - Asymmetry=0 - UserInitUpgrade=FALSE - UseEdge=FALSE - FIELD_COUNT=34 -END_ADD - - -############################################################ -## DialInISP -## -[DialInISP] -ADD_TEMPLATE - Name=Default Dial In ISP - UseLoginScript=FALSE - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - UseEdge=FALSE - FIELD_COUNT=9 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - Name=Dial In ISP01 - UseLoginScript=FALSE - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableIPHeaderComp=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - EnableSWComp=FALSE - UseEdge=FALSE - FIELD_COUNT=9 -END_ADD - - -############################################################ -## OutgoingGPRS -## -[OutgoingGPRS] -ADD_SECTION -# COMMDB_ID = 1 - Name=GPRS01 - APN=gprs01APNPlaceHolder - PDPType=IPV4 - ReqPrecedence=0 - ReqDelay=0 - ReqReliability=0 - ReqPeakThroughput=0 - ReqMeanThroughput=0 - MinPrecedence=0 - MinDelay=0 - MinReliability=0 - MinPeakThroughput=0 - MinMeanThroughput=0 - DataCompression=FALSE - HeaderCompression=FALSE - GprsUseEdge=FALSE - AnonymousAccess=FALSE - IfNetworks=ip - IfPromptForAuth=FALSE - AuthRetries=1 - IpDNSAddrFromServer=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - IpAddrFromServer=TRUE - GprsAccessPointType=0 - QosWarningTimeout=0 - FIELD_COUNT=26 -END_ADD - -ADD_SECTION -# COMMDB_ID = 2 - Name=GPRS02 - APN=gprs02APNPlaceHolder - PDPType=IPV4 - ReqPrecedence=0 - ReqDelay=0 - ReqReliability=0 - ReqPeakThroughput=0 - ReqMeanThroughput=0 - MinPrecedence=0 - MinDelay=0 - MinReliability=0 - MinPeakThroughput=0 - MinMeanThroughput=0 - DataCompression=FALSE - HeaderCompression=FALSE - GprsUseEdge=FALSE - AnonymousAccess=FALSE - IfNetworks=ip - IfPromptForAuth=FALSE - AuthRetries=1 - IpDNSAddrFromServer=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - IpAddrFromServer=TRUE - GprsAccessPointType=0 - QosWarningTimeout=0 - FIELD_COUNT=26 -END_ADD - -ADD_SECTION -# COMMDB_ID = 3 - Name=GPRS03 - APN=gprs03APNPlaceHolder - PDPType=IPV4 - ReqPrecedence=0 - ReqDelay=0 - ReqReliability=0 - ReqPeakThroughput=0 - ReqMeanThroughput=0 - MinPrecedence=0 - MinDelay=0 - MinReliability=0 - MinPeakThroughput=0 - MinMeanThroughput=0 - DataCompression=FALSE - HeaderCompression=FALSE - GprsUseEdge=FALSE - AnonymousAccess=FALSE - IfNetworks=ip - IfPromptForAuth=FALSE - AuthRetries=1 - IpDNSAddrFromServer=FALSE - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - IpAddrFromServer=TRUE - GprsAccessPointType=0 - QosWarningTimeout=0 - FIELD_COUNT=26 -END_ADD - - -############################################################ -## IncomingGPRS -## -[IncomingGPRS] -ADD_SECTION -# COMMDB_ID = 1 - Name=Incoming GPRS Settings PlaceHolder - APN=Test - PDPType=IPV4 - ReqPrecedence=1 - ReqDelay=1 - ReqReliability=1 - ReqPeakThroughput=1 - ReqMeanThroughput=1 - MinPrecedence=1 - MinDelay=1 - MinReliability=1 - MinPeakThroughput=1 - MinMeanThroughput=1 - DataCompression=FALSE - HeaderCompression=FALSE - GprsUseEdge=FALSE - AnonymousAccess=FALSE - IfNetworks=ip - IfPromptForAuth=FALSE - IfAuthName=RasUser - IfAuthPass=pass - AuthRetries=1 - IpDNSAddrFromServer=TRUE - IpNameServer1=0.0.0.0 - IpNameServer2=0.0.0.0 - EnableLCPExtension=FALSE - DisablePlainTextAuth=FALSE - PDPAddress=0.0.0.0 - IpAddrFromServer=TRUE - FIELD_COUNT=29 -END_ADD - - -############################################################ -## DefaultGPRS -## -[DefaultGPRS] -ADD_SECTION -# COMMDB_ID = 1 - Name=Dummy Default GPRS Settings - Usage=1 - APN=Access point name - PDPType=IPV6 - PDPAddress=www.wid.com - Precedence=1 - Delay=1 - Reliability=1 - PeakThroughput=1 - MeanThroughput=1 - MinPrecedence=1 - MinDelay=1 - MinReliability=1 - MinPeakThroughput=1 - MinMeanThroughput=1 - DataCompression=TRUE - HeaderCompression=TRUE - GprsUseEdge=FALSE - AnonymousAccess=TRUE - FIELD_COUNT=19 -END_ADD - - -############################################################ -## CDMA2000PacketServiceTable -## -[CDMA2000PacketServiceTable] -ADD_SECTION -# COMMDB_ID = 1 - Name=test name cdma2000 - IwfName=Test2000 - ServiceOption=HIGHSPEEDCDMA2000DATA - PdpType=IPV4 - ReqFwdPriority=PRIORITY04 - ReqRevPriority=PRIORITY04 - ReqFwdBitrate=32KBPS - ReqRevBitrate=32KBPS - ReqFwdLoss=LOSS1 - ReqRevLoss=LOSS1 - ReqFwdMaxdelay=40MS - ReqRevMaxdelay=40MS - MinFwdBitrate=32KBPS - MinRevBitrate=32KBPS - AccptFwdLoss=LOSS2 - AccptRevLoss=LOSS2 - AccptFwdMaxdelay=120MS - AccptRevMaxdelay=120MS - EnableIPHeaderComp=FALSE - AnonymousAccess=FALSE - IfNetworks=ip - IfPromptForAuth=FALSE - IfAuthName=RasUser - IfAuthPass=pass - AuthRetries=1 - IpNetMask=255.255.255.0 - IpGateway=10.0.0.1 - IpAddrFromServer=TRUE - IpDNSAddrFromServer=TRUE - EnableLCPExtension=TRUE - DisablePlainTextAuth=TRUE - ApType=2 - QosWarningTimeout=1000000 - RlpMode=TRANSPARENT - CDMAMobileIP=FALSE - CDMAMobileIPTimeout=10000000 - CDMANaiType=0 - FIELD_COUNT=37 -END_ADD - - -############################################################ -## DefaultCDMA2000SettingsTable -## -[DefaultCDMA2000SettingsTable] - -############################################################ -## LANService -## -[LANService] -ADD_SECTION -# COMMDB_ID = 1 - Name=Ethernet - IfNetworks=ip,ip6 - IpNetMask=255.255.255.0 - #IpGateway=194.72.6.1 - IpAddrFromServer=FALSE - IpAddr=169.254.172.4 - IpDNSAddrFromServer=FALSE - #IpNameServer1=194.72.6.51 - #IpNameServer2=194.72.6.52 - #FIELD_COUNT=9 - FIELD_COUNT=6 -END_ADD - - -############################################################ -## IAP -## -[IAP] -ADD_SECTION -# COMMDB_ID = 1 - Name=NT RAS with Null Modem - IAPService=2 - IAPServiceType=DialOutISP - IAPBearer=2 - IAPBearerType=ModemBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 2 - Name=CSD IAP PlaceHolder01 - IAPService=3 - IAPServiceType=DialOutISP - IAPBearer=2 - IAPBearerType=ModemBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 3 - Name=CSD IAP PlaceHolder02 - IAPService=4 - IAPServiceType=DialOutISP - IAPBearer=2 - IAPBearerType=ModemBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 4 - Name=GPRS IAP PlaceHolder01 - IAPService=1 - IAPServiceType=OutgoingGPRS - IAPBearer=8 - IAPBearerType=ModemBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=4 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 5 - Name=GPRS IAP PlaceHolder02 - IAPService=2 - IAPServiceType=OutgoingGPRS - IAPBearer=8 - IAPBearerType=ModemBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=4 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 6 - Name=mRouter Rs232 - IAPService=8 - IAPServiceType=DialOutISP - IAPBearer=12 - IAPBearerType=ModemBearer - IAPNetwork=2 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 7 - Name=mRouter Ir - IAPService=8 - IAPServiceType=DialOutISP - IAPBearer=13 - IAPBearerType=ModemBearer - IAPNetwork=2 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 8 - Name=mRouter BT - IAPService=8 - IAPServiceType=DialOutISP - IAPBearer=14 - IAPBearerType=ModemBearer - IAPNetwork=2 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 9 - Name=mRouter USB - IAPService=8 - IAPServiceType=DialOutISP - IAPBearer=15 - IAPBearerType=ModemBearer - IAPNetwork=2 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 10 - Name=mRouter Wins - IAPService=8 - IAPServiceType=DialOutISP - IAPBearer=11 - IAPBearerType=ModemBearer - IAPNetwork=2 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 11 - Name=VPN IAP - IAPService=2 - IAPServiceType=VpnService - IAPBearer=2 - IAPBearerType=VirtualBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 12 - Name=EKA1 Assabet on-board ethernet - IAPService=1 - IAPServiceType=LANService - IAPBearer=1 - IAPBearerType=LANBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 13 - Name=EKA2 Assabet on-board ethernet - IAPService=1 - IAPServiceType=LANService - IAPBearer=2 - IAPBearerType=LANBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 14 - Name=EKA1 emulator ethernet - IAPService=1 - IAPServiceType=LANService - IAPBearer=3 - IAPBearerType=LANBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 15 - Name=EKA2 emulator ethernet - IAPService=1 - IAPServiceType=LANService - IAPBearer=4 - IAPBearerType=LANBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - -ADD_SECTION -# COMMDB_ID = 16 - Name=EKA2 SYBORG on-board ethernet - IAPService=1 - IAPServiceType=LANService - IAPBearer=5 - IAPBearerType=LANBearer - IAPNetwork=1 - IAPNetworkWeighting=0 - Location=2 - FIELD_COUNT=8 -END_ADD - - -############################################################ -## ConnectionPreferences -## -[ConnectionPreferences] -ADD_SECTION - Ranking=0 - Direction=OUTGOING - DialogPref=PROMPT - BearerSet=CSD - IAP=1 - FIELD_COUNT=5 -END_ADD - -ADD_SECTION - Ranking=1 - Direction=OUTGOING - DialogPref=PROMPT - BearerSet=CSD - IAP=1 - FIELD_COUNT=5 -END_ADD - - -############################################################ -## BTDeviceTable -## -[BTDeviceTable] - -############################################################ -## BTSecurityTable -## -[BTSecurityTable] - -############################################################ -## BTDefaultTable -## -[BTDefaultTable] - -############################################################ -## Proxies -## -[Proxies] -ADD_SECTION -# COMMDB_ID = 1 - ISP=2 - ProxyServiceType=DialOutISP - UseProxyServer=TRUE - ProxyServerName=www.dummyproxy.com - ProtocolName=http - PortNumber=80 - Exceptions=www.dummyproxy.com/exception - FIELD_COUNT=7 -END_ADD - - -############################################################ -## AgentLookup -## -[AgentLookup] - -############################################################ -## WAPAccessPoint -## -[WAPAccessPoint] -ADD_TEMPLATE - Name=Default Dial In ISP - CurrentBearer=WAPIPBearer - FIELD_COUNT=2 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - Name=Dummy WAP Settings - CurrentBearer=WAPIPBearer - StartPage=www.wapstart.com - FIELD_COUNT=3 -END_ADD - - -############################################################ -## WAPIPBearer -## -[WAPIPBearer] -ADD_TEMPLATE - AccessPointId=0 - IAP=0 - WSPOption=CONNECTIONLESS - Security=FALSE - ProxyPortNumber=0 - FIELD_COUNT=5 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - AccessPointId=2 - GatewayAddress=www.wapgateway.com - IAP=2 - WSPOption=CONNECTIONORIENTED - Security=FALSE - ProxyPortNumber=1 - FIELD_COUNT=6 -END_ADD - - -############################################################ -## WAPSMSBearer -## -[WAPSMSBearer] -ADD_TEMPLATE - AccessPointId=0 - WSPOption=CONNECTIONLESS - Security=FALSE - FIELD_COUNT=3 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - AccessPointId=2 - GatewayAddress=+4412345678901 - ServiceCentreAddress=+442071234567 - WSPOption=CONNECTIONORIENTED - Security=FALSE - FIELD_COUNT=5 -END_ADD - - -############################################################ -## SecureSocketTable -## -[SecureSocketTable] -ADD_SECTION -# COMMDB_ID = 1 - ProtocolName=ssl3.0 - ProtoLibrary=ssladaptor.dll - FIELD_COUNT=2 -END_ADD - -ADD_SECTION -# COMMDB_ID = 2 - ProtocolName=tls1.0 - ProtoLibrary=ssladaptor.dll - FIELD_COUNT=2 -END_ADD - - -############################################################ -## BTPersistTable -## -[BTPersistTable] -############################################################ -## ERROR -## AccessTypeTable -############################################################ -############################################################ -## ERROR -## Error opening table -############################################################ -############################################################ -## ERROR -## Unable to find the specified object or missing required field values -############################################################ - -############################################################ -## VirtualBearer -## -[VirtualBearer] -ADD_TEMPLATE - Name=Default VPN Bearer - Agent=VPN.agt - IfName=VPN.nif - LastSocketActivityTimeout=180 - LastSessionClosedTimeout=30 - LastSocketClosedTimeout=60 - FIELD_COUNT=6 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - Name=VPN Bearer1 - Agent=ntras.agt - IfName=ppp.nif - LastSocketActivityTimeout=-1 - LastSessionClosedTimeout=-1 - LastSocketClosedTimeout=-1 - FIELD_COUNT=6 -END_ADD - - -############################################################ -## VpnService -## -[VpnService] -ADD_TEMPLATE - Name=Default VPN - Policy=DefaultVPNpolicy - HomeIAP=1 - HomeNetwork=0 - FIELD_COUNT=4 -END_TEMPLATE - -ADD_SECTION -# COMMDB_ID = 2 - Name=VPN1 - Policy=VPNpolicy1 - HomeIAP=2 - HomeNetwork=1 - FIELD_COUNT=4 -END_ADD - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/syborg.cia --- a/baseport/src/cedar/generic/base/syborg/specific/syborg.cia Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -// -// Timer Access Functions -// - -// Set the starting count value for a timer -EXPORT_C void __NAKED__ TSyborg::SetTimerLoad(TUint /*aTimerBase*/, TUint32 /*aValue*/) -{ - asm("str r1, [r0, #12]"); - asm("bx lr"); -} - -// Read the load register (starting count value) -EXPORT_C TUint __NAKED__ TSyborg::TimerLoad(TUint /*aTimerBase*/) -{ - asm("ldr r0, [r0, #12]"); - asm("bx lr"); -} - -// Read the actual timer value -EXPORT_C TUint __NAKED__ TSyborg::TimerValue(TUint /*aTimerBase*/) -{ - asm("ldr r0, [r0, #16]"); - asm("bx lr"); -} - -// Clear the timer interrupt by writing a value to Timer x clear register -// The written value doesn't matter as any value will clear the interrupt. -EXPORT_C void __NAKED__ TSyborg::ClearTimerInt(TUint /*aTimerBase*/) -{ - asm("mov r1, #1"); - asm("str r1, [r0, #24]"); - asm("bx lr"); -} - -// -//Interrupt Controller Acces Functions -// - -// Enable specified motherboard Int on either the PIC/SIC -EXPORT_C void __NAKED__ TSyborg::EnableInt(TUint /*anId*/) -{ - asm("ldr r1, __KHwInt"); - asm("str r0, [r1, #20]"); - asm("bx lr"); -} - -// Disable specified motherboard Int on either the PIC/SIC -EXPORT_C void __NAKED__ TSyborg::DisableInt(TUint /*anId*/) -{ - asm("ldr r1, __KHwInt"); - asm("str r0, [r1, #16]"); - asm("bx lr"); - - asm("__KHwInt:"); - asm(".word %a0" : : "i" (TInt)(KHwBaseSic)); -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/syborg.cpp --- a/baseport/src/cedar/generic/base/syborg/specific/syborg.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -//#define DEBUG - -#ifdef DEBUG -#define __DEBUG_PRINT(format...) Kern::Printf(format) -#else -#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) -#endif - -void TSyborg::Init3() -{ -// SetTimerMode(KHwBaseCounterTimer, ETimerModePeriodic); -// EnableTimer(KHwBaseCounterTimer, EEnable); -} - -EXPORT_C TBool TSyborg::IsTimerEnabled(TUint aTimerBase) -{ - __DEBUG_PRINT("TSyborg::IsTimerEnabled"); - return ReadReg(aTimerBase, 1); -} - -EXPORT_C void TSyborg::EnableTimerInterrupt(TUint aTimerBase) -{ - __DEBUG_PRINT("TSyborg::EnableTimerInterrupt"); - WriteReg(aTimerBase,5,1); -} - -EXPORT_C void TSyborg::DisableTimerInterrupt(TUint aTimerBase) -{ - __DEBUG_PRINT("TSyborg::DisableTimerInterrupt"); - WriteReg(aTimerBase,5,0); -} - -EXPORT_C void TSyborg::EnableTimer(TUint aTimerBase, TState aState) -{ - __DEBUG_PRINT("TSyborg::EnableTimer"); - // TUint32 mode = ReadReg(aTimerBase, 1); - if (aState == EEnable) - WriteReg(aTimerBase, 1, 1); - else - WriteReg(aTimerBase, 1, 0); -} - -EXPORT_C TSyborg::TTimerMode TSyborg::TimerMode(TUint aTimerBase) -{ - __DEBUG_PRINT("TSyborg::TimerMode"); - if (ReadReg(aTimerBase, 2)) - return ETimerModeOneShot; - else - return ETimerModePeriodic; -} - -EXPORT_C void TSyborg::SetTimerMode(TUint aTimerBase, TTimerMode aValue) -{ - __DEBUG_PRINT("TSyborg::SetTimerMode"); - if (aValue == ETimerModePeriodic) - WriteReg(aTimerBase, 2, 0); - else - WriteReg(aTimerBase, 2, 1); -} - -// Return base address of debug UART -// (as selected in obey file or with eshell debugport command) -EXPORT_C TUint32 TSyborg::DebugPortAddr() -{ - // Defaults to UART 0 - switch (Kern::SuperPage().iDebugPort) - { - case KNullDebugPort: // debug supressed - return (TUint32)KNullDebugPort; - case 1: - return KHwBaseUart1; - case 2: - return KHwBaseUart2; - case 3: - return KHwBaseUart3; - case 0: - default: - return KHwBaseUart0; - } -} - -EXPORT_C void TSyborg::MarkDebugPortOff() -{ - TheVariant.iDebugPortBase = 0; -} - -EXPORT_C TInt TSyborg::VideoRamSize() -{ - return 4*640*480; -} - -// !@! -EXPORT_C TPhysAddr TSyborg::VideoRamPhys() -{ -#if 0 - __KTRACE_OPT(KEXTENSION,Kern::Printf("TSyborg::VideoRamPhys: VideoRamPhys=0x%x", Syborg::VideoRamPhys)); -#endif - return 0; - -} - -EXPORT_C TPhysAddr TSyborg::VideoRamPhysSecure() -{ -#if 0 - return Syborg::VideoRamPhysSecure; -#endif - return 0; -} - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/syborg.h --- a/baseport/src/cedar/generic/base/syborg/specific/syborg.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SYBORG_H__ -#define __SYBORG_H__ - -#include -#include -#include -#include -#include -#include // KPrimaryIOBase - -#ifndef __SYBORG__ -#define __SYBORG__ -#endif - -const TUint KHwBasePeripherals = KPrimaryIOBase; -const TUint KHwLinSeparation = 0x1000; - -const TUint KHwBaseSic = KHwBasePeripherals + 0x00*KHwLinSeparation; -// intended for use as a free-running counter. Reading the value register of a free-running syborg counter returns a microsec value -const TUint KHwBaseRtc = KHwBasePeripherals + 0x01*KHwLinSeparation; -// intended for use as an alarm generating timer with a resolution of 1 microsecond -const TUint KHwBaseCounterTimer = KHwBasePeripherals + 0x02*KHwLinSeparation; -const TUint KHwBaseKmiKeyboard = KHwBasePeripherals + 0x03*KHwLinSeparation; -const TUint KHwBaseKmiMouse = KHwBasePeripherals + 0x04*KHwLinSeparation; -const TUint KHwBaseKmiPointer = KHwBasePeripherals + 0x04*KHwLinSeparation; -const TUint KHwBaseClcd = KHwBasePeripherals + 0x05*KHwLinSeparation; -const TUint KHwBaseUart0 = KHwBasePeripherals + 0x06*KHwLinSeparation; -const TUint KHwBaseUart1 = KHwBasePeripherals + 0x07*KHwLinSeparation; -const TUint KHwBaseUart2 = KHwBasePeripherals + 0x08*KHwLinSeparation; -const TUint KHwBaseUart3 = KHwBasePeripherals + 0x09*KHwLinSeparation; -const TUint KHwSVPHostFileSystemDevice = KHwBasePeripherals + 0x0a*KHwLinSeparation; -const TUint KHwSVPSnapDevice = KHwBasePeripherals + 0x0b*KHwLinSeparation; -const TUint KHwSVPNetDevice = KHwBasePeripherals + 0x0c*KHwLinSeparation; -const TUint KHwSVPNandDevice = KHwBasePeripherals + 0x0d*KHwLinSeparation; -const TUint KHwSVPAudioDevice = KHwBasePeripherals + 0x0e*KHwLinSeparation; -const TUint KHwSVPPlatformDevice = KHwBasePeripherals + 0x0f*KHwLinSeparation; - - -enum TSyborgInterruptId -{ - EIntTimer0 = 0, /* RTC -- not used */ - EIntTimer1 = 1, /* Interval Timer */ - EIntKeyboard = 2, - EIntPointer = 3, - // EIntMouse = 3, - EIntFb = 4, - EIntSerial0 = 5, - EIntSerial1 = 6, - EIntSerial2 = 7, - EIntSerial3 = 8 -}; - -// Timer Mode -const TUint KPeriodic = 0x0; -const TUint KOneShot = 0x1; - -class TSyborg -{ -public: - // generic enums - enum TState - { - EEnable, - EDisable - }; - enum TLock - { - ELocked=0, - EUnlocked=0xA05F - }; - enum TTimerMode - { - ETimerModePeriodic=KPeriodic, - ETimerModeOneShot=KOneShot, - }; -public: - // Initialisation of class - static void Init3(); - - // Accessor methods for timers - IMPORT_C static void EnableTimerInterrupt(TUint aTimerBase); // Enable the timer interrupt - IMPORT_C static void DisableTimerInterrupt(TUint aTimerBase); // Disable the timer interrupt - IMPORT_C static void SetTimerLoad(TUint aTimerBase, TUint32 aValue); // Set the starting count value for a timer - IMPORT_C static TUint TimerLoad(TUint aTimerBase); // Read the load register (starting count value) - IMPORT_C static TUint TimerValue(TUint aTimerBase); // Read the actual timer value - IMPORT_C static void ClearTimerInt(TUint aTimerBase); // Clear the timer interrupt - IMPORT_C static TBool IsTimerEnabled(TUint aTimerBase); // Enquire as to whether the timer is enabled - IMPORT_C static void EnableTimer(TUint aTimerBase, TState aState); // Enable/disable the timer (start/stop it running) - IMPORT_C static TTimerMode TimerMode(TUint aTimerBase); // Find out what mode the timer is running in - IMPORT_C static void SetTimerMode(TUint aTimerBase, TTimerMode aValue); // Set the timer mode (periodic or free running) - - // Accessor methods for interrupts - IMPORT_C static void EnableInt(TUint anId); - IMPORT_C static void DisableInt(TUint anId); - - IMPORT_C static TInt VideoRamSize(); - IMPORT_C static TPhysAddr VideoRamPhys(); - IMPORT_C static TPhysAddr VideoRamPhysSecure(); - - // Debug Port Specific - IMPORT_C static TUint32 DebugPortAddr(); - IMPORT_C static void MarkDebugPortOff(); -}; - -static inline TUint32 ReadReg(TUint32 base, TUint8 aReg) -{ - return *(volatile TUint32 *)(base + (aReg << 2)); -} - -static inline void WriteReg(TUint32 base, TUint8 aReg, TUint32 aVal) -{ - *(volatile TUint32*)(base + (aReg<<2)) = aVal; -} - -#endif // __SYBORG_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/syborg_priv.h --- a/baseport/src/cedar/generic/base/syborg/specific/syborg_priv.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SYBORG_PRIV_H__ -#define __SYBORG_PRIV_H__ - -#include -#include -#include -#include - -#define _LOCK TInt irq=NKern::DisableAllInterrupts(); -#define _UNLOCK NKern::RestoreInterrupts(irq); - -const TUint32 K1000HzTickMatchLoad = 1000; -const TInt KNumSyborgInts = 64; - -class SyborgInterrupt : public Interrupt -{ -public: - static void IrqDispatch(); - static void FiqDispatch(); - static void DisableAndClearAll(); - static void Init1(); - static void Init3(); - static void Spurious(TAny* anId); - static void MsTimerTick(TAny* aPtr); - - static SInterruptHandler Handlers[KNumSyborgInts]; -}; - -class Syborg : public Asic -{ -public: - IMPORT_C Syborg(); - -public: - // Initialisation - IMPORT_C virtual TMachineStartupType StartupReason(); - IMPORT_C virtual void Init1(); - IMPORT_C virtual void Init3(); - - // Power management - IMPORT_C virtual void Idle(); - - IMPORT_C void DebugInit(); - IMPORT_C virtual void DebugOutput(TUint aChar); - - // Timing - IMPORT_C virtual TInt MsTickPeriod(); - IMPORT_C virtual TInt SystemTimeInSecondsFrom2000(TInt& aTime); - IMPORT_C virtual TInt SetSystemTimeInSecondsFrom2000(TInt aTime); - IMPORT_C virtual TUint32 NanoWaitCalibration(); - - // HAL - virtual TInt VariantHal(TInt aFunction, TAny* a1, TAny* a2); - - // Machine configuration - virtual TPtr8 MachineConfiguration(); - - TUint32 iDebugPortBase; - - static Syborg* Variant; - static TPhysAddr VideoRamPhys; - static TPhysAddr VideoRamPhysSecure; - NTimerQ* iTimerQ; -}; - -GLREF_D Syborg TheVariant; - -#endif // __SYBORG_PRIV_H__ - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/system.h --- a/baseport/src/cedar/generic/base/syborg/specific/system.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SYSTEM_H__ -#define __SYSTEM_H__ - -#ifndef __BOOTLOADER_VARIANTCONFIG_H__ -#include -#endif - -#define VARIANT_INTERFACE TSyborg -_LIT(KPddName,"Comm.SYBORG_SERIAL"); - -#endif // __SYSTEM_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/system_priv.h --- a/baseport/src/cedar/generic/base/syborg/specific/system_priv.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SYSTEM_PRIV_H__ -#define __SYSTEM_PRIV_H__ - -#include "system.h" -#include - -#endif // __SYSTEM_PRIV_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/specific/variantmediadef.h --- a/baseport/src/cedar/generic/base/syborg/specific/variantmediadef.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __VARIANTMEDIADEF_H__ -#define __VARIANTMEDIADEF_H__ - -// Variant parameters for IRAM Media Driver (MEDINT.PDD) -#define IRAM_DRIVECOUNT 1 -#define IRAM_DRIVELIST 0 // C: -#define IRAM_NUMMEDIA 1 -#define IRAM_DRIVENAME "IRam" - -#endif // __VARIANTMEDIADEF_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/driver/stringops.c --- a/baseport/src/cedar/generic/base/syborg/svphostfs/driver/stringops.c Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -char * strchr (const char *p, int ch) - { - char c; - - c = ch; - for (;; ++p) - { - if (*p == c) - return ((char *)p); - if (*p == '\0') - return (char *)(0); - } - /* NOTREACHED */ - } - -unsigned int strlen(const char *str) - { - const char *s; - for (s = str; *s; ++s) { } - - return(s - str); - } - -int strcmp(const char *s1, const char *s2) - { - while (*s1 == *s2++) - if (*s1++ == 0) - return (0); - return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); - } - -void * memchr(const void *s, int c, unsigned n) - { - if (n != 0) - { - const unsigned char *p = s; - do - { - if (*p++ == (unsigned char)c) - return ((void *)(p - 1)); - } while (--n != 0); - - } - // Not found - return (void *)0; - } - -int memcmp(const void *s1, const void *s2, unsigned n) - { - if (n != 0) - { - const unsigned char *p1 = s1, *p2 = s2; - - do - { - if (*p1++ != *p2++) - return (*--p1 - *--p2); - } while (--n != 0); - } - return (0); - } - -#ifdef __cplusplus -} -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/driver/svphostfsdriver.cpp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/driver/svphostfsdriver.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,919 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Device driver for SVP Host file system access -* -*/ - -#ifdef __WINS__ -#error - this driver cannot be built for emulation -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "rsvphostfsdriver.h" - -#include "libfdt.h" - -// Debug messages - uncomment define below -//#define SVPDBG -#ifdef SVPDBG -#define DP(format...) Kern::Printf(format) -#else -#define DP(format...) -#endif - -#define SVP_HOST_FS_DEVICE_ID 0xc51d0008 -#define SVP_PLATFORM_DEVICE_ID 0xc51d1000 - -class DSVPHostFsDriverFactory : public DLogicalDevice -{ -public: - - DSVPHostFsDriverFactory(); - virtual TInt Install(); - virtual void GetCaps(TDes8& aDes) const; - virtual TInt Create(DLogicalChannelBase*& aChannel); -}; - -class DSVPHostFsChannel : public DLogicalChannel -{ -public: - - DSVPHostFsChannel(DLogicalDevice* aLogicalDevice); - ~DSVPHostFsChannel(); - - virtual TInt DoCreate(TInt aUnit, const TDesC* anInfo, const TVersion& aVer); - virtual void HandleMsg(TMessageBase* aMsg); - -protected: - virtual void DoCancel(TInt aReqNo); - virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); - virtual TInt DoControl(TInt aFunction, TAny *a1, TAny *a2); - -private: - TInt MkDir(TSVPHostFsMkDirInfo* aInfo); - TInt RmDir(TSVPHostFsRmDirInfo* aInfo); - TInt Delete(TSVPHostFsDeleteInfo* aInfo); - TInt Rename(TSVPHostFsRenameInfo* aInfo); - TInt Replace(TSVPHostFsReplaceInfo* aInfo); - TInt Entry(TSVPHostFsEntryInfo* aInfo); - TInt SetEntry(TSVPHostFsSetEntryInfo* aInfo); - TInt FileOpen(TSVPHostFsFileOpenInfo* aInfo); - TInt FileClose(TUint32 aDrive, TUint32 aHandle); - TInt FileRead(TSVPHostFsFileReadInfo* aInfo); - TInt FileWrite(TSVPHostFsFileWriteInfo* aInfo); - TInt FileSetSize(TSVPHostFsFileSetSizeInfo* aInfo); - TInt FileSetEntry(TSVPHostFsSetEntryInfo* aInfo); - TInt DirOpen(TSVPHostFsDirOpenInfo* aInfo); - TInt Flush(TUint32 aDrive); - TInt DirClose(TUint32 aDrive, TUint32 aHandle); - TInt DirRead(TSVPHostFsDirReadInfo* aInfo); - - TInt GetID(TUint32 aDrive, TUint32 * aId); - - TInt SetUpDrives(); - TInt GetDriveMap(TAny * aMap); - -private: - DThread* iClientThread; - TDfcQue* iDFCQue; - TUint32 iDriveMap[DRIVE_MAP_SIZE] ; - -}; - - -#define RET_IF_ERROR(v, e) { if ((v = (e)) != KErrNone) return v; } - - -#define EDeviceID 0 -#define EOp 1 -#define ETreeStart 1 -#define EResult 2 -#define EArg0 3 -#define EArg1 4 -#define EArg2 5 -#define EArg3 6 - -static inline TUint32 SVPReadReg(TUint32 dev, TUint32 aReg) - { - DP("** ReadReg @ 0x%08x (%d)",dev,aReg); - - return *(volatile TUint32 *)(dev + (aReg << 2)); - } - -static inline void SVPWriteReg(TUint32 dev, TUint32 aReg, TUint32 aVal) - { - DP("** WriteReg @ 0x%08x (%d,%d)",dev,aReg,aVal); - - *(volatile TUint32*)(dev + (aReg << 2)) = aVal; - } - -static inline void SVPInvoke(TUint32 dev, TUint32 aVal) - { - DP("** Invoke @ 0x%08x (%d)",dev,aVal); - - *(TUint32*)(dev + (EOp << 2)) = aVal; - } - -///////////////////////////////////////////////////////////////////////// -// -// DSVPHostFsDriverFactory -// -///////////////////////////////////////////////////////////////////////// - -// -// DSVPHostFsDriverFactory constructor -// -DSVPHostFsDriverFactory::DSVPHostFsDriverFactory() - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::DSVPHostFsDriverFactory()"); - - iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); - } - -// -// DSVPHostFsDriverFactory::Create -// -TInt DSVPHostFsDriverFactory::Create(DLogicalChannelBase*& aChannel) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::Create()"); - - aChannel = new DSVPHostFsChannel(this); - - return aChannel ? KErrNone : KErrNoMemory; - } - -// -// DSVPHostFsDriverFactory::Install -// -TInt DSVPHostFsDriverFactory::Install() - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::Install()"); - - return(SetName(&KSVPHostFsDriverName)); - } - -// -// DSVPHostFsDriverFactory::Install -// -void DSVPHostFsDriverFactory::GetCaps(TDes8& aDes) const - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::GetCaps()"); - - TCapsSVPHostFsDriver b; - b.iVersion = TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber); - aDes.FillZ(aDes.MaxLength()); - aDes.Copy((TUint8 *)&b, Min(aDes.MaxLength(), sizeof(b))); - } - - -///////////////////////////////////////////////////////////////////////// -// -// DSVPHostFsChannel implementation -// -///////////////////////////////////////////////////////////////////////// - -// -// DSVPHostFsChannel constructor -// -DSVPHostFsChannel::DSVPHostFsChannel(DLogicalDevice* aLogicalDevice) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DSVPHostFsChannel()"); - - iDevice = aLogicalDevice; - - iClientThread = &Kern::CurrentThread(); - iClientThread->Open(); - } - -// -// DSVPHostFsChannel destructor -// -DSVPHostFsChannel::~DSVPHostFsChannel() - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::~DSVPHostFsChannel()"); - Kern::SafeClose((DObject*&)iClientThread, NULL); - } - -// -// DSVPHostFsChannel::DoCreate -// -TInt DSVPHostFsChannel::DoCreate(TInt /*aUnit*/, const TDesC* anInfo, const TVersion& aVer) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCreate()"); - - if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), aVer)) - return KErrNotSupported; - - - //Setup the driver for receiving client messages - SetDfcQ(Kern::DfcQue0()); - iMsgQ.Receive(); - - SetUpDrives(); - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCreate()- checking device"); - TUint id = SVPReadReg(KHwSVPHostFileSystemDevice, EDeviceID); - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCreate()- checked device- 0x%08x -expected 0x%08x", - id, SVP_HOST_FS_DEVICE_ID); - return id == SVP_HOST_FS_DEVICE_ID ? KErrNone : KErrHardwareNotAvailable; - } - -TInt DSVPHostFsChannel::SetUpDrives() - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetUpDrives() @ 0x%08x", KHwSVPPlatformDevice) ; - TUint32 platId = SVPReadReg(KHwSVPPlatformDevice, EDeviceID); - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetUpDrives()- checked device- 0x%08x -expected 0x%08x", - platId, SVP_PLATFORM_DEVICE_ID); - if (platId != SVP_PLATFORM_DEVICE_ID) return KErrHardwareNotAvailable; - - TUint32 * fdt = (TUint32 *)((char *)(SVPReadReg(KHwSVPPlatformDevice, ETreeStart) + KHwSVPPlatformDevice)); - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetUpDrives()- device tree @ 0x%08x", fdt); - - // Iteratate over the tree looking for "syborg,hostfs" nodes. - const char * compatible = "syborg,hostfs" ; - int offset = fdt_node_offset_by_compatible(fdt, -1, compatible); - while (offset != -FDT_ERR_NOTFOUND) - { - if (offset < 0) - { - DP("FDT: Node not found %d", offset) ; - return KErrHardwareNotAvailable ; - } - - int lenp1, lenp2 = 0; - TUint32 * deviceAddressp = (TUint32 *)fdt_getprop(fdt,offset,"reg",&lenp1); - - if (!deviceAddressp) - { - DP("FDT format error: reg %d", lenp1); - return KErrHardwareNotAvailable ; - } - - - TUint32 * driveNumberp = (TUint32 *)fdt_getprop(fdt,offset,"drive-number",&lenp2); - if (!driveNumberp) - { - DP("FDT format error: drive-number %d", lenp2); - return KErrHardwareNotAvailable ; - } - TUint32 deviceAddressPhys = bswap_32(*deviceAddressp); - -#define PhysicalToLinear(addr) ((addr & (~(Epoc::LinearToPhysical(KPrimaryIOBase)))) | KPrimaryIOBase) - - TUint32 deviceAddressLin = PhysicalToLinear(deviceAddressPhys) ; - TUint32 driveNumber = bswap_32(*driveNumberp) ; - DP("FDT: dev address phys 0x%08x lin 0x%08x len1 %d drive number %08x len2 %d", - deviceAddressPhys, deviceAddressLin, lenp1, driveNumber, lenp2) ; - TUint32 fsId = SVPReadReg(deviceAddressLin, EDeviceID) ; - DP("FDT: dev id 0x%08x", fsId) ; - if (fsId != SVP_HOST_FS_DEVICE_ID) return KErrHardwareNotAvailable ; - - // we have a disagreement about the base number of the drives: 0 or 1? - iDriveMap[driveNumber-1] = deviceAddressLin ; - offset = fdt_node_offset_by_compatible(fdt, offset, compatible); - } - return KErrNone; - } - -// -// DSVPHostFsChannel::DoCancel -// -void DSVPHostFsChannel::DoCancel(TInt aReqNo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCancel() %x(%d)", aReqNo, aReqNo); - } - -// -// DSVPHostFsChannel::DoRequest -// -TInt DSVPHostFsChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoRequest() %x(%d)", aReqNo, aReqNo); - - TInt err = KErrGeneral; - - (void)aStatus; - - switch(aReqNo) - { - case RSVPHostFsDriver::EMkDir: - { - err = MkDir((TSVPHostFsMkDirInfo*)a1); - break; - } - case RSVPHostFsDriver::ERmDir: - { - err = RmDir((TSVPHostFsRmDirInfo*)a1); - break; - } - case RSVPHostFsDriver::EDelete: - { - err = Delete((TSVPHostFsDeleteInfo*)a1); - break; - } - case RSVPHostFsDriver::ERename: - { - err = Rename((TSVPHostFsRenameInfo*)a1); - break; - } - case RSVPHostFsDriver::EReplace: - { - err = Replace((TSVPHostFsReplaceInfo*)a1); - break; - } - case RSVPHostFsDriver::EEntry: - { - err = Entry((TSVPHostFsEntryInfo*)a1); - break; - } - case RSVPHostFsDriver::ESetEntry: - { - err = SetEntry((TSVPHostFsSetEntryInfo*)a1); - break; - } - case RSVPHostFsDriver::EFileOpen: - { - err = FileOpen((TSVPHostFsFileOpenInfo*)a1); - break; - } - case RSVPHostFsDriver::EDirOpen: - { - err = DirOpen((TSVPHostFsDirOpenInfo*)a1); - break; - } - case RSVPHostFsDriver::EFileClose: - { - err = FileClose((TUint32)a1, (TUint32)a2); - break; - } - case RSVPHostFsDriver::EFileRead: - { - err = FileRead((TSVPHostFsFileReadInfo*)a1); - break; - } - case RSVPHostFsDriver::EFileWrite: - { - err = FileWrite((TSVPHostFsFileWriteInfo*)a1); - break; - } - case RSVPHostFsDriver::EFileSetSize: - { - err = FileSetSize((TSVPHostFsFileSetSizeInfo*)a1); - break; - } - case RSVPHostFsDriver::EFileFlushAll: - { - err = Flush((TUint32)a1); - break; - } - case RSVPHostFsDriver::EDirClose: - { - err = DirClose((TUint32)a1, (TUint32)a2); - break; - } - case RSVPHostFsDriver::EDirRead: - { - err = DirRead((TSVPHostFsDirReadInfo*)a1); - break; - } - case RSVPHostFsDriver::EGetDeviceID: - { - err = GetID((TUint32)a1, (TUint32*)a2); - break; - } - case RSVPHostFsDriver::EGetDriveMap: - { - err = GetDriveMap((TUint32*)a1); - break; - } - - default: - { - err = KErrGeneral; - } - } - - if (KErrNone != err) - { - DP("Error %d from DoRequest", err); - } - - return err; - } - -// -// DSVPHostFsChannel::DoControl -// -TInt DSVPHostFsChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoControl()"); - - DP("DoControl Function %d", aFunction); - - TInt err = KErrGeneral; - - /* There should be a good reason to use a control rather than a request. */ - - if (KErrNone != err) - { - DP("** (SVPHOSTFSDRIVER) Error %d from control function", err); - } - - return err; - } - -void DSVPHostFsChannel::HandleMsg(TMessageBase* aMsg) - { - - TThreadMessage& m = *(TThreadMessage*)aMsg; - TInt id = m.iValue; - - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::HandleMsg() %x(%d)", id, id); - - if (id == (TInt)ECloseMsg) - { - m.Complete(KErrNone, EFalse); - return; - } - if (id == KMaxTInt) - { - // DoCancel - DoCancel(m.Int0()); - m.Complete(KErrNone, ETrue); - return; - } - if (id < 0) - { - // DoRequest - TRequestStatus* pStatus = (TRequestStatus*)m.Ptr0(); - TInt r = DoRequest(~id, pStatus, m.Ptr1(), m.Ptr2()); - // if (r != KErrNone) - Kern::RequestComplete(iClientThread,pStatus,r); - m.Complete(KErrNone, ETrue); - } - else - { - // DoControl - TInt r = DoControl(id, m.Ptr0(), m.Ptr1()); - m.Complete(r, ETrue); - } - } - -TInt DSVPHostFsChannel::MkDir(TSVPHostFsMkDirInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::MkDir()"); - - TSVPHostFsMkDirInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsMkDirInfo))); - - if (!info.iName) - return KErrArgument; - - TUint16 pathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); - SVPWriteReg(device, EArg1, info.iLength); - SVPWriteReg(device, EArg2, info.iFlags); - SVPInvoke(device, RSVPHostFsDriver::EMkDir); - - return SVPReadReg(device, EResult); - - } - -TInt DSVPHostFsChannel::RmDir(TSVPHostFsRmDirInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::RmDir()"); - - TSVPHostFsRmDirInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsRmDirInfo))); - - if (!info.iName) - return KErrArgument; - - TUint16 pathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); - SVPWriteReg(device, EArg1, info.iLength); - SVPInvoke(device, RSVPHostFsDriver::ERmDir); - - return SVPReadReg(device, EResult); - - } - -TInt DSVPHostFsChannel::Delete(TSVPHostFsDeleteInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Delete()"); - - TSVPHostFsDeleteInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsDeleteInfo))); - - if (!info.iName) - return KErrArgument; - - TUint16 pathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); - SVPWriteReg(device, EArg1, info.iLength); - SVPInvoke(device, RSVPHostFsDriver::EDelete); - - return SVPReadReg(device, EResult); - - } - -TInt DSVPHostFsChannel::Rename(TSVPHostFsRenameInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Rename()"); - - TSVPHostFsRenameInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsRenameInfo))); - - if (!info.iOldName) - return KErrArgument; - - if (!info.iNewName) - return KErrArgument; - - TUint16 oldPathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iOldName, (TUint8*)oldPathData, info.iOldLength*2)); - - TUint16 newPathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iNewName, (TUint8*)newPathData, info.iNewLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)oldPathData)); - SVPWriteReg(device, EArg1, info.iOldLength); - SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)newPathData)); - SVPWriteReg(device, EArg3, info.iNewLength); - SVPInvoke(device, RSVPHostFsDriver::ERename); - - return SVPReadReg(device, EResult); - - } - -TInt DSVPHostFsChannel::Replace(TSVPHostFsReplaceInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Replace()"); - - TSVPHostFsReplaceInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsReplaceInfo))); - - if (!info.iOldName) - return KErrArgument; - - if (!info.iNewName) - return KErrArgument; - - TUint16 oldPathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iOldName, (TUint8*)oldPathData, info.iOldLength*2)); - - TUint16 newPathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iNewName, (TUint8*)newPathData, info.iNewLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)oldPathData)); - SVPWriteReg(device, EArg1, info.iOldLength); - SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)newPathData)); - SVPWriteReg(device, EArg3, info.iNewLength); - SVPInvoke(device, RSVPHostFsDriver::EReplace); - - return SVPReadReg(device, EResult); - - } - -TInt DSVPHostFsChannel::Entry(TSVPHostFsEntryInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Entry()"); - - TSVPHostFsEntryInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsEntryInfo))); - - if (!info.iName) - return KErrArgument; - - TUint16 pathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); - SVPWriteReg(device, EArg1, info.iLength); - SVPInvoke(device, RSVPHostFsDriver::EEntry); - - RET_IF_ERROR(err, SVPReadReg(device, EResult)); - - TUint32 att = SVPReadReg(device, EArg0); - TUint32 modified = SVPReadReg(device, EArg1); - TUint32 filesize = SVPReadReg(device, EArg2); - // TODO: Yuk! Hack alert! Say EWindows for now. But really should probably say EUnknown, - // since the device won't tell us. Not sure if it can (easily) given remote mounting etc. - // However this probably delays the problem. On the other hand it is probably best to make - // the file service guess, since it need only guess once, and cache its guess. - TUint32 filetimetype = EWindows; - - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iAtt, (TUint8*)&att, sizeof(att))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iModified, (TUint8*)&modified, sizeof(modified))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iSize, (TUint8*)&filesize, sizeof(filesize))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iTimeType, (TUint8*)&filetimetype, sizeof(filetimetype))); - return KErrNone; - } - -TInt DSVPHostFsChannel::SetEntry(TSVPHostFsSetEntryInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetEntry()"); - return KErrNotSupported; - } - -TInt DSVPHostFsChannel::Flush(TUint32 aDrive) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Flush()"); - TUint32 device = iDriveMap[aDrive]; - SVPInvoke(device, RSVPHostFsDriver::EFileFlushAll); - - return KErrNone; - } - -TInt DSVPHostFsChannel::DirOpen(TSVPHostFsDirOpenInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DirOpen()"); - - TSVPHostFsDirOpenInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsDirOpenInfo))); - - if (!info.iName) - return KErrArgument; - - TUint16 pathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); - SVPWriteReg(device, EArg1, info.iLength); - SVPInvoke(device, RSVPHostFsDriver::EDirOpen); - - RET_IF_ERROR(err, SVPReadReg(device, EResult)); - - // handle is in arg 0 - TUint32 handle = SVPReadReg(device, EArg0); - return Kern::ThreadRawWrite(iClientThread, &aInfo->iHandle, (TUint8*)&handle, sizeof(handle)); - } - -TInt DSVPHostFsChannel::FileOpen(TSVPHostFsFileOpenInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileOpen()"); - - TSVPHostFsFileOpenInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileOpenInfo))); - - if (!info.iName) - return KErrArgument; - - TUint16 pathData[KMaxPath]; - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); - SVPWriteReg(device, EArg1, info.iLength); - SVPWriteReg(device, EArg2, info.iMode); - SVPWriteReg(device, EArg3, info.iOpen); - SVPInvoke(device, RSVPHostFsDriver::EFileOpen); - - RET_IF_ERROR(err, SVPReadReg(device, EResult)); - - TUint32 handle = SVPReadReg(device, EArg0); - TUint32 att = SVPReadReg(device, EArg1); - TUint32 modified = SVPReadReg(device, EArg2); - TUint32 size = SVPReadReg(device, EArg3); - TUint32 timeType = EWindows; - - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iHandle, (TUint8*)&handle, sizeof(handle))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iAtt, (TUint8*)&att, sizeof(att))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iModified, (TUint8*)&modified, sizeof(modified))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iSize, (TUint8*)&size, sizeof(size))); - return Kern::ThreadRawWrite(iClientThread, &aInfo->iTimeType, (TUint8*)&timeType, sizeof(timeType)); - - } - -TInt DSVPHostFsChannel::FileClose(TUint32 aDrive, TUint32 aHandle) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileClose()"); - - TUint32 device = iDriveMap[aDrive]; - SVPWriteReg(device, EArg0, aHandle); - SVPInvoke(device, RSVPHostFsDriver::EFileClose); - return SVPReadReg(device, EResult); - } - -TInt DSVPHostFsChannel::FileRead(TSVPHostFsFileReadInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileRead()"); - - char buf[0x400]; - TSVPHostFsFileReadInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileReadInfo))); - - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileRead handle %d length %d pos %d phys_addr 0x%08x info.iBuf 0x%08x", - info.iHandle, info.iLength, info.iPos, Epoc::LinearToPhysical((TUint32)buf), info.iBuf); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, info.iHandle); - SVPWriteReg(device, EArg1, info.iPos); - SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)buf)); - SVPWriteReg(device, EArg3, info.iLength); - SVPInvoke(device, RSVPHostFsDriver::EFileRead); - - RET_IF_ERROR(err, SVPReadReg(device, EResult)); - - TUint32 len = SVPReadReg(device, EArg0); - - DP("** (SVPHOSTFSDRIVER) Read %d bytes", len); - - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iLength, (TUint8*)&len, sizeof(len))); - return Kern::ThreadRawWrite(iClientThread, (TUint8*)info.iBuf, (TUint8*)&buf, len); - } - -TInt DSVPHostFsChannel::FileWrite(TSVPHostFsFileWriteInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileWrite()"); - - char buf[0x400]; - TSVPHostFsFileWriteInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileWriteInfo))); - - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileWrite handle %d length %d pos %d phys_addr 0x%08x info.iBuf 0x%08x", - info.iHandle, info.iLength, info.iPos, Epoc::LinearToPhysical((TUint32)buf), info.iBuf); - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, (TUint8 *)info.iBuf, buf, info.iLength)); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, info.iHandle); - SVPWriteReg(device, EArg1, info.iPos); - SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)buf)); - SVPWriteReg(device, EArg3, info.iLength); - SVPInvoke(device, RSVPHostFsDriver::EFileWrite); - - RET_IF_ERROR(err, SVPReadReg(device, EResult)); - - TUint32 len = SVPReadReg(device, EArg0); - - DP("** (SVPHOSTFSDRIVER) Wrote %d bytes", len); - - return Kern::ThreadRawWrite(iClientThread, &aInfo->iLength, (TUint8*)&len, sizeof(len)); - } - -TInt DSVPHostFsChannel::FileSetSize(TSVPHostFsFileSetSizeInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileSetSize()"); - - TSVPHostFsFileSetSizeInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileSetSizeInfo))); - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, info.iHandle); - SVPWriteReg(device, EArg1, info.iLength); - SVPInvoke(device, RSVPHostFsDriver::EFileSetSize); - - TUint32 res = SVPReadReg(device, EResult); - - RET_IF_ERROR(err, res); - - return res; - } - -TInt DSVPHostFsChannel::FileSetEntry(TSVPHostFsSetEntryInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileSetEntry()"); - - return KErrNotSupported; - } - -TInt DSVPHostFsChannel::DirClose(TUint32 aDrive, TUint32 aHandle) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DirClose()"); - - TUint32 device = iDriveMap[aDrive]; - SVPWriteReg(device, EArg0, aHandle); - SVPInvoke(device, RSVPHostFsDriver::EDirClose); - return SVPReadReg(device, EResult); - } - -TInt DSVPHostFsChannel::DirRead(TSVPHostFsDirReadInfo* aInfo) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DirRead()"); - - TUint16 name[KMaxPath]; - TSVPHostFsDirReadInfo info; - TInt err = KErrNone; - - RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsDirReadInfo))); - - - TUint32 device = iDriveMap[info.iDrive]; - SVPWriteReg(device, EArg0, info.iHandle); - SVPWriteReg(device, EArg1, Epoc::LinearToPhysical((TUint32)name)); - SVPWriteReg(device, EArg2, KMaxPath); - SVPInvoke(device, RSVPHostFsDriver::EDirRead); - - RET_IF_ERROR(err, SVPReadReg(device, EResult)); - - TUint32 att = SVPReadReg(device, EArg0); - TUint32 modified = SVPReadReg(device, EArg1); - TUint32 filesize = SVPReadReg(device, EArg2); - TUint32 namesize = SVPReadReg(device, EArg3); - // TODO: Yuk! Hack alert! Say EWindows for now. But really should probably say EUnknown, - // since the device won't tell us. Not sure if it can (easily) given remote mounting etc. - // However this probably delays the problem. On the other hand it is probably best to make - // the file service guess, since it need only guess once, and cache its guess. - TUint32 filetimetype = EWindows; - - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iAtt, (TUint8*)&att, sizeof(att))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iModified, (TUint8*)&modified, sizeof(modified))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iSize, (TUint8*)&filesize, sizeof(filesize))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iTimeType, (TUint8*)&filetimetype, sizeof(filetimetype))); - RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iLength, (TUint8*)&namesize, sizeof(namesize))); - return Kern::ThreadRawWrite(iClientThread, &aInfo->iName, (TUint8*)&name, namesize * sizeof(TUint16)); - } - -TInt DSVPHostFsChannel::GetID(TUint32 aDrive, TUint32 * aId) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::GetID"); - TUint32 device = iDriveMap[aDrive]; - TUint32 id = SVPReadReg(device, EDeviceID); - return Kern::ThreadRawWrite(iClientThread, aId, &id, sizeof(TUint32)); - } - -TInt DSVPHostFsChannel::GetDriveMap(TAny * aMap) - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::GetDriveMap"); - return Kern::ThreadRawWrite(iClientThread, aMap, iDriveMap, sizeof(iDriveMap)); - } - -DECLARE_EXTENSION_LDD() - { - DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory created"); - return new DSVPHostFsDriverFactory; - } - -DECLARE_STANDARD_EXTENSION() - { - DP("** (SVPHOSTFSDRIVER) SVPHostFs extension entry point"); - - DP("** (SVPHOSTFSDRIVER) Creating LocDrv device"); - TInt r; - DSVPHostFsDriverFactory* device = new DSVPHostFsDriverFactory; - if (device==NULL) - r=KErrNoMemory; - else - r=Kern::InstallLogicalDevice(device); - - DP("** (SVPHOSTFSDRIVER) Installing LocDrv device in kernel returned %d",r); - - return r; - } diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/driver/svphostfsdriver.h --- a/baseport/src/cedar/generic/base/syborg/svphostfs/driver/svphostfsdriver.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SVPHOSTFSDRIVER_H__ -#define __SVPHOSTFSDRIVER_H__ - - -#include "rsvphostfsdriver.h" - -// Debug messages -//#define SVPDBG -#ifdef SVPDBG -#define LOG_MSG(x) Kern::Printf(x) -#define LOG_MSG2(x, y) Kern::Printf(x, y) -#else -#define LOG_MSG(x) -#define LOG_MSG2(x, y) -#endif - - -// -// class DSVPHostFsDriverFactory -// -class DSVPHostFsDriverFactory : public DLogicalDevice -{ -public: - - DSVPHostFsDriverFactory(); - virtual TInt Install(); - virtual void GetCaps(TDes8& aDes) const; - virtual TInt Create(DLogicalChannelBase*& aChannel); -}; - -// -// DSVPHostFsChannel -// -class DSVPHostFsChannel : public DLogicalChannel -{ -public: - - DSVPHostFsChannel(DLogicalDevice* aLogicalDevice); - ~DSVPHostFsChannel(); - - virtual TInt DoCreate(TInt aUnit, const TDesC* anInfo, const TVersion& aVer); - virtual void HandleMsg(TMessageBase* aMsg); - -protected: - virtual void DoCancel(TInt aReqNo); - virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); - virtual TInt DoControl(TInt aFunction, TAny *a1, TAny *a2); - -private: - TInt DirOpen(TSVPHostFsDirOpenInfo* aInfo); - TInt DirClose(TUint32 aHandle); - TInt DirRead(TSVPHostFsDirReadInfo* aInfo); - -private: - DThread* iClientThread; - - - TDfcQue* iDFCQue; - -}; - -#endif //__SVPHOSTFSDRIVER_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/fs/rsvphostfsdriver.cpp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/fs/rsvphostfsdriver.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - -#include - -#include "svphostfsy.h" - -#ifdef DP -#undef DP -#define DP(f...) -#endif - -TInt RSVPHostFsDriver::Open() - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Open()")); - return DoCreate(KSVPHostFsDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), KNullUnit, NULL, NULL); - } - -TInt RSVPHostFsDriver::MkDir(TSVPHostFsMkDirInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::MkDir()")); - return DoSVPRequest(EMkDir, &aInfo); - } - -TInt RSVPHostFsDriver::RmDir(TSVPHostFsRmDirInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::RmDir()")); - return DoSVPRequest(ERmDir, &aInfo); - } - -TInt RSVPHostFsDriver::Delete(TSVPHostFsDeleteInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Delete()")); - return DoSVPRequest(EDelete, &aInfo); - } - -TInt RSVPHostFsDriver::Rename(TSVPHostFsRenameInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Rename()")); - return DoSVPRequest(ERename, &aInfo); - } - -TInt RSVPHostFsDriver::Replace(TSVPHostFsReplaceInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Replace()")); - return DoSVPRequest(EReplace, &aInfo); - } - -TInt RSVPHostFsDriver::ReadUid(const TDesC& /*aName*/,TEntry& /*anEntry*/) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::ReadUid()")); - return KErrNone; - } - -TInt RSVPHostFsDriver::Entry(TSVPHostFsEntryInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Entry()")); - return DoSVPRequest(EEntry, &aInfo); - } - -TInt RSVPHostFsDriver::SetEntry(TSVPHostFsSetEntryInfo &aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::SetEntry()")); - return DoSVPRequest(ESetEntry, &aInfo); - } - -TInt RSVPHostFsDriver::FileOpen(TSVPHostFsFileOpenInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileOpen()")); - return DoSVPRequest(EFileOpen, &aInfo); - } - -TInt RSVPHostFsDriver::FileClose(TUint32 aDrive, TUint32 aHandle) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileClose()")); - return DoSVPRequest(EFileClose, (TAny *)aDrive, (TAny *)aHandle); - } - -TInt RSVPHostFsDriver::FileRead(TSVPHostFsFileReadInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileRead()")); - return DoSVPRequest(EFileRead, &aInfo); - } - -TInt RSVPHostFsDriver::FileWrite(TSVPHostFsFileWriteInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileWrite()")); - return DoSVPRequest(EFileWrite, &aInfo); - } - -TInt RSVPHostFsDriver::FileSetSize(TSVPHostFsFileSetSizeInfo &aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileSetSize()")); - return DoSVPRequest(EFileSetSize, &aInfo); - } - -TInt RSVPHostFsDriver::FileSetEntry(TSVPHostFsSetEntryInfo &aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileSetEntry()")); - return KErrNotSupported; - } - -TInt RSVPHostFsDriver::FlushData(TUint32 aDrive) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FlushData()")); - return DoSVPRequest(EFileFlushAll, (TAny *)aDrive); - } - -TInt RSVPHostFsDriver::FlushAll(TUint32 aDrive) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FlushAll()")); - return DoSVPRequest(EFileFlushAll, (TAny *)aDrive); - } - -TInt RSVPHostFsDriver::DirOpen(TSVPHostFsDirOpenInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::DirOpen()")); - return DoSVPRequest(EDirOpen, &aInfo); - } - -TInt RSVPHostFsDriver::DirClose(TUint32 aDrive, TUint32 aHandle) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::DirClose()")); - return DoSVPRequest(EDirClose, (TAny *)aDrive, (TAny *)aHandle); - } - -TInt RSVPHostFsDriver::DirRead(TSVPHostFsDirReadInfo& aInfo) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::DirRead()")); - return DoSVPRequest(EDirRead, &aInfo); - } - -TUint32 RSVPHostFsDriver::GetDeviceID(TUint32 aDrive) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::GetDeviceID()")); - - TUint32 id; - TInt r = DoSVPRequest(EGetDeviceID, (TAny *) aDrive, &id); - return (r != KErrNone) ? r : id; - } - -TInt RSVPHostFsDriver::GetDriveMap(TUint32 * aMap) - { - DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::GetDeviceID()")); - - return DoSVPRequest(EGetDriveMap, (TAny *)aMap); - } - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphost.cpp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphost.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,691 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: f32test\fsstress\t_remote.cpp -* -*/ - -#if !defined(__F32FILE_H__) -#include -#endif -#if !defined(__E32TEST_H__) -#include -#endif -#if !defined(__T_STD_H__) -#include "t_std.h" -#endif -#if !defined(__T_REMFSY_H__) -#include "t_remfsy.h" -#endif - -GLDEF_D RTest test(_L("T_REMOTE - DEFAULT DRIVE")); -GLDEF_D RTest testx(_L("X Drive (WINS) <-> D Drive (MARM)")); -GLDEF_D RTest testy(_L("Y Drive (WINS) <-> C Drive (MARM)")); -GLDEF_D RTest testq(_L("REMOTE Q Drive")); - -LOCAL_D TFileName gBatchFile; -LOCAL_D TBool gRunByBatch=EFalse; - -GLDEF_D TFileName gExeFileName(RProcess().FileName()); - -/* -INFORMATION - What this test is all about - -T_REMOTE tests the asynchronous remote file system implementation, introduced in -F32 release 110 and refined in release 112. The test sets up and mounts four drives, -the default drive (usually C on WINS and MARM), a remote drive (Q) and two others, on -MARM these are C and D, on WINS these are X and Y. The remote filesystem is the only -system treated asynchronously by F32. - -The test sets up a thread for each drive and runs a number of tests on each drive. -In the remote filesystem case, a dummy filesystem has been implemented, this is built -as T_REMFSY.fsy. The tests are designed to stress a number of fileserver API -functions. The test MultipleSessions() is adapted from another F32 test T_SESSION. -It sets up an array of fileserver connections and then uses each connection to run -a number of tests - alternating between connections to stress F32 as it does so. The -test should therefore be testing multiple fileserver connections on multiple drives - -the remote filesystem running concurrently with the other drives. There should be -no failure or confusion between fileserver sessions. Each drive has a separate test -console which should complete successfully. - -NOTE: TO RUN THIS CARD SUCCESSFULLY ON MARM A CF CARD IS REQUIRED - -*/ - -LOCAL_C void Test0(RTest& aTest) -// -// Scan for open files - no sessions -// - { - aTest.Next(_L("Scan for open files with no sessions open")); - CFileList* list; - TOpenFileScan fileScan(TheFs); - fileScan.NextL(list); - if (list==NULL) - return; - TInt count=list->Count(); - if (count==1) - { - gRunByBatch=ETrue; - gBatchFile=(*list)[0].iName; - delete list; - fileScan.NextL(list); - if (list==NULL) - return; - count=list->Count(); - } - while (count--) - { - TEntry entry=(*list)[count]; - aTest.Printf(_L("%d) EntryName = %S\n"),count,&entry.iName); - } - //aTest.Printf(_L("Test will fail unless files are closed.\n")); - //aTest.Printf(_L("Press any key ...\n")); - //aTest.Getch(); - } - - -LOCAL_C void Test1() -// -// This test is only called by default drive -// Test OpenFileScan -// - { - test.Next(_L("Scan for open files - one session only")); - - RFile file1,file2,file3; - TFileName fn; - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FILE.CPP"); - fn[0] = gExeFileName[0]; - r=file2.Open(TheFs,fn,EFileRead); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - - CFileList* list; - TOpenFileScan fileScan(TheFs); - fileScan.NextL(list); - - if (gRunByBatch) - { - test(list!=NULL); - test(list->Count()==1); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L(".BAT"))>=0); - delete list; - fileScan.NextL(list); - } - - test(list!=NULL); - TInt count=list->Count(); - test(count==3); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - entry=(*list)[1]; - test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); - entry=(*list)[2]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - TThreadId threadId=fileScan.ThreadId(); - RThread current; - TThreadId currentId=current.Id(); - test(threadId==currentId); - delete list; - - fileScan.NextL(list); - test(list==NULL); - - file1.Close(); - file2.Close(); - file3.Close(); - } - -LOCAL_C void Test2() -// -// Test openfilescan - empty, full, empty. -// - { - test.Next(_L("Scan for open files - empty sessions")); - - RFs fs1,fs2,fs3,fs4; - TInt r=fs1.Connect(); - test(r==KErrNone); - r=fs2.Connect(); - test(r==KErrNone); - r=fs3.Connect(); - test(r==KErrNone); - r=fs4.Connect(); - test(r==KErrNone); - - RFile file1,file2,file3; - TFileName fn; - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FILE.CPP"); - fn[0] = gExeFileName[0]; - r=file2.Open(fs2,fn,EFileRead); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - - CFileList* list; - TOpenFileScan fileScan(TheFs); - fileScan.NextL(list); - - if (gRunByBatch) - { - test(list!=NULL); - test(list->Count()==1); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L(".BAT"))>=0); - delete list; - fileScan.NextL(list); - } - - test(list!=NULL); - TInt count=list->Count(); - test(count==3); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - entry=(*list)[1]; - test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); - entry=(*list)[2]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - TThreadId threadId=fileScan.ThreadId(); - RThread current; - TThreadId currentId=current.Id(); - test(threadId==currentId); - delete list; - - fileScan.NextL(list); - test(list==NULL); - - file1.Close(); - file2.Close(); - file3.Close(); - fs1.Close(); - fs2.Close(); - fs3.Close(); - fs4.Close(); - } - -LOCAL_C void Test3() -// -// Test openfilescan - empty, full, empty full -// - { - test.Next(_L("Scan for open files - multiple sessions")); - - RFs fs1,fs2,fs3,fs4; - TInt r=fs1.Connect(); - test(r==KErrNone); - r=fs2.Connect(); - test(r==KErrNone); - r=fs3.Connect(); - test(r==KErrNone); - r=fs4.Connect(); - test(r==KErrNone); - - RFile file1,file2,file3; - TFileName fn; - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FILE.CPP"); - fn[0] = gExeFileName[0]; - r=file2.Open(fs2,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - - r=file1.Open(fs4,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FILE.CPP"); - fn[0] = gExeFileName[0]; - r=file2.Open(fs4,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file3.Open(fs4,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - - CFileList* list; - TOpenFileScan fileScan(TheFs); - fileScan.NextL(list); - - if (gRunByBatch) - { - test(list!=NULL); - test(list->Count()==1); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L(".BAT"))>=0); - delete list; - fileScan.NextL(list); - } - - test(list!=NULL); - TInt count=list->Count(); - test(count==3); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - entry=(*list)[1]; - test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); - entry=(*list)[2]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - TThreadId threadId=fileScan.ThreadId(); - RThread current; - TThreadId currentId=current.Id(); - test(threadId==currentId); - delete list; - - fileScan.NextL(list); - test(list!=NULL); - count=list->Count(); - test(count==3); - entry=(*list)[0]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - entry=(*list)[1]; - test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); - entry=(*list)[2]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - threadId=fileScan.ThreadId(); - currentId=current.Id(); - test(threadId==currentId); - delete list; - - fileScan.NextL(list); - test(list==NULL); - - file1.Close(); - file2.Close(); - file3.Close(); - fs1.Close(); - fs2.Close(); - fs3.Close(); - fs4.Close(); - } - -LOCAL_C void Test4() -// -// Test openfilescan - rdirs, empty, full, empty rdirs. -// - { - test.Next(_L("Scan for open files - check RDir sessions are ignored")); - - RFs fs1,fs2,fs3,fs4; - TFileName fn; - TInt r=fs1.Connect(); - test(r==KErrNone); - r=fs2.Connect(); - test(r==KErrNone); - r=fs3.Connect(); - test(r==KErrNone); - r=fs4.Connect(); - test(r==KErrNone); - - RDir dir1,dir2,dir3,dir4; - fn = _L("Z:\\TEST\\*.XDE"); - fn[0] = gExeFileName[0]; - r=dir1.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir2.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir3.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir4.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - - RFile file1,file2,file3; - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FILE.CPP"); - fn[0] = gExeFileName[0]; - r=file2.Open(fs2,fn,EFileRead); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - - RDir dir5,dir6,dir7,dir8; - fn = _L("Z:\\TEST\\*.XDE"); - fn[0] = gExeFileName[0]; - r=dir5.Open(fs4,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir6.Open(fs4,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir7.Open(fs4,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir8.Open(fs4,fn,KEntryAttMaskSupported); - test(r==KErrNone); - - CFileList* list; - TOpenFileScan fileScan(TheFs); - fileScan.NextL(list); - - if (gRunByBatch) - { - test(list!=NULL); - test(list->Count()==1); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L(".BAT"))>=0); - delete list; - fileScan.NextL(list); - } - - test(list!=NULL); - TInt count=list->Count(); - test(count==3); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - entry=(*list)[1]; - test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); - entry=(*list)[2]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - TThreadId threadId=fileScan.ThreadId(); - RThread current; - TThreadId currentId=current.Id(); - test(threadId==currentId); - delete list; - - fileScan.NextL(list); - test(list==NULL); - - file1.Close(); - file2.Close(); - file3.Close(); - dir1.Close(); dir2.Close(); - dir3.Close(); dir4.Close(); - dir5.Close(); dir6.Close(); - dir7.Close(); dir8.Close(); - fs1.Close(); fs2.Close(); - fs3.Close(); fs4.Close(); - } - -LOCAL_C void Test5() -// -// Test OpenFileScan -// - { - - test.Next(_L("Scan for open files - mixed RDirs and RFiles")); - - RFile file1,file2,file3; - TFileName fn; - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FILE.CPP"); - fn[0] = gExeFileName[0]; - r=file2.Open(TheFs,fn,EFileRead); - test(r==KErrNone); - fn = _L("Z:\\TEST\\T_FSRV.CPP"); - fn[0] = gExeFileName[0]; - r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); - test(r==KErrNone); - - RDir dir1,dir2,dir3,dir4; - fn = _L("Z:\\TEST\\*.XDE"); - fn[0] = gExeFileName[0]; - r=dir1.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir2.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir3.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - r=dir4.Open(TheFs,fn,KEntryAttMaskSupported); - test(r==KErrNone); - - CFileList* list; - TOpenFileScan fileScan(TheFs); - fileScan.NextL(list); - - if (gRunByBatch) - { - test(list!=NULL); - test(list->Count()==1); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L(".BAT"))>=0); - delete list; - fileScan.NextL(list); - } - - test(list!=NULL); - TInt count=list->Count(); - test(count==3); - TEntry entry=(*list)[0]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - entry=(*list)[1]; - test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); - entry=(*list)[2]; - test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); - TThreadId threadId=fileScan.ThreadId(); - RThread current; - TThreadId currentId=current.Id(); - test(threadId==currentId); - delete list; - - fileScan.NextL(list); - test(list==NULL); - - file1.Close(); - file2.Close(); - file3.Close(); - dir1.Close(); - dir2.Close(); - dir3.Close(); - dir4.Close(); - } - - - -LOCAL_C void MultipleSessions(TInt aDrive, RTest& aTest) -// -// Create an array of fileserver sessions -// Create an array of TMultipleSessionTest objects -// - - { -#if defined(UNICODE) - const TInt maxNumberSessions=10; -#else - const TInt maxNumberSessions=20; -#endif - - RFs session[maxNumberSessions]; - TMultipleSessionTest testObject[maxNumberSessions]; - TInt i=0; - TInt r; - - for (; i -#include -#include -#include - -#include "svphostfsy.h" - -////////////////////////////////////////////////////////////////////////// -// CSVPHostDirCB // -////////////////////////////////////////////////////////////////////////// - -CSVPHostDirCB::CSVPHostDirCB(/*CSessionFs* aSession*/) -// -// Constructor -// - : CDirCB(/*aSession*/),iEntry() - { - __DECLARE_NAME(_S("CSVPHostDirCB")); - } - -CSVPHostDirCB::~CSVPHostDirCB() -// -// Destructor -// - { - DP(_L("** (SVPHOSTDIR) CSVPHostDirCB::~CSVPHostDirCB")); - - if ((TInt)iHandle == KErrBadHandle) return; - - SVP_HOST_FS_DEVICE().DirClose(Drive().DriveNumber(), iHandle); - } - -TBool CSVPHostDirCB::MatchUid() -// -// Match the uid ? -// - { - if (iUidType[0]!=TUid::Null() || iUidType[1]!=TUid::Null() || iUidType[2]!=TUid::Null()) - return(ETrue); - return(EFalse); - } - -void fileTimeToTime(TUint32 t,TTime& aTime, TFileTimeType aType) -// -// Convert a time (in seconds from the epoc) into a TTIME -// - { - TInt64 at =((TInt64)t) * 1000000; - TTime time = TTime(at); - if (aType == EWindows) - { - time += TTimeIntervalYears(1970); - time += TTimeIntervalDays(1); - } - aTime=time; - } - -LOCAL_C TBool CompareUid(const TUidType& aUidTrg, const TUidType& aUidSuitor) -// -// Compare the suitor to the target pattern -// - { - - if (aUidTrg[0]!=TUid::Null() && aUidTrg[0]!=aUidSuitor[0]) - return(EFalse); - if (aUidTrg[1]!=TUid::Null() && aUidTrg[1]!=aUidSuitor[1]) - return(EFalse); - if (aUidTrg[2]!=TUid::Null() && aUidTrg[2]!=aUidSuitor[2]) - return(EFalse); - return(ETrue); - } - - -void CSVPHostDirCB::ReadL(TEntry& anEntry) -// -// Read the next entry from the directory -// - { - DP(_L("** (SVPHOSTDIR) CSVPHostDirCB::ReadL")); - - TUint driveNumber = Drive().DriveNumber() ; - FOREVER - { - if (!iPending) - { - TSVPHostFsDirReadInfo info(driveNumber, iHandle); - User::LeaveIfError(SVP_HOST_FS_DEVICE().DirRead(info)); - - TPtr name((TUint16 *)&info.iName[0], info.iLength, KMaxPath); - - if (name==_L(".") || name==_L("..")) - continue; - - iEntry.iName = name; - iEntry.iAtt=info.iAtt&KEntryAttMaskSupported; - iEntry.iSize=info.iSize; - fileTimeToTime(info.iModified,iEntry.iModified, info.iTimeType); - DP(_L("%S %d %x %x"), &name, iEntry.iAtt, iEntry.iSize, iEntry.iModified); - } - iPending=EFalse; - anEntry=iEntry; - if ((iFullName.NameAndExt()==_L("*.*") || anEntry.iName.MatchF(iFullName.NameAndExt())!=KErrNotFound) - && Mount().MatchEntryAtt(anEntry.iAtt&KEntryAttMaskSupported,iAtt)) - { - if (MatchUid()) - { - TParse fileName; - TBuf path=iFullName.Path(); - fileName.Set(anEntry.iName,&path,NULL); - (*(CSVPHostMountCB*)&Mount()).ReadUidL(fileName.FullName(),anEntry); - if (CompareUid(iUidType,anEntry.iType)) - break; - } - else - break; - } - break; - } - - if ((iAtt&KEntryAttAllowUid)==0 || anEntry.iAtt&KEntryAttDir || MatchUid()) - return; - TParse fileName; - TBuf path=iFullName.Path(); - fileName.Set(anEntry.iName,&path,NULL); - (*(CSVPHostMountCB*)&Mount()).ReadUidL(fileName.FullName(),anEntry); - - return; - } - - -////////////////////////////////////////////////////////////////////////// -// CSVPHostFormatCB // -////////////////////////////////////////////////////////////////////////// - -CSVPHostFormatCB::CSVPHostFormatCB(/*CSessionFs* aSession*/)//???JCS -// -// Constructor -// - : CFormatCB(/*aSession*/) - { - __DECLARE_NAME(_S("CSVPHostFormatCB")); - } - -CSVPHostFormatCB::~CSVPHostFormatCB() -// -// Destructor -// - {} - -void CSVPHostFormatCB::DoFormatStepL() -// -// Do Formatting -// - { - iCurrentStep=0; - User::Leave(KErrNotSupported); - } - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostfil.cpp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostfil.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - -#include "svphostfsy.h" - - - -////////////////////////////////////////////////////////////////////////// -// CSVPHostFileCB // -////////////////////////////////////////////////////////////////////////// - -CSVPHostFileCB::CSVPHostFileCB() -// -// Constructor -// - { - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::CSVPHostFileCB()")); - - __DECLARE_NAME(_S("CSVPHostFileCB")); - } - -CSVPHostFileCB::~CSVPHostFileCB() -// -// Destructor -// - { - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::~CSVPHostFileCB()")); - if ((TInt)iHandle == KErrBadHandle) return; - - SVP_HOST_FS_DEVICE().FileClose(Drive().DriveNumber(), iHandle); - } - -TBool CSVPHostFileCB::IsRomDrive() const -// -// Returns ETrue if the drive number == EDriveZ -// - { - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::IsRomDrive()")); - return(EFalse); - } - - -void CSVPHostFileCB::CheckPos(TInt /*aPos*/) - { - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::CheckPos()")); - } - -void CSVPHostFileCB::ReadL(TInt aPos,TInt& aLength ,const TAny* aDes , const RMessagePtr2& aMessage) - { - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL(%d,%d)"), aPos, aLength); - - TInt n = 0; - TInt pos=aPos; - TInt len=aLength; - TBuf8<0x400> buf; - - if (aMessage.Handle() == KLocalMessageHandle) - ((TPtr8* )aDes)->SetLength(0); - - TUint driveNumber = Drive().DriveNumber() ; - while (len) - { - TInt s=Min(len,buf.MaxLength()); - TSVPHostFsFileReadInfo info(driveNumber, iHandle,s,pos+n,(char*)buf.Ptr()); - - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL pos %d s %d p 0x%08x"), pos+n, s, buf.Ptr()); - - User::LeaveIfError(SVP_HOST_FS_DEVICE().FileRead(info)); - - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL read %d bytes"), info.iLength); - - buf.SetLength(info.iLength); - - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL set buf length")); - - if (aMessage.Handle() == KLocalMessageHandle) - ((TPtr8* )aDes)->Append(buf); - else - aMessage.WriteL(0,buf,n); - - n+=info.iLength; - - if (((TInt)info.iLength) buf; - TUint driveNumber = Drive().DriveNumber() ; - while (len) - { - TInt s=Min(len,buf.MaxLength()); - - if (aMessage.Handle() == KLocalMessageHandle) - buf.Copy( ((TPtr8* )aDes)->MidTPtr(n, s) ); - else - aMessage.ReadL(0,buf,n); - - TSVPHostFsFileWriteInfo info(driveNumber, iHandle,s,pos+n,(char*)buf.Ptr()); - - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::WriteL pos %d s %d p 0x%08x"), pos+n, s, buf.Ptr()); - - User::LeaveIfError(SVP_HOST_FS_DEVICE().FileWrite(info)); - - DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::WriteL wrote %d bytes"), info.iLength); - - if (((TInt)info.iLength) -#include - -_LIT(KEStartPanicCatagory, "SVP_HOSTFS_SYSSTART"); - -enum TEStartPanic - { - ELitNoDM = 1, // No Domain Manager - ELitDMInitFail, // Domain Manager init fail - ELitHALFail, // HAL init fail - ELitConnectFsFail1, // Connect fs 1 fail - ELitInitLocalPwStoreFail, // Init PwStore fail - ELitLocaleInitialisationFail, // Initialisation of locale properties failed - ELitFSInitDriveInfoFail, // FS Init DriveInfo fail - ELitCreateTrapHandlerFail, // Create trap handler fail - ELitLoadSysLddsFail, // Load sys ldds fail - ELitLocalDriveMappingFail, // Local drive mapping fail - ELitDriveMappingFileFail, // Drive mapping file not found - ELitSwapMappingFailArrayInconsistent, // Swap mappings fail - array inconsistent - ELitFsSwapMappingFail, // Swap mappings fail - Fs request failed - EPropertyError, // RProperty return error - ECompMountFsFail, // Failed comp fs mount - EFsNameFail, // File system name on Z: failed - ELitNoWS, // No WSERV - EStartupModeFail, // Get startup mode failed - ESysAgentFail, // Fail to launch system agent - ESetSystemDriveFail // Fail to set System Drive - }; - -inline void Panic(TEStartPanic aPanic, TInt aReason) - { - TBuf<10> panic(KEStartPanicCatagory); - panic.AppendFormat(_L("_%d"), aPanic); - User::Panic(panic, aReason); - } - -_LIT(KServerPathSysBin, "0:\\Sys\\Bin\\"); -_LIT(KWindowServerRootName1,"EWSRV.EXE"); -_LIT(KHostFSMounter, "z:\\sys\\bin\\SVPHOSTFS.EXE"); - -TBool CreateServer(const TDriveList& aDrives, const TDesC& aRootName) - { - RProcess ws; - TInt r=ws.Create(aRootName, KNullDesC); - if (r!=KErrNone) - { - TFileName name; - name = KServerPathSysBin(); - name+=aRootName; - TInt i=EDriveZ; - FOREVER - { - i= (i==0) ? EDriveZ : i-1; - if (aDrives[i]!=KDriveAbsent) // Got a valid drive - { - name[0]=(TUint32)('A'+i); // Set the drive letter - r=ws.Create(name,KNullDesC); - if (r==KErrNone) - break; - } - if (i==EDriveZ) - return EFalse; - } - } - ws.Resume(); - ws.Close(); - return ETrue; - } - -GLDEF_C TInt E32Main() - { - RProcess ws; - TInt r=ws.Create(KHostFSMounter, KNullDesC); - if (r == KErrNone) - { - TRequestStatus stat; - ws.Rendezvous(stat); - ws.Resume(); - User::WaitForRequest(stat); // wait for start or death - ws.Close(); - } - // Start the window server - RFs aFs; - r = aFs.Connect(); - - if (r != KErrNone) - Panic(ELitConnectFsFail1, r); - TDriveList list; - aFs.DriveList(list); - aFs.Close(); - - if (!CreateServer(list,KWindowServerRootName1)) - Panic(ELitNoWS,KErrNotFound); - - return(KErrNone); - } diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostfsy.cpp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostfsy.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - -#include "svphostfsy.h" - -////////////////////////////////////////////////////////////////////////// -// CSVPHostFileSystem // -////////////////////////////////////////////////////////////////////////// - -CSVPHostFileSystem::CSVPHostFileSystem() -// -// Constructor -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::CSVPHostFileSystem()")); - __DECLARE_NAME(_S("CSVPHostFileSystem")); - } - -CSVPHostFileSystem::~CSVPHostFileSystem() -// -// Destructor -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::~CSVPHostFileSystem")); - iDevice.Close(); - } - - - -TInt CSVPHostFileSystem::Install() -// -// Install the file system. -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::Install()")); - - // Open the device - RSVPHostFsDriver device; - TInt err = device.Open(); - - if (KErrNone != err) - return err; - - iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KF32BuildVersionNumber); - TPtrC name=_L("SVPHOSTFSY"); - - return(SetName(&name)); - } - -CMountCB* CSVPHostFileSystem::NewMountL(/*CSessionFs* aSession*/) const -// -// Create a new mount control block. -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewMountL()")); - return(new(ELeave) CSVPHostMountCB); - } - -CFileCB* CSVPHostFileSystem::NewFileL(/*CSessionFs* aSession*/) const -// -// Create a new file. -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewFileL()")); - return(new(ELeave) CSVPHostFileCB); - } - -CDirCB* CSVPHostFileSystem::NewDirL(/*CSessionFs* aSession*/) const -// -// Create a new directory lister. -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewDirL()")); - return(new(ELeave) CSVPHostDirCB(/*aSession*/)); - } - -CFormatCB* CSVPHostFileSystem::NewFormatL(/*CSessionFs* aSession*/) const -// -// Create a new media formatter. -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewFormatL()")); - return(new(ELeave) CSVPHostFormatCB(/*aSession*/)); - } - -TInt CSVPHostFileSystem::DefaultPath(TDes& aPath) const -// -// Return the initial default path. -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::DefaultPath()")); - aPath=_L("\\"); - return(KErrNone); - } - - -CFileSystem* CSVPHostFileSystem::NewL() -// -// Factory for CSVPHostFileSystem -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewL()")); - CSVPHostFileSystem* svpHostFsy=new(ELeave) CSVPHostFileSystem(); - return svpHostFsy; - } - - -void CSVPHostFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const -// -// Return the drive info iDriveAtt && iBatteryState already set -// - { - DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::DriveInfo()")); - - /* !@! TODO: are these the best values? */ - anInfo.iMediaAtt=KMediaAttVariableSize; - anInfo.iType=EMediaRam; -#if 0 - // !@! can't execute from remote drives - anInfo.iDriveAtt=KDriveAttRemote; -#endif - anInfo.iDriveAtt=KDriveAttLocal|KDriveAttInternal; - } - - -extern "C" { - -EXPORT_C CFileSystem* CreateFileSystem() -// -// Create a new file system -// - { - DP(_L("** (SVPHOSTFSY) CreateFileSystem()")); - - return(CSVPHostFileSystem::NewL()); - } -} - - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostfsy.h --- a/baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostfsy.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Based on the test code under f32test\fsstress -* -*/ - -#if !defined(__SVPHOSTFSY_H__) -#define __SVPHOSTFSY_H__ - -#include -#include -#include -#include -#include -#include - -#include - -// -// Common constants used by both EFSRV and the filesystems -// - -const TUint KEntryAttIllegal=(KEntryAttVolume|KEntryAttDir); -const TUint KEntryAttModified=0x20000000; -const TUint KEntryAttMustBeFile=0x80000000; -const TInt KCurrentPosition=KMinTInt; - - -GLDEF_D const TInt KMaxParses=7; -GLDEF_D const TInt KHeapSize=0x2000; -GLREF_C void TurnAllocFailureOff(); -GLREF_C void TurnAllocFailureOn(); -GLREF_C void ReportCheckDiskFailure(TInt aRet); -GLREF_D RTest test; -GLREF_D TFileName gSessionPath; -GLREF_D TInt gAllocFailOff; -GLREF_D TInt gAllocFailOn; - -#if defined(_DEBUG) -#define SetAllocFailure(a) SetAllocFailure(a) -#else -#define SetAllocFailure(a) IsRomAddress(NULL) -#define KAllocFailureOn 0 -#define KAllocFailureOff 0 -#endif - -// Debug virtual host file service - uncomment define below -//#define SVPDBG -#ifdef SVPDBG -IMPORT_C TUint32 DebugRegister(); -#define DP(format...) { if (DebugRegister()&KFSYS) RDebug::Print(format);} -#else -#define DP(format...) -#endif - -#define SVP_HOST_FS_DEVICE() (((CSVPHostMountCB&)Mount()).Device()) -#define SVP_HOST_FS_DEVICE_ID 0xc51d0008 - -enum TPanic - { - EFileTimeToSystemTime, - EFileClose, - EFileCloseSetAttributes, - EDirClose, - EMapCouldNotConnect - }; - -// utility to convert file system times to TTime format -void fileTimeToTime(TUint32 t,TTime& aTime, TFileTimeType aType); - -// utility to produce a canonicalized pathname (i.e. with a drive letter) suitable to pass to the FS device. - -void CanonicalizePathname(const TDesC& aName, TInt aDrive, THostFileName& aHostName); - -class CSessionFs; - -class CSVPHostMountCB : public CMountCB - { -public: - CSVPHostMountCB(); - ~CSVPHostMountCB(); - void MountL(TBool aForceMount); - TInt ReMount(); - void Dismounted(); - void VolumeL(TVolumeInfo& aVolume) const; - void SetVolumeL(TDes& aName); - void MkDirL(const TDesC& aName); - void RmDirL(const TDesC& aName); - void DeleteL(const TDesC& aName); - void RenameL(const TDesC& anOldName,const TDesC& anNewName); - void ReplaceL(const TDesC& anOldName,const TDesC& anNewName); - void EntryL(const TDesC& aName,TEntry& anEntry) const; - void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); - void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile); - void DirOpenL(const TDesC& aName,CDirCB* aDir); - void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const; - void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage); - void ReadUidL(const TDesC& aName,TEntry& anEntry) const; - void GetShortNameL(const TDesC& aLongName,TDes& aShortName); - void GetLongNameL(const TDesC& aShortName,TDes& aLongName); - void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); - void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); - - inline const CSVPHostMountCB& Mount() const { return *this; } - inline RSVPHostFsDriver& Device() { return iDevice; } - - -private: - TBool IsRomDrive() const; - RSVPHostFsDriver iDevice; - }; - - -class RConsole; -class CSVPHostFileCB : public CFileCB - { -public: - CSVPHostFileCB(); - ~CSVPHostFileCB(); - void RenameL(const TDesC& aNewName); - void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage); - void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage); - TInt Address(TInt& aPos) const; - void SetSizeL(TInt aSize); - void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); - void FlushDataL(); - void FlushAllL(); - void CheckPos(TInt aPos); - void SetHandle(TUint aHandle) { iHandle = aHandle; } - TUint Handle() const { return iHandle; } -private: - TBool IsRomDrive() const; -private: - TInt iCurrentPos; - // TUint8* iFilePtr; - TUint iHandle; - }; - -class CSVPHostDirCB : public CDirCB - { -public: - CSVPHostDirCB(/*CSessionFs* aSession*/); - ~CSVPHostDirCB(); - void ReadL(TEntry& anEntry); - inline void SetFullName(const TDesC& aName) {iFullName.Set(aName,NULL,NULL);} - inline void SetHandle(TUint32 aHandle) { iHandle = aHandle; } - -private: - TBool MatchUid(); -public: - TEntry iEntry; -private: - TUint32 iHandle; - TParse iFullName; - }; - -class CSVPHostFormatCB : public CFormatCB - { -public: - CSVPHostFormatCB(/*CSessionFs* aSession*/); - ~CSVPHostFormatCB(); -public: - virtual void DoFormatStepL(); - }; - -class CSVPHostFileSystem : public CFileSystem - { -public: - CSVPHostFileSystem(); - ~CSVPHostFileSystem(); - TInt Install(); - TInt DefaultPath(TDes& aPath) const; - void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; -private: - CMountCB* NewMountL() const; - CFileCB* NewFileL() const; - CDirCB* NewDirL() const; - CFormatCB* NewFormatL() const; -public: - static CFileSystem* NewL(); - -public: - inline RSVPHostFsDriver& Device() { return iDevice; }; -private: - RSVPHostFsDriver iDevice; - TUint32 iDriveMap[DRIVE_MAP_SIZE]; - }; - -#endif - - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostmain.cpp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostmain.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - -#include "svphostfsy.h" - -#ifdef DP -#undef DP -#define DP(f...) -#endif - -_LIT(KSVPHOSTFSY, "SVPHOSTFSY"); - -#if 1 -GLDEF_C TInt E32Main() - { - CTrapCleanup* cleanup; - cleanup=CTrapCleanup::New(); - - RSVPHostFsDriver driver; - - TInt r = driver.Open(); - - if (r != KErrNone) - { - delete cleanup; - return(r); - } - - TUint32 driveMap[DRIVE_MAP_SIZE]; - - r = driver.GetDriveMap(driveMap); - - driver.Close(); - - if (r != KErrNone) - { - delete cleanup; - return(r); - } - - RFs aFs; - r=aFs.Connect(); - - if (r != KErrNone) goto fail; - - r=aFs.AddFileSystem(KSVPHOSTFSY); - - if (r != KErrNone) goto close; - - for (TInt i = 0; i < DRIVE_MAP_SIZE ; i++ ) - { - if (driveMap[i]) - { - char driveLetter = LOWEST_DRIVE + i; - TInt driveNumber = driveLetter - 'A'; - DP(_L(" Drive %c to be mounted\n"), driveLetter); - r = aFs.MountFileSystem(KSVPHOSTFSY,driveNumber); - DP(_L("aFs.MountFileSystem(KSVPHOSTFSY, %c) -> %d"), driveNumber, r); - if (r != KErrNone) goto close; - } - } - -close: - aFs.Close(); - -fail: - delete cleanup; - return(r); - } - -#else - -GLDEF_C TInt E32Main() - { - CTrapCleanup* cleanup; - cleanup=CTrapCleanup::New(); - - RSVPHostFsDriver driver; - - TInt r = driver.Open(); - - if (r != KErrNone){ - delete cleanup; - return(r); - } - - RFs aFs; - r=aFs.Connect(); - - r=aFs.AddFileSystem(KSVPHOSTFSY); - DP(_L("r=aFs.AddFileSystem(KSVPHOSTFSY) -> %d\n"), r); - - // !@! - // Until we have 'platform' device driver that we can use hardcode single virtual host drive as 'S' - // !@! - char driveLetter = 'S'; - TInt driveNumber = driveLetter - 'A'; - DP(_L(" Drive %c to be mounted\n"), driveLetter); - r = aFs.MountFileSystem(KSVPHOSTFSY,driveNumber); - DP(_L("aFs.MountFileSystem(KSVPHOSTFSY, %d) -> %d"), driveNumber, r); - - aFs.Close(); - - delete cleanup; - return(KErrNone); - } - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostmnt.cpp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/fs/svphostmnt.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,335 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - -#include "svphostfsy.h" - -#define HOST_SVP_DRIVE_SIZE 1024*1024*1024 -#define HOST_SVP_DRIVE_FREE_SIZE 10*1024*1024 - -LOCAL_C TInt GetMediaSize(TInt /*aDriveNumber*/,TInt64& aSize,TInt64& aFree) -// -// Return the size and free space on a drive. -// - { - DP(_L("** (SVPHOSTMNT) GetMediaSize")); - - aSize = HOST_SVP_DRIVE_SIZE; - aFree = HOST_SVP_DRIVE_FREE_SIZE; - return(KErrNone); - } - -LOCAL_C TInt GetVolume(TInt /*aDriveNumber*/,TDes& aName,TUint& aUniqueID) -// -// Return the volume name and uniqueID. -// - { - DP(_L("** (SVPHOSTMNT) GetVolume")); - - aUniqueID=1234; - aName=(_L("SVPHOSTDRV")); - return(KErrNone); - } - -void CanonicalizePathname(const TDesC& aName, TInt aDrive, TDes& n, THostFileName& aHostName) - { - DP(_L("** (SVPHOSTMNT) CanonicalizePathname (%S)"), &aName); - n += TDriveUnit(aDrive).Name(); - n += aName; - TParse parse; - parse.Set(n,NULL,NULL); - n=parse.FullName(); - aHostName.Copy(n); - DP(_L("-> (%S)"), &aHostName); - } - -void CanonicalizePathname(const TDesC& aName, TInt aDrive, THostFileName& aHostName) - { - TUint16 buf[KMaxPath]; - TPtr n(buf, KMaxPath); - CanonicalizePathname(aName, aDrive, n, aHostName); - } - - - -////////////////////////////////////////////////////////////////////////// -// CSVPHostMountCB // -////////////////////////////////////////////////////////////////////////// - - -CSVPHostMountCB::CSVPHostMountCB() - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::CSVPHostMountCB()")); - - __DECLARE_NAME(_S("CSVPHostMountCB")); - } - -CSVPHostMountCB::~CSVPHostMountCB() - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::~CSVPHostMountCB()")); - iDevice.Close(); - } - -void CSVPHostMountCB::MountL(TBool /*aForceMount*/) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::MountL()")); - - TInt err = iDevice.Open(); - User::LeaveIfError(err); - - TFileName driveName; - TInt d=Drive().DriveNumber(); - iSize=HOST_SVP_DRIVE_SIZE; - User::LeaveIfError(GetVolume(d,driveName,iUniqueID)); - HBufC* pN=driveName.AllocL(); - DP(_L("** (SVPHOSTMNT) ->SetVolumeName()")); - SetVolumeName(pN); - DP(_L("** (SVPHOSTMNT) <-SetVolumeName()")); - - } - -TInt CSVPHostMountCB::ReMount() - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::ReMount()")); - - TFileName n; - TInt d=Drive().DriveNumber(); - TUint uniqueID; - TInt r=GetVolume(d,n,uniqueID); - if (r!=KErrNone) - return(r); - if (n==VolumeName() && uniqueID==iUniqueID) - return(KErrNone); - return(KErrGeneral); - } - -void CSVPHostMountCB::Dismounted() - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::Dismounted()")); - } - -void CSVPHostMountCB::VolumeL(TVolumeInfo& aVolume) const - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::VolumeL()")); - TInt64 s,f(0); - TFileName n; - TInt d=Drive().DriveNumber(); - User::LeaveIfError(GetMediaSize(d,s,f)); - aVolume.iFree=f; - } - -void CSVPHostMountCB::SetVolumeL(TDes& /*aName*/) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::SetVolumeL()")); - User::Leave(KErrNotSupported); - } - -void CSVPHostMountCB::IsFileInRom(const TDesC& /*aName*/,TUint8*& /*aFileStart*/) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::IsFileInRom()")); - } - -void CSVPHostMountCB::MkDirL(const TDesC& aName) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::MkDirL()")); - TBuf name; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(aName, driveNumber, name); - TSVPHostFsMkDirInfo info(driveNumber, name, 0777); - User::LeaveIfError(SVP_HOST_FS_DEVICE().MkDir(info)); - } - -void CSVPHostMountCB::RmDirL(const TDesC& aName) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RmDirL()")); - TBuf name; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(aName, driveNumber, name); - TSVPHostFsRmDirInfo info(driveNumber, name); - User::LeaveIfError(SVP_HOST_FS_DEVICE().RmDir(info)); - } - -void CSVPHostMountCB::DeleteL(const TDesC& aName) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::DeleteL()")); - TBuf name; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(aName, driveNumber, name); - TSVPHostFsDeleteInfo info(driveNumber, name); - User::LeaveIfError(SVP_HOST_FS_DEVICE().Delete(info)); - } - -void CSVPHostMountCB::RenameL(const TDesC& anOldName,const TDesC& aNewName) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RenameL()")); - // TODO: do we allow renaming across drives? - TBuf oldName, newName; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(anOldName, driveNumber, oldName); - CanonicalizePathname(aNewName, driveNumber, newName); - TSVPHostFsRenameInfo info(driveNumber, oldName, newName); - User::LeaveIfError(SVP_HOST_FS_DEVICE().Rename(info)); - } - -void CSVPHostMountCB::ReplaceL(const TDesC& anOldName,const TDesC& aNewName) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::ReplaceL()")); - - if(FileNamesIdentical(anOldName,aNewName)) - { - return; - } - TBuf oldName, newName; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(anOldName, driveNumber, oldName); - CanonicalizePathname(aNewName, driveNumber, newName); - TSVPHostFsReplaceInfo info(driveNumber, oldName, newName); - User::LeaveIfError(SVP_HOST_FS_DEVICE().Replace(info)); - } - -void CSVPHostMountCB::ReadUidL(const TDesC& aName,TEntry& anEntry) const - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::ReadUidL()")); - TBuf name; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(aName, driveNumber, name); - TSVPHostFsFileOpenInfo fileOpenInfo(driveNumber, name,EFileRead,EFileOpen); - TInt err = SVP_HOST_FS_DEVICE().FileOpen(fileOpenInfo); - - User::LeaveIfError(err); - - TBuf8 uidBuf; - uidBuf.SetLength(sizeof(TCheckedUid)); - - TSVPHostFsFileReadInfo fileReadInfo(driveNumber, fileOpenInfo.iHandle,sizeof(TCheckedUid),0,(char*)uidBuf.Ptr()); - - if (KErrNone != SVP_HOST_FS_DEVICE().FileRead(fileReadInfo)) - User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle)); - - DP(_L("** (SVPHOSTMNT) CSVPHostFileCB::ReadUidL sizeof(TCheckedUid) %d fileOpenInfo.iLength %d "), sizeof(TCheckedUid), fileReadInfo.iLength); - - if (fileReadInfo.iLength!=sizeof(TCheckedUid)) - User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle)); - - TCheckedUid uid(uidBuf); - anEntry.iType=uid.UidType(); - - User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle)); - } - -void CSVPHostMountCB::EntryL(const TDesC& aName,TEntry& anEntry) const - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::EntryL(%S)"), &aName); - TBuf name; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(aName, driveNumber, name); - TSVPHostFsEntryInfo info(driveNumber, name); - User::LeaveIfError(SVP_HOST_FS_DEVICE().Entry(info)); - anEntry.iAtt=info.iAtt&KEntryAttMaskSupported; - anEntry.iSize=info.iSize; - fileTimeToTime(info.iModified,anEntry.iModified, info.iTimeType); - - } - -void timeToFileTime(TUint32& t,const TTime& aTime, TFileTimeType aType); - -void CSVPHostMountCB::SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::SetEntryL()")); - - //User::Leave(KErrNotSupported); - } - -void CSVPHostMountCB::FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::FileOpenL(%S)"), &aName); - CSVPHostFileCB& file=(*((CSVPHostFileCB*)aFile)); - - TBuf name; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(aName, driveNumber, name); - TSVPHostFsFileOpenInfo info(driveNumber, name,aMode,anOpen); - TInt err = SVP_HOST_FS_DEVICE().FileOpen(info); - - User::LeaveIfError(err); - - file.SetHandle(info.iHandle); - file.SetSize(info.iSize); - file.SetAtt(info.iAtt&KEntryAttMaskSupported); - TTime tempTime=file.Modified(); - fileTimeToTime(info.iModified, tempTime, info.iTimeType); - file.SetModified(tempTime); - } - -void CSVPHostMountCB::DirOpenL(const TDesC& aName ,CDirCB* aDir) - { - DP(_L("CFatMountCB::DirOpenL, drv:%d, %S"), DriveNumber(), &aName); - CSVPHostDirCB& dir=(*((CSVPHostDirCB*)aDir)); - - TBuf name; - TUint driveNumber = Drive().DriveNumber(); - CanonicalizePathname(aName, driveNumber, name); - TSVPHostFsDirOpenInfo info(driveNumber, name); - TInt err = SVP_HOST_FS_DEVICE().DirOpen(info); - - User::LeaveIfError(err); - - dir.SetHandle(info.iHandle); - TFileName n(TDriveUnit(Drive().DriveNumber()).Name()); - n.Append(aName); - dir.SetFullName(n); - } - -void CSVPHostMountCB::RawReadL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aTrg*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) const - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RawReadL()")); - User::Leave(KErrNotSupported); - } - -void CSVPHostMountCB::RawWriteL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aSrc*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RawWriteL()")); - User::Leave(KErrNotSupported); - } - -void CSVPHostMountCB::GetShortNameL(const TDesC& aLongName,TDes& aShortName) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::GetShortNameL(%S)"), &aLongName); - aShortName = aLongName; - } - -void CSVPHostMountCB::GetLongNameL(const TDesC& aShortName,TDes& aLongName) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::GetLongNameL(%S)"), &aShortName); - aLongName = aShortName; - } - -void CSVPHostMountCB::ReadSectionL(const TDesC& /*aName*/,TInt /*aPos*/,TAny* /*aTrg*/,TInt /*aLength*/,const RMessagePtr2& /*aMessage*/) - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RawSectionL()")); - User::Leave(KErrNotSupported); - } - -TBool CSVPHostMountCB::IsRomDrive() const - { - DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::IsRomDrive()")); - return(EFalse); - } diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/inc/rsvphostfsdriver.h --- a/baseport/src/cedar/generic/base/syborg/svphostfs/inc/rsvphostfsdriver.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,468 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __RSVPHOSTFSDRIVER_H__ -#define __RSVPHOSTFSDRIVER_H__ - -#include - -typedef TDes16 THostFileName; - -typedef enum - { - EUnknown=0, - EWindows, - EUnix, - EMac, - } TFileTimeType; - -class TSVPHostFsMkDirInfo - { -public: - inline TSVPHostFsMkDirInfo() : - iDrive(0), - iName(0), - iLength(0), - iFlags(0) - {}; - inline TSVPHostFsMkDirInfo(TUint aDrive, const THostFileName & aName, TUint32 aFlags) : - iDrive(aDrive), - iName(aName.Ptr()), - iLength(aName.Length()), - iFlags(aFlags) - {}; -public: - TUint iDrive; - const TUint16 * iName; - TUint32 iLength; - TUint32 iFlags; - }; - -class TSVPHostFsRmDirInfo - { -public: - inline TSVPHostFsRmDirInfo() : - iDrive(0), - iName(0), - iLength(0) - {}; - inline TSVPHostFsRmDirInfo(TUint aDrive, const THostFileName & aName) : - iDrive(aDrive), - iName(aName.Ptr()), - iLength(aName.Length()) - {}; -public: - TUint iDrive; - const TUint16 * iName; - TUint32 iLength; - }; - -class TSVPHostFsDeleteInfo - { -public: - inline TSVPHostFsDeleteInfo() : - iDrive(0), - iName(0), - iLength(0) - {}; - inline TSVPHostFsDeleteInfo(TUint aDrive, const THostFileName & aName) : - iDrive(aDrive), - iName(aName.Ptr()), - iLength(aName.Length()) - {}; -public: - TUint iDrive; - const TUint16 * iName; - TUint32 iLength; - }; - -class TSVPHostFsRenameInfo - { -public: - inline TSVPHostFsRenameInfo() : - iDrive(0), - iOldName(0), - iOldLength(0), - iNewName(0), - iNewLength(0) - {}; - inline TSVPHostFsRenameInfo(TUint aDrive, const THostFileName & aOldName, const THostFileName & aNewName) : - iDrive(aDrive), - iOldName(aOldName.Ptr()), - iOldLength(aOldName.Length()), - iNewName(aNewName.Ptr()), - iNewLength(aNewName.Length()) - {}; -public: - TUint iDrive; - const TUint16 * iOldName; - TUint32 iOldLength; - const TUint16 * iNewName; - TUint32 iNewLength; - }; - -class TSVPHostFsReplaceInfo - { -public: - inline TSVPHostFsReplaceInfo() : - iDrive(0), - iOldName(0), - iOldLength(0), - iNewName(0), - iNewLength(0) - {}; - inline TSVPHostFsReplaceInfo(TUint aDrive, const THostFileName & aOldName, const THostFileName & aNewName) : - iDrive(aDrive), - iOldName(aOldName.Ptr()), - iOldLength(aOldName.Length()), - iNewName(aNewName.Ptr()), - iNewLength(aNewName.Length()) - {}; -public: - TUint iDrive; - const TUint16 * iOldName; - TUint32 iOldLength; - const TUint16 * iNewName; - TUint32 iNewLength; - }; - -class TSVPHostFsEntryInfo - { -public: - inline TSVPHostFsEntryInfo() : - iDrive(0), - iName(0), - iLength(0), - iAtt(0), - iModified(0), - iSize(0), - iTimeType(EUnknown) - {}; - inline TSVPHostFsEntryInfo(TUint aDrive, const THostFileName & aName) : - iDrive(aDrive), - iName(aName.Ptr()), - iLength(aName.Length()), - iAtt(0), - iModified(0), - iSize(0), - iTimeType(EUnknown) - {}; -public: - TUint iDrive; - const TUint16 * iName; - TUint32 iLength; - TUint iAtt; - TUint32 iModified; // time in seconds since the epoc - TInt iSize; - TFileTimeType iTimeType; - char iHostName[KMaxFileName]; -}; - -class TSVPHostFsSetEntryInfo - { -public: - inline TSVPHostFsSetEntryInfo() : - iDrive(0), - iName(0), - iModified(0), - iNewAtt(0), - iTimeType(EUnknown) - {}; - inline TSVPHostFsSetEntryInfo(TUint aDrive, const THostFileName & aName, TUint32 aModified, TUint aNewAtt) : - iDrive(aDrive), - iName(aName.Ptr()), - iModified(aModified), - iNewAtt(aNewAtt), - iTimeType(EUnknown) - {}; -public: - TUint iDrive; - const TUint16 *iName; - TUint32 iModified; // time in seconds since the epoc - TUint iNewAtt; - TFileTimeType iTimeType; - }; - -class TSVPHostFsDirOpenInfo - { -public: - inline TSVPHostFsDirOpenInfo() : - iDrive(0), - iName(0), - iLength(0), - iHandle(0) - {}; -inline TSVPHostFsDirOpenInfo(TUint aDrive, const THostFileName & aName) : - iDrive(aDrive), - iName(aName.Ptr()), - iLength(aName.Length()), - iHandle(0) - {}; -public: - TUint iDrive; - const TUint16 * iName; - TUint32 iLength; - TUint32 iHandle; - }; - -#define SVP_HOST_FS_INVALID_FILE_HANDLE -1 -class TSVPHostFsFileOpenInfo - { -public: - inline TSVPHostFsFileOpenInfo() : - iDrive(0), - iName(0), - iLength(0), // of file name - iMode(0), - iOpen(0), - iAtt(0), - iModified(0), // time in seconds since the epoc - iSize(0), // of file - iTimeType(EUnknown), - iHandle(SVP_HOST_FS_INVALID_FILE_HANDLE) - {}; - inline TSVPHostFsFileOpenInfo(TUint aDrive, const THostFileName & aName, TUint32 aMode, TUint32 anOpen) : - iDrive(aDrive), - iName(aName.Ptr()), - iLength(aName.Length()), - iMode(aMode), - iOpen(anOpen), - iAtt(0), - iModified(0), // time in seconds since the epoc - iSize(0), // of file - iTimeType(EUnknown), - iHandle(SVP_HOST_FS_INVALID_FILE_HANDLE) - {}; -public: - TUint iDrive; - const TUint16 * iName; - TUint32 iLength; - TUint32 iMode; - TUint32 iOpen; - TUint iAtt; - TUint32 iModified; // time in seconds since the epoc - TInt iSize; - TFileTimeType iTimeType; - TInt iHandle; - }; - -class TSVPHostFsFileReadInfo - { -public: - inline TSVPHostFsFileReadInfo() : - iDrive(0), - iHandle(0), - iLength(0), - iPos(0), - iBuf(0) - {}; - inline TSVPHostFsFileReadInfo(TUint aDrive, TUint aHandle,TInt aLength,TInt aPos, char * aBuf): - iDrive(aDrive), - iHandle(aHandle), - iLength(aLength), - iPos(aPos), - iBuf(aBuf) - {}; -public: - TUint iDrive; - TUint iHandle; - TInt iLength; - TInt iPos; - char * iBuf; - }; - -class TSVPHostFsFileWriteInfo - { -public: - inline TSVPHostFsFileWriteInfo() : - iDrive(0), - iHandle(0), - iLength(0), - iPos(0), - iBuf(0) - {}; - inline TSVPHostFsFileWriteInfo(TUint aDrive, TUint aHandle,TInt aLength,TInt aPos, char * aBuf): - iDrive(aDrive), - iHandle(aHandle), - iLength(aLength), - iPos(aPos), - iBuf(aBuf) - {}; -public: - TUint iDrive; - TUint iHandle; - TInt iLength; - TInt iPos; - char * iBuf; - }; - -class TSVPHostFsFileSetSizeInfo - { -public: - inline TSVPHostFsFileSetSizeInfo() : - iDrive(0), - iHandle(0), - iLength(0) - {}; - inline TSVPHostFsFileSetSizeInfo(TUint aDrive, TUint aHandle, TInt aLength) : - iDrive(aDrive), - iHandle(aHandle), - iLength(aLength) - {}; -public: - TUint iDrive; - TUint iHandle; - TInt iLength; - }; - -class TSVPHostFsDirReadInfo -{ -public: - inline TSVPHostFsDirReadInfo() : - iDrive(0), - iHandle(0), - iLength(0), - iAtt(0), - iModified(0), - iSize(0), - iTimeType(EUnknown) - {}; - inline TSVPHostFsDirReadInfo(TUint aDrive, TUint32 aHandle) : - iDrive(aDrive), - iHandle(aHandle), - iLength(-1), - iAtt(0), - iModified(666), - iSize(-1), - iTimeType(EUnknown) - {}; -public: - TUint iDrive; - TUint32 iHandle; - TInt iLength; - TUint16 iName[KMaxPath]; - TUint iAtt; - TUint32 iModified; // time in seconds since the epoc - TInt iSize; - TFileTimeType iTimeType; - }; - -class TCapsSVPHostFsDriver - { -public: - TVersion iVersion; - }; - -_LIT(KSVPHostFsDriverName,"SVP Host Filesystem Driver"); -_LIT(KSVPHostFsDriverLDD, "svphostfsdriver.ldd"); - -// Version information -const TInt KMajorVersionNumber=0; -const TInt KMinorVersionNumber=0; -const TInt KBuildVersionNumber=1; - -// keep in sync with the definitions in QEMU/hw/svphostfs.c -#define LOWEST_DRIVE 'A' -#define HIGHEST_DRIVE 'Z' -#define DRIVE_MAP_SIZE (HIGHEST_DRIVE - LOWEST_DRIVE + 1) - -class RSVPHostFsDriver : public RBusLogicalChannel - { -public: - - enum TControl - { - EDummu = 0, - - // Codes for CMountCB operations - EMkDir, - ERmDir, - EDelete, - ERename, - EReplace, - EReadUid, - EEntry, - ESetEntry, - EFileOpen, - EDirOpen, - - // Code for CFileCB operations - EFileClose, - EFileRead, - EFileWrite, - EFileSetSize, - EFileFlushAll, - - // Code for CDirCB operations - EDirClose, - EDirRead, - - // Device ops - EGetDeviceID, - EGetDriveMap, - - }; - - -public: -#ifndef __KERNEL_MODE__ // don't need to see these in the driver - TInt Open(); - TInt MkDir(TSVPHostFsMkDirInfo& aInfo); - TInt RmDir(TSVPHostFsRmDirInfo& aInfo); - TInt Delete(TSVPHostFsDeleteInfo& aInfo); - TInt Rename(TSVPHostFsRenameInfo& aInfo); - TInt Replace(TSVPHostFsReplaceInfo& aInfo); - TInt ReadUid(const TDesC& aName,TEntry& anEntry); - TInt Entry(TSVPHostFsEntryInfo& aInfo); - TInt SetEntry(TSVPHostFsSetEntryInfo &aInfo); - TInt FileOpen(TSVPHostFsFileOpenInfo &aInfo); - TInt DirOpen(TSVPHostFsDirOpenInfo& aInfo); - TInt FileClose(TUint32 aDrive, TUint32 aHandle); - TInt FileRead(TSVPHostFsFileReadInfo& aInfo); - TInt FileWrite(TSVPHostFsFileWriteInfo& aInfo); - TInt FileSetSize(TSVPHostFsFileSetSizeInfo &aInfo); - TInt FileSetEntry(TSVPHostFsSetEntryInfo &aInfo); - TInt FlushData(TUint32 aDrive); - TInt FlushAll(TUint32 aDrive); - - TInt DirClose(TUint32 aDrive, TUint32 aHandle); - TInt DirRead(TSVPHostFsDirReadInfo& aInfo); - - TUint32 GetDeviceID(TUint32 aDrive); - - TInt GetDriveMap(TUint32 * aMap); - -private: - inline TInt DoSVPRequest(TInt aReqNo, TAny * a1) - { - TRequestStatus status; - DoRequest(aReqNo, status, a1); - User::WaitForRequest(status); - return status.Int(); - } - - inline TInt DoSVPRequest(TInt aReqNo, TAny * a1, TAny * a2) - { - TRequestStatus status; - DoRequest(aReqNo, status, a1, a2); - User::WaitForRequest(status); - return status.Int(); - } -#endif - }; - -#endif // __rsvphostfsdriver_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/svphostfs.mmp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/svphostfs.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -TARGET svphostfs.exe -TARGETTYPE EXE -SOURCEPATH fs -SOURCE svphostmain.cpp rsvphostfsdriver.cpp -LIBRARY euser.lib efsrv.lib efile.lib hal.lib -SYSTEMINCLUDE inc -SYSTEMINCLUDE /epoc32/include - -CAPABILITY DISKADMIN ALLFILES -VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/svphostfsdriver.mmp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/svphostfsdriver.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -//macro __KERNEL_MODE__ - -#include -#include - -systeminclude AsspNKernIncludePath -systeminclude inc -systeminclude ..\svpplatform\libfdt -systeminclude \epoc32\include\stdapis - -target VariantTarget(svphostfsdriver,ldd) -linkas svphostfsdriver.ldd -targettype ldd - - -sourcepath driver -source svphostfsdriver.cpp stringops.c - -option armcc --gnu - -staticlibrary libfdt.lib -noexportlibrary - -vendorid 0x70000001 -capability all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/svphostfsstart.mmp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/svphostfsstart.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -TARGET svphostfsstart.exe -TARGETTYPE EXE -SOURCEPATH fs -SOURCE svphostfsstart.cpp -LIBRARY euser.lib efsrv.lib efile.lib hal.lib -SYSTEMINCLUDE inc -SYSTEMINCLUDE /epoc32/include - -CAPABILITY DISKADMIN ALLFILES -VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svphostfs/svphostfsy.mmp --- a/baseport/src/cedar/generic/base/syborg/svphostfs/svphostfsy.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -TARGET svphostfsy.fsy -TARGETTYPE fsy - -SOURCEPATH fs -SOURCE svphostfsy.cpp svphostmnt.cpp svphostfil.cpp svphostdir.cpp rsvphostfsdriver.cpp -NOSTRICTDEF - -SYSTEMINCLUDE inc -SYSTEMINCLUDE /epoc32/include - -LIBRARY efsrv.lib euser.lib hal.lib -LIBRARY efile.lib - -UID 0x100039df 0x10000CEE -VENDORID 0x70000001 - -unpaged - -TARGETPATH /sys/bin - -//CAPABILITY TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD -#include "../../f32/group/f32caps.mmh" // Capabilities of File Server process -#include "../../f32/group/f32.mmh" // Generic definitions for the whole f32 component diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/fdt.mmp --- a/baseport/src/cedar/generic/base/syborg/svpplatform/fdt.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -target libfdt.lib -targettype klib - -systeminclude libfdt -systeminclude \epoc32\include\stdapis - -sourcepath libfdt - -source fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c - -option armcc --gnu -option_replace armcc --diag_suppress 161,611,654,997,1152,1300,1464,1488,6318,6331,1254,1293,68 -capability all - -VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/Makefile.libfdt --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/Makefile.libfdt Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -# Makefile.libfdt -# -# This is not a complete Makefile of itself. Instead, it is designed to -# be easily embeddable into other systems of Makefiles. -# -LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c -LIBFDT_INCLUDES = fdt.h libfdt.h -LIBFDT_EXTRA = libfdt_internal.h -LIBFDT_LIB = libfdt/libfdt.a - -LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) - -$(LIBFDT_objdir)/$(LIBFDT_LIB): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS)) - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/TODO --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/TODO Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -- Tree traversal functions -- Graft function -- Complete libfdt.h documenting comments diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/bswap.h --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/bswap.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -#ifndef BSWAP_H -#define BSWAP_H - -#include "config-host.h" - -#include - -#ifdef HAVE_MACHINE_BSWAP_H -#include -#include -#include -#else - -#ifdef HAVE_BYTESWAP_H -#include -#else - -#define bswap_16(x) \ -({ \ - uint16_t __x = (x); \ - ((uint16_t)( \ - (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \ - (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \ -}) - -#define bswap_32(x) \ -({ \ - uint32_t __x = (x); \ - ((uint32_t)( \ - (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ - (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ - (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ - (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ -}) - -#define bswap_64(x) \ -({ \ - uint64_t __x = (x); \ - ((uint64_t)( \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ - (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ -}) - -#endif /* !HAVE_BYTESWAP_H */ - -static inline uint16_t bswap16(uint16_t x) -{ - return bswap_16(x); -} - -static inline uint32_t bswap32(uint32_t x) -{ - return bswap_32(x); -} - -static inline uint64_t bswap64(uint64_t x) -{ - return bswap_64(x); -} - -#endif /* ! HAVE_MACHINE_BSWAP_H */ - -static inline void bswap16s(uint16_t *s) -{ - *s = bswap16(*s); -} - -static inline void bswap32s(uint32_t *s) -{ - *s = bswap32(*s); -} - -static inline void bswap64s(uint64_t *s) -{ - *s = bswap64(*s); -} - -#if defined(WORDS_BIGENDIAN) -#define be_bswap(v, size) (v) -#define le_bswap(v, size) bswap ## size(v) -#define be_bswaps(v, size) -#define le_bswaps(p, size) *p = bswap ## size(*p); -#else -#define le_bswap(v, size) (v) -#define be_bswap(v, size) bswap ## size(v) -#define le_bswaps(v, size) -#define be_bswaps(p, size) *p = bswap ## size(*p); -#endif - -#define CPU_CONVERT(endian, size, type)\ -static inline type endian ## size ## _to_cpu(type v)\ -{\ - return endian ## _bswap(v, size);\ -}\ -\ -static inline type cpu_to_ ## endian ## size(type v)\ -{\ - return endian ## _bswap(v, size);\ -}\ -\ -static inline void endian ## size ## _to_cpus(type *p)\ -{\ - endian ## _bswaps(p, size)\ -}\ -\ -static inline void cpu_to_ ## endian ## size ## s(type *p)\ -{\ - endian ## _bswaps(p, size)\ -}\ -\ -static inline type endian ## size ## _to_cpup(const type *p)\ -{\ - return endian ## size ## _to_cpu(*p);\ -}\ -\ -static inline void cpu_to_ ## endian ## size ## w(type *p, type v)\ -{\ - *p = cpu_to_ ## endian ## size(v);\ -} - -CPU_CONVERT(be, 16, uint16_t) -CPU_CONVERT(be, 32, uint32_t) -CPU_CONVERT(be, 64, uint64_t) - -CPU_CONVERT(le, 16, uint16_t) -CPU_CONVERT(le, 32, uint32_t) -CPU_CONVERT(le, 64, uint64_t) - -/* unaligned versions (optimized for frequent unaligned accesses)*/ - -#if defined(__i386__) || defined(__powerpc__) - -#define cpu_to_le16wu(p, v) cpu_to_le16w(p, v) -#define cpu_to_le32wu(p, v) cpu_to_le32w(p, v) -#define le16_to_cpupu(p) le16_to_cpup(p) -#define le32_to_cpupu(p) le32_to_cpup(p) -#define be32_to_cpupu(p) be32_to_cpup(p) - -#define cpu_to_be16wu(p, v) cpu_to_be16w(p, v) -#define cpu_to_be32wu(p, v) cpu_to_be32w(p, v) - -#else - -static inline void cpu_to_le16wu(uint16_t *p, uint16_t v) -{ - uint8_t *p1 = (uint8_t *)p; - - p1[0] = v; - p1[1] = v >> 8; -} - -static inline void cpu_to_le32wu(uint32_t *p, uint32_t v) -{ - uint8_t *p1 = (uint8_t *)p; - - p1[0] = v; - p1[1] = v >> 8; - p1[2] = v >> 16; - p1[3] = v >> 24; -} - -static inline uint16_t le16_to_cpupu(const uint16_t *p) -{ - const uint8_t *p1 = (const uint8_t *)p; - return p1[0] | (p1[1] << 8); -} - -static inline uint32_t le32_to_cpupu(const uint32_t *p) -{ - const uint8_t *p1 = (const uint8_t *)p; - return p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24); -} - -static inline uint32_t be32_to_cpupu(const uint32_t *p) -{ - const uint8_t *p1 = (const uint8_t *)p; - return p1[3] | (p1[2] << 8) | (p1[1] << 16) | (p1[0] << 24); -} - -static inline void cpu_to_be16wu(uint16_t *p, uint16_t v) -{ - uint8_t *p1 = (uint8_t *)p; - - p1[0] = v >> 8; - p1[1] = v; -} - -static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) -{ - uint8_t *p1 = (uint8_t *)p; - - p1[0] = v >> 24; - p1[1] = v >> 16; - p1[2] = v >> 8; - p1[3] = v; -} - -#endif - -#ifdef WORDS_BIGENDIAN -#define cpu_to_32wu cpu_to_be32wu -#else -#define cpu_to_32wu cpu_to_le32wu -#endif - -#undef le_bswap -#undef be_bswap -#undef le_bswaps -#undef be_bswaps - -#endif /* BSWAP_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/config-host.h --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/config-host.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#ifndef CONFIG_HOST_H -#define CONFIG_HOST_H - -// dont have machine level bswap -//#define HAVE_MACHINE_BSWAP_H - -// dont have byteswap -//#define HAVE_BYTESWAP_H - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt.c --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt.c Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "libfdt_env.h" - -#include -#include - -#include "libfdt_internal.h" - -int fdt_check_header(const void *fdt) -{ - if (fdt_magic(fdt) == FDT_MAGIC) { - /* Complete tree */ - if (fdt_version(fdt) < FDT_FIRST_SUPPORTED_VERSION) - return -FDT_ERR_BADVERSION; - if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION) - return -FDT_ERR_BADVERSION; - } else if (fdt_magic(fdt) == SW_MAGIC) { - /* Unfinished sequential-write blob */ - if (fdt_size_dt_struct(fdt) == 0) - return -FDT_ERR_BADSTATE; - } else { - return -FDT_ERR_BADMAGIC; - } - - return 0; -} - -const void *fdt_offset_ptr(const void *fdt, int offset, int len) -{ - const void *p; - - if (fdt_version(fdt) >= 0x11) - if (((offset + len) < offset) - || ((offset + len) > fdt_size_dt_struct(fdt))) - return NULL; - - p = _fdt_offset_ptr(fdt, offset); - - if (p + len < p) - return NULL; - return p; -} - -uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset) -{ - const uint32_t *tagp, *lenp; - uint32_t tag; - const char *p; - - if (offset % FDT_TAGSIZE) - return -1; - - tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE); - if (! tagp) - return FDT_END; /* premature end */ - tag = fdt32_to_cpu(*tagp); - offset += FDT_TAGSIZE; - - switch (tag) { - case FDT_BEGIN_NODE: - /* skip name */ - do { - p = fdt_offset_ptr(fdt, offset++, 1); - } while (p && (*p != '\0')); - if (! p) - return FDT_END; - break; - case FDT_PROP: - lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp)); - if (! lenp) - return FDT_END; - /* skip name offset, length and value */ - offset += 2*FDT_TAGSIZE + fdt32_to_cpu(*lenp); - break; - } - - if (nextoffset) - *nextoffset = ALIGN(offset, FDT_TAGSIZE); - - return tag; -} - -const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) -{ - int len = strlen(s) + 1; - const char *last = strtab + tabsize - len; - const char *p; - - for (p = strtab; p <= last; p++) - if (memeq(p, s, len)) - return p; - return NULL; -} - -int fdt_move(const void *fdt, void *buf, int bufsize) -{ - int err = fdt_check_header(fdt); - - if (err) - return err; - - if (fdt_totalsize(fdt) > bufsize) - return -FDT_ERR_NOSPACE; - - memmove(buf, fdt, fdt_totalsize(fdt)); - return 0; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt.cpp --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - -extern "C" { - -#include "fdt.c" - -}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt.h --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -#ifndef _FDT_H -#define _FDT_H - -#ifndef __ASSEMBLY__ - -struct fdt_header { - uint32_t magic; /* magic word FDT_MAGIC */ - uint32_t totalsize; /* total size of DT block */ - uint32_t off_dt_struct; /* offset to structure */ - uint32_t off_dt_strings; /* offset to strings */ - uint32_t off_mem_rsvmap; /* offset to memory reserve map */ - uint32_t version; /* format version */ - uint32_t last_comp_version; /* last compatible version */ - - /* version 2 fields below */ - uint32_t boot_cpuid_phys; /* Which physical CPU id we're - booting on */ - /* version 3 fields below */ - uint32_t size_dt_strings; /* size of the strings block */ - - /* version 17 fields below */ - uint32_t size_dt_struct; /* size of the structure block */ -}; - -struct fdt_reserve_entry { - uint64_t address; - uint64_t size; -}; - -struct fdt_node_header { - uint32_t tag; - char name[0]; -}; - -struct fdt_property { - uint32_t tag; - uint32_t len; - uint32_t nameoff; - char data[0]; -}; - -#endif /* !__ASSEMBLY */ - -#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ -#define FDT_TAGSIZE sizeof(uint32_t) - -#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ -#define FDT_END_NODE 0x2 /* End node */ -#define FDT_PROP 0x3 /* Property: name off, - size, content */ -#define FDT_NOP 0x4 /* nop */ -#define FDT_END 0x9 - -#define FDT_V1_SIZE (7*sizeof(uint32_t)) -#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t)) -#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t)) -#define FDT_V16_SIZE FDT_V3_SIZE -#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t)) - -#endif /* _FDT_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_ro.c --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_ro.c Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,583 +0,0 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "libfdt_env.h" - -#include -#include - -#include "libfdt_internal.h" - -#define CHECK_HEADER(fdt) \ - { \ - int err; \ - if ((err = fdt_check_header(fdt)) != 0) \ - return err; \ - } - -static int nodename_eq(const void *fdt, int offset, - const char *s, int len) -{ - const char *p = fdt_offset_ptr(fdt, offset, len+1); - - if (! p) - /* short match */ - return 0; - - if (memcmp(p, s, len) != 0) - return 0; - - if (p[len] == '\0') - return 1; - else if (!memchr(s, '@', len) && (p[len] == '@')) - return 1; - else - return 0; -} - -const char *fdt_string(const void *fdt, int stroffset) -{ - return (char *)fdt + fdt_off_dt_strings(fdt) + stroffset; -} - -int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) -{ - CHECK_HEADER(fdt); - *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address); - *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size); - return 0; -} - -int fdt_num_mem_rsv(const void *fdt) -{ - int i = 0; - - while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0) - i++; - return i; -} - -int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, - const char *name, int namelen) -{ - int level = 0; - uint32_t tag; - int offset, nextoffset; - - CHECK_HEADER(fdt); - - tag = fdt_next_tag(fdt, parentoffset, &nextoffset); - if (tag != FDT_BEGIN_NODE) - return -FDT_ERR_BADOFFSET; - - do { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset); - - switch (tag) { - case FDT_END: - return -FDT_ERR_TRUNCATED; - - case FDT_BEGIN_NODE: - level++; - if (level != 1) - continue; - if (nodename_eq(fdt, offset+FDT_TAGSIZE, name, namelen)) - /* Found it! */ - return offset; - break; - - case FDT_END_NODE: - level--; - break; - - case FDT_PROP: - case FDT_NOP: - break; - - default: - return -FDT_ERR_BADSTRUCTURE; - } - } while (level >= 0); - - return -FDT_ERR_NOTFOUND; -} - -int fdt_subnode_offset(const void *fdt, int parentoffset, - const char *name) -{ - return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name)); -} - -int fdt_path_offset(const void *fdt, const char *path) -{ - const char *end = path + strlen(path); - const char *p = path; - int offset = 0; - - CHECK_HEADER(fdt); - - if (*path != '/') - return -FDT_ERR_BADPATH; - - while (*p) { - const char *q; - - while (*p == '/') - p++; - if (! *p) - return offset; - q = strchr(p, '/'); - if (! q) - q = end; - - offset = fdt_subnode_offset_namelen(fdt, offset, p, q-p); - if (offset < 0) - return offset; - - p = q; - } - - return offset; -} - -const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) -{ - const struct fdt_node_header *nh; - int err; - - if ((err = fdt_check_header(fdt)) != 0) - goto fail; - - err = -FDT_ERR_BADOFFSET; - nh = fdt_offset_ptr(fdt, nodeoffset, sizeof(*nh)); - if (!nh || (fdt32_to_cpu(nh->tag) != FDT_BEGIN_NODE)) - goto fail; - - if (len) - *len = strlen(nh->name); - - return nh->name; - - fail: - if (len) - *len = err; - return NULL; -} - -const struct fdt_property *fdt_get_property(const void *fdt, - int nodeoffset, - const char *name, int *lenp) -{ - uint32_t tag; - const struct fdt_property *prop; - int namestroff; - int offset, nextoffset; - int err; - - if ((err = fdt_check_header(fdt)) != 0) - goto fail; - - err = -FDT_ERR_BADOFFSET; - if (nodeoffset % FDT_TAGSIZE) - goto fail; - - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); - if (tag != FDT_BEGIN_NODE) - goto fail; - - do { - offset = nextoffset; - - tag = fdt_next_tag(fdt, offset, &nextoffset); - switch (tag) { - case FDT_END: - err = -FDT_ERR_TRUNCATED; - goto fail; - - case FDT_BEGIN_NODE: - case FDT_END_NODE: - case FDT_NOP: - break; - - case FDT_PROP: - err = -FDT_ERR_BADSTRUCTURE; - prop = fdt_offset_ptr(fdt, offset, sizeof(*prop)); - if (! prop) - goto fail; - namestroff = fdt32_to_cpu(prop->nameoff); - if (streq(fdt_string(fdt, namestroff), name)) { - /* Found it! */ - int len = fdt32_to_cpu(prop->len); - prop = fdt_offset_ptr(fdt, offset, - sizeof(*prop)+len); - if (! prop) - goto fail; - - if (lenp) - *lenp = len; - - return prop; - } - break; - - default: - err = -FDT_ERR_BADSTRUCTURE; - goto fail; - } - } while ((tag != FDT_BEGIN_NODE) && (tag != FDT_END_NODE)); - - err = -FDT_ERR_NOTFOUND; - fail: - if (lenp) - *lenp = err; - return NULL; -} - -const void *fdt_getprop(const void *fdt, int nodeoffset, - const char *name, int *lenp) -{ - const struct fdt_property *prop; - - prop = fdt_get_property(fdt, nodeoffset, name, lenp); - if (! prop) - return NULL; - - return prop->data; -} - -uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) -{ - const uint32_t *php; - int len; - - php = fdt_getprop(fdt, nodeoffset, "linux,phandle", &len); - if (!php || (len != sizeof(*php))) - return 0; - - return fdt32_to_cpu(*php); -} - -int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) -{ - uint32_t tag; - int p = 0, overflow = 0; - int offset, nextoffset, namelen; - const char *name; - - CHECK_HEADER(fdt); - - tag = fdt_next_tag(fdt, 0, &nextoffset); - if (tag != FDT_BEGIN_NODE) - return -FDT_ERR_BADSTRUCTURE; - - if (buflen < 2) - return -FDT_ERR_NOSPACE; - buf[0] = '/'; - p = 1; - - while (nextoffset <= nodeoffset) { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset); - switch (tag) { - case FDT_END: - return -FDT_ERR_BADOFFSET; - - case FDT_BEGIN_NODE: - name = fdt_get_name(fdt, offset, &namelen); - if (!name) - return namelen; - if (overflow || ((p + namelen + 1) > buflen)) { - overflow++; - break; - } - memcpy(buf + p, name, namelen); - p += namelen; - buf[p++] = '/'; - break; - - case FDT_END_NODE: - if (overflow) { - overflow--; - break; - } - do { - p--; - } while (buf[p-1] != '/'); - break; - - case FDT_PROP: - case FDT_NOP: - break; - - default: - return -FDT_ERR_BADSTRUCTURE; - } - } - - if (overflow) - return -FDT_ERR_NOSPACE; - - if (p > 1) /* special case so that root path is "/", not "" */ - p--; - buf[p] = '\0'; - return p; -} - -int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, - int supernodedepth, int *nodedepth) -{ - int level = -1; - uint32_t tag; - int offset, nextoffset = 0; - int supernodeoffset = -FDT_ERR_INTERNAL; - - CHECK_HEADER(fdt); - - if (supernodedepth < 0) - return -FDT_ERR_NOTFOUND; - - do { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset); - switch (tag) { - case FDT_END: - return -FDT_ERR_BADOFFSET; - - case FDT_BEGIN_NODE: - level++; - if (level == supernodedepth) - supernodeoffset = offset; - break; - - case FDT_END_NODE: - level--; - break; - - case FDT_PROP: - case FDT_NOP: - break; - - default: - return -FDT_ERR_BADSTRUCTURE; - } - } while (offset < nodeoffset); - - if (nodedepth) - *nodedepth = level; - - if (supernodedepth > level) - return -FDT_ERR_NOTFOUND; - return supernodeoffset; -} - -int fdt_node_depth(const void *fdt, int nodeoffset) -{ - int nodedepth; - int err; - - err = fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, &nodedepth); - if (err) - return (err < 0) ? err : -FDT_ERR_INTERNAL; - return nodedepth; -} - -int fdt_parent_offset(const void *fdt, int nodeoffset) -{ - int nodedepth = fdt_node_depth(fdt, nodeoffset); - - if (nodedepth < 0) - return nodedepth; - return fdt_supernode_atdepth_offset(fdt, nodeoffset, - nodedepth - 1, NULL); -} - -int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, - const char *propname, - const void *propval, int proplen) -{ - uint32_t tag; - int offset, nextoffset; - const void *val; - int len; - - CHECK_HEADER(fdt); - - if (startoffset >= 0) { - tag = fdt_next_tag(fdt, startoffset, &nextoffset); - if (tag != FDT_BEGIN_NODE) - return -FDT_ERR_BADOFFSET; - } else { - nextoffset = 0; - } - - /* FIXME: The algorithm here is pretty horrible: we scan each - * property of a node in fdt_getprop(), then if that didn't - * find what we want, we scan over them again making our way - * to the next node. Still it's the easiest to implement - * approach; performance can come later. */ - do { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset); - - switch (tag) { - case FDT_BEGIN_NODE: - val = fdt_getprop(fdt, offset, propname, &len); - if (val - && (len == proplen) - && (memcmp(val, propval, len) == 0)) - return offset; - break; - - case FDT_PROP: - case FDT_END: - case FDT_END_NODE: - case FDT_NOP: - break; - - default: - return -FDT_ERR_BADSTRUCTURE; - } - } while (tag != FDT_END); - - return -FDT_ERR_NOTFOUND; -} - -int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) -{ - if ((phandle == 0) || (phandle == -1)) - return -FDT_ERR_BADPHANDLE; - phandle = cpu_to_fdt32(phandle); - return fdt_node_offset_by_prop_value(fdt, -1, "linux,phandle", - &phandle, sizeof(phandle)); -} - -int _stringlist_contains(const void *strlist, int listlen, const char *str) -{ - int len = strlen(str); - const void *p; - - while (listlen >= len) { - if (memcmp(str, strlist, len+1) == 0) - return 1; - p = memchr(strlist, '\0', listlen); - if (!p) - return 0; /* malformed strlist.. */ - listlen -= (p-strlist) + 1; - strlist = p + 1; - } - return 0; -} - -int fdt_node_check_compatible(const void *fdt, int nodeoffset, - const char *compatible) -{ - const void *prop; - int len; - - prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); - if (!prop) - return len; - if (_stringlist_contains(prop, len, compatible)) - return 0; - else - return 1; -} - -int fdt_node_offset_by_compatible(const void *fdt, int startoffset, - const char *compatible) -{ - uint32_t tag; - int offset, nextoffset; - int err; - - CHECK_HEADER(fdt); - - if (startoffset >= 0) { - tag = fdt_next_tag(fdt, startoffset, &nextoffset); - if (tag != FDT_BEGIN_NODE) - return -FDT_ERR_BADOFFSET; - } else { - nextoffset = 0; - } - - /* FIXME: The algorithm here is pretty horrible: we scan each - * property of a node in fdt_node_check_compatible(), then if - * that didn't find what we want, we scan over them again - * making our way to the next node. Still it's the easiest to - * implement approach; performance can come later. */ - do { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset); - - switch (tag) { - case FDT_BEGIN_NODE: - err = fdt_node_check_compatible(fdt, offset, - compatible); - if ((err < 0) - && (err != -FDT_ERR_NOTFOUND)) - return err; - else if (err == 0) - return offset; - break; - - case FDT_PROP: - case FDT_END: - case FDT_END_NODE: - case FDT_NOP: - break; - - default: - return -FDT_ERR_BADSTRUCTURE; - } - } while (tag != FDT_END); - - return -FDT_ERR_NOTFOUND; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_ro.cpp --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_ro.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -extern "C" { - -#include "fdt_ro.c" - -}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_rw.c --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_rw.c Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,471 +0,0 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "libfdt_env.h" - -#include -#include - -#include "libfdt_internal.h" - -static int _blocks_misordered(const void *fdt, - int mem_rsv_size, int struct_size) -{ - return (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8)) - || (fdt_off_dt_struct(fdt) < - (fdt_off_mem_rsvmap(fdt) + mem_rsv_size)) - || (fdt_off_dt_strings(fdt) < - (fdt_off_dt_struct(fdt) + struct_size)) - || (fdt_totalsize(fdt) < - (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt))); -} - -static int rw_check_header(void *fdt) -{ - int err; - - if ((err = fdt_check_header(fdt))) - return err; - if (fdt_version(fdt) < 17) - return -FDT_ERR_BADVERSION; - if (_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry), - fdt_size_dt_struct(fdt))) - return -FDT_ERR_BADLAYOUT; - if (fdt_version(fdt) > 17) - fdt_set_version(fdt, 17); - - return 0; -} - -#define RW_CHECK_HEADER(fdt) \ - { \ - int err; \ - if ((err = rw_check_header(fdt)) != 0) \ - return err; \ - } - -static inline int _blob_data_size(void *fdt) -{ - return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); -} - -static int _blob_splice(void *fdt, void *p, int oldlen, int newlen) -{ - void *end = fdt + _blob_data_size(fdt); - - if (((p + oldlen) < p) || ((p + oldlen) > end)) - return -FDT_ERR_BADOFFSET; - if ((end - oldlen + newlen) > (fdt + fdt_totalsize(fdt))) - return -FDT_ERR_NOSPACE; - memmove(p + newlen, p + oldlen, end - p - oldlen); - return 0; -} - -static int _blob_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p, - int oldn, int newn) -{ - int delta = (newn - oldn) * sizeof(*p); - int err; - err = _blob_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p)); - if (err) - return err; - fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta); - fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta); - return 0; -} - -static int _blob_splice_struct(void *fdt, void *p, - int oldlen, int newlen) -{ - int delta = newlen - oldlen; - int err; - - if ((err = _blob_splice(fdt, p, oldlen, newlen))) - return err; - - fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta); - fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta); - return 0; -} - -static int _blob_splice_string(void *fdt, int newlen) -{ - void *p = fdt + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); - int err; - - if ((err = _blob_splice(fdt, p, 0, newlen))) - return err; - - fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen); - return 0; -} - -static int _find_add_string(void *fdt, const char *s) -{ - char *strtab = (char *)fdt + fdt_off_dt_strings(fdt); - const char *p; - char *new; - int len = strlen(s) + 1; - int err; - - p = _fdt_find_string(strtab, fdt_size_dt_strings(fdt), s); - if (p) - /* found it */ - return (p - strtab); - - new = strtab + fdt_size_dt_strings(fdt); - err = _blob_splice_string(fdt, len); - if (err) - return err; - - memcpy(new, s, len); - return (new - strtab); -} - -int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size) -{ - struct fdt_reserve_entry *re; - int err; - - if ((err = rw_check_header(fdt))) - return err; - - re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt)); - err = _blob_splice_mem_rsv(fdt, re, 0, 1); - if (err) - return err; - - re->address = cpu_to_fdt64(address); - re->size = cpu_to_fdt64(size); - return 0; -} - -int fdt_del_mem_rsv(void *fdt, int n) -{ - struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n); - int err; - - if ((err = rw_check_header(fdt))) - return err; - if (n >= fdt_num_mem_rsv(fdt)) - return -FDT_ERR_NOTFOUND; - - err = _blob_splice_mem_rsv(fdt, re, 1, 0); - if (err) - return err; - return 0; -} - -static int _resize_property(void *fdt, int nodeoffset, const char *name, int len, - struct fdt_property **prop) -{ - int oldlen; - int err; - - *prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen); - if (! (*prop)) - return oldlen; - - if ((err = _blob_splice_struct(fdt, (*prop)->data, - ALIGN(oldlen, FDT_TAGSIZE), - ALIGN(len, FDT_TAGSIZE)))) - return err; - - (*prop)->len = cpu_to_fdt32(len); - return 0; -} - -static int _add_property(void *fdt, int nodeoffset, const char *name, int len, - struct fdt_property **prop) -{ - uint32_t tag; - int proplen; - int nextoffset; - int namestroff; - int err; - - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); - if (tag != FDT_BEGIN_NODE) - return -FDT_ERR_BADOFFSET; - - namestroff = _find_add_string(fdt, name); - if (namestroff < 0) - return namestroff; - - *prop = _fdt_offset_ptr_w(fdt, nextoffset); - proplen = sizeof(**prop) + ALIGN(len, FDT_TAGSIZE); - - err = _blob_splice_struct(fdt, *prop, 0, proplen); - if (err) - return err; - - (*prop)->tag = cpu_to_fdt32(FDT_PROP); - (*prop)->nameoff = cpu_to_fdt32(namestroff); - (*prop)->len = cpu_to_fdt32(len); - return 0; -} - -int fdt_set_name(void *fdt, int nodeoffset, const char *name) -{ - char *namep; - int oldlen, newlen; - int err; - - if ((err = rw_check_header(fdt))) - return err; - - namep = (char *)fdt_get_name(fdt, nodeoffset, &oldlen); - if (!namep) - return oldlen; - - newlen = strlen(name); - - err = _blob_splice_struct(fdt, namep, ALIGN(oldlen+1, FDT_TAGSIZE), - ALIGN(newlen+1, FDT_TAGSIZE)); - if (err) - return err; - - memcpy(namep, name, newlen+1); - return 0; -} - -int fdt_setprop(void *fdt, int nodeoffset, const char *name, - const void *val, int len) -{ - struct fdt_property *prop; - int err; - - if ((err = rw_check_header(fdt))) - return err; - - err = _resize_property(fdt, nodeoffset, name, len, &prop); - if (err == -FDT_ERR_NOTFOUND) - err = _add_property(fdt, nodeoffset, name, len, &prop); - if (err) - return err; - - memcpy(prop->data, val, len); - return 0; -} - -int fdt_delprop(void *fdt, int nodeoffset, const char *name) -{ - struct fdt_property *prop; - int len, proplen; - - RW_CHECK_HEADER(fdt); - - prop = fdt_get_property_w(fdt, nodeoffset, name, &len); - if (! prop) - return len; - - proplen = sizeof(*prop) + ALIGN(len, FDT_TAGSIZE); - return _blob_splice_struct(fdt, prop, proplen, 0); -} - -int fdt_add_subnode_namelen(void *fdt, int parentoffset, - const char *name, int namelen) -{ - struct fdt_node_header *nh; - int offset, nextoffset; - int nodelen; - int err; - uint32_t tag; - uint32_t *endtag; - - RW_CHECK_HEADER(fdt); - - offset = fdt_subnode_offset_namelen(fdt, parentoffset, name, namelen); - if (offset >= 0) - return -FDT_ERR_EXISTS; - else if (offset != -FDT_ERR_NOTFOUND) - return offset; - - /* Try to place the new node after the parent's properties */ - fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */ - do { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset); - } while (tag == FDT_PROP); - - nh = _fdt_offset_ptr_w(fdt, offset); - nodelen = sizeof(*nh) + ALIGN(namelen+1, FDT_TAGSIZE) + FDT_TAGSIZE; - - err = _blob_splice_struct(fdt, nh, 0, nodelen); - if (err) - return err; - - nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); - memset(nh->name, 0, ALIGN(namelen+1, FDT_TAGSIZE)); - memcpy(nh->name, name, namelen); - endtag = (uint32_t *)((void *)nh + nodelen - FDT_TAGSIZE); - *endtag = cpu_to_fdt32(FDT_END_NODE); - - return offset; -} - -int fdt_add_subnode(void *fdt, int parentoffset, const char *name) -{ - return fdt_add_subnode_namelen(fdt, parentoffset, name, strlen(name)); -} - -int fdt_del_node(void *fdt, int nodeoffset) -{ - int endoffset; - - RW_CHECK_HEADER(fdt); - - endoffset = _fdt_node_end_offset(fdt, nodeoffset); - if (endoffset < 0) - return endoffset; - - return _blob_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset), - endoffset - nodeoffset, 0); -} - -static void _packblocks(const void *fdt, void *buf, - int mem_rsv_size, int struct_size) -{ - int mem_rsv_off, struct_off, strings_off; - - mem_rsv_off = ALIGN(sizeof(struct fdt_header), 8); - struct_off = mem_rsv_off + mem_rsv_size; - strings_off = struct_off + struct_size; - - memmove(buf + mem_rsv_off, fdt + fdt_off_mem_rsvmap(fdt), mem_rsv_size); - fdt_set_off_mem_rsvmap(buf, mem_rsv_off); - - memmove(buf + struct_off, fdt + fdt_off_dt_struct(fdt), struct_size); - fdt_set_off_dt_struct(buf, struct_off); - fdt_set_size_dt_struct(buf, struct_size); - - memmove(buf + strings_off, fdt + fdt_off_dt_strings(fdt), - fdt_size_dt_strings(fdt)); - fdt_set_off_dt_strings(buf, strings_off); - fdt_set_size_dt_strings(buf, fdt_size_dt_strings(fdt)); -} - -int fdt_open_into(const void *fdt, void *buf, int bufsize) -{ - int err; - int mem_rsv_size, struct_size; - int newsize; - void *tmp; - - err = fdt_check_header(fdt); - if (err) - return err; - - mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) - * sizeof(struct fdt_reserve_entry); - - if (fdt_version(fdt) >= 17) { - struct_size = fdt_size_dt_struct(fdt); - } else { - struct_size = 0; - while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END) - ; - } - - if (!_blocks_misordered(fdt, mem_rsv_size, struct_size)) { - /* no further work necessary */ - err = fdt_move(fdt, buf, bufsize); - if (err) - return err; - fdt_set_version(buf, 17); - fdt_set_size_dt_struct(buf, struct_size); - fdt_set_totalsize(buf, bufsize); - return 0; - } - - /* Need to reorder */ - newsize = ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size - + struct_size + fdt_size_dt_strings(fdt); - - if (bufsize < newsize) - return -FDT_ERR_NOSPACE; - - if (((buf + newsize) <= fdt) - || (buf >= (fdt + fdt_totalsize(fdt)))) { - tmp = buf; - } else { - tmp = (void *)fdt + fdt_totalsize(fdt); - if ((tmp + newsize) > (buf + bufsize)) - return -FDT_ERR_NOSPACE; - } - - _packblocks(fdt, tmp, mem_rsv_size, struct_size); - memmove(buf, tmp, newsize); - - fdt_set_magic(buf, FDT_MAGIC); - fdt_set_totalsize(buf, bufsize); - fdt_set_version(buf, 17); - fdt_set_last_comp_version(buf, 16); - fdt_set_boot_cpuid_phys(buf, fdt_boot_cpuid_phys(fdt)); - - return 0; -} - -int fdt_pack(void *fdt) -{ - int mem_rsv_size; - int err; - - err = rw_check_header(fdt); - if (err) - return err; - - mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) - * sizeof(struct fdt_reserve_entry); - _packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt)); - fdt_set_totalsize(fdt, _blob_data_size(fdt)); - - return 0; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_rw.cpp --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_rw.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -extern "C" { - -#include "fdt_rw.c" - -}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_strerror.c --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_strerror.c Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "libfdt_env.h" - -#include -#include - -#include "libfdt_internal.h" - -struct errtabent { - const char *str; -}; - -#define ERRTABENT(val) \ - [(val)] = { .str = #val, } - -static struct errtabent errtable[] = { - ERRTABENT(FDT_ERR_NOTFOUND), - ERRTABENT(FDT_ERR_EXISTS), - ERRTABENT(FDT_ERR_NOSPACE), - - ERRTABENT(FDT_ERR_BADOFFSET), - ERRTABENT(FDT_ERR_BADPATH), - ERRTABENT(FDT_ERR_BADSTATE), - - ERRTABENT(FDT_ERR_TRUNCATED), - ERRTABENT(FDT_ERR_BADMAGIC), - ERRTABENT(FDT_ERR_BADVERSION), - ERRTABENT(FDT_ERR_BADSTRUCTURE), - ERRTABENT(FDT_ERR_BADLAYOUT), -}; -#define ERRTABSIZE (sizeof(errtable) / sizeof(errtable[0])) - -const char *fdt_strerror(int errval) -{ - if (errval > 0) - return ""; - else if (errval == 0) - return ""; - else if (errval > -ERRTABSIZE) { - const char *s = errtable[-errval].str; - - if (s) - return s; - } - - return ""; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_strerror.cpp --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_strerror.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -extern "C" { - -#include "fdt_strerror.c" - -}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_sw.c --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_sw.c Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +0,0 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "libfdt_env.h" - -#include -#include - -#include "libfdt_internal.h" - -static int check_header_sw(void *fdt) -{ - if (fdt_magic(fdt) != SW_MAGIC) - return -FDT_ERR_BADMAGIC; - return 0; -} - -static void *grab_space(void *fdt, int len) -{ - int offset = fdt_size_dt_struct(fdt); - int spaceleft; - - spaceleft = fdt_totalsize(fdt) - fdt_off_dt_struct(fdt) - - fdt_size_dt_strings(fdt); - - if ((offset + len < offset) || (offset + len > spaceleft)) - return NULL; - - fdt_set_size_dt_struct(fdt, offset + len); - return fdt_offset_ptr_w(fdt, offset, len); -} - -int fdt_create(void *buf, int bufsize) -{ - void *fdt = buf; - - if (bufsize < sizeof(struct fdt_header)) - return -FDT_ERR_NOSPACE; - - memset(buf, 0, bufsize); - - fdt_set_magic(fdt, SW_MAGIC); - fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION); - fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION); - fdt_set_totalsize(fdt, bufsize); - - fdt_set_off_mem_rsvmap(fdt, ALIGN(sizeof(struct fdt_header), - sizeof(struct fdt_reserve_entry))); - fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt)); - fdt_set_off_dt_strings(fdt, bufsize); - - return 0; -} - -int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) -{ - struct fdt_reserve_entry *re; - int err = check_header_sw(fdt); - int offset; - - if (err) - return err; - if (fdt_size_dt_struct(fdt)) - return -FDT_ERR_BADSTATE; - - offset = fdt_off_dt_struct(fdt); - if ((offset + sizeof(*re)) > fdt_totalsize(fdt)) - return -FDT_ERR_NOSPACE; - - re = (struct fdt_reserve_entry *)(fdt + offset); - re->address = cpu_to_fdt64(addr); - re->size = cpu_to_fdt64(size); - - fdt_set_off_dt_struct(fdt, offset + sizeof(*re)); - - return 0; -} - -int fdt_finish_reservemap(void *fdt) -{ - return fdt_add_reservemap_entry(fdt, 0, 0); -} - -int fdt_begin_node(void *fdt, const char *name) -{ - struct fdt_node_header *nh; - int err = check_header_sw(fdt); - int namelen = strlen(name) + 1; - - if (err) - return err; - - nh = grab_space(fdt, sizeof(*nh) + ALIGN(namelen, FDT_TAGSIZE)); - if (! nh) - return -FDT_ERR_NOSPACE; - - nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); - memcpy(nh->name, name, namelen); - return 0; -} - -int fdt_end_node(void *fdt) -{ - uint32_t *en; - int err = check_header_sw(fdt); - - if (err) - return err; - - en = grab_space(fdt, FDT_TAGSIZE); - if (! en) - return -FDT_ERR_NOSPACE; - - *en = cpu_to_fdt32(FDT_END_NODE); - return 0; -} - -static int find_add_string(void *fdt, const char *s) -{ - char *strtab = (char *)fdt + fdt_totalsize(fdt); - const char *p; - int strtabsize = fdt_size_dt_strings(fdt); - int len = strlen(s) + 1; - int struct_top, offset; - - p = _fdt_find_string(strtab - strtabsize, strtabsize, s); - if (p) - return p - strtab; - - /* Add it */ - offset = -strtabsize - len; - struct_top = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt); - if (fdt_totalsize(fdt) + offset < struct_top) - return 0; /* no more room :( */ - - memcpy(strtab + offset, s, len); - fdt_set_size_dt_strings(fdt, strtabsize + len); - return offset; -} - -int fdt_property(void *fdt, const char *name, const void *val, int len) -{ - struct fdt_property *prop; - int err = check_header_sw(fdt); - int nameoff; - - if (err) - return err; - - nameoff = find_add_string(fdt, name); - if (nameoff == 0) - return -FDT_ERR_NOSPACE; - - prop = grab_space(fdt, sizeof(*prop) + ALIGN(len, FDT_TAGSIZE)); - if (! prop) - return -FDT_ERR_NOSPACE; - - prop->tag = cpu_to_fdt32(FDT_PROP); - prop->nameoff = cpu_to_fdt32(nameoff); - prop->len = cpu_to_fdt32(len); - memcpy(prop->data, val, len); - return 0; -} - -int fdt_finish(void *fdt) -{ - int err = check_header_sw(fdt); - char *p = (char *)fdt; - uint32_t *end; - int oldstroffset, newstroffset; - uint32_t tag; - int offset, nextoffset; - - if (err) - return err; - - /* Add terminator */ - end = grab_space(fdt, sizeof(*end)); - if (! end) - return -FDT_ERR_NOSPACE; - *end = cpu_to_fdt32(FDT_END); - - /* Relocate the string table */ - oldstroffset = fdt_totalsize(fdt) - fdt_size_dt_strings(fdt); - newstroffset = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt); - memmove(p + newstroffset, p + oldstroffset, fdt_size_dt_strings(fdt)); - fdt_set_off_dt_strings(fdt, newstroffset); - - /* Walk the structure, correcting string offsets */ - offset = 0; - while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) { - if (tag == FDT_PROP) { - struct fdt_property *prop = - fdt_offset_ptr_w(fdt, offset, sizeof(*prop)); - int nameoff; - - if (! prop) - return -FDT_ERR_BADSTRUCTURE; - - nameoff = fdt32_to_cpu(prop->nameoff); - nameoff += fdt_size_dt_strings(fdt); - prop->nameoff = cpu_to_fdt32(nameoff); - } - offset = nextoffset; - } - - /* Finally, adjust the header */ - fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt)); - fdt_set_magic(fdt, FDT_MAGIC); - return 0; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_sw.cpp --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_sw.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -extern "C" { - -#include "fdt_sw.c" - -}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_wip.c --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_wip.c Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "libfdt_env.h" - -#include -#include - -#include "libfdt_internal.h" - -int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, - const void *val, int len) -{ - void *propval; - int proplen; - - propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen); - if (! propval) - return proplen; - - if (proplen != len) - return -FDT_ERR_NOSPACE; - - memcpy(propval, val, len); - return 0; -} - -static void nop_region(void *start, int len) -{ - uint32_t *p; - - for (p = start; (void *)p < (start + len); p++) - *p = cpu_to_fdt32(FDT_NOP); -} - -int fdt_nop_property(void *fdt, int nodeoffset, const char *name) -{ - struct fdt_property *prop; - int len; - - prop = fdt_get_property_w(fdt, nodeoffset, name, &len); - if (! prop) - return len; - - nop_region(prop, len + sizeof(*prop)); - - return 0; -} - -int _fdt_node_end_offset(void *fdt, int nodeoffset) -{ - int level = 0; - uint32_t tag; - int offset, nextoffset; - - tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); - if (tag != FDT_BEGIN_NODE) - return -FDT_ERR_BADOFFSET; - do { - offset = nextoffset; - tag = fdt_next_tag(fdt, offset, &nextoffset); - - switch (tag) { - case FDT_END: - return offset; - - case FDT_BEGIN_NODE: - level++; - break; - - case FDT_END_NODE: - level--; - break; - - case FDT_PROP: - case FDT_NOP: - break; - - default: - return -FDT_ERR_BADSTRUCTURE; - } - } while (level >= 0); - - return nextoffset; -} - -int fdt_nop_node(void *fdt, int nodeoffset) -{ - int endoffset; - - endoffset = _fdt_node_end_offset(fdt, nodeoffset); - if (endoffset < 0) - return endoffset; - - nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0), endoffset - nodeoffset); - return 0; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_wip.cpp --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/fdt_wip.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -extern "C" { - -#include "fdt_wip.c" - -}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/libfdt.h --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/libfdt.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1080 +0,0 @@ -#ifndef _LIBFDT_H -#define _LIBFDT_H -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "libfdt_env.h" -#include "fdt.h" - -#define FDT_FIRST_SUPPORTED_VERSION 0x10 -#define FDT_LAST_SUPPORTED_VERSION 0x11 - -/* Error codes: informative error codes */ -#define FDT_ERR_NOTFOUND 1 - /* FDT_ERR_NOTFOUND: The requested node or property does not exist */ -#define FDT_ERR_EXISTS 2 - /* FDT_ERR_EXISTS: Attemped to create a node or property which - * already exists */ -#define FDT_ERR_NOSPACE 3 - /* FDT_ERR_NOSPACE: Operation needed to expand the device - * tree, but its buffer did not have sufficient space to - * contain the expanded tree. Use fdt_open_into() to move the - * device tree to a buffer with more space. */ - -/* Error codes: codes for bad parameters */ -#define FDT_ERR_BADOFFSET 4 - /* FDT_ERR_BADOFFSET: Function was passed a structure block - * offset which is out-of-bounds, or which points to an - * unsuitable part of the structure for the operation. */ -#define FDT_ERR_BADPATH 5 - /* FDT_ERR_BADPATH: Function was passed a badly formatted path - * (e.g. missing a leading / for a function which requires an - * absolute path) */ -#define FDT_ERR_BADPHANDLE 6 - /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle - * value. phandle values of 0 and -1 are not permitted. */ -#define FDT_ERR_BADSTATE 7 - /* FDT_ERR_BADSTATE: Function was passed an incomplete device - * tree created by the sequential-write functions, which is - * not sufficiently complete for the requested operation. */ - -/* Error codes: codes for bad device tree blobs */ -#define FDT_ERR_TRUNCATED 8 - /* FDT_ERR_TRUNCATED: Structure block of the given device tree - * ends without an FDT_END tag. */ -#define FDT_ERR_BADMAGIC 9 - /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a - * device tree at all - it is missing the flattened device - * tree magic number. */ -#define FDT_ERR_BADVERSION 10 - /* FDT_ERR_BADVERSION: Given device tree has a version which - * can't be handled by the requested operation. For - * read-write functions, this may mean that fdt_open_into() is - * required to convert the tree to the expected version. */ -#define FDT_ERR_BADSTRUCTURE 11 - /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt - * structure block or other serious error (e.g. misnested - * nodes, or subnodes preceding properties). */ -#define FDT_ERR_BADLAYOUT 12 - /* FDT_ERR_BADLAYOUT: For read-write functions, the given - * device tree has it's sub-blocks in an order that the - * function can't handle (memory reserve map, then structure, - * then strings). Use fdt_open_into() to reorganize the tree - * into a form suitable for the read-write operations. */ - -/* "Can't happen" error indicating a bug in libfdt */ -#define FDT_ERR_INTERNAL 13 - /* FDT_ERR_INTERNAL: libfdt has failed an internal assertion. - * Should never be returned, if it is, it indicates a bug in - * libfdt itself. */ - -#define FDT_ERR_MAX 13 - -/**********************************************************************/ -/* Low-level functions (you probably don't need these) */ -/**********************************************************************/ - -const void *fdt_offset_ptr(const void *fdt, int offset, int checklen); -static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) -{ - return (void *)fdt_offset_ptr(fdt, offset, checklen); -} - -uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); - -/**********************************************************************/ -/* General functions */ -/**********************************************************************/ - -#define fdt_get_header(fdt, field) \ - (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field)) -#define fdt_magic(fdt) (fdt_get_header(fdt, magic)) -#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize)) -#define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct)) -#define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings)) -#define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap)) -#define fdt_version(fdt) (fdt_get_header(fdt, version)) -#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version)) -#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys)) -#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings)) -#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct)) - -#define __fdt_set_hdr(name) \ - static inline void fdt_set_##name(void *fdt, uint32_t val) \ - { \ - struct fdt_header *fdth = (struct fdt_header *)fdt; \ - fdth->name = cpu_to_fdt32(val); \ - } - -__fdt_set_hdr(magic); -__fdt_set_hdr(totalsize); -__fdt_set_hdr(off_dt_struct); -__fdt_set_hdr(off_dt_strings); -__fdt_set_hdr(off_mem_rsvmap); -__fdt_set_hdr(version); -__fdt_set_hdr(last_comp_version); -__fdt_set_hdr(boot_cpuid_phys); -__fdt_set_hdr(size_dt_strings); -__fdt_set_hdr(size_dt_struct); -#undef __fdt_set_hdr - -/** - * fdt_check_header - sanity check a device tree or possible device tree - * @fdt: pointer to data which might be a flattened device tree - * - * fdt_check_header() checks that the given buffer contains what - * appears to be a flattened device tree with sane information in its - * header. - * - * returns: - * 0, if the buffer appears to contain a valid device tree - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, standard meanings, as above - */ -int fdt_check_header(const void *fdt); - -/** - * fdt_move - move a device tree around in memory - * @fdt: pointer to the device tree to move - * @buf: pointer to memory where the device is to be moved - * @bufsize: size of the memory space at buf - * - * fdt_move() relocates, if possible, the device tree blob located at - * fdt to the buffer at buf of size bufsize. The buffer may overlap - * with the existing device tree blob at fdt. Therefore, - * fdt_move(fdt, fdt, fdt_totalsize(fdt)) - * should always succeed. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, standard meanings - */ -int fdt_move(const void *fdt, void *buf, int bufsize); - -/**********************************************************************/ -/* Read-only functions */ -/**********************************************************************/ - -/** - * fdt_string - retreive a string from the strings block of a device tree - * @fdt: pointer to the device tree blob - * @stroffset: offset of the string within the strings block (native endian) - * - * fdt_string() retrieves a pointer to a single string from the - * strings block of the device tree blob at fdt. - * - * returns: - * a pointer to the string, on success - * NULL, if stroffset is out of bounds - */ -const char *fdt_string(const void *fdt, int stroffset); - -/** - * fdt_num_mem_rsv - retreive the number of memory reserve map entries - * @fdt: pointer to the device tree blob - * - * Returns the number of entries in the device tree blob's memory - * reservation map. This does not include the terminating 0,0 entry - * or any other (0,0) entries reserved for expansion. - * - * returns: - * the number of entries - */ -int fdt_num_mem_rsv(const void *fdt); - -/** - * fdt_get_mem_rsv - retreive one memory reserve map entry - * @fdt: pointer to the device tree blob - * @address, @size: pointers to 64-bit variables - * - * On success, *address and *size will contain the address and size of - * the n-th reserve map entry from the device tree blob, in - * native-endian format. - * - * returns: - * 0, on success - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, standard meanings - */ -int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size); - -/** - * fdt_subnode_offset_namelen - find a subnode based on substring - * @fdt: pointer to the device tree blob - * @parentoffset: structure block offset of a node - * @name: name of the subnode to locate - * @namelen: number of characters of name to consider - * - * Identical to fdt_subnode_offset(), but only examine the first - * namelen characters of name for matching the subnode name. This is - * useful for finding subnodes based on a portion of a larger string, - * such as a full path. - */ -int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, - const char *name, int namelen); -/** - * fdt_subnode_offset - find a subnode of a given node - * @fdt: pointer to the device tree blob - * @parentoffset: structure block offset of a node - * @name: name of the subnode to locate - * - * fdt_subnode_offset() finds a subnode of the node at structure block - * offset parentoffset with the given name. name may include a unit - * address, in which case fdt_subnode_offset() will find the subnode - * with that unit address, or the unit address may be omitted, in - * which case fdt_subnode_offset() will find an arbitrary subnode - * whose name excluding unit address matches the given name. - * - * returns: - * structure block offset of the requested subnode (>=0), on success - * -FDT_ERR_NOTFOUND, if the requested subnode does not exist - * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings. - */ -int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name); - -/** - * fdt_path_offset - find a tree node by its full path - * @fdt: pointer to the device tree blob - * @path: full path of the node to locate - * - * fdt_path_offset() finds a node of a given path in the device tree. - * Each path component may omit the unit address portion, but the - * results of this are undefined if any such path component is - * ambiguous (that is if there are multiple nodes at the relevant - * level matching the given component, differentiated only by unit - * address). - * - * returns: - * structure block offset of the node with the requested path (>=0), on success - * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid - * -FDT_ERR_NOTFOUND, if the requested node does not exist - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings. - */ -int fdt_path_offset(const void *fdt, const char *path); - -/** - * fdt_get_name - retreive the name of a given node - * @fdt: pointer to the device tree blob - * @nodeoffset: structure block offset of the starting node - * @lenp: pointer to an integer variable (will be overwritten) or NULL - * - * fdt_get_name() retrieves the name (including unit address) of the - * device tree node at structure block offset nodeoffset. If lenp is - * non-NULL, the length of this name is also returned, in the integer - * pointed to by lenp. - * - * returns: - * pointer to the node's name, on success - * If lenp is non-NULL, *lenp contains the length of that name (>=0) - * NULL, on error - * if lenp is non-NULL *lenp contains an error code (<0): - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, standard meanings - */ -const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp); - -/** - * fdt_get_property - find a given property in a given node - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to find - * @name: name of the property to find - * @lenp: pointer to an integer variable (will be overwritten) or NULL - * - * fdt_get_property() retrieves a pointer to the fdt_property - * structure within the device tree blob corresponding to the property - * named 'name' of the node at offset nodeoffset. If lenp is - * non-NULL, the length of the property value also returned, in the - * integer pointed to by lenp. - * - * returns: - * pointer to the structure representing the property - * if lenp is non-NULL, *lenp contains the length of the property - * value (>=0) - * NULL, on error - * if lenp is non-NULL, *lenp contains an error code (<0): - * -FDT_ERR_NOTFOUND, node does not have named property - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, - const char *name, int *lenp); -static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, - const char *name, - int *lenp) -{ - return (struct fdt_property *)fdt_get_property(fdt, nodeoffset, - name, lenp); -} - -/** - * fdt_getprop - retrieve the value of a given property - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to find - * @name: name of the property to find - * @lenp: pointer to an integer variable (will be overwritten) or NULL - * - * fdt_getprop() retrieves a pointer to the value of the property - * named 'name' of the node at offset nodeoffset (this will be a - * pointer to within the device blob itself, not a copy of the value). - * If lenp is non-NULL, the length of the property value also - * returned, in the integer pointed to by lenp. - * - * returns: - * pointer to the property's value - * if lenp is non-NULL, *lenp contains the length of the property - * value (>=0) - * NULL, on error - * if lenp is non-NULL, *lenp contains an error code (<0): - * -FDT_ERR_NOTFOUND, node does not have named property - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -const void *fdt_getprop(const void *fdt, int nodeoffset, - const char *name, int *lenp); -static inline void *fdt_getprop_w(void *fdt, int nodeoffset, - const char *name, int *lenp) -{ - return (void *)fdt_getprop(fdt, nodeoffset, name, lenp); -} - -/** - * fdt_get_phandle - retreive the phandle of a given node - * @fdt: pointer to the device tree blob - * @nodeoffset: structure block offset of the node - * - * fdt_get_phandle() retrieves the phandle of the device tree node at - * structure block offset nodeoffset. - * - * returns: - * the phandle of the node at nodeoffset, on succes (!= 0, != -1) - * 0, if the node has no phandle, or another error occurs - */ -uint32_t fdt_get_phandle(const void *fdt, int nodeoffset); - -/** - * fdt_get_path - determine the full path of a node - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose path to find - * @buf: character buffer to contain the returned path (will be overwritten) - * @buflen: size of the character buffer at buf - * - * fdt_get_path() computes the full path of the node at offset - * nodeoffset, and records that path in the buffer at buf. - * - * NOTE: This function is expensive, as it must scan the device tree - * structure from the start to nodeoffset. - * - * returns: - * 0, on success - * buf contains the absolute path of the node at - * nodeoffset, as a NUL-terminated string. - * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag - * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1) - * characters and will not fit in the given buffer. - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen); - -/** - * fdt_supernode_atdepth_offset - find a specific ancestor of a node - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose parent to find - * @supernodedepth: depth of the ancestor to find - * @nodedepth: pointer to an integer variable (will be overwritten) or NULL - * - * fdt_supernode_atdepth_offset() finds an ancestor of the given node - * at a specific depth from the root (where the root itself has depth - * 0, its immediate subnodes depth 1 and so forth). So - * fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL); - * will always return 0, the offset of the root node. If the node at - * nodeoffset has depth D, then: - * fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL); - * will return nodeoffset itself. - * - * NOTE: This function is expensive, as it must scan the device tree - * structure from the start to nodeoffset. - * - * returns: - - * structure block offset of the node at node offset's ancestor - * of depth supernodedepth (>=0), on success - * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag -* -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, - int supernodedepth, int *nodedepth); - -/** - * fdt_node_depth - find the depth of a given node - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose parent to find - * - * fdt_node_depth() finds the depth of a given node. The root node - * has depth 0, its immediate subnodes depth 1 and so forth. - * - * NOTE: This function is expensive, as it must scan the device tree - * structure from the start to nodeoffset. - * - * returns: - * depth of the node at nodeoffset (>=0), on success - * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_node_depth(const void *fdt, int nodeoffset); - -/** - * fdt_parent_offset - find the parent of a given node - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose parent to find - * - * fdt_parent_offset() locates the parent node of a given node (that - * is, it finds the offset of the node which contains the node at - * nodeoffset as a subnode). - * - * NOTE: This function is expensive, as it must scan the device tree - * structure from the start to nodeoffset, *twice*. - * - * returns: - * stucture block offset of the parent of the node at nodeoffset - * (>=0), on success - * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_parent_offset(const void *fdt, int nodeoffset); - -/** - * fdt_node_offset_by_prop_value - find nodes with a given property value - * @fdt: pointer to the device tree blob - * @startoffset: only find nodes after this offset - * @propname: property name to check - * @propval: property value to search for - * @proplen: length of the value in propval - * - * fdt_node_offset_by_prop_value() returns the offset of the first - * node after startoffset, which has a property named propname whose - * value is of length proplen and has value equal to propval; or if - * startoffset is -1, the very first such node in the tree. - * - * To iterate through all nodes matching the criterion, the following - * idiom can be used: - * offset = fdt_node_offset_by_prop_value(fdt, -1, propname, - * propval, proplen); - * while (offset != -FDT_ERR_NOTFOUND) { - * // other code here - * offset = fdt_node_offset_by_prop_value(fdt, offset, propname, - * propval, proplen); - * } - * - * Note the -1 in the first call to the function, if 0 is used here - * instead, the function will never locate the root node, even if it - * matches the criterion. - * - * returns: - * structure block offset of the located node (>= 0, >startoffset), - * on success - * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the - * tree after startoffset - * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, - const char *propname, - const void *propval, int proplen); - -/** - * fdt_node_offset_by_phandle - find the node with a given phandle - * @fdt: pointer to the device tree blob - * @phandle: phandle value - * - * fdt_node_offset_by_prop_value() returns the offset of the node - * which has the given phandle value. If there is more than one node - * in the tree with the given phandle (an invalid tree), results are - * undefined. - * - * returns: - * structure block offset of the located node (>= 0), on success - * -FDT_ERR_NOTFOUND, no node with that phandle exists - * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1) - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle); - -/** - * fdt_node_check_compatible: check a node's compatible property - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of a tree node - * @compatible: string to match against - * - * - * fdt_node_check_compatible() returns 0 if the given node contains a - * 'compatible' property with the given string as one of its elements, - * it returns non-zero otherwise, or on error. - * - * returns: - * 0, if the node has a 'compatible' property listing the given string - * 1, if the node has a 'compatible' property, but it does not list - * the given string - * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property - * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_node_check_compatible(const void *fdt, int nodeoffset, - const char *compatible); - -/** - * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value - * @fdt: pointer to the device tree blob - * @startoffset: only find nodes after this offset - * @compatible: 'compatible' string to match against - * - * fdt_node_offset_by_compatible() returns the offset of the first - * node after startoffset, which has a 'compatible' property which - * lists the given compatible string; or if startoffset is -1, the - * very first such node in the tree. - * - * To iterate through all nodes matching the criterion, the following - * idiom can be used: - * offset = fdt_node_offset_by_compatible(fdt, -1, compatible); - * while (offset != -FDT_ERR_NOTFOUND) { - * // other code here - * offset = fdt_node_offset_by_compatible(fdt, offset, compatible); - * } - * - * Note the -1 in the first call to the function, if 0 is used here - * instead, the function will never locate the root node, even if it - * matches the criterion. - * - * returns: - * structure block offset of the located node (>= 0, >startoffset), - * on success - * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the - * tree after startoffset - * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, standard meanings - */ -int fdt_node_offset_by_compatible(const void *fdt, int startoffset, - const char *compatible); - -/**********************************************************************/ -/* Write-in-place functions */ -/**********************************************************************/ - -/** - * fdt_setprop_inplace - change a property's value, but not its size - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to change - * @name: name of the property to change - * @val: pointer to data to replace the property value with - * @len: length of the property value - * - * fdt_setprop_inplace() replaces the value of a given property with - * the data in val, of length len. This function cannot change the - * size of a property, and so will only work if len is equal to the - * current length of the property. - * - * This function will alter only the bytes in the blob which contain - * the given property value, and will not alter or move any other part - * of the tree. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, if len is not equal to the property's current length - * -FDT_ERR_NOTFOUND, node does not have the named property - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, - const void *val, int len); - -/** - * fdt_setprop_inplace_cell - change the value of a single-cell property - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to change - * @name: name of the property to change - * @val: cell (32-bit integer) value to replace the property with - * - * fdt_setprop_inplace_cell() replaces the value of a given property - * with the 32-bit integer cell value in val, converting val to - * big-endian if necessary. This function cannot change the size of a - * property, and so will only work if the property already exists and - * has length 4. - * - * This function will alter only the bytes in the blob which contain - * the given property value, and will not alter or move any other part - * of the tree. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, if the property's length is not equal to 4 - * -FDT_ERR_NOTFOUND, node does not have the named property - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, - const char *name, uint32_t val) -{ - val = cpu_to_fdt32(val); - return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); -} - -/** - * fdt_nop_property - replace a property with nop tags - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to nop - * @name: name of the property to nop - * - * fdt_nop_property() will replace a given property's representation - * in the blob with FDT_NOP tags, effectively removing it from the - * tree. - * - * This function will alter only the bytes in the blob which contain - * the property, and will not alter or move any other part of the - * tree. - * - * returns: - * 0, on success - * -FDT_ERR_NOTFOUND, node does not have the named property - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_nop_property(void *fdt, int nodeoffset, const char *name); - -/** - * fdt_nop_node - replace a node (subtree) with nop tags - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node to nop - * - * fdt_nop_node() will replace a given node's representation in the - * blob, including all its subnodes, if any, with FDT_NOP tags, - * effectively removing it from the tree. - * - * This function will alter only the bytes in the blob which contain - * the node and its properties and subnodes, and will not alter or - * move any other part of the tree. - * - * returns: - * 0, on success - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_nop_node(void *fdt, int nodeoffset); - -/**********************************************************************/ -/* Sequential write functions */ -/**********************************************************************/ - -int fdt_create(void *buf, int bufsize); -int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size); -int fdt_finish_reservemap(void *fdt); -int fdt_begin_node(void *fdt, const char *name); -int fdt_property(void *fdt, const char *name, const void *val, int len); -static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) -{ - val = cpu_to_fdt32(val); - return fdt_property(fdt, name, &val, sizeof(val)); -} -#define fdt_property_string(fdt, name, str) \ - fdt_property(fdt, name, str, strlen(str)+1) -int fdt_end_node(void *fdt); -int fdt_finish(void *fdt); - -/**********************************************************************/ -/* Read-write functions */ -/**********************************************************************/ - -int fdt_open_into(const void *fdt, void *buf, int bufsize); -int fdt_pack(void *fdt); - -/** - * fdt_add_mem_rsv - add one memory reserve map entry - * @fdt: pointer to the device tree blob - * @addres, @size: 64-bit values (native endian) - * - * Adds a reserve map entry to the given blob reserving a region at - * address address of length size. - * - * This function will insert data into the reserve map and will - * therfore change the indexes of some entries in the table. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to - * contain the new reservation entry - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size); - -/** - * fdt_del_mem_rsv - remove a memory reserve map entry - * @fdt: pointer to the device tree blob - * @n: entry to remove - * - * fdt_del_mem_rsv() removes the n-th memory reserve map entry from - * the blob. - * - * This function will delete data from the reservation table and will - * therfore change the indexes of some entries in the table. - * - * returns: - * 0, on success - * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there - * are less than n+1 reserve map entries) - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_del_mem_rsv(void *fdt, int n); - -/** - * fdt_set_name - change the name of a given node - * @fdt: pointer to the device tree blob - * @nodeoffset: structure block offset of a node - * @name: name to give the node - * - * fdt_set_name() replaces the name (including unit address, if any) - * of the given node with the given string. NOTE: this function can't - * efficiently check if the new name is unique amongst the given - * node's siblings; results are undefined if this function is invoked - * with a name equal to one of the given node's siblings. - * - * This function may insert or delete data from the blob, and will - * therefore change the offsets of some existing nodes. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, there is insufficient free space in the blob - * to contain the new name - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, standard meanings - */ -int fdt_set_name(void *fdt, int nodeoffset, const char *name); - -/** - * fdt_setprop - create or change a property - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to change - * @name: name of the property to change - * @val: pointer to data to set the property value to - * @len: length of the property value - * - * fdt_setprop() sets the value of the named property in the given - * node to the given value and length, creeating the property if it - * does not already exist. - * - * This function may insert or delete data from the blob, and will - * therefore change the offsets of some existing nodes. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to - * contain the new property value - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_setprop(void *fdt, int nodeoffset, const char *name, - const void *val, int len); - -/** - * fdt_setprop_cell - set a property to a single cell value - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to change - * @name: name of the property to change - * @val: 32-bit integer value for the property (native endian) - * - * fdt_setprop_cell() sets the value of the named property in the - * given node to the given cell value (converting to big-endian if - * necessary), or creates a new property with that value if it does - * not already exist. - * - * This function may insert or delete data from the blob, and will - * therefore change the offsets of some existing nodes. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to - * contain the new property value - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_TRUNCATED, standard meanings - */ -static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, - uint32_t val) -{ - val = cpu_to_fdt32(val); - return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); -} - -/** - * fdt_setprop_string - set a property to a string value - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to change - * @name: name of the property to change - * @str: string value for the property - * - * fdt_setprop_string() sets the value of the named property in the - * given node to the given string value (using the length of the - * string to determine the new length of the property), or creates a - * new property with that value if it does not already exist. - * - * This function may insert or delete data from the blob, and will - * therefore change the offsets of some existing nodes. - * - * returns: - * 0, on success - * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to - * contain the new property value - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_TRUNCATED, standard meanings - */ -#define fdt_setprop_string(fdt, nodeoffset, name, str) \ - fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1) - -/** - * fdt_delprop - delete a property - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node whose property to nop - * @name: name of the property to nop - * - * fdt_del_property() will delete the given property. - * - * This function will delete data from the blob, and will therefore - * change the offsets of some existing nodes. - * - * returns: - * 0, on success - * -FDT_ERR_NOTFOUND, node does not have the named property - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_delprop(void *fdt, int nodeoffset, const char *name); - -/** - * fdt_add_subnode_namelen - creates a new node based on substring - * @fdt: pointer to the device tree blob - * @parentoffset: structure block offset of a node - * @name: name of the subnode to locate - * @namelen: number of characters of name to consider - * - * Identical to fdt_add_subnode(), but use only the first namelen - * characters of name as the name of the new node. This is useful for - * creating subnodes based on a portion of a larger string, such as a - * full path. - */ -int fdt_add_subnode_namelen(void *fdt, int parentoffset, - const char *name, int namelen); - -/** - * fdt_add_subnode - creates a new node - * @fdt: pointer to the device tree blob - * @parentoffset: structure block offset of a node - * @name: name of the subnode to locate - * - * fdt_add_subnode() creates a new node as a subnode of the node at - * structure block offset parentoffset, with the given name (which - * should include the unit address, if any). - * - * This function will insert data into the blob, and will therefore - * change the offsets of some existing nodes. - - * returns: - * structure block offset of the created nodeequested subnode (>=0), on success - * -FDT_ERR_NOTFOUND, if the requested subnode does not exist - * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag - * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of - * the given name - * -FDT_ERR_NOSPACE, if there is insufficient free space in the - * blob to contain the new node - * -FDT_ERR_NOSPACE - * -FDT_ERR_BADLAYOUT - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings. - */ -int fdt_add_subnode(void *fdt, int parentoffset, const char *name); - -/** - * fdt_del_node - delete a node (subtree) - * @fdt: pointer to the device tree blob - * @nodeoffset: offset of the node to nop - * - * fdt_del_node() will remove the given node, including all its - * subnodes if any, from the blob. - * - * This function will delete data from the blob, and will therefore - * change the offsets of some existing nodes. - * - * returns: - * 0, on success - * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag - * -FDT_ERR_BADLAYOUT, - * -FDT_ERR_BADMAGIC, - * -FDT_ERR_BADVERSION, - * -FDT_ERR_BADSTATE, - * -FDT_ERR_BADSTRUCTURE, - * -FDT_ERR_TRUNCATED, standard meanings - */ -int fdt_del_node(void *fdt, int nodeoffset); - -/**********************************************************************/ -/* Debugging / informational functions */ -/**********************************************************************/ - -const char *fdt_strerror(int errval); - -#ifdef __cplusplus -} -#endif - - -#endif /* _LIBFDT_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/libfdt_env.h --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/libfdt_env.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#ifndef _LIBFDT_ENV_H -#define _LIBFDT_ENV_H - -#include -#include -#include -#include "bswap.h" - -#ifdef WORDS_BIGENDIAN -#define fdt32_to_cpu(x) (x) -#define cpu_to_fdt32(x) (x) -#define fdt64_to_cpu(x) (x) -#define cpu_to_fdt64(x) (x) -#else -#define fdt32_to_cpu(x) (bswap_32((x))) -#define cpu_to_fdt32(x) (bswap_32((x))) -#define fdt64_to_cpu(x) (bswap_64((x))) -#define cpu_to_fdt64(x) (bswap_64((x))) -#endif - -#endif /* _LIBFDT_ENV_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/libfdt_internal.h --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/libfdt_internal.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -#ifndef _LIBFDT_INTERNAL_H -#define _LIBFDT_INTERNAL_H -/* - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include - -#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) -#define PALIGN(p, a) ((void *)ALIGN((unsigned long)(p), (a))) - -#define memeq(p, q, n) (memcmp((p), (q), (n)) == 0) -#define streq(p, q) (strcmp((p), (q)) == 0) - -uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset); -const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); -int _fdt_node_end_offset(void *fdt, int nodeoffset); - -static inline const void *_fdt_offset_ptr(const void *fdt, int offset) -{ - return fdt + fdt_off_dt_struct(fdt) + offset; -} - -static inline void *_fdt_offset_ptr_w(void *fdt, int offset) -{ - return (void *)_fdt_offset_ptr(fdt, offset); -} - -static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) -{ - const struct fdt_reserve_entry *rsv_table = - fdt + fdt_off_mem_rsvmap(fdt); - - return rsv_table + n; -} -static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) -{ - return (void *)_fdt_mem_rsv(fdt, n); -} - -#define SW_MAGIC (~FDT_MAGIC) - -#endif /* _LIBFDT_INTERNAL_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/patch.libfdt --- a/baseport/src/cedar/generic/base/syborg/svpplatform/libfdt/patch.libfdt Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -Minor changes are required to get libfdt to build as part of qemu. -The patch below records modifications relative to upstream dtc-v1.2.0. - -Index: libfdt_env.h -=================================================================== ---- libfdt_env.h (revision 230023) -+++ libfdt_env.h (working copy) -@@ -4,10 +4,9 @@ - #include - #include - #include --#include --#include -+#include "bswap.h" - --#if __BYTE_ORDER == __BIG_ENDIAN -+#ifdef WORDS_BIGENDIAN - #define fdt32_to_cpu(x) (x) - #define cpu_to_fdt32(x) (x) - #define fdt64_to_cpu(x) (x) diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpsnapdriver/snapapp.mmp --- a/baseport/src/cedar/generic/base/syborg/svpsnapdriver/snapapp.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -TARGET snapapp.exe -TARGETTYPE EXE -SOURCEPATH src -SOURCE snapapp.cpp rsvpsnapdriver.cpp -LIBRARY euser.lib efsrv.lib -SYSTEMINCLUDE /epoc32/include - -CAPABILITY TCB DISKADMIN ALLFILES -VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/rsvpsnapdriver.cpp --- a/baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/rsvpsnapdriver.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include // for User:: -#include "rsvpsnapdriver.h" - -//#define SVPDBG -#ifdef SVPDBG -#include -#define DP(format...) RDebug::Printf(format) -#else -#define DP(format...) -#endif - -TInt RSVPSnapDriver::Open(void) -{ - DP("** RSVPSnapDriver::Open()"); - - const TVersion ver = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); - - return DoCreate(KSVPSnapDriverName, - ver, - KNullUnit, - NULL, - NULL); -} - -TInt RSVPSnapDriver::SaveVM(const TDesC8& aData) -{ - DP("** RSVPSnapDriver::SaveVM"); - - //DP("** RSVPSnapDriver::SaveVM: - length of data=%d", length); - //DP("** RSVPSnapDriver::SaveVM: - aName= %s", name.Ptr()); - - return DoSVPRequest(ESaveVM,(TAny*)&aData); - } - -TInt RSVPSnapDriver::LoadVM(const TDesC8& aData) -{ - DP("** RSVPSnapDriver::LoadVM"); - return DoSVPRequest(ELoadVM,(TAny*)&aData); -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/rsvpsnapdriver.h --- a/baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/rsvpsnapdriver.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __RSVPSNAPDRIVER_H -#define __RSVPSNAPDRIVER_H - -#include // for RBusLogicalChannel - -class TCapsSVPSnapDriver -{ -public: - TVersion iVersion; -}; - -_LIT(KSVPSnapDriverName,"SVP Snapshot Driver"); -_LIT(KSVPSnapDriverLDD, "svpsnapdriver.ldd"); - -// Version information -const TInt KMajorVersionNumber=0; -const TInt KMinorVersionNumber=0; -const TInt KBuildVersionNumber=1; - -class RSVPSnapDriver : public RBusLogicalChannel -{ - public: - enum TControl - { - EDummy = 0, - ESaveVM, - ELoadVM - }; - - public: -#ifndef __KERNEL_MODE__ - TInt Open(void); - TInt SaveVM(const TDesC8& aData); - TInt LoadVM(const TDesC8& aData); - -private: - inline TInt DoSVPRequest(TInt aReqNo, TAny * a1) - { - TRequestStatus status; - DoRequest(aReqNo, status, a1); - User::WaitForRequest(status); - return status.Int(); - } -#endif -}; - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/snapapp.cpp --- a/baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/snapapp.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include // CTrapCleanup - -#include "rsvpsnapdriver.h" - -#define SVPDBG -#ifdef SVPDBG -#include -#define DP(format...) RDebug::Printf(format) -#else -#define DP(format...) -#endif - -_LIT8(KTestSendData,"kalle"); - -GLDEF_C TInt E32Main() -{ - DP("** (SNAPAPP) E32Main()"); - - // CTrapCleanup* cleanup; - // cleanup=CTrapCleanup::New(); - // __UHEAP_MARK; - -#if 0 - TInt err = User::LoadLogicalDevice(KSVPSnapDriverLDD); - if (err==KErrAlreadyExists) - DP("KErrAlreadyExists"); -#endif - - RSVPSnapDriver drv; - TInt err = drv.Open(); - -#if 1 - if (err==KErrNone) - { - - drv.SaveVM(KTestSendData); - } - else - DP("Error"); -#else - drv.LoadVM(KTestSendData); // Will never return -#endif - - // __UHEAP_MARKEND; - // delete cleanup; - return(KErrNone); -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/svpsnapdriver.cpp --- a/baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/svpsnapdriver.cpp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "svpsnapdriver.h" -#include "rsvpsnapdriver.h" -#include "system.h" - -static inline TUint32 ReadReg(ESVPSnapReg aReg) -{ - DP("** (SVPSNAPDRIVER) ReadReg(%d)",aReg); - - return *(volatile TUint32 *)(KHwSVPSnapDevice + (aReg << 2)); -} - -static inline void WriteReg(ESVPSnapReg aReg, TUint32 aVal) -{ - DP("** (SVPSNAPDRIVER) WriteReg(%d,%d)",aReg,aVal); - - *(volatile TUint32*)(KHwSVPSnapDevice + (aReg << 2)) = aVal; -} - -// -// DSVPSnapDriverFactory -// - -DSVPSnapDriverFactory::DSVPSnapDriverFactory() -{ - DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::DSVPSnapDriverFactory()"); - - iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); -} - -TInt DSVPSnapDriverFactory::Create(DLogicalChannelBase*& aChannel) -{ - DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::Create()"); - -#if 0 - if (iOpenChannels != 0) - return KErrInUse; // a channel is already open -#endif - - aChannel = new DSVPSnapChannel(this); - - return aChannel ? KErrNone : KErrNoMemory; -} - -TInt DSVPSnapDriverFactory::Install() -{ - DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::Install()"); - - return(SetName(&KSVPSnapDriverName)); -} - -void DSVPSnapDriverFactory::GetCaps(TDes8& aDes) const -{ - DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::GetCaps()"); - - TCapsSVPSnapDriver b; - b.iVersion = TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber); - aDes.FillZ(aDes.MaxLength()); - aDes.Copy((TUint8 *)&b, Min(aDes.MaxLength(), sizeof(b))); -} - -// -// DSVPSnapChannel -// - -DSVPSnapChannel::DSVPSnapChannel(DLogicalDevice* aLogicalDevice) -{ - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DSVPSnapChannel()"); - - iDevice = aLogicalDevice; - - iClientThread = &Kern::CurrentThread(); - iClientThread->Open(); -} - -DSVPSnapChannel::~DSVPSnapChannel() -{ - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::~DSVPSnapChannel() ->"); - Kern::SafeClose((DObject*&)iClientThread, NULL); - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::~DSVPSnapChannel() <-"); -} - -TInt DSVPSnapChannel::DoCreate(TInt /*aUnit*/, const TDesC* anInfo, const TVersion& aVer) -{ - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCreate()"); - - if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), aVer)) - return KErrNotSupported; - - //Setup the driver for receiving client messages - SetDfcQ(Kern::DfcQue0()); - iMsgQ.Receive(); - - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCreate()- checking device"); - TUint id = ReadReg(ESnapshot_Id); - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCreate()- checked device- 0x%08x", id); - WriteReg(ESnapshot_Address, 0); - return KErrNone; -} - -void DSVPSnapChannel::DoCancel(TInt aReqNo) -{ - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCancel() %x(%d)", aReqNo, aReqNo); -} - -TInt DSVPSnapChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2) -{ - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoRequest() %x(%d)", aReqNo, aReqNo); - - TInt err = KErrGeneral; - - switch(aReqNo) - { - case RSVPSnapDriver::ESaveVM: - DP("RSVPSnapDriver::ESaveVM"); - err = SaveVM((const TDesC8*)a1); - break; - case RSVPSnapDriver::ELoadVM: - DP("RSVPSnapDriver::ELoadVM"); - err= LoadVM((const TDesC8*)a1); - break; - default: - DP("default"); - err = KErrGeneral; - break; - } - - if (KErrNone != err) - DP("** (SVPSNAPDRIVER) Error %d from DoRequest", err); - - return err; -} - -TInt DSVPSnapChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2) -{ - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoControl(%d)", aFunction); - - TInt err = KErrGeneral; - /* There should be a good reason to use a control rather than a request. */ - - if (KErrNone != err) { - DP("** (SVPSNAPDRIVER) Error %d from control function", err); - } - - return err; -} - -void DSVPSnapChannel::HandleMsg(TMessageBase* aMsg) -{ - - TThreadMessage& m = *(TThreadMessage*)aMsg; - TInt id = m.iValue; - - DP("** (SVPSNAPDRIVER) DSVPSnapChannel::HandleMsg() %x(%d)", id, id); - - if (id == (TInt)ECloseMsg) - { - m.Complete(KErrNone, EFalse); - return; - } - if (id == KMaxTInt) - { - // DoCancel - DoCancel(m.Int0()); - m.Complete(KErrNone, ETrue); - return; - } - if (id < 0) - { - // DoRequest - TRequestStatus* pStatus = (TRequestStatus*)m.Ptr0(); - TInt r = DoRequest(~id, pStatus, m.Ptr1(), m.Ptr2()); - // if (r != KErrNone) - Kern::RequestComplete(iClientThread,pStatus,r); - m.Complete(KErrNone, ETrue); - } - else - { - // DoControl - TInt r = DoControl(id, m.Ptr0(), m.Ptr1()); - m.Complete(r, ETrue); - } -} - -TInt DSVPSnapChannel::SaveVM(const TDesC8* aData) -{ - DP("** DSVPSnapChannel::SaveVM()"); - - TInt err = KErrNone; - RET_IF_ERROR(err, Kern::ThreadDesRead(iClientThread, aData, iSendDataBuffer,0)); - TUint32 * ptr = (TUint32*) iSendDataBuffer.Ptr(); - - WriteReg(ESnapshot_Address, Epoc::LinearToPhysical((TUint32)ptr)); - WriteReg(ESnapshot_Length, (TUint32) (iSendDataBuffer.Length())); - WriteReg(ESnapshot_Trigger, RSVPSnapDriver::ESaveVM); - - return err; -} - -TInt DSVPSnapChannel::LoadVM(const TDesC8* aData) -{ - DP("** DSVPSnapChannel::LoadVM()"); - - TInt err = KErrNone; - RET_IF_ERROR(err, Kern::ThreadDesRead(iClientThread, aData, iSendDataBuffer,0)); - - TUint32 * ptr = (TUint32*) iSendDataBuffer.Ptr(); - WriteReg(ESnapshot_Address, Epoc::LinearToPhysical((TUint32)ptr)); - - return ReadReg(ESnapshot_Address); -} - -DECLARE_EXTENSION_LDD() -{ - // FIXME: Not needed? - DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory created"); - return new DSVPSnapDriverFactory; -} - -DECLARE_STANDARD_EXTENSION() -{ - DP("** (SVPSNAPDRIVER) SVPSnap extension entry point"); - TInt r; - DSVPSnapDriverFactory* device = new DSVPSnapDriverFactory; - if (device==NULL) - r=KErrNoMemory; - else - r=Kern::InstallLogicalDevice(device); - - return r; -} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/svpsnapdriver.h --- a/baseport/src/cedar/generic/base/syborg/svpsnapdriver/src/svpsnapdriver.h Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SVPSNAPDRIVER_H -#define __SVPSNAPDRIVER_H - -#include // for DLogicalChannel - -#define SVPDBG -#ifdef SVPDBG -#define DP(format...) Kern::Printf(format) -#else -#define DP(format...) -#endif - -#define RET_IF_ERROR(v, e) { if ((v = (e)) != KErrNone) return v; } - -enum ESVPSnapReg { - ESnapshot_Id = 0, - ESnapshot_Address, - ESnapshot_Length, - ESnapshot_Trigger - }; - -class DSVPSnapDriverFactory : public DLogicalDevice -{ - public: - - DSVPSnapDriverFactory(); - virtual TInt Install(); - virtual void GetCaps(TDes8& aDes) const; - virtual TInt Create(DLogicalChannelBase*& aChannel); -}; - -class DSVPSnapChannel : public DLogicalChannel -{ - public: - - DSVPSnapChannel(DLogicalDevice* aLogicalDevice); - ~DSVPSnapChannel(); - - virtual TInt DoCreate(TInt aUnit, const TDesC* anInfo, const TVersion& aVer); - virtual void HandleMsg(TMessageBase* aMsg); - - protected: - virtual void DoCancel(TInt aReqNo); - virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); - virtual TInt DoControl(TInt aFunction, TAny *a1, TAny *a2); - - private: - TInt SaveVM(const TDesC8* aData); - TInt LoadVM(const TDesC8* aData); - -private: - DThread* iClientThread; - TDfcQue* iDFCQue; - - TBuf8<256> iSendDataBuffer; -}; - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/svpsnapdriver/svpsnapdriver.mmp --- a/baseport/src/cedar/generic/base/syborg/svpsnapdriver/svpsnapdriver.mmp Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -//macro __KERNEL_MODE__ - -#include -#include - -systeminclude AsspNKernIncludePath - -systeminclude src - -target VariantTarget(svpsnapdriver,ldd) -linkas svpsnapdriver.ldd -targettype ldd - -sourcepath src -source svpsnapdriver.cpp - -noexportlibrary - -vendorid 0x70000001 -capability all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/syborg-elf.cfg --- a/baseport/src/cedar/generic/base/syborg/syborg-elf.cfg Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -input = syborg_001.techview.img -logfile = syborg_001.techview.log -output = syborg_001.techview.elf -physical-address = 0x00000000 -drive = X: diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/syborg.dtb Binary file baseport/src/cedar/generic/base/syborg/syborg.dtb has changed diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/syborg.dts --- a/baseport/src/cedar/generic/base/syborg/syborg.dts Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - cpu0: ARM,Cortex-A8@0 { - device_type = "cpu"; - reg = <0>; - }; - }; - memory@0 { - device_type = "memory"; - reg = <0 08000000>; - }; - syborg { - #address-cells = <1>; - #size-cells = <0>; - intc: intc@0 { - compatible = "syborg,interrupt"; - #interrupt-cells = <1>; - reg = ; - interrupt-controller; - qemu,interrupts = <&cpu0 0>; - num-interrupts = <20>; - }; - rtc@0 { - compatible = "syborg,rtc"; - reg = ; - }; - timer@0 { - compatible = "syborg,timer"; - reg = ; - frequency = ; - interrupts = <1>; - interrupt-parent = <&intc>; - }; - keyboard@0 { - compatible = "syborg,keyboard"; - reg = ; - interrupts = <2>; - interrupt-parent = <&intc>; - }; - touchscreen@0 { - compatible = "syborg,pointer"; - reg = ; - interrupts = <3>; - interrupt-parent = <&intc>; - }; - framebuffer@0 { - compatible = "syborg,framebuffer"; - reg = ; - interrupts = <4>; - interrupt-parent = <&intc>; - }; - serial@0 { - device_type = "serial"; - compatible = "syborg,serial"; - chardev = "serial0"; - reg = ; - interrupts = <5>; - interrupt-parent = <&intc>; - }; - serial@1 { - device_type = "serial"; - compatible = "syborg,serial"; - chardev = "serial1"; - reg = ; - interrupts = <6>; - interrupt-parent = <&intc>; - }; - serial@2 { - device_type = "serial"; - compatible = "syborg,serial"; - chardev = "serial2"; - reg = ; - interrupts = <7>; - interrupt-parent = <&intc>; - }; - serial@3 { - device_type = "serial"; - compatible = "syborg,serial"; - chardev = "serial3"; - reg = ; - interrupts = <8>; - interrupt-parent = <&intc>; - }; - hostfs@0 { - compatible = "syborg,hostfs"; - reg = ; - host-path = "\\svphostfs\\"; - drive-number = ; - }; - ss@0 { - compatible = "syborg,snapshot"; - reg = ; - }; - net@0 { - compatible = "syborg,virtio-net"; - reg = ; - interrupts = <9>; - interrupt-parent = <&intc>; - }; - nand@0 { - compatible = "syborg,nand"; - reg = ; - size = <400>; - }; - audio@0 { - compatible = "syborg,virtio-audio"; - reg = ; - interrupts = ; - interrupt-parent = <&intc>; - }; - platform@0 { - compatible = "syborg,platform"; - reg = ; - }; - }; -}; - diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/syborg.oby --- a/baseport/src/cedar/generic/base/syborg/syborg.oby Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SYBORG_OBY__ -#define __SYBORG_OBY__ - -define LANGID 01 -define BUILDNO 0 -define VERSION 0.01 - -DEFAULT_LANGUAGE 01 - -REM #undef _ARM4 -REM #define _ARM4 - -#define __SYBORG__ -#define __ARM_HW_PLATFORM__ -#define SYMBIAN_EXCLUDE_MTP - -define SYBORG_L1 0x0b0a0001 -define VARIANT syborg -define VARID SYBORG_L1 -define ASSP_DIR EPOCROOT##epoc32\release\syborg -define ROMMEGS 15 /* !! HEX !! */ -define PLATFORM_NAME syborg - -#define COLOR - -REM defines for IrDA options -REM Uncomment the line below to enable IrDA to use a Jeteye ESI09680 pod with serial card adapter -REM #define _ENABLE_IRDA_POD_ -REM define which port IrDA uses -define IRPOD_ESK irda_port1.esk - -REM define which serial port Bluetooth protocol uses -define BLUETOOTH_ESK bt_port2.esk - -REM Define whether or not to include USB client support: -//#define EUSBC - -ROMBUILD_OPTION -no-header - -#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/test/ABLD.BAT --- a/baseport/src/cedar/generic/base/syborg/test/ABLD.BAT Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\src\cedar\generic\base\syborg\test\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/test/autoexec.bat --- a/baseport/src/cedar/generic/base/syborg/test/autoexec.bat Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -z: -cd test -rem runtests e32test.auto.bat -rem format c: -rem runtests f32test.auto.bat -d c diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/test/bld.inf --- a/baseport/src/cedar/generic/base/syborg/test/bld.inf Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_PLATFORMS -ARMV5 - -PRJ_TESTEXPORTS -autoexec.bat \epoc32\rom\syborg\ // - -PRJ_TESTMMPFILES - -// Drivers -// requires baseport specific definitions for TIMER and TimeDelta in d_mstim.cpp -..\..\e32test\group\d_mstim support -// requires baseport specific definitions for TIMER and TimeDelta and LongTimeDelta in d_tick.cpp -..\..\e32test\group\d_tick support -// requires definitions for KTickPeriodMs and KTicksPerMillisecond. These are baseport specific and require changes to d_latncy -..\..\e32test\group\d_latncy support -..\..\e32test\group\d_shadow support -..\..\e32test\group\bm_pdd support -//..\..\e32test\group\d_sharedio support -// needs dma.dll -//..\..\e32test\group\d_dma support // DMA kernel-side test harness for real DMA framework -// needs epbusm.dll -//..\..\e32test\group\d_medch support -..\..\e32test\group\d_cache support diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/test/variant_test.mmh --- a/baseport/src/cedar/generic/base/syborg/test/variant_test.mmh Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#define BUILD_TESTS - -#include <..\variant.mmh> - -SYSTEMINCLUDE AsspNKernIncludePath diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/trk_l1.ini --- a/baseport/src/cedar/generic/base/syborg/trk_l1.ini Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -[SERIALCOMM] -PDD EUART1 -LDD ECOMM -CSY ECUART -PORT 1 -RATE 115200 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/src/cedar/generic/base/syborg/variant.mmh --- a/baseport/src/cedar/generic/base/syborg/variant.mmh Fri Jul 31 15:01:17 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* 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: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -//macro __CPU_ARM926J__ -//#define __CPU__ ARM926EJ-S - -//macro __CPU_ARM1136__ - -//#define __CPU_ARM1176__ - -macro __CPU_CORTEX_A8N__ -macro __VFP_V3 -#define SYBORG -macro __SYBORG__ - -#define MM_MULTIPLE -//#define MM_FLEXIBLE - -// TO DO: decide if we need to switch these on or off!! -// -// Uncomment the following line if using the r1p0 release or later of the ARM1136 processor. -// -//#define __CPU_ARM1136_IS_R1__ -// - -/* Uncomment if ARM1136 Erratum 351912 - * "VFP11 double precision multiply can corrupt data" - * is fixed on this hardware. - */ -//macro __CPU_ARM1136_ERRATUM_351912_FIXED - -/* Uncomment if ARM1136 Erratum 353494 - * "Rare conditions can cause corruption of the Instruction Cache" - * is fixed on this hardware. - */ -//macro __CPU_ARM1136_ERRATUM_353494_FIXED - -/* Uncomment if ARM1136 Erratum 371025 - * "Invalidate Instruction Cache operation can fail" - * is fixed on this hardware. - */ -//macro __CPU_ARM1136_ERRATUM_371025_FIXED - -/* Uncomment if using ARM1136 processor and ARM1136 Erratum 399234 - * "Write back data cache entry evicted by write through entry causes data corruption" - * is fixed on this hardware. - * Workaround - * The erratum may be avoided by marking all cacheable memory as one of write through or write back. - * This requires the memory attributes described in the translation tables to be modified by software - * appropriately, or the use of the remapping capability to remap write through regions to non cacheable. - * If this macro is enabled, it should be acompanied by: - * GBLL CFG_CPU_ARM1136_ERRATUM_399234_FIXED in config.inc - */ -//macro __CPU_ARM1136_ERRATUM_399234_FIXED - -/* Uncomment if ARM1136 Erratum 408022 "Cancelled write to CONTEXTID register might update ASID" - * is fixed on this hardware. - */ -//macro __CPU_ARM1136_ERRATUM_408022_FIXED - -// TO DO: -// -// Uncomment the next line if using the ARM1136 processor and ARM1136 Erratum 406973 -// "CLREX instruction might be ignored during data cache line fill" -// is fixed on this hardware. -// -//#define __CPU_ARM1136_ERRATUM_406973_FIXED - - -// Uncomment if: -// 1) using ARM1136 processor and ARM1136 Erratum 411920: "Invalidate Entire Instruction Cache -// operation might fail to invalidate some lines if coincident with linefill" -// is fixed on this hardware, or -// 2) using ARM1176 processor and ARM1176 Erratum 415045: "Invalidate Entire Instruction Cache -// operation might fail to invalidate some lines if coincident with linefill -// is fixed on this hardware. -// Workaround: -// 1) Disables the use of of prefetch range cache operations by setting RV bit in Auxiliary Ctrl Reg. -// 2) Replaces Invalidate ICache operation with the sequence defined in the errata document. -// If this macro is enabled, it should be accompanied by: -// "GBLL CFG_CPU_ARM1136_ERRATUM_411920_FIXED" in variant.mmh -// -//macro __CPU_ARM1136_ERRATUM_411920_FIXED - - - -macro __CPU_HAS_VFP -#define USE_VFP_MATH -// !@! not moving when 1136 -//#define MM_MOVING -macro __DEBUGGER_SUPPORT__ -macro FASTTRACE_KERNEL_ALL -macro __EMI_SUPPORT__ - -#define VariantTarget(name,ext) _syborg_##name##.##ext -#define AsspNKernIncludePath \..\..\src\cedar\generic\base\syborg\specific -#define VariantMediaDefIncludePath AsspNKernIncludePath -#define PlatformLib kasyborg.lib - -systeminclude \epoc32\include\memmodel\epoc\mmubase -//systeminclude \epoc32\include\memmodel\epoc\moving -//systeminclude \epoc32\include\memmodel\epoc\moving\arm -//systeminclude \epoc32\include\memmodel\epoc\flexible -//systeminclude \epoc32\include\memmodel\epoc\flexible\arm -systeminclude \epoc32\include\memmodel\epoc\multiple -systeminclude \epoc32\include\memmodel\epoc\multiple\arm - -systeminclude ..\soc\interface - -// Uncomment for T_USERCOMDEB test -//#define BUILD_TESTS - -#ifdef BUILD_TESTS -macro BTRACE_KERNEL_ALL -#endif - -//OPTION_REPLACE ARMCC --cpu __CPU__ -//OPTION_REPLACE ARMASM --cpu __CPU__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/armv5.mbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/armv5.mbc Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +SECTION_COMMANDS + +bldmake bldfiles armv5 +abld export + +abld makefile armv5 +abld reallyclean armv5 + +bldmake bldfiles armv5 +abld export + +abld makefile armv5 +abld library armv5 +abld -k target armv5 + +SECTION_DIRS +..\e32utils\group +..\e32 +..\e32\compsupp +..\f32\group +..\hal +..\syborg +..\domain\group + +..\e32\drivers\pbus\mmc\sdcard\sdcard3c +..\e32\drivers\pbus\mmc\sdcard\sdcard4c + +..\e32\drivers\usbho +..\e32\drivers\usbho\usbd + +..\e32\drivers\bsp +..\e32\drivers\debug +..\e32\drivers\ecomm +..\e32\drivers\esound +..\e32\drivers\ethernet +..\e32\drivers\locmedia +..\e32\drivers\media +..\e32\drivers\trace +..\e32\drivers\usbc +..\e32\euser +..\e32\ewsrv + +..\f32\estart +..\f32\etshell +..\f32\iso9660 +..\f32\ntfs +..\f32\scomp +..\f32\sfat +..\f32\sfat32 +..\f32\sftl +..\f32\slffs +..\f32\smassstorage +..\f32\srofs +..\f32\srom + +..\e32test\group +..\syborg\test diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/armv5test.mbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/armv5test.mbc Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +SECTION_COMMANDS + +bldmake bldfiles armv5 +abld export +abld test export + +abld makefile armv5 +abld test makefile armv5 +abld reallyclean armv5 +abld test reallyclean armv5 + +bldmake bldfiles armv5 +abld export + +abld makefile armv5 +abld test makefile armv5 +abld library armv5 +abld test library armv5 +abld -k target armv5 +abld test -k target armv5 + +SECTION_DIRS +..\e32test\group +..\syborg\test diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/base.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/base.iby Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __BASE_IBY__ +#define __BASE_IBY__ + +REM Base operating system, including all assp-specific files + +#if defined(__MISA__) +#include +#elif defined(__MI920__) +#include +#elif defined(__NI1136__) +#include +#elif defined(__MCOT__) +#include +#elif defined(__TEMPLATE__) +#include +#elif defined(__MOMAP16XX_H2__) +#include +#elif defined(__MOMAP24XX_H4HRP__) +#include +#elif defined(__X86PCHRP__) +#include +#elif defined(__NE1_TB__) +#include +#elif defined(__SYBORG__) +#include +#endif + +#include + +file=ABI_DIR\DEBUG_DIR\EUSER_DLL \sys\bin\EUser.dll +file=ABI_DIR\DEBUG_DIR\RPIPE.DLL \sys\bin\rpipe.dll + +file=ABI_DIR\DEBUG_DIR\ektran.dll \sys\bin\EKTran.dll +file=ABI_DIR\DEBUG_DIR\HAL_DLL \sys\bin\Hal.dll + +#ifndef SYMBIAN_EXCLUDE_KEYMAP +file=ABI_DIR\DEBUG_DIR\KEYMAP_FILE.dll \sys\bin\EKData.dll +#endif //SYMBIAN_EXCLUDE_KEYMAP + +secondary=ABI_DIR\DEBUG_DIR\efile.exe \sys\bin\efile.exe FIXED HEAPMAX(0x40000) +file=ABI_DIR\DEBUG_DIR\efsrv.dll \sys\bin\EFSrv.dll + +#ifndef CUSTOM_ELOCAL +#ifdef WITH_FAT32 +file=ABI_DIR\DEBUG_DIR\efat32.fsy \sys\bin\ELocal.fsy +#else +file=ABI_DIR\DEBUG_DIR\elocal.fsy \sys\bin\ELocal.fsy +#endif +#endif + +#ifdef WITH_LFFS +file=ABI_DIR\DEBUG_DIR\elffs.fsy \sys\bin\ELffs.fsy +#endif + +#ifdef WITH_NAND +file=ABI_DIR\BUILD_DIR\nandftl.fxt \sys\bin\nandftl.fxt +file=ABI_DIR\BUILD_DIR\ecomp.fsy \sys\bin\ecomp.fsy +file=ABI_DIR\BUILD_DIR\erofs.fsy \sys\bin\erofs.fsy +#endif + +#ifdef WITH_NAND2 +file=ABI_DIR\BUILD_DIR\ecomp.fsy \sys\bin\ecomp.fsy +file=ABI_DIR\BUILD_DIR\erofs.fsy \sys\bin\erofs.fsy +#endif + +#ifdef WITH_ISO9660 +file=ABI_DIR\DEBUG_DIR\iso9660.fsy \sys\bin\Iso9660.fsy +#endif + +#ifdef WITH_NTFS +file=ABI_DIR\DEBUG_DIR\ntfs.fsy \sys\bin\Ntfs.fsy +#endif + +#ifdef WITH_MASS_STORAGE +file=ABI_DIR\DEBUG_DIR\msfs.fsy \sys\bin\msfs.fsy +#endif + +file=ABI_DIR\DEBUG_DIR\ESTART_EXE \sys\bin\EStart.exe HEAPMAX(0x10000) + +file=ABI_DIR\DEBUG_DIR\domainSrv.exe \sys\bin\domainSrv.exe +file=ABI_DIR\DEBUG_DIR\domainCli.dll \sys\bin\domainCli.dll +file=ABI_DIR\DEBUG_DIR\domainPolicy.dll \sys\bin\domainPolicy.dll + +#if defined(_NAND) || defined(_NAND2) +#if !defined PAGED_ROM || defined EFFICIENT_ROM_PAGING || defined CODE_PAGING_FROM_ROFS +REM Start of ROFS image +ROM_IMAGE[1] { +#endif +#endif + +#ifndef SYMBIAN_EXCLUDE_D_EXC +file=ABI_DIR\DEBUG_DIR\d_exc.exe \sys\bin\d_exc.exe +#endif //SYMBIAN_EXCLUDE_D_EXC + +#ifndef SYMBIAN_EXCLUDE_SCDV +file=ABI_DIR\DEBUG_DIR\SCDV_DLL \sys\bin\ScDv.dll +#endif // SYMBIAN_EXCLUDE_SCDV + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/bld.inf Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +PRJ_PLATFORMS +ARMV5 + +PRJ_EXPORTS +syborg.oby \epoc32\rom\include\ // +base.iby \epoc32\rom\include\ // +rom\base_syborg.iby \epoc32\rom\include\ // +rom\header.iby \epoc32\rom\syborg\ // +rom\kernel.iby \epoc32\rom\syborg\ // +specific\syborg.cfg \epoc32\rom\syborg\ // +estart.txt \epoc32\rom\syborg\ // +trk_l1.ini \epoc32\data\Z\trk\trk_syborg.ini + +PRJ_EXTENSIONS +start extension base/genexec +option EXTRA_SRC_PATH $(TO_BLDINF)/../e32/kernel +end + +PRJ_MMPFILES +..\e32\kernel\ekern +..\e32\kernel\kc_exe +..\e32\kernel\exmoncommon +..\e32\drivers\medint\medint +..\f32\etshell\eshell +..\e32\drivers\trace\btracex +..\e32\euser\variant_euser + +// SYBORG components +kasyborg // Variant library +serial\serial // Serial / UART ports +fb\fb // Framebuffer +keyboard\keyboard // Keyboard +pointer\pointer // Pointer +monitor\monap // Crash Debugger output + +keymap\keymap // Key mapping library + +// platform device library - for flattened device tree (FDT) +svpplatform\fdt + +//Host Filesystem +svphostfs\svphostfs +svphostfs\svphostfsdriver +svphostfs\svphostfsstart +svphostfs\svphostfsy + +//Snap Device +svpsnapdriver\svpsnapdriver +svpsnapdriver\snapapp + +PRJ_EXTENSIONS +start extension base/config +option PREFIX _syborg_ +option HALPATH $(TO_BLDINF)/.. +option SOURCE $(TO_BLDINF)/hal +end + +PRJ_MMPFILES +hal\hal + +PRJ_EXTENSIONS +start extension base/bootstrap +option NAME _syborg_bootloader_bootrom +option MEMMODEL multiple +//option MEMMODEL flexible +//option MEMMODEL moving +option SOURCES syborg.s +option INCLUDES config.inc syborg.inc +option E32PATH $(TO_BLDINF)/.. +option EXTRA_INC_PATH $(TO_BLDINF)/bootstrap +option EXTRA_SRC_PATH $(TO_BLDINF)/bootstrap +end diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/bootstrap/syborg.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/bootstrap/syborg.inc Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,77 @@ +;/* +;* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +;* 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: +;* Nokia Corporation - initial contribution. +;* +;* Contributors: +;* +;* Description: +;* +;*/ + +;--------------------------------------------------------------------------- +; Physical Addresses of Memory +;--------------------------------------------------------------------------- + +KHwRamBaseAddr EQU 0x00000000 +KHwRamSizeMb EQU 128 ; 128MB + +KHwNorFlashBaseAddr EQU 0x40000000 +KHwNorFlashSize EQU 0x04000000 ; 64MB +KHwNorFlashCodeSize EQU 0x02000000 ; 32MB for code, 32MB for LFFS + +;--------------------------------------------------------------------------- +; Physical Addresses of Peripherals +;--------------------------------------------------------------------------- + +KHwBaseRegisters EQU 0xC0000000 + +KHwBaseSic EQU KHwBaseRegisters + 0x00000 +KHwBaseRtc EQU KHwBaseRegisters + 0x01000 +KHwBaseTimer EQU KHwBaseRegisters + 0x02000 +KHwBaseKmiKeyboard EQU KHwBaseRegisters + 0x03000 +KHwBaseKmiPointer EQU KHwBaseRegisters + 0x04000 +KHwBaseClcd EQU KHwBaseRegisters + 0x05000 +KHwBaseUart0 EQU KHwBaseRegisters + 0x06000 +KHwBaseUart1 EQU KHwBaseRegisters + 0x07000 +KHwBaseUart2 EQU KHwBaseRegisters + 0x08000 +KHwBaseUart3 EQU KHwBaseRegisters + 0x09000 +KHwBaseHostFs EQU KHwBaseRegisters + 0x0a000 +KHwBaseSnap EQU KHwBaseRegisters + 0x0b000 +KHwBaseNet EQU KHwBaseRegisters + 0x0c000 +KHwBaseNand EQU KHwBaseRegisters + 0x0d000 +KHwBaseAudio EQU KHwBaseRegisters + 0x0e000 +KHwBasePlatform EQU KHwBaseRegisters + 0x0f000 +;----------------------------------------------------------------------------- +; Module linear bases +;----------------------------------------------------------------------------- + +; Register group linear separation: 4K +KHwLinSeparation EQU 0x1000 + +KHwLinBaseRegisters EQU KPrimaryIOBase + +KHwLinBaseSic EQU KHwLinBaseRegisters + 0x00*KHwLinSeparation +KHwLinBaseRtc EQU KHwLinBaseRegisters + 0x01*KHwLinSeparation +KHwLinBaseTimer EQU KHwLinBaseRegisters + 0x02*KHwLinSeparation +KHwLinBaseKmiKeyboard EQU KHwLinBaseRegisters + 0x03*KHwLinSeparation +KHwLinBaseKmiPointer EQU KHwLinBaseRegisters + 0x04*KHwLinSeparation +KHwLinBaseClcd EQU KHwLinBaseRegisters + 0x05*KHwLinSeparation +KHwLinBaseUart0 EQU KHwLinBaseRegisters + 0x06*KHwLinSeparation +KHwLinBaseUart1 EQU KHwLinBaseRegisters + 0x07*KHwLinSeparation +KHwLinBaseUart2 EQU KHwLinBaseRegisters + 0x08*KHwLinSeparation +KHwLinBaseUart3 EQU KHwLinBaseRegisters + 0x09*KHwLinSeparation +KHwLinBaseHostFs EQU KHwLinBaseRegisters + 0x0a*KHwLinSeparation +KHwLinBaseSnap EQU KHwLinBaseRegisters + 0x0b*KHwLinSeparation +KHwLinBaseNet EQU KHwLinBaseRegisters + 0x0c*KHwLinSeparation +KHwLinBaseNand EQU KHwLinBaseRegisters + 0x0d*KHwLinSeparation +KHwLinBaseAudio EQU KHwLinBaseRegisters + 0x0e*KHwLinSeparation +KHwLinBasePlatform EQU KHwLinBaseRegisters + 0x0f*KHwLinSeparation + + END diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/bootstrap/syborg.s --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/bootstrap/syborg.s Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,603 @@ +;/* +;* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +;* 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: +;* Nokia Corporation - initial contribution. +;* +;* Contributors: +;* +;* Description: +;* +;*/ + + GBLL __VARIANT_S__ ; indicates that this is platform-specific code + GBLL __SYBORG_S__ ; indicates which source file this is + + INCLUDE bootcpu.inc + INCLUDE syborg.inc +; +;******************************************************************************* +; + IMPORT ResetEntry +; +;******************************************************************************* +; + AREA |Boot$$Code|, CODE, READONLY, ALIGN=6 +; +;******************************************************************************* +; Initialise Hardware +; Determine the hardware configuration +; Determine the reset reason. If it is wakeup from a low power mode, perform +; whatever reentry sequence is required and jump back to the kernel. +; Set up the memory controller so that at least some RAM is available +; Set R10 to point to the super page or to a temporary version of the super page +; with at least the following fields valid: +; iBootTable, iCodeBase, iActiveVariant, iCpuId +; Initialise the debug serial port +; +; Enter with: +; R12 points to TRomHeader +; NO STACK +; R14 = return address (as usual) +; +; All registers may be modified by this call +;******************************************************************************* + EXPORT InitialiseHardware +InitialiseHardware ROUT + mov r13, lr ; save return address + + adrl r1, ParameterTable ; pass address of parameter table + bl InitCpu ; initialise CPU/MMU registers + +;******************************************************************************* +; DoInitialise Hardware +; Initialise CPU registers +; Determine the hardware configuration +; Determine the reset reason. If it is wakeup from a low power mode, perform +; whatever reentry sequence is required and jump back to the kernel. +; Set up the memory controller so that at least some RAM is available +; Set R10 to point to the super page or to a temporary version of the super page +; with at least the following fields valid: +; iBootTable, iCodeBase, iActiveVariant, iCpuId +; In debug builds initialise the debug serial port +; +; Enter with: +; R12 points to TRomHeader +; NO STACK +; R13 = return address (as usual) +; +; All registers may be modified by this call +;******************************************************************************* +DoInitialiseHardware ROUT + +; Hardware memory size is 128MB - 32MB reserved for bootloader + mov r4, #KHwRamSizeMb + + bl InitDebugPort + + ldr r7, =CFG_HWVD ; variant number + + lsl r10, r4, #20 ; R10 = top of RAM + sub r10, #0x2000 ; put super page at end for now + +; Set up the required super page values + str r7, [r10, #SSuperPageBase_iActiveVariant] + + mov r1, #0 + str r1, [r10, #SSuperPageBase_iHwStartupReason] ; reset reason (from hardware) + + add r1, r10, #CpuPageOffset + str r1, [r10, #SSuperPageBase_iMachineData] + bl GetBootTableAddress + str r0, [r10, #SSuperPageBase_iBootTable] ; set the boot function table + str r12, [r10, #SSuperPageBase_iCodeBase] ; set the base address of bootstrap code + mrc p15, 0, r0, c0, c0, 0 ; read CPU ID from CP15 (remove if no CP15) + str r0, [r10, #SSuperPageBase_iCpuId] + + mov r0, r13 + add sp, r10, #CpuBootStackTop ; set up a boot stack + push {r0} ; save return address + bl DoInitHw2 ; any extra CPU-dependent stuff + + ldr r7, [r10, #SSuperPageBase_iActiveVariant] + DWORD r7, "ActiveVariant" + + pop {pc} ; return + +;******************************************************************************* +DoInitHw2 ROUT + mrc p15, 0, r0, c0, c0, 0 + DWORD r0, "MMUID" + mrc p15, 0, r0, c0, c0, 1 + DWORD r0, "CacheType" + mrc p15, 0, r0, c0, c0, 2 + DWORD r0, "TCMType" + mrc p15, 0, r0, c0, c0, 3 + DWORD r0, "TLBType" + bx lr + +;******************************************************************************* +; Get a pointer to the list of hardware banks +; +; The pointer returned should point to a list of hardware banks declared with +; the HW_MAPPING and/or HW_MAPPING_EXT macros. A zero word terminates the list. +; For the direct memory model, all hardware on the system should be mapped here +; and the mapping will set linear address = physical address. +; For the moving or multiple model, only the hardware required to boot the kernel +; and do debug tracing needs to be mapped here. The linear addresses used will +; start at KPrimaryIOBase and step up as required with the order of banks in +; the list being maintained in the linear addresses used. +; +; HW_MAPPING PB, SIZE, MULT +; This declares a block of I/O with physical base PB and address range SIZE +; blocks each of which has a size determined by MULT. The page size used for +; the mapping is determined by MULT. The linear address base of the mapping +; will be the next free linear address rounded up to the size specified by +; MULT. +; The permissions used for the mapping are the standard I/O permissions (BTP_Hw). +; +; HW_MAPPING_EXT PB, SIZE, MULT +; This declares a block of I/O with physical base PB and address range SIZE +; blocks each of which has a size determined by MULT. The page size used for +; the mapping is determined by MULT. The linear address base of the mapping +; will be the next free linear address rounded up to the size specified by +; MULT. +; The permissions used for the mapping are determined by a BTP_ENTRY macro +; immediately following this macro in the HW bank list or by a DCD directive +; specifying a different standard permission type. +; +; Configurations without an MMU need not implement this function. +; +; Enter with : +; R10 points to super page +; R12 points to ROM header +; R13 points to valid stack +; +; Leave with : +; R0 = pointer +; Nothing else modified +;******************************************************************************* + EXPORT GetHwBanks +GetHwBanks ROUT + adr r0, %FT1 + bx lr +1 + HW_MAPPING KHwBaseSic, 1, HW_MULT_4K + HW_MAPPING KHwBaseRtc, 1, HW_MULT_4K + HW_MAPPING KHwBaseTimer, 1, HW_MULT_4K + HW_MAPPING KHwBaseKmiKeyboard, 1, HW_MULT_4K + HW_MAPPING KHwBaseKmiPointer, 1, HW_MULT_4K + HW_MAPPING KHwBaseClcd, 1, HW_MULT_4K + HW_MAPPING KHwBaseUart0, 1, HW_MULT_4K + HW_MAPPING KHwBaseUart1, 1, HW_MULT_4K + HW_MAPPING KHwBaseUart2, 1, HW_MULT_4K + HW_MAPPING KHwBaseUart3, 1, HW_MULT_4K + HW_MAPPING KHwBaseHostFs, 1, HW_MULT_4K + HW_MAPPING KHwBaseSnap, 1, HW_MULT_4K + HW_MAPPING KHwBaseNet, 1, HW_MULT_4K + HW_MAPPING KHwBaseNand, 1, HW_MULT_4K + HW_MAPPING KHwBaseAudio, 1, HW_MULT_4K + HW_MAPPING KHwBasePlatform, 8, HW_MULT_4K + + DCD 0 ; terminator + +;******************************************************************************* +; Notify an unrecoverable error during the boot process +; +; Enter with: +; R14 = address at which fault detected +; +; Don't return +;******************************************************************************* + EXPORT Fault +Fault ROUT + b BasicFaultHandler ; generic handler dumps registers via debug + ; serial port + +;******************************************************************************* +; Reboot the system +; +; Enter with: +; R0 = reboot reason code +; +; Don't return (of course) +;******************************************************************************* + ALIGN 32, 0 + EXPORT RestartEntry +RestartEntry ROUT + +; Save R0 parameter in HW dependent register which is preserved over reset +; Put HW specific code here to reset system + GETCPSR r1 + orr r1, #0xC0 + SETCPSR r1 ; disable interrupts + + ldr r10, =KSuperPageLinAddr + adr r0, Run_Physical + bl RomLinearToPhysical ; physical address in r0 + +; Disable MMU + mrc p15, 0, r1, c1, c0, 0 ; get MMUCR + bic r1, #MMUCR_M ; clear M bit + mcr p15, 0, r1, c1, c0, 0 ; set MMUCR + bx r0 ; jump to the physical address + +; Now running from physical address + +Run_Physical + mov r3, #KHwNorFlashBaseAddr ; r3 = NOR flash image base + +; Jump to the NOR flash image + bx r3 + +;******************************************************************************* +; Get a pointer to the list of RAM banks +; +; The pointer returned should point to a list of {BASE; MAXSIZE;} pairs, where +; BASE is the physical base address of the bank and MAXSIZE is the maximum +; amount of RAM which may be present in that bank. MAXSIZE should be a power of +; 2 and BASE should be a multiple of MAXSIZE. The generic code will examine the +; specified range of addresses and determine the actual amount of RAM if any +; present in the bank. The list is terminated by an entry with zero size. +; +; The pointer returned will usually be to constant data, but could equally well +; point to RAM if dynamic determination of the list is required. +; +; Enter with : +; R10 points to super page +; R12 points to ROM header +; R13 points to valid stack +; +; Leave with : +; R0 = pointer +; Nothing else modified +;******************************************************************************* + EXPORT GetRamBanks +GetRamBanks ROUT + push {r1-r3,lr} + mov r0, #KHwRamSizeMb + lsl r2, r0, #20 ; R2 = RAM size in bytes + mov r1, #KHwRamBaseAddr ; R1 = base address of usable RAM area + sub r2, r1 ; R2 = size of usable RAM area + orr r1, #RAM_VERBATIM ; prevent testing (overlay would break it) + mov r3, #0 + mov lr, #0 ; terminator + add r0, r10, #CpuPageOffset ; + stm r0, {r1-r3,lr} ; store single bank descriptor and terminator + pop {r1-r3,pc} + +;******************************************************************************* +; Get a pointer to the list of ROM banks +; +; The pointer returned should point to a list of entries of SRomBank structures, +; usually declared with the ROM_BANK macro. +; The list is terminated by a zero size entry (four zero words) +; +; ROM_BANK PB, SIZE, LB, W, T, RS, SS +; PB = physical base address of bank +; SIZE = size of bank +; LB = linear base if override required - usually set this to 0 +; W = bus width (ROM_WIDTH_8, ROM_WIDTH_16, ROM_WIDTH_32) +; T = type (see TRomType enum in kernboot.h) +; RS = random speed +; SS = sequential speed +; +; Only PB, SIZE, LB are used by the rest of the bootstrap. +; The information given here can be modified by the SetupRomBank call, if +; dynamic detection and sizing of ROMs is required. +; +; Enter with : +; R10 points to super page +; R12 points to ROM header +; R13 points to valid stack +; +; Leave with : +; R0 = pointer +; Nothing else modified +;******************************************************************************* + EXPORT GetRomBanks +GetRomBanks ROUT + adr r0, RomBanksFlashTable ; NOR flash + bx lr + +RomBanksFlashTable + ROM_BANK KHwNorFlashBaseAddr, KHwNorFlashCodeSize, 0, ROM_WIDTH_32, ERomTypeXIPFlash, 0, 0 + DCD 0,0,0,0 ; terminator + +;******************************************************************************* +; Set up RAM bank +; +; Do any additional RAM controller initialisation for each RAM bank which wasn't +; done by InitialiseHardware. +; Called twice for each RAM bank :- +; First with R3 = 0xFFFFFFFF before bank has been probed +; Then, if RAM is present, with R3 indicating validity of each byte lane, ie +; R3 bit 0=1 if D0-7 are valid, bit1=1 if D8-15 are valid etc. +; For each call R1 specifies the bank physical base address. +; +; Enter with : +; R10 points to super page +; R12 points to ROM header +; R13 points to stack +; R1 = physical base address of bank +; R3 = width (bottom 4 bits indicate validity of byte lanes) +; 0xffffffff = preliminary initialise +; +; Leave with : +; No registers modified +;******************************************************************************* + EXPORT SetupRamBank +SetupRamBank ROUT + bx lr + +;******************************************************************************* +; Set up ROM bank +; +; Do any required autodetection and autosizing of ROMs and any additional memory +; controller initialisation for each ROM bank which wasn't done by +; InitialiseHardware. +; +; The first time this function is called R11=0 and R0 points to the list of +; ROM banks returned by the BTF_RomBanks call. This allows any preliminary setup +; before autodetection begins. +; +; This function is subsequently called once for each ROM bank with R11 pointing +; to the current information held about that ROM bank (SRomBank structure). +; The structure pointed to by R11 should be updated with the size and width +; determined. The size should be set to zero if there is no ROM present in the +; bank. +; +; Enter with : +; R10 points to super page +; R12 points to ROM header +; R13 points to stack +; R11 points to SRomBank info for this bank +; R11 = 0 for preliminary initialise (all banks) +; +; Leave with : +; Update SRomBank info with detected size/width +; Set the size field to 0 if the ROM bank is absent +; Can modify R0-R4 but not other registers +; +;******************************************************************************* + EXPORT SetupRomBank +SetupRomBank ROUT ; only get here if running from ROM + cmp r11, #0 + bxeq lr ; don't do anything for preliminary + ldm r11, {r0,r1} ; r0 = base, r1 = size + lsr r0, pc, #20 + lsl r0, #20 ; r0 = image base + ldr r1, [r12, #TRomHeader_iRomSize] ; r1 = size of ROM block + stm r11, {r0,r1} + bx lr + +;******************************************************************************* +; Reserve physical memory +; +; Reserve any physical RAM needed for platform-specific purposes before the +; bootstrap begins allocating RAM for page tables/kernel data etc. +; +; There are two methods for this: +; 1. The function ExciseRamArea may be used. This will remove a contiguous +; region of physical RAM from the RAM bank list. That region will never +; again be identified as RAM. +; 2. A list of excluded physical address ranges may be written at [R11]. +; This should be a list of (base,size) pairs terminated by a (0,0) entry. +; This RAM will still be identified as RAM by the kernel but will not +; be allocated by the bootstrap and will subsequently be marked as +; allocated by the kernel immediately after boot. +; +; Enter with : +; R10 points to super page +; R11 indicates where preallocated RAM list should be written. +; R12 points to ROM header +; R13 points to stack +; +; Leave with : +; R0-R3 may be modified. Other registers should be preserved. +;******************************************************************************* + EXPORT ReservePhysicalMemory +ReservePhysicalMemory ROUT + bx lr + +;******************************************************************************* +; Do final platform-specific initialisation before booting the kernel +; +; Typical uses for this call would be: +; 1. Mapping cache flushing areas +; 2. Setting up pointers to routines in the bootstrap which are used by +; the variant or drivers (eg idle code). +; +; Enter with : +; R10 points to super page +; R11 points to TRomImageHeader for the kernel +; R12 points to ROM header +; R13 points to stack +; +; Leave with : +; R0-R9 may be modified. Other registers should be preserved. +; +;******************************************************************************* + EXPORT FinalInitialise +FinalInitialise ROUT + bx lr + +;******************************************************************************* +; Debug port write routine associated with debug port in the super page +; Enter with : +; R0 character to be written +; R12 points to rom header +; R13 points to valid stack +; +; Leave with : +; nothing modified +;******************************************************************************* + EXPORT DoWriteC +DoWriteC ROUT + IF CFG_DebugBootRom + push {r1,lr} + bl GetDebugPortBase ; r1 = base address of UART registers + + str r0, [r1, #4] ; Store to data register + + pop {r1,pc} + ELSE + bx lr + ENDIF + +;******************************************************************************* +; Initialise the debug port +; +; Enter with : +; R12 points to ROM header +; There is no valid stack +; +; Leave with : +; R0-R2 modified +; Other registers unmodified +;******************************************************************************* +InitDebugPort ROUT + GET_ADDRESS r1, KHwBaseUart0, KHwLinBaseUart0 + ldr r0,[r1, #0] + bx lr + +;******************************************************************************* +; Get the base address of the debug UART +; +; Enter with : +; R12 points to ROM header +; There may be no stack +; +; Leave with : +; R1 = base address of port, 0 for JTAG +; Z flag set for JTAG, clear for non-JTAG +; No other registers modified +;******************************************************************************* +GetDebugPortBase ROUT + ldr r1, [r12, #TRomHeader_iDebugPort] + cmp r1, #42 ; JTAG? + movseq r1, #0 + bxeq lr ; yes - return 0 and set Z + cmp r1, #1 + blo GetUartPort0 + beq GetUartPort1 + cmp r1, #3 + blo GetUartPort2 + beq GetUartPort3 +GetUartPort0 + GET_ADDRESS r1, KHwBaseUart0, KHwLinBaseUart0 + movs r1, r1 ; clear Z + bx lr + +GetUartPort1 + GET_ADDRESS r1, KHwBaseUart1, KHwLinBaseUart1 + movs r1, r1 ; clear Z + bx lr + +GetUartPort2 + GET_ADDRESS r1, KHwBaseUart2, KHwLinBaseUart2 + movs r1, r1 ; clear Z + bx lr + +GetUartPort3 + GET_ADDRESS r1, KHwBaseUart3, KHwLinBaseUart3 + movs r1, r1 ; clear Z + bx lr + +;******************************************************************************* +; Return parameter specified by R0 (see TBootParam enum) +; +; Enter with : +; R0 = parameter number +; +; Leave with : +; If parameter value is supplied, R0 = value and N flag clear +; If parameter value is not supplied, N flag set. In this case the +; parameter may be defaulted or the system may fault. +; R0, R1 modified. No other registers modified. +; +;******************************************************************************* +GetParameters ROUT + adr r1, ParameterTable + b FindParameter + +ParameterTable + DCD -1 ; terminator + +;******************************************************************************* +; BOOT FUNCTION TABLE +;******************************************************************************* +GetBootTableAddress ROUT + adr r0, SyborgBootTable + bx lr + +SyborgBootTable + DCD DoWriteC ; output a debug character + DCD GetRamBanks ; get list of RAM banks + DCD SetupRamBank ; set up a RAM bank + DCD GetRomBanks ; get list of ROM banks + DCD SetupRomBank ; set up a ROM bank + DCD GetHwBanks ; get list of HW banks + DCD ReservePhysicalMemory ; reserve physical RAM if required + DCD GetParameters ; get addresses for direct memory model + DCD FinalInitialise ; Final initialisation before booting the kernel + DCD HandleAllocRequest ; allocate memory (usually in generic code) + DCD GetPdeValue ; usually in generic code + DCD GetPteValue ; usually in generic code + DCD PageTableUpdate ; usually in generic code + DCD EnableMmu ; Enable the MMU (usually in generic code) + +; These entries specify the standard MMU permissions for various areas + + IF CFG_MMMultiple +; IF CFG_MMFlexible + IF CFG_ARMV7 + BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, MEMORY_FULLY_CACHED, 1, 1, 0, 0 ; ROM + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; kernel data/stack/heap + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; super page/CPU page + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; page directory/tables + BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, MEMORY_FULLY_CACHED, 1, 1, 0, 0 ; exception vectors + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_STRONGLY_ORDERED, 0, 1, 0, 0 ; hardware registers + DCD 0 ; unused (minicache flush) + DCD 0 ; unused (maincache flush) + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, MEMORY_FULLY_CACHED, 0, 1, 0, 0 ; page table info + BTP_ENTRY CLIENT_DOMAIN, PERM_RWRW, MEMORY_FULLY_CACHED, 1, 1, 0, 0 ; user RAM + BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, MEMORY_STRONGLY_ORDERED, 1, 1, 0, 0 ; temporary identity mapping + BTP_ENTRY CLIENT_DOMAIN, UNC_PERM, MEMORY_STRONGLY_ORDERED, 0, 1, 0, 0 ; uncached + ENDIF + IF CFG_ARMV6 + BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_WBWA, 1, 1, 0, 0 ; ROM + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; kernel data/stack/heap + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; super page/CPU page + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; page directory/tables + BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, CACHE_WTRA, 1, 1, 0, 0 ; exception vectors + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_SO, 0, 1, 0, 0 ; hardware registers + DCD 0 ; unused (minicache flush) + DCD 0 ; unused (maincache flush) + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WBWA, 0, 1, 0, 0 ; page table info + BTP_ENTRY CLIENT_DOMAIN, PERM_RWRW, CACHE_WBWA, 1, 1, 0, 0 ; user RAM + BTP_ENTRY CLIENT_DOMAIN, PERM_RONO, CACHE_SO, 1, 1, 0, 0 ; temporary identity mapping + BTP_ENTRY CLIENT_DOMAIN, UNC_PERM, CACHE_SO, 0, 1, 0, 0 ; uncached + ENDIF + ENDIF + IF CFG_MMMoving + BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_WT ; ROM + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WB ; kernel data/stack/heap + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WB ; super page/CPU page + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WT ; page directory/tables + BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_WT ; exception vectors + BTP_ENTRY CLIENT_DOMAIN, PERM_RWRO, CACHE_NCNB ; hardware registers + DCD 0 ; unused (minicache flush) + DCD 0 ; unused (maincache flush) + BTP_ENTRY CLIENT_DOMAIN, PERM_RWNO, CACHE_WB ; page table info + BTP_ENTRY CLIENT_DOMAIN, PERM_RWRW, CACHE_WB ; user RAM + BTP_ENTRY CLIENT_DOMAIN, PERM_RORO, CACHE_NCNB ; temporary identity mapping + BTP_ENTRY CLIENT_DOMAIN, UNC_PERM, CACHE_NCNB ; uncached + ENDIF + + END diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/config.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/config.inc Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,78 @@ +;/* +;* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +;* 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: +;* Nokia Corporation - initial contribution. +;* +;* Contributors: +;* +;* Description: +;* +;*/ + +; Include to enable tracing +; GBLL CFG_DebugBootRom + +; Include one of these to select the CPU +; GBLL CFG_CPU_ARM926J +; GBLL CFG_CPU_ARM1136 + GBLL CFG_CPU_CORTEX_A8N +; GBLL CFG_CPU_ARM1136_ERRATUM_399234_FIXED +; GBLL CFG_CPU_ARM1136_ERRATUM_411920_FIXED +; Include the following lines if this is a bootloader bootstrap +; GBLL CFG_BootLoader + +; If you want to supply a custom set of initial vectors (including reset vector) include the following line +; GBLL CFG_CustomVectors +; +; and provide a custom_vectors.inc file + +; On ARM architecture 6 processors, include the following line to override the threshold +; on total physical RAM size at which the multiple memory model switches into large address space mode +; i.e. size>threshold -> 2Gb per process, size<=threshold -> 1Gb per process +; Defaults to 32Mb. +; INIT_NUMERIC_CONSTANT CFG_ARMV6_LARGE_CONFIG_THRESHOLD, + +; For the direct memory model only, include the following line if you wish the exception vectors at the +; start of the bootstrap to be used at all times. This is only relevant if an MMU is present - this option +; is mandatory if not. +; GBLL CFG_UseBootstrapVectors +; +; If the above option is in use (including if no MMU is present) the following symbol should be defined +; to specify the offset from the bootstrap to the kernel image. +; INIT_NUMERIC_CONSTANT KernelCodeOffset, 0x4000 + +; Include the following line if you wish to include the ROM autodetection code based on data bus +; capacitance and image repeats. +; GBLL CFG_AutoDetectROM + +; Include the following line to minimise the initial kernel heap size +; On the direct memory model the size of the kernel data area (super page to end of kernel heap) +; is rounded up to the next 1Mb if this is not included, 4K if it is. +; On the moving and multiple models, the size of the initial kernel heap area is rounded up to +; the next 64K if this is not included, 4K if it is. +; GBLL CFG_MinimiseKernelHeap + +; On the moving or multiple memory models, include either or both of the following lines to +; specify the size of the initial kernel heap +; INIT_NUMERIC_CONSTANT CFG_KernelHeapMultiplier, +; INIT_NUMERIC_CONSTANT CFG_KernelHeapBaseSize, +; +; The initial kernel heap size is MAX( + * N / 16, value specified in ROMBUILD ) +; where N is the total physical RAM size in pages. +; defaults to 24K and defaults to 9*16 (ie 9 bytes per page). + +; Specific stuff for integrator +; GBLL CFG_Integrator_DontSetClock + INIT_NUMERIC_CONSTANT CFG_HWVD, 0x0B0A0001 + +; Copy NOR Flash image to SDRAM + GBLL CFG_CopyFlashToRam + + + END diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/eabi/kasyborg.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/eabi/kasyborg.def Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,39 @@ +EXPORTS + _Z17VariantInitialisev @ 1 NONAME + _Z14AsicInitialisev @ 2 NONAME + _ZN6Syborg11DebugOutputEj @ 3 NONAME + _ZN6Syborg12MsTickPeriodEv @ 4 NONAME + _ZN6Syborg13StartupReasonEv @ 5 NONAME + _ZN6Syborg27SystemTimeInSecondsFrom2000ERi @ 6 NONAME + _ZN6Syborg30SetSystemTimeInSecondsFrom2000Ei @ 7 NONAME + _ZN6Syborg5Init1Ev @ 8 NONAME + _ZN6Syborg5Init3Ev @ 9 NONAME + _ZN6Syborg9DebugInitEv @ 10 NONAME + _ZN6SyborgC1Ev @ 11 NONAME + _ZN6SyborgC2Ev @ 12 NONAME + _ZN7TSyborg10DisableIntEj @ 13 NONAME + _ZN7TSyborg10TimerValueEj @ 14 NONAME + _ZN7TSyborg11EnableTimerEjNS_6TStateE @ 15 NONAME + _ZN7TSyborg12SetTimerLoadEjm @ 16 NONAME + _ZN7TSyborg12SetTimerModeEjNS_10TTimerModeE @ 17 NONAME + _ZN7TSyborg12VideoRamPhysEv @ 18 NONAME + _ZN7TSyborg12VideoRamSizeEv @ 19 NONAME + _ZN7TSyborg13ClearTimerIntEj @ 20 NONAME + _ZN7TSyborg13DebugPortAddrEv @ 21 NONAME + _ZN7TSyborg14IsTimerEnabledEj @ 22 NONAME + _ZN7TSyborg16MarkDebugPortOffEv @ 23 NONAME + _ZN7TSyborg18VideoRamPhysSecureEv @ 24 NONAME + _ZN7TSyborg20EnableTimerInterruptEj @ 25 NONAME + _ZN7TSyborg21DisableTimerInterruptEj @ 26 NONAME + _ZN7TSyborg9EnableIntEj @ 27 NONAME + _ZN7TSyborg9TimerLoadEj @ 28 NONAME + _ZN7TSyborg9TimerModeEj @ 29 NONAME + _ZN9Interrupt11SetPriorityEii @ 30 NONAME + _ZN9Interrupt4BindEiPFvPvES0_ @ 31 NONAME + _ZN9Interrupt5ClearEi @ 32 NONAME + _ZN9Interrupt6EnableEi @ 33 NONAME + _ZN9Interrupt6UnbindEi @ 34 NONAME + _ZN9Interrupt7DisableEi @ 35 NONAME + _ZTI6Syborg @ 36 NONAME + _ZTV6Syborg @ 37 NONAME + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/estart.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/estart.txt Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,1 @@ +C: 0 ELOCAL FAT 0 FS_FORMAT_COLD,FS_SYNC_DRIVE # IRAM diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/ethernet/pdd/enet.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/ethernet/pdd/enet.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "kernel\kern_ext.mmh" + +TARGET VariantTarget(ethernet,pdd) +TARGETTYPE pdd +ROMTARGET ethernet.pdd + +SYSTEMINCLUDE \epoc32\include\drivers +SYSTEMINCLUDE AsspNKernIncludePath +SOURCEPATH . + +SOURCE ethernet.cpp ethernet_device.cpp + +LIBRARY PlatformLib + +UID 0x100039d0 0x1000015c +VENDORID 0x70000001 + +CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/ethernet/pdd/ethernet.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/ethernet/pdd/ethernet.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include "ethernet_device.h" + +#pragma diag_suppress 1441 + +_LIT(KEthPddName, "Ethernet.Syborg"); + +// needs ldd version.. +const TInt KMinimumLddMajorVersion = 1; +const TInt KMinimumLddMinorVersion = 0; +const TInt KMinimumLddBuild = 122; + +// +// Class to identify the driver as PDD +// +class DDriverEthernet : public DPhysicalDevice +{ +public: + DDriverEthernet(); + + // + // Functions that we must implement as we are inheriting from abstract base class + // + virtual TInt Install(); + virtual void GetCaps(TDes8 &aDes) const; + virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); + virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); +}; + +////////////////////////////////////////// +// Implementation of DDriverEthernet class +////////////////////////////////////////// + +DDriverEthernet::DDriverEthernet() +{ + DP("** (PDD) DDriverEthernet::DDriverEthernet()"); + __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::DDriverEthernet()")); + + iUnitsMask=0x1; + iVersion=TVersion(KEthernetMajorVersionNumber, + KEthernetMinorVersionNumber, + KEthernetBuildVersionNumber); +} + +TInt DDriverEthernet::Install() +{ + DP("** (PDD) DDriverEthernet::Install()"); + __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Install()")); + + return SetName(&KEthPddName); +} + +void DDriverEthernet::GetCaps(TDes8 &aDes) const +{ + DP("** (PDD) DDriverEthernet::GetCaps"); + __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::GetCaps")); + + TEthernetCaps capsBuf; + + aDes.FillZ(aDes.MaxLength()); + aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength())); +} + +TInt DDriverEthernet::Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) +{ + DP("** (PDD) DDriverEthernet::Create"); + __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Create")); + + TInt r = KErrNoMemory; + + EthernetDevice *VirtioEthernet = new EthernetDevice; + if(VirtioEthernet) + { + DP("** (PDD) DDriverEthernet:: EthernetDevice created successfully"); + r = VirtioEthernet->DoCreate(aUnit, anInfo); + } + aChannel = VirtioEthernet; + return r; +} + +TInt DDriverEthernet::Validate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) +{ + DP("** (PDD) DDriverEthernet::Validate"); + __KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Validate")); + + if((!Kern::QueryVersionSupported(iVersion,aVer)) || + (!Kern::QueryVersionSupported(aVer,TVersion(KMinimumLddMajorVersion, + KMinimumLddMinorVersion, + KMinimumLddBuild)))) + { + return KErrNotSupported; + } + if(aUnit != 0) + { + return KErrNotSupported; + } + return KErrNone; +} + +DECLARE_STANDARD_PDD() +{ + DP("** (DPhysicalDevice) Ethernet PDD Factory created"); + return new DDriverEthernet; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/ethernet/pdd/ethernet_device.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/ethernet/pdd/ethernet_device.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,411 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include "ethernet_device.h" + +// Constants specific to this file +const TInt K1000mSecDelay = 1000; + +///////////////////////////////////////// +// Implementation of EthernetDevice class +///////////////////////////////////////// + +EthernetDevice::EthernetDevice() : iRxDfc(RxDfc, this) +{ + DP("** (PDD) EthernetDevice()"); + + iInterruptId=-1; + iCreated = FALSE; + iStarted = FALSE; + iRxDfc.SetDfcQ(Kern::DfcQue0()); +} + +EthernetDevice::~EthernetDevice() +{ + DP("** (PDD) ~EthernetDevice()"); + DP("** (PDD) ~EthernetDevice Unbind Interrupt"); + Interrupt::Unbind(EIntNet0); +} + +void EthernetDevice::GetConfig(TEthernetConfigV01 &aConfig) const +{ + DP("** (PDD) EthernetDevice::GetConfig"); + aConfig = iDefaultConfig; +} + +TInt EthernetDevice::ValidateConfig(const TEthernetConfigV01 &aConfig) const +{ + DP("** (PDD) EthernetDevice::ValidateConfig"); + + switch(aConfig.iEthSpeed) + { + case KEthSpeedUnknown: + return KErrNotSupported; + default: + break; + } + + switch(aConfig.iEthDuplex) + { + case KEthDuplexUnknown: + return KErrNotSupported; + default: + break; + } + + return KErrNone; +} + +void EthernetDevice::Caps(TDes8 &aCaps) const +{ + DP("** (PDD) EthernetDevice::Caps"); + TEthernetCaps capsBuf; + + aCaps.FillZ(aCaps.MaxLength()); + aCaps=capsBuf.Left(Min(capsBuf.Length(),aCaps.MaxLength())); +} + +TDfcQue* EthernetDevice::DfcQ(TInt aUnit) +{ + DP("** (PDD) EthernetDevice::DfcQ"); + return Kern::DfcQue0(); +} + +TInt EthernetDevice::DisableIrqs() +{ + DP("** (PDD) EthernetDevice::DisableIrqs"); + return NKern::DisableInterrupts(1); +} + +void EthernetDevice::RestoreIrqs(TInt aLevel) +{ + DP("** (PDD) EthernetDevice::RestoreIrqs"); + NKern::RestoreInterrupts(aLevel); +} + +// +// Enable Ethernet interrupt line, allocate memory for Rx/Tx paths and send QEMU frames for Rx transmission. +// +TInt EthernetDevice::DoCreate(TInt aUnit, const TDesC8* anInfo) +{ + DP("** (PDD) Enter: EthernetDevice::DoCreate"); + + if(iCreated) + return KErrNone; + + // Bind to Ethernet interrupt + Interrupt::Bind(EIntNet0,Isr,this); + SetMacAddress(); + + DP("** (PDD) EthernetDevice::DoCreate - VNET[VIRTIO_STATUS]"); + + VNET[VIRTIO_STATUS] = VIRTIO_CONFIG_S_ACKNOWLEDGE + | VIRTIO_CONFIG_S_DRIVER; + + AllocRings(); + VNET[VIRTIO_STATUS] |= VIRTIO_CONFIG_S_DRIVER_OK; + AddRx(); + VNET[VIRTIO_INT_ENABLE] = 1; + + iCreated = TRUE; + + DP("** (PDD) Exit: EthernetDevice::DoCreate"); + + return KErrNone; +} + +TInt EthernetDevice::Start() +{ + DP("** (PDD) EthernetDevice::Start()"); + + if(iStarted) + return KErrNone; + + // wait for 1 sec as negotiation is going on... hopefully auto-neg completes by then + NKern::Sleep(K1000mSecDelay); + Interrupt::Enable(EIntNet0); + + iStarted = TRUE; + + return KErrNone; +} + +void EthernetDevice::Stop(TStopMode aMode) +{ + DP("** (PDD) EthernetDevice::Stop(TStopMode aMode)"); + + switch (aMode) + { + case EStopNormal: + case EStopEmergency: + iRxDfc.Cancel(); + //Should we disable QEMU interrupts here? + break; + default: + break; + } + + iStarted = FALSE; + Interrupt::Disable(EIntNet0); +} + +// +// Transmit Tx data to QEMU and increment iTxAvail idx counter to indicate to QEMU that a new frame is available. +// +TInt EthernetDevice::Send(TBuf8 &aBuffer) +{ + DP("** (PDD) EthernetDevice::Send"); + + TInt err = KErrNone; + TUint32 length = aBuffer.Length(); + iTxBuffer = aBuffer; + + DP ("** (PDD) Value of iTxAvail->idx = %d\n", iTxAvail->idx); + TInt ring_slot = iTxAvail->idx & (tx_ring_size - 1); + DP ("** (PDD) Value of ring_slot = %d\n", ring_slot); + + memset(&tx_header, 0, sizeof(tx_header)); + + iTxDesc[0].addr = Epoc::LinearToPhysical((TUint32)&tx_header); + iTxDesc[0].len = sizeof(tx_header); + iTxDesc[0].flags = VRING_DESC_F_NEXT; + iTxDesc[0].next = 1; + iTxDesc[1].addr = Epoc::LinearToPhysical((TUint32) iTxBuffer.Ptr()); + iTxDesc[1].len = length; + iTxDesc[1].flags = 0; + iTxAvail->ring[ring_slot] = 0; + + iTxAvail->idx++; + DP ("** (PDD)iTxAvail->idx = %x, rx_last_used=%d\n", iTxAvail->idx, rx_last_used); + + VNET[VIRTIO_QUEUE_NOTIFY] = TX_QUEUE; + + DP ("** (PDD) iTxDesc[0].addr = %x\n", iTxDesc[0].addr); + DP ("** (PDD) iTxDesc[0].len = %d\n", iTxDesc[0].len); + DP ("** (PDD) iTxDesc[0].flags = %d\n", iTxDesc[0].flags); + DP ("** (PDD) iTxDesc[0].next = %d\n", iTxDesc[0].next); + DP ("** (PDD) iTxDesc[1].addr = %x\n", iTxDesc[1].addr); + DP ("** (PDD) iTxDesc[1].len = %d\n", iTxDesc[1].len); + DP ("** (PDD) iTxDesc[1].flags = %d\n", iTxDesc[1].flags); + + return err; +} + +TInt EthernetDevice::ReceiveFrame(TBuf8 &aBuffer, + TBool okToUse) +{ + DP("** (PDD) EthernetDevice::ReceiveFrame"); + + //If no buffer available dump frame + if (!okToUse) + { + DP("** (PDD) EthernetDevice::ReceiveFrame - dumping frame"); + return KErrGeneral; + } + + aBuffer.Copy(iRxBuffer.Ptr(), ETHERNET_PAYLOAD_SIZE); + AddRx(); + + return KErrNone; +} + +void EthernetDevice::Isr(TAny* aPtr) +{ + DP("** (PDD) EthernetDevice::Isr(TAny* aPtr)"); + + Interrupt::Clear(EIntNet0); + VNET[VIRTIO_INT_STATUS] = 1; + EthernetDevice& d=*(EthernetDevice*)aPtr; + d.iRxDfc.Add(); +} + +void EthernetDevice::RxDfc(TAny* aPtr) +{ + DP("** (PDD) EthernetDevice::RxDfc"); + EthernetDevice& d=*(EthernetDevice*)aPtr; + + TInt x = VNET[VIRTIO_INT_STATUS]; + DP("** (PDD) EthernetDevice::RxDfc - value of x=%d", x); + + TInt ring_slot = d.iRxUsed->idx & (d.rx_ring_size - 1); + + DP("**(PDD) RxDfc (d.iTxAvail->idx) = %d (d.iRxAvail->idx) = %d", d.iTxAvail->idx, d.iRxAvail->idx); + DP("**(PDD) RxDfc (d.iRxUsed->idx) = %d ", d.iRxUsed->idx); + DP("**(PDD) RxDfc ring_slot=%d, (d.iRxUsed->ring[%d].id) = %d", ring_slot, ring_slot, d.iRxUsed->ring[ring_slot].id); + DP("**(PDD) RxDfc d.iRxDesc[1].next = %d", d.iRxDesc[1].next); + + //check to see if this is a Rx or Tx + if (d.iRxUsed->idx != d.rx_last_used) + { + DP("** (PDD) Received Rx Interrupt"); + d.rx_last_used++; + DP("** (PDD) Value of rx_last_used=%d", d.rx_last_used); + d.ReceiveIsr(); + } +} + +void EthernetDevice::MacConfigure(TEthernetConfigV01 &aConfig) +{ + DP("** (PDD) EthernetDevice::MacConfigure"); + + iDefaultConfig.iEthAddress[0] = aConfig.iEthAddress[0]; + iDefaultConfig.iEthAddress[1] = aConfig.iEthAddress[1]; + iDefaultConfig.iEthAddress[2] = aConfig.iEthAddress[2]; + iDefaultConfig.iEthAddress[3] = aConfig.iEthAddress[3]; + iDefaultConfig.iEthAddress[4] = aConfig.iEthAddress[4]; + iDefaultConfig.iEthAddress[5] = aConfig.iEthAddress[5]; + + DP ("** (PDD) macaddr %02x:%02x:%02x:%02x:%02x:%02x\n", + iDefaultConfig.iEthAddress[0], + iDefaultConfig.iEthAddress[1], + iDefaultConfig.iEthAddress[2], + iDefaultConfig.iEthAddress[3], + iDefaultConfig.iEthAddress[4], + iDefaultConfig.iEthAddress[5]); +} + +//Descriptor list and vring_used must start on a 4k page boundary. +TAny * EthernetDevice::AllocAligned(TUint16 size) +{ + DP("** (PDD) Enter: EthernetDevice::alloc_aligned"); + DP("** (PDD) size=%d",size); + + TAny * p = Kern::Alloc(size + 4095); + + DP("** (PDD) BEFORE: p=%x",p); + p = (TAny *)(((TUint32)p + 4095) & ~4095); + DP("** (PDD) AFTER: p=%x",p); + + DP("** (PDD) Exit: EthernetDevice::alloc_aligned"); + + return p; +} + +TAny EthernetDevice::AllocRings() +{ + DP("** (PDD) Enter: EthernetDevice::AllocRings"); + + TUint size; + TUint used_offset; + TUint32 p; + + VNET[VIRTIO_QUEUE_SEL] = TX_QUEUE; + tx_ring_size = VNET[VIRTIO_QUEUE_NUM]; + + DP ("** (PDD) tx_ring_size = %d\n", tx_ring_size); + + size = (tx_ring_size * (16 + 2)) + 4; + used_offset = (size + 4095) & ~1024; + DP ("** (PDD) used_offset = %d", used_offset); + size = used_offset + 4 + (tx_ring_size * 8); + DP ("** (PDD) size = %d", size); + + p = (TUint32)AllocAligned(size); + DP ("** (PDD) p = %x\n", p); + + VNET[VIRTIO_QUEUE_BASE] = Epoc::LinearToPhysical(p); + + iTxDesc = reinterpret_cast(p); + iTxAvail = reinterpret_cast(p + tx_ring_size * 16); + iTxUsed = reinterpret_cast(p + used_offset); + + DP ("** (PDD) iTxDesc = %x", iTxDesc); + DP ("** (PDD) iTxAvail = %x", iTxAvail); + DP ("** (PDD) iTxUsed = %x", iTxUsed); + + VNET[VIRTIO_QUEUE_SEL] = RX_QUEUE; + rx_ring_size = VNET[VIRTIO_QUEUE_NUM]; + + size = (rx_ring_size * (16 + 2)) + 4; + used_offset = (size + 4095) & ~4095; + size = used_offset + 4 + (rx_ring_size * 8); + p = (TUint32)AllocAligned(size); + DP ("** (PDD) p = %x\n", p); + VNET[VIRTIO_QUEUE_BASE] = Epoc::LinearToPhysical(p); + + iRxDesc = reinterpret_cast(p); + iRxAvail = reinterpret_cast(p + rx_ring_size * 16); + iRxUsed = reinterpret_cast(p + used_offset); + + DP ("** (PDD) iRxDesc = %x", iRxDesc); + DP ("** (PDD) iRxAvail = %x", iRxAvail); + DP ("** (PDD) iRxUsed = %x", iRxUsed); + + DP("** (PDD) Exit: EthernetDevice::AllocRings"); +} + +void EthernetDevice::AddRx() +{ + DP("** (PDD) Enter: EthernetDevice::AddRx"); + + TInt n = iRxAvail->idx & (rx_ring_size - 1); + memset(&rx_header, 0, sizeof(rx_header)); + iRxDesc[0].addr = Epoc::LinearToPhysical((TUint32)&rx_header); + iRxDesc[0].len = sizeof(rx_header); + iRxDesc[0].flags = VRING_DESC_F_NEXT | VRING_DESC_F_WRITE; + iRxDesc[0].next = 1; + iRxDesc[1].addr = Epoc::LinearToPhysical((TUint32) iRxBuffer.Ptr()); + iRxDesc[1].len = ETHERNET_PAYLOAD_SIZE; + iRxDesc[1].flags = VRING_DESC_F_WRITE; + iRxAvail->ring[n] = 0; + iRxAvail->idx++; + VNET[VIRTIO_QUEUE_NOTIFY] = RX_QUEUE; + + DP("** (PDD) Exit: EthernetDevice::AddRx"); +} + + + +void EthernetDevice::SetMacAddress(void) + { + DP("** (PDD) Enter: EthernetDevice::SetMacAddress"); + + iDefaultConfig.iEthAddress[0] = VNET_MAC[0]; + iDefaultConfig.iEthAddress[1] = VNET_MAC[1]; + iDefaultConfig.iEthAddress[2] = VNET_MAC[2]; + iDefaultConfig.iEthAddress[3] = VNET_MAC[3]; + iDefaultConfig.iEthAddress[4] = VNET_MAC[4]; + iDefaultConfig.iEthAddress[5] = VNET_MAC[5]; + + DP ("** (PDD) macaddr %02x:%02x:%02x:%02x:%02x:%02x\n", + iDefaultConfig.iEthAddress[0], + iDefaultConfig.iEthAddress[1], + iDefaultConfig.iEthAddress[2], + iDefaultConfig.iEthAddress[3], + iDefaultConfig.iEthAddress[4], + iDefaultConfig.iEthAddress[5]); + + DP("** (PDD) Exit: EthernetDevice::SetMacAddress"); + } + +// +// Functions that are just stubs +// + +void EthernetDevice::CheckConfig(TEthernetConfigV01& aConfig) +{ + DP("** (PDD) EthernetDevice::CheckConfig"); +} + +TInt EthernetDevice::Configure(TEthernetConfigV01 &aConfig) +{ + DP("** (PDD) EthernetDevice::Configure"); + return KErrNone; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/ethernet/pdd/ethernet_device.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/ethernet/pdd/ethernet_device.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Register definitions and base classes for Ethernet Virtio. +* +*/ + +#ifndef __QEMUETHERNET_ +#define __QEMUETHERNET_ + +#include +#include + +#define SVPDBG +#ifdef SVPDBG +#define DP(format...) Kern::Printf(format) +#else +#define DP(format...) +#endif + +#define ETHERNET_PAYLOAD_SIZE 1500 + +#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 +#define VIRTIO_CONFIG_S_DRIVER 2 +#define VIRTIO_CONFIG_S_DRIVER_OK 4 +#define VIRTIO_CONFIG_S_FAILED 0x80 + +/* This marks a buffer as continuing via the next field. */ +#define VRING_DESC_F_NEXT 1 +/* This marks a buffer as write-only (otherwise read-only). */ +#define VRING_DESC_F_WRITE 2 + +#define TX_QUEUE 1 +#define RX_QUEUE 0 + +#define VNET_MAC ((volatile TUint8 *)(0xc600c000 + 0x100)) +#define VNET ((volatile TUint32 *)0xc600c000) + +enum { + VIRTIO_ID = 0, + VIRTIO_DEVTYPE = 1, + VIRTIO_HOST_FEATURES = 2, + VIRTIO_GUEST_FEATURES = 3, + VIRTIO_QUEUE_BASE = 4, + VIRTIO_QUEUE_NUM = 5, + VIRTIO_QUEUE_SEL = 6, + VIRTIO_QUEUE_NOTIFY = 7, + VIRTIO_STATUS = 8, + VIRTIO_INT_ENABLE = 9, + VIRTIO_INT_STATUS = 10 +}; + +typedef struct +{ +#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset + TUint8 flags; +#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame +#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) +#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) +#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP +#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set + TUint8 gso_type; + TUint16 hdr_len; + TUint16 gso_size; + TUint16 csum_start; + TUint16 csum_offset; +} virtio_net_hdr; + +typedef struct +{ + TUint64 addr; + TUint32 len; + TUint16 flags; + TUint16 next; +} vring_desc; + +typedef struct +{ + TUint16 flags; + TUint16 idx; + TUint16 ring[16]; + +} vring_avail; + +typedef struct +{ + TUint16 flags; + TUint16 idx; + struct { + TUint32 id; + TUint32 len; + } ring[16]; +} vring_used; + + +// +// Class to identify the device as ethernet device for Symbian +// +class EthernetDevice : public DEthernet +{ +public: + EthernetDevice(); + ~EthernetDevice(); + TInt DoCreate(TInt aUnit, const TDesC8* anInfo); + static void Isr(TAny* aPtr); + + // + // Functions that we must implement as we are inheriting from abstract base class + // + virtual TInt Start(); + virtual void Stop(TStopMode aMode); + virtual void GetConfig(TEthernetConfigV01 &aConfig) const; + virtual TInt ValidateConfig(const TEthernetConfigV01 &aConfig) const; + virtual void CheckConfig(TEthernetConfigV01 &aConfig); + virtual TInt Configure(TEthernetConfigV01 &aConfig); + virtual void MacConfigure(TEthernetConfigV01 &aConfig); + virtual void Caps(TDes8 &aCaps) const; + virtual TInt DisableIrqs(); + virtual void RestoreIrqs(TInt aIrq); + virtual TDfcQue* DfcQ(TInt aUnit); + virtual TInt Send(TBuf8 &aBuffer); + virtual TInt ReceiveFrame(TBuf8 &aBuffer, TBool okToUse); + +private: + + TEthernetConfigV01 iDefaultConfig; + TInt iInterruptId; + TDfc iRxDfc; + TUint32 iCreated; + TUint32 iStarted; + + //Virtio structs for transmitting data to QEMU. + volatile vring_desc *iTxDesc; + volatile vring_avail *iTxAvail; + volatile vring_used *iTxUsed; + //Ring size hardcoded in QEMU. + TUint tx_ring_size; + + //Virtio structs for receiving data from QEMU. + volatile vring_desc *iRxDesc; + volatile vring_avail *iRxAvail; + volatile vring_used *iRxUsed; + + TUint rx_ring_size; + TUint rx_last_used; + + //Virtio packet header definitions. + virtio_net_hdr rx_header; + virtio_net_hdr tx_header; + + //Buffers for Rx/Tx transmission. + TBuf8 iTxBuffer; + TBuf8 iRxBuffer; + + static void RxDfc(TAny* aPtr); + + //QEMU specific member functions + void AllocRings(); + void* AllocAligned(TUint16 size); + void AddRx(); + void SetMacAddress(void); +}; + +#endif // __QEMUETHERNET_ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/ethernet/test/ethernet_test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/ethernet/test/ethernet_test.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include + +LOCAL_D RTest test(_L("DRIVER1_TEST")); + +_LIT(KDriver1LddFileName,"enet"); +_LIT(KDriver1PddFileName,"ethernet"); + +_LIT8(KTestSendData,"abcdefghijklmnopqrstuvwxyz"); +_LIT8(KTestLargeSendData,"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + +GLDEF_C TInt E32Main() + { + test.Title(); + + TInt r; + RDebug::Printf(">>>>>>E32Main()"); + + test.Start(_L("Load Physical Device")); + r=User::LoadPhysicalDevice(KDriver1PddFileName); + if (r != KErrNone) + RDebug::Printf("LoadPhysicalDevice: value of error =%d", r); + test(r==KErrNone || r==KErrAlreadyExists); + + test.Next(_L("Load Logical Device")); + r=User::LoadLogicalDevice(KDriver1LddFileName); + if (r != KErrNone) + RDebug::Printf("LoadLogicalDevice: value of error =%d", r); + test(r==KErrNone || r==KErrAlreadyExists); + + __KHEAP_MARK; + + test.Next(_L("Open Logical Channel")); + RBusDevEthernet ldd; + + r=ldd.Open(0); + RDebug::Printf("Value returned from ldd.Open()=%d", r); + test(r==KErrNone); + + test.Next(_L("SendData")); + TRequestStatus status; + ldd.Write(status,KTestSendData); + + test.Next(_L("SendDataCancel")); + ldd.WriteCancel(); + User::WaitForRequest(status); + r=status.Int(); + //test(r==KErrCancel); + + test.Next(_L("SendData")); + ldd.Write(status,KTestSendData); + User::WaitForRequest(status); + r=status.Int(); + //test(r==KErrNone); + + test.Next(_L("ReceiveData")); + TBuf8<256> buffer; + ldd.Read(status,buffer); + + test.Next(_L("ReceiveDataCancel")); + ldd.ReadCancel(); + User::WaitForRequest(status); + r=status.Int(); + test(r==KErrCancel); + + test.Next(_L("Close Logical Channel")); + ldd.Close(); + + __KHEAP_MARKEND; + + test.End(); + + return(0); + + } + + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/ethernet/test/ethernet_test.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/ethernet/test/ethernet_test.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +target ethernet_testapp.exe +targettype exe +source ethernet_test.cpp +library euser.lib +systeminclude /epoc32/include + +CAPABILITY all -tcb + +SMPSAFE diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/fb/fb.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/fb/fb.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "kernel\kern_ext.mmh" + +TARGET VariantTarget(lcd,dll) +TARGETTYPE kext + +SYSTEMINCLUDE AsspNKernIncludePath +SYSTEMINCLUDE . + +SOURCEPATH . +SOURCE syborg_fb.cpp + +LIBRARY PlatformLib + +EPOCALLOWDLLDATA + +UID 0x1000008d 0x100039e8 +VENDORID 0x70000001 + +ROMTARGET lcd.dll + +CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/fb/syborg_fb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/fb/syborg_fb.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,487 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic frame buffer driver +* +*/ + +#include +#include "syborg_fb.h" + +TPhysAddr Syborg::VideoRamPhys; +TPhysAddr Syborg::VideoRamPhysSecure; // Secure display memory + +TPhysAddr TSyborg::VideoRamPhys() +{ + __KTRACE_OPT(KEXTENSION,Kern::Printf("TSyborg::VideoRamPhys: VideoRamPhys=0x%x", Syborg::VideoRamPhys)); + return Syborg::VideoRamPhys; +} + +TPhysAddr TSyborg::VideoRamPhysSecure() +{ + return Syborg::VideoRamPhysSecure; +} + +LOCAL_C TInt DoHalFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) +{ + DLcdPowerHandler* pH=(DLcdPowerHandler*)aPtr; + return pH->HalFunction(aFunction,a1,a2); +} + +static void rxMsg(TAny* aPtr) +{ + DLcdPowerHandler& h=*(DLcdPowerHandler*)aPtr; + TMessageBase* pM = h.iMsgQ.iMessage; + if(pM) + h.HandleMsg(pM); +} + +static void power_up_dfc(TAny* aPtr) +{ + ((DLcdPowerHandler*)aPtr)->PowerUpDfc(); +} + +void power_down_dfc(TAny* aPtr) +{ + ((DLcdPowerHandler*)aPtr)->PowerDownDfc(); +} + +void DLcdPowerHandler::DisplayOn() +{ + PowerUpLcd(iSecureDisplay); + iDisplayOn = ETrue; +} + +void DLcdPowerHandler::DisplayOff() +{ + PowerDownLcd(); + iDisplayOn = EFalse; +} + +void DLcdPowerHandler::SwitchDisplay(TBool aSecure) + { + if(aSecure) + { + if(!iSecureDisplay) + { + DisplayOff(); + iSecureDisplay = ETrue; + DisplayOn(); + } + } + else + { + if(iSecureDisplay) + { + DisplayOff(); + iSecureDisplay = EFalse; + DisplayOn(); + } + } + } + +void DLcdPowerHandler::PowerUpDfc() +{ + DisplayOn(); + PowerUpDone(); +} + +void DLcdPowerHandler::PowerDownDfc() +{ + DisplayOff(); + PowerDownDone(); +} + +void DLcdPowerHandler::PowerDown(TPowerState) +{ + iPowerDownDfc.Enque(); +} + +void DLcdPowerHandler::PowerUp() +{ + iPowerUpDfc.Enque(); +} + +void DLcdPowerHandler::PowerUpLcd(TBool aSecure) +{ +#if 1 + WriteReg(iPortAddr, FB_ENABLED, 0); + WriteReg(iPortAddr, FB_BASE, aSecure ? iSecurevRamPhys : ivRamPhys); + WriteReg(iPortAddr, FB_WIDTH, iVideoInfo.iSizeInPixels.iWidth); + WriteReg(iPortAddr, FB_BLANK, 0); + WriteReg(iPortAddr, FB_BPP, 32); + WriteReg(iPortAddr, FB_COLOR_ORDER, 0); + WriteReg(iPortAddr, FB_BYTE_ORDER, 0); + WriteReg(iPortAddr, FB_PIXEL_ORDER, 0); + WriteReg(iPortAddr, FB_INT_MASK, 0); + WriteReg(iPortAddr, FB_ENABLED, 1); + WriteReg(iPortAddr, FB_HEIGHT, iVideoInfo.iSizeInPixels.iHeight); +#endif +} + +void DLcdPowerHandler::PowerDownLcd() +{ + WriteReg(iPortAddr, FB_BLANK, 1); +} + +DLcdPowerHandler::DLcdPowerHandler() + : DPowerHandler(KLitLcd), + iMsgQ(rxMsg,this,NULL,1), + iPowerUpDfc(&power_up_dfc,this,6), + iPowerDownDfc(&power_down_dfc,this,7) +{ +} + +void DLcdPowerHandler::ScreenInfo(TScreenInfoV01& anInfo) +{ + anInfo.iWindowHandleValid = EFalse; + anInfo.iWindowHandle = NULL; + anInfo.iScreenAddressValid = ETrue; + anInfo.iScreenAddress = (TAny *)(iChunk->LinearAddress()); + anInfo.iScreenSize.iWidth = iVideoInfo.iSizeInPixels.iWidth; + anInfo.iScreenSize.iHeight = iVideoInfo.iSizeInPixels.iHeight; +} + +void DLcdPowerHandler::HandleMsg(TMessageBase* aMsg) +{ + if(aMsg->iValue) + DisplayOn(); + else + DisplayOff(); + aMsg->Complete(KErrNone,ETrue); +} + +void DLcdPowerHandler::WsSwitchOnScreen() +{ + TThreadMessage& m = Kern::Message(); + m.iValue = ETrue; + m.SendReceive(&iMsgQ); +} + +void DLcdPowerHandler::WsSwitchOffScreen() +{ + TThreadMessage& m = Kern::Message(); + m.iValue = EFalse; + m.SendReceive(&iMsgQ); +} + +TInt DLcdPowerHandler::GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure) +{ + NKern::FMWait(&iLock); + if(aSecure) + aInfo = iSecureVideoInfo; + else + aInfo = iVideoInfo; + NKern::FMSignal(&iLock); + return KErrNone; +} + +TInt DLcdPowerHandler::GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo) +{ + if(aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes) + return KErrArgument; + + NKern::FMWait(&iLock); + aInfo = iVideoInfo; + NKern::FMSignal(&iLock); + + if(aMode != aInfo.iDisplayMode) + { + aInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; + aInfo.iIsPalettized = KConfigIsPalettized; + aInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; + aInfo.iBitsPerPixel = KConfigBitsPerPixel; + } + return KErrNone; +} + +TInt DLcdPowerHandler::AllocateFrameBuffer() +{ + // Allocate physical RAM for video + TInt vSize = TSyborg::VideoRamSize(); + + NKern::ThreadEnterCS(); + TInt r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhys); + if (r != KErrNone) + { + NKern::ThreadLeaveCS(); + Kern::Fault("AllocVideoRam",r); + } + + // Map the video RAM + ivRamPhys = TSyborg::VideoRamPhys(); + + r = DPlatChunkHw::New(iChunk,ivRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); + + NKern::ThreadLeaveCS(); + + if(r != KErrNone) + return r; + + TUint* pV = (TUint*)iChunk->LinearAddress(); + + // Allocate physical RAM for secure display + NKern::ThreadEnterCS(); + r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhysSecure); + if (r != KErrNone) + { + NKern::ThreadLeaveCS(); + Kern::Fault("AllocVideoRam 2",r); + } + iSecurevRamPhys = ivRamPhys + vSize; + TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); + + NKern::ThreadLeaveCS(); + + if(r2 != KErrNone) + return r2; + + TUint* pV2 = (TUint*)iSecureChunk->LinearAddress(); + + iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth; + iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight; + iVideoInfo.iDisplayMode = KConfigLcdDisplayMode; + iVideoInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; + iVideoInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; + iVideoInfo.iIsPalettized = KConfigIsPalettized; + iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel; + iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips; + iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips; + iVideoInfo.iIsMono = KConfigIsMono; + iVideoInfo.iVideoAddress = (TInt)pV; + iVideoInfo.iIsPixelOrderLandscape = KConfigPixelOrderLandscape; + iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB; + + iSecureVideoInfo = iVideoInfo; + iSecureVideoInfo.iVideoAddress = (TInt)pV2; + +#if 0 + WriteReg(iPortAddr, FB_ENABLED, 0); + WriteReg(IPortAddr, FB_INT_MASK, 0); + WriteReg(iPortAddr, FB_BASE, iSecureDisplay ? iSecurevRamPhys : ivRamPhys); + WriteReg(iPortAddr, FB_WIDTH, iVideoInfo.iSizeInPixels.iWidth); + WriteReg(iPortAddr, FB_HEIGHT, iVideoInfo.iSizeInPixels.iHeight); + WriteReg(iPortAddr, FB_BLANK, 0); + WriteReg(iPortAddr, FB_ENABLED, 1); +#endif + + return KErrNone; +} + + +TInt DLcdPowerHandler::SetDisplayMode(TInt aMode) +{ + if(aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes) + return KErrArgument; + + // store the current mode + iVideoInfo.iDisplayMode = aMode; + + // store the current mode for secure screen + iSecureVideoInfo.iDisplayMode = aMode; + + return KErrNone; +} + +TInt DLcdPowerHandler::HalFunction(TInt aFunction, TAny* a1, TAny* a2) +{ + TInt r=KErrNone; + switch(aFunction) + { + case EDisplayHalScreenInfo: + { + TPckgBuf vPckg; + ScreenInfo(vPckg()); + Kern::InfoCopy(*(TDes8*)a1,vPckg); + break; + } + case EDisplayHalWsRegisterSwitchOnScreenHandling: + { + iWsSwitchOnScreen=(TBool)a1; + break; + } + case EDisplayHalWsSwitchOnScreen: + { + WsSwitchOnScreen(); + break; + } + case EDisplayHalModeCount: + { + TInt ndm = KConfigLcdNumberOfDisplayModes; + kumemput32(a1, &ndm, sizeof(ndm)); + break; + } + case EDisplayHalSetMode: + { + __KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetMode")); + __SECURE_KERNEL( + if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetMode"))) + return KErrPermissionDenied; + ) + r = SetDisplayMode((TInt)a1); + break; + } + case EDisplayHalMode: + { + kumemput32(a1, &iVideoInfo.iDisplayMode, sizeof(iVideoInfo.iDisplayMode)); + r = KErrNone; + break; + } + case EDisplayHalSetPaletteEntry: + { + __SECURE_KERNEL( + if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetPaletteEntry"))) + return KErrPermissionDenied; + ) + r = KErrNotSupported; + break; + } + case EDisplayHalPaletteEntry: + { + TInt entry; + kumemget32(&entry, a1, sizeof(TInt)); + r = KErrNotSupported; + break; + } + case EDisplayHalSetState: + { + __SECURE_KERNEL( + if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState"))) + return KErrPermissionDenied; + ) + if((TBool)a1) + WsSwitchOnScreen(); + else + WsSwitchOffScreen(); + break; + } + case EDisplayHalState: + { + kumemput32(a1, &iDisplayOn, sizeof(TBool)); + break; + } + case EDisplayHalColors: + { + TInt mdc = 1<<24; + kumemput32(a1, &mdc, sizeof(mdc)); + break; + } + case EDisplayHalCurrentModeInfo: + { + TPckgBuf vPckg; + r = GetCurrentDisplayModeInfo(vPckg(), (TBool)a2); + if(KErrNone == r) + Kern::InfoCopy(*(TDes8*)a1,vPckg); + break; + } + case EDisplayHalSpecifiedModeInfo: + { + TPckgBuf vPckg; + TInt mode; + kumemget32(&mode, a1, sizeof(mode)); + r = GetSpecifiedDisplayModeInfo(mode, vPckg()); + if(KErrNone == r) + Kern::InfoCopy(*(TDes8*)a2,vPckg); + break; + } + case EDisplayHalSecure: + { + kumemput32(a1, &iSecureDisplay, sizeof(TBool)); + break; + } + case EDisplayHalSetSecure: + { + __SECURE_KERNEL( + if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetSecure"))) + return KErrPermissionDenied; + ) + SwitchDisplay((TBool)a1); + break; + } + default: + { + r = KErrNotSupported; + break; + } + } + return r; +} + +TInt DLcdPowerHandler::Create() +{ + iDfcQ = Kern::DfcQue0(); // use low priority DFC queue for this driver + + iPortAddr = KHwBaseClcd; + + // !@! +#if 0 + // Map the video RAM + TInt vSize = TSyborg::VideoRamSize(); + ivRamPhys = TSyborg::VideoRamPhys(); + + TInt r = DPlatChunkHw::New(iChunk,ivRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); + if(r != KErrNone) + return r; + + TUint* pV = (TUint*)iChunk->LinearAddress(); + + iSecurevRamPhys = ivRamPhys + vSize; + TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC); + if(r2 != KErrNone) + return r2; + + TUint* pV2 = (TUint*)iSecureChunk->LinearAddress(); +#endif + + iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth; + iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight; + iVideoInfo.iDisplayMode = KConfigLcdDisplayMode; + iVideoInfo.iOffsetToFirstPixel = KCOnfigOffsetToFirstPixel; + iVideoInfo.iOffsetBetweenLines = KCOnfigOffsetBetweenLines; + iVideoInfo.iIsPalettized = KConfigIsPalettized; + iVideoInfo.iBitsPerPixel = KConfigBitsPerPixel; + iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips; + iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips; + iVideoInfo.iIsMono = KConfigIsMono; + // !@! iVideoInfo.iVideoAddress = (TInt)pV; + iVideoInfo.iIsPixelOrderLandscape = KConfigPixelOrderLandscape; + iVideoInfo.iIsPixelOrderRGB = KConfigPixelOrderRGB; + + iSecureVideoInfo = iVideoInfo; + // !@! iSecureVideoInfo.iVideoAddress = (TInt)pV2; + + AllocateFrameBuffer(); + TInt r = Kern::AddHalEntry(EHalGroupDisplay,DoHalFunction,this); + if(r != KErrNone) + return r; + + iPowerUpDfc.SetDfcQ(iDfcQ); + iPowerDownDfc.SetDfcQ(iDfcQ); + iMsgQ.SetDfcQ(iDfcQ); + iMsgQ.Receive(); + + Add(); + DisplayOn(); + + return KErrNone; +} + +DECLARE_STANDARD_EXTENSION() +{ + TInt r = KErrNoMemory; + DLcdPowerHandler* pH=new DLcdPowerHandler; + if(pH) + r = pH->Create(); + + return r; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/fb/syborg_fb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/fb/syborg_fb.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic frame buffer driver +* +*/ + +#ifndef _SYBORG_FB_H +#define _SYBORG_FB_H + +#include +#include +#include +#include +#include + +_LIT(KLitLcd,"SYBORG_FB"); + +const TUint KConfigLcdWidth = 640; +const TUint KConfigLcdHeight = 480; +const TInt KConfigLcdWidthInTwips = 9638; +const TInt KConfigLcdHeightInTwips = 7370; +const TBool KConfigIsMono = 0; +const TBool KConfigIsPalettized = 0; +const TInt KCOnfigOffsetToFirstPixel = 0; +const TBool KConfigPixelOrderRGB = 0; +const TBool KConfigPixelOrderLandscape = 1; +const TInt KConfigLcdDisplayMode = 2; +//const TInt KConfigLcdDisplayMode = 1; +const TInt KConfigLcdNumberOfDisplayModes = 3; + + +const TInt KConfigBitsPerPixel = 24; +const TInt KCOnfigOffsetBetweenLines = 2560; + +class DLcdPowerHandler : public DPowerHandler +{ +public: // from DPowerHandler + void PowerDown(TPowerState); + void PowerUp(); +public: // to prevent a race condition with WServer trying to power up/down at the same time + void PowerUpDfc(); + void PowerDownDfc(); +public: + DLcdPowerHandler(); + TInt Create(); + void DisplayOn(); + void DisplayOff(); + TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2); + + void PowerUpLcd(TBool aSecure); + void PowerDownLcd(); + + void ScreenInfo(TScreenInfoV01& aInfo); + void WsSwitchOnScreen(); + void WsSwitchOffScreen(); + void HandleMsg(TMessageBase* aMsg); + void SwitchDisplay(TBool aSecure); + +private: + TInt GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure); + TInt GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo); + TInt SetDisplayMode(TInt aMode); + TInt AllocateFrameBuffer(); + + TBool iDisplayOn; + DPlatChunkHw* iChunk; + DPlatChunkHw* iSecureChunk; + TBool iWsSwitchOnScreen; + TBool iSecureDisplay; + +public: + TDfcQue* iDfcQ; + TMessageQue iMsgQ; // to prevent a race condition with Power Manager trying to power up/down at the same time + TDfc iPowerUpDfc; + TDfc iPowerDownDfc; + +private: + TVideoInfoV01 iVideoInfo; + TVideoInfoV01 iSecureVideoInfo; + NFastMutex iLock; + TPhysAddr ivRamPhys; + TPhysAddr iSecurevRamPhys; + +public: + TLinAddr iPortAddr; + +enum { + FB_ID = 0, + FB_BASE = 1, + FB_HEIGHT = 2, + FB_WIDTH = 3, + FB_ORIENTATION = 4, + FB_BLANK = 5, + FB_INT_MASK = 6, + /* begin new interface */ + FB_INTERRUPT_CAUSE = 7, + FB_BPP = 8, + FB_COLOR_ORDER = 9, + FB_BYTE_ORDER = 10, + FB_PIXEL_ORDER = 11, + FB_ROW_PITCH = 12, + FB_ENABLED = 13, + FB_PALETTE_START = 0x400 >> 2, + FB_PALETTE_END = FB_PALETTE_START+256-1, + /* end new interface */ +}; + +#define FB_INT_VSYNC (1U << 0) +#define FB_INT_BASE_UPDATE_DONE (1U << 1) + +}; + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/hal/config.hcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/hal/config.hcf Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,75 @@ +EManufacturer=0 +EManufacturerHardwareRev=0 +EManufacturerSoftwareRev=0 +EManufacturerSoftwareBuild=0 +EModel=0 +EMachineUid=0 +EDeviceFamily=0 +EDeviceFamilyRev=0 +ECPU=0 +ECPUArch=0 +ECPUABI=0 +ECPUSpeed = GetCPUSpeed +ESystemStartupReason = GetSystemStartupReason +ESystemException = GetSystemException +ESystemTickPeriod=0 +EMemoryRAM = GetRAMSize +EMemoryRAMFree = GetFreeRAM +EMemoryROM = GetROMSize +EMemoryPageSize=0 +EPowerGood=0 +EPowerBackup=0 +EPowerExternal=0 +EKeyboard=0 +EKeyboardDeviceKeys=0 +EKeyboardAppKeys=0 +EKeyboardClick=0 +EDisplayXPixels=ProcessDisplayCurrentModeInfo +EDisplayYPixels=ProcessDisplayCurrentModeInfo +EDisplayXTwips=ProcessDisplayCurrentModeInfo +EDisplayYTwips=ProcessDisplayCurrentModeInfo +EDisplayColors=ProcessDisplayColors +EDisplayState : set = ProcessDisplayState +EDisplayContrast : set = ProcessDisplayContrast +EDisplayContrastMax=ProcessDisplayMaxContrast +EBacklight=0 +EBacklightState :set = ProcessBacklightState +EPen=0 +EPenX=0 +EPenY=0 +EPenDisplayOn : set = ProcessPenDisplayOnState +EPenClick=0 +EMouse=0 +EMouseState : set = ProcessMouseState +EMouseSpeed : set = ProcessMouseSpeed +EMouseAcceleration : set = ProcessMouseAcceleration +EMouseButtons=0 +EMouseButtonState = GetMouseButtonState +ECaseSwitch=0 +ELEDs=0 +ELEDmask : set = ProcessLEDMask +ESwitches=GetSwitches +EIntegratedPhone=0 +EDisplayBrightness : set = ProcessDisplayBrightness +EDisplayBrightnessMax=ProcessDisplayMaxBrightness +ELanguageIndex : set = 0 +EDisplayIsMono=ProcessDisplaySpecifiedModeInfo +EDisplayIsPalettized=ProcessDisplaySpecifiedModeInfo +EDisplayBitsPerPixel=ProcessDisplaySpecifiedModeInfo +EDisplayNumModes = ProcessDisplayNumModes +EDisplayMemoryAddress=ProcessDisplayCurrentModeInfo +EDisplayOffsetToFirstPixel=ProcessDisplaySpecifiedModeInfo +EDisplayOffsetBetweenLines=ProcessDisplaySpecifiedModeInfo +EDisplayPaletteEntry : set = ProcessDisplayPaletteEntry +EDisplayIsPixelOrderRGB=ProcessDisplayCurrentModeInfo +EDisplayIsPixelOrderLandscape=ProcessDisplayCurrentModeInfo +EDisplayMode : set = ProcessDisplayMode +EDebugPort : set = ProcessDebugPort +EClipboardDrive=0 +ESystemDrive : set = 0 +EDisplayNumberOfScreens=0 +ENanoTickPeriod=0 +EFastCounterFrequency=0 +EFastCounterCountsUp=0 +EHardwareFloatingPoint = GetHardwareFloatingPoint + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/hal/hal.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/hal/hal.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +TARGET VariantTarget(hal,dll) +TARGETTYPE dll +LINKAS hal.dll +NOEXPORTLIBRARY + +SOURCEPATH ..\..\hal\src +SOURCE hal_main.cpp userhal.cpp + +SOURCEPATH \epoc32\build\generatedcpp\hal +SOURCE VariantTarget(values,cpp) VariantTarget(config,cpp) + +SYSTEMINCLUDE \epoc32\include \epoc32\include\kernel + +LIBRARY euser.lib +DEFFILE ..\..\hal\~\hal.def + +UID 0x1000008d 0x100039e8 +VENDORID 0x70000001 + +CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/hal/values.hda --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/hal/values.hda Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,41 @@ +EManufacturer=intel +EManufacturerHardwareRev=0x1 +EManufacturerSoftwareRev=0x100 +EManufacturerSoftwareBuild=0x250 +EModel=0x42525453 +EMachineUid=OmapH4 +EDeviceFamily=crystal +EDeviceFamilyRev=0x001 +ECPU=arm +ECPUArch=0x400 +ECPUABI=arm5 +ECPUSpeed=0 +ESystemStartupReason=cold +ESystemException=0 +ESystemTickPeriod=15625 +EMemoryRAM=4 +EMemoryRAMFree=2 +EMemoryROM=12 +EMemoryPageSize=0x1000 +EPowerGood=1 +EPowerExternal=1 +EMouse=1 +EMouseState=1 +EMouseSpeed=1 +EMouseAcceleration=1 +EMouseButtons=2 +EMouseButtonState=0 +EMouseX=640 +EMouseY=480 +ECaseSwitch=0 +EIntegratedPhone=0 +ELanguageIndex=0 +EDebugPort=0 +EClipboardDrive=2 +ESystemDrive=0xffff +EDisplayNumberOfScreens=1 +ENanoTickPeriod=1000 +EFastCounterFrequency=1000000 +EFastCounterCountsUp=1 + + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/kasyborg.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/kasyborg.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "kernel\kern_ext.mmh" + +TARGET VariantTarget(kasyborg,dll) +TARGETTYPE var + +EXPORTLIBRARY kasyborg +LINKAS kasyborg.dll + +SYSTEMINCLUDE .\specific + +SOURCEPATH .\specific +SOURCE syborg.cpp interrupts.cpp assp.cpp +SOURCE syborg.cia interrupts.cia + +// now specified in kern_ext.lib +//LIBRARY ekern.lib + +DEFFILE .\~\kasyborg.def + +NOSTRICTDEF + +EPOCALLOWDLLDATA + +UID 0x1000008d 0x100039e8 +VENDORID 0x70000001 + +CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/keyboard/keyboard.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/keyboard/keyboard.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "kernel\kern_ext.mmh" + +TARGET VariantTarget(ekeyb,dll) +TARGETTYPE kext +ROMTARGET ekeyb.dll + +SYSTEMINCLUDE AsspNKernIncludePath + +SOURCEPATH . +SOURCE syborg_keyboard.cpp + +//LIBRARY ekern.lib +LIBRARY PlatformLib + +//NOEXPORTLIBRARY + +//DEFFILE ..\e32\~\empty.def +//DEFFILE .\~\exkey.def + +//NOSTRICTDEF + +UID 0x100039cf 0x100000db +VENDORID 0x70000001 + +CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/keyboard/syborg_keyboard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/keyboard/syborg_keyboard.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic keyboard driver +* +*/ + +//#define DEBUG + +#include "syborg_keyboard.h" + +LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) +{ + DKeyboardPs2Soc* pH=(DKeyboardPs2Soc*)aPtr; + return pH->HalFunction(aFunction,a1,a2); +} + +void rxMsg(TAny* aPtr) +{ + DKeyboardPs2Soc& h=*(DKeyboardPs2Soc*)aPtr; + TMessageBase* pM=h.iMsgQ.iMessage; + if (pM) + h.HandleMsg(pM); +} + +TInt DKeyboardPs2Soc::FifoPop(void) +{ + TInt val = iKeyFifo[iFifoPos]; + iFifoPos++; + iFifoCount--; + + if (iFifoPos == FIFO_SIZE) + iFifoPos = 0; + + return val; +} + +void DKeyboardPs2Soc::FifoPush(TInt val) +{ + TInt slot; + + if (iFifoCount == FIFO_SIZE) + return; + + slot = iFifoPos + iFifoCount; + if (slot >= FIFO_SIZE) + slot -= FIFO_SIZE; + iKeyFifo[slot] = val; + iFifoCount++; +} + +void DKeyboardPs2Soc::Isr(TAny* aPtr) +{ + __DEBUG_PRINT("DKeyboardPs2Soc::Isr"); + DKeyboardPs2Soc& k = *(DKeyboardPs2Soc*)aPtr; + + // Is now auto-clearing + while(ReadReg(KHwBaseKmiKeyboard, KBD_FIFO_COUNT)!=0) + k.FifoPush(ReadReg(KHwBaseKmiKeyboard, KBD_DATA)); + + //WriteReg(KHwBaseKmiKeyboard,KBD_CLEAR_INT, 0); + Interrupt::Clear(EIntKeyboard); + k.iRxDfc.Add(); +} + +DKeyboardPs2Soc::DKeyboardPs2Soc() + : DPowerHandler(KLitKeyboard), + iRxDfc(RxDfc,this,Kern::DfcQue0(),1), + iMsgQ(rxMsg,this,NULL,1) +{ + iKeyboardOn = ETrue; + iFifoPos = 0; + iFifoCount = 0; +} + +TInt DKeyboardPs2Soc::Create() +{ + __DEBUG_PRINT("DKeyboardPs2Soc::Create"); + + TInt r=KErrNone; + iDfcQ=Kern::DfcQue0(); + + iFifoPos = iFifoCount = 0; + + r=Kern::AddHalEntry(EHalGroupKeyboard,halFunction,this); + if (r!=KErrNone) + return r; + + iMsgQ.SetDfcQ(iDfcQ); + iMsgQ.Receive(); + + r=Interrupt::Bind(EIntKeyboard,Isr,this); + if (r==KErrNone) { + Add(); + KeyboardOn(); + } + return r; +} + +void DKeyboardPs2Soc::PowerUp() +{ + PowerUpDone(); +} + +void DKeyboardPs2Soc::PowerDown(TPowerState) +{ + PowerDownDone(); +} + +void DKeyboardPs2Soc::KeyboardOn() +{ + __DEBUG_PRINT("DKeyboardPs2Soc::KeyboardOn"); + TInt reg = ReadReg(KHwBaseKmiKeyboard,KBD_ID); + + Interrupt::Enable(EIntKeyboard); + WriteReg(KHwBaseKmiKeyboard,KBD_INT_ENABLE,1); +} + +void DKeyboardPs2Soc::KeyboardOff() +{ + __DEBUG_PRINT("DKeyboardPs2Soc::KeyboardOff"); + Interrupt::Disable(EIntKeyboard); + WriteReg(KHwBaseKmiKeyboard,KBD_INT_ENABLE,0); +} + +void DKeyboardPs2Soc::HandleMsg(TMessageBase* aMsg) +{ + __DEBUG_PRINT("DKeyboardPs2Soc::HandleMsg"); + if (aMsg->iValue) + KeyboardOn(); + else + KeyboardOff(); + aMsg->Complete(KErrNone,ETrue); +} + +void DKeyboardPs2Soc::KeyboardInfo(TKeyboardInfoV01& aInfo) +{ + aInfo.iKeyboardType=KConfigKeyboardType; + aInfo.iDeviceKeys=KConfigKeyboardDeviceKeys; + aInfo.iAppsKeys=KConfigKeyboardAppsKeys; +} + +TInt DKeyboardPs2Soc::HalFunction(TInt aFunction, TAny* a1, TAny* a2) +{ + TInt r=KErrNone; + + __DEBUG_PRINT("DKeyboardPs2Soc::HalFunction"); + switch(aFunction) + { + case EKeyboardHalKeyboardInfo: + { + TPckgBuf kPckg; + KeyboardInfo(kPckg()); + Kern::InfoCopy(*(TDes8*)a1,kPckg); + break; + } + // UIKLAF Silent running/power management + case EKeyboardHalSetKeyboardState: + { + if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EKeyboardHalSetKeyboardState"))) + return KErrPermissionDenied; + if ((TBool)a1) + { + TThreadMessage& m=Kern::Message(); + m.iValue = ETrue; + m.SendReceive(&iMsgQ); + } + else + { + TThreadMessage& m=Kern::Message(); + m.iValue = EFalse; + m.SendReceive(&iMsgQ); + } + } + break; + case EKeyboardHalKeyboardState: + kumemput32(a1, &iKeyboardOn, sizeof(TBool)); + break; + default: + r=KErrNotSupported; + break; + } + return r; +} + +void DKeyboardPs2Soc::RxDfc(TAny* aPtr) +{ + TRawEvent e; + DKeyboardPs2Soc& k = *(DKeyboardPs2Soc*)aPtr; + + while(k.iFifoCount>0) { + int keycode = k.FifoPop(); + int dwn = (keycode & 0x80000000) ? 0 : 1; + __DEBUG_PRINT("DKeyboardPs2Soc::RxDfc %d %d", keycode, dwn); + + keycode &= ~(0x80000000); + if (dwn) { + __DEBUG_PRINT("kbd EKeyDown:%d",keycode); + e.Set(TRawEvent::EKeyDown,KConvertCode[keycode],0); + } + else { + __DEBUG_PRINT("kbd EKeyUp:%d",keycode); + e.Set(TRawEvent::EKeyUp,KConvertCode[keycode],0); + } + Kern::AddEvent(e); + } +} + +DECLARE_STANDARD_EXTENSION() +{ + TInt r=KErrNoMemory; + DKeyboardPs2Soc* pK=new DKeyboardPs2Soc; + if (pK) + r=pK->Create(); + __KTRACE_OPT(KEXTENSION,__DEBUG_PRINT("Returns %d",r)); + return r; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/keyboard/syborg_keyboard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/keyboard/syborg_keyboard.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,337 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic keyboard driver +* +*/ + +#ifndef _SYBORG_KEYBOARD_H +#define _SYBORG_KEYBOARD_H + +#include +#include +#include + +#ifdef DEBUG +#define __DEBUG_PRINT(format...) Kern::Printf(format) +#else +#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) +#endif + +#define FIFO_SIZE 16 + +_LIT(KLitKeyboard,"Syborg Keyboard"); +const TKeyboard KConfigKeyboardType = EKeyboard_Full; +const TInt KConfigKeyboardDeviceKeys = 0; +const TInt KConfigKeyboardAppsKeys = 0; + +class DKeyboardPs2Soc : public DPowerHandler +{ +public: + DKeyboardPs2Soc(); + TInt Create(); + TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2); + void KeyboardInfo(TKeyboardInfoV01& aInfo); + void KeyboardOn(); + void KeyboardOff(); + void PowerUp(); + void PowerDown(TPowerState); + void HandleMsg(TMessageBase* aMsg); + +private: + static void Isr(TAny* aPtr); + static void RxDfc(TAny* aPtr); + + private: + TInt FifoPop(void); + void FifoPush(TInt val); + + TInt iKeyFifo[FIFO_SIZE]; + TInt iFifoPos; + TInt iFifoCount; + +private: + TDfc iRxDfc; + TBool iKeyboardOn; + +public: + TDfcQue* iDfcQ; + TMessageQue iMsgQ; + + enum { + KBD_ID = 0, + KBD_DATA = 1, + KBD_FIFO_COUNT = 2, + KBD_INT_ENABLE = 3 + }; +}; + +const TUint8 KConvertCode[] = + { + /*00*/ EStdKeyNull, + /*01*/ EStdKeyEscape, + /*02*/ '1', + /*03*/ '2', + /*04*/ '3', + /*05*/ '4', + /*06*/ '5', + /*07*/ '6', + /*08*/ '7', + /*09*/ '8', + /*0a*/ '9', + /*0b*/ '0', + /*0c*/ EStdKeyMinus, + /*0d*/ EStdKeyEquals, + /*0e*/ EStdKeyBackspace, + /*0f*/ EStdKeyTab, + + /*10*/ 'Q', + /*11*/ 'W', + /*12*/ 'E', + /*13*/ 'R', + /*14*/ 'T', + /*15*/ 'Y', + /*16*/ 'U', + /*17*/ 'I', + /*18*/ 'O', + /*19*/ 'P', + /*1a*/ EStdKeySquareBracketLeft, + /*1b*/ EStdKeySquareBracketRight, + /*1c*/ EStdKeyEnter, + /*1d*/ EStdKeyLeftCtrl, + /*1e*/ 'A', + /*1f*/ 'S', + + /*20*/ 'D', + /*21*/ 'F', + /*22*/ 'G', + /*23*/ 'H', + /*24*/ 'J', + /*25*/ 'K', + /*26*/ 'L', + /*27*/ EStdKeySemiColon, + /*28*/ EStdKeySingleQuote, + /*29*/ EStdKeyNull, + /*2a*/ EStdKeyLeftShift, + /*2b*/ EStdKeyHash, + /*2c*/ 'Z', + /*2d*/ 'X', + /*2e*/ 'C', + /*2f*/ 'V', + + /*30*/ 'B', + /*31*/ 'N', + /*32*/ 'M', + /*33*/ EStdKeyComma, + /*34*/ EStdKeyFullStop, + /*35*/ EStdKeyForwardSlash, + /*36*/ EStdKeyRightShift, + /*37*/ EStdKeyPrintScreen, + /*38*/ EStdKeyLeftAlt, + /*39*/ EStdKeySpace, + /*3a*/ EStdKeyCapsLock, + /*3b*/ EStdKeyMenu, // EStdKeyF1, + /*3c*/ EStdKeyF2, + /*3d*/ EStdKeyF3, + /*3e*/ EStdKeyF4, + /*3f*/ EStdKeyF5, + + /*40*/ EStdKeyF6, + /*41*/ EStdKeyF7, + /*42*/ EStdKeyF8, + /*43*/ EStdKeyF9, + /*44*/ EStdKeyF10, + /*45*/ EStdKeyNull, + /*46*/ EStdKeyScrollLock, + /*47*/ EStdKeyHome, + /*48*/ EStdKeyUpArrow, + /*49*/ EStdKeyPageUp, + /*4a*/ EStdKeyNull, + /*4b*/ EStdKeyLeftArrow, + /*4c*/ EStdKeyNull, + /*4d*/ EStdKeyRightArrow, + /*4e*/ EStdKeyNull, + /*4f*/ EStdKeyNull, + + /*50*/ EStdKeyDownArrow, + /*51*/ EStdKeyPageDown, + /*52*/ EStdKeyInsert, + /*53*/ EStdKeyDelete, + /*54*/ EStdKeyNull, + /*55*/ EStdKeyNull, + /*56*/ EStdKeyBackSlash, + /*57*/ EStdKeyF11, + /*58*/ EStdKeyF12, + /*59*/ EStdKeyNull, + /*5a*/ EStdKeyNull, + /*5b*/ EStdKeyNull, + /*5c*/ EStdKeyNull, + /*5d*/ EStdKeyNull, + /*5e*/ EStdKeyNull, + /*5f*/ EStdKeyNull, + + /*60*/ EStdKeyNull, + /*61*/ EStdKeyNull, + /*62*/ EStdKeyNull, + /*63*/ EStdKeyNull, + /*64*/ EStdKeyNull, + /*65*/ EStdKeyNull, + /*66*/ EStdKeyNull, + /*67*/ EStdKeyNull, + /*68*/ EStdKeyNull, + /*69*/ EStdKeyNull, + /*6a*/ EStdKeyNull, + /*6b*/ EStdKeyNull, + /*6c*/ EStdKeyNull, + /*6d*/ EStdKeyNull, + /*6e*/ EStdKeyNull, + /*6f*/ EStdKeyNull, + + /*70*/ EStdKeyNull, + /*71*/ EStdKeyNull, + /*72*/ EStdKeyNull, + /*73*/ EStdKeyNull, + /*74*/ EStdKeyNull, + /*75*/ EStdKeyNull, + /*76*/ EStdKeyNull, + /*77*/ EStdKeyNull, + /*78*/ EStdKeyNull, + /*79*/ EStdKeyNull, + /*7a*/ EStdKeyNull, + /*7b*/ EStdKeyNull, + /*7c*/ EStdKeyNull, + /*7d*/ EStdKeyNull, + /*7e*/ EStdKeyNull, + /*7f*/ EStdKeyNull, + + /*80*/ EStdKeyNull, + /*81*/ EStdKeyNull, + /*82*/ EStdKeyNull, + /*83*/ EStdKeyNull, + /*84*/ EStdKeyNull, + /*85*/ EStdKeyNull, + /*86*/ EStdKeyNull, + /*87*/ EStdKeyNull, + /*88*/ EStdKeyNull, + /*89*/ EStdKeyNull, + /*8a*/ EStdKeyNull, + /*8b*/ EStdKeyNull, + /*8c*/ EStdKeyNull, + /*8d*/ EStdKeyNull, + /*8e*/ EStdKeyNull, + /*8f*/ EStdKeyNull, + + /*90*/ EStdKeyNull, + /*91*/ EStdKeyNull, + /*92*/ EStdKeyNull, + /*93*/ EStdKeyNull, + /*94*/ EStdKeyNull, + /*95*/ EStdKeyNull, + /*96*/ EStdKeyNull, + /*97*/ EStdKeyNull, + /*98*/ EStdKeyNull, + /*99*/ EStdKeyNull, + /*9a*/ EStdKeyNull, + /*9b*/ EStdKeyNull, + /*9c*/ EStdKeyNull, + /*9d*/ EStdKeyNull, + /*9e*/ EStdKeyNull, + /*9f*/ EStdKeyNull, + + /*a0*/ EStdKeyNull, + /*a1*/ EStdKeyNull, + /*a2*/ EStdKeyNull, + /*a3*/ EStdKeyNull, + /*a4*/ EStdKeyNull, + /*a5*/ EStdKeyNull, + /*a6*/ EStdKeyNull, + /*a7*/ EStdKeyNull, + /*a8*/ EStdKeyNull, + /*a9*/ EStdKeyNull, + /*aa*/ EStdKeyNull, + /*ab*/ EStdKeyNull, + /*ac*/ EStdKeyNull, + /*ad*/ EStdKeyNull, + /*ae*/ EStdKeyNull, + /*af*/ EStdKeyNull, + + /*b0*/ EStdKeyNull, + /*b1*/ EStdKeyNull, + /*b2*/ EStdKeyNull, + /*b3*/ EStdKeyNull, + /*b4*/ EStdKeyNull, + /*b5*/ EStdKeyNull, + /*b6*/ EStdKeyNull, + /*b7*/ EStdKeyNull, + /*b8*/ EStdKeyNull, + /*b9*/ EStdKeyNull, + /*ba*/ EStdKeyNull, + /*bb*/ EStdKeyNull, + /*bc*/ EStdKeyNull, + /*bd*/ EStdKeyNull, + /*be*/ EStdKeyNull, + /*bf*/ EStdKeyNull, + + /*c0*/ EStdKeyNull, + /*c1*/ EStdKeyNull, + /*c2*/ EStdKeyNull, + /*c3*/ EStdKeyNull, + /*c4*/ EStdKeyNull, + /*c5*/ EStdKeyNull, + /*c6*/ EStdKeyNull, + /*c7*/ EStdKeyNull, + /*c8*/ EStdKeyNull, + /*c9*/ EStdKeyNull, + /*ca*/ EStdKeyNull, + /*cb*/ EStdKeyNull, + /*cc*/ EStdKeyNull, + /*cd*/ EStdKeyNull, + /*ce*/ EStdKeyNull, + /*cf*/ EStdKeyNull, + + /*d0*/ EStdKeyNull, + /*d1*/ EStdKeyNull, + /*d2*/ EStdKeyNull, + /*d3*/ EStdKeyNull, + /*d4*/ EStdKeyNull, + /*d5*/ EStdKeyNull, + /*d6*/ EStdKeyNull, + /*d7*/ EStdKeyNull, + /*d8*/ EStdKeyNull, + /*d9*/ EStdKeyNull, + /*da*/ EStdKeyNull, + /*db*/ EStdKeyNull, + /*dc*/ EStdKeyNull, + /*dd*/ EStdKeyNull, + /*de*/ EStdKeyNull, + /*df*/ EStdKeyNull, + + /*e0*/ EStdKeyNull, + /*e1*/ EStdKeyNull, + /*e2*/ EStdKeyNull, + /*e3*/ EStdKeyNull, + /*e4*/ EStdKeyNull, + /*e5*/ EStdKeyNull, + /*e6*/ EStdKeyNull, + /*e7*/ EStdKeyNull, + /*e8*/ EStdKeyNull, + /*e9*/ EStdKeyNull, + /*ea*/ EStdKeyNull, + /*eb*/ EStdKeyNull, + /*ec*/ EStdKeyNull, + /*ed*/ EStdKeyNull, + /*ee*/ EStdKeyNull, + /*ef*/ EStdKeyNull, +}; + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/keymap/keymap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/keymap/keymap.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,1952 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is for a UK Keyboard +* +*/ + +#include + +//#define US_KEYBOARD + +// the "array" parameter must be a true array and not a pointer +#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0])) + +#define TABLE_ENTRY_ANOTHER_CTRL_DIGIT \ + { \ + { \ + EModifierKeyUp|EModifierFunc, \ + 0 \ + }, \ + { \ + EKeyNull, \ + EAnyDigitGivenRadix \ + }, \ + { \ + EStateCtrlDigits, \ + EAddOnCtrlDigit, \ + 0 \ + } \ + } + +// This table is searched for a match if a match has not been +// found in the current state's table + +LOCAL_D const SFuncTableEntry defaultTable[]= + { + { // prevent key up events generating keycodes + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyNull, + EAnyKey + }, + { + EStateUnchanged, + EDoNothing, + 0 + } + }, + { // prevent any modifer key from changing state + { + 0, + 0 + }, + { + EKeyNull, + EAnyModifierKey + }, + { + EStateUnchanged, + EDoNothing, + 0 + } + }, + { // filter out any unprocessed codes??? + { + 0, + 0 + }, + { + EKeyNull, + EAnyKey + }, + { + EStateNormal, + EDoNothing, + 0 + } + } + }; + +// The table indicating which keys change which modifiers; +// the state field in this table is ignored +LOCAL_D const SFuncTableEntry modifierTable[]= + { + { + { + EModifierKeyUp, + 0 + }, + { + EKeyCapsLock, + EMatchKey + }, + { + EStateUnchanged, + EToggleModifier, + EModifierCapsLock + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyNumLock, + EMatchKey + }, + { + EStateUnchanged, + EToggleModifier, + EModifierNumLock + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyScrollLock, + EMatchKey + }, + { + EStateUnchanged, + EToggleModifier, + EModifierScrollLock + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyLeftAlt, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierAlt|EModifierLeftAlt + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyLeftAlt, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierLeftAlt + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyLeftFunc, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierFunc|EModifierLeftFunc + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyLeftFunc, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierLeftFunc + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyLeftShift, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierShift|EModifierLeftShift + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyLeftShift, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierLeftShift + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyLeftCtrl, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierCtrl|EModifierLeftCtrl + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyLeftCtrl, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierLeftCtrl + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyRightAlt, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierAlt|EModifierRightAlt + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyRightAlt, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierRightAlt + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyRightFunc, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierFunc|EModifierRightFunc + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyRightFunc, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierRightFunc + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyRightShift, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierShift|EModifierRightShift + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyRightShift, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierRightShift + } + }, + { + { + EModifierKeyUp, + 0 + }, + { + EKeyRightCtrl, + EMatchKey + }, + { + EStateUnchanged, + ETurnOnModifier, + EModifierCtrl|EModifierRightCtrl + } + }, + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyRightCtrl, + EMatchKey + }, + { + EStateUnchanged, + ETurnOffModifier, + EModifierRightCtrl + } + } + }; + +// table0 to table12 are the tables corresponding to states +// 0 to 12 respectively + +//LOCAL_D const SFuncTableEntry table0[]= +// { +// TABLE_ENTRY_ANOTHER_CTRL_DIGIT +// }; + +LOCAL_D const SFuncTableEntry table1[]= + { + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'e', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcAe + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'c', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcCcedilla + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 's', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1EsTset + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'o', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcOslash + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'd', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcThorn + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 't', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcSoftTh + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'l', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LeftChevron + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'r', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1RightChevron + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'x', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1InvExclam + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'q', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1InvQuest + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'a', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcAo + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'p', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1Pound + } + }, + TABLE_ENTRY_ANOTHER_CTRL_DIGIT + }; + +LOCAL_D const SFuncTableEntry table2[]= + { + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'a', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcAumlaut + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'e', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcEumlaut + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'i', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcIumlaut + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'o', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcOumlaut + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'u', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcUumlaut + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'y', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcYumlaut + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + ' ', + EMatchKey + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1SpaceUmlaut + } + }, + TABLE_ENTRY_ANOTHER_CTRL_DIGIT + }; + +LOCAL_D const SFuncTableEntry table3[]= + { + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'a', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcAgrave + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'e', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcEgrave + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'i', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcIgrave + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'o', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcOgrave + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'u', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcUgrave + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + ' ', + EMatchKey + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1SpaceGrave + } + }, + TABLE_ENTRY_ANOTHER_CTRL_DIGIT + }; + +LOCAL_D const SFuncTableEntry table4[]= + { + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'a', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcAacute + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'e', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcEacute + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'i', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcIacute + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'o', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcOacute + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'u', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcUacute + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'y', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcYacute + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + ' ', + EMatchKey + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcSpaceAcute + } + }, + TABLE_ENTRY_ANOTHER_CTRL_DIGIT + }; + +LOCAL_D const SFuncTableEntry table5[]= + { + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'a', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcAtilde + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'n', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcNtilde + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'o', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcOtilde + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + ' ', + EMatchKey + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcSpaceTilde + } + }, + TABLE_ENTRY_ANOTHER_CTRL_DIGIT + }; + +LOCAL_D const SFuncTableEntry table6[]= + { + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'a', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcAcirc + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'e', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcEcirc + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'i', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcIcirc + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'o', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcOcirc + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + 'u', + EMatchKeyCaseInsens + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcUcirc + } + }, + { + { + EModifierFunc|EModifierKeyUp, + 0 + }, + { + ' ', + EMatchKey + }, + { + EStateNormal, + EPassSpecialKeyThru, + ELatin1LcSpaceCirc + } + }, + TABLE_ENTRY_ANOTHER_CTRL_DIGIT + }; + +//LOCAL_D const SFuncTableEntry table7[]= +// { +// TABLE_ENTRY_ANOTHER_CTRL_DIGIT +// }; + +//LOCAL_D const SFuncTableEntry table8[]= +// { +// TABLE_ENTRY_ANOTHER_CTRL_DIGIT +// }; + +//LOCAL_D const SFuncTableEntry table9[]= +// { +// TABLE_ENTRY_ANOTHER_CTRL_DIGIT +// }; + +LOCAL_D const SFuncTableEntry table10[]= + { + { // filter out up key strokes + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyNull, + EAnyKey + }, + { + EStateUnchanged, + EDoNothing, + 0 + } + }, + { // check for ctrl-number presses + { + EModifierCtrl|EModifierFunc|EModifierKeyUp, + EModifierCtrl + }, + { + EKeyNull, + EAnyDecimalDigit + }, + { + EStateDerivedFromDigitEntered, + EAddOnCtrlDigit, + 0 + } + }, + { // pass thru any keys which can't be state control keys + { + EModifierFunc, + 0, + }, + { + EKeyNull, + EAnyKey + }, + { + EStateUnchanged, + EPassKeyThru, + 0 + } + }, + { // pass thru any keys which can't be state control keys + { + EModifierCtrl, + EModifierCtrl, + }, + { + EKeyNull, + EAnyKey + }, + { + EStateUnchanged, + EPassKeyThru, + 0 + } + }, + { // check for FN-q + { + EModifierCtrl|EModifierFunc|EModifierKeyUp, + EModifierFunc + }, + { + 'q', + EMatchKeyCaseInsens + }, + { + 1, + EDoNothing, + 0 + } + }, + { // check for FN-z + { + EModifierCtrl|EModifierFunc|EModifierKeyUp, + EModifierFunc + }, + { + 'z', + EMatchKeyCaseInsens + }, + { + 2, + EDoNothing, + 0 + } + }, + { // check for FN-x + { + EModifierCtrl|EModifierFunc|EModifierKeyUp, + EModifierFunc + }, + { + 'x', + EMatchKeyCaseInsens + }, + { + 3, + EDoNothing, + 0 + } + }, + { // check for FN-c + { + EModifierCtrl|EModifierFunc|EModifierKeyUp, + EModifierFunc + }, + { + 'c', + EMatchKeyCaseInsens + }, + { + 4, + EDoNothing, + 0 + } + }, + { // check for FN-v + { + EModifierCtrl|EModifierFunc|EModifierKeyUp, + EModifierFunc + }, + { + 'v', + EMatchKeyCaseInsens + }, + { + 5, + EDoNothing, + 0 + } + }, + { // check for FN-b + { + EModifierCtrl|EModifierFunc|EModifierKeyUp, + EModifierFunc + }, + { + 'b', + EMatchKeyCaseInsens + }, + { + 6, + EDoNothing, + 0 + } + }, + { // pass thru any non-processed keys + { + 0, + 0 + }, + { + EKeyNull, + EAnyKey + }, + { + EStateUnchanged, + EPassKeyThru, + 0 + } + } + }; + +//LOCAL_D const SFuncTableEntry table11[]= +// { +// TABLE_ENTRY_ANOTHER_CTRL_DIGIT +// }; + +LOCAL_D const SFuncTableEntry table12[]= + { + { + { + EModifierKeyUp, + EModifierKeyUp + }, + { + EKeyLeftCtrl, + EMatchLeftOrRight + }, + { + EStateNormal, + EPassCtrlDigitsThru, + 0 + } + }, + TABLE_ENTRY_ANOTHER_CTRL_DIGIT + }; + +LOCAL_D const SFuncTable genFuncTables[]= + { + { + 0, + NULL + }, + { + ARRAY_LENGTH(table1), + &table1[0] + }, + { + ARRAY_LENGTH(table2), + &table2[0] + }, + { + ARRAY_LENGTH(table3), + &table3[0] + }, + { + ARRAY_LENGTH(table4), + &table4[0] + }, + { + ARRAY_LENGTH(table5), + &table5[0] + }, + { + ARRAY_LENGTH(table6), + &table6[0] + }, + { + 0, + NULL + }, + { + 0, + NULL + }, + { + 0, + NULL + }, + { + ARRAY_LENGTH(table10), + &table10[0] + }, + { + 0, + NULL + }, + { + ARRAY_LENGTH(table12), + &table12[0] + } + }; + +LOCAL_D const SFuncTables FuncTables= + { + { + ARRAY_LENGTH(defaultTable), + &defaultTable[0] + }, + { + ARRAY_LENGTH(modifierTable), + &modifierTable[0] + }, + ARRAY_LENGTH(genFuncTables), + &genFuncTables[0] + }; + +LOCAL_D const SScanCodeBlock scanCodeBlock_unmodifiable[]= + { + {EStdKeyLeftShift, EStdKeyScrollLock} + }; + +LOCAL_D const TUint16 convKeyCodes_unmodifiable[]= + { + EKeyLeftShift, + EKeyRightShift, + EKeyLeftAlt, + EKeyRightAlt, + EKeyLeftCtrl, + EKeyRightCtrl, + EKeyLeftFunc, + EKeyRightFunc, + EKeyCapsLock, + EKeyNumLock, + EKeyScrollLock + }; + +// base: this table traps all of the keyboard's scanCodes except those in convKeyCodes_unmodifiable +LOCAL_D const SScanCodeBlock scanCodeBlock_base[]= + { + {EStdKeyNull, EStdKeyDownArrow}, + {'0', '9'}, + {'A', 'Z'}, + {EStdKeyF1, EStdKeyDictaphoneRecord}, + }; + +LOCAL_D const TUint16 convKeyCodes_base[]= + { + EKeyNull, + EKeyBackspace, + EKeyTab, + EKeyEnter, + EKeyEscape, + ' ', + EKeyPrintScreen, + EKeyPause, + EKeyHome, + EKeyEnd, + EKeyPageUp, + EKeyPageDown, + EKeyInsert, + EKeyDelete, + EKeyLeftArrow, + EKeyRightArrow, + EKeyUpArrow, + EKeyDownArrow, + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + EKeyF1, + EKeyF2, + EKeyF3, + EKeyF4, + EKeyF5, + EKeyF6, + EKeyF7, + EKeyF8, + EKeyF9, + EKeyF10, + EKeyF11, + EKeyF12, + EKeyF13, + EKeyF14, + EKeyF15, + EKeyF16, + EKeyF17, + EKeyF18, + EKeyF19, + EKeyF20, + EKeyF21, + EKeyF22, + EKeyF23, + EKeyF24, + '`', + ',', + '.', + '/', + '\\', + ';', + '\'', +#ifndef US_KEYBOARD + '#', +#else + '\\', +#endif + '[', + ']', + '-', + '=', + '/', + '*', + '-', + '+', + EKeyEnter, + EKeyEnd, + EKeyDownArrow, + EKeyPageDown, + EKeyLeftArrow, + EKeyNull, // numeric keypad '5' + EKeyRightArrow, + EKeyHome, + EKeyUpArrow, + EKeyPageUp, + EKeyInsert, + EKeyDelete, + EKeyMenu, + EKeyBacklightOn, + EKeyBacklightOff, + EKeyBacklightToggle, + EKeyIncContrast, + EKeyDecContrast, + EKeySliderDown, + EKeySliderUp, + EKeyDictaphonePlay, + EKeyDictaphoneStop, + EKeyDictaphoneRecord, + }; + +// caps-lock: this table traps those scanCodes which are affected by caps-lock +LOCAL_D const SScanCodeBlock scanCodeBlock_capsLock[]= + { + {'A', 'Z'} + }; + +LOCAL_D const TUint16 convKeyCodes_capsLock[]= + { + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z' + }; + +// shift: this table traps those scanCodes which are affected +// by shift EXCEPT for those scanCodes affected by caps-lock +LOCAL_D const SScanCodeBlock scanCodeBlock_shift[]= + { + {'0', '9'}, + {EStdKeyXXX, EStdKeyEquals}, + }; + +LOCAL_D const TUint16 convKeyCodes_shift[]= + { + ')', + '!', + '"', + ELatin1Pound, + '$', + '%', + '^', + '&', + '*', + '(', + ELatin1LogicNot, + '<', + '>', + '?', + '|', + ':', + '@', + '~', + '{', + '}', + '_', + '+' + }; + +// numlock: this table traps those scanCodes which are affected by numlock +LOCAL_D const SScanCodeBlock scanCodeBlock_numLock[]= + { + {EStdKeyNkpForwardSlash, EStdKeyNkpFullStop} + }; + +LOCAL_D const TUint16 convKeyCodes_numLock[]= + { + '/', + '*', + '-', + '+', + EKeyEnter, + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '0', + '.' + }; + +// func: this table traps those scanCodes which are affected +// by func but not shift +LOCAL_D const SScanCodeBlock scanCodeBlock_func[]= + { + {'0', '9'}, + {'K', 'L'}, + {'U', 'U'}, + {'I', 'I'}, + {'O', 'P'}, + {EStdKeySingleQuote, EStdKeySingleQuote}, + {EStdKeyLeftArrow, EStdKeyDownArrow}, + {EStdKeyTab, EStdKeyTab}, + {EStdKeyEscape, EStdKeyEscape}, + {'M', 'M'}, + {EStdKeyComma, EStdKeyFullStop}, + {EStdKeySpace, EStdKeySpace}, + {EStdKeyMenu, EStdKeyMenu}, + }; + +LOCAL_D const TUint16 convKeyCodes_func[]= + { + '}', + '_', + '#', + '\\', + '@', + '<', + '>', + '[', + ']', + '{', + '~', + ';', + '/', + '*', + '-', + '+', + ':', + EKeyHome, + EKeyEnd, + EKeyPageUp, + EKeyPageDown, + EKeyCapsLock, + EKeyOff, + EKeyDecContrast, + EKeyHelp, + EKeyIncContrast, + EKeyBacklightToggle, + EKeyDial, + }; + +// func: this table traps those scanCodes which are affected +// by func and shift - lower case entries +LOCAL_D const SScanCodeBlock scanCodeBlock_funcUnshifted[]= + { + {'E', 'E'}, + }; + +LOCAL_D const TUint16 convKeyCodes_funcUnshifted[]= + { + ELatin1LcEacute, + }; + +// func: this table traps those scanCodes which are affected +// by func and shift - upper case entries +LOCAL_D const SScanCodeBlock scanCodeBlock_funcShifted[]= + { + {'E', 'E'}, + }; + +LOCAL_D const TUint16 convKeyCodes_funcShifted[]= + { + ELatin1UcEacute, + }; + +// ctrl: this table traps those scanCodes which are affected by ctrl +LOCAL_D const SScanCodeBlock scanCodeBlock_ctrl[]= + { +// The space key gets handled else where, otherwise it gets +// thrown away as a NULL key +// {EStdKeySpace, EStdKeySpace}, + + {'A', 'Z'} + }; + +LOCAL_D const TUint16 convKeyCodes_ctrl[]= + { +// 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26 + }; + +LOCAL_D const SConvSubTable + convSubTable_unmodifiable= + { + &convKeyCodes_unmodifiable[0], + { + ARRAY_LENGTH(scanCodeBlock_unmodifiable), + &scanCodeBlock_unmodifiable[0] + } + }, + convSubTable_base= + { + &convKeyCodes_base[0], + { + ARRAY_LENGTH(scanCodeBlock_base), + &scanCodeBlock_base[0] + } + }, + convSubTable_capsLock= + { + &convKeyCodes_capsLock[0], + { + ARRAY_LENGTH(scanCodeBlock_capsLock), + &scanCodeBlock_capsLock[0] + } + }, + convSubTable_shift= + { + &convKeyCodes_shift[0], + { + ARRAY_LENGTH(scanCodeBlock_shift), + &scanCodeBlock_shift[0] + } + }, + convSubTable_numLock= + { + &convKeyCodes_numLock[0], + { + ARRAY_LENGTH(scanCodeBlock_numLock), + &scanCodeBlock_numLock[0] + } + }, + convSubTable_func= + { + &convKeyCodes_func[0], + { + ARRAY_LENGTH(scanCodeBlock_func), + &scanCodeBlock_func[0] + } + }, + convSubTable_funcUnshifted= + { + &convKeyCodes_funcUnshifted[0], + { + ARRAY_LENGTH(scanCodeBlock_funcUnshifted), + &scanCodeBlock_funcUnshifted[0] + } + }, + convSubTable_funcShifted= + { + &convKeyCodes_funcShifted[0], + { + ARRAY_LENGTH(scanCodeBlock_funcShifted), + &scanCodeBlock_funcShifted[0] + } + }, + convSubTable_ctrl= + { + &convKeyCodes_ctrl[0], + { + ARRAY_LENGTH(scanCodeBlock_ctrl), + &scanCodeBlock_ctrl[0] + } + }; + +// Some modifiers, e.g. shift, may required more than one table (other than "base") +// to be searched; therefore arrays of tables are required +LOCAL_D const SConvSubTable + * const convSubTableArray_unmodifiable[]={&convSubTable_unmodifiable}, + * const convSubTableArray_base[]={&convSubTable_base}, + * const convSubTableArray_capsLock[]={&convSubTable_capsLock}, + * const convSubTableArray_shift[]={&convSubTable_capsLock, &convSubTable_shift}, + * const convSubTableArray_capsLockShift[]={&convSubTable_shift}, + * const convSubTableArray_numLock[]={&convSubTable_numLock}, + * const convSubTableArray_func[]={&convSubTable_func,&convSubTable_funcUnshifted}, + * const convSubTableArray_funcShift[]={&convSubTable_func,&convSubTable_funcShifted}, + * const convSubTableArray_ctrl[]={&convSubTable_ctrl}; + +// The order of these nodes is VITAL, as the scanCode/modifiers are +// searched for a match in this order +LOCAL_D const SConvTableNode convTableNodes[]= + { + { + { + 0, + 0 + }, + ARRAY_LENGTH(convSubTableArray_unmodifiable), + &convSubTableArray_unmodifiable[0] + }, + { + { + EModifierCtrl, + EModifierCtrl + }, + ARRAY_LENGTH(convSubTableArray_ctrl), + &convSubTableArray_ctrl[0] + }, + { + { + EModifierNumLock, + EModifierNumLock + }, + ARRAY_LENGTH(convSubTableArray_numLock), + &convSubTableArray_numLock[0] + }, + { + { + EModifierFunc|EModifierShift|EModifierCapsLock, + EModifierFunc + }, + ARRAY_LENGTH(convSubTableArray_func), + &convSubTableArray_func[0] + }, + { + { + EModifierFunc|EModifierShift|EModifierCapsLock, + EModifierFunc|EModifierShift|EModifierCapsLock + }, + ARRAY_LENGTH(convSubTableArray_func), + &convSubTableArray_func[0] + }, + { + { + EModifierFunc|EModifierShift|EModifierCapsLock, + EModifierFunc|EModifierShift + }, + ARRAY_LENGTH(convSubTableArray_funcShift), + &convSubTableArray_funcShift[0] + }, + { + { + EModifierFunc|EModifierShift|EModifierCapsLock, + EModifierFunc|EModifierCapsLock + }, + ARRAY_LENGTH(convSubTableArray_funcShift), + &convSubTableArray_funcShift[0] + }, + { + { + EModifierCapsLock|EModifierShift, + EModifierCapsLock + }, + ARRAY_LENGTH(convSubTableArray_capsLock), + &convSubTableArray_capsLock[0] + }, + { + { + EModifierShift|EModifierCapsLock, + EModifierShift + }, + ARRAY_LENGTH(convSubTableArray_shift), + &convSubTableArray_shift[0] + }, + { + { + EModifierCapsLock|EModifierShift, + EModifierCapsLock|EModifierShift + }, + ARRAY_LENGTH(convSubTableArray_capsLockShift), + &convSubTableArray_capsLockShift[0] + }, + { + { + 0, + 0 + }, + ARRAY_LENGTH(convSubTableArray_base), + &convSubTableArray_base[0] + } + }; + +// The top-level exported data structure of all the conversion tables +LOCAL_D const SConvTable ConvTable= + { + ARRAY_LENGTH(convTableNodes), + &convTableNodes[0] + }; + +// The list of scan-codes on the numeric keypad +LOCAL_D const SScanCodeBlock keypadScanCodeBlockArray[]= + { + {EStdKeyNumLock, EStdKeyNumLock}, + {EStdKeyNkpForwardSlash, EStdKeyNkpFullStop} + }; + +LOCAL_D const SScanCodeBlockList ConvTableKeypadScanCodes= + { + ARRAY_LENGTH(keypadScanCodeBlockArray), + &keypadScanCodeBlockArray[0] + }; + +// The list of non-autorepeating key-codes +LOCAL_D const TUint16 nonAutorepKeyCodeArray[]= + { + EKeyEscape, + EKeyPrintScreen, + EKeyPause, + EKeyInsert, + EKeyLeftShift, + EKeyRightShift, + EKeyLeftAlt, + EKeyRightAlt, + EKeyLeftCtrl, + EKeyRightCtrl, + EKeyLeftFunc, + EKeyRightFunc, + EKeyCapsLock, + EKeyNumLock, + EKeyScrollLock, + EKeyMenu, + EKeyDictaphonePlay, + EKeyDictaphoneStop, + EKeyDictaphoneRecord + }; + +LOCAL_D const SKeyCodeList ConvTableNonAutorepKeyCodes= + { + ARRAY_LENGTH(nonAutorepKeyCodeArray), + &nonAutorepKeyCodeArray[0] + }; + +EXPORT_C void KeyDataSettings(TRadix &aRadix,TCtrlDigitsTermination &aCtrlDigitsTermination,TInt &aDefaultCtrlDigitsMaxCount, + TInt &aMaximumCtrlDigitsMaxCount) + { + aRadix=EDecimal; + aCtrlDigitsTermination=ETerminationByCtrlUp; + aDefaultCtrlDigitsMaxCount=3; + aMaximumCtrlDigitsMaxCount=10; + } + +EXPORT_C void KeyDataFuncTable(SFuncTables &aFuncTables) + { + aFuncTables=FuncTables; + } + +EXPORT_C void KeyDataConvTable(SConvTable &aConvTable, TUint &aConvTableFirstScanCode,TUint &aConvTableLastScanCode, + SScanCodeBlockList &aKeypadScanCode,SKeyCodeList &aNonAutorepKeyCodes) + { + aConvTable=ConvTable; + aConvTableFirstScanCode=scanCodeBlock_base[0].firstScanCode; + aConvTableLastScanCode=scanCodeBlock_base[ARRAY_LENGTH(scanCodeBlock_base)-1].lastScanCode; + aKeypadScanCode=ConvTableKeypadScanCodes; + aNonAutorepKeyCodes=ConvTableNonAutorepKeyCodes; + } + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/keymap/keymap.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/keymap/keymap.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +TARGET VariantTarget(ekdata,dll) +TARGETTYPE dll +LINKAS ekdata.dll + +SYSTEMINCLUDE \epoc32\include + +SOURCE keymap.cpp + +LIBRARY euser.lib + +DEFFILE ..\..\e32\~\ekdata.def + +NOSTRICTDEF + +UID 0x1000008d 0x100039e0 +VENDORID 0x70000001 + +CAPABILITY all +MACRO __SECURE_API__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/monitor/monap.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/monitor/monap.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#define __MONAP_MMP__ + +#include +#include "..\..\e32\kernel\exmondebug.mmp" + +TARGET VariantTarget(exmondebug,dll) + +SYSTEMINCLUDE \epoc32\include\drivers +SYSTEMINCLUDE ..\serial + +SOURCEPATH . +SOURCE monitor.cpp + +LIBRARY PlatformLib + +CAPABILITY all + +VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/monitor/monitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/monitor/monitor.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include + +#include "syborg_serial.h" + +void CrashDebugger::InitUart() +{ + TUint32 debugPortBase = VARIANT_INTERFACE::DebugPortAddr(); + TUint8 res = ReadReg(debugPortBase, 0); + WriteReg(debugPortBase,DCommSyborgSoc::SERIAL_INT_ENABLE,0); +} + +void CrashDebugger::UartOut(TUint aChar) +{ + TUint32 debugPortBase = VARIANT_INTERFACE::DebugPortAddr(); + WriteReg(debugPortBase,DCommSyborgSoc::SERIAL_DATA,aChar); +} + +TUint8 CrashDebugger::UartIn() +{ + TUint32 debugPortBase = VARIANT_INTERFACE::DebugPortAddr(); + while (ReadReg(debugPortBase,DCommSyborgSoc::SERIAL_FIFO_COUNT)==0) + ; + + return ReadReg(debugPortBase,DCommSyborgSoc::SERIAL_DATA); +} + +TBool CrashDebugger::CheckPower() +{ + return EFalse; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/pointer/pointer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/pointer/pointer.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "kernel\kern_ext.mmh" + +TARGET VariantTarget(epointer,dll) +TARGETTYPE kext +LINKAS epointer.dll + +SYSTEMINCLUDE . +SYSTEMINCLUDE AsspNKernIncludePath + +SOURCEPATH . +SOURCE syborg_pointer.cpp + +//LIBRARY ekern.lib +LIBRARY PlatformLib + +//NOEXPORTLIBRARY + +//DEFFILE ..\e32\~\empty.def +//DEFFILE .\~\cmse.def + +//NOSTRICTDEF + +UID 0x100039cf 0x100000db +VENDORID 0x70000001 + +CAPABILITY all + + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/pointer/syborg_pointer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/pointer/syborg_pointer.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,276 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic pointer driver +* +*/ + +//#define DEBUG + +#include +#include "syborg_pointer.h" + +TPointerRv::TPointerRv(): + iRxDfc(RxDfc,this,Kern::DfcQue0(),1) +{ + __DEBUG_PRINT("TPointerRv::TPointerRv()"); + TInt r = Interrupt::Bind(EIntPointer,Isr,this); + if(r != KErrNone) + __KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::TPointerRv() Interrupt::Bind(%d)=%d", + EIntPointer, r)); + iPointerOn = ETrue; + iLastBut = 0; + + Interrupt::Enable(EIntPointer); +} + +TPointerRv::~TPointerRv() +{ +} + +struct TPointerRv::PData* TPointerRv::FifoPop(void) +{ + struct TPointerRv::PData* val = &iPDataFifo[iFifoPos]; + iFifoPos++; + iFifoCount--; + + if (iFifoPos == FIFO_SIZE) + iFifoPos = 0; + + return val; +} + +void TPointerRv::FifoPush(struct TPointerRv::PData* val) +{ + TInt slot; + + if (iFifoCount == FIFO_SIZE) + return; + + slot = iFifoPos + iFifoCount; + if (slot >= FIFO_SIZE) + slot -= FIFO_SIZE; + iPDataFifo[slot] = *val; + iFifoCount++; + + // __DEBUG_PRINT("TPointerRv::FifoPush %d %d %d %d",val->x, val->y, val->z, val->but); + // __DEBUG_PRINT("TPointerRv::FifoPush %d %d %d %d",iPDataFifo[slot].x, iPDataFifo[slot].y, iPDataFifo[slot].z, iPDataFifo[slot].but); + +} + +void TPointerRv::Init3() +{ + __DEBUG_PRINT("TPointerRv::Init3"); + + TInt reg = ReadReg(KHwBaseKmiPointer,POINTER_ID); + WriteReg(KHwBaseKmiPointer,POINTER_INT_ENABLE,1); + + TInt r = Kern::AddHalEntry(EHalGroupMouse,DoPointerHalFunction,this); + if(r != KErrNone) + __KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::AddHalEntry()=%d", r)); + + // Get information about the screen display mode + TPckgBuf buf; + TVideoInfoV01& videoInfo = buf(); + + r = Kern::HalFunction(EHalGroupDisplay, EDisplayHalCurrentModeInfo, (TAny*)&buf, NULL); + if(r != KErrNone) + __KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::HalFunction(EDisplayHalCurrentModeInfo)=%d", r)); + + iScreenWidth = videoInfo.iSizeInPixels.iWidth; + iScreenHeight = videoInfo.iSizeInPixels.iHeight; + iDisplayMode = videoInfo.iDisplayMode; + ix = iy = 0; + + iXFactor = Fixed(iScreenWidth) / Fixed(0x8000); + iYFactor = Fixed(iScreenHeight) / Fixed(0x8000); + + iFifoPos = iFifoCount = 0; +} + + +void TPointerRv::Process(TPointerRv *i, struct TPointerRv::PData *pd) +{ + TRawEvent e; + + // __DEBUG_PRINT("Event: X=%d Y=%d Point %d", pd->x, pd->y, pd->but); + // __DEBUG_PRINT(" Last X=%d Y=%d Point %d", i->ix, i->iy, i->iLastBut); + + // i->ix += pd->x; + // i->iy += pd->y; + + i->ix = int(Fixed(pd->x) * i->iXFactor); + i->iy = int(Fixed(pd->y) * i->iYFactor); + + switch(pd->but) + { + case 0: // Button released + switch(i->iLastBut) + { + case 0: + if( (pd->x!=0) || (pd->y!=0) ) { + e.Set(TRawEvent::EPointerMove, i->ix, i->iy); + __DEBUG_PRINT("1 EPointerMove (x:%d y:%d)", i->ix, i->iy); + } + goto fin; + case 1: // Left + e.Set(TRawEvent::EButton1Up, i->ix, i->iy); + __DEBUG_PRINT("2 EButton1UP (x:%d y:%d)", i->ix, i->iy); + goto fin; + case 2: // Right + e.Set(TRawEvent::EButton2Up, i->ix, i->iy); + __DEBUG_PRINT("3 EButton2UP (x:%d y:%d)", i->ix, i->iy); + goto fin; + } + case 1: // Left + if (i->iLastBut == 0) { + e.Set(TRawEvent::EButton1Down, i->ix, i->iy); + __DEBUG_PRINT("4 EButton1Down (x:%d y:%d)", i->ix, i->iy); + } + else if( (pd->x!=0) || (pd->y!=0) ) { + e.Set(TRawEvent::EPointerMove, i->ix, i->iy); + __DEBUG_PRINT("5 EPointerMove (x:%d y:%d)", i->ix, i->iy); + } + break; + case 2: // Right + if (i->iLastBut == 0) { + e.Set(TRawEvent::EButton2Down, i->ix, i->iy); + __DEBUG_PRINT("6 EButton2Down (x:%d y:%d)", i->ix, i->iy); + } + else if( (pd->x!=0) || (pd->y!=0) ) { + e.Set(TRawEvent::EPointerMove, i->ix, i->iy); + __DEBUG_PRINT("7 EPointerMove (x:%d y:%d)", i->ix, i->iy); + } + break; + + } + fin: + Kern::AddEvent(e); + i->iLastBut = pd->but; +} + +void TPointerRv::RxDfc(TAny* aPtr) +{ + __DEBUG_PRINT("TPointerRv::RxDfc"); + + TPointerRv* i = static_cast(aPtr); + + while(i->iFifoCount>0) { + struct TPointerRv::PData *pd= i->FifoPop(); + Process(i,pd); + } +} + +void TPointerRv::Isr(TAny* aPtr) +{ + __DEBUG_PRINT("TPointerRv::Isr"); + + TPointerRv& k = *(TPointerRv*)aPtr; + // interrupts are now auto clear + + while(ReadReg(KHwBaseKmiPointer, POINTER_FIFO_COUNT)!=0) { + struct TPointerRv::PData pd; + pd.x = ReadReg(KHwBaseKmiPointer,POINTER_X); + pd.y = ReadReg(KHwBaseKmiPointer,POINTER_Y); + pd.z = ReadReg(KHwBaseKmiPointer,POINTER_Z); + pd.but = ReadReg(KHwBaseKmiPointer,POINTER_BUTTONS); + k.FifoPush(&pd); + WriteReg(KHwBaseKmiPointer,POINTER_LATCH,0); + } + + // WriteReg(KHwBaseKmiPointer,POINTER_CLEAR_INT,0); + Interrupt::Clear(EIntPointer); + k.iRxDfc.Add(); +} + +TInt TPointerRv::DoPointerHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2) +{ + return static_cast(aThis)->PointerHalFunction(aFunction,a1,a2); +} + +TInt TPointerRv::PointerHalFunction(TInt aFunction, TAny* a1, TAny* /*a2*/) +{ + __DEBUG_PRINT("TPointerRv::PointerHalFunction"); + + TInt r=KErrNone; + + switch(aFunction) + { + case EMouseHalMouseState: + { + kumemput32(a1, (TBool*)&iPointerOn, sizeof(TBool)); + break; + } + case EMouseHalSetMouseState: + { + __SECURE_KERNEL( + if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, + __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseState"))) + return KErrPermissionDenied; + ); + if(((TBool)a1 == HAL::EMouseState_Visible) && (iPointerOn == (TBool)EFalse)) + { + iPointerOn=(TBool)ETrue; + } + else if(((TBool)a1 == HAL::EMouseState_Invisible) && (iPointerOn==(TBool)ETrue)) + { + iPointerOn=(TBool)EFalse; + } + break; + } + case EMouseHalMouseInfo: + { + TPckgBuf vPckg; + TMouseInfoV01& xyinfo = vPckg(); + xyinfo.iMouseButtons = 2; + xyinfo.iMouseAreaSize.iWidth = iScreenWidth; + xyinfo.iMouseAreaSize.iHeight = iScreenHeight; + xyinfo.iOffsetToDisplay.iX = 0; + xyinfo.iOffsetToDisplay.iY = 0; + Kern::InfoCopy(*(TDes8*)a1,vPckg); + break; + } + case EMouseHalSetMouseSpeed: + { + __SECURE_KERNEL( + if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, + __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseSpeed"))) + return KErrPermissionDenied; + ); + // fall thru to NotSupported + } + case EMouseHalSetMouseAcceleration: + { + __SECURE_KERNEL( + if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, + __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseAcceleration"))) + return KErrPermissionDenied; + ); + // fall thru to NotSupported + } + default: + { + r = KErrNotSupported; + break; + } + } + return r; +} + +DECLARE_STANDARD_EXTENSION() +{ + __DEBUG_PRINT("DECLARE_STANDARD_EXTENSION"); + TPointerRv *d = new TPointerRv; + d->Init3(); + return KErrNone; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/pointer/syborg_pointer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/pointer/syborg_pointer.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic pointer driver +* +*/ + +#ifndef _SYBORG_POINTER_H +#define _SYBORG_POINTER_H + +#include +#include +#include +#include + +#define FIFO_SIZE 16 + +#ifdef DEBUG +#define __DEBUG_PRINT(format...) Kern::Printf(format) +#else +#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) +#endif + +class TPointerRv +{ +public: + TPointerRv(); + virtual ~TPointerRv(); + static TInt DoPointerHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2); + TInt PointerHalFunction(TInt aFunction, TAny* a1, TAny* a2); + void Init3(); + + private: + struct PData { + TInt x; + TInt y; + TInt z; + TInt but; + }; + + struct PData* FifoPop(void); + void FifoPush(struct PData*); + + struct PData iPDataFifo[FIFO_SIZE]; + TInt iFifoPos; + TInt iFifoCount; + + private: + static void Isr(TAny* aPtr); + static void RxDfc(TAny* aPtr ); + static void Process(TPointerRv *i, struct PData *); + + TDfc iRxDfc; + + TBool iPointerOn; // cursor visiability + TInt iScreenWidth; + TInt iScreenHeight; + TInt iDisplayMode; + + TInt ix,iy; + TInt iLastBut; + + + public: + + enum { + POINTER_ID = 0, + POINTER_LATCH = 1, + POINTER_FIFO_COUNT = 2, + POINTER_X = 3, + POINTER_Y = 4, + POINTER_Z = 5, + POINTER_BUTTONS = 6, + POINTER_INT_ENABLE = 7 + }; + + private: + // Fixed point maths + class Fixed { + + private: + int g; + const static int BP = 8; + const static int BP2 = BP*2; + enum FixedRaw { RAW }; + Fixed(FixedRaw, int guts) : g(guts) {} + + public: + Fixed() : g(0) {} + Fixed(const Fixed& a) : g( a.g ) {} + Fixed(int a) : g( a << BP ) {} + operator int() { return g>>BP; } + Fixed operator +() const { return Fixed(RAW,g); } + Fixed operator -() const { return Fixed(RAW,-g); } + Fixed operator +(const Fixed& a) const { return Fixed(RAW, g + a.g); } + Fixed operator -(const Fixed& a) const { return Fixed(RAW, g - a.g); } + Fixed operator *(const Fixed& a) const { return Fixed(RAW, (int)( ((long long)g * (long long)a.g ) >> BP)); } + Fixed operator /(const Fixed& a) const { return Fixed(RAW, int( (((long long)g << BP2) / (long long)(a.g)) >> BP) ); } + }; + + Fixed iXFactor; + Fixed iYFactor; +}; + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/rom/base_syborg.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/rom/base_syborg.iby Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Used by techview roms +* +*/ + +#ifndef __BASE_SYBORG_IBY__ +#define __BASE_SYBORG_IBY__ + +#define HEAPMAX(x) +//#define FIXED fixed +#define FIXED + +kerneltrace 0x80000000 + +memmodel multiple 0x100000 +//memmodel flexible 0x100000 0x1000 -0x4000 +//dlldatatop 0x7f000000 + +multikernel +bootbinary= KERNEL_DIR\_PLATFORM_NAME_bootloader_bootrom.bin + +debugport 0 +romsize=0x2000000 +romlinearbase=0x80000000 +romalign=0x10 +kerneldataaddress=0xC8000000 +kernelheapmin=0x08000 // calculated at boot time +kernelheapmax=0x00FFC000 +dataaddress=0x400000 +defaultstackreserve=0x200000 +romchecksum=0x12345678 + +// Must align kernel to 16K boundary since exception vectors will be mapped at 0xFFFF0000 +primary[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_ekern.exe \sys\bin\ekern.exe code-align 0x4000 + +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_btracex.ldd \sys\bin\btracex.ldd +file= ABI_DIR\DEBUG_DIR\btracec.dll \sys\bin\btracec.dll + +define BTRACEX_LDD _PLATFORM_NAME_btracex.ldd + +variant[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_kasyborg.dll \sys\bin\kasyborg.dll + +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_exmoncommon.dll \sys\bin\exmoncommon.dll +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_exmondebug.dll \sys\bin\exmondebug.dll + +extension[VARID]= KERNEL_DIR\DEBUG_DIR\kdebug.dll \sys\bin\kdebug.dll + +#ifdef RMDEBUG +#include "..\include\trk.iby" +#endif + +// IEEE-mode VFP support +extension[VARID]= KERNEL_DIR\DEBUG_DIR\evfp.dll \sys\bin\evfp.dll + +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_lcd.dll \sys\bin\lcd.dll + +device[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_eserial.pdd \sys\bin\euart1.pdd +device[VARID]= KERNEL_DIR\DEBUG_DIR\ecomm.ldd \sys\bin\ecomm.ldd + +extension[VARID]= KERNEL_DIR\DEBUG_DIR\elocd.ldd \sys\bin\elocd.ldd + +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_epointer.dll \sys\bin\epointer.dll +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_medint.pdd \sys\bin\medint.pdd + +extension[VARID]= KERNEL_DIR\DEBUG_DIR\exstart.dll \sys\bin\exstart.dll + +// Keyboard driver +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_ekeyb.dll \sys\bin\ekeyb.dll + +// Kernel pipe +device[VARID]= KERNEL_DIR\DEBUG_DIR\pipelib.ldd \sys\bin\pipelib.ldd + +// Host Filesystem +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_svphostfsdriver.ldd sys\bin\svphostfsdriver.ldd +file= KERNEL_DIR\DEBUG_DIR\svphostfsy.fsy sys\bin\svphostfsy.fsy +file= KERNEL_DIR\DEBUG_DIR\svphostfs.exe sys\bin\svphostfs.exe +file= KERNEL_DIR\DEBUG_DIR\svphostfsstart.exe sys\bin\sysstart.exe + +// file= KERNEL_DIR\DEBUG_DIR\stdnew.dll sys\bin\stdnew.dll + +// Snap Driver +extension[VARID]= KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_svpsnapdriver.ldd sys\bin\svpsnapdriver.ldd +file= KERNEL_DIR\DEBUG_DIR\snapapp.exe sys\bin\snapapp.exe + +// Estart drive mapping setup files. +data= EPOCROOT##epoc32\rom\syborg\estart.txt \sys\data\estart.txt + +define HAL_DLL _PLATFORM_NAME_hal.dll +define ESTART_EXE e32strt.exe +define KEYMAP_FILE _PLATFORM_NAME_ekdata +#define SCDV_DLL _PLATFORM_NAME_scdv.dll +#define EUSER_DLL _PLATFORM_NAME_euser.dll + +#endif // __BASE_SYBORG_IBY__ + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/rom/header.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/rom/header.iby Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#define HEAPMAX(x) + +#define VARID 0x0b0a0001 +#define MAGIC 0x0b0a0001 +#define ALL 0x0b0a0001 +#define FIXED + +kerneltrace 0x80000000 + +memmodel multiple 0x100000 +//memmodel flexible 0x100000 0x1000 -0x4000 +//dlldatatop 0x7f000000 + +trace 0x10 +collapse arm gcc 0 +multikernel + +version=0.01 +bootbinary=\epoc32\release\##MAIN##\_syborg_bootloader_bootrom.bin + +debugport 0 +romsize=0x2000000 +romlinearbase=0x80000000 +romalign=0x10 +kerneldataaddress=0xC8000000 +kernelheapmin=0x08000 // calculated at boot time +kernelheapmax=0x00FFF000 +dataaddress=0x400000 +defaultstackreserve=0x200000 +romchecksum=0x12345678 + +nowrapper // no rom header + +#ifdef UNICODE +unicode +#endif + +#define VARIANT_PATH syborg diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/rom/kernel.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/rom/kernel.iby Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Used by textshell roms +* +*/ + +//#define USE_AUTOEXEC + +#define EUSER_DLL _##VARIANT##_EUSER.DLL + +// Must align kernel to 16K boundary since exception vectors will be mapped at 0xFFFF0000 +primary[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EKERN.EXE \sys\bin\EKERN.EXE code-align 0x4000 +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_BTRACEX.LDD \sys\bin\BTRACEX.LDD +variant[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_KASYBORG.DLL \sys\bin\KASYBORG.DLL + +// IEEE-mode VFP support +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\EVFP.DLL \sys\bin\EVFP.DLL + +// Common monitor support. Must be before both interactive debugger and automatic logger. +extension[VARID]= \Epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EXMONCOMMON.DLL \sys\bin\EXMONCOMMON.DLL +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EXMONDEBUG.DLL \sys\bin\EXMONDEBUG.DLL + +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\KDEBUG.DLL \sys\bin\KDEBUG.DLL + +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_LCD.DLL \sys\bin\LCD.DLL +device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_ESERIAL.PDD \sys\bin\ESERIAL.PDD +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\ELOCD.LDD \sys\bin\ELOCD.LDD + +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EPOINTER.DLL \sys\bin\EPOINTER.DLL + +device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\ECOMM.LDD \sys\bin\ECOMM.LDD +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\EXSTART.DLL \sys\bin\EXSTART.DLL + +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_EKEYB.DLL \sys\bin\EKEYB.DLL + +file[VARID]= \epoc32\release\##MAIN##\##BUILD##\_##VARIANT##_EKDATA.DLL \sys\bin\EKDATA.DLL + +// Kernel pipe +device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\PIPELIB.LDD \sys\bin\PIPELIB.LDD + +// Host Filesystem +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_svphostfsdriver.ldd \sys\bin\svphostfsdriver.ldd +file= \epoc32\release\##KMAIN##\##BUILD##\svphostfsy.fsy \sys\bin\svphostfsy.fsy +file= \epoc32\release\##KMAIN##\##BUILD##\svphostfs.exe \sys\bin\svphostfs.exe +file= \epoc32\release\##KMAIN##\##BUILD##\svphostfsstart.exe \sys\bin\sysstart.exe + +// Snap Driver +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_svpsnapdriver.ldd \sys\bin\svpsnapdriver.ldd +file= \epoc32\release\##KMAIN##\##BUILD##\snapapp.exe \sys\bin\snapapp.exe + +// Estart +data= \epoc32\rom\syborg\ESTART.TXT \sys\data\ESTART.TXT + +#ifdef USE_AUTOEXEC +data= \epoc32\rom\##VARIANT##\AUTOEXEC.BAT AUTOEXEC.BAT +#endif + +extension[VARID]= \epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_MEDINT.PDD \sys\bin\MEDINT.PDD +//device[VARID]= \epoc32\release\##KMAIN##\##BUILD##\D_DEBUG.LDD \sys\bin\D_DEBUG.LDD diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/serial/serial.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/serial/serial.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include "kernel\kern_ext.mmh" + +TARGET VariantTarget(eserial,pdd) +TARGETTYPE pdd + +SYSTEMINCLUDE \epoc32\include\drivers +SYSTEMINCLUDE AsspNKernIncludePath + +SOURCEPATH . +SOURCE syborg_serial.cpp + +LIBRARY PlatformLib + +EPOCALLOWDLLDATA + +UID 0 0x1000015b +VENDORID 0x70000001 + +ROMTARGET eserial.pdd + +CAPABILITY all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/serial/syborg_serial.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/serial/syborg_serial.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,252 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic serial driver +* +* TODO: Handle multiple Units, hardcoded FIFO Size +*/ + +#include "syborg_serial.h" + +//#define DPRINT(x) Kern::Printf(x) +//#define DPRINT2(x,y) Kern::Printf(x,y) + +#define DPRINT(x) +#define DPRINT2(x,y) + +// --------------------------------------------------------------- +// --------------------------------------------------------------- + +DDriverSyborgComm::DDriverSyborgComm() +{ + iVersion=TVersion(KCommsMajorVersionNumber,KCommsMinorVersionNumber,KCommsBuildVersionNumber); +} + +TInt DDriverSyborgComm::Install() +{ + DPRINT("DDriverSyborgComm::Install"); + return SetName(&KPddName); +} + +void DDriverSyborgComm::GetCaps(TDes8 &aDes) const +{ + DPRINT("DDriverSyborgComm::GetCaps"); + + TCommCaps3 capsBuf; + TCommCapsV03 &c=capsBuf(); + c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400; + c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8; + c.iStopBits=KCapsStop1|KCapsStop2; + c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd; + c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported; + c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported; + c.iSIR=0; + c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported; + c.iFifo=KCapsHasFifo; + c.iRoleCaps=0; + c.iFlowControlCaps=0; + c.iBreakSupported=ETrue; + aDes.FillZ(aDes.MaxLength()); + aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength())); +} + +TInt DDriverSyborgComm::Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) +{ + DPRINT("DDriverSyborgComm::Create"); + + DCommSyborgSoc* pD=new DCommSyborgSoc; + aChannel=pD; + TInt r=KErrNoMemory; + if (pD) + r=pD->DoCreate(aUnit,anInfo); + return r; +} + +TInt DDriverSyborgComm::Validate(TInt aUnit, const TDesC8* /*anInfo*/, const TVersion& aVer) +{ + DPRINT("DDriverSyborgComm::Validate"); + if ((!Kern::QueryVersionSupported(iVersion,aVer)) || + (!Kern::QueryVersionSupported(aVer,TVersion(KMinimumLddMajorVersion,KMinimumLddMinorVersion,KMinimumLddBuild)))) + return KErrNotSupported; + return KErrNone; +} + +// --------------------------------------------------------------- +// --------------------------------------------------------------- + +DCommSyborgSoc::DCommSyborgSoc() +{ +} + +DCommSyborgSoc::~DCommSyborgSoc() +{ + Interrupt::Unbind(iIrq); +} + +TInt DCommSyborgSoc::DoCreate(TInt aUnit, const TDesC8* /*anInfo*/) +{ + DPRINT2("DCommSyborgSoc::DoCreate %d",aUnit); + switch(aUnit) + { + case 0: + iPortAddr = KHwBaseUart0; + iIrq = EIntSerial0; + break; + case 1: + iPortAddr = KHwBaseUart1; + iIrq = EIntSerial1; + break; + case 2: + iPortAddr = KHwBaseUart2; + iIrq = EIntSerial2; + break; + case 3: + iPortAddr = KHwBaseUart3; + iIrq = EIntSerial3; + break; + default: + iPortAddr = KHwBaseUart0; + iIrq = EIntSerial0; + break; + } + + Interrupt::Bind(EIntSerial0,Isr,this); + + return KErrNone; + +} + +TInt DCommSyborgSoc::Start() +{ + DPRINT("DCommSyborgSoc::Start"); + WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x1); + Interrupt::Enable(iIrq); + return KErrNone; +} + +void DCommSyborgSoc::Stop(TStopMode aMode) +{ + DPRINT("DCommSyborgSoc::Stop"); + WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x0); + Interrupt::Disable(iIrq); +} + +void DCommSyborgSoc::Break(TBool aState) +{ + DPRINT("DCommSyborgSoc::Break"); +} + +void DCommSyborgSoc::EnableTransmit() +{ + DPRINT("DCommSyborgSoc::EnableTransmit"); + while (Kern::PowerGood()) + { + TInt r=TransmitIsr(); + if (r<0) + break; + WriteReg(iPortAddr, SERIAL_DATA, r); + } +} + +TUint DCommSyborgSoc::Signals() const +{ + DPRINT("DCommSyborgSoc::Signals"); + return(0); +} + +void DCommSyborgSoc::SetSignals(TUint aSetMask, TUint aClearMask) +{ + DPRINT("DCommSyborgSoc::SetSignals"); +} + +TInt DCommSyborgSoc::ValidateConfig(const TCommConfigV01 &aConfig) const +{ + DPRINT("DCommSyborgSoc::ValidateConfig"); + return KErrNone; +} + +void DCommSyborgSoc::Configure(TCommConfigV01 &aConfig) +{ + DPRINT("DCommSyborgSoc::Configure"); +} + +void DCommSyborgSoc::Caps(TDes8 &aCaps) const +{ + DPRINT("DCommSyborgSoc::Caps"); + TCommCaps3 capsBuf; + TCommCapsV03 &c=capsBuf(); + c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400; + c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8; + c.iStopBits=KCapsStop1|KCapsStop2; + c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd; + c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported; + c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported; + c.iSIR=0; + c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported; + c.iFifo=KCapsHasFifo; + c.iRoleCaps=0; + c.iFlowControlCaps=0; + c.iBreakSupported=ETrue; + aCaps.FillZ(aCaps.MaxLength()); + aCaps=capsBuf.Left(Min(capsBuf.Length(),aCaps.MaxLength())); +} + +TInt DCommSyborgSoc::DisableIrqs() +{ + DPRINT("DCommSyborgSoc::DisableIrqs"); + return NKern::DisableAllInterrupts(); +} + +void DCommSyborgSoc::RestoreIrqs(TInt aIrq) +{ + DPRINT("DCommSyborgSoc::RestoreIrqs"); + NKern::RestoreInterrupts(aIrq); +} + +TDfcQue* DCommSyborgSoc::DfcQ(TInt /*aUnit*/) +{ + return Kern::DfcQue0(); +} + +void DCommSyborgSoc::CheckConfig(TCommConfigV01& aConfig) +{ + DPRINT("DCommSyborgSoc::CheckConfig"); +} + +void DCommSyborgSoc::Isr(TAny* aPtr) +{ + DCommSyborgSoc& d=*(DCommSyborgSoc*)aPtr; + TUint rx[32]; + TInt rxi=0; + + DPRINT2("DCommSyborgSoc::Isr %x",d.iIrq); + + // Is now auto clear + // WriteReg(d.iPortAddr, SERIAL_CLEAR_INT, 0x0); // clear interrupts + + while(ReadReg(d.iPortAddr, SERIAL_FIFO_COUNT)!=0) { + TUint ch = ReadReg(d.iPortAddr, SERIAL_DATA); + rx[rxi++]=ch; + } + d.ReceiveIsr(rx,rxi,0); +} + +// --------------------------------------------------------------- +// --------------------------------------------------------------- + +DECLARE_STANDARD_PDD() +{ + DPRINT("DECLARE_STANDARD_PDD()"); + return new DDriverSyborgComm; +} + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/serial/syborg_serial.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/serial/syborg_serial.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Minimalistic serial driver +* +*/ + +#ifndef _SYBORG_SERIAL_H +#define _SYBORG_SERIAL_H + +#include +#include +#include "system.h" + +const TInt KMinimumLddMajorVersion=1; +const TInt KMinimumLddMinorVersion=1; +const TInt KMinimumLddBuild=1; + +class DDriverSyborgComm : public DPhysicalDevice +{ +public: + DDriverSyborgComm(); + virtual TInt Install(); + virtual void GetCaps(TDes8 &aDes) const; + virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); + virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); +}; + +class DCommSyborgSoc : public DComm +{ +public: + DCommSyborgSoc(); + ~DCommSyborgSoc(); + TInt DoCreate(TInt aUnit, const TDesC8* anInfo); +public: + virtual TInt Start(); + virtual void Stop(TStopMode aMode); + virtual void Break(TBool aState); + virtual void EnableTransmit(); + virtual TUint Signals() const; + virtual void SetSignals(TUint aSetMask, TUint aClearMask); + virtual TInt ValidateConfig(const TCommConfigV01 &aConfig) const; + virtual void Configure(TCommConfigV01 &aConfig); + virtual void Caps(TDes8 &aCaps) const; + virtual TInt DisableIrqs(); + virtual void RestoreIrqs(TInt aIrq); + virtual TDfcQue* DfcQ(TInt aUnit); + virtual void CheckConfig(TCommConfigV01& aConfig); + static void Isr(TAny* aPtr); + +public: + TLinAddr iPortAddr; + TInt iIrq; + + enum { + SERIAL_ID = 0, + SERIAL_DATA = 1, + SERIAL_FIFO_COUNT = 2, + SERIAL_INT_ENABLE = 3, + SERIAL_DMA_TX_ADDR = 4, + SERIAL_DMA_TX_COUNT = 5, /* triggers dma */ + SERIAL_DMA_RX_ADDR = 6, + SERIAL_DMA_RX_COUNT = 7 /* triggers dma */ + }; +}; + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/assp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/assp.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: implementation of class Syborg +* +*/ + +#include +#include + +#ifdef __EMI_SUPPORT__ +#include +#endif + +//#define ASSP_DEBUG + +#ifdef ASSP_DEBUG +#define __DEBUG_PRINT(format...) Kern::Printf(format) +#else +#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) +#endif + +Syborg* Syborg::Variant=NULL; +// !@! +#if 0 +TPhysAddr Syborg::VideoRamPhys; +TPhysAddr Syborg::VideoRamPhysSecure; // Secure display memory +#endif + +GLDEF_D Syborg TheVariant; + +// Wait for interrupt idle routine +extern TInt SyborgWFIIdle(); + +DECLARE_STANDARD_ASSP() + +EXPORT_C Asic* VariantInitialise() +{ + return &TheVariant; +} + +void Syborg::Idle() +{ + // Use the basic Wait For Interrupt call to idle + TInt irq = NKern::DisableAllInterrupts(); +#ifdef __EMI_SUPPORT__ + EMI::EnterIdle(); +#endif + SyborgWFIIdle(); +#ifdef __EMI_SUPPORT__ + EMI::LeaveIdle(); +#endif + NKern::RestoreInterrupts(irq); +} + +TUint32 Syborg::NanoWaitCalibration() +{ + return 17; // 2 cycles approx 17ns at 125MHz +} + +TInt Syborg::VariantHal(TInt aFunction, TAny* a1, TAny* a2) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Syborg::VariantHal(%d, %0x, %0x)",aFunction,a1,a2)); + + switch(aFunction) + { + case EVariantHalVariantInfo: + { + TVariantInfoV01Buf infoBuf; + TVariantInfoV01& info = infoBuf(); + TUint clock=0; + info.iRomVersion = Epoc::RomHeader().iVersion; + info.iMachineUniqueId = (TInt64(HALData::EMachineUid_OmapH4)<<32); + info.iLedCapabilities = (8<<16) + KLedMaskGreen1; + info.iProcessorClockInKHz = clock; + info.iSpeedFactor = clock/25; + Kern::InfoCopy(*(TDes8*)a1,infoBuf); + break; + } + case EVariantHalDebugPortSet: + { + TUint32 thePort = (TUint32)a1; + switch(thePort) // Accept UART(0-3) + { + case 0: + case 1: + case 2: + case 3: + { + TSyborg::MarkDebugPortOff(); // mark port is not initialised + Kern::SuperPage().iDebugPort = thePort; // update the super page + Syborg::DebugInit(); // init debug port + break; + } + case (TUint32)KNullDebugPort: // debug output supressed + { + TSyborg::MarkDebugPortOff(); // mark port is not initialised + Kern::SuperPage().iDebugPort = thePort; // update the super page + break; + } + default: + return KErrNotSupported; + } + break; + } + case EVariantHalDebugPortGet: + { + TUint32 thePort = Kern::SuperPage().iDebugPort; + kumemput32(a1, &thePort, sizeof(TUint32)); + break; + } + case EVariantHalSwitches: + { + TUint32 x = 0; //Register32(KHwBaseSystemReg+KHoRoSystemSw); + kumemput32(a1, &x, sizeof(x)); + break; + } + case EVariantHalLedMaskSet: + { + //SetRegister32(KHwBaseSystemReg+KHoRwSystemLed, (TUint32)a1 & 0xFF); + break; + } + case EVariantHalLedMaskGet: + { + TUint32 x = 0; //Register32(KHwBaseSystemReg+KHoRwSystemLed); + kumemput32(a1, &x, sizeof(x)); + break; + } + case EVariantHalCustomRestartReason: + { + // Restart reason is stored in super page + TInt x = (Kern::SuperPage().iHwStartupReason); // & KmRestartCustomReasons) >> KsRestartCustomReasons; + kumemput32(a1, &x, sizeof(TInt)); + break; + } + case EVariantHalCustomRestart: + { + __KERNEL_CAPABILITY_CHECK( + if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt, + __PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EVariantHalCustomRestart"))) + return KErrPermissionDenied; + ) + Kern::Restart(0); + break; + } + default: + { + return KErrNotSupported; + } + } + return KErrNone; +} + +TPtr8 Syborg::MachineConfiguration() +{ + return TPtr8((TUint8*)&Kern::MachineConfig(),40,40); +} + +EXPORT_C Syborg::Syborg() +{ + iDebugPortBase = TSyborg::DebugPortAddr(); // initialised in bootstrap +} + +EXPORT_C TMachineStartupType Syborg::StartupReason() +{ + TUint s = Kern::SuperPage().iHwStartupReason; + __DEBUG_PRINT("Syborg::StartupReason CPU page value 0x%08X", s); + return EStartupColdReset; +} + +EXPORT_C void Syborg::Init1() +{ + __DEBUG_PRINT("Syborg::Init1()"); + + // Enable the CLCD in the System registers + SyborgInterrupt::Init1(); +} + +EXPORT_C void Syborg::Init3() +{ + NTimerQ& m = *(NTimerQ*)NTimerQ::TimerAddress(); + m.iRounding = -5; + + TInt r = Interrupt::Bind(EIntTimer1,SyborgInterrupt::MsTimerTick,&m); + if (r != KErrNone) + { + Kern::Fault("BindMsTick",r); + } + + TSyborg::Init3(); + TSyborg::ClearTimerInt(KHwBaseCounterTimer); + + r = Interrupt::Enable(EIntTimer1); + if (r != KErrNone) + { + Kern::Fault("EnbMsTick",r); + } + + TSyborg::SetTimerLoad(KHwBaseCounterTimer, K1000HzTickMatchLoad); + // TSyborg::SetTimerLoad(KHwBaseCounterTimer, 1000000); + TSyborg::SetTimerMode(KHwBaseCounterTimer, TSyborg::ETimerModePeriodic); + TSyborg::EnableTimerInterrupt(KHwBaseCounterTimer); + TSyborg::EnableTimer(KHwBaseCounterTimer, TSyborg::EEnable); + + SyborgInterrupt::Init3(); + + // !@! +#if 0 + // Allocate physical RAM for video + TInt vSize = TSyborg::VideoRamSize(); + + r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhys); + if (r != KErrNone) + { + Kern::Fault("AllocVideoRam",r); + } + + // Allocate physical RAM for secure display + r = Epoc::AllocPhysicalRam(vSize,Syborg::VideoRamPhysSecure); + if (r != KErrNone) + { + Kern::Fault("AllocVideoRam 2",r); + } +#endif + __DEBUG_PRINT("Finished Syborg::Init3()"); +} + +EXPORT_C void Syborg::DebugInit() +{ + iDebugPortBase = TSyborg::DebugPortAddr(); + + if(iDebugPortBase != (TUint32)KNullDebugPort) // supress debug output + { + TUint8 res = ReadReg(iDebugPortBase, 0); + } +} + +// +// Output a character to the debug port +// +EXPORT_C void Syborg::DebugOutput(TUint aLetter) +{ + if(!iDebugPortBase) + { + DebugInit(); + } + + if(iDebugPortBase != (TUint32)KNullDebugPort) // supress debug output + { + WriteReg(iDebugPortBase,1,aLetter); + } +} + +EXPORT_C TInt Syborg::MsTickPeriod() +{ + return 1000; +} + +EXPORT_C TInt Syborg::SystemTimeInSecondsFrom2000(TInt& aTime) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("RTC READ: %d",aTime)); + return KErrNone; +} + +EXPORT_C TInt Syborg::SetSystemTimeInSecondsFrom2000(TInt aTime) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Set RTC: %d",aTime)); // do this here to allow the value to be loaded... + return KErrNone; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/highrestimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/highrestimer.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** + * @file + * @internalTechnology + * + * The highrestimer.h header file defines how to access the high resoltion + * timer, if one is supported. This file is used by default if the variant does + * not export one to \epoc32\include\nkern. + */ + +#ifndef __HIGHRESTIMER_H__ +#define __HIGHRESTIMER_H__ +// +// Copyright (c) 2008 Symbian Ltd. All rights reserved. +// + +#include + +/** + * Macro indicating that a high resolution timer is supported. + */ +#define HAS_HIGH_RES_TIMER + +/** + * Assembler macro to get the the current value of the high res timer and place + * it in the specified register. + * Reads the 32-bit value from a free-running counter that represents the current time. + * Syborg timers have 'microsecond resolution'. NB. This value comes from the host clock + * and so there is a good chance that the kernels tick based notion of time (elapsed) and that + * measured by the free running timer will get out of kilter. This affects t_cputime from e32test + * amongst other things. + */ +//#define GET_HIGH_RES_TICK_COUNT(Rd) asm("nop"); +// Hi-jacking r10 for tmp, not good if Rd is R10 -- grepping the the kernel shows it's not (for now) +#define GET_HIGH_RES_TICK_COUNT(Rd) \ + asm("push {r10}"); \ + asm("mov r10, #2"); \ + asm("ldr "#Rd", =%a0" : : "i" (KHwBaseRtc + 4)); \ + asm("str r10, ["#Rd", #%a0]" : : "i" (0)); \ + asm("pop {r10}"); \ + asm("ldr "#Rd", =%a0" : : "i" (KHwBaseRtc + 8)); \ + asm("ldr "#Rd", ["#Rd", #%a0]" : : "i" (0)); + +/** + * The frequency of the timer in Hz. + */ +const TInt KHighResTimerFrequency = 1000000; + +/** + * Macro indicating that the timer counts up if defined. + */ +#define HIGH_RES_TIMER_COUNTS_UP + +#endif // __HIGHRESTIMER_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/interrupts.cia --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/interrupts.cia Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Syborg interrupt control and dispatch +* +*/ + +#include +#include +#include + +// CIA symbols for ASSP code? +#if defined(__GCC32__) +// CIA symbol macros for Gcc98r2 +#define CSM_ZN7NTimerQ4TickEv " Tick__7NTimerQ" +#elif defined(__ARMCC__) +// CIA symbol macros for RVCT +#define CSM_ZN7NTimerQ4TickEv " __cpp(NTimerQ::Tick)" +#else +// CIA symbol macros for EABI assemblers +#define CSM_ZN7NTimerQ4TickEv " _ZN7NTimerQ4TickEv" +#endif + +/******************************************************************** + * Wait for interrupt idle routine which does not disable interrupts + ********************************************************************/ + +__NAKED__ void SyborgWFIIdle() +{ + // Enter an idle state and wait for interrupts + asm("mov r0, #0"); + asm("mcr p15, 0, r0, c7, c0, 4"); + asm("bx lr"); +} + +/******************************************************************** + * Service 1ms tick interrupt & timer 1 interrupt + ********************************************************************/ + +__NAKED__ void SyborgInterrupt::MsTimerTick(TAny* /*aPtr*/) +{ + // Service 1ms tick interrupt + asm("ldr r1, __KHwCounterTimer"); + asm("push {r0}"); + asm("mov r0, #1"); + asm("str r0, [r1, #24]"); + asm("pop {r0}"); + asm("b "CSM_ZN7NTimerQ4TickEv); + asm("bx lr"); + + asm("__KHwCounterTimer:"); + asm(".word %a0" : : "i" ((TInt)KHwBaseCounterTimer)); +} + +/******************************************************************** + * Interrupt handling/dispatch + ********************************************************************/ +// IRQ dispatcher +// Enter with r0-r3, r12 and return address on IRQ stack +// Must preserve r4-r11 +// Uses r4,r5,r12 +__NAKED__ void SyborgInterrupt::IrqDispatch() +{ + asm("push {r4,r5,lr} "); + asm("ldr r4, __KHwBaseSic"); + asm("ldr r12, __SicHandlerStart"); + asm("ldr r5, [r4, #8]"); // r5 - pending interrupt + asm("adr lr, Clear"); + asm("add r12, r5, lsl #3"); + asm("ldm r12, {r0, pc}"); + + asm("Clear:"); + // asm("str r5, [r4, #16]"); // TODO: error + asm("pop {r4,r5,pc}"); + + asm("__KHwBaseSic:"); + asm(".word %a0" : : "i" ((TInt)KHwBaseSic)); + asm("__SicHandlerStart:"); + asm(".word %a0" : : "i" ((TInt)&Handlers[0])); +} + +__NAKED__ void SyborgInterrupt::FiqDispatch() +{ + // FIQ dispatcher + // Enter with return address on FIQ stack + // We may use r8-r12, but must preserve other registers + // NOTE: STACK IS MISALIGNED ON ENTRY (1 WORD PUSHED) + asm("push {r0-r3,lr}"); + // FIQ Handler to go in here. + // Not needed because no FIQs are currently used + asm("pop {r0-r3,pc}"); +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/interrupts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/interrupts.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Syborg interrupt control and dispatch +* +*/ + +#include + +SInterruptHandler SyborgInterrupt::Handlers[KNumSyborgInts]; + +void SyborgInterrupt::DisableAndClearAll() +{ + WriteReg(KHwBaseSic, 3, 0); +} + +void SyborgInterrupt::Init1() +{ + __KTRACE_OPT(KBOOT,Kern::Printf("SyborgInterrupt::Init1()")); + + for(TUint i = 0; i < KNumSyborgInts; i++) + { + Handlers[i].iPtr = (TAny*)i; + Handlers[i].iIsr = Spurious; + } + + DisableAndClearAll(); + + Arm::SetIrqHandler((TLinAddr)SyborgInterrupt::IrqDispatch); + Arm::SetFiqHandler((TLinAddr)SyborgInterrupt::FiqDispatch); +} + +void SyborgInterrupt::Init3() +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("SyborgInterrupt::Init3()")); +} + +void SyborgInterrupt::Spurious(TAny* anId) +{ + // Handle an unexpected interrupt + Kern::Fault("SpuriousInt", (TInt)anId); +} + +EXPORT_C TInt Interrupt::Bind(TInt anId, TIsr anIsr, TAny* aPtr) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Bind(anId=%d anIsr=0x%X aPtr=0x%X)",anId,anIsr,aPtr)); + if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) + { + SInterruptHandler& h = SyborgInterrupt::Handlers[anId]; + TInt irq = NKern::DisableAllInterrupts(); + TInt r; + if(h.iIsr != SyborgInterrupt::Spurious) + { + r = KErrInUse; + } + else + { + h.iPtr = aPtr; + h.iIsr = anIsr; + r = KErrNone; + } + NKern::RestoreInterrupts(irq); + return r; + } + return KErrArgument; +} + +EXPORT_C TInt Interrupt::Unbind(TInt anId) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Unbind(%d)",anId)); + if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) + { + SInterruptHandler& h = SyborgInterrupt::Handlers[anId]; + TInt irq = NKern::DisableAllInterrupts(); + TInt r; + if(h.iIsr == SyborgInterrupt::Spurious) + { + r = KErrGeneral; + } + else + { + // Reset pointer to handler back to default + h.iPtr = (TAny*)anId; + h.iIsr = SyborgInterrupt::Spurious; + // Disable the interrupt + TSyborg::DisableInt(anId); + r = KErrNone; + } + NKern::RestoreInterrupts(irq); + return r; + } + return KErrArgument; +} + +EXPORT_C TInt Interrupt::Enable(TInt anId) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Enable(%d)",anId)); + if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) + { + if(SyborgInterrupt::Handlers[anId].iIsr == SyborgInterrupt::Spurious) + { + return KErrNotReady; + } + else + { + TSyborg::EnableInt(anId); + return KErrNone; + } + } + return KErrArgument; +} + +EXPORT_C TInt Interrupt::Disable(TInt anId) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Disable(%d)",anId)); + if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) + { + TSyborg::DisableInt(anId); + return KErrNone; + } + return KErrArgument; +} + +EXPORT_C TInt Interrupt::Clear(TInt anId) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::Clear(%d)",anId)); + if((anId >= 0) && ((TUint)anId < KNumSyborgInts)) + { + return KErrNone; + } + return KErrArgument; +} + +EXPORT_C TInt Interrupt::SetPriority(TInt anId, TInt aPriority) +{ + __KTRACE_OPT(KHARDWARE,Kern::Printf("Interrupt::SetPriority(anId=%d aPriority=0x%X)",anId,aPriority)); + return KErrNotSupported; +} + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/syborg.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/syborg.cfg Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,2348 @@ +############################################################ +## AUTO-GENERATED CONFIGURATION FILE +## CommDB Database Dump Utility +## 1.1 +############################################################ + +############################################################ +## Network +## +[Network] +ADD_SECTION +# COMMDB_ID = 1 + Name=Intranet + FIELD_COUNT=1 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=mRouter + FIELD_COUNT=1 +END_ADD + + +############################################################ +## ModemBearer +## +[ModemBearer] +ADD_TEMPLATE + Name=Default Modem + Agent=CSD.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=0 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + Name=Null Modem 115200bps + Agent=CSD.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=52 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=US Robotics Sportster + Agent=CSD.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=57600 + Handshaking=244 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=AFTERDIALUNTILANSWER + SpeakerVolPref=QUIET + ModemInitString=AT&F1 + DataInitString=AT + FaxInitString=AT&d2 + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=Dacom Surfer + Agent=CSD.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=57600 + Handshaking=244 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=AFTERDIALUNTILANSWER + SpeakerVolPref=QUIET + ModemInitString=AT&F + DataInitString=AT + FaxInitString=AT&d2 + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=GSM Mobile Phone via Infrared + Agent=CSD.agt + IfName=PPP + PortName=IRCOMM::0 + TSYName=MM + CSYName=IRCOMM + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=196 + SpecialRate=0 + XonChar=17 + XoffChar=19 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=ATZ + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 6 + Name=GSM Mobile Phone via Serial + Agent=CSD.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=19200 + Handshaking=196 + SpecialRate=0 + XonChar=17 + XoffChar=19 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=ATZ + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=GPRS Ericsson R520m via IR + Agent=PSD.agt + IfName=PPP + PortName=IRCOMM::0 + TSYName=MM + CSYName=IRCOMM + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=4 + SpecialRate=0 + XonChar=17 + XoffChar=19 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=ATZ + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=GPRS Ericsson R520m/T68i via Serial + Agent=PSD.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=19200 + Handshaking=4 + SpecialRate=0 + XonChar=17 + XoffChar=19 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=ATZ + DataInitString=AT + FaxInitString=AT + IspInitString=*99***1# + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=70 +END_ADD + +ADD_SECTION +# COMMDB_ID = 9 + Name=GPRS Motorola Mobile Phone via Serial + Agent=PSD.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=57600 + Handshaking=4 + SpecialRate=0 + XonChar=17 + XoffChar=19 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=ATZ + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 10 + Name=WinTunnel Modem + Agent=null.agt + IfName=PPP + PortName=COMM::6 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=52 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 11 + Name=mRouterWinsBearer + Agent=mRouterAgent.agt + IfName=PPP + PortName=WINS::0 + TSYName=MM + CSYName=WINSCSY + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=52 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=9999 + LastSessionClosedTimeout=180 + LastSocketClosedTimeout=30 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 12 + Name=mRouterRs232Bearer + Agent=mRouterAgent.agt + IfName=PPP + PortName=COMM::0 + TSYName=MM + CSYName=ECUART + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=52 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=9999 + LastSessionClosedTimeout=180 + LastSocketClosedTimeout=30 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 13 + Name=mRouterIrBearer + Agent=mRouterAgent.agt + IfName=PPP + PortName=IRCOMM::0 + TSYName=MM + CSYName=IRCOMM + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=52 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=9999 + LastSessionClosedTimeout=180 + LastSocketClosedTimeout=30 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 14 + Name=mRouterBtBearer + Agent=mRouterAgent.agt + IfName=PPP + PortName=BTCOMM::0 + TSYName=MM + CSYName=BTCOMM + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=52 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=9999 + LastSessionClosedTimeout=180 + LastSocketClosedTimeout=30 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + +ADD_SECTION +# COMMDB_ID = 15 + Name=mRouterUsbBearer + Agent=mRouterAgent.agt + IfName=PPP + PortName=ACM::0 + TSYName=MM + CSYName=ECACM + DataBits=8 + StopBits=1 + Parity=NONE + Rate=115200 + Handshaking=52 + SpecialRate=0 + XonChar=0 + XoffChar=0 + FaxClassPref=AUTO + SpeakerPref=NEVER + SpeakerVolPref=QUIET + ModemInitString=AT + DataInitString=AT + FaxInitString=AT + DialPauseLength=S8= + SpeakerVolContorlLow=L0 + SpeakerVolControlMedium=L1 + SpeakerVolControlHigh=L2 + SpeakerAlwaysOff=M0 + SpeakerOnUntilCarrier=M1 + SpeakerAlwaysOn=M2 + SpeakerOnAfterUntilCarrier=M3 + DialToneWaitModifier=W + CallProgress1=X1 + CallProgress2=X2 + CallProgress3=X3 + CallProgress4=X4 + EchoOff=E0 + VerboseText=V1 + QuietOn=Q1 + QuietOff=Q0 + DialCommandStateModifier=; + OnLine=O + ResetConfiguration=Z + ReturnToFactoryDefs=&F + DCDOnDuringLink=&C1 + DTRHangUp=&D2 + DSRAlwaysOn=&S0 + RTSCTSHandshake=&K3 + XonXoffHandshake=&K4 + EscapeCharacter=+ + EscapeGuardPeriod=S12 + NoDialTone=NO DIAL TONE + Busy=BUSY + NoAnswer=NO ANSWER + Carrier=CARRIER + Connect=CONNECT + CompressionClass5=COMPRESSION:CLASS 5 + CompressionV42bis=COMPRESSION:V.42 bis + CompressionNone=COMPRESSION:NONE + ProtocolLAPD=PROTOCOL:LAPD + ProtocolALT=PROTOCOL:ALT + ProtocolALTCELLULAR=PROTOCOL:ALT-CELLULAR + ProtocolNone=PROTOCOL:NONE + MessageCentreNumber=+44123456789 + MessageValidityPeriod=1440 + MessageDeliveryReport=FALSE + MinimumSignalLevel=9905 + LastSocketActivityTimeout=9999 + LastSessionClosedTimeout=180 + LastSocketClosedTimeout=30 + SIRSettings=0 + CommRole=0 + FIELD_COUNT=69 +END_ADD + + +############################################################ +## LANBearer +## +[LANBearer] +ADD_SECTION +# COMMDB_ID = 1 + Name=EKA1 Assabet on-board Ethernet + Agent=nullagt.agt + IfName=ethint + LDDFilename=ethercard + LDDName=EtherCard + PDDFilename=EtherSmc + PDDName=EtherCard.Smc + PacketDriverName=EtherPkt.drv + LastSocketActivityTimeout=-1 + LastSessionClosedTimeout=-1 + LastSocketClosedTimeout=-1 + FIELD_COUNT=11 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=EKA2 Assabet on-board Ethernet + Agent=nullagt.agt + IfName=ethint + LDDFilename=enet + LDDName=Ethernet + PDDFilename=ethernet + PDDName=Ethernet.Assabet + PacketDriverName=EtherPkt.drv + LastSocketActivityTimeout=-1 + LastSessionClosedTimeout=-1 + LastSocketClosedTimeout=-1 + FIELD_COUNT=11 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=EKA1 emulator Ethernet + Agent=nullagt.agt + IfName=ethint + LDDFilename=ethercard + LDDName=Ethercard + PDDFilename=etherwins + PDDName=Ethercard.wins + PacketDriverName=EtherPkt.drv + LastSocketActivityTimeout=-1 + LastSessionClosedTimeout=-1 + LastSocketClosedTimeout=-1 + FIELD_COUNT=11 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=EKA2 emulator Ethernet + Agent=nullagt.agt + IfName=ethint + LDDFilename=enet + LDDName=Ethernet + PDDFilename=ethernet + PDDName=Ethernet.Wins + PacketDriverName=EtherPkt.drv + LastSocketActivityTimeout=-1 + LastSessionClosedTimeout=-1 + LastSocketClosedTimeout=-1 + FIELD_COUNT=11 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=EKA2 SYBORG on-board Ethernet + Agent=nullagt.agt + IfName=ethint + LDDFilename=enet + LDDName=Ethernet + PDDFilename=ethernet + PDDName=Ethernet.SYBORG + PacketDriverName=EtherPkt.drv + LastSocketActivityTimeout=-1 + LastSessionClosedTimeout=-1 + LastSocketClosedTimeout=-1 + FIELD_COUNT=11 +END_ADD + +############################################################ +## Location +## +[Location] +ADD_TEMPLATE + Name=Default Location + IntlPrefixCode=+ + NatPrefixCode=0 + NatCode=44 + Mobile=TRUE + UsePulseDial=FALSE + WaitForDialTone=FALSE + PauseAfterDialout=0 + FIELD_COUNT=8 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + Name=Office + IntlPrefixCode=00 + NatPrefixCode=0 + NatCode=44 + AreaCode=171 + DialOutCode=9, + Mobile=FALSE + UsePulseDial=FALSE + WaitForDialTone=FALSE + PauseAfterDialout=0 + FIELD_COUNT=10 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=Office Direct Dial + IntlPrefixCode=00 + NatPrefixCode=0 + NatCode=44 + AreaCode=171 + Mobile=FALSE + UsePulseDial=FALSE + WaitForDialTone=FALSE + PauseAfterDialout=0 + FIELD_COUNT=9 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=Mobile + IntlPrefixCode=+ + NatPrefixCode=0 + NatCode=44 + Mobile=TRUE + UsePulseDial=FALSE + WaitForDialTone=FALSE + PauseAfterDialout=0 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=Home + IntlPrefixCode=00 + NatPrefixCode=0 + NatCode=44 + AreaCode=181 + Mobile=FALSE + UsePulseDial=TRUE + WaitForDialTone=TRUE + PauseAfterDialout=0 + FIELD_COUNT=9 +END_ADD + + +############################################################ +## Chargecard +## +[Chargecard] +ADD_SECTION +# COMMDB_ID = 1 + Name=Dummy BT Chargecard + AccountNumber=144,12345678 + Pin=0000 + LocalRule=HG + NatRule=HFG + IntlRule=HEFG + FIELD_COUNT=6 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=Dummy Mercury Chargecard + AccountNumber=0500800800,,12345678 + Pin=**** + LocalRule=HG + NatRule=J,K,0FG + IntlRule=HEFG + FIELD_COUNT=6 +END_ADD + + +############################################################ +## GlobalSettings +## +[GlobalSettings] +ADD_SECTION + WAPAccessPoint=1 + RedialAttempts=3 + SmsBearer=1 + SmsReceiveMode=2 + GPRSAttachMode=1 + AcceptIncomingGprs=1 + GPRSClassCBearer=GSM + ConnectionAttempts=2 + ModemForDataAndFax=2 + ModemForPhoneServicesAndSMS=2 + LocationForDataAndFax=2 + LocationForPhoneServicesAndSMS=2 + DefaultNetwork=1 + BearerAvailabilityCheckTSY=mm + FIELD_COUNT=14 +END_ADD + + +############################################################ +## DialOutISP +## +[DialOutISP] +ADD_TEMPLATE + Name=Default Dial Out ISP + DialResolution=TRUE + UseLoginScript=FALSE + PromptForLogin=TRUE + DisplayPCT=FALSE + IfPromptForAuth=TRUE + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=28 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + Name=NT RAS + Description=Test + Type=INTERNETONLY + DialResolution=TRUE + UseLoginScript=TRUE + LoginScript=CHARMAP \[windows-1252\]\nLOOP 10\n{\nSEND "CLIENT"+<0x0d>\nWAIT 3\n{\n"SERVER" OK\n}\n}\nEXIT KErrNoAnswer$\n\nOK:\nEXIT\n + PromptForLogin=FALSE + DisplayPCT=FALSE + IfNetworks=ip + IfPromptForAuth=FALSE + IfAuthName=RasUser + IfAuthPass=pass + AuthRetries=0 + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=35 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=ISP01 + Description=PlaceHolder for ISP01 + Type=INTERNETONLY + DialResolution=TRUE + UseLoginScript=FALSE + PromptForLogin=FALSE + DisplayPCT=FALSE + IfNetworks=ip + IfPromptForAuth=TRUE + IfAuthName=xxx + IfAuthPass=yyy + AuthRetries=0 + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=34 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=ISP02 + Description=PlaceHolder for ISP02 + Type=INTERNETONLY + DialResolution=TRUE + UseLoginScript=FALSE + PromptForLogin=FALSE + DisplayPCT=FALSE + IfNetworks=ip + IfPromptForAuth=TRUE + IfAuthName=xxx + IfAuthPass=yyy + AuthRetries=0 + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=34 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=ISP03 + Description=PlaceHolder for ISP03 + Type=INTERNETONLY + DialResolution=TRUE + UseLoginScript=FALSE + PromptForLogin=FALSE + DisplayPCT=FALSE + IfNetworks=ip + IfPromptForAuth=TRUE + IfAuthName=xxx + IfAuthPass=yyy + AuthRetries=0 + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=34 +END_ADD + +ADD_SECTION +# COMMDB_ID = 6 + Name=ISP04 + Description=PlaceHolder for ISP04 + Type=INTERNETONLY + DialResolution=TRUE + UseLoginScript=FALSE + PromptForLogin=FALSE + DisplayPCT=FALSE + IfNetworks=ip + IfPromptForAuth=TRUE + IfAuthName=xxx + IfAuthPass=yyy + AuthRetries=0 + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=34 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=ISP05 + Description=PlaceHolder for ISP05 + Type=INTERNETONLY + DialResolution=TRUE + UseLoginScript=FALSE + PromptForLogin=FALSE + DisplayPCT=FALSE + IfNetworks=ip + IfPromptForAuth=TRUE + IfAuthName=xxx + IfAuthPass=yyy + AuthRetries=0 + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=34 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=mRouterDialOutIsp + Description=mRouterDialOutIsp + Type=INTERNETONLY + DialResolution=TRUE + UseLoginScript=FALSE + PromptForLogin=FALSE + DisplayPCT=FALSE + IfNetworks=ip + IfPromptForAuth=FALSE + IfAuthName=IfAuthPass= + IfAuthPass=AuthRetries=0 + AuthRetries=0 + IfCallbackEnabled=FALSE + CallbackTimeout=0 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + BearerService=0 + BearerProtocol=UNSPECIFIED + RlpVersion=0 + IwfToMs=0 + MsToIwf=0 + AckTimer=0 + RetransmissionAttempts=0 + ResequencePeriod=0 + V42Compression=0 + V42Codewords=0 + V42MaxLength=0 + Asymmetry=0 + UserInitUpgrade=FALSE + UseEdge=FALSE + FIELD_COUNT=34 +END_ADD + + +############################################################ +## DialInISP +## +[DialInISP] +ADD_TEMPLATE + Name=Default Dial In ISP + UseLoginScript=FALSE + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + UseEdge=FALSE + FIELD_COUNT=9 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + Name=Dial In ISP01 + UseLoginScript=FALSE + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableIPHeaderComp=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + EnableSWComp=FALSE + UseEdge=FALSE + FIELD_COUNT=9 +END_ADD + + +############################################################ +## OutgoingGPRS +## +[OutgoingGPRS] +ADD_SECTION +# COMMDB_ID = 1 + Name=GPRS01 + APN=gprs01APNPlaceHolder + PDPType=IPV4 + ReqPrecedence=0 + ReqDelay=0 + ReqReliability=0 + ReqPeakThroughput=0 + ReqMeanThroughput=0 + MinPrecedence=0 + MinDelay=0 + MinReliability=0 + MinPeakThroughput=0 + MinMeanThroughput=0 + DataCompression=FALSE + HeaderCompression=FALSE + GprsUseEdge=FALSE + AnonymousAccess=FALSE + IfNetworks=ip + IfPromptForAuth=FALSE + AuthRetries=1 + IpDNSAddrFromServer=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + IpAddrFromServer=TRUE + GprsAccessPointType=0 + QosWarningTimeout=0 + FIELD_COUNT=26 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=GPRS02 + APN=gprs02APNPlaceHolder + PDPType=IPV4 + ReqPrecedence=0 + ReqDelay=0 + ReqReliability=0 + ReqPeakThroughput=0 + ReqMeanThroughput=0 + MinPrecedence=0 + MinDelay=0 + MinReliability=0 + MinPeakThroughput=0 + MinMeanThroughput=0 + DataCompression=FALSE + HeaderCompression=FALSE + GprsUseEdge=FALSE + AnonymousAccess=FALSE + IfNetworks=ip + IfPromptForAuth=FALSE + AuthRetries=1 + IpDNSAddrFromServer=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + IpAddrFromServer=TRUE + GprsAccessPointType=0 + QosWarningTimeout=0 + FIELD_COUNT=26 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=GPRS03 + APN=gprs03APNPlaceHolder + PDPType=IPV4 + ReqPrecedence=0 + ReqDelay=0 + ReqReliability=0 + ReqPeakThroughput=0 + ReqMeanThroughput=0 + MinPrecedence=0 + MinDelay=0 + MinReliability=0 + MinPeakThroughput=0 + MinMeanThroughput=0 + DataCompression=FALSE + HeaderCompression=FALSE + GprsUseEdge=FALSE + AnonymousAccess=FALSE + IfNetworks=ip + IfPromptForAuth=FALSE + AuthRetries=1 + IpDNSAddrFromServer=FALSE + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + IpAddrFromServer=TRUE + GprsAccessPointType=0 + QosWarningTimeout=0 + FIELD_COUNT=26 +END_ADD + + +############################################################ +## IncomingGPRS +## +[IncomingGPRS] +ADD_SECTION +# COMMDB_ID = 1 + Name=Incoming GPRS Settings PlaceHolder + APN=Test + PDPType=IPV4 + ReqPrecedence=1 + ReqDelay=1 + ReqReliability=1 + ReqPeakThroughput=1 + ReqMeanThroughput=1 + MinPrecedence=1 + MinDelay=1 + MinReliability=1 + MinPeakThroughput=1 + MinMeanThroughput=1 + DataCompression=FALSE + HeaderCompression=FALSE + GprsUseEdge=FALSE + AnonymousAccess=FALSE + IfNetworks=ip + IfPromptForAuth=FALSE + IfAuthName=RasUser + IfAuthPass=pass + AuthRetries=1 + IpDNSAddrFromServer=TRUE + IpNameServer1=0.0.0.0 + IpNameServer2=0.0.0.0 + EnableLCPExtension=FALSE + DisablePlainTextAuth=FALSE + PDPAddress=0.0.0.0 + IpAddrFromServer=TRUE + FIELD_COUNT=29 +END_ADD + + +############################################################ +## DefaultGPRS +## +[DefaultGPRS] +ADD_SECTION +# COMMDB_ID = 1 + Name=Dummy Default GPRS Settings + Usage=1 + APN=Access point name + PDPType=IPV6 + PDPAddress=www.wid.com + Precedence=1 + Delay=1 + Reliability=1 + PeakThroughput=1 + MeanThroughput=1 + MinPrecedence=1 + MinDelay=1 + MinReliability=1 + MinPeakThroughput=1 + MinMeanThroughput=1 + DataCompression=TRUE + HeaderCompression=TRUE + GprsUseEdge=FALSE + AnonymousAccess=TRUE + FIELD_COUNT=19 +END_ADD + + +############################################################ +## CDMA2000PacketServiceTable +## +[CDMA2000PacketServiceTable] +ADD_SECTION +# COMMDB_ID = 1 + Name=test name cdma2000 + IwfName=Test2000 + ServiceOption=HIGHSPEEDCDMA2000DATA + PdpType=IPV4 + ReqFwdPriority=PRIORITY04 + ReqRevPriority=PRIORITY04 + ReqFwdBitrate=32KBPS + ReqRevBitrate=32KBPS + ReqFwdLoss=LOSS1 + ReqRevLoss=LOSS1 + ReqFwdMaxdelay=40MS + ReqRevMaxdelay=40MS + MinFwdBitrate=32KBPS + MinRevBitrate=32KBPS + AccptFwdLoss=LOSS2 + AccptRevLoss=LOSS2 + AccptFwdMaxdelay=120MS + AccptRevMaxdelay=120MS + EnableIPHeaderComp=FALSE + AnonymousAccess=FALSE + IfNetworks=ip + IfPromptForAuth=FALSE + IfAuthName=RasUser + IfAuthPass=pass + AuthRetries=1 + IpNetMask=255.255.255.0 + IpGateway=10.0.0.1 + IpAddrFromServer=TRUE + IpDNSAddrFromServer=TRUE + EnableLCPExtension=TRUE + DisablePlainTextAuth=TRUE + ApType=2 + QosWarningTimeout=1000000 + RlpMode=TRANSPARENT + CDMAMobileIP=FALSE + CDMAMobileIPTimeout=10000000 + CDMANaiType=0 + FIELD_COUNT=37 +END_ADD + + +############################################################ +## DefaultCDMA2000SettingsTable +## +[DefaultCDMA2000SettingsTable] + +############################################################ +## LANService +## +[LANService] +ADD_SECTION +# COMMDB_ID = 1 + Name=Ethernet + IfNetworks=ip,ip6 + IpNetMask=255.255.255.0 + #IpGateway=194.72.6.1 + IpAddrFromServer=FALSE + IpAddr=169.254.172.4 + IpDNSAddrFromServer=FALSE + #IpNameServer1=194.72.6.51 + #IpNameServer2=194.72.6.52 + #FIELD_COUNT=9 + FIELD_COUNT=6 +END_ADD + + +############################################################ +## IAP +## +[IAP] +ADD_SECTION +# COMMDB_ID = 1 + Name=NT RAS with Null Modem + IAPService=2 + IAPServiceType=DialOutISP + IAPBearer=2 + IAPBearerType=ModemBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + Name=CSD IAP PlaceHolder01 + IAPService=3 + IAPServiceType=DialOutISP + IAPBearer=2 + IAPBearerType=ModemBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 3 + Name=CSD IAP PlaceHolder02 + IAPService=4 + IAPServiceType=DialOutISP + IAPBearer=2 + IAPBearerType=ModemBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 4 + Name=GPRS IAP PlaceHolder01 + IAPService=1 + IAPServiceType=OutgoingGPRS + IAPBearer=8 + IAPBearerType=ModemBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=4 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 5 + Name=GPRS IAP PlaceHolder02 + IAPService=2 + IAPServiceType=OutgoingGPRS + IAPBearer=8 + IAPBearerType=ModemBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=4 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 6 + Name=mRouter Rs232 + IAPService=8 + IAPServiceType=DialOutISP + IAPBearer=12 + IAPBearerType=ModemBearer + IAPNetwork=2 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 7 + Name=mRouter Ir + IAPService=8 + IAPServiceType=DialOutISP + IAPBearer=13 + IAPBearerType=ModemBearer + IAPNetwork=2 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 8 + Name=mRouter BT + IAPService=8 + IAPServiceType=DialOutISP + IAPBearer=14 + IAPBearerType=ModemBearer + IAPNetwork=2 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 9 + Name=mRouter USB + IAPService=8 + IAPServiceType=DialOutISP + IAPBearer=15 + IAPBearerType=ModemBearer + IAPNetwork=2 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 10 + Name=mRouter Wins + IAPService=8 + IAPServiceType=DialOutISP + IAPBearer=11 + IAPBearerType=ModemBearer + IAPNetwork=2 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 11 + Name=VPN IAP + IAPService=2 + IAPServiceType=VpnService + IAPBearer=2 + IAPBearerType=VirtualBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 12 + Name=EKA1 Assabet on-board ethernet + IAPService=1 + IAPServiceType=LANService + IAPBearer=1 + IAPBearerType=LANBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 13 + Name=EKA2 Assabet on-board ethernet + IAPService=1 + IAPServiceType=LANService + IAPBearer=2 + IAPBearerType=LANBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 14 + Name=EKA1 emulator ethernet + IAPService=1 + IAPServiceType=LANService + IAPBearer=3 + IAPBearerType=LANBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 15 + Name=EKA2 emulator ethernet + IAPService=1 + IAPServiceType=LANService + IAPBearer=4 + IAPBearerType=LANBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + +ADD_SECTION +# COMMDB_ID = 16 + Name=EKA2 SYBORG on-board ethernet + IAPService=1 + IAPServiceType=LANService + IAPBearer=5 + IAPBearerType=LANBearer + IAPNetwork=1 + IAPNetworkWeighting=0 + Location=2 + FIELD_COUNT=8 +END_ADD + + +############################################################ +## ConnectionPreferences +## +[ConnectionPreferences] +ADD_SECTION + Ranking=0 + Direction=OUTGOING + DialogPref=PROMPT + BearerSet=CSD + IAP=1 + FIELD_COUNT=5 +END_ADD + +ADD_SECTION + Ranking=1 + Direction=OUTGOING + DialogPref=PROMPT + BearerSet=CSD + IAP=1 + FIELD_COUNT=5 +END_ADD + + +############################################################ +## BTDeviceTable +## +[BTDeviceTable] + +############################################################ +## BTSecurityTable +## +[BTSecurityTable] + +############################################################ +## BTDefaultTable +## +[BTDefaultTable] + +############################################################ +## Proxies +## +[Proxies] +ADD_SECTION +# COMMDB_ID = 1 + ISP=2 + ProxyServiceType=DialOutISP + UseProxyServer=TRUE + ProxyServerName=www.dummyproxy.com + ProtocolName=http + PortNumber=80 + Exceptions=www.dummyproxy.com/exception + FIELD_COUNT=7 +END_ADD + + +############################################################ +## AgentLookup +## +[AgentLookup] + +############################################################ +## WAPAccessPoint +## +[WAPAccessPoint] +ADD_TEMPLATE + Name=Default Dial In ISP + CurrentBearer=WAPIPBearer + FIELD_COUNT=2 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + Name=Dummy WAP Settings + CurrentBearer=WAPIPBearer + StartPage=www.wapstart.com + FIELD_COUNT=3 +END_ADD + + +############################################################ +## WAPIPBearer +## +[WAPIPBearer] +ADD_TEMPLATE + AccessPointId=0 + IAP=0 + WSPOption=CONNECTIONLESS + Security=FALSE + ProxyPortNumber=0 + FIELD_COUNT=5 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + AccessPointId=2 + GatewayAddress=www.wapgateway.com + IAP=2 + WSPOption=CONNECTIONORIENTED + Security=FALSE + ProxyPortNumber=1 + FIELD_COUNT=6 +END_ADD + + +############################################################ +## WAPSMSBearer +## +[WAPSMSBearer] +ADD_TEMPLATE + AccessPointId=0 + WSPOption=CONNECTIONLESS + Security=FALSE + FIELD_COUNT=3 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + AccessPointId=2 + GatewayAddress=+4412345678901 + ServiceCentreAddress=+442071234567 + WSPOption=CONNECTIONORIENTED + Security=FALSE + FIELD_COUNT=5 +END_ADD + + +############################################################ +## SecureSocketTable +## +[SecureSocketTable] +ADD_SECTION +# COMMDB_ID = 1 + ProtocolName=ssl3.0 + ProtoLibrary=ssladaptor.dll + FIELD_COUNT=2 +END_ADD + +ADD_SECTION +# COMMDB_ID = 2 + ProtocolName=tls1.0 + ProtoLibrary=ssladaptor.dll + FIELD_COUNT=2 +END_ADD + + +############################################################ +## BTPersistTable +## +[BTPersistTable] +############################################################ +## ERROR +## AccessTypeTable +############################################################ +############################################################ +## ERROR +## Error opening table +############################################################ +############################################################ +## ERROR +## Unable to find the specified object or missing required field values +############################################################ + +############################################################ +## VirtualBearer +## +[VirtualBearer] +ADD_TEMPLATE + Name=Default VPN Bearer + Agent=VPN.agt + IfName=VPN.nif + LastSocketActivityTimeout=180 + LastSessionClosedTimeout=30 + LastSocketClosedTimeout=60 + FIELD_COUNT=6 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + Name=VPN Bearer1 + Agent=ntras.agt + IfName=ppp.nif + LastSocketActivityTimeout=-1 + LastSessionClosedTimeout=-1 + LastSocketClosedTimeout=-1 + FIELD_COUNT=6 +END_ADD + + +############################################################ +## VpnService +## +[VpnService] +ADD_TEMPLATE + Name=Default VPN + Policy=DefaultVPNpolicy + HomeIAP=1 + HomeNetwork=0 + FIELD_COUNT=4 +END_TEMPLATE + +ADD_SECTION +# COMMDB_ID = 2 + Name=VPN1 + Policy=VPNpolicy1 + HomeIAP=2 + HomeNetwork=1 + FIELD_COUNT=4 +END_ADD + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/syborg.cia --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/syborg.cia Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +// +// Timer Access Functions +// + +// Set the starting count value for a timer +EXPORT_C void __NAKED__ TSyborg::SetTimerLoad(TUint /*aTimerBase*/, TUint32 /*aValue*/) +{ + asm("str r1, [r0, #12]"); + asm("bx lr"); +} + +// Read the load register (starting count value) +EXPORT_C TUint __NAKED__ TSyborg::TimerLoad(TUint /*aTimerBase*/) +{ + asm("ldr r0, [r0, #12]"); + asm("bx lr"); +} + +// Read the actual timer value +EXPORT_C TUint __NAKED__ TSyborg::TimerValue(TUint /*aTimerBase*/) +{ + asm("ldr r0, [r0, #16]"); + asm("bx lr"); +} + +// Clear the timer interrupt by writing a value to Timer x clear register +// The written value doesn't matter as any value will clear the interrupt. +EXPORT_C void __NAKED__ TSyborg::ClearTimerInt(TUint /*aTimerBase*/) +{ + asm("mov r1, #1"); + asm("str r1, [r0, #24]"); + asm("bx lr"); +} + +// +//Interrupt Controller Acces Functions +// + +// Enable specified motherboard Int on either the PIC/SIC +EXPORT_C void __NAKED__ TSyborg::EnableInt(TUint /*anId*/) +{ + asm("ldr r1, __KHwInt"); + asm("str r0, [r1, #20]"); + asm("bx lr"); +} + +// Disable specified motherboard Int on either the PIC/SIC +EXPORT_C void __NAKED__ TSyborg::DisableInt(TUint /*anId*/) +{ + asm("ldr r1, __KHwInt"); + asm("str r0, [r1, #16]"); + asm("bx lr"); + + asm("__KHwInt:"); + asm(".word %a0" : : "i" (TInt)(KHwBaseSic)); +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/syborg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/syborg.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +//#define DEBUG + +#ifdef DEBUG +#define __DEBUG_PRINT(format...) Kern::Printf(format) +#else +#define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) +#endif + +void TSyborg::Init3() +{ +// SetTimerMode(KHwBaseCounterTimer, ETimerModePeriodic); +// EnableTimer(KHwBaseCounterTimer, EEnable); +} + +EXPORT_C TBool TSyborg::IsTimerEnabled(TUint aTimerBase) +{ + __DEBUG_PRINT("TSyborg::IsTimerEnabled"); + return ReadReg(aTimerBase, 1); +} + +EXPORT_C void TSyborg::EnableTimerInterrupt(TUint aTimerBase) +{ + __DEBUG_PRINT("TSyborg::EnableTimerInterrupt"); + WriteReg(aTimerBase,5,1); +} + +EXPORT_C void TSyborg::DisableTimerInterrupt(TUint aTimerBase) +{ + __DEBUG_PRINT("TSyborg::DisableTimerInterrupt"); + WriteReg(aTimerBase,5,0); +} + +EXPORT_C void TSyborg::EnableTimer(TUint aTimerBase, TState aState) +{ + __DEBUG_PRINT("TSyborg::EnableTimer"); + // TUint32 mode = ReadReg(aTimerBase, 1); + if (aState == EEnable) + WriteReg(aTimerBase, 1, 1); + else + WriteReg(aTimerBase, 1, 0); +} + +EXPORT_C TSyborg::TTimerMode TSyborg::TimerMode(TUint aTimerBase) +{ + __DEBUG_PRINT("TSyborg::TimerMode"); + if (ReadReg(aTimerBase, 2)) + return ETimerModeOneShot; + else + return ETimerModePeriodic; +} + +EXPORT_C void TSyborg::SetTimerMode(TUint aTimerBase, TTimerMode aValue) +{ + __DEBUG_PRINT("TSyborg::SetTimerMode"); + if (aValue == ETimerModePeriodic) + WriteReg(aTimerBase, 2, 0); + else + WriteReg(aTimerBase, 2, 1); +} + +// Return base address of debug UART +// (as selected in obey file or with eshell debugport command) +EXPORT_C TUint32 TSyborg::DebugPortAddr() +{ + // Defaults to UART 0 + switch (Kern::SuperPage().iDebugPort) + { + case KNullDebugPort: // debug supressed + return (TUint32)KNullDebugPort; + case 1: + return KHwBaseUart1; + case 2: + return KHwBaseUart2; + case 3: + return KHwBaseUart3; + case 0: + default: + return KHwBaseUart0; + } +} + +EXPORT_C void TSyborg::MarkDebugPortOff() +{ + TheVariant.iDebugPortBase = 0; +} + +EXPORT_C TInt TSyborg::VideoRamSize() +{ + return 4*640*480; +} + +// !@! +EXPORT_C TPhysAddr TSyborg::VideoRamPhys() +{ +#if 0 + __KTRACE_OPT(KEXTENSION,Kern::Printf("TSyborg::VideoRamPhys: VideoRamPhys=0x%x", Syborg::VideoRamPhys)); +#endif + return 0; + +} + +EXPORT_C TPhysAddr TSyborg::VideoRamPhysSecure() +{ +#if 0 + return Syborg::VideoRamPhysSecure; +#endif + return 0; +} + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/syborg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/syborg.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SYBORG_H__ +#define __SYBORG_H__ + +#include +#include +#include +#include +#include +#include // KPrimaryIOBase + +#ifndef __SYBORG__ +#define __SYBORG__ +#endif + +const TUint KHwBasePeripherals = KPrimaryIOBase; +const TUint KHwLinSeparation = 0x1000; + +const TUint KHwBaseSic = KHwBasePeripherals + 0x00*KHwLinSeparation; +// intended for use as a free-running counter. Reading the value register of a free-running syborg counter returns a microsec value +const TUint KHwBaseRtc = KHwBasePeripherals + 0x01*KHwLinSeparation; +// intended for use as an alarm generating timer with a resolution of 1 microsecond +const TUint KHwBaseCounterTimer = KHwBasePeripherals + 0x02*KHwLinSeparation; +const TUint KHwBaseKmiKeyboard = KHwBasePeripherals + 0x03*KHwLinSeparation; +const TUint KHwBaseKmiMouse = KHwBasePeripherals + 0x04*KHwLinSeparation; +const TUint KHwBaseKmiPointer = KHwBasePeripherals + 0x04*KHwLinSeparation; +const TUint KHwBaseClcd = KHwBasePeripherals + 0x05*KHwLinSeparation; +const TUint KHwBaseUart0 = KHwBasePeripherals + 0x06*KHwLinSeparation; +const TUint KHwBaseUart1 = KHwBasePeripherals + 0x07*KHwLinSeparation; +const TUint KHwBaseUart2 = KHwBasePeripherals + 0x08*KHwLinSeparation; +const TUint KHwBaseUart3 = KHwBasePeripherals + 0x09*KHwLinSeparation; +const TUint KHwSVPHostFileSystemDevice = KHwBasePeripherals + 0x0a*KHwLinSeparation; +const TUint KHwSVPSnapDevice = KHwBasePeripherals + 0x0b*KHwLinSeparation; +const TUint KHwSVPNetDevice = KHwBasePeripherals + 0x0c*KHwLinSeparation; +const TUint KHwSVPNandDevice = KHwBasePeripherals + 0x0d*KHwLinSeparation; +const TUint KHwSVPAudioDevice = KHwBasePeripherals + 0x0e*KHwLinSeparation; +const TUint KHwSVPPlatformDevice = KHwBasePeripherals + 0x0f*KHwLinSeparation; + + +enum TSyborgInterruptId +{ + EIntTimer0 = 0, /* RTC -- not used */ + EIntTimer1 = 1, /* Interval Timer */ + EIntKeyboard = 2, + EIntPointer = 3, + // EIntMouse = 3, + EIntFb = 4, + EIntSerial0 = 5, + EIntSerial1 = 6, + EIntSerial2 = 7, + EIntSerial3 = 8 +}; + +// Timer Mode +const TUint KPeriodic = 0x0; +const TUint KOneShot = 0x1; + +class TSyborg +{ +public: + // generic enums + enum TState + { + EEnable, + EDisable + }; + enum TLock + { + ELocked=0, + EUnlocked=0xA05F + }; + enum TTimerMode + { + ETimerModePeriodic=KPeriodic, + ETimerModeOneShot=KOneShot, + }; +public: + // Initialisation of class + static void Init3(); + + // Accessor methods for timers + IMPORT_C static void EnableTimerInterrupt(TUint aTimerBase); // Enable the timer interrupt + IMPORT_C static void DisableTimerInterrupt(TUint aTimerBase); // Disable the timer interrupt + IMPORT_C static void SetTimerLoad(TUint aTimerBase, TUint32 aValue); // Set the starting count value for a timer + IMPORT_C static TUint TimerLoad(TUint aTimerBase); // Read the load register (starting count value) + IMPORT_C static TUint TimerValue(TUint aTimerBase); // Read the actual timer value + IMPORT_C static void ClearTimerInt(TUint aTimerBase); // Clear the timer interrupt + IMPORT_C static TBool IsTimerEnabled(TUint aTimerBase); // Enquire as to whether the timer is enabled + IMPORT_C static void EnableTimer(TUint aTimerBase, TState aState); // Enable/disable the timer (start/stop it running) + IMPORT_C static TTimerMode TimerMode(TUint aTimerBase); // Find out what mode the timer is running in + IMPORT_C static void SetTimerMode(TUint aTimerBase, TTimerMode aValue); // Set the timer mode (periodic or free running) + + // Accessor methods for interrupts + IMPORT_C static void EnableInt(TUint anId); + IMPORT_C static void DisableInt(TUint anId); + + IMPORT_C static TInt VideoRamSize(); + IMPORT_C static TPhysAddr VideoRamPhys(); + IMPORT_C static TPhysAddr VideoRamPhysSecure(); + + // Debug Port Specific + IMPORT_C static TUint32 DebugPortAddr(); + IMPORT_C static void MarkDebugPortOff(); +}; + +static inline TUint32 ReadReg(TUint32 base, TUint8 aReg) +{ + return *(volatile TUint32 *)(base + (aReg << 2)); +} + +static inline void WriteReg(TUint32 base, TUint8 aReg, TUint32 aVal) +{ + *(volatile TUint32*)(base + (aReg<<2)) = aVal; +} + +#endif // __SYBORG_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/syborg_priv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/syborg_priv.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SYBORG_PRIV_H__ +#define __SYBORG_PRIV_H__ + +#include +#include +#include +#include + +#define _LOCK TInt irq=NKern::DisableAllInterrupts(); +#define _UNLOCK NKern::RestoreInterrupts(irq); + +const TUint32 K1000HzTickMatchLoad = 1000; +const TInt KNumSyborgInts = 64; + +class SyborgInterrupt : public Interrupt +{ +public: + static void IrqDispatch(); + static void FiqDispatch(); + static void DisableAndClearAll(); + static void Init1(); + static void Init3(); + static void Spurious(TAny* anId); + static void MsTimerTick(TAny* aPtr); + + static SInterruptHandler Handlers[KNumSyborgInts]; +}; + +class Syborg : public Asic +{ +public: + IMPORT_C Syborg(); + +public: + // Initialisation + IMPORT_C virtual TMachineStartupType StartupReason(); + IMPORT_C virtual void Init1(); + IMPORT_C virtual void Init3(); + + // Power management + IMPORT_C virtual void Idle(); + + IMPORT_C void DebugInit(); + IMPORT_C virtual void DebugOutput(TUint aChar); + + // Timing + IMPORT_C virtual TInt MsTickPeriod(); + IMPORT_C virtual TInt SystemTimeInSecondsFrom2000(TInt& aTime); + IMPORT_C virtual TInt SetSystemTimeInSecondsFrom2000(TInt aTime); + IMPORT_C virtual TUint32 NanoWaitCalibration(); + + // HAL + virtual TInt VariantHal(TInt aFunction, TAny* a1, TAny* a2); + + // Machine configuration + virtual TPtr8 MachineConfiguration(); + + TUint32 iDebugPortBase; + + static Syborg* Variant; + static TPhysAddr VideoRamPhys; + static TPhysAddr VideoRamPhysSecure; + NTimerQ* iTimerQ; +}; + +GLREF_D Syborg TheVariant; + +#endif // __SYBORG_PRIV_H__ + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/system.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/system.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SYSTEM_H__ +#define __SYSTEM_H__ + +#ifndef __BOOTLOADER_VARIANTCONFIG_H__ +#include +#endif + +#define VARIANT_INTERFACE TSyborg +_LIT(KPddName,"Comm.SYBORG_SERIAL"); + +#endif // __SYSTEM_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/system_priv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/system_priv.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SYSTEM_PRIV_H__ +#define __SYSTEM_PRIV_H__ + +#include "system.h" +#include + +#endif // __SYSTEM_PRIV_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/specific/variantmediadef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/specific/variantmediadef.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __VARIANTMEDIADEF_H__ +#define __VARIANTMEDIADEF_H__ + +// Variant parameters for IRAM Media Driver (MEDINT.PDD) +#define IRAM_DRIVECOUNT 1 +#define IRAM_DRIVELIST 0 // C: +#define IRAM_NUMMEDIA 1 +#define IRAM_DRIVENAME "IRam" + +#endif // __VARIANTMEDIADEF_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/driver/stringops.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/driver/stringops.c Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +char * strchr (const char *p, int ch) + { + char c; + + c = ch; + for (;; ++p) + { + if (*p == c) + return ((char *)p); + if (*p == '\0') + return (char *)(0); + } + /* NOTREACHED */ + } + +unsigned int strlen(const char *str) + { + const char *s; + for (s = str; *s; ++s) { } + + return(s - str); + } + +int strcmp(const char *s1, const char *s2) + { + while (*s1 == *s2++) + if (*s1++ == 0) + return (0); + return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); + } + +void * memchr(const void *s, int c, unsigned n) + { + if (n != 0) + { + const unsigned char *p = s; + do + { + if (*p++ == (unsigned char)c) + return ((void *)(p - 1)); + } while (--n != 0); + + } + // Not found + return (void *)0; + } + +int memcmp(const void *s1, const void *s2, unsigned n) + { + if (n != 0) + { + const unsigned char *p1 = s1, *p2 = s2; + + do + { + if (*p1++ != *p2++) + return (*--p1 - *--p2); + } while (--n != 0); + } + return (0); + } + +#ifdef __cplusplus +} +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/driver/svphostfsdriver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/driver/svphostfsdriver.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,919 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Device driver for SVP Host file system access +* +*/ + +#ifdef __WINS__ +#error - this driver cannot be built for emulation +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "rsvphostfsdriver.h" + +#include "libfdt.h" + +// Debug messages - uncomment define below +//#define SVPDBG +#ifdef SVPDBG +#define DP(format...) Kern::Printf(format) +#else +#define DP(format...) +#endif + +#define SVP_HOST_FS_DEVICE_ID 0xc51d0008 +#define SVP_PLATFORM_DEVICE_ID 0xc51d1000 + +class DSVPHostFsDriverFactory : public DLogicalDevice +{ +public: + + DSVPHostFsDriverFactory(); + virtual TInt Install(); + virtual void GetCaps(TDes8& aDes) const; + virtual TInt Create(DLogicalChannelBase*& aChannel); +}; + +class DSVPHostFsChannel : public DLogicalChannel +{ +public: + + DSVPHostFsChannel(DLogicalDevice* aLogicalDevice); + ~DSVPHostFsChannel(); + + virtual TInt DoCreate(TInt aUnit, const TDesC* anInfo, const TVersion& aVer); + virtual void HandleMsg(TMessageBase* aMsg); + +protected: + virtual void DoCancel(TInt aReqNo); + virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); + virtual TInt DoControl(TInt aFunction, TAny *a1, TAny *a2); + +private: + TInt MkDir(TSVPHostFsMkDirInfo* aInfo); + TInt RmDir(TSVPHostFsRmDirInfo* aInfo); + TInt Delete(TSVPHostFsDeleteInfo* aInfo); + TInt Rename(TSVPHostFsRenameInfo* aInfo); + TInt Replace(TSVPHostFsReplaceInfo* aInfo); + TInt Entry(TSVPHostFsEntryInfo* aInfo); + TInt SetEntry(TSVPHostFsSetEntryInfo* aInfo); + TInt FileOpen(TSVPHostFsFileOpenInfo* aInfo); + TInt FileClose(TUint32 aDrive, TUint32 aHandle); + TInt FileRead(TSVPHostFsFileReadInfo* aInfo); + TInt FileWrite(TSVPHostFsFileWriteInfo* aInfo); + TInt FileSetSize(TSVPHostFsFileSetSizeInfo* aInfo); + TInt FileSetEntry(TSVPHostFsSetEntryInfo* aInfo); + TInt DirOpen(TSVPHostFsDirOpenInfo* aInfo); + TInt Flush(TUint32 aDrive); + TInt DirClose(TUint32 aDrive, TUint32 aHandle); + TInt DirRead(TSVPHostFsDirReadInfo* aInfo); + + TInt GetID(TUint32 aDrive, TUint32 * aId); + + TInt SetUpDrives(); + TInt GetDriveMap(TAny * aMap); + +private: + DThread* iClientThread; + TDfcQue* iDFCQue; + TUint32 iDriveMap[DRIVE_MAP_SIZE] ; + +}; + + +#define RET_IF_ERROR(v, e) { if ((v = (e)) != KErrNone) return v; } + + +#define EDeviceID 0 +#define EOp 1 +#define ETreeStart 1 +#define EResult 2 +#define EArg0 3 +#define EArg1 4 +#define EArg2 5 +#define EArg3 6 + +static inline TUint32 SVPReadReg(TUint32 dev, TUint32 aReg) + { + DP("** ReadReg @ 0x%08x (%d)",dev,aReg); + + return *(volatile TUint32 *)(dev + (aReg << 2)); + } + +static inline void SVPWriteReg(TUint32 dev, TUint32 aReg, TUint32 aVal) + { + DP("** WriteReg @ 0x%08x (%d,%d)",dev,aReg,aVal); + + *(volatile TUint32*)(dev + (aReg << 2)) = aVal; + } + +static inline void SVPInvoke(TUint32 dev, TUint32 aVal) + { + DP("** Invoke @ 0x%08x (%d)",dev,aVal); + + *(TUint32*)(dev + (EOp << 2)) = aVal; + } + +///////////////////////////////////////////////////////////////////////// +// +// DSVPHostFsDriverFactory +// +///////////////////////////////////////////////////////////////////////// + +// +// DSVPHostFsDriverFactory constructor +// +DSVPHostFsDriverFactory::DSVPHostFsDriverFactory() + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::DSVPHostFsDriverFactory()"); + + iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); + } + +// +// DSVPHostFsDriverFactory::Create +// +TInt DSVPHostFsDriverFactory::Create(DLogicalChannelBase*& aChannel) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::Create()"); + + aChannel = new DSVPHostFsChannel(this); + + return aChannel ? KErrNone : KErrNoMemory; + } + +// +// DSVPHostFsDriverFactory::Install +// +TInt DSVPHostFsDriverFactory::Install() + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::Install()"); + + return(SetName(&KSVPHostFsDriverName)); + } + +// +// DSVPHostFsDriverFactory::Install +// +void DSVPHostFsDriverFactory::GetCaps(TDes8& aDes) const + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory::GetCaps()"); + + TCapsSVPHostFsDriver b; + b.iVersion = TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber); + aDes.FillZ(aDes.MaxLength()); + aDes.Copy((TUint8 *)&b, Min(aDes.MaxLength(), sizeof(b))); + } + + +///////////////////////////////////////////////////////////////////////// +// +// DSVPHostFsChannel implementation +// +///////////////////////////////////////////////////////////////////////// + +// +// DSVPHostFsChannel constructor +// +DSVPHostFsChannel::DSVPHostFsChannel(DLogicalDevice* aLogicalDevice) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DSVPHostFsChannel()"); + + iDevice = aLogicalDevice; + + iClientThread = &Kern::CurrentThread(); + iClientThread->Open(); + } + +// +// DSVPHostFsChannel destructor +// +DSVPHostFsChannel::~DSVPHostFsChannel() + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::~DSVPHostFsChannel()"); + Kern::SafeClose((DObject*&)iClientThread, NULL); + } + +// +// DSVPHostFsChannel::DoCreate +// +TInt DSVPHostFsChannel::DoCreate(TInt /*aUnit*/, const TDesC* anInfo, const TVersion& aVer) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCreate()"); + + if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), aVer)) + return KErrNotSupported; + + + //Setup the driver for receiving client messages + SetDfcQ(Kern::DfcQue0()); + iMsgQ.Receive(); + + SetUpDrives(); + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCreate()- checking device"); + TUint id = SVPReadReg(KHwSVPHostFileSystemDevice, EDeviceID); + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCreate()- checked device- 0x%08x -expected 0x%08x", + id, SVP_HOST_FS_DEVICE_ID); + return id == SVP_HOST_FS_DEVICE_ID ? KErrNone : KErrHardwareNotAvailable; + } + +TInt DSVPHostFsChannel::SetUpDrives() + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetUpDrives() @ 0x%08x", KHwSVPPlatformDevice) ; + TUint32 platId = SVPReadReg(KHwSVPPlatformDevice, EDeviceID); + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetUpDrives()- checked device- 0x%08x -expected 0x%08x", + platId, SVP_PLATFORM_DEVICE_ID); + if (platId != SVP_PLATFORM_DEVICE_ID) return KErrHardwareNotAvailable; + + TUint32 * fdt = (TUint32 *)((char *)(SVPReadReg(KHwSVPPlatformDevice, ETreeStart) + KHwSVPPlatformDevice)); + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetUpDrives()- device tree @ 0x%08x", fdt); + + // Iteratate over the tree looking for "syborg,hostfs" nodes. + const char * compatible = "syborg,hostfs" ; + int offset = fdt_node_offset_by_compatible(fdt, -1, compatible); + while (offset != -FDT_ERR_NOTFOUND) + { + if (offset < 0) + { + DP("FDT: Node not found %d", offset) ; + return KErrHardwareNotAvailable ; + } + + int lenp1, lenp2 = 0; + TUint32 * deviceAddressp = (TUint32 *)fdt_getprop(fdt,offset,"reg",&lenp1); + + if (!deviceAddressp) + { + DP("FDT format error: reg %d", lenp1); + return KErrHardwareNotAvailable ; + } + + + TUint32 * driveNumberp = (TUint32 *)fdt_getprop(fdt,offset,"drive-number",&lenp2); + if (!driveNumberp) + { + DP("FDT format error: drive-number %d", lenp2); + return KErrHardwareNotAvailable ; + } + TUint32 deviceAddressPhys = bswap_32(*deviceAddressp); + +#define PhysicalToLinear(addr) ((addr & (~(Epoc::LinearToPhysical(KPrimaryIOBase)))) | KPrimaryIOBase) + + TUint32 deviceAddressLin = PhysicalToLinear(deviceAddressPhys) ; + TUint32 driveNumber = bswap_32(*driveNumberp) ; + DP("FDT: dev address phys 0x%08x lin 0x%08x len1 %d drive number %08x len2 %d", + deviceAddressPhys, deviceAddressLin, lenp1, driveNumber, lenp2) ; + TUint32 fsId = SVPReadReg(deviceAddressLin, EDeviceID) ; + DP("FDT: dev id 0x%08x", fsId) ; + if (fsId != SVP_HOST_FS_DEVICE_ID) return KErrHardwareNotAvailable ; + + // we have a disagreement about the base number of the drives: 0 or 1? + iDriveMap[driveNumber-1] = deviceAddressLin ; + offset = fdt_node_offset_by_compatible(fdt, offset, compatible); + } + return KErrNone; + } + +// +// DSVPHostFsChannel::DoCancel +// +void DSVPHostFsChannel::DoCancel(TInt aReqNo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoCancel() %x(%d)", aReqNo, aReqNo); + } + +// +// DSVPHostFsChannel::DoRequest +// +TInt DSVPHostFsChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoRequest() %x(%d)", aReqNo, aReqNo); + + TInt err = KErrGeneral; + + (void)aStatus; + + switch(aReqNo) + { + case RSVPHostFsDriver::EMkDir: + { + err = MkDir((TSVPHostFsMkDirInfo*)a1); + break; + } + case RSVPHostFsDriver::ERmDir: + { + err = RmDir((TSVPHostFsRmDirInfo*)a1); + break; + } + case RSVPHostFsDriver::EDelete: + { + err = Delete((TSVPHostFsDeleteInfo*)a1); + break; + } + case RSVPHostFsDriver::ERename: + { + err = Rename((TSVPHostFsRenameInfo*)a1); + break; + } + case RSVPHostFsDriver::EReplace: + { + err = Replace((TSVPHostFsReplaceInfo*)a1); + break; + } + case RSVPHostFsDriver::EEntry: + { + err = Entry((TSVPHostFsEntryInfo*)a1); + break; + } + case RSVPHostFsDriver::ESetEntry: + { + err = SetEntry((TSVPHostFsSetEntryInfo*)a1); + break; + } + case RSVPHostFsDriver::EFileOpen: + { + err = FileOpen((TSVPHostFsFileOpenInfo*)a1); + break; + } + case RSVPHostFsDriver::EDirOpen: + { + err = DirOpen((TSVPHostFsDirOpenInfo*)a1); + break; + } + case RSVPHostFsDriver::EFileClose: + { + err = FileClose((TUint32)a1, (TUint32)a2); + break; + } + case RSVPHostFsDriver::EFileRead: + { + err = FileRead((TSVPHostFsFileReadInfo*)a1); + break; + } + case RSVPHostFsDriver::EFileWrite: + { + err = FileWrite((TSVPHostFsFileWriteInfo*)a1); + break; + } + case RSVPHostFsDriver::EFileSetSize: + { + err = FileSetSize((TSVPHostFsFileSetSizeInfo*)a1); + break; + } + case RSVPHostFsDriver::EFileFlushAll: + { + err = Flush((TUint32)a1); + break; + } + case RSVPHostFsDriver::EDirClose: + { + err = DirClose((TUint32)a1, (TUint32)a2); + break; + } + case RSVPHostFsDriver::EDirRead: + { + err = DirRead((TSVPHostFsDirReadInfo*)a1); + break; + } + case RSVPHostFsDriver::EGetDeviceID: + { + err = GetID((TUint32)a1, (TUint32*)a2); + break; + } + case RSVPHostFsDriver::EGetDriveMap: + { + err = GetDriveMap((TUint32*)a1); + break; + } + + default: + { + err = KErrGeneral; + } + } + + if (KErrNone != err) + { + DP("Error %d from DoRequest", err); + } + + return err; + } + +// +// DSVPHostFsChannel::DoControl +// +TInt DSVPHostFsChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DoControl()"); + + DP("DoControl Function %d", aFunction); + + TInt err = KErrGeneral; + + /* There should be a good reason to use a control rather than a request. */ + + if (KErrNone != err) + { + DP("** (SVPHOSTFSDRIVER) Error %d from control function", err); + } + + return err; + } + +void DSVPHostFsChannel::HandleMsg(TMessageBase* aMsg) + { + + TThreadMessage& m = *(TThreadMessage*)aMsg; + TInt id = m.iValue; + + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::HandleMsg() %x(%d)", id, id); + + if (id == (TInt)ECloseMsg) + { + m.Complete(KErrNone, EFalse); + return; + } + if (id == KMaxTInt) + { + // DoCancel + DoCancel(m.Int0()); + m.Complete(KErrNone, ETrue); + return; + } + if (id < 0) + { + // DoRequest + TRequestStatus* pStatus = (TRequestStatus*)m.Ptr0(); + TInt r = DoRequest(~id, pStatus, m.Ptr1(), m.Ptr2()); + // if (r != KErrNone) + Kern::RequestComplete(iClientThread,pStatus,r); + m.Complete(KErrNone, ETrue); + } + else + { + // DoControl + TInt r = DoControl(id, m.Ptr0(), m.Ptr1()); + m.Complete(r, ETrue); + } + } + +TInt DSVPHostFsChannel::MkDir(TSVPHostFsMkDirInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::MkDir()"); + + TSVPHostFsMkDirInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsMkDirInfo))); + + if (!info.iName) + return KErrArgument; + + TUint16 pathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); + SVPWriteReg(device, EArg1, info.iLength); + SVPWriteReg(device, EArg2, info.iFlags); + SVPInvoke(device, RSVPHostFsDriver::EMkDir); + + return SVPReadReg(device, EResult); + + } + +TInt DSVPHostFsChannel::RmDir(TSVPHostFsRmDirInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::RmDir()"); + + TSVPHostFsRmDirInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsRmDirInfo))); + + if (!info.iName) + return KErrArgument; + + TUint16 pathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); + SVPWriteReg(device, EArg1, info.iLength); + SVPInvoke(device, RSVPHostFsDriver::ERmDir); + + return SVPReadReg(device, EResult); + + } + +TInt DSVPHostFsChannel::Delete(TSVPHostFsDeleteInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Delete()"); + + TSVPHostFsDeleteInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsDeleteInfo))); + + if (!info.iName) + return KErrArgument; + + TUint16 pathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); + SVPWriteReg(device, EArg1, info.iLength); + SVPInvoke(device, RSVPHostFsDriver::EDelete); + + return SVPReadReg(device, EResult); + + } + +TInt DSVPHostFsChannel::Rename(TSVPHostFsRenameInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Rename()"); + + TSVPHostFsRenameInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsRenameInfo))); + + if (!info.iOldName) + return KErrArgument; + + if (!info.iNewName) + return KErrArgument; + + TUint16 oldPathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iOldName, (TUint8*)oldPathData, info.iOldLength*2)); + + TUint16 newPathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iNewName, (TUint8*)newPathData, info.iNewLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)oldPathData)); + SVPWriteReg(device, EArg1, info.iOldLength); + SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)newPathData)); + SVPWriteReg(device, EArg3, info.iNewLength); + SVPInvoke(device, RSVPHostFsDriver::ERename); + + return SVPReadReg(device, EResult); + + } + +TInt DSVPHostFsChannel::Replace(TSVPHostFsReplaceInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Replace()"); + + TSVPHostFsReplaceInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsReplaceInfo))); + + if (!info.iOldName) + return KErrArgument; + + if (!info.iNewName) + return KErrArgument; + + TUint16 oldPathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iOldName, (TUint8*)oldPathData, info.iOldLength*2)); + + TUint16 newPathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iNewName, (TUint8*)newPathData, info.iNewLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)oldPathData)); + SVPWriteReg(device, EArg1, info.iOldLength); + SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)newPathData)); + SVPWriteReg(device, EArg3, info.iNewLength); + SVPInvoke(device, RSVPHostFsDriver::EReplace); + + return SVPReadReg(device, EResult); + + } + +TInt DSVPHostFsChannel::Entry(TSVPHostFsEntryInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Entry()"); + + TSVPHostFsEntryInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsEntryInfo))); + + if (!info.iName) + return KErrArgument; + + TUint16 pathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); + SVPWriteReg(device, EArg1, info.iLength); + SVPInvoke(device, RSVPHostFsDriver::EEntry); + + RET_IF_ERROR(err, SVPReadReg(device, EResult)); + + TUint32 att = SVPReadReg(device, EArg0); + TUint32 modified = SVPReadReg(device, EArg1); + TUint32 filesize = SVPReadReg(device, EArg2); + // TODO: Yuk! Hack alert! Say EWindows for now. But really should probably say EUnknown, + // since the device won't tell us. Not sure if it can (easily) given remote mounting etc. + // However this probably delays the problem. On the other hand it is probably best to make + // the file service guess, since it need only guess once, and cache its guess. + TUint32 filetimetype = EWindows; + + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iAtt, (TUint8*)&att, sizeof(att))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iModified, (TUint8*)&modified, sizeof(modified))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iSize, (TUint8*)&filesize, sizeof(filesize))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iTimeType, (TUint8*)&filetimetype, sizeof(filetimetype))); + return KErrNone; + } + +TInt DSVPHostFsChannel::SetEntry(TSVPHostFsSetEntryInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::SetEntry()"); + return KErrNotSupported; + } + +TInt DSVPHostFsChannel::Flush(TUint32 aDrive) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::Flush()"); + TUint32 device = iDriveMap[aDrive]; + SVPInvoke(device, RSVPHostFsDriver::EFileFlushAll); + + return KErrNone; + } + +TInt DSVPHostFsChannel::DirOpen(TSVPHostFsDirOpenInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DirOpen()"); + + TSVPHostFsDirOpenInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsDirOpenInfo))); + + if (!info.iName) + return KErrArgument; + + TUint16 pathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); + SVPWriteReg(device, EArg1, info.iLength); + SVPInvoke(device, RSVPHostFsDriver::EDirOpen); + + RET_IF_ERROR(err, SVPReadReg(device, EResult)); + + // handle is in arg 0 + TUint32 handle = SVPReadReg(device, EArg0); + return Kern::ThreadRawWrite(iClientThread, &aInfo->iHandle, (TUint8*)&handle, sizeof(handle)); + } + +TInt DSVPHostFsChannel::FileOpen(TSVPHostFsFileOpenInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileOpen()"); + + TSVPHostFsFileOpenInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileOpenInfo))); + + if (!info.iName) + return KErrArgument; + + TUint16 pathData[KMaxPath]; + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, info.iName, (TUint8*)pathData, info.iLength*2)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, Epoc::LinearToPhysical((TUint32)pathData)); + SVPWriteReg(device, EArg1, info.iLength); + SVPWriteReg(device, EArg2, info.iMode); + SVPWriteReg(device, EArg3, info.iOpen); + SVPInvoke(device, RSVPHostFsDriver::EFileOpen); + + RET_IF_ERROR(err, SVPReadReg(device, EResult)); + + TUint32 handle = SVPReadReg(device, EArg0); + TUint32 att = SVPReadReg(device, EArg1); + TUint32 modified = SVPReadReg(device, EArg2); + TUint32 size = SVPReadReg(device, EArg3); + TUint32 timeType = EWindows; + + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iHandle, (TUint8*)&handle, sizeof(handle))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iAtt, (TUint8*)&att, sizeof(att))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iModified, (TUint8*)&modified, sizeof(modified))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iSize, (TUint8*)&size, sizeof(size))); + return Kern::ThreadRawWrite(iClientThread, &aInfo->iTimeType, (TUint8*)&timeType, sizeof(timeType)); + + } + +TInt DSVPHostFsChannel::FileClose(TUint32 aDrive, TUint32 aHandle) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileClose()"); + + TUint32 device = iDriveMap[aDrive]; + SVPWriteReg(device, EArg0, aHandle); + SVPInvoke(device, RSVPHostFsDriver::EFileClose); + return SVPReadReg(device, EResult); + } + +TInt DSVPHostFsChannel::FileRead(TSVPHostFsFileReadInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileRead()"); + + char buf[0x400]; + TSVPHostFsFileReadInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileReadInfo))); + + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileRead handle %d length %d pos %d phys_addr 0x%08x info.iBuf 0x%08x", + info.iHandle, info.iLength, info.iPos, Epoc::LinearToPhysical((TUint32)buf), info.iBuf); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, info.iHandle); + SVPWriteReg(device, EArg1, info.iPos); + SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)buf)); + SVPWriteReg(device, EArg3, info.iLength); + SVPInvoke(device, RSVPHostFsDriver::EFileRead); + + RET_IF_ERROR(err, SVPReadReg(device, EResult)); + + TUint32 len = SVPReadReg(device, EArg0); + + DP("** (SVPHOSTFSDRIVER) Read %d bytes", len); + + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iLength, (TUint8*)&len, sizeof(len))); + return Kern::ThreadRawWrite(iClientThread, (TUint8*)info.iBuf, (TUint8*)&buf, len); + } + +TInt DSVPHostFsChannel::FileWrite(TSVPHostFsFileWriteInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileWrite()"); + + char buf[0x400]; + TSVPHostFsFileWriteInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileWriteInfo))); + + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileWrite handle %d length %d pos %d phys_addr 0x%08x info.iBuf 0x%08x", + info.iHandle, info.iLength, info.iPos, Epoc::LinearToPhysical((TUint32)buf), info.iBuf); + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, (TUint8 *)info.iBuf, buf, info.iLength)); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, info.iHandle); + SVPWriteReg(device, EArg1, info.iPos); + SVPWriteReg(device, EArg2, Epoc::LinearToPhysical((TUint32)buf)); + SVPWriteReg(device, EArg3, info.iLength); + SVPInvoke(device, RSVPHostFsDriver::EFileWrite); + + RET_IF_ERROR(err, SVPReadReg(device, EResult)); + + TUint32 len = SVPReadReg(device, EArg0); + + DP("** (SVPHOSTFSDRIVER) Wrote %d bytes", len); + + return Kern::ThreadRawWrite(iClientThread, &aInfo->iLength, (TUint8*)&len, sizeof(len)); + } + +TInt DSVPHostFsChannel::FileSetSize(TSVPHostFsFileSetSizeInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileSetSize()"); + + TSVPHostFsFileSetSizeInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsFileSetSizeInfo))); + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, info.iHandle); + SVPWriteReg(device, EArg1, info.iLength); + SVPInvoke(device, RSVPHostFsDriver::EFileSetSize); + + TUint32 res = SVPReadReg(device, EResult); + + RET_IF_ERROR(err, res); + + return res; + } + +TInt DSVPHostFsChannel::FileSetEntry(TSVPHostFsSetEntryInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::FileSetEntry()"); + + return KErrNotSupported; + } + +TInt DSVPHostFsChannel::DirClose(TUint32 aDrive, TUint32 aHandle) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DirClose()"); + + TUint32 device = iDriveMap[aDrive]; + SVPWriteReg(device, EArg0, aHandle); + SVPInvoke(device, RSVPHostFsDriver::EDirClose); + return SVPReadReg(device, EResult); + } + +TInt DSVPHostFsChannel::DirRead(TSVPHostFsDirReadInfo* aInfo) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::DirRead()"); + + TUint16 name[KMaxPath]; + TSVPHostFsDirReadInfo info; + TInt err = KErrNone; + + RET_IF_ERROR(err, Kern::ThreadRawRead(iClientThread, aInfo, (TUint8*)&info, sizeof(TSVPHostFsDirReadInfo))); + + + TUint32 device = iDriveMap[info.iDrive]; + SVPWriteReg(device, EArg0, info.iHandle); + SVPWriteReg(device, EArg1, Epoc::LinearToPhysical((TUint32)name)); + SVPWriteReg(device, EArg2, KMaxPath); + SVPInvoke(device, RSVPHostFsDriver::EDirRead); + + RET_IF_ERROR(err, SVPReadReg(device, EResult)); + + TUint32 att = SVPReadReg(device, EArg0); + TUint32 modified = SVPReadReg(device, EArg1); + TUint32 filesize = SVPReadReg(device, EArg2); + TUint32 namesize = SVPReadReg(device, EArg3); + // TODO: Yuk! Hack alert! Say EWindows for now. But really should probably say EUnknown, + // since the device won't tell us. Not sure if it can (easily) given remote mounting etc. + // However this probably delays the problem. On the other hand it is probably best to make + // the file service guess, since it need only guess once, and cache its guess. + TUint32 filetimetype = EWindows; + + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iAtt, (TUint8*)&att, sizeof(att))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iModified, (TUint8*)&modified, sizeof(modified))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iSize, (TUint8*)&filesize, sizeof(filesize))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iTimeType, (TUint8*)&filetimetype, sizeof(filetimetype))); + RET_IF_ERROR(err, Kern::ThreadRawWrite(iClientThread, &aInfo->iLength, (TUint8*)&namesize, sizeof(namesize))); + return Kern::ThreadRawWrite(iClientThread, &aInfo->iName, (TUint8*)&name, namesize * sizeof(TUint16)); + } + +TInt DSVPHostFsChannel::GetID(TUint32 aDrive, TUint32 * aId) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::GetID"); + TUint32 device = iDriveMap[aDrive]; + TUint32 id = SVPReadReg(device, EDeviceID); + return Kern::ThreadRawWrite(iClientThread, aId, &id, sizeof(TUint32)); + } + +TInt DSVPHostFsChannel::GetDriveMap(TAny * aMap) + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsChannel::GetDriveMap"); + return Kern::ThreadRawWrite(iClientThread, aMap, iDriveMap, sizeof(iDriveMap)); + } + +DECLARE_EXTENSION_LDD() + { + DP("** (SVPHOSTFSDRIVER) DSVPHostFsDriverFactory created"); + return new DSVPHostFsDriverFactory; + } + +DECLARE_STANDARD_EXTENSION() + { + DP("** (SVPHOSTFSDRIVER) SVPHostFs extension entry point"); + + DP("** (SVPHOSTFSDRIVER) Creating LocDrv device"); + TInt r; + DSVPHostFsDriverFactory* device = new DSVPHostFsDriverFactory; + if (device==NULL) + r=KErrNoMemory; + else + r=Kern::InstallLogicalDevice(device); + + DP("** (SVPHOSTFSDRIVER) Installing LocDrv device in kernel returned %d",r); + + return r; + } diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/driver/svphostfsdriver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/driver/svphostfsdriver.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SVPHOSTFSDRIVER_H__ +#define __SVPHOSTFSDRIVER_H__ + + +#include "rsvphostfsdriver.h" + +// Debug messages +//#define SVPDBG +#ifdef SVPDBG +#define LOG_MSG(x) Kern::Printf(x) +#define LOG_MSG2(x, y) Kern::Printf(x, y) +#else +#define LOG_MSG(x) +#define LOG_MSG2(x, y) +#endif + + +// +// class DSVPHostFsDriverFactory +// +class DSVPHostFsDriverFactory : public DLogicalDevice +{ +public: + + DSVPHostFsDriverFactory(); + virtual TInt Install(); + virtual void GetCaps(TDes8& aDes) const; + virtual TInt Create(DLogicalChannelBase*& aChannel); +}; + +// +// DSVPHostFsChannel +// +class DSVPHostFsChannel : public DLogicalChannel +{ +public: + + DSVPHostFsChannel(DLogicalDevice* aLogicalDevice); + ~DSVPHostFsChannel(); + + virtual TInt DoCreate(TInt aUnit, const TDesC* anInfo, const TVersion& aVer); + virtual void HandleMsg(TMessageBase* aMsg); + +protected: + virtual void DoCancel(TInt aReqNo); + virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); + virtual TInt DoControl(TInt aFunction, TAny *a1, TAny *a2); + +private: + TInt DirOpen(TSVPHostFsDirOpenInfo* aInfo); + TInt DirClose(TUint32 aHandle); + TInt DirRead(TSVPHostFsDirReadInfo* aInfo); + +private: + DThread* iClientThread; + + + TDfcQue* iDFCQue; + +}; + +#endif //__SVPHOSTFSDRIVER_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/fs/rsvphostfsdriver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/fs/rsvphostfsdriver.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include + +#include + +#include "svphostfsy.h" + +#ifdef DP +#undef DP +#define DP(f...) +#endif + +TInt RSVPHostFsDriver::Open() + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Open()")); + return DoCreate(KSVPHostFsDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), KNullUnit, NULL, NULL); + } + +TInt RSVPHostFsDriver::MkDir(TSVPHostFsMkDirInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::MkDir()")); + return DoSVPRequest(EMkDir, &aInfo); + } + +TInt RSVPHostFsDriver::RmDir(TSVPHostFsRmDirInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::RmDir()")); + return DoSVPRequest(ERmDir, &aInfo); + } + +TInt RSVPHostFsDriver::Delete(TSVPHostFsDeleteInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Delete()")); + return DoSVPRequest(EDelete, &aInfo); + } + +TInt RSVPHostFsDriver::Rename(TSVPHostFsRenameInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Rename()")); + return DoSVPRequest(ERename, &aInfo); + } + +TInt RSVPHostFsDriver::Replace(TSVPHostFsReplaceInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Replace()")); + return DoSVPRequest(EReplace, &aInfo); + } + +TInt RSVPHostFsDriver::ReadUid(const TDesC& /*aName*/,TEntry& /*anEntry*/) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::ReadUid()")); + return KErrNone; + } + +TInt RSVPHostFsDriver::Entry(TSVPHostFsEntryInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::Entry()")); + return DoSVPRequest(EEntry, &aInfo); + } + +TInt RSVPHostFsDriver::SetEntry(TSVPHostFsSetEntryInfo &aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::SetEntry()")); + return DoSVPRequest(ESetEntry, &aInfo); + } + +TInt RSVPHostFsDriver::FileOpen(TSVPHostFsFileOpenInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileOpen()")); + return DoSVPRequest(EFileOpen, &aInfo); + } + +TInt RSVPHostFsDriver::FileClose(TUint32 aDrive, TUint32 aHandle) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileClose()")); + return DoSVPRequest(EFileClose, (TAny *)aDrive, (TAny *)aHandle); + } + +TInt RSVPHostFsDriver::FileRead(TSVPHostFsFileReadInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileRead()")); + return DoSVPRequest(EFileRead, &aInfo); + } + +TInt RSVPHostFsDriver::FileWrite(TSVPHostFsFileWriteInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileWrite()")); + return DoSVPRequest(EFileWrite, &aInfo); + } + +TInt RSVPHostFsDriver::FileSetSize(TSVPHostFsFileSetSizeInfo &aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileSetSize()")); + return DoSVPRequest(EFileSetSize, &aInfo); + } + +TInt RSVPHostFsDriver::FileSetEntry(TSVPHostFsSetEntryInfo &aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FileSetEntry()")); + return KErrNotSupported; + } + +TInt RSVPHostFsDriver::FlushData(TUint32 aDrive) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FlushData()")); + return DoSVPRequest(EFileFlushAll, (TAny *)aDrive); + } + +TInt RSVPHostFsDriver::FlushAll(TUint32 aDrive) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::FlushAll()")); + return DoSVPRequest(EFileFlushAll, (TAny *)aDrive); + } + +TInt RSVPHostFsDriver::DirOpen(TSVPHostFsDirOpenInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::DirOpen()")); + return DoSVPRequest(EDirOpen, &aInfo); + } + +TInt RSVPHostFsDriver::DirClose(TUint32 aDrive, TUint32 aHandle) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::DirClose()")); + return DoSVPRequest(EDirClose, (TAny *)aDrive, (TAny *)aHandle); + } + +TInt RSVPHostFsDriver::DirRead(TSVPHostFsDirReadInfo& aInfo) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::DirRead()")); + return DoSVPRequest(EDirRead, &aInfo); + } + +TUint32 RSVPHostFsDriver::GetDeviceID(TUint32 aDrive) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::GetDeviceID()")); + + TUint32 id; + TInt r = DoSVPRequest(EGetDeviceID, (TAny *) aDrive, &id); + return (r != KErrNone) ? r : id; + } + +TInt RSVPHostFsDriver::GetDriveMap(TUint32 * aMap) + { + DP(_L("** (rsvphostfsdriver.cpp) RSVPHostFsDriver::GetDeviceID()")); + + return DoSVPRequest(EGetDriveMap, (TAny *)aMap); + } + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/fs/svphost.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/fs/svphost.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,691 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: f32test\fsstress\t_remote.cpp +* +*/ + +#if !defined(__F32FILE_H__) +#include +#endif +#if !defined(__E32TEST_H__) +#include +#endif +#if !defined(__T_STD_H__) +#include "t_std.h" +#endif +#if !defined(__T_REMFSY_H__) +#include "t_remfsy.h" +#endif + +GLDEF_D RTest test(_L("T_REMOTE - DEFAULT DRIVE")); +GLDEF_D RTest testx(_L("X Drive (WINS) <-> D Drive (MARM)")); +GLDEF_D RTest testy(_L("Y Drive (WINS) <-> C Drive (MARM)")); +GLDEF_D RTest testq(_L("REMOTE Q Drive")); + +LOCAL_D TFileName gBatchFile; +LOCAL_D TBool gRunByBatch=EFalse; + +GLDEF_D TFileName gExeFileName(RProcess().FileName()); + +/* +INFORMATION - What this test is all about + +T_REMOTE tests the asynchronous remote file system implementation, introduced in +F32 release 110 and refined in release 112. The test sets up and mounts four drives, +the default drive (usually C on WINS and MARM), a remote drive (Q) and two others, on +MARM these are C and D, on WINS these are X and Y. The remote filesystem is the only +system treated asynchronously by F32. + +The test sets up a thread for each drive and runs a number of tests on each drive. +In the remote filesystem case, a dummy filesystem has been implemented, this is built +as T_REMFSY.fsy. The tests are designed to stress a number of fileserver API +functions. The test MultipleSessions() is adapted from another F32 test T_SESSION. +It sets up an array of fileserver connections and then uses each connection to run +a number of tests - alternating between connections to stress F32 as it does so. The +test should therefore be testing multiple fileserver connections on multiple drives - +the remote filesystem running concurrently with the other drives. There should be +no failure or confusion between fileserver sessions. Each drive has a separate test +console which should complete successfully. + +NOTE: TO RUN THIS CARD SUCCESSFULLY ON MARM A CF CARD IS REQUIRED + +*/ + +LOCAL_C void Test0(RTest& aTest) +// +// Scan for open files - no sessions +// + { + aTest.Next(_L("Scan for open files with no sessions open")); + CFileList* list; + TOpenFileScan fileScan(TheFs); + fileScan.NextL(list); + if (list==NULL) + return; + TInt count=list->Count(); + if (count==1) + { + gRunByBatch=ETrue; + gBatchFile=(*list)[0].iName; + delete list; + fileScan.NextL(list); + if (list==NULL) + return; + count=list->Count(); + } + while (count--) + { + TEntry entry=(*list)[count]; + aTest.Printf(_L("%d) EntryName = %S\n"),count,&entry.iName); + } + //aTest.Printf(_L("Test will fail unless files are closed.\n")); + //aTest.Printf(_L("Press any key ...\n")); + //aTest.Getch(); + } + + +LOCAL_C void Test1() +// +// This test is only called by default drive +// Test OpenFileScan +// + { + test.Next(_L("Scan for open files - one session only")); + + RFile file1,file2,file3; + TFileName fn; + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FILE.CPP"); + fn[0] = gExeFileName[0]; + r=file2.Open(TheFs,fn,EFileRead); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + + CFileList* list; + TOpenFileScan fileScan(TheFs); + fileScan.NextL(list); + + if (gRunByBatch) + { + test(list!=NULL); + test(list->Count()==1); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L(".BAT"))>=0); + delete list; + fileScan.NextL(list); + } + + test(list!=NULL); + TInt count=list->Count(); + test(count==3); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + entry=(*list)[1]; + test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); + entry=(*list)[2]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + TThreadId threadId=fileScan.ThreadId(); + RThread current; + TThreadId currentId=current.Id(); + test(threadId==currentId); + delete list; + + fileScan.NextL(list); + test(list==NULL); + + file1.Close(); + file2.Close(); + file3.Close(); + } + +LOCAL_C void Test2() +// +// Test openfilescan - empty, full, empty. +// + { + test.Next(_L("Scan for open files - empty sessions")); + + RFs fs1,fs2,fs3,fs4; + TInt r=fs1.Connect(); + test(r==KErrNone); + r=fs2.Connect(); + test(r==KErrNone); + r=fs3.Connect(); + test(r==KErrNone); + r=fs4.Connect(); + test(r==KErrNone); + + RFile file1,file2,file3; + TFileName fn; + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FILE.CPP"); + fn[0] = gExeFileName[0]; + r=file2.Open(fs2,fn,EFileRead); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + + CFileList* list; + TOpenFileScan fileScan(TheFs); + fileScan.NextL(list); + + if (gRunByBatch) + { + test(list!=NULL); + test(list->Count()==1); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L(".BAT"))>=0); + delete list; + fileScan.NextL(list); + } + + test(list!=NULL); + TInt count=list->Count(); + test(count==3); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + entry=(*list)[1]; + test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); + entry=(*list)[2]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + TThreadId threadId=fileScan.ThreadId(); + RThread current; + TThreadId currentId=current.Id(); + test(threadId==currentId); + delete list; + + fileScan.NextL(list); + test(list==NULL); + + file1.Close(); + file2.Close(); + file3.Close(); + fs1.Close(); + fs2.Close(); + fs3.Close(); + fs4.Close(); + } + +LOCAL_C void Test3() +// +// Test openfilescan - empty, full, empty full +// + { + test.Next(_L("Scan for open files - multiple sessions")); + + RFs fs1,fs2,fs3,fs4; + TInt r=fs1.Connect(); + test(r==KErrNone); + r=fs2.Connect(); + test(r==KErrNone); + r=fs3.Connect(); + test(r==KErrNone); + r=fs4.Connect(); + test(r==KErrNone); + + RFile file1,file2,file3; + TFileName fn; + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FILE.CPP"); + fn[0] = gExeFileName[0]; + r=file2.Open(fs2,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + + r=file1.Open(fs4,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FILE.CPP"); + fn[0] = gExeFileName[0]; + r=file2.Open(fs4,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file3.Open(fs4,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + + CFileList* list; + TOpenFileScan fileScan(TheFs); + fileScan.NextL(list); + + if (gRunByBatch) + { + test(list!=NULL); + test(list->Count()==1); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L(".BAT"))>=0); + delete list; + fileScan.NextL(list); + } + + test(list!=NULL); + TInt count=list->Count(); + test(count==3); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + entry=(*list)[1]; + test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); + entry=(*list)[2]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + TThreadId threadId=fileScan.ThreadId(); + RThread current; + TThreadId currentId=current.Id(); + test(threadId==currentId); + delete list; + + fileScan.NextL(list); + test(list!=NULL); + count=list->Count(); + test(count==3); + entry=(*list)[0]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + entry=(*list)[1]; + test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); + entry=(*list)[2]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + threadId=fileScan.ThreadId(); + currentId=current.Id(); + test(threadId==currentId); + delete list; + + fileScan.NextL(list); + test(list==NULL); + + file1.Close(); + file2.Close(); + file3.Close(); + fs1.Close(); + fs2.Close(); + fs3.Close(); + fs4.Close(); + } + +LOCAL_C void Test4() +// +// Test openfilescan - rdirs, empty, full, empty rdirs. +// + { + test.Next(_L("Scan for open files - check RDir sessions are ignored")); + + RFs fs1,fs2,fs3,fs4; + TFileName fn; + TInt r=fs1.Connect(); + test(r==KErrNone); + r=fs2.Connect(); + test(r==KErrNone); + r=fs3.Connect(); + test(r==KErrNone); + r=fs4.Connect(); + test(r==KErrNone); + + RDir dir1,dir2,dir3,dir4; + fn = _L("Z:\\TEST\\*.XDE"); + fn[0] = gExeFileName[0]; + r=dir1.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir2.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir3.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir4.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + + RFile file1,file2,file3; + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FILE.CPP"); + fn[0] = gExeFileName[0]; + r=file2.Open(fs2,fn,EFileRead); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + + RDir dir5,dir6,dir7,dir8; + fn = _L("Z:\\TEST\\*.XDE"); + fn[0] = gExeFileName[0]; + r=dir5.Open(fs4,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir6.Open(fs4,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir7.Open(fs4,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir8.Open(fs4,fn,KEntryAttMaskSupported); + test(r==KErrNone); + + CFileList* list; + TOpenFileScan fileScan(TheFs); + fileScan.NextL(list); + + if (gRunByBatch) + { + test(list!=NULL); + test(list->Count()==1); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L(".BAT"))>=0); + delete list; + fileScan.NextL(list); + } + + test(list!=NULL); + TInt count=list->Count(); + test(count==3); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + entry=(*list)[1]; + test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); + entry=(*list)[2]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + TThreadId threadId=fileScan.ThreadId(); + RThread current; + TThreadId currentId=current.Id(); + test(threadId==currentId); + delete list; + + fileScan.NextL(list); + test(list==NULL); + + file1.Close(); + file2.Close(); + file3.Close(); + dir1.Close(); dir2.Close(); + dir3.Close(); dir4.Close(); + dir5.Close(); dir6.Close(); + dir7.Close(); dir8.Close(); + fs1.Close(); fs2.Close(); + fs3.Close(); fs4.Close(); + } + +LOCAL_C void Test5() +// +// Test OpenFileScan +// + { + + test.Next(_L("Scan for open files - mixed RDirs and RFiles")); + + RFile file1,file2,file3; + TFileName fn; + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FILE.CPP"); + fn[0] = gExeFileName[0]; + r=file2.Open(TheFs,fn,EFileRead); + test(r==KErrNone); + fn = _L("Z:\\TEST\\T_FSRV.CPP"); + fn[0] = gExeFileName[0]; + r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly); + test(r==KErrNone); + + RDir dir1,dir2,dir3,dir4; + fn = _L("Z:\\TEST\\*.XDE"); + fn[0] = gExeFileName[0]; + r=dir1.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir2.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir3.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + r=dir4.Open(TheFs,fn,KEntryAttMaskSupported); + test(r==KErrNone); + + CFileList* list; + TOpenFileScan fileScan(TheFs); + fileScan.NextL(list); + + if (gRunByBatch) + { + test(list!=NULL); + test(list->Count()==1); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L(".BAT"))>=0); + delete list; + fileScan.NextL(list); + } + + test(list!=NULL); + TInt count=list->Count(); + test(count==3); + TEntry entry=(*list)[0]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + entry=(*list)[1]; + test(entry.iName.FindF(_L("T_FILE.CPP"))>=0); + entry=(*list)[2]; + test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0); + TThreadId threadId=fileScan.ThreadId(); + RThread current; + TThreadId currentId=current.Id(); + test(threadId==currentId); + delete list; + + fileScan.NextL(list); + test(list==NULL); + + file1.Close(); + file2.Close(); + file3.Close(); + dir1.Close(); + dir2.Close(); + dir3.Close(); + dir4.Close(); + } + + + +LOCAL_C void MultipleSessions(TInt aDrive, RTest& aTest) +// +// Create an array of fileserver sessions +// Create an array of TMultipleSessionTest objects +// + + { +#if defined(UNICODE) + const TInt maxNumberSessions=10; +#else + const TInt maxNumberSessions=20; +#endif + + RFs session[maxNumberSessions]; + TMultipleSessionTest testObject[maxNumberSessions]; + TInt i=0; + TInt r; + + for (; i +#include +#include +#include + +#include "svphostfsy.h" + +////////////////////////////////////////////////////////////////////////// +// CSVPHostDirCB // +////////////////////////////////////////////////////////////////////////// + +CSVPHostDirCB::CSVPHostDirCB(/*CSessionFs* aSession*/) +// +// Constructor +// + : CDirCB(/*aSession*/),iEntry() + { + __DECLARE_NAME(_S("CSVPHostDirCB")); + } + +CSVPHostDirCB::~CSVPHostDirCB() +// +// Destructor +// + { + DP(_L("** (SVPHOSTDIR) CSVPHostDirCB::~CSVPHostDirCB")); + + if ((TInt)iHandle == KErrBadHandle) return; + + SVP_HOST_FS_DEVICE().DirClose(Drive().DriveNumber(), iHandle); + } + +TBool CSVPHostDirCB::MatchUid() +// +// Match the uid ? +// + { + if (iUidType[0]!=TUid::Null() || iUidType[1]!=TUid::Null() || iUidType[2]!=TUid::Null()) + return(ETrue); + return(EFalse); + } + +void fileTimeToTime(TUint32 t,TTime& aTime, TFileTimeType aType) +// +// Convert a time (in seconds from the epoc) into a TTIME +// + { + TInt64 at =((TInt64)t) * 1000000; + TTime time = TTime(at); + if (aType == EWindows) + { + time += TTimeIntervalYears(1970); + time += TTimeIntervalDays(1); + } + aTime=time; + } + +LOCAL_C TBool CompareUid(const TUidType& aUidTrg, const TUidType& aUidSuitor) +// +// Compare the suitor to the target pattern +// + { + + if (aUidTrg[0]!=TUid::Null() && aUidTrg[0]!=aUidSuitor[0]) + return(EFalse); + if (aUidTrg[1]!=TUid::Null() && aUidTrg[1]!=aUidSuitor[1]) + return(EFalse); + if (aUidTrg[2]!=TUid::Null() && aUidTrg[2]!=aUidSuitor[2]) + return(EFalse); + return(ETrue); + } + + +void CSVPHostDirCB::ReadL(TEntry& anEntry) +// +// Read the next entry from the directory +// + { + DP(_L("** (SVPHOSTDIR) CSVPHostDirCB::ReadL")); + + TUint driveNumber = Drive().DriveNumber() ; + FOREVER + { + if (!iPending) + { + TSVPHostFsDirReadInfo info(driveNumber, iHandle); + User::LeaveIfError(SVP_HOST_FS_DEVICE().DirRead(info)); + + TPtr name((TUint16 *)&info.iName[0], info.iLength, KMaxPath); + + if (name==_L(".") || name==_L("..")) + continue; + + iEntry.iName = name; + iEntry.iAtt=info.iAtt&KEntryAttMaskSupported; + iEntry.iSize=info.iSize; + fileTimeToTime(info.iModified,iEntry.iModified, info.iTimeType); + DP(_L("%S %d %x %x"), &name, iEntry.iAtt, iEntry.iSize, iEntry.iModified); + } + iPending=EFalse; + anEntry=iEntry; + if ((iFullName.NameAndExt()==_L("*.*") || anEntry.iName.MatchF(iFullName.NameAndExt())!=KErrNotFound) + && Mount().MatchEntryAtt(anEntry.iAtt&KEntryAttMaskSupported,iAtt)) + { + if (MatchUid()) + { + TParse fileName; + TBuf path=iFullName.Path(); + fileName.Set(anEntry.iName,&path,NULL); + (*(CSVPHostMountCB*)&Mount()).ReadUidL(fileName.FullName(),anEntry); + if (CompareUid(iUidType,anEntry.iType)) + break; + } + else + break; + } + break; + } + + if ((iAtt&KEntryAttAllowUid)==0 || anEntry.iAtt&KEntryAttDir || MatchUid()) + return; + TParse fileName; + TBuf path=iFullName.Path(); + fileName.Set(anEntry.iName,&path,NULL); + (*(CSVPHostMountCB*)&Mount()).ReadUidL(fileName.FullName(),anEntry); + + return; + } + + +////////////////////////////////////////////////////////////////////////// +// CSVPHostFormatCB // +////////////////////////////////////////////////////////////////////////// + +CSVPHostFormatCB::CSVPHostFormatCB(/*CSessionFs* aSession*/)//???JCS +// +// Constructor +// + : CFormatCB(/*aSession*/) + { + __DECLARE_NAME(_S("CSVPHostFormatCB")); + } + +CSVPHostFormatCB::~CSVPHostFormatCB() +// +// Destructor +// + {} + +void CSVPHostFormatCB::DoFormatStepL() +// +// Do Formatting +// + { + iCurrentStep=0; + User::Leave(KErrNotSupported); + } + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/fs/svphostfil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/fs/svphostfil.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include + +#include "svphostfsy.h" + + + +////////////////////////////////////////////////////////////////////////// +// CSVPHostFileCB // +////////////////////////////////////////////////////////////////////////// + +CSVPHostFileCB::CSVPHostFileCB() +// +// Constructor +// + { + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::CSVPHostFileCB()")); + + __DECLARE_NAME(_S("CSVPHostFileCB")); + } + +CSVPHostFileCB::~CSVPHostFileCB() +// +// Destructor +// + { + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::~CSVPHostFileCB()")); + if ((TInt)iHandle == KErrBadHandle) return; + + SVP_HOST_FS_DEVICE().FileClose(Drive().DriveNumber(), iHandle); + } + +TBool CSVPHostFileCB::IsRomDrive() const +// +// Returns ETrue if the drive number == EDriveZ +// + { + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::IsRomDrive()")); + return(EFalse); + } + + +void CSVPHostFileCB::CheckPos(TInt /*aPos*/) + { + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::CheckPos()")); + } + +void CSVPHostFileCB::ReadL(TInt aPos,TInt& aLength ,const TAny* aDes , const RMessagePtr2& aMessage) + { + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL(%d,%d)"), aPos, aLength); + + TInt n = 0; + TInt pos=aPos; + TInt len=aLength; + TBuf8<0x400> buf; + + if (aMessage.Handle() == KLocalMessageHandle) + ((TPtr8* )aDes)->SetLength(0); + + TUint driveNumber = Drive().DriveNumber() ; + while (len) + { + TInt s=Min(len,buf.MaxLength()); + TSVPHostFsFileReadInfo info(driveNumber, iHandle,s,pos+n,(char*)buf.Ptr()); + + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL pos %d s %d p 0x%08x"), pos+n, s, buf.Ptr()); + + User::LeaveIfError(SVP_HOST_FS_DEVICE().FileRead(info)); + + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL read %d bytes"), info.iLength); + + buf.SetLength(info.iLength); + + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::ReadL set buf length")); + + if (aMessage.Handle() == KLocalMessageHandle) + ((TPtr8* )aDes)->Append(buf); + else + aMessage.WriteL(0,buf,n); + + n+=info.iLength; + + if (((TInt)info.iLength) buf; + TUint driveNumber = Drive().DriveNumber() ; + while (len) + { + TInt s=Min(len,buf.MaxLength()); + + if (aMessage.Handle() == KLocalMessageHandle) + buf.Copy( ((TPtr8* )aDes)->MidTPtr(n, s) ); + else + aMessage.ReadL(0,buf,n); + + TSVPHostFsFileWriteInfo info(driveNumber, iHandle,s,pos+n,(char*)buf.Ptr()); + + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::WriteL pos %d s %d p 0x%08x"), pos+n, s, buf.Ptr()); + + User::LeaveIfError(SVP_HOST_FS_DEVICE().FileWrite(info)); + + DP(_L("** (SVPHOSTFIL) CSVPHostFileCB::WriteL wrote %d bytes"), info.iLength); + + if (((TInt)info.iLength) +#include + +_LIT(KEStartPanicCatagory, "SVP_HOSTFS_SYSSTART"); + +enum TEStartPanic + { + ELitNoDM = 1, // No Domain Manager + ELitDMInitFail, // Domain Manager init fail + ELitHALFail, // HAL init fail + ELitConnectFsFail1, // Connect fs 1 fail + ELitInitLocalPwStoreFail, // Init PwStore fail + ELitLocaleInitialisationFail, // Initialisation of locale properties failed + ELitFSInitDriveInfoFail, // FS Init DriveInfo fail + ELitCreateTrapHandlerFail, // Create trap handler fail + ELitLoadSysLddsFail, // Load sys ldds fail + ELitLocalDriveMappingFail, // Local drive mapping fail + ELitDriveMappingFileFail, // Drive mapping file not found + ELitSwapMappingFailArrayInconsistent, // Swap mappings fail - array inconsistent + ELitFsSwapMappingFail, // Swap mappings fail - Fs request failed + EPropertyError, // RProperty return error + ECompMountFsFail, // Failed comp fs mount + EFsNameFail, // File system name on Z: failed + ELitNoWS, // No WSERV + EStartupModeFail, // Get startup mode failed + ESysAgentFail, // Fail to launch system agent + ESetSystemDriveFail // Fail to set System Drive + }; + +inline void Panic(TEStartPanic aPanic, TInt aReason) + { + TBuf<10> panic(KEStartPanicCatagory); + panic.AppendFormat(_L("_%d"), aPanic); + User::Panic(panic, aReason); + } + +_LIT(KServerPathSysBin, "0:\\Sys\\Bin\\"); +_LIT(KWindowServerRootName1,"EWSRV.EXE"); +_LIT(KHostFSMounter, "z:\\sys\\bin\\SVPHOSTFS.EXE"); + +TBool CreateServer(const TDriveList& aDrives, const TDesC& aRootName) + { + RProcess ws; + TInt r=ws.Create(aRootName, KNullDesC); + if (r!=KErrNone) + { + TFileName name; + name = KServerPathSysBin(); + name+=aRootName; + TInt i=EDriveZ; + FOREVER + { + i= (i==0) ? EDriveZ : i-1; + if (aDrives[i]!=KDriveAbsent) // Got a valid drive + { + name[0]=(TUint32)('A'+i); // Set the drive letter + r=ws.Create(name,KNullDesC); + if (r==KErrNone) + break; + } + if (i==EDriveZ) + return EFalse; + } + } + ws.Resume(); + ws.Close(); + return ETrue; + } + +GLDEF_C TInt E32Main() + { + RProcess ws; + TInt r=ws.Create(KHostFSMounter, KNullDesC); + if (r == KErrNone) + { + TRequestStatus stat; + ws.Rendezvous(stat); + ws.Resume(); + User::WaitForRequest(stat); // wait for start or death + ws.Close(); + } + // Start the window server + RFs aFs; + r = aFs.Connect(); + + if (r != KErrNone) + Panic(ELitConnectFsFail1, r); + TDriveList list; + aFs.DriveList(list); + aFs.Close(); + + if (!CreateServer(list,KWindowServerRootName1)) + Panic(ELitNoWS,KErrNotFound); + + return(KErrNone); + } diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/fs/svphostfsy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/fs/svphostfsy.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include + +#include "svphostfsy.h" + +////////////////////////////////////////////////////////////////////////// +// CSVPHostFileSystem // +////////////////////////////////////////////////////////////////////////// + +CSVPHostFileSystem::CSVPHostFileSystem() +// +// Constructor +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::CSVPHostFileSystem()")); + __DECLARE_NAME(_S("CSVPHostFileSystem")); + } + +CSVPHostFileSystem::~CSVPHostFileSystem() +// +// Destructor +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::~CSVPHostFileSystem")); + iDevice.Close(); + } + + + +TInt CSVPHostFileSystem::Install() +// +// Install the file system. +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::Install()")); + + // Open the device + RSVPHostFsDriver device; + TInt err = device.Open(); + + if (KErrNone != err) + return err; + + iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KF32BuildVersionNumber); + TPtrC name=_L("SVPHOSTFSY"); + + return(SetName(&name)); + } + +CMountCB* CSVPHostFileSystem::NewMountL(/*CSessionFs* aSession*/) const +// +// Create a new mount control block. +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewMountL()")); + return(new(ELeave) CSVPHostMountCB); + } + +CFileCB* CSVPHostFileSystem::NewFileL(/*CSessionFs* aSession*/) const +// +// Create a new file. +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewFileL()")); + return(new(ELeave) CSVPHostFileCB); + } + +CDirCB* CSVPHostFileSystem::NewDirL(/*CSessionFs* aSession*/) const +// +// Create a new directory lister. +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewDirL()")); + return(new(ELeave) CSVPHostDirCB(/*aSession*/)); + } + +CFormatCB* CSVPHostFileSystem::NewFormatL(/*CSessionFs* aSession*/) const +// +// Create a new media formatter. +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewFormatL()")); + return(new(ELeave) CSVPHostFormatCB(/*aSession*/)); + } + +TInt CSVPHostFileSystem::DefaultPath(TDes& aPath) const +// +// Return the initial default path. +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::DefaultPath()")); + aPath=_L("\\"); + return(KErrNone); + } + + +CFileSystem* CSVPHostFileSystem::NewL() +// +// Factory for CSVPHostFileSystem +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewL()")); + CSVPHostFileSystem* svpHostFsy=new(ELeave) CSVPHostFileSystem(); + return svpHostFsy; + } + + +void CSVPHostFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const +// +// Return the drive info iDriveAtt && iBatteryState already set +// + { + DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::DriveInfo()")); + + /* !@! TODO: are these the best values? */ + anInfo.iMediaAtt=KMediaAttVariableSize; + anInfo.iType=EMediaRam; +#if 0 + // !@! can't execute from remote drives + anInfo.iDriveAtt=KDriveAttRemote; +#endif + anInfo.iDriveAtt=KDriveAttLocal|KDriveAttInternal; + } + + +extern "C" { + +EXPORT_C CFileSystem* CreateFileSystem() +// +// Create a new file system +// + { + DP(_L("** (SVPHOSTFSY) CreateFileSystem()")); + + return(CSVPHostFileSystem::NewL()); + } +} + + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/fs/svphostfsy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/fs/svphostfsy.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Based on the test code under f32test\fsstress +* +*/ + +#if !defined(__SVPHOSTFSY_H__) +#define __SVPHOSTFSY_H__ + +#include +#include +#include +#include +#include +#include + +#include + +// +// Common constants used by both EFSRV and the filesystems +// + +const TUint KEntryAttIllegal=(KEntryAttVolume|KEntryAttDir); +const TUint KEntryAttModified=0x20000000; +const TUint KEntryAttMustBeFile=0x80000000; +const TInt KCurrentPosition=KMinTInt; + + +GLDEF_D const TInt KMaxParses=7; +GLDEF_D const TInt KHeapSize=0x2000; +GLREF_C void TurnAllocFailureOff(); +GLREF_C void TurnAllocFailureOn(); +GLREF_C void ReportCheckDiskFailure(TInt aRet); +GLREF_D RTest test; +GLREF_D TFileName gSessionPath; +GLREF_D TInt gAllocFailOff; +GLREF_D TInt gAllocFailOn; + +#if defined(_DEBUG) +#define SetAllocFailure(a) SetAllocFailure(a) +#else +#define SetAllocFailure(a) IsRomAddress(NULL) +#define KAllocFailureOn 0 +#define KAllocFailureOff 0 +#endif + +// Debug virtual host file service - uncomment define below +//#define SVPDBG +#ifdef SVPDBG +IMPORT_C TUint32 DebugRegister(); +#define DP(format...) { if (DebugRegister()&KFSYS) RDebug::Print(format);} +#else +#define DP(format...) +#endif + +#define SVP_HOST_FS_DEVICE() (((CSVPHostMountCB&)Mount()).Device()) +#define SVP_HOST_FS_DEVICE_ID 0xc51d0008 + +enum TPanic + { + EFileTimeToSystemTime, + EFileClose, + EFileCloseSetAttributes, + EDirClose, + EMapCouldNotConnect + }; + +// utility to convert file system times to TTime format +void fileTimeToTime(TUint32 t,TTime& aTime, TFileTimeType aType); + +// utility to produce a canonicalized pathname (i.e. with a drive letter) suitable to pass to the FS device. + +void CanonicalizePathname(const TDesC& aName, TInt aDrive, THostFileName& aHostName); + +class CSessionFs; + +class CSVPHostMountCB : public CMountCB + { +public: + CSVPHostMountCB(); + ~CSVPHostMountCB(); + void MountL(TBool aForceMount); + TInt ReMount(); + void Dismounted(); + void VolumeL(TVolumeInfo& aVolume) const; + void SetVolumeL(TDes& aName); + void MkDirL(const TDesC& aName); + void RmDirL(const TDesC& aName); + void DeleteL(const TDesC& aName); + void RenameL(const TDesC& anOldName,const TDesC& anNewName); + void ReplaceL(const TDesC& anOldName,const TDesC& anNewName); + void EntryL(const TDesC& aName,TEntry& anEntry) const; + void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); + void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile); + void DirOpenL(const TDesC& aName,CDirCB* aDir); + void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const; + void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage); + void ReadUidL(const TDesC& aName,TEntry& anEntry) const; + void GetShortNameL(const TDesC& aLongName,TDes& aShortName); + void GetLongNameL(const TDesC& aShortName,TDes& aLongName); + void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart); + void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage); + + inline const CSVPHostMountCB& Mount() const { return *this; } + inline RSVPHostFsDriver& Device() { return iDevice; } + + +private: + TBool IsRomDrive() const; + RSVPHostFsDriver iDevice; + }; + + +class RConsole; +class CSVPHostFileCB : public CFileCB + { +public: + CSVPHostFileCB(); + ~CSVPHostFileCB(); + void RenameL(const TDesC& aNewName); + void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage); + void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage); + TInt Address(TInt& aPos) const; + void SetSizeL(TInt aSize); + void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); + void FlushDataL(); + void FlushAllL(); + void CheckPos(TInt aPos); + void SetHandle(TUint aHandle) { iHandle = aHandle; } + TUint Handle() const { return iHandle; } +private: + TBool IsRomDrive() const; +private: + TInt iCurrentPos; + // TUint8* iFilePtr; + TUint iHandle; + }; + +class CSVPHostDirCB : public CDirCB + { +public: + CSVPHostDirCB(/*CSessionFs* aSession*/); + ~CSVPHostDirCB(); + void ReadL(TEntry& anEntry); + inline void SetFullName(const TDesC& aName) {iFullName.Set(aName,NULL,NULL);} + inline void SetHandle(TUint32 aHandle) { iHandle = aHandle; } + +private: + TBool MatchUid(); +public: + TEntry iEntry; +private: + TUint32 iHandle; + TParse iFullName; + }; + +class CSVPHostFormatCB : public CFormatCB + { +public: + CSVPHostFormatCB(/*CSessionFs* aSession*/); + ~CSVPHostFormatCB(); +public: + virtual void DoFormatStepL(); + }; + +class CSVPHostFileSystem : public CFileSystem + { +public: + CSVPHostFileSystem(); + ~CSVPHostFileSystem(); + TInt Install(); + TInt DefaultPath(TDes& aPath) const; + void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; +private: + CMountCB* NewMountL() const; + CFileCB* NewFileL() const; + CDirCB* NewDirL() const; + CFormatCB* NewFormatL() const; +public: + static CFileSystem* NewL(); + +public: + inline RSVPHostFsDriver& Device() { return iDevice; }; +private: + RSVPHostFsDriver iDevice; + TUint32 iDriveMap[DRIVE_MAP_SIZE]; + }; + +#endif + + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/fs/svphostmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/fs/svphostmain.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include + +#include "svphostfsy.h" + +#ifdef DP +#undef DP +#define DP(f...) +#endif + +_LIT(KSVPHOSTFSY, "SVPHOSTFSY"); + +#if 1 +GLDEF_C TInt E32Main() + { + CTrapCleanup* cleanup; + cleanup=CTrapCleanup::New(); + + RSVPHostFsDriver driver; + + TInt r = driver.Open(); + + if (r != KErrNone) + { + delete cleanup; + return(r); + } + + TUint32 driveMap[DRIVE_MAP_SIZE]; + + r = driver.GetDriveMap(driveMap); + + driver.Close(); + + if (r != KErrNone) + { + delete cleanup; + return(r); + } + + RFs aFs; + r=aFs.Connect(); + + if (r != KErrNone) goto fail; + + r=aFs.AddFileSystem(KSVPHOSTFSY); + + if (r != KErrNone) goto close; + + for (TInt i = 0; i < DRIVE_MAP_SIZE ; i++ ) + { + if (driveMap[i]) + { + char driveLetter = LOWEST_DRIVE + i; + TInt driveNumber = driveLetter - 'A'; + DP(_L(" Drive %c to be mounted\n"), driveLetter); + r = aFs.MountFileSystem(KSVPHOSTFSY,driveNumber); + DP(_L("aFs.MountFileSystem(KSVPHOSTFSY, %c) -> %d"), driveNumber, r); + if (r != KErrNone) goto close; + } + } + +close: + aFs.Close(); + +fail: + delete cleanup; + return(r); + } + +#else + +GLDEF_C TInt E32Main() + { + CTrapCleanup* cleanup; + cleanup=CTrapCleanup::New(); + + RSVPHostFsDriver driver; + + TInt r = driver.Open(); + + if (r != KErrNone){ + delete cleanup; + return(r); + } + + RFs aFs; + r=aFs.Connect(); + + r=aFs.AddFileSystem(KSVPHOSTFSY); + DP(_L("r=aFs.AddFileSystem(KSVPHOSTFSY) -> %d\n"), r); + + // !@! + // Until we have 'platform' device driver that we can use hardcode single virtual host drive as 'S' + // !@! + char driveLetter = 'S'; + TInt driveNumber = driveLetter - 'A'; + DP(_L(" Drive %c to be mounted\n"), driveLetter); + r = aFs.MountFileSystem(KSVPHOSTFSY,driveNumber); + DP(_L("aFs.MountFileSystem(KSVPHOSTFSY, %d) -> %d"), driveNumber, r); + + aFs.Close(); + + delete cleanup; + return(KErrNone); + } + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/fs/svphostmnt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/fs/svphostmnt.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,335 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include + +#include "svphostfsy.h" + +#define HOST_SVP_DRIVE_SIZE 1024*1024*1024 +#define HOST_SVP_DRIVE_FREE_SIZE 10*1024*1024 + +LOCAL_C TInt GetMediaSize(TInt /*aDriveNumber*/,TInt64& aSize,TInt64& aFree) +// +// Return the size and free space on a drive. +// + { + DP(_L("** (SVPHOSTMNT) GetMediaSize")); + + aSize = HOST_SVP_DRIVE_SIZE; + aFree = HOST_SVP_DRIVE_FREE_SIZE; + return(KErrNone); + } + +LOCAL_C TInt GetVolume(TInt /*aDriveNumber*/,TDes& aName,TUint& aUniqueID) +// +// Return the volume name and uniqueID. +// + { + DP(_L("** (SVPHOSTMNT) GetVolume")); + + aUniqueID=1234; + aName=(_L("SVPHOSTDRV")); + return(KErrNone); + } + +void CanonicalizePathname(const TDesC& aName, TInt aDrive, TDes& n, THostFileName& aHostName) + { + DP(_L("** (SVPHOSTMNT) CanonicalizePathname (%S)"), &aName); + n += TDriveUnit(aDrive).Name(); + n += aName; + TParse parse; + parse.Set(n,NULL,NULL); + n=parse.FullName(); + aHostName.Copy(n); + DP(_L("-> (%S)"), &aHostName); + } + +void CanonicalizePathname(const TDesC& aName, TInt aDrive, THostFileName& aHostName) + { + TUint16 buf[KMaxPath]; + TPtr n(buf, KMaxPath); + CanonicalizePathname(aName, aDrive, n, aHostName); + } + + + +////////////////////////////////////////////////////////////////////////// +// CSVPHostMountCB // +////////////////////////////////////////////////////////////////////////// + + +CSVPHostMountCB::CSVPHostMountCB() + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::CSVPHostMountCB()")); + + __DECLARE_NAME(_S("CSVPHostMountCB")); + } + +CSVPHostMountCB::~CSVPHostMountCB() + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::~CSVPHostMountCB()")); + iDevice.Close(); + } + +void CSVPHostMountCB::MountL(TBool /*aForceMount*/) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::MountL()")); + + TInt err = iDevice.Open(); + User::LeaveIfError(err); + + TFileName driveName; + TInt d=Drive().DriveNumber(); + iSize=HOST_SVP_DRIVE_SIZE; + User::LeaveIfError(GetVolume(d,driveName,iUniqueID)); + HBufC* pN=driveName.AllocL(); + DP(_L("** (SVPHOSTMNT) ->SetVolumeName()")); + SetVolumeName(pN); + DP(_L("** (SVPHOSTMNT) <-SetVolumeName()")); + + } + +TInt CSVPHostMountCB::ReMount() + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::ReMount()")); + + TFileName n; + TInt d=Drive().DriveNumber(); + TUint uniqueID; + TInt r=GetVolume(d,n,uniqueID); + if (r!=KErrNone) + return(r); + if (n==VolumeName() && uniqueID==iUniqueID) + return(KErrNone); + return(KErrGeneral); + } + +void CSVPHostMountCB::Dismounted() + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::Dismounted()")); + } + +void CSVPHostMountCB::VolumeL(TVolumeInfo& aVolume) const + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::VolumeL()")); + TInt64 s,f(0); + TFileName n; + TInt d=Drive().DriveNumber(); + User::LeaveIfError(GetMediaSize(d,s,f)); + aVolume.iFree=f; + } + +void CSVPHostMountCB::SetVolumeL(TDes& /*aName*/) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::SetVolumeL()")); + User::Leave(KErrNotSupported); + } + +void CSVPHostMountCB::IsFileInRom(const TDesC& /*aName*/,TUint8*& /*aFileStart*/) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::IsFileInRom()")); + } + +void CSVPHostMountCB::MkDirL(const TDesC& aName) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::MkDirL()")); + TBuf name; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(aName, driveNumber, name); + TSVPHostFsMkDirInfo info(driveNumber, name, 0777); + User::LeaveIfError(SVP_HOST_FS_DEVICE().MkDir(info)); + } + +void CSVPHostMountCB::RmDirL(const TDesC& aName) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RmDirL()")); + TBuf name; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(aName, driveNumber, name); + TSVPHostFsRmDirInfo info(driveNumber, name); + User::LeaveIfError(SVP_HOST_FS_DEVICE().RmDir(info)); + } + +void CSVPHostMountCB::DeleteL(const TDesC& aName) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::DeleteL()")); + TBuf name; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(aName, driveNumber, name); + TSVPHostFsDeleteInfo info(driveNumber, name); + User::LeaveIfError(SVP_HOST_FS_DEVICE().Delete(info)); + } + +void CSVPHostMountCB::RenameL(const TDesC& anOldName,const TDesC& aNewName) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RenameL()")); + // TODO: do we allow renaming across drives? + TBuf oldName, newName; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(anOldName, driveNumber, oldName); + CanonicalizePathname(aNewName, driveNumber, newName); + TSVPHostFsRenameInfo info(driveNumber, oldName, newName); + User::LeaveIfError(SVP_HOST_FS_DEVICE().Rename(info)); + } + +void CSVPHostMountCB::ReplaceL(const TDesC& anOldName,const TDesC& aNewName) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::ReplaceL()")); + + if(FileNamesIdentical(anOldName,aNewName)) + { + return; + } + TBuf oldName, newName; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(anOldName, driveNumber, oldName); + CanonicalizePathname(aNewName, driveNumber, newName); + TSVPHostFsReplaceInfo info(driveNumber, oldName, newName); + User::LeaveIfError(SVP_HOST_FS_DEVICE().Replace(info)); + } + +void CSVPHostMountCB::ReadUidL(const TDesC& aName,TEntry& anEntry) const + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::ReadUidL()")); + TBuf name; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(aName, driveNumber, name); + TSVPHostFsFileOpenInfo fileOpenInfo(driveNumber, name,EFileRead,EFileOpen); + TInt err = SVP_HOST_FS_DEVICE().FileOpen(fileOpenInfo); + + User::LeaveIfError(err); + + TBuf8 uidBuf; + uidBuf.SetLength(sizeof(TCheckedUid)); + + TSVPHostFsFileReadInfo fileReadInfo(driveNumber, fileOpenInfo.iHandle,sizeof(TCheckedUid),0,(char*)uidBuf.Ptr()); + + if (KErrNone != SVP_HOST_FS_DEVICE().FileRead(fileReadInfo)) + User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle)); + + DP(_L("** (SVPHOSTMNT) CSVPHostFileCB::ReadUidL sizeof(TCheckedUid) %d fileOpenInfo.iLength %d "), sizeof(TCheckedUid), fileReadInfo.iLength); + + if (fileReadInfo.iLength!=sizeof(TCheckedUid)) + User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle)); + + TCheckedUid uid(uidBuf); + anEntry.iType=uid.UidType(); + + User::LeaveIfError(SVP_HOST_FS_DEVICE().FileClose(driveNumber, fileOpenInfo.iHandle)); + } + +void CSVPHostMountCB::EntryL(const TDesC& aName,TEntry& anEntry) const + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::EntryL(%S)"), &aName); + TBuf name; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(aName, driveNumber, name); + TSVPHostFsEntryInfo info(driveNumber, name); + User::LeaveIfError(SVP_HOST_FS_DEVICE().Entry(info)); + anEntry.iAtt=info.iAtt&KEntryAttMaskSupported; + anEntry.iSize=info.iSize; + fileTimeToTime(info.iModified,anEntry.iModified, info.iTimeType); + + } + +void timeToFileTime(TUint32& t,const TTime& aTime, TFileTimeType aType); + +void CSVPHostMountCB::SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::SetEntryL()")); + + //User::Leave(KErrNotSupported); + } + +void CSVPHostMountCB::FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::FileOpenL(%S)"), &aName); + CSVPHostFileCB& file=(*((CSVPHostFileCB*)aFile)); + + TBuf name; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(aName, driveNumber, name); + TSVPHostFsFileOpenInfo info(driveNumber, name,aMode,anOpen); + TInt err = SVP_HOST_FS_DEVICE().FileOpen(info); + + User::LeaveIfError(err); + + file.SetHandle(info.iHandle); + file.SetSize(info.iSize); + file.SetAtt(info.iAtt&KEntryAttMaskSupported); + TTime tempTime=file.Modified(); + fileTimeToTime(info.iModified, tempTime, info.iTimeType); + file.SetModified(tempTime); + } + +void CSVPHostMountCB::DirOpenL(const TDesC& aName ,CDirCB* aDir) + { + DP(_L("CFatMountCB::DirOpenL, drv:%d, %S"), DriveNumber(), &aName); + CSVPHostDirCB& dir=(*((CSVPHostDirCB*)aDir)); + + TBuf name; + TUint driveNumber = Drive().DriveNumber(); + CanonicalizePathname(aName, driveNumber, name); + TSVPHostFsDirOpenInfo info(driveNumber, name); + TInt err = SVP_HOST_FS_DEVICE().DirOpen(info); + + User::LeaveIfError(err); + + dir.SetHandle(info.iHandle); + TFileName n(TDriveUnit(Drive().DriveNumber()).Name()); + n.Append(aName); + dir.SetFullName(n); + } + +void CSVPHostMountCB::RawReadL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aTrg*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) const + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RawReadL()")); + User::Leave(KErrNotSupported); + } + +void CSVPHostMountCB::RawWriteL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aSrc*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RawWriteL()")); + User::Leave(KErrNotSupported); + } + +void CSVPHostMountCB::GetShortNameL(const TDesC& aLongName,TDes& aShortName) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::GetShortNameL(%S)"), &aLongName); + aShortName = aLongName; + } + +void CSVPHostMountCB::GetLongNameL(const TDesC& aShortName,TDes& aLongName) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::GetLongNameL(%S)"), &aShortName); + aLongName = aShortName; + } + +void CSVPHostMountCB::ReadSectionL(const TDesC& /*aName*/,TInt /*aPos*/,TAny* /*aTrg*/,TInt /*aLength*/,const RMessagePtr2& /*aMessage*/) + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::RawSectionL()")); + User::Leave(KErrNotSupported); + } + +TBool CSVPHostMountCB::IsRomDrive() const + { + DP(_L("** (SVPHOSTMNT) CSVPHostMountCB::IsRomDrive()")); + return(EFalse); + } diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/inc/rsvphostfsdriver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/inc/rsvphostfsdriver.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,468 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __RSVPHOSTFSDRIVER_H__ +#define __RSVPHOSTFSDRIVER_H__ + +#include + +typedef TDes16 THostFileName; + +typedef enum + { + EUnknown=0, + EWindows, + EUnix, + EMac, + } TFileTimeType; + +class TSVPHostFsMkDirInfo + { +public: + inline TSVPHostFsMkDirInfo() : + iDrive(0), + iName(0), + iLength(0), + iFlags(0) + {}; + inline TSVPHostFsMkDirInfo(TUint aDrive, const THostFileName & aName, TUint32 aFlags) : + iDrive(aDrive), + iName(aName.Ptr()), + iLength(aName.Length()), + iFlags(aFlags) + {}; +public: + TUint iDrive; + const TUint16 * iName; + TUint32 iLength; + TUint32 iFlags; + }; + +class TSVPHostFsRmDirInfo + { +public: + inline TSVPHostFsRmDirInfo() : + iDrive(0), + iName(0), + iLength(0) + {}; + inline TSVPHostFsRmDirInfo(TUint aDrive, const THostFileName & aName) : + iDrive(aDrive), + iName(aName.Ptr()), + iLength(aName.Length()) + {}; +public: + TUint iDrive; + const TUint16 * iName; + TUint32 iLength; + }; + +class TSVPHostFsDeleteInfo + { +public: + inline TSVPHostFsDeleteInfo() : + iDrive(0), + iName(0), + iLength(0) + {}; + inline TSVPHostFsDeleteInfo(TUint aDrive, const THostFileName & aName) : + iDrive(aDrive), + iName(aName.Ptr()), + iLength(aName.Length()) + {}; +public: + TUint iDrive; + const TUint16 * iName; + TUint32 iLength; + }; + +class TSVPHostFsRenameInfo + { +public: + inline TSVPHostFsRenameInfo() : + iDrive(0), + iOldName(0), + iOldLength(0), + iNewName(0), + iNewLength(0) + {}; + inline TSVPHostFsRenameInfo(TUint aDrive, const THostFileName & aOldName, const THostFileName & aNewName) : + iDrive(aDrive), + iOldName(aOldName.Ptr()), + iOldLength(aOldName.Length()), + iNewName(aNewName.Ptr()), + iNewLength(aNewName.Length()) + {}; +public: + TUint iDrive; + const TUint16 * iOldName; + TUint32 iOldLength; + const TUint16 * iNewName; + TUint32 iNewLength; + }; + +class TSVPHostFsReplaceInfo + { +public: + inline TSVPHostFsReplaceInfo() : + iDrive(0), + iOldName(0), + iOldLength(0), + iNewName(0), + iNewLength(0) + {}; + inline TSVPHostFsReplaceInfo(TUint aDrive, const THostFileName & aOldName, const THostFileName & aNewName) : + iDrive(aDrive), + iOldName(aOldName.Ptr()), + iOldLength(aOldName.Length()), + iNewName(aNewName.Ptr()), + iNewLength(aNewName.Length()) + {}; +public: + TUint iDrive; + const TUint16 * iOldName; + TUint32 iOldLength; + const TUint16 * iNewName; + TUint32 iNewLength; + }; + +class TSVPHostFsEntryInfo + { +public: + inline TSVPHostFsEntryInfo() : + iDrive(0), + iName(0), + iLength(0), + iAtt(0), + iModified(0), + iSize(0), + iTimeType(EUnknown) + {}; + inline TSVPHostFsEntryInfo(TUint aDrive, const THostFileName & aName) : + iDrive(aDrive), + iName(aName.Ptr()), + iLength(aName.Length()), + iAtt(0), + iModified(0), + iSize(0), + iTimeType(EUnknown) + {}; +public: + TUint iDrive; + const TUint16 * iName; + TUint32 iLength; + TUint iAtt; + TUint32 iModified; // time in seconds since the epoc + TInt iSize; + TFileTimeType iTimeType; + char iHostName[KMaxFileName]; +}; + +class TSVPHostFsSetEntryInfo + { +public: + inline TSVPHostFsSetEntryInfo() : + iDrive(0), + iName(0), + iModified(0), + iNewAtt(0), + iTimeType(EUnknown) + {}; + inline TSVPHostFsSetEntryInfo(TUint aDrive, const THostFileName & aName, TUint32 aModified, TUint aNewAtt) : + iDrive(aDrive), + iName(aName.Ptr()), + iModified(aModified), + iNewAtt(aNewAtt), + iTimeType(EUnknown) + {}; +public: + TUint iDrive; + const TUint16 *iName; + TUint32 iModified; // time in seconds since the epoc + TUint iNewAtt; + TFileTimeType iTimeType; + }; + +class TSVPHostFsDirOpenInfo + { +public: + inline TSVPHostFsDirOpenInfo() : + iDrive(0), + iName(0), + iLength(0), + iHandle(0) + {}; +inline TSVPHostFsDirOpenInfo(TUint aDrive, const THostFileName & aName) : + iDrive(aDrive), + iName(aName.Ptr()), + iLength(aName.Length()), + iHandle(0) + {}; +public: + TUint iDrive; + const TUint16 * iName; + TUint32 iLength; + TUint32 iHandle; + }; + +#define SVP_HOST_FS_INVALID_FILE_HANDLE -1 +class TSVPHostFsFileOpenInfo + { +public: + inline TSVPHostFsFileOpenInfo() : + iDrive(0), + iName(0), + iLength(0), // of file name + iMode(0), + iOpen(0), + iAtt(0), + iModified(0), // time in seconds since the epoc + iSize(0), // of file + iTimeType(EUnknown), + iHandle(SVP_HOST_FS_INVALID_FILE_HANDLE) + {}; + inline TSVPHostFsFileOpenInfo(TUint aDrive, const THostFileName & aName, TUint32 aMode, TUint32 anOpen) : + iDrive(aDrive), + iName(aName.Ptr()), + iLength(aName.Length()), + iMode(aMode), + iOpen(anOpen), + iAtt(0), + iModified(0), // time in seconds since the epoc + iSize(0), // of file + iTimeType(EUnknown), + iHandle(SVP_HOST_FS_INVALID_FILE_HANDLE) + {}; +public: + TUint iDrive; + const TUint16 * iName; + TUint32 iLength; + TUint32 iMode; + TUint32 iOpen; + TUint iAtt; + TUint32 iModified; // time in seconds since the epoc + TInt iSize; + TFileTimeType iTimeType; + TInt iHandle; + }; + +class TSVPHostFsFileReadInfo + { +public: + inline TSVPHostFsFileReadInfo() : + iDrive(0), + iHandle(0), + iLength(0), + iPos(0), + iBuf(0) + {}; + inline TSVPHostFsFileReadInfo(TUint aDrive, TUint aHandle,TInt aLength,TInt aPos, char * aBuf): + iDrive(aDrive), + iHandle(aHandle), + iLength(aLength), + iPos(aPos), + iBuf(aBuf) + {}; +public: + TUint iDrive; + TUint iHandle; + TInt iLength; + TInt iPos; + char * iBuf; + }; + +class TSVPHostFsFileWriteInfo + { +public: + inline TSVPHostFsFileWriteInfo() : + iDrive(0), + iHandle(0), + iLength(0), + iPos(0), + iBuf(0) + {}; + inline TSVPHostFsFileWriteInfo(TUint aDrive, TUint aHandle,TInt aLength,TInt aPos, char * aBuf): + iDrive(aDrive), + iHandle(aHandle), + iLength(aLength), + iPos(aPos), + iBuf(aBuf) + {}; +public: + TUint iDrive; + TUint iHandle; + TInt iLength; + TInt iPos; + char * iBuf; + }; + +class TSVPHostFsFileSetSizeInfo + { +public: + inline TSVPHostFsFileSetSizeInfo() : + iDrive(0), + iHandle(0), + iLength(0) + {}; + inline TSVPHostFsFileSetSizeInfo(TUint aDrive, TUint aHandle, TInt aLength) : + iDrive(aDrive), + iHandle(aHandle), + iLength(aLength) + {}; +public: + TUint iDrive; + TUint iHandle; + TInt iLength; + }; + +class TSVPHostFsDirReadInfo +{ +public: + inline TSVPHostFsDirReadInfo() : + iDrive(0), + iHandle(0), + iLength(0), + iAtt(0), + iModified(0), + iSize(0), + iTimeType(EUnknown) + {}; + inline TSVPHostFsDirReadInfo(TUint aDrive, TUint32 aHandle) : + iDrive(aDrive), + iHandle(aHandle), + iLength(-1), + iAtt(0), + iModified(666), + iSize(-1), + iTimeType(EUnknown) + {}; +public: + TUint iDrive; + TUint32 iHandle; + TInt iLength; + TUint16 iName[KMaxPath]; + TUint iAtt; + TUint32 iModified; // time in seconds since the epoc + TInt iSize; + TFileTimeType iTimeType; + }; + +class TCapsSVPHostFsDriver + { +public: + TVersion iVersion; + }; + +_LIT(KSVPHostFsDriverName,"SVP Host Filesystem Driver"); +_LIT(KSVPHostFsDriverLDD, "svphostfsdriver.ldd"); + +// Version information +const TInt KMajorVersionNumber=0; +const TInt KMinorVersionNumber=0; +const TInt KBuildVersionNumber=1; + +// keep in sync with the definitions in QEMU/hw/svphostfs.c +#define LOWEST_DRIVE 'A' +#define HIGHEST_DRIVE 'Z' +#define DRIVE_MAP_SIZE (HIGHEST_DRIVE - LOWEST_DRIVE + 1) + +class RSVPHostFsDriver : public RBusLogicalChannel + { +public: + + enum TControl + { + EDummu = 0, + + // Codes for CMountCB operations + EMkDir, + ERmDir, + EDelete, + ERename, + EReplace, + EReadUid, + EEntry, + ESetEntry, + EFileOpen, + EDirOpen, + + // Code for CFileCB operations + EFileClose, + EFileRead, + EFileWrite, + EFileSetSize, + EFileFlushAll, + + // Code for CDirCB operations + EDirClose, + EDirRead, + + // Device ops + EGetDeviceID, + EGetDriveMap, + + }; + + +public: +#ifndef __KERNEL_MODE__ // don't need to see these in the driver + TInt Open(); + TInt MkDir(TSVPHostFsMkDirInfo& aInfo); + TInt RmDir(TSVPHostFsRmDirInfo& aInfo); + TInt Delete(TSVPHostFsDeleteInfo& aInfo); + TInt Rename(TSVPHostFsRenameInfo& aInfo); + TInt Replace(TSVPHostFsReplaceInfo& aInfo); + TInt ReadUid(const TDesC& aName,TEntry& anEntry); + TInt Entry(TSVPHostFsEntryInfo& aInfo); + TInt SetEntry(TSVPHostFsSetEntryInfo &aInfo); + TInt FileOpen(TSVPHostFsFileOpenInfo &aInfo); + TInt DirOpen(TSVPHostFsDirOpenInfo& aInfo); + TInt FileClose(TUint32 aDrive, TUint32 aHandle); + TInt FileRead(TSVPHostFsFileReadInfo& aInfo); + TInt FileWrite(TSVPHostFsFileWriteInfo& aInfo); + TInt FileSetSize(TSVPHostFsFileSetSizeInfo &aInfo); + TInt FileSetEntry(TSVPHostFsSetEntryInfo &aInfo); + TInt FlushData(TUint32 aDrive); + TInt FlushAll(TUint32 aDrive); + + TInt DirClose(TUint32 aDrive, TUint32 aHandle); + TInt DirRead(TSVPHostFsDirReadInfo& aInfo); + + TUint32 GetDeviceID(TUint32 aDrive); + + TInt GetDriveMap(TUint32 * aMap); + +private: + inline TInt DoSVPRequest(TInt aReqNo, TAny * a1) + { + TRequestStatus status; + DoRequest(aReqNo, status, a1); + User::WaitForRequest(status); + return status.Int(); + } + + inline TInt DoSVPRequest(TInt aReqNo, TAny * a1, TAny * a2) + { + TRequestStatus status; + DoRequest(aReqNo, status, a1, a2); + User::WaitForRequest(status); + return status.Int(); + } +#endif + }; + +#endif // __rsvphostfsdriver_H__ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/svphostfs.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/svphostfs.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +TARGET svphostfs.exe +TARGETTYPE EXE +SOURCEPATH fs +SOURCE svphostmain.cpp rsvphostfsdriver.cpp +LIBRARY euser.lib efsrv.lib efile.lib hal.lib +SYSTEMINCLUDE inc +SYSTEMINCLUDE /epoc32/include + +CAPABILITY DISKADMIN ALLFILES +VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/svphostfsdriver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/svphostfsdriver.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +//macro __KERNEL_MODE__ + +#include +#include + +systeminclude AsspNKernIncludePath +systeminclude inc +systeminclude ..\svpplatform\libfdt +systeminclude \epoc32\include\stdapis + +target VariantTarget(svphostfsdriver,ldd) +linkas svphostfsdriver.ldd +targettype ldd + + +sourcepath driver +source svphostfsdriver.cpp stringops.c + +option armcc --gnu + +staticlibrary libfdt.lib +noexportlibrary + +vendorid 0x70000001 +capability all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/svphostfsstart.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/svphostfsstart.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +TARGET svphostfsstart.exe +TARGETTYPE EXE +SOURCEPATH fs +SOURCE svphostfsstart.cpp +LIBRARY euser.lib efsrv.lib efile.lib hal.lib +SYSTEMINCLUDE inc +SYSTEMINCLUDE /epoc32/include + +CAPABILITY DISKADMIN ALLFILES +VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svphostfs/svphostfsy.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svphostfs/svphostfsy.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +TARGET svphostfsy.fsy +TARGETTYPE fsy + +SOURCEPATH fs +SOURCE svphostfsy.cpp svphostmnt.cpp svphostfil.cpp svphostdir.cpp rsvphostfsdriver.cpp +NOSTRICTDEF + +SYSTEMINCLUDE inc +SYSTEMINCLUDE /epoc32/include + +LIBRARY efsrv.lib euser.lib hal.lib +LIBRARY efile.lib + +UID 0x100039df 0x10000CEE +VENDORID 0x70000001 + +unpaged + +TARGETPATH /sys/bin + +//CAPABILITY TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD +#include "../../f32/group/f32caps.mmh" // Capabilities of File Server process +#include "../../f32/group/f32.mmh" // Generic definitions for the whole f32 component diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/fdt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/fdt.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +target libfdt.lib +targettype klib + +systeminclude libfdt +systeminclude \epoc32\include\stdapis + +sourcepath libfdt + +source fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c + +option armcc --gnu +option_replace armcc --diag_suppress 161,611,654,997,1152,1300,1464,1488,6318,6331,1254,1293,68 +capability all + +VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/Makefile.libfdt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/Makefile.libfdt Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,14 @@ +# Makefile.libfdt +# +# This is not a complete Makefile of itself. Instead, it is designed to +# be easily embeddable into other systems of Makefiles. +# +LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c +LIBFDT_INCLUDES = fdt.h libfdt.h +LIBFDT_EXTRA = libfdt_internal.h +LIBFDT_LIB = libfdt/libfdt.a + +LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) + +$(LIBFDT_objdir)/$(LIBFDT_LIB): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS)) + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/TODO --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/TODO Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,3 @@ +- Tree traversal functions +- Graft function +- Complete libfdt.h documenting comments diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/bswap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/bswap.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,217 @@ +#ifndef BSWAP_H +#define BSWAP_H + +#include "config-host.h" + +#include + +#ifdef HAVE_MACHINE_BSWAP_H +#include +#include +#include +#else + +#ifdef HAVE_BYTESWAP_H +#include +#else + +#define bswap_16(x) \ +({ \ + uint16_t __x = (x); \ + ((uint16_t)( \ + (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \ + (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \ +}) + +#define bswap_32(x) \ +({ \ + uint32_t __x = (x); \ + ((uint32_t)( \ + (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ +}) + +#define bswap_64(x) \ +({ \ + uint64_t __x = (x); \ + ((uint64_t)( \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ +}) + +#endif /* !HAVE_BYTESWAP_H */ + +static inline uint16_t bswap16(uint16_t x) +{ + return bswap_16(x); +} + +static inline uint32_t bswap32(uint32_t x) +{ + return bswap_32(x); +} + +static inline uint64_t bswap64(uint64_t x) +{ + return bswap_64(x); +} + +#endif /* ! HAVE_MACHINE_BSWAP_H */ + +static inline void bswap16s(uint16_t *s) +{ + *s = bswap16(*s); +} + +static inline void bswap32s(uint32_t *s) +{ + *s = bswap32(*s); +} + +static inline void bswap64s(uint64_t *s) +{ + *s = bswap64(*s); +} + +#if defined(WORDS_BIGENDIAN) +#define be_bswap(v, size) (v) +#define le_bswap(v, size) bswap ## size(v) +#define be_bswaps(v, size) +#define le_bswaps(p, size) *p = bswap ## size(*p); +#else +#define le_bswap(v, size) (v) +#define be_bswap(v, size) bswap ## size(v) +#define le_bswaps(v, size) +#define be_bswaps(p, size) *p = bswap ## size(*p); +#endif + +#define CPU_CONVERT(endian, size, type)\ +static inline type endian ## size ## _to_cpu(type v)\ +{\ + return endian ## _bswap(v, size);\ +}\ +\ +static inline type cpu_to_ ## endian ## size(type v)\ +{\ + return endian ## _bswap(v, size);\ +}\ +\ +static inline void endian ## size ## _to_cpus(type *p)\ +{\ + endian ## _bswaps(p, size)\ +}\ +\ +static inline void cpu_to_ ## endian ## size ## s(type *p)\ +{\ + endian ## _bswaps(p, size)\ +}\ +\ +static inline type endian ## size ## _to_cpup(const type *p)\ +{\ + return endian ## size ## _to_cpu(*p);\ +}\ +\ +static inline void cpu_to_ ## endian ## size ## w(type *p, type v)\ +{\ + *p = cpu_to_ ## endian ## size(v);\ +} + +CPU_CONVERT(be, 16, uint16_t) +CPU_CONVERT(be, 32, uint32_t) +CPU_CONVERT(be, 64, uint64_t) + +CPU_CONVERT(le, 16, uint16_t) +CPU_CONVERT(le, 32, uint32_t) +CPU_CONVERT(le, 64, uint64_t) + +/* unaligned versions (optimized for frequent unaligned accesses)*/ + +#if defined(__i386__) || defined(__powerpc__) + +#define cpu_to_le16wu(p, v) cpu_to_le16w(p, v) +#define cpu_to_le32wu(p, v) cpu_to_le32w(p, v) +#define le16_to_cpupu(p) le16_to_cpup(p) +#define le32_to_cpupu(p) le32_to_cpup(p) +#define be32_to_cpupu(p) be32_to_cpup(p) + +#define cpu_to_be16wu(p, v) cpu_to_be16w(p, v) +#define cpu_to_be32wu(p, v) cpu_to_be32w(p, v) + +#else + +static inline void cpu_to_le16wu(uint16_t *p, uint16_t v) +{ + uint8_t *p1 = (uint8_t *)p; + + p1[0] = v; + p1[1] = v >> 8; +} + +static inline void cpu_to_le32wu(uint32_t *p, uint32_t v) +{ + uint8_t *p1 = (uint8_t *)p; + + p1[0] = v; + p1[1] = v >> 8; + p1[2] = v >> 16; + p1[3] = v >> 24; +} + +static inline uint16_t le16_to_cpupu(const uint16_t *p) +{ + const uint8_t *p1 = (const uint8_t *)p; + return p1[0] | (p1[1] << 8); +} + +static inline uint32_t le32_to_cpupu(const uint32_t *p) +{ + const uint8_t *p1 = (const uint8_t *)p; + return p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24); +} + +static inline uint32_t be32_to_cpupu(const uint32_t *p) +{ + const uint8_t *p1 = (const uint8_t *)p; + return p1[3] | (p1[2] << 8) | (p1[1] << 16) | (p1[0] << 24); +} + +static inline void cpu_to_be16wu(uint16_t *p, uint16_t v) +{ + uint8_t *p1 = (uint8_t *)p; + + p1[0] = v >> 8; + p1[1] = v; +} + +static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) +{ + uint8_t *p1 = (uint8_t *)p; + + p1[0] = v >> 24; + p1[1] = v >> 16; + p1[2] = v >> 8; + p1[3] = v; +} + +#endif + +#ifdef WORDS_BIGENDIAN +#define cpu_to_32wu cpu_to_be32wu +#else +#define cpu_to_32wu cpu_to_le32wu +#endif + +#undef le_bswap +#undef be_bswap +#undef le_bswaps +#undef be_bswaps + +#endif /* BSWAP_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/config-host.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/config-host.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,10 @@ +#ifndef CONFIG_HOST_H +#define CONFIG_HOST_H + +// dont have machine level bswap +//#define HAVE_MACHINE_BSWAP_H + +// dont have byteswap +//#define HAVE_BYTESWAP_H + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt.c Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,156 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +int fdt_check_header(const void *fdt) +{ + if (fdt_magic(fdt) == FDT_MAGIC) { + /* Complete tree */ + if (fdt_version(fdt) < FDT_FIRST_SUPPORTED_VERSION) + return -FDT_ERR_BADVERSION; + if (fdt_last_comp_version(fdt) > FDT_LAST_SUPPORTED_VERSION) + return -FDT_ERR_BADVERSION; + } else if (fdt_magic(fdt) == SW_MAGIC) { + /* Unfinished sequential-write blob */ + if (fdt_size_dt_struct(fdt) == 0) + return -FDT_ERR_BADSTATE; + } else { + return -FDT_ERR_BADMAGIC; + } + + return 0; +} + +const void *fdt_offset_ptr(const void *fdt, int offset, int len) +{ + const void *p; + + if (fdt_version(fdt) >= 0x11) + if (((offset + len) < offset) + || ((offset + len) > fdt_size_dt_struct(fdt))) + return NULL; + + p = _fdt_offset_ptr(fdt, offset); + + if (p + len < p) + return NULL; + return p; +} + +uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset) +{ + const uint32_t *tagp, *lenp; + uint32_t tag; + const char *p; + + if (offset % FDT_TAGSIZE) + return -1; + + tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE); + if (! tagp) + return FDT_END; /* premature end */ + tag = fdt32_to_cpu(*tagp); + offset += FDT_TAGSIZE; + + switch (tag) { + case FDT_BEGIN_NODE: + /* skip name */ + do { + p = fdt_offset_ptr(fdt, offset++, 1); + } while (p && (*p != '\0')); + if (! p) + return FDT_END; + break; + case FDT_PROP: + lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp)); + if (! lenp) + return FDT_END; + /* skip name offset, length and value */ + offset += 2*FDT_TAGSIZE + fdt32_to_cpu(*lenp); + break; + } + + if (nextoffset) + *nextoffset = ALIGN(offset, FDT_TAGSIZE); + + return tag; +} + +const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) +{ + int len = strlen(s) + 1; + const char *last = strtab + tabsize - len; + const char *p; + + for (p = strtab; p <= last; p++) + if (memeq(p, s, len)) + return p; + return NULL; +} + +int fdt_move(const void *fdt, void *buf, int bufsize) +{ + int err = fdt_check_header(fdt); + + if (err) + return err; + + if (fdt_totalsize(fdt) > bufsize) + return -FDT_ERR_NOSPACE; + + memmove(buf, fdt, fdt_totalsize(fdt)); + return 0; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,6 @@ + +extern "C" { + +#include "fdt.c" + +}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,60 @@ +#ifndef _FDT_H +#define _FDT_H + +#ifndef __ASSEMBLY__ + +struct fdt_header { + uint32_t magic; /* magic word FDT_MAGIC */ + uint32_t totalsize; /* total size of DT block */ + uint32_t off_dt_struct; /* offset to structure */ + uint32_t off_dt_strings; /* offset to strings */ + uint32_t off_mem_rsvmap; /* offset to memory reserve map */ + uint32_t version; /* format version */ + uint32_t last_comp_version; /* last compatible version */ + + /* version 2 fields below */ + uint32_t boot_cpuid_phys; /* Which physical CPU id we're + booting on */ + /* version 3 fields below */ + uint32_t size_dt_strings; /* size of the strings block */ + + /* version 17 fields below */ + uint32_t size_dt_struct; /* size of the structure block */ +}; + +struct fdt_reserve_entry { + uint64_t address; + uint64_t size; +}; + +struct fdt_node_header { + uint32_t tag; + char name[0]; +}; + +struct fdt_property { + uint32_t tag; + uint32_t len; + uint32_t nameoff; + char data[0]; +}; + +#endif /* !__ASSEMBLY */ + +#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ +#define FDT_TAGSIZE sizeof(uint32_t) + +#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ +#define FDT_END_NODE 0x2 /* End node */ +#define FDT_PROP 0x3 /* Property: name off, + size, content */ +#define FDT_NOP 0x4 /* nop */ +#define FDT_END 0x9 + +#define FDT_V1_SIZE (7*sizeof(uint32_t)) +#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t)) +#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t)) +#define FDT_V16_SIZE FDT_V3_SIZE +#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t)) + +#endif /* _FDT_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_ro.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_ro.c Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,583 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +#define CHECK_HEADER(fdt) \ + { \ + int err; \ + if ((err = fdt_check_header(fdt)) != 0) \ + return err; \ + } + +static int nodename_eq(const void *fdt, int offset, + const char *s, int len) +{ + const char *p = fdt_offset_ptr(fdt, offset, len+1); + + if (! p) + /* short match */ + return 0; + + if (memcmp(p, s, len) != 0) + return 0; + + if (p[len] == '\0') + return 1; + else if (!memchr(s, '@', len) && (p[len] == '@')) + return 1; + else + return 0; +} + +const char *fdt_string(const void *fdt, int stroffset) +{ + return (char *)fdt + fdt_off_dt_strings(fdt) + stroffset; +} + +int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) +{ + CHECK_HEADER(fdt); + *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address); + *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size); + return 0; +} + +int fdt_num_mem_rsv(const void *fdt) +{ + int i = 0; + + while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0) + i++; + return i; +} + +int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, + const char *name, int namelen) +{ + int level = 0; + uint32_t tag; + int offset, nextoffset; + + CHECK_HEADER(fdt); + + tag = fdt_next_tag(fdt, parentoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADOFFSET; + + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + + switch (tag) { + case FDT_END: + return -FDT_ERR_TRUNCATED; + + case FDT_BEGIN_NODE: + level++; + if (level != 1) + continue; + if (nodename_eq(fdt, offset+FDT_TAGSIZE, name, namelen)) + /* Found it! */ + return offset; + break; + + case FDT_END_NODE: + level--; + break; + + case FDT_PROP: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (level >= 0); + + return -FDT_ERR_NOTFOUND; +} + +int fdt_subnode_offset(const void *fdt, int parentoffset, + const char *name) +{ + return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name)); +} + +int fdt_path_offset(const void *fdt, const char *path) +{ + const char *end = path + strlen(path); + const char *p = path; + int offset = 0; + + CHECK_HEADER(fdt); + + if (*path != '/') + return -FDT_ERR_BADPATH; + + while (*p) { + const char *q; + + while (*p == '/') + p++; + if (! *p) + return offset; + q = strchr(p, '/'); + if (! q) + q = end; + + offset = fdt_subnode_offset_namelen(fdt, offset, p, q-p); + if (offset < 0) + return offset; + + p = q; + } + + return offset; +} + +const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) +{ + const struct fdt_node_header *nh; + int err; + + if ((err = fdt_check_header(fdt)) != 0) + goto fail; + + err = -FDT_ERR_BADOFFSET; + nh = fdt_offset_ptr(fdt, nodeoffset, sizeof(*nh)); + if (!nh || (fdt32_to_cpu(nh->tag) != FDT_BEGIN_NODE)) + goto fail; + + if (len) + *len = strlen(nh->name); + + return nh->name; + + fail: + if (len) + *len = err; + return NULL; +} + +const struct fdt_property *fdt_get_property(const void *fdt, + int nodeoffset, + const char *name, int *lenp) +{ + uint32_t tag; + const struct fdt_property *prop; + int namestroff; + int offset, nextoffset; + int err; + + if ((err = fdt_check_header(fdt)) != 0) + goto fail; + + err = -FDT_ERR_BADOFFSET; + if (nodeoffset % FDT_TAGSIZE) + goto fail; + + tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + goto fail; + + do { + offset = nextoffset; + + tag = fdt_next_tag(fdt, offset, &nextoffset); + switch (tag) { + case FDT_END: + err = -FDT_ERR_TRUNCATED; + goto fail; + + case FDT_BEGIN_NODE: + case FDT_END_NODE: + case FDT_NOP: + break; + + case FDT_PROP: + err = -FDT_ERR_BADSTRUCTURE; + prop = fdt_offset_ptr(fdt, offset, sizeof(*prop)); + if (! prop) + goto fail; + namestroff = fdt32_to_cpu(prop->nameoff); + if (streq(fdt_string(fdt, namestroff), name)) { + /* Found it! */ + int len = fdt32_to_cpu(prop->len); + prop = fdt_offset_ptr(fdt, offset, + sizeof(*prop)+len); + if (! prop) + goto fail; + + if (lenp) + *lenp = len; + + return prop; + } + break; + + default: + err = -FDT_ERR_BADSTRUCTURE; + goto fail; + } + } while ((tag != FDT_BEGIN_NODE) && (tag != FDT_END_NODE)); + + err = -FDT_ERR_NOTFOUND; + fail: + if (lenp) + *lenp = err; + return NULL; +} + +const void *fdt_getprop(const void *fdt, int nodeoffset, + const char *name, int *lenp) +{ + const struct fdt_property *prop; + + prop = fdt_get_property(fdt, nodeoffset, name, lenp); + if (! prop) + return NULL; + + return prop->data; +} + +uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) +{ + const uint32_t *php; + int len; + + php = fdt_getprop(fdt, nodeoffset, "linux,phandle", &len); + if (!php || (len != sizeof(*php))) + return 0; + + return fdt32_to_cpu(*php); +} + +int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) +{ + uint32_t tag; + int p = 0, overflow = 0; + int offset, nextoffset, namelen; + const char *name; + + CHECK_HEADER(fdt); + + tag = fdt_next_tag(fdt, 0, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADSTRUCTURE; + + if (buflen < 2) + return -FDT_ERR_NOSPACE; + buf[0] = '/'; + p = 1; + + while (nextoffset <= nodeoffset) { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + switch (tag) { + case FDT_END: + return -FDT_ERR_BADOFFSET; + + case FDT_BEGIN_NODE: + name = fdt_get_name(fdt, offset, &namelen); + if (!name) + return namelen; + if (overflow || ((p + namelen + 1) > buflen)) { + overflow++; + break; + } + memcpy(buf + p, name, namelen); + p += namelen; + buf[p++] = '/'; + break; + + case FDT_END_NODE: + if (overflow) { + overflow--; + break; + } + do { + p--; + } while (buf[p-1] != '/'); + break; + + case FDT_PROP: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } + + if (overflow) + return -FDT_ERR_NOSPACE; + + if (p > 1) /* special case so that root path is "/", not "" */ + p--; + buf[p] = '\0'; + return p; +} + +int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, + int supernodedepth, int *nodedepth) +{ + int level = -1; + uint32_t tag; + int offset, nextoffset = 0; + int supernodeoffset = -FDT_ERR_INTERNAL; + + CHECK_HEADER(fdt); + + if (supernodedepth < 0) + return -FDT_ERR_NOTFOUND; + + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + switch (tag) { + case FDT_END: + return -FDT_ERR_BADOFFSET; + + case FDT_BEGIN_NODE: + level++; + if (level == supernodedepth) + supernodeoffset = offset; + break; + + case FDT_END_NODE: + level--; + break; + + case FDT_PROP: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (offset < nodeoffset); + + if (nodedepth) + *nodedepth = level; + + if (supernodedepth > level) + return -FDT_ERR_NOTFOUND; + return supernodeoffset; +} + +int fdt_node_depth(const void *fdt, int nodeoffset) +{ + int nodedepth; + int err; + + err = fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, &nodedepth); + if (err) + return (err < 0) ? err : -FDT_ERR_INTERNAL; + return nodedepth; +} + +int fdt_parent_offset(const void *fdt, int nodeoffset) +{ + int nodedepth = fdt_node_depth(fdt, nodeoffset); + + if (nodedepth < 0) + return nodedepth; + return fdt_supernode_atdepth_offset(fdt, nodeoffset, + nodedepth - 1, NULL); +} + +int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, + const char *propname, + const void *propval, int proplen) +{ + uint32_t tag; + int offset, nextoffset; + const void *val; + int len; + + CHECK_HEADER(fdt); + + if (startoffset >= 0) { + tag = fdt_next_tag(fdt, startoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADOFFSET; + } else { + nextoffset = 0; + } + + /* FIXME: The algorithm here is pretty horrible: we scan each + * property of a node in fdt_getprop(), then if that didn't + * find what we want, we scan over them again making our way + * to the next node. Still it's the easiest to implement + * approach; performance can come later. */ + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + + switch (tag) { + case FDT_BEGIN_NODE: + val = fdt_getprop(fdt, offset, propname, &len); + if (val + && (len == proplen) + && (memcmp(val, propval, len) == 0)) + return offset; + break; + + case FDT_PROP: + case FDT_END: + case FDT_END_NODE: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (tag != FDT_END); + + return -FDT_ERR_NOTFOUND; +} + +int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) +{ + if ((phandle == 0) || (phandle == -1)) + return -FDT_ERR_BADPHANDLE; + phandle = cpu_to_fdt32(phandle); + return fdt_node_offset_by_prop_value(fdt, -1, "linux,phandle", + &phandle, sizeof(phandle)); +} + +int _stringlist_contains(const void *strlist, int listlen, const char *str) +{ + int len = strlen(str); + const void *p; + + while (listlen >= len) { + if (memcmp(str, strlist, len+1) == 0) + return 1; + p = memchr(strlist, '\0', listlen); + if (!p) + return 0; /* malformed strlist.. */ + listlen -= (p-strlist) + 1; + strlist = p + 1; + } + return 0; +} + +int fdt_node_check_compatible(const void *fdt, int nodeoffset, + const char *compatible) +{ + const void *prop; + int len; + + prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); + if (!prop) + return len; + if (_stringlist_contains(prop, len, compatible)) + return 0; + else + return 1; +} + +int fdt_node_offset_by_compatible(const void *fdt, int startoffset, + const char *compatible) +{ + uint32_t tag; + int offset, nextoffset; + int err; + + CHECK_HEADER(fdt); + + if (startoffset >= 0) { + tag = fdt_next_tag(fdt, startoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADOFFSET; + } else { + nextoffset = 0; + } + + /* FIXME: The algorithm here is pretty horrible: we scan each + * property of a node in fdt_node_check_compatible(), then if + * that didn't find what we want, we scan over them again + * making our way to the next node. Still it's the easiest to + * implement approach; performance can come later. */ + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + + switch (tag) { + case FDT_BEGIN_NODE: + err = fdt_node_check_compatible(fdt, offset, + compatible); + if ((err < 0) + && (err != -FDT_ERR_NOTFOUND)) + return err; + else if (err == 0) + return offset; + break; + + case FDT_PROP: + case FDT_END: + case FDT_END_NODE: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (tag != FDT_END); + + return -FDT_ERR_NOTFOUND; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_ro.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_ro.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,5 @@ +extern "C" { + +#include "fdt_ro.c" + +}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_rw.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_rw.c Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,471 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +static int _blocks_misordered(const void *fdt, + int mem_rsv_size, int struct_size) +{ + return (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8)) + || (fdt_off_dt_struct(fdt) < + (fdt_off_mem_rsvmap(fdt) + mem_rsv_size)) + || (fdt_off_dt_strings(fdt) < + (fdt_off_dt_struct(fdt) + struct_size)) + || (fdt_totalsize(fdt) < + (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt))); +} + +static int rw_check_header(void *fdt) +{ + int err; + + if ((err = fdt_check_header(fdt))) + return err; + if (fdt_version(fdt) < 17) + return -FDT_ERR_BADVERSION; + if (_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry), + fdt_size_dt_struct(fdt))) + return -FDT_ERR_BADLAYOUT; + if (fdt_version(fdt) > 17) + fdt_set_version(fdt, 17); + + return 0; +} + +#define RW_CHECK_HEADER(fdt) \ + { \ + int err; \ + if ((err = rw_check_header(fdt)) != 0) \ + return err; \ + } + +static inline int _blob_data_size(void *fdt) +{ + return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); +} + +static int _blob_splice(void *fdt, void *p, int oldlen, int newlen) +{ + void *end = fdt + _blob_data_size(fdt); + + if (((p + oldlen) < p) || ((p + oldlen) > end)) + return -FDT_ERR_BADOFFSET; + if ((end - oldlen + newlen) > (fdt + fdt_totalsize(fdt))) + return -FDT_ERR_NOSPACE; + memmove(p + newlen, p + oldlen, end - p - oldlen); + return 0; +} + +static int _blob_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p, + int oldn, int newn) +{ + int delta = (newn - oldn) * sizeof(*p); + int err; + err = _blob_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p)); + if (err) + return err; + fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta); + fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta); + return 0; +} + +static int _blob_splice_struct(void *fdt, void *p, + int oldlen, int newlen) +{ + int delta = newlen - oldlen; + int err; + + if ((err = _blob_splice(fdt, p, oldlen, newlen))) + return err; + + fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta); + fdt_set_off_dt_strings(fdt, fdt_off_dt_strings(fdt) + delta); + return 0; +} + +static int _blob_splice_string(void *fdt, int newlen) +{ + void *p = fdt + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); + int err; + + if ((err = _blob_splice(fdt, p, 0, newlen))) + return err; + + fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen); + return 0; +} + +static int _find_add_string(void *fdt, const char *s) +{ + char *strtab = (char *)fdt + fdt_off_dt_strings(fdt); + const char *p; + char *new; + int len = strlen(s) + 1; + int err; + + p = _fdt_find_string(strtab, fdt_size_dt_strings(fdt), s); + if (p) + /* found it */ + return (p - strtab); + + new = strtab + fdt_size_dt_strings(fdt); + err = _blob_splice_string(fdt, len); + if (err) + return err; + + memcpy(new, s, len); + return (new - strtab); +} + +int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size) +{ + struct fdt_reserve_entry *re; + int err; + + if ((err = rw_check_header(fdt))) + return err; + + re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt)); + err = _blob_splice_mem_rsv(fdt, re, 0, 1); + if (err) + return err; + + re->address = cpu_to_fdt64(address); + re->size = cpu_to_fdt64(size); + return 0; +} + +int fdt_del_mem_rsv(void *fdt, int n) +{ + struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n); + int err; + + if ((err = rw_check_header(fdt))) + return err; + if (n >= fdt_num_mem_rsv(fdt)) + return -FDT_ERR_NOTFOUND; + + err = _blob_splice_mem_rsv(fdt, re, 1, 0); + if (err) + return err; + return 0; +} + +static int _resize_property(void *fdt, int nodeoffset, const char *name, int len, + struct fdt_property **prop) +{ + int oldlen; + int err; + + *prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen); + if (! (*prop)) + return oldlen; + + if ((err = _blob_splice_struct(fdt, (*prop)->data, + ALIGN(oldlen, FDT_TAGSIZE), + ALIGN(len, FDT_TAGSIZE)))) + return err; + + (*prop)->len = cpu_to_fdt32(len); + return 0; +} + +static int _add_property(void *fdt, int nodeoffset, const char *name, int len, + struct fdt_property **prop) +{ + uint32_t tag; + int proplen; + int nextoffset; + int namestroff; + int err; + + tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADOFFSET; + + namestroff = _find_add_string(fdt, name); + if (namestroff < 0) + return namestroff; + + *prop = _fdt_offset_ptr_w(fdt, nextoffset); + proplen = sizeof(**prop) + ALIGN(len, FDT_TAGSIZE); + + err = _blob_splice_struct(fdt, *prop, 0, proplen); + if (err) + return err; + + (*prop)->tag = cpu_to_fdt32(FDT_PROP); + (*prop)->nameoff = cpu_to_fdt32(namestroff); + (*prop)->len = cpu_to_fdt32(len); + return 0; +} + +int fdt_set_name(void *fdt, int nodeoffset, const char *name) +{ + char *namep; + int oldlen, newlen; + int err; + + if ((err = rw_check_header(fdt))) + return err; + + namep = (char *)fdt_get_name(fdt, nodeoffset, &oldlen); + if (!namep) + return oldlen; + + newlen = strlen(name); + + err = _blob_splice_struct(fdt, namep, ALIGN(oldlen+1, FDT_TAGSIZE), + ALIGN(newlen+1, FDT_TAGSIZE)); + if (err) + return err; + + memcpy(namep, name, newlen+1); + return 0; +} + +int fdt_setprop(void *fdt, int nodeoffset, const char *name, + const void *val, int len) +{ + struct fdt_property *prop; + int err; + + if ((err = rw_check_header(fdt))) + return err; + + err = _resize_property(fdt, nodeoffset, name, len, &prop); + if (err == -FDT_ERR_NOTFOUND) + err = _add_property(fdt, nodeoffset, name, len, &prop); + if (err) + return err; + + memcpy(prop->data, val, len); + return 0; +} + +int fdt_delprop(void *fdt, int nodeoffset, const char *name) +{ + struct fdt_property *prop; + int len, proplen; + + RW_CHECK_HEADER(fdt); + + prop = fdt_get_property_w(fdt, nodeoffset, name, &len); + if (! prop) + return len; + + proplen = sizeof(*prop) + ALIGN(len, FDT_TAGSIZE); + return _blob_splice_struct(fdt, prop, proplen, 0); +} + +int fdt_add_subnode_namelen(void *fdt, int parentoffset, + const char *name, int namelen) +{ + struct fdt_node_header *nh; + int offset, nextoffset; + int nodelen; + int err; + uint32_t tag; + uint32_t *endtag; + + RW_CHECK_HEADER(fdt); + + offset = fdt_subnode_offset_namelen(fdt, parentoffset, name, namelen); + if (offset >= 0) + return -FDT_ERR_EXISTS; + else if (offset != -FDT_ERR_NOTFOUND) + return offset; + + /* Try to place the new node after the parent's properties */ + fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */ + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + } while (tag == FDT_PROP); + + nh = _fdt_offset_ptr_w(fdt, offset); + nodelen = sizeof(*nh) + ALIGN(namelen+1, FDT_TAGSIZE) + FDT_TAGSIZE; + + err = _blob_splice_struct(fdt, nh, 0, nodelen); + if (err) + return err; + + nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); + memset(nh->name, 0, ALIGN(namelen+1, FDT_TAGSIZE)); + memcpy(nh->name, name, namelen); + endtag = (uint32_t *)((void *)nh + nodelen - FDT_TAGSIZE); + *endtag = cpu_to_fdt32(FDT_END_NODE); + + return offset; +} + +int fdt_add_subnode(void *fdt, int parentoffset, const char *name) +{ + return fdt_add_subnode_namelen(fdt, parentoffset, name, strlen(name)); +} + +int fdt_del_node(void *fdt, int nodeoffset) +{ + int endoffset; + + RW_CHECK_HEADER(fdt); + + endoffset = _fdt_node_end_offset(fdt, nodeoffset); + if (endoffset < 0) + return endoffset; + + return _blob_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset), + endoffset - nodeoffset, 0); +} + +static void _packblocks(const void *fdt, void *buf, + int mem_rsv_size, int struct_size) +{ + int mem_rsv_off, struct_off, strings_off; + + mem_rsv_off = ALIGN(sizeof(struct fdt_header), 8); + struct_off = mem_rsv_off + mem_rsv_size; + strings_off = struct_off + struct_size; + + memmove(buf + mem_rsv_off, fdt + fdt_off_mem_rsvmap(fdt), mem_rsv_size); + fdt_set_off_mem_rsvmap(buf, mem_rsv_off); + + memmove(buf + struct_off, fdt + fdt_off_dt_struct(fdt), struct_size); + fdt_set_off_dt_struct(buf, struct_off); + fdt_set_size_dt_struct(buf, struct_size); + + memmove(buf + strings_off, fdt + fdt_off_dt_strings(fdt), + fdt_size_dt_strings(fdt)); + fdt_set_off_dt_strings(buf, strings_off); + fdt_set_size_dt_strings(buf, fdt_size_dt_strings(fdt)); +} + +int fdt_open_into(const void *fdt, void *buf, int bufsize) +{ + int err; + int mem_rsv_size, struct_size; + int newsize; + void *tmp; + + err = fdt_check_header(fdt); + if (err) + return err; + + mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) + * sizeof(struct fdt_reserve_entry); + + if (fdt_version(fdt) >= 17) { + struct_size = fdt_size_dt_struct(fdt); + } else { + struct_size = 0; + while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END) + ; + } + + if (!_blocks_misordered(fdt, mem_rsv_size, struct_size)) { + /* no further work necessary */ + err = fdt_move(fdt, buf, bufsize); + if (err) + return err; + fdt_set_version(buf, 17); + fdt_set_size_dt_struct(buf, struct_size); + fdt_set_totalsize(buf, bufsize); + return 0; + } + + /* Need to reorder */ + newsize = ALIGN(sizeof(struct fdt_header), 8) + mem_rsv_size + + struct_size + fdt_size_dt_strings(fdt); + + if (bufsize < newsize) + return -FDT_ERR_NOSPACE; + + if (((buf + newsize) <= fdt) + || (buf >= (fdt + fdt_totalsize(fdt)))) { + tmp = buf; + } else { + tmp = (void *)fdt + fdt_totalsize(fdt); + if ((tmp + newsize) > (buf + bufsize)) + return -FDT_ERR_NOSPACE; + } + + _packblocks(fdt, tmp, mem_rsv_size, struct_size); + memmove(buf, tmp, newsize); + + fdt_set_magic(buf, FDT_MAGIC); + fdt_set_totalsize(buf, bufsize); + fdt_set_version(buf, 17); + fdt_set_last_comp_version(buf, 16); + fdt_set_boot_cpuid_phys(buf, fdt_boot_cpuid_phys(fdt)); + + return 0; +} + +int fdt_pack(void *fdt) +{ + int mem_rsv_size; + int err; + + err = rw_check_header(fdt); + if (err) + return err; + + mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) + * sizeof(struct fdt_reserve_entry); + _packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt)); + fdt_set_totalsize(fdt, _blob_data_size(fdt)); + + return 0; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_rw.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_rw.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,5 @@ +extern "C" { + +#include "fdt_rw.c" + +}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_strerror.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_strerror.c Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,96 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +struct errtabent { + const char *str; +}; + +#define ERRTABENT(val) \ + [(val)] = { .str = #val, } + +static struct errtabent errtable[] = { + ERRTABENT(FDT_ERR_NOTFOUND), + ERRTABENT(FDT_ERR_EXISTS), + ERRTABENT(FDT_ERR_NOSPACE), + + ERRTABENT(FDT_ERR_BADOFFSET), + ERRTABENT(FDT_ERR_BADPATH), + ERRTABENT(FDT_ERR_BADSTATE), + + ERRTABENT(FDT_ERR_TRUNCATED), + ERRTABENT(FDT_ERR_BADMAGIC), + ERRTABENT(FDT_ERR_BADVERSION), + ERRTABENT(FDT_ERR_BADSTRUCTURE), + ERRTABENT(FDT_ERR_BADLAYOUT), +}; +#define ERRTABSIZE (sizeof(errtable) / sizeof(errtable[0])) + +const char *fdt_strerror(int errval) +{ + if (errval > 0) + return ""; + else if (errval == 0) + return ""; + else if (errval > -ERRTABSIZE) { + const char *s = errtable[-errval].str; + + if (s) + return s; + } + + return ""; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_strerror.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_strerror.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,5 @@ +extern "C" { + +#include "fdt_strerror.c" + +}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_sw.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_sw.c Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,258 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +static int check_header_sw(void *fdt) +{ + if (fdt_magic(fdt) != SW_MAGIC) + return -FDT_ERR_BADMAGIC; + return 0; +} + +static void *grab_space(void *fdt, int len) +{ + int offset = fdt_size_dt_struct(fdt); + int spaceleft; + + spaceleft = fdt_totalsize(fdt) - fdt_off_dt_struct(fdt) + - fdt_size_dt_strings(fdt); + + if ((offset + len < offset) || (offset + len > spaceleft)) + return NULL; + + fdt_set_size_dt_struct(fdt, offset + len); + return fdt_offset_ptr_w(fdt, offset, len); +} + +int fdt_create(void *buf, int bufsize) +{ + void *fdt = buf; + + if (bufsize < sizeof(struct fdt_header)) + return -FDT_ERR_NOSPACE; + + memset(buf, 0, bufsize); + + fdt_set_magic(fdt, SW_MAGIC); + fdt_set_version(fdt, FDT_LAST_SUPPORTED_VERSION); + fdt_set_last_comp_version(fdt, FDT_FIRST_SUPPORTED_VERSION); + fdt_set_totalsize(fdt, bufsize); + + fdt_set_off_mem_rsvmap(fdt, ALIGN(sizeof(struct fdt_header), + sizeof(struct fdt_reserve_entry))); + fdt_set_off_dt_struct(fdt, fdt_off_mem_rsvmap(fdt)); + fdt_set_off_dt_strings(fdt, bufsize); + + return 0; +} + +int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) +{ + struct fdt_reserve_entry *re; + int err = check_header_sw(fdt); + int offset; + + if (err) + return err; + if (fdt_size_dt_struct(fdt)) + return -FDT_ERR_BADSTATE; + + offset = fdt_off_dt_struct(fdt); + if ((offset + sizeof(*re)) > fdt_totalsize(fdt)) + return -FDT_ERR_NOSPACE; + + re = (struct fdt_reserve_entry *)(fdt + offset); + re->address = cpu_to_fdt64(addr); + re->size = cpu_to_fdt64(size); + + fdt_set_off_dt_struct(fdt, offset + sizeof(*re)); + + return 0; +} + +int fdt_finish_reservemap(void *fdt) +{ + return fdt_add_reservemap_entry(fdt, 0, 0); +} + +int fdt_begin_node(void *fdt, const char *name) +{ + struct fdt_node_header *nh; + int err = check_header_sw(fdt); + int namelen = strlen(name) + 1; + + if (err) + return err; + + nh = grab_space(fdt, sizeof(*nh) + ALIGN(namelen, FDT_TAGSIZE)); + if (! nh) + return -FDT_ERR_NOSPACE; + + nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); + memcpy(nh->name, name, namelen); + return 0; +} + +int fdt_end_node(void *fdt) +{ + uint32_t *en; + int err = check_header_sw(fdt); + + if (err) + return err; + + en = grab_space(fdt, FDT_TAGSIZE); + if (! en) + return -FDT_ERR_NOSPACE; + + *en = cpu_to_fdt32(FDT_END_NODE); + return 0; +} + +static int find_add_string(void *fdt, const char *s) +{ + char *strtab = (char *)fdt + fdt_totalsize(fdt); + const char *p; + int strtabsize = fdt_size_dt_strings(fdt); + int len = strlen(s) + 1; + int struct_top, offset; + + p = _fdt_find_string(strtab - strtabsize, strtabsize, s); + if (p) + return p - strtab; + + /* Add it */ + offset = -strtabsize - len; + struct_top = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt); + if (fdt_totalsize(fdt) + offset < struct_top) + return 0; /* no more room :( */ + + memcpy(strtab + offset, s, len); + fdt_set_size_dt_strings(fdt, strtabsize + len); + return offset; +} + +int fdt_property(void *fdt, const char *name, const void *val, int len) +{ + struct fdt_property *prop; + int err = check_header_sw(fdt); + int nameoff; + + if (err) + return err; + + nameoff = find_add_string(fdt, name); + if (nameoff == 0) + return -FDT_ERR_NOSPACE; + + prop = grab_space(fdt, sizeof(*prop) + ALIGN(len, FDT_TAGSIZE)); + if (! prop) + return -FDT_ERR_NOSPACE; + + prop->tag = cpu_to_fdt32(FDT_PROP); + prop->nameoff = cpu_to_fdt32(nameoff); + prop->len = cpu_to_fdt32(len); + memcpy(prop->data, val, len); + return 0; +} + +int fdt_finish(void *fdt) +{ + int err = check_header_sw(fdt); + char *p = (char *)fdt; + uint32_t *end; + int oldstroffset, newstroffset; + uint32_t tag; + int offset, nextoffset; + + if (err) + return err; + + /* Add terminator */ + end = grab_space(fdt, sizeof(*end)); + if (! end) + return -FDT_ERR_NOSPACE; + *end = cpu_to_fdt32(FDT_END); + + /* Relocate the string table */ + oldstroffset = fdt_totalsize(fdt) - fdt_size_dt_strings(fdt); + newstroffset = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt); + memmove(p + newstroffset, p + oldstroffset, fdt_size_dt_strings(fdt)); + fdt_set_off_dt_strings(fdt, newstroffset); + + /* Walk the structure, correcting string offsets */ + offset = 0; + while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) { + if (tag == FDT_PROP) { + struct fdt_property *prop = + fdt_offset_ptr_w(fdt, offset, sizeof(*prop)); + int nameoff; + + if (! prop) + return -FDT_ERR_BADSTRUCTURE; + + nameoff = fdt32_to_cpu(prop->nameoff); + nameoff += fdt_size_dt_strings(fdt); + prop->nameoff = cpu_to_fdt32(nameoff); + } + offset = nextoffset; + } + + /* Finally, adjust the header */ + fdt_set_totalsize(fdt, newstroffset + fdt_size_dt_strings(fdt)); + fdt_set_magic(fdt, FDT_MAGIC); + return 0; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_sw.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_sw.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,5 @@ +extern "C" { + +#include "fdt_sw.c" + +}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_wip.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_wip.c Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,144 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, + const void *val, int len) +{ + void *propval; + int proplen; + + propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen); + if (! propval) + return proplen; + + if (proplen != len) + return -FDT_ERR_NOSPACE; + + memcpy(propval, val, len); + return 0; +} + +static void nop_region(void *start, int len) +{ + uint32_t *p; + + for (p = start; (void *)p < (start + len); p++) + *p = cpu_to_fdt32(FDT_NOP); +} + +int fdt_nop_property(void *fdt, int nodeoffset, const char *name) +{ + struct fdt_property *prop; + int len; + + prop = fdt_get_property_w(fdt, nodeoffset, name, &len); + if (! prop) + return len; + + nop_region(prop, len + sizeof(*prop)); + + return 0; +} + +int _fdt_node_end_offset(void *fdt, int nodeoffset) +{ + int level = 0; + uint32_t tag; + int offset, nextoffset; + + tag = fdt_next_tag(fdt, nodeoffset, &nextoffset); + if (tag != FDT_BEGIN_NODE) + return -FDT_ERR_BADOFFSET; + do { + offset = nextoffset; + tag = fdt_next_tag(fdt, offset, &nextoffset); + + switch (tag) { + case FDT_END: + return offset; + + case FDT_BEGIN_NODE: + level++; + break; + + case FDT_END_NODE: + level--; + break; + + case FDT_PROP: + case FDT_NOP: + break; + + default: + return -FDT_ERR_BADSTRUCTURE; + } + } while (level >= 0); + + return nextoffset; +} + +int fdt_nop_node(void *fdt, int nodeoffset) +{ + int endoffset; + + endoffset = _fdt_node_end_offset(fdt, nodeoffset); + if (endoffset < 0) + return endoffset; + + nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0), endoffset - nodeoffset); + return 0; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/fdt_wip.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/fdt_wip.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,5 @@ +extern "C" { + +#include "fdt_wip.c" + +}; diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/libfdt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/libfdt.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,1080 @@ +#ifndef _LIBFDT_H +#define _LIBFDT_H +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "libfdt_env.h" +#include "fdt.h" + +#define FDT_FIRST_SUPPORTED_VERSION 0x10 +#define FDT_LAST_SUPPORTED_VERSION 0x11 + +/* Error codes: informative error codes */ +#define FDT_ERR_NOTFOUND 1 + /* FDT_ERR_NOTFOUND: The requested node or property does not exist */ +#define FDT_ERR_EXISTS 2 + /* FDT_ERR_EXISTS: Attemped to create a node or property which + * already exists */ +#define FDT_ERR_NOSPACE 3 + /* FDT_ERR_NOSPACE: Operation needed to expand the device + * tree, but its buffer did not have sufficient space to + * contain the expanded tree. Use fdt_open_into() to move the + * device tree to a buffer with more space. */ + +/* Error codes: codes for bad parameters */ +#define FDT_ERR_BADOFFSET 4 + /* FDT_ERR_BADOFFSET: Function was passed a structure block + * offset which is out-of-bounds, or which points to an + * unsuitable part of the structure for the operation. */ +#define FDT_ERR_BADPATH 5 + /* FDT_ERR_BADPATH: Function was passed a badly formatted path + * (e.g. missing a leading / for a function which requires an + * absolute path) */ +#define FDT_ERR_BADPHANDLE 6 + /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle + * value. phandle values of 0 and -1 are not permitted. */ +#define FDT_ERR_BADSTATE 7 + /* FDT_ERR_BADSTATE: Function was passed an incomplete device + * tree created by the sequential-write functions, which is + * not sufficiently complete for the requested operation. */ + +/* Error codes: codes for bad device tree blobs */ +#define FDT_ERR_TRUNCATED 8 + /* FDT_ERR_TRUNCATED: Structure block of the given device tree + * ends without an FDT_END tag. */ +#define FDT_ERR_BADMAGIC 9 + /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a + * device tree at all - it is missing the flattened device + * tree magic number. */ +#define FDT_ERR_BADVERSION 10 + /* FDT_ERR_BADVERSION: Given device tree has a version which + * can't be handled by the requested operation. For + * read-write functions, this may mean that fdt_open_into() is + * required to convert the tree to the expected version. */ +#define FDT_ERR_BADSTRUCTURE 11 + /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt + * structure block or other serious error (e.g. misnested + * nodes, or subnodes preceding properties). */ +#define FDT_ERR_BADLAYOUT 12 + /* FDT_ERR_BADLAYOUT: For read-write functions, the given + * device tree has it's sub-blocks in an order that the + * function can't handle (memory reserve map, then structure, + * then strings). Use fdt_open_into() to reorganize the tree + * into a form suitable for the read-write operations. */ + +/* "Can't happen" error indicating a bug in libfdt */ +#define FDT_ERR_INTERNAL 13 + /* FDT_ERR_INTERNAL: libfdt has failed an internal assertion. + * Should never be returned, if it is, it indicates a bug in + * libfdt itself. */ + +#define FDT_ERR_MAX 13 + +/**********************************************************************/ +/* Low-level functions (you probably don't need these) */ +/**********************************************************************/ + +const void *fdt_offset_ptr(const void *fdt, int offset, int checklen); +static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) +{ + return (void *)fdt_offset_ptr(fdt, offset, checklen); +} + +uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); + +/**********************************************************************/ +/* General functions */ +/**********************************************************************/ + +#define fdt_get_header(fdt, field) \ + (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field)) +#define fdt_magic(fdt) (fdt_get_header(fdt, magic)) +#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize)) +#define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct)) +#define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings)) +#define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap)) +#define fdt_version(fdt) (fdt_get_header(fdt, version)) +#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version)) +#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys)) +#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings)) +#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct)) + +#define __fdt_set_hdr(name) \ + static inline void fdt_set_##name(void *fdt, uint32_t val) \ + { \ + struct fdt_header *fdth = (struct fdt_header *)fdt; \ + fdth->name = cpu_to_fdt32(val); \ + } + +__fdt_set_hdr(magic); +__fdt_set_hdr(totalsize); +__fdt_set_hdr(off_dt_struct); +__fdt_set_hdr(off_dt_strings); +__fdt_set_hdr(off_mem_rsvmap); +__fdt_set_hdr(version); +__fdt_set_hdr(last_comp_version); +__fdt_set_hdr(boot_cpuid_phys); +__fdt_set_hdr(size_dt_strings); +__fdt_set_hdr(size_dt_struct); +#undef __fdt_set_hdr + +/** + * fdt_check_header - sanity check a device tree or possible device tree + * @fdt: pointer to data which might be a flattened device tree + * + * fdt_check_header() checks that the given buffer contains what + * appears to be a flattened device tree with sane information in its + * header. + * + * returns: + * 0, if the buffer appears to contain a valid device tree + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings, as above + */ +int fdt_check_header(const void *fdt); + +/** + * fdt_move - move a device tree around in memory + * @fdt: pointer to the device tree to move + * @buf: pointer to memory where the device is to be moved + * @bufsize: size of the memory space at buf + * + * fdt_move() relocates, if possible, the device tree blob located at + * fdt to the buffer at buf of size bufsize. The buffer may overlap + * with the existing device tree blob at fdt. Therefore, + * fdt_move(fdt, fdt, fdt_totalsize(fdt)) + * should always succeed. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings + */ +int fdt_move(const void *fdt, void *buf, int bufsize); + +/**********************************************************************/ +/* Read-only functions */ +/**********************************************************************/ + +/** + * fdt_string - retreive a string from the strings block of a device tree + * @fdt: pointer to the device tree blob + * @stroffset: offset of the string within the strings block (native endian) + * + * fdt_string() retrieves a pointer to a single string from the + * strings block of the device tree blob at fdt. + * + * returns: + * a pointer to the string, on success + * NULL, if stroffset is out of bounds + */ +const char *fdt_string(const void *fdt, int stroffset); + +/** + * fdt_num_mem_rsv - retreive the number of memory reserve map entries + * @fdt: pointer to the device tree blob + * + * Returns the number of entries in the device tree blob's memory + * reservation map. This does not include the terminating 0,0 entry + * or any other (0,0) entries reserved for expansion. + * + * returns: + * the number of entries + */ +int fdt_num_mem_rsv(const void *fdt); + +/** + * fdt_get_mem_rsv - retreive one memory reserve map entry + * @fdt: pointer to the device tree blob + * @address, @size: pointers to 64-bit variables + * + * On success, *address and *size will contain the address and size of + * the n-th reserve map entry from the device tree blob, in + * native-endian format. + * + * returns: + * 0, on success + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings + */ +int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size); + +/** + * fdt_subnode_offset_namelen - find a subnode based on substring + * @fdt: pointer to the device tree blob + * @parentoffset: structure block offset of a node + * @name: name of the subnode to locate + * @namelen: number of characters of name to consider + * + * Identical to fdt_subnode_offset(), but only examine the first + * namelen characters of name for matching the subnode name. This is + * useful for finding subnodes based on a portion of a larger string, + * such as a full path. + */ +int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, + const char *name, int namelen); +/** + * fdt_subnode_offset - find a subnode of a given node + * @fdt: pointer to the device tree blob + * @parentoffset: structure block offset of a node + * @name: name of the subnode to locate + * + * fdt_subnode_offset() finds a subnode of the node at structure block + * offset parentoffset with the given name. name may include a unit + * address, in which case fdt_subnode_offset() will find the subnode + * with that unit address, or the unit address may be omitted, in + * which case fdt_subnode_offset() will find an arbitrary subnode + * whose name excluding unit address matches the given name. + * + * returns: + * structure block offset of the requested subnode (>=0), on success + * -FDT_ERR_NOTFOUND, if the requested subnode does not exist + * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings. + */ +int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name); + +/** + * fdt_path_offset - find a tree node by its full path + * @fdt: pointer to the device tree blob + * @path: full path of the node to locate + * + * fdt_path_offset() finds a node of a given path in the device tree. + * Each path component may omit the unit address portion, but the + * results of this are undefined if any such path component is + * ambiguous (that is if there are multiple nodes at the relevant + * level matching the given component, differentiated only by unit + * address). + * + * returns: + * structure block offset of the node with the requested path (>=0), on success + * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid + * -FDT_ERR_NOTFOUND, if the requested node does not exist + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings. + */ +int fdt_path_offset(const void *fdt, const char *path); + +/** + * fdt_get_name - retreive the name of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: structure block offset of the starting node + * @lenp: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_get_name() retrieves the name (including unit address) of the + * device tree node at structure block offset nodeoffset. If lenp is + * non-NULL, the length of this name is also returned, in the integer + * pointed to by lenp. + * + * returns: + * pointer to the node's name, on success + * If lenp is non-NULL, *lenp contains the length of that name (>=0) + * NULL, on error + * if lenp is non-NULL *lenp contains an error code (<0): + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings + */ +const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp); + +/** + * fdt_get_property - find a given property in a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to find + * @name: name of the property to find + * @lenp: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_get_property() retrieves a pointer to the fdt_property + * structure within the device tree blob corresponding to the property + * named 'name' of the node at offset nodeoffset. If lenp is + * non-NULL, the length of the property value also returned, in the + * integer pointed to by lenp. + * + * returns: + * pointer to the structure representing the property + * if lenp is non-NULL, *lenp contains the length of the property + * value (>=0) + * NULL, on error + * if lenp is non-NULL, *lenp contains an error code (<0): + * -FDT_ERR_NOTFOUND, node does not have named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, + const char *name, int *lenp); +static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, + const char *name, + int *lenp) +{ + return (struct fdt_property *)fdt_get_property(fdt, nodeoffset, + name, lenp); +} + +/** + * fdt_getprop - retrieve the value of a given property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to find + * @name: name of the property to find + * @lenp: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_getprop() retrieves a pointer to the value of the property + * named 'name' of the node at offset nodeoffset (this will be a + * pointer to within the device blob itself, not a copy of the value). + * If lenp is non-NULL, the length of the property value also + * returned, in the integer pointed to by lenp. + * + * returns: + * pointer to the property's value + * if lenp is non-NULL, *lenp contains the length of the property + * value (>=0) + * NULL, on error + * if lenp is non-NULL, *lenp contains an error code (<0): + * -FDT_ERR_NOTFOUND, node does not have named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +const void *fdt_getprop(const void *fdt, int nodeoffset, + const char *name, int *lenp); +static inline void *fdt_getprop_w(void *fdt, int nodeoffset, + const char *name, int *lenp) +{ + return (void *)fdt_getprop(fdt, nodeoffset, name, lenp); +} + +/** + * fdt_get_phandle - retreive the phandle of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: structure block offset of the node + * + * fdt_get_phandle() retrieves the phandle of the device tree node at + * structure block offset nodeoffset. + * + * returns: + * the phandle of the node at nodeoffset, on succes (!= 0, != -1) + * 0, if the node has no phandle, or another error occurs + */ +uint32_t fdt_get_phandle(const void *fdt, int nodeoffset); + +/** + * fdt_get_path - determine the full path of a node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose path to find + * @buf: character buffer to contain the returned path (will be overwritten) + * @buflen: size of the character buffer at buf + * + * fdt_get_path() computes the full path of the node at offset + * nodeoffset, and records that path in the buffer at buf. + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset. + * + * returns: + * 0, on success + * buf contains the absolute path of the node at + * nodeoffset, as a NUL-terminated string. + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1) + * characters and will not fit in the given buffer. + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen); + +/** + * fdt_supernode_atdepth_offset - find a specific ancestor of a node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose parent to find + * @supernodedepth: depth of the ancestor to find + * @nodedepth: pointer to an integer variable (will be overwritten) or NULL + * + * fdt_supernode_atdepth_offset() finds an ancestor of the given node + * at a specific depth from the root (where the root itself has depth + * 0, its immediate subnodes depth 1 and so forth). So + * fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL); + * will always return 0, the offset of the root node. If the node at + * nodeoffset has depth D, then: + * fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL); + * will return nodeoffset itself. + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset. + * + * returns: + + * structure block offset of the node at node offset's ancestor + * of depth supernodedepth (>=0), on success + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag +* -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, + int supernodedepth, int *nodedepth); + +/** + * fdt_node_depth - find the depth of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose parent to find + * + * fdt_node_depth() finds the depth of a given node. The root node + * has depth 0, its immediate subnodes depth 1 and so forth. + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset. + * + * returns: + * depth of the node at nodeoffset (>=0), on success + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_depth(const void *fdt, int nodeoffset); + +/** + * fdt_parent_offset - find the parent of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose parent to find + * + * fdt_parent_offset() locates the parent node of a given node (that + * is, it finds the offset of the node which contains the node at + * nodeoffset as a subnode). + * + * NOTE: This function is expensive, as it must scan the device tree + * structure from the start to nodeoffset, *twice*. + * + * returns: + * stucture block offset of the parent of the node at nodeoffset + * (>=0), on success + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_parent_offset(const void *fdt, int nodeoffset); + +/** + * fdt_node_offset_by_prop_value - find nodes with a given property value + * @fdt: pointer to the device tree blob + * @startoffset: only find nodes after this offset + * @propname: property name to check + * @propval: property value to search for + * @proplen: length of the value in propval + * + * fdt_node_offset_by_prop_value() returns the offset of the first + * node after startoffset, which has a property named propname whose + * value is of length proplen and has value equal to propval; or if + * startoffset is -1, the very first such node in the tree. + * + * To iterate through all nodes matching the criterion, the following + * idiom can be used: + * offset = fdt_node_offset_by_prop_value(fdt, -1, propname, + * propval, proplen); + * while (offset != -FDT_ERR_NOTFOUND) { + * // other code here + * offset = fdt_node_offset_by_prop_value(fdt, offset, propname, + * propval, proplen); + * } + * + * Note the -1 in the first call to the function, if 0 is used here + * instead, the function will never locate the root node, even if it + * matches the criterion. + * + * returns: + * structure block offset of the located node (>= 0, >startoffset), + * on success + * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the + * tree after startoffset + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, + const char *propname, + const void *propval, int proplen); + +/** + * fdt_node_offset_by_phandle - find the node with a given phandle + * @fdt: pointer to the device tree blob + * @phandle: phandle value + * + * fdt_node_offset_by_prop_value() returns the offset of the node + * which has the given phandle value. If there is more than one node + * in the tree with the given phandle (an invalid tree), results are + * undefined. + * + * returns: + * structure block offset of the located node (>= 0), on success + * -FDT_ERR_NOTFOUND, no node with that phandle exists + * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1) + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle); + +/** + * fdt_node_check_compatible: check a node's compatible property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of a tree node + * @compatible: string to match against + * + * + * fdt_node_check_compatible() returns 0 if the given node contains a + * 'compatible' property with the given string as one of its elements, + * it returns non-zero otherwise, or on error. + * + * returns: + * 0, if the node has a 'compatible' property listing the given string + * 1, if the node has a 'compatible' property, but it does not list + * the given string + * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property + * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_check_compatible(const void *fdt, int nodeoffset, + const char *compatible); + +/** + * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value + * @fdt: pointer to the device tree blob + * @startoffset: only find nodes after this offset + * @compatible: 'compatible' string to match against + * + * fdt_node_offset_by_compatible() returns the offset of the first + * node after startoffset, which has a 'compatible' property which + * lists the given compatible string; or if startoffset is -1, the + * very first such node in the tree. + * + * To iterate through all nodes matching the criterion, the following + * idiom can be used: + * offset = fdt_node_offset_by_compatible(fdt, -1, compatible); + * while (offset != -FDT_ERR_NOTFOUND) { + * // other code here + * offset = fdt_node_offset_by_compatible(fdt, offset, compatible); + * } + * + * Note the -1 in the first call to the function, if 0 is used here + * instead, the function will never locate the root node, even if it + * matches the criterion. + * + * returns: + * structure block offset of the located node (>= 0, >startoffset), + * on success + * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the + * tree after startoffset + * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, standard meanings + */ +int fdt_node_offset_by_compatible(const void *fdt, int startoffset, + const char *compatible); + +/**********************************************************************/ +/* Write-in-place functions */ +/**********************************************************************/ + +/** + * fdt_setprop_inplace - change a property's value, but not its size + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to change + * @name: name of the property to change + * @val: pointer to data to replace the property value with + * @len: length of the property value + * + * fdt_setprop_inplace() replaces the value of a given property with + * the data in val, of length len. This function cannot change the + * size of a property, and so will only work if len is equal to the + * current length of the property. + * + * This function will alter only the bytes in the blob which contain + * the given property value, and will not alter or move any other part + * of the tree. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, if len is not equal to the property's current length + * -FDT_ERR_NOTFOUND, node does not have the named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, + const void *val, int len); + +/** + * fdt_setprop_inplace_cell - change the value of a single-cell property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to change + * @name: name of the property to change + * @val: cell (32-bit integer) value to replace the property with + * + * fdt_setprop_inplace_cell() replaces the value of a given property + * with the 32-bit integer cell value in val, converting val to + * big-endian if necessary. This function cannot change the size of a + * property, and so will only work if the property already exists and + * has length 4. + * + * This function will alter only the bytes in the blob which contain + * the given property value, and will not alter or move any other part + * of the tree. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, if the property's length is not equal to 4 + * -FDT_ERR_NOTFOUND, node does not have the named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, + const char *name, uint32_t val) +{ + val = cpu_to_fdt32(val); + return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); +} + +/** + * fdt_nop_property - replace a property with nop tags + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to nop + * @name: name of the property to nop + * + * fdt_nop_property() will replace a given property's representation + * in the blob with FDT_NOP tags, effectively removing it from the + * tree. + * + * This function will alter only the bytes in the blob which contain + * the property, and will not alter or move any other part of the + * tree. + * + * returns: + * 0, on success + * -FDT_ERR_NOTFOUND, node does not have the named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_nop_property(void *fdt, int nodeoffset, const char *name); + +/** + * fdt_nop_node - replace a node (subtree) with nop tags + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node to nop + * + * fdt_nop_node() will replace a given node's representation in the + * blob, including all its subnodes, if any, with FDT_NOP tags, + * effectively removing it from the tree. + * + * This function will alter only the bytes in the blob which contain + * the node and its properties and subnodes, and will not alter or + * move any other part of the tree. + * + * returns: + * 0, on success + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_nop_node(void *fdt, int nodeoffset); + +/**********************************************************************/ +/* Sequential write functions */ +/**********************************************************************/ + +int fdt_create(void *buf, int bufsize); +int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size); +int fdt_finish_reservemap(void *fdt); +int fdt_begin_node(void *fdt, const char *name); +int fdt_property(void *fdt, const char *name, const void *val, int len); +static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) +{ + val = cpu_to_fdt32(val); + return fdt_property(fdt, name, &val, sizeof(val)); +} +#define fdt_property_string(fdt, name, str) \ + fdt_property(fdt, name, str, strlen(str)+1) +int fdt_end_node(void *fdt); +int fdt_finish(void *fdt); + +/**********************************************************************/ +/* Read-write functions */ +/**********************************************************************/ + +int fdt_open_into(const void *fdt, void *buf, int bufsize); +int fdt_pack(void *fdt); + +/** + * fdt_add_mem_rsv - add one memory reserve map entry + * @fdt: pointer to the device tree blob + * @addres, @size: 64-bit values (native endian) + * + * Adds a reserve map entry to the given blob reserving a region at + * address address of length size. + * + * This function will insert data into the reserve map and will + * therfore change the indexes of some entries in the table. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to + * contain the new reservation entry + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size); + +/** + * fdt_del_mem_rsv - remove a memory reserve map entry + * @fdt: pointer to the device tree blob + * @n: entry to remove + * + * fdt_del_mem_rsv() removes the n-th memory reserve map entry from + * the blob. + * + * This function will delete data from the reservation table and will + * therfore change the indexes of some entries in the table. + * + * returns: + * 0, on success + * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there + * are less than n+1 reserve map entries) + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_del_mem_rsv(void *fdt, int n); + +/** + * fdt_set_name - change the name of a given node + * @fdt: pointer to the device tree blob + * @nodeoffset: structure block offset of a node + * @name: name to give the node + * + * fdt_set_name() replaces the name (including unit address, if any) + * of the given node with the given string. NOTE: this function can't + * efficiently check if the new name is unique amongst the given + * node's siblings; results are undefined if this function is invoked + * with a name equal to one of the given node's siblings. + * + * This function may insert or delete data from the blob, and will + * therefore change the offsets of some existing nodes. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, there is insufficient free space in the blob + * to contain the new name + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, standard meanings + */ +int fdt_set_name(void *fdt, int nodeoffset, const char *name); + +/** + * fdt_setprop - create or change a property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to change + * @name: name of the property to change + * @val: pointer to data to set the property value to + * @len: length of the property value + * + * fdt_setprop() sets the value of the named property in the given + * node to the given value and length, creeating the property if it + * does not already exist. + * + * This function may insert or delete data from the blob, and will + * therefore change the offsets of some existing nodes. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to + * contain the new property value + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_setprop(void *fdt, int nodeoffset, const char *name, + const void *val, int len); + +/** + * fdt_setprop_cell - set a property to a single cell value + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to change + * @name: name of the property to change + * @val: 32-bit integer value for the property (native endian) + * + * fdt_setprop_cell() sets the value of the named property in the + * given node to the given cell value (converting to big-endian if + * necessary), or creates a new property with that value if it does + * not already exist. + * + * This function may insert or delete data from the blob, and will + * therefore change the offsets of some existing nodes. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to + * contain the new property value + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_TRUNCATED, standard meanings + */ +static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, + uint32_t val) +{ + val = cpu_to_fdt32(val); + return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); +} + +/** + * fdt_setprop_string - set a property to a string value + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to change + * @name: name of the property to change + * @str: string value for the property + * + * fdt_setprop_string() sets the value of the named property in the + * given node to the given string value (using the length of the + * string to determine the new length of the property), or creates a + * new property with that value if it does not already exist. + * + * This function may insert or delete data from the blob, and will + * therefore change the offsets of some existing nodes. + * + * returns: + * 0, on success + * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to + * contain the new property value + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_TRUNCATED, standard meanings + */ +#define fdt_setprop_string(fdt, nodeoffset, name, str) \ + fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1) + +/** + * fdt_delprop - delete a property + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node whose property to nop + * @name: name of the property to nop + * + * fdt_del_property() will delete the given property. + * + * This function will delete data from the blob, and will therefore + * change the offsets of some existing nodes. + * + * returns: + * 0, on success + * -FDT_ERR_NOTFOUND, node does not have the named property + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_delprop(void *fdt, int nodeoffset, const char *name); + +/** + * fdt_add_subnode_namelen - creates a new node based on substring + * @fdt: pointer to the device tree blob + * @parentoffset: structure block offset of a node + * @name: name of the subnode to locate + * @namelen: number of characters of name to consider + * + * Identical to fdt_add_subnode(), but use only the first namelen + * characters of name as the name of the new node. This is useful for + * creating subnodes based on a portion of a larger string, such as a + * full path. + */ +int fdt_add_subnode_namelen(void *fdt, int parentoffset, + const char *name, int namelen); + +/** + * fdt_add_subnode - creates a new node + * @fdt: pointer to the device tree blob + * @parentoffset: structure block offset of a node + * @name: name of the subnode to locate + * + * fdt_add_subnode() creates a new node as a subnode of the node at + * structure block offset parentoffset, with the given name (which + * should include the unit address, if any). + * + * This function will insert data into the blob, and will therefore + * change the offsets of some existing nodes. + + * returns: + * structure block offset of the created nodeequested subnode (>=0), on success + * -FDT_ERR_NOTFOUND, if the requested subnode does not exist + * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag + * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of + * the given name + * -FDT_ERR_NOSPACE, if there is insufficient free space in the + * blob to contain the new node + * -FDT_ERR_NOSPACE + * -FDT_ERR_BADLAYOUT + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings. + */ +int fdt_add_subnode(void *fdt, int parentoffset, const char *name); + +/** + * fdt_del_node - delete a node (subtree) + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node to nop + * + * fdt_del_node() will remove the given node, including all its + * subnodes if any, from the blob. + * + * This function will delete data from the blob, and will therefore + * change the offsets of some existing nodes. + * + * returns: + * 0, on success + * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag + * -FDT_ERR_BADLAYOUT, + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_del_node(void *fdt, int nodeoffset); + +/**********************************************************************/ +/* Debugging / informational functions */ +/**********************************************************************/ + +const char *fdt_strerror(int errval); + +#ifdef __cplusplus +} +#endif + + +#endif /* _LIBFDT_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/libfdt_env.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/libfdt_env.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,21 @@ +#ifndef _LIBFDT_ENV_H +#define _LIBFDT_ENV_H + +#include +#include +#include +#include "bswap.h" + +#ifdef WORDS_BIGENDIAN +#define fdt32_to_cpu(x) (x) +#define cpu_to_fdt32(x) (x) +#define fdt64_to_cpu(x) (x) +#define cpu_to_fdt64(x) (x) +#else +#define fdt32_to_cpu(x) (bswap_32((x))) +#define cpu_to_fdt32(x) (bswap_32((x))) +#define fdt64_to_cpu(x) (bswap_64((x))) +#define cpu_to_fdt64(x) (bswap_64((x))) +#endif + +#endif /* _LIBFDT_ENV_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/libfdt_internal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/libfdt_internal.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,89 @@ +#ifndef _LIBFDT_INTERNAL_H +#define _LIBFDT_INTERNAL_H +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) +#define PALIGN(p, a) ((void *)ALIGN((unsigned long)(p), (a))) + +#define memeq(p, q, n) (memcmp((p), (q), (n)) == 0) +#define streq(p, q) (strcmp((p), (q)) == 0) + +uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset); +const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); +int _fdt_node_end_offset(void *fdt, int nodeoffset); + +static inline const void *_fdt_offset_ptr(const void *fdt, int offset) +{ + return fdt + fdt_off_dt_struct(fdt) + offset; +} + +static inline void *_fdt_offset_ptr_w(void *fdt, int offset) +{ + return (void *)_fdt_offset_ptr(fdt, offset); +} + +static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) +{ + const struct fdt_reserve_entry *rsv_table = + fdt + fdt_off_mem_rsvmap(fdt); + + return rsv_table + n; +} +static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) +{ + return (void *)_fdt_mem_rsv(fdt, n); +} + +#define SW_MAGIC (~FDT_MAGIC) + +#endif /* _LIBFDT_INTERNAL_H */ diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpplatform/libfdt/patch.libfdt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpplatform/libfdt/patch.libfdt Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,20 @@ +Minor changes are required to get libfdt to build as part of qemu. +The patch below records modifications relative to upstream dtc-v1.2.0. + +Index: libfdt_env.h +=================================================================== +--- libfdt_env.h (revision 230023) ++++ libfdt_env.h (working copy) +@@ -4,10 +4,9 @@ + #include + #include + #include +-#include +-#include ++#include "bswap.h" + +-#if __BYTE_ORDER == __BIG_ENDIAN ++#ifdef WORDS_BIGENDIAN + #define fdt32_to_cpu(x) (x) + #define cpu_to_fdt32(x) (x) + #define fdt64_to_cpu(x) (x) diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpsnapdriver/snapapp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpsnapdriver/snapapp.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +TARGET snapapp.exe +TARGETTYPE EXE +SOURCEPATH src +SOURCE snapapp.cpp rsvpsnapdriver.cpp +LIBRARY euser.lib efsrv.lib +SYSTEMINCLUDE /epoc32/include + +CAPABILITY TCB DISKADMIN ALLFILES +VENDORID 0x70000001 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpsnapdriver/src/rsvpsnapdriver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpsnapdriver/src/rsvpsnapdriver.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include // for User:: +#include "rsvpsnapdriver.h" + +//#define SVPDBG +#ifdef SVPDBG +#include +#define DP(format...) RDebug::Printf(format) +#else +#define DP(format...) +#endif + +TInt RSVPSnapDriver::Open(void) +{ + DP("** RSVPSnapDriver::Open()"); + + const TVersion ver = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); + + return DoCreate(KSVPSnapDriverName, + ver, + KNullUnit, + NULL, + NULL); +} + +TInt RSVPSnapDriver::SaveVM(const TDesC8& aData) +{ + DP("** RSVPSnapDriver::SaveVM"); + + //DP("** RSVPSnapDriver::SaveVM: - length of data=%d", length); + //DP("** RSVPSnapDriver::SaveVM: - aName= %s", name.Ptr()); + + return DoSVPRequest(ESaveVM,(TAny*)&aData); + } + +TInt RSVPSnapDriver::LoadVM(const TDesC8& aData) +{ + DP("** RSVPSnapDriver::LoadVM"); + return DoSVPRequest(ELoadVM,(TAny*)&aData); +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpsnapdriver/src/rsvpsnapdriver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpsnapdriver/src/rsvpsnapdriver.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __RSVPSNAPDRIVER_H +#define __RSVPSNAPDRIVER_H + +#include // for RBusLogicalChannel + +class TCapsSVPSnapDriver +{ +public: + TVersion iVersion; +}; + +_LIT(KSVPSnapDriverName,"SVP Snapshot Driver"); +_LIT(KSVPSnapDriverLDD, "svpsnapdriver.ldd"); + +// Version information +const TInt KMajorVersionNumber=0; +const TInt KMinorVersionNumber=0; +const TInt KBuildVersionNumber=1; + +class RSVPSnapDriver : public RBusLogicalChannel +{ + public: + enum TControl + { + EDummy = 0, + ESaveVM, + ELoadVM + }; + + public: +#ifndef __KERNEL_MODE__ + TInt Open(void); + TInt SaveVM(const TDesC8& aData); + TInt LoadVM(const TDesC8& aData); + +private: + inline TInt DoSVPRequest(TInt aReqNo, TAny * a1) + { + TRequestStatus status; + DoRequest(aReqNo, status, a1); + User::WaitForRequest(status); + return status.Int(); + } +#endif +}; + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpsnapdriver/src/snapapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpsnapdriver/src/snapapp.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include // CTrapCleanup + +#include "rsvpsnapdriver.h" + +#define SVPDBG +#ifdef SVPDBG +#include +#define DP(format...) RDebug::Printf(format) +#else +#define DP(format...) +#endif + +_LIT8(KTestSendData,"kalle"); + +GLDEF_C TInt E32Main() +{ + DP("** (SNAPAPP) E32Main()"); + + // CTrapCleanup* cleanup; + // cleanup=CTrapCleanup::New(); + // __UHEAP_MARK; + +#if 0 + TInt err = User::LoadLogicalDevice(KSVPSnapDriverLDD); + if (err==KErrAlreadyExists) + DP("KErrAlreadyExists"); +#endif + + RSVPSnapDriver drv; + TInt err = drv.Open(); + +#if 1 + if (err==KErrNone) + { + + drv.SaveVM(KTestSendData); + } + else + DP("Error"); +#else + drv.LoadVM(KTestSendData); // Will never return +#endif + + // __UHEAP_MARKEND; + // delete cleanup; + return(KErrNone); +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpsnapdriver/src/svpsnapdriver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpsnapdriver/src/svpsnapdriver.cpp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "svpsnapdriver.h" +#include "rsvpsnapdriver.h" +#include "system.h" + +static inline TUint32 ReadReg(ESVPSnapReg aReg) +{ + DP("** (SVPSNAPDRIVER) ReadReg(%d)",aReg); + + return *(volatile TUint32 *)(KHwSVPSnapDevice + (aReg << 2)); +} + +static inline void WriteReg(ESVPSnapReg aReg, TUint32 aVal) +{ + DP("** (SVPSNAPDRIVER) WriteReg(%d,%d)",aReg,aVal); + + *(volatile TUint32*)(KHwSVPSnapDevice + (aReg << 2)) = aVal; +} + +// +// DSVPSnapDriverFactory +// + +DSVPSnapDriverFactory::DSVPSnapDriverFactory() +{ + DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::DSVPSnapDriverFactory()"); + + iVersion = TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); +} + +TInt DSVPSnapDriverFactory::Create(DLogicalChannelBase*& aChannel) +{ + DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::Create()"); + +#if 0 + if (iOpenChannels != 0) + return KErrInUse; // a channel is already open +#endif + + aChannel = new DSVPSnapChannel(this); + + return aChannel ? KErrNone : KErrNoMemory; +} + +TInt DSVPSnapDriverFactory::Install() +{ + DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::Install()"); + + return(SetName(&KSVPSnapDriverName)); +} + +void DSVPSnapDriverFactory::GetCaps(TDes8& aDes) const +{ + DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory::GetCaps()"); + + TCapsSVPSnapDriver b; + b.iVersion = TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber); + aDes.FillZ(aDes.MaxLength()); + aDes.Copy((TUint8 *)&b, Min(aDes.MaxLength(), sizeof(b))); +} + +// +// DSVPSnapChannel +// + +DSVPSnapChannel::DSVPSnapChannel(DLogicalDevice* aLogicalDevice) +{ + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DSVPSnapChannel()"); + + iDevice = aLogicalDevice; + + iClientThread = &Kern::CurrentThread(); + iClientThread->Open(); +} + +DSVPSnapChannel::~DSVPSnapChannel() +{ + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::~DSVPSnapChannel() ->"); + Kern::SafeClose((DObject*&)iClientThread, NULL); + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::~DSVPSnapChannel() <-"); +} + +TInt DSVPSnapChannel::DoCreate(TInt /*aUnit*/, const TDesC* anInfo, const TVersion& aVer) +{ + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCreate()"); + + if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), aVer)) + return KErrNotSupported; + + //Setup the driver for receiving client messages + SetDfcQ(Kern::DfcQue0()); + iMsgQ.Receive(); + + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCreate()- checking device"); + TUint id = ReadReg(ESnapshot_Id); + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCreate()- checked device- 0x%08x", id); + WriteReg(ESnapshot_Address, 0); + return KErrNone; +} + +void DSVPSnapChannel::DoCancel(TInt aReqNo) +{ + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoCancel() %x(%d)", aReqNo, aReqNo); +} + +TInt DSVPSnapChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2) +{ + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoRequest() %x(%d)", aReqNo, aReqNo); + + TInt err = KErrGeneral; + + switch(aReqNo) + { + case RSVPSnapDriver::ESaveVM: + DP("RSVPSnapDriver::ESaveVM"); + err = SaveVM((const TDesC8*)a1); + break; + case RSVPSnapDriver::ELoadVM: + DP("RSVPSnapDriver::ELoadVM"); + err= LoadVM((const TDesC8*)a1); + break; + default: + DP("default"); + err = KErrGeneral; + break; + } + + if (KErrNone != err) + DP("** (SVPSNAPDRIVER) Error %d from DoRequest", err); + + return err; +} + +TInt DSVPSnapChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2) +{ + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::DoControl(%d)", aFunction); + + TInt err = KErrGeneral; + /* There should be a good reason to use a control rather than a request. */ + + if (KErrNone != err) { + DP("** (SVPSNAPDRIVER) Error %d from control function", err); + } + + return err; +} + +void DSVPSnapChannel::HandleMsg(TMessageBase* aMsg) +{ + + TThreadMessage& m = *(TThreadMessage*)aMsg; + TInt id = m.iValue; + + DP("** (SVPSNAPDRIVER) DSVPSnapChannel::HandleMsg() %x(%d)", id, id); + + if (id == (TInt)ECloseMsg) + { + m.Complete(KErrNone, EFalse); + return; + } + if (id == KMaxTInt) + { + // DoCancel + DoCancel(m.Int0()); + m.Complete(KErrNone, ETrue); + return; + } + if (id < 0) + { + // DoRequest + TRequestStatus* pStatus = (TRequestStatus*)m.Ptr0(); + TInt r = DoRequest(~id, pStatus, m.Ptr1(), m.Ptr2()); + // if (r != KErrNone) + Kern::RequestComplete(iClientThread,pStatus,r); + m.Complete(KErrNone, ETrue); + } + else + { + // DoControl + TInt r = DoControl(id, m.Ptr0(), m.Ptr1()); + m.Complete(r, ETrue); + } +} + +TInt DSVPSnapChannel::SaveVM(const TDesC8* aData) +{ + DP("** DSVPSnapChannel::SaveVM()"); + + TInt err = KErrNone; + RET_IF_ERROR(err, Kern::ThreadDesRead(iClientThread, aData, iSendDataBuffer,0)); + TUint32 * ptr = (TUint32*) iSendDataBuffer.Ptr(); + + WriteReg(ESnapshot_Address, Epoc::LinearToPhysical((TUint32)ptr)); + WriteReg(ESnapshot_Length, (TUint32) (iSendDataBuffer.Length())); + WriteReg(ESnapshot_Trigger, RSVPSnapDriver::ESaveVM); + + return err; +} + +TInt DSVPSnapChannel::LoadVM(const TDesC8* aData) +{ + DP("** DSVPSnapChannel::LoadVM()"); + + TInt err = KErrNone; + RET_IF_ERROR(err, Kern::ThreadDesRead(iClientThread, aData, iSendDataBuffer,0)); + + TUint32 * ptr = (TUint32*) iSendDataBuffer.Ptr(); + WriteReg(ESnapshot_Address, Epoc::LinearToPhysical((TUint32)ptr)); + + return ReadReg(ESnapshot_Address); +} + +DECLARE_EXTENSION_LDD() +{ + // FIXME: Not needed? + DP("** (SVPSNAPDRIVER) DSVPSnapDriverFactory created"); + return new DSVPSnapDriverFactory; +} + +DECLARE_STANDARD_EXTENSION() +{ + DP("** (SVPSNAPDRIVER) SVPSnap extension entry point"); + TInt r; + DSVPSnapDriverFactory* device = new DSVPSnapDriverFactory; + if (device==NULL) + r=KErrNoMemory; + else + r=Kern::InstallLogicalDevice(device); + + return r; +} diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpsnapdriver/src/svpsnapdriver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpsnapdriver/src/svpsnapdriver.h Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SVPSNAPDRIVER_H +#define __SVPSNAPDRIVER_H + +#include // for DLogicalChannel + +#define SVPDBG +#ifdef SVPDBG +#define DP(format...) Kern::Printf(format) +#else +#define DP(format...) +#endif + +#define RET_IF_ERROR(v, e) { if ((v = (e)) != KErrNone) return v; } + +enum ESVPSnapReg { + ESnapshot_Id = 0, + ESnapshot_Address, + ESnapshot_Length, + ESnapshot_Trigger + }; + +class DSVPSnapDriverFactory : public DLogicalDevice +{ + public: + + DSVPSnapDriverFactory(); + virtual TInt Install(); + virtual void GetCaps(TDes8& aDes) const; + virtual TInt Create(DLogicalChannelBase*& aChannel); +}; + +class DSVPSnapChannel : public DLogicalChannel +{ + public: + + DSVPSnapChannel(DLogicalDevice* aLogicalDevice); + ~DSVPSnapChannel(); + + virtual TInt DoCreate(TInt aUnit, const TDesC* anInfo, const TVersion& aVer); + virtual void HandleMsg(TMessageBase* aMsg); + + protected: + virtual void DoCancel(TInt aReqNo); + virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); + virtual TInt DoControl(TInt aFunction, TAny *a1, TAny *a2); + + private: + TInt SaveVM(const TDesC8* aData); + TInt LoadVM(const TDesC8* aData); + +private: + DThread* iClientThread; + TDfcQue* iDFCQue; + + TBuf8<256> iSendDataBuffer; +}; + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/svpsnapdriver/svpsnapdriver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/svpsnapdriver/svpsnapdriver.mmp Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +//macro __KERNEL_MODE__ + +#include +#include + +systeminclude AsspNKernIncludePath + +systeminclude src + +target VariantTarget(svpsnapdriver,ldd) +linkas svpsnapdriver.ldd +targettype ldd + +sourcepath src +source svpsnapdriver.cpp + +noexportlibrary + +vendorid 0x70000001 +capability all diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/syborg-elf.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/syborg-elf.cfg Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,5 @@ +input = syborg_001.techview.img +logfile = syborg_001.techview.log +output = syborg_001.techview.elf +physical-address = 0x00000000 +drive = X: diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/syborg.dtb Binary file baseport/syborg/syborg.dtb has changed diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/syborg.dts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/syborg.dts Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,122 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu0: ARM,Cortex-A8@0 { + device_type = "cpu"; + reg = <0>; + }; + }; + memory@0 { + device_type = "memory"; + reg = <0 08000000>; + }; + syborg { + #address-cells = <1>; + #size-cells = <0>; + intc: intc@0 { + compatible = "syborg,interrupt"; + #interrupt-cells = <1>; + reg = ; + interrupt-controller; + qemu,interrupts = <&cpu0 0>; + num-interrupts = <20>; + }; + rtc@0 { + compatible = "syborg,rtc"; + reg = ; + }; + timer@0 { + compatible = "syborg,timer"; + reg = ; + frequency = ; + interrupts = <1>; + interrupt-parent = <&intc>; + }; + keyboard@0 { + compatible = "syborg,keyboard"; + reg = ; + interrupts = <2>; + interrupt-parent = <&intc>; + }; + touchscreen@0 { + compatible = "syborg,pointer"; + reg = ; + interrupts = <3>; + interrupt-parent = <&intc>; + }; + framebuffer@0 { + compatible = "syborg,framebuffer"; + reg = ; + interrupts = <4>; + interrupt-parent = <&intc>; + }; + serial@0 { + device_type = "serial"; + compatible = "syborg,serial"; + chardev = "serial0"; + reg = ; + interrupts = <5>; + interrupt-parent = <&intc>; + }; + serial@1 { + device_type = "serial"; + compatible = "syborg,serial"; + chardev = "serial1"; + reg = ; + interrupts = <6>; + interrupt-parent = <&intc>; + }; + serial@2 { + device_type = "serial"; + compatible = "syborg,serial"; + chardev = "serial2"; + reg = ; + interrupts = <7>; + interrupt-parent = <&intc>; + }; + serial@3 { + device_type = "serial"; + compatible = "syborg,serial"; + chardev = "serial3"; + reg = ; + interrupts = <8>; + interrupt-parent = <&intc>; + }; + hostfs@0 { + compatible = "syborg,hostfs"; + reg = ; + host-path = "\\svphostfs\\"; + drive-number = ; + }; + ss@0 { + compatible = "syborg,snapshot"; + reg = ; + }; + net@0 { + compatible = "syborg,virtio-net"; + reg = ; + interrupts = <9>; + interrupt-parent = <&intc>; + }; + nand@0 { + compatible = "syborg,nand"; + reg = ; + size = <400>; + }; + audio@0 { + compatible = "syborg,virtio-audio"; + reg = ; + interrupts = ; + interrupt-parent = <&intc>; + }; + platform@0 { + compatible = "syborg,platform"; + reg = ; + }; + }; +}; + diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/syborg.oby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/syborg.oby Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SYBORG_OBY__ +#define __SYBORG_OBY__ + +define LANGID 01 +define BUILDNO 0 +define VERSION 0.01 + +DEFAULT_LANGUAGE 01 + +REM #undef _ARM4 +REM #define _ARM4 + +#define __SYBORG__ +#define __ARM_HW_PLATFORM__ +#define SYMBIAN_EXCLUDE_MTP + +define SYBORG_L1 0x0b0a0001 +define VARIANT syborg +define VARID SYBORG_L1 +define ASSP_DIR EPOCROOT##epoc32\release\syborg +define ROMMEGS 15 /* !! HEX !! */ +define PLATFORM_NAME syborg + +#define COLOR + +REM defines for IrDA options +REM Uncomment the line below to enable IrDA to use a Jeteye ESI09680 pod with serial card adapter +REM #define _ENABLE_IRDA_POD_ +REM define which port IrDA uses +define IRPOD_ESK irda_port1.esk + +REM define which serial port Bluetooth protocol uses +define BLUETOOTH_ESK bt_port2.esk + +REM Define whether or not to include USB client support: +//#define EUSBC + +ROMBUILD_OPTION -no-header + +#endif diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/test/ABLD.BAT --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/test/ABLD.BAT Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,15 @@ +@ECHO OFF + +REM Bldmake-generated batch file - ABLD.BAT +REM ** DO NOT EDIT ** + +perl -S ABLD.PL "\src\cedar\generic\base\syborg\test\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 +if errorlevel==1 goto CheckPerl +goto End + +:CheckPerl +perl -v >NUL +if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? +goto End + +:End diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/test/autoexec.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/test/autoexec.bat Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,5 @@ +z: +cd test +rem runtests e32test.auto.bat +rem format c: +rem runtests f32test.auto.bat -d c diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/test/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/test/bld.inf Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +PRJ_PLATFORMS +ARMV5 + +PRJ_TESTEXPORTS +autoexec.bat \epoc32\rom\syborg\ // + +PRJ_TESTMMPFILES + +// Drivers +// requires baseport specific definitions for TIMER and TimeDelta in d_mstim.cpp +..\..\e32test\group\d_mstim support +// requires baseport specific definitions for TIMER and TimeDelta and LongTimeDelta in d_tick.cpp +..\..\e32test\group\d_tick support +// requires definitions for KTickPeriodMs and KTicksPerMillisecond. These are baseport specific and require changes to d_latncy +..\..\e32test\group\d_latncy support +..\..\e32test\group\d_shadow support +..\..\e32test\group\bm_pdd support +//..\..\e32test\group\d_sharedio support +// needs dma.dll +//..\..\e32test\group\d_dma support // DMA kernel-side test harness for real DMA framework +// needs epbusm.dll +//..\..\e32test\group\d_medch support +..\..\e32test\group\d_cache support diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/test/variant_test.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/test/variant_test.mmh Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#define BUILD_TESTS + +#include <..\variant.mmh> + +SYSTEMINCLUDE AsspNKernIncludePath diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/trk_l1.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/trk_l1.ini Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,6 @@ +[SERIALCOMM] +PDD EUART1 +LDD ECOMM +CSY ECUART +PORT 1 +RATE 115200 diff -r 2fb8b9db1c86 -r d55eb581a87c baseport/syborg/variant.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/variant.mmh Tue Aug 04 10:28:23 2009 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +//macro __CPU_ARM926J__ +//#define __CPU__ ARM926EJ-S + +//macro __CPU_ARM1136__ + +//#define __CPU_ARM1176__ + +macro __CPU_CORTEX_A8N__ +macro __VFP_V3 +#define SYBORG +macro __SYBORG__ + +#define MM_MULTIPLE +//#define MM_FLEXIBLE + +// TO DO: decide if we need to switch these on or off!! +// +// Uncomment the following line if using the r1p0 release or later of the ARM1136 processor. +// +//#define __CPU_ARM1136_IS_R1__ +// + +/* Uncomment if ARM1136 Erratum 351912 + * "VFP11 double precision multiply can corrupt data" + * is fixed on this hardware. + */ +//macro __CPU_ARM1136_ERRATUM_351912_FIXED + +/* Uncomment if ARM1136 Erratum 353494 + * "Rare conditions can cause corruption of the Instruction Cache" + * is fixed on this hardware. + */ +//macro __CPU_ARM1136_ERRATUM_353494_FIXED + +/* Uncomment if ARM1136 Erratum 371025 + * "Invalidate Instruction Cache operation can fail" + * is fixed on this hardware. + */ +//macro __CPU_ARM1136_ERRATUM_371025_FIXED + +/* Uncomment if using ARM1136 processor and ARM1136 Erratum 399234 + * "Write back data cache entry evicted by write through entry causes data corruption" + * is fixed on this hardware. + * Workaround + * The erratum may be avoided by marking all cacheable memory as one of write through or write back. + * This requires the memory attributes described in the translation tables to be modified by software + * appropriately, or the use of the remapping capability to remap write through regions to non cacheable. + * If this macro is enabled, it should be acompanied by: + * GBLL CFG_CPU_ARM1136_ERRATUM_399234_FIXED in config.inc + */ +//macro __CPU_ARM1136_ERRATUM_399234_FIXED + +/* Uncomment if ARM1136 Erratum 408022 "Cancelled write to CONTEXTID register might update ASID" + * is fixed on this hardware. + */ +//macro __CPU_ARM1136_ERRATUM_408022_FIXED + +// TO DO: +// +// Uncomment the next line if using the ARM1136 processor and ARM1136 Erratum 406973 +// "CLREX instruction might be ignored during data cache line fill" +// is fixed on this hardware. +// +//#define __CPU_ARM1136_ERRATUM_406973_FIXED + + +// Uncomment if: +// 1) using ARM1136 processor and ARM1136 Erratum 411920: "Invalidate Entire Instruction Cache +// operation might fail to invalidate some lines if coincident with linefill" +// is fixed on this hardware, or +// 2) using ARM1176 processor and ARM1176 Erratum 415045: "Invalidate Entire Instruction Cache +// operation might fail to invalidate some lines if coincident with linefill +// is fixed on this hardware. +// Workaround: +// 1) Disables the use of of prefetch range cache operations by setting RV bit in Auxiliary Ctrl Reg. +// 2) Replaces Invalidate ICache operation with the sequence defined in the errata document. +// If this macro is enabled, it should be accompanied by: +// "GBLL CFG_CPU_ARM1136_ERRATUM_411920_FIXED" in variant.mmh +// +//macro __CPU_ARM1136_ERRATUM_411920_FIXED + + + +macro __CPU_HAS_VFP +#define USE_VFP_MATH +// !@! not moving when 1136 +//#define MM_MOVING +macro __DEBUGGER_SUPPORT__ +macro FASTTRACE_KERNEL_ALL +macro __EMI_SUPPORT__ + +#define VariantTarget(name,ext) _syborg_##name##.##ext +#define AsspNKernIncludePath \..\..\src\cedar\generic\base\syborg\specific +#define VariantMediaDefIncludePath AsspNKernIncludePath +#define PlatformLib kasyborg.lib + +systeminclude \epoc32\include\memmodel\epoc\mmubase +//systeminclude \epoc32\include\memmodel\epoc\moving +//systeminclude \epoc32\include\memmodel\epoc\moving\arm +//systeminclude \epoc32\include\memmodel\epoc\flexible +//systeminclude \epoc32\include\memmodel\epoc\flexible\arm +systeminclude \epoc32\include\memmodel\epoc\multiple +systeminclude \epoc32\include\memmodel\epoc\multiple\arm + +systeminclude ..\soc\interface + +// Uncomment for T_USERCOMDEB test +//#define BUILD_TESTS + +#ifdef BUILD_TESTS +macro BTRACE_KERNEL_ALL +#endif + +//OPTION_REPLACE ARMCC --cpu __CPU__ +//OPTION_REPLACE ARMASM --cpu __CPU__