vghwinterface/vghwdriver/ldd/src/virtualvideohwinterface.cpp
branchbug235_bringup_0
changeset 56 40cc73c24bf8
parent 51 4f400a6ea71f
equal deleted inserted replaced
55:09263774e342 56:40cc73c24bf8
    19 #include <kern_priv.h>
    19 #include <kern_priv.h>
    20 
    20 
    21 #include <graphics/guestvideodriverinterfaceconstants.h>
    21 #include <graphics/guestvideodriverinterfaceconstants.h>
    22 #include <graphics/virtualvideohwinterface.h>
    22 #include <graphics/virtualvideohwinterface.h>
    23 #include <graphics/virtualvideotracing.h>
    23 #include <graphics/virtualvideotracing.h>
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 #ifdef FIXED_MEMORY_LOCATION
       
    28 _LIT( KVirtualVideoHwInterfacePanic, "DVirtualVideoHwInterface" );
       
    29 #else
    24 #include "syborg.h"
    30 #include "syborg.h"
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 #ifdef PLATSIM_CONFIG
       
    29 _LIT( KVirtualVideoHwInterfacePanic, "DVirtualVideoHwInterface" );
       
    30 #endif
    31 #endif
    31 
    32 
    32 // ============================ LOCAL DATA TYPES ===============================
    33 // ============================ LOCAL DATA TYPES ===============================
    33 
    34 
    34 TPhysAddr DVirtualVideoHwInterface::iVideoRamBasePhys = NULL;
    35 TPhysAddr DVirtualVideoHwInterface::iVideoRamBasePhys = NULL;
    73     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()>");
    74     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()>");
    74     iInputParametersMemoryChunk = NULL;
    75     iInputParametersMemoryChunk = NULL;
    75     iOutputParametersMemoryChunk = NULL;
    76     iOutputParametersMemoryChunk = NULL;
    76     iRegisterMemoryChunk = NULL;
    77     iRegisterMemoryChunk = NULL;
    77 
    78 
    78 #ifdef PLATSIM_CONFIG
    79 #ifdef FIXED_MEMORY_LOCATION
    79 	iVideoRamBasePhys = VVI_BASE;
    80 	iVideoRamBasePhys = VVI_BASE;
    80 #else
    81 #else
    81 	// Reserve a contiguous memory chunk for graphics usage
    82 	// Reserve a contiguous memory chunk for graphics usage
    82 	TUint32 ramSize = VVI_PARAMETERS_INPUT_MEMORY_SIZE +
    83 	TUint32 ramSize = VVI_PARAMETERS_INPUT_MEMORY_SIZE +
    83 						VVI_PARAMETERS_OUTPUT_MEMORY_SIZE + 
    84 						VVI_PARAMETERS_OUTPUT_MEMORY_SIZE + 
    90 		Kern::Fault("DVirtualVideoHwInterface Allocate Ram %d",r);
    91 		Kern::Fault("DVirtualVideoHwInterface Allocate Ram %d",r);
    91 		}
    92 		}
    92  	SetSharedCmdMemBase( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS );
    93  	SetSharedCmdMemBase( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS );
    93 	SetSharedSurfacebufferMemBase( iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS );
    94 	SetSharedSurfacebufferMemBase( iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS );
    94 
    95 
    95 #endif // PLATSIM_CONFIG
    96 #endif // FIXED_MEMORY_LOCATION
    96     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()<");
    97     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()<");
    97     }
    98     }
    98 
    99 
    99 
   100 
   100 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
   143             iOutputParametersChunkKernelAddress );    
   144             iOutputParametersChunkKernelAddress );    
   144     }
   145     }
   145 
   146 
   146 TInt DVirtualVideoHwInterface::InitRegisterMemory()
   147 TInt DVirtualVideoHwInterface::InitRegisterMemory()
   147     {
   148     {
   148 #ifdef PLATSIM_CONFIG
   149 #ifdef FIXED_MEMORY_LOCATION
   149     return InitPhysicalMemory( VVI_REGISTERS_BASE_ADDRESS, 
   150     return InitPhysicalMemory( VVI_REGISTERS_BASE_ADDRESS, 
   150             VVI_REGISTERS_MEMORY_SIZE, iRegisterMemoryChunk, 
   151             VVI_REGISTERS_MEMORY_SIZE, iRegisterMemoryChunk, 
   151             iRegisterChunkKernelAddress );        
   152             iRegisterChunkKernelAddress );        
   152 #else
   153 #else
   153     return KErrNone;    
   154     return KErrNone;    
   154 #endif // PLATSIM_CONFIG	
   155 #endif // FIXED_MEMORY_LOCATION	
   155     }
   156     }
   156 
   157 
   157 // -----------------------------------------------------------------------------
   158 // -----------------------------------------------------------------------------
   158 // DVirtualVideoHwInterface::InitPhysicalMemory
   159 // DVirtualVideoHwInterface::InitPhysicalMemory
   159 // -----------------------------------------------------------------------------
   160 // -----------------------------------------------------------------------------
   278         TUint32* ptr = reinterpret_cast<TUint32*>( iRegisterChunkKernelAddress + offset );
   279         TUint32* ptr = reinterpret_cast<TUint32*>( iRegisterChunkKernelAddress + offset );
   279         aValue = *ptr;
   280         aValue = *ptr;
   280         }
   281         }
   281     else
   282     else
   282         {
   283         {
   283 #ifdef PLATSIM_CONFIG
   284 #ifdef FIXED_MEMORY_LOCATION
   284         Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady );
   285         Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady );
   285 #else
   286 #else
   286         TLinAddr offset = RegisterOffset( aRegister );
   287         TLinAddr offset = RegisterOffset( aRegister );
   287 		aValue = ReadReg( KHwGraphicsRegBase, offset );
   288 		aValue = ReadReg( KHwGraphicsRegBase, offset );
   288 #endif // PLATSIM_CONFIG
   289 #endif // FIXED_MEMORY_LOCATION
   289         }
   290         }
   290     }
   291     }
   291 
   292 
   292 
   293 
   293 // -----------------------------------------------------------------------------
   294 // -----------------------------------------------------------------------------
   304         TUint32* ptr = reinterpret_cast<TUint32*>( iRegisterChunkKernelAddress + offset );
   305         TUint32* ptr = reinterpret_cast<TUint32*>( iRegisterChunkKernelAddress + offset );
   305         *ptr = aValue;
   306         *ptr = aValue;
   306         }
   307         }
   307     else
   308     else
   308         {
   309         {
   309 #ifdef PLATSIM_CONFIG
   310 #ifdef FIXED_MEMORY_LOCATION
   310         Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady );
   311         Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady );
   311 #else
   312 #else
   312         TLinAddr offset = RegisterOffset( aRegister );
   313         TLinAddr offset = RegisterOffset( aRegister );
   313 		WriteReg( KHwGraphicsRegBase, offset, aValue );
   314 		WriteReg( KHwGraphicsRegBase, offset, aValue );
   314 #endif // PLATSIM_CONFIG
   315 #endif // FIXED_MEMORY_LOCATION
   315         }
   316         }
   316     }
   317     }
   317 
   318 
   318 EXPORT_C TPhysAddr  DVirtualVideoHwInterface::GetSurfaceBufferBase()
   319 EXPORT_C TPhysAddr  DVirtualVideoHwInterface::GetSurfaceBufferBase()
   319 	{
   320 	{