graphics_plat/guestvideodriver_api/ldd/inc/virtualvideohwinterface.h
branchbug235_bringup_0
changeset 167 b9003303ce25
parent 165 3899db667a38
child 185 c4bff43bf8eb
equal deleted inserted replaced
166:82f54ddc6d9b 167:b9003303ce25
    25  * interface. Intended to be instantiated only once in the device driver.
    25  * interface. Intended to be instantiated only once in the device driver.
    26  */
    26  */
    27 class DVirtualVideoHwInterface : public DBase
    27 class DVirtualVideoHwInterface : public DBase
    28     {
    28     {
    29     public: // Data types
    29     public: // Data types
    30 	
    30     
    31 	/**
    31     /**
    32 	 * Enumeration for different interrupts.
    32      * Enumeration for different interrupts.
    33 	 */
    33      */
    34 	enum TInterrupt
    34     enum TInterrupt
    35 	    {
    35         {
    36 	    EInterruptNewDataAvailable  = 0x01 ///< Video HW has new data available
    36         EInterruptNewDataAvailable  = 0x01 ///< Video HW has new data available
    37 	    };
    37         };
    38 	/**
    38     /**
    39 	 * Enumeration for different registers.
    39      * Enumeration for different registers.
    40 	 */
    40      */
    41 	enum TRegister
    41     enum TRegister
    42 	    {
    42         {
    43 	    ERegId,			     ///< Id register
    43         ERegId,              ///< Id register
    44 	    ERegIrqEnable,		      ///< IRQ enabling register
    44         ERegIrqEnable,            ///< IRQ enabling register
    45 	    ERegIrqStatus,		      ///< IRQ status register
    45         ERegIrqStatus,            ///< IRQ status register
    46 	    ERegCommand,			///< Command register
    46         ERegCommand,            ///< Command register
    47 	    ERegParameterLoad,
    47         ERegParameterLoad,
    48 	    ERegError,			 ///< 
    48         ERegError,           ///< 
    49 	    ERegInputBufferTail,
    49         ERegInputBufferTail,
    50 	    ERegInputBufferHead,
    50         ERegInputBufferHead,
    51 	    ERegInputBufferReadCount,
    51         ERegInputBufferReadCount,
    52 	    ERegInputBufferWriteCount,
    52         ERegInputBufferWriteCount,
    53 	    ERegInputBufferMaxTail,
    53         ERegInputBufferMaxTail,
    54 	    ERegRequestId,
    54         ERegRequestId,
    55 		ERegSharedCmdMemBase,
    55         ERegSharedCmdMemBase,
    56 		ERegSharedFramebufferMemBase,
    56         ERegSharedFramebufferMemBase,
    57 	    ENumRegisters		       ///< Number of registers						
    57         ENumRegisters              ///< Number of registers                     
    58 	    
    58         
    59 	    };
    59         };
    60 
    60 
    61     public: // Construction and destruction
    61     public: // Construction and destruction
    62 
    62 
    63 	/**
    63     /**
    64 	 * Constructor.
    64      * Constructor.
    65 	 */
    65      */
    66 	DVirtualVideoHwInterface();
    66     DVirtualVideoHwInterface();
    67 
    67 
    68 	/**
    68     /**
    69 	 * Destructor.
    69      * Destructor.
    70 	 * NOTE: Enters and leaves critical section.
    70      * NOTE: Enters and leaves critical section.
    71 	 */
    71      */
    72 	virtual ~DVirtualVideoHwInterface();
    72     virtual ~DVirtualVideoHwInterface();
    73 
    73 
    74     public: // Functions
    74     public: // Functions
    75 
    75 
    76 
    76 
    77 	/**
    77     /**
    78 	 * Initializes the Virtual Video HW's memory mapped I/O model.
    78      * Initializes the Virtual Video HW's memory mapped I/O model.
    79 	 * NOTE: Enters and leaves critical section.
    79      * NOTE: Enters and leaves critical section.
    80 	 *
    80      *
    81 	 * @return System-wide error code
    81      * @return System-wide error code
    82 	 */
    82      */
    83 	TInt InitParametersInputMemory();
    83     TInt InitParametersInputMemory();
    84 	TInt InitParametersOutputMemory();
    84     TInt InitParametersOutputMemory();
    85 	
    85     
    86 	/**
    86     /**
    87 	 * Enables interrupts in the Virtual Video HW.
    87      * Enables interrupts in the Virtual Video HW.
    88 	 *
    88      *
    89 	 * @param aChannel The channel, whose interrupts are enabled
    89      * @param aChannel The channel, whose interrupts are enabled
    90 	 * @param aInterruptBitField A bitmask of TInterrupt enumeration.
    90      * @param aInterruptBitField A bitmask of TInterrupt enumeration.
    91 	 *      Enabled interrupt bits should be set to 1 and disabled interrupt
    91      *      Enabled interrupt bits should be set to 1 and disabled interrupt
    92 	 *      bits to 0.
    92      *      bits to 0.
    93 	 */
    93      */
    94 	void EnableInterrupts( TUint32 aInterruptBitField );
    94     void EnableInterrupts( TUint32 aInterruptBitField );
    95 	
    95     
    96 	/**
    96     /**
    97 	 * Initializes the Virtual Video HW's memory mapped I/O model.
    97      * Initializes the Virtual Video HW's memory mapped I/O model.
    98 	 * NOTE: Enters and leaves critical section.
    98      * NOTE: Enters and leaves critical section.
    99 	 *
    99      *
   100 	 * @return System-wide error code
   100      * @return System-wide error code
   101 	 */
   101      */
   102 	 TInt InitRegisterMemory();
   102      TInt InitRegisterMemory();
   103 	/**
   103     /**
   104 	 * Retrieves interrupt enabled state in the Virtual Video HW.
   104      * Retrieves interrupt enabled state in the Virtual Video HW.
   105 	 *
   105      *
   106 	 * @param aChannel The channel, whose interrupt states are queried
   106      * @param aChannel The channel, whose interrupt states are queried
   107 	 * @param aInterruptBitField A reference parameter, where a bitmask of
   107      * @param aInterruptBitField A reference parameter, where a bitmask of
   108 	 *      TInterrupt enumeration will be written. Enabled interrupt bits
   108      *      TInterrupt enumeration will be written. Enabled interrupt bits
   109 	 *      are set to 1 and disabled interrupt bits to 0.
   109      *      are set to 1 and disabled interrupt bits to 0.
   110 	 */
   110      */
   111 	void GetInterruptEnabledState( TUint32& aInterruptBitField );
   111     void GetInterruptEnabledState( TUint32& aInterruptBitField );
   112 
   112 
   113 	/**
   113     /**
   114 	 * Retrieves interrupt status in the Virtual Video HW.
   114      * Retrieves interrupt status in the Virtual Video HW.
   115 	 *
   115      *
   116 	 * @param aChannel The channel, whose interrupt status is queried
   116      * @param aChannel The channel, whose interrupt status is queried
   117 	 * @param aInterruptBitField A reference parameter, where a bitmask of
   117      * @param aInterruptBitField A reference parameter, where a bitmask of
   118 	 *      TInterrupt enumeration will be written. Those interrupt lines
   118      *      TInterrupt enumeration will be written. Those interrupt lines
   119 	 *      are active, whose bits are set to 1 in the bitmask.
   119      *      are active, whose bits are set to 1 in the bitmask.
   120 	 */
   120      */
   121 	void GetInterruptStatus( TUint32& aInterruptBitField );
   121     void GetInterruptStatus( TUint32& aInterruptBitField );
   122 
   122 
   123 	/**
   123     /**
   124 	 * Resets interrupt status in the Virtual Video HW.
   124      * Resets interrupt status in the Virtual Video HW.
   125 	 *
   125      *
   126 	 * @param aChannel The channel, whose interrupt statuses are being reset
   126      * @param aChannel The channel, whose interrupt statuses are being reset
   127 	 * @param aInterruptBitField The bitmask of TInterrupt enumeration. Those
   127      * @param aInterruptBitField The bitmask of TInterrupt enumeration. Those
   128 	 *      interrupts are reset, whose bits are set to 1 in the bitfield.
   128      *      interrupts are reset, whose bits are set to 1 in the bitfield.
   129 	 */
   129      */
   130 	void ResetInterruptStatus( TUint32 aInterruptBitField );
   130     void ResetInterruptStatus( TUint32 aInterruptBitField );
   131 	
   131     
   132 	/**
   132     /**
   133 	 * Issues a command to the Virtual Video HW.
   133      * Issues a command to the Virtual Video HW.
   134 	 *
   134      *
   135 	 * @param aCommand One of TCommand enumeration commands.
   135      * @param aCommand One of TCommand enumeration commands.
   136 	 */
   136      */
   137 	void IssueCommand( TUint32 aCommand );
   137     void IssueCommand( TUint32 aCommand );
   138 
   138 
   139 	/**
   139     /**
   140 	 * Set shared command memory base address.
   140      * Set shared command memory base address.
   141 	 *
   141      *
   142 	 * @param aPhysicalAddress Physical address of the contiguous memory area reserved for video device.
   142      * @param aPhysicalAddress Physical address of the contiguous memory area reserved for video device.
   143 	 */
   143      */
   144 	void SetSharedCmdMemBase( TUint32 aPhysicalAddress );
   144     void SetSharedCmdMemBase( TUint32 aPhysicalAddress );
   145 		
   145         
   146 	/**
   146     /**
   147 	 * Set shared framebuffer memory base address.
   147      * Set shared framebuffer memory base address.
   148 	 *
   148      *
   149 	 * @param aPhysicalAddress Physical address of the contiguous memory area reserved for video device.
   149      * @param aPhysicalAddress Physical address of the contiguous memory area reserved for video device.
   150 	 */
   150      */
   151 
   151 
   152 	void SetSharedFramebufferMemBase( TUint32 aPhysicalAddress );
   152     void SetSharedFramebufferMemBase( TUint32 aPhysicalAddress );
   153 	
   153     
   154 	/**
   154     /**
   155 	 * Address to input parameter buffer
   155      * Address to input parameter buffer
   156 	 */
   156      */
   157 	TLinAddr InputParametersAddress(){ return iInputParametersChunkKernelAddress; }
   157     TLinAddr InputParametersAddress(){ return iInputParametersChunkKernelAddress; }
   158 	
   158     
   159 	/**
   159     /**
   160 	 * Address to output parameter buffer
   160      * Address to output parameter buffer
   161 	 */
   161      */
   162 	TLinAddr OutputParametersAddress(){ return iOutputParametersChunkKernelAddress; }
   162     TLinAddr OutputParametersAddress(){ return iOutputParametersChunkKernelAddress; }
   163 
   163 
   164 	
   164     
   165 	/**
   165     /**
   166 	 * Gets a register value.
   166      * Gets a register value.
   167 	 * 
   167      * 
   168 	 * @param aRegisterRange The register range
   168      * @param aRegisterRange The register range
   169 	 * @param aRegister The register in the given register range, whose value is being read
   169      * @param aRegister The register in the given register range, whose value is being read
   170 	 * @param aValue A reference parameter, where the register's value is written
   170      * @param aValue A reference parameter, where the register's value is written
   171 	 */
   171      */
   172 	void GetRegisterValue(
   172     void GetRegisterValue(
   173 	    TRegister aRegister,
   173         TRegister aRegister,
   174 	    TUint32& aValue );
   174         TUint32& aValue );
   175 
   175 
   176 	/**
   176     /**
   177 	 * Sets a register value.
   177      * Sets a register value.
   178 	 * 
   178      * 
   179 	 * @param aRegisterRange The register range
   179      * @param aRegisterRange The register range
   180 	 * @param aRegister The register in the given register range, whose value is being written
   180      * @param aRegister The register in the given register range, whose value is being written
   181 	 * @param aValue A new value to be written into register
   181      * @param aValue A new value to be written into register
   182 	 */
   182      */
   183 	void SetRegisterValue( TRegister aRegister,
   183     void SetRegisterValue( TRegister aRegister,
   184 	    TUint32 aValue );
   184         TUint32 aValue );
   185 
   185 
   186 	IMPORT_C static TPhysAddr GetFrameBase();
   186     IMPORT_C static TPhysAddr GetFrameBase();
   187 
       
   188 	public:
       
   189         TPhysAddr iFrameRamPhys;
       
   190         static DVirtualVideoHwInterface * pVVHIf;
       
   191 
   187 
   192     protected:
   188     protected:
   193 
   189 
   194 	/**
   190     /**
   195 	 * Maps a virtual address range to physical address space
   191      * Maps a virtual address range to physical address space
   196 	 * 
   192      * 
   197 	 * @param aPhysicalAddress 
   193      * @param aPhysicalAddress 
   198 	 * @param aMaxSize 
   194      * @param aMaxSize 
   199 	 * @param aChunk
   195      * @param aChunk
   200 	 * @param aLinAddr 
   196      * @param aLinAddr 
   201 	 * @return System wide error code
   197      * @return System wide error code
   202 	 */
   198      */
   203 	TInt InitPhysicalMemory( TUint32 aPhysicalAddress, 
   199     TInt InitPhysicalMemory( TUint32 aPhysicalAddress, 
   204 		TInt aMaxSize, DChunk*& aChunk, TLinAddr& aLinAddr );
   200         TInt aMaxSize, DChunk*& aChunk, TLinAddr& aLinAddr );
   205 
   201 
   206     private: // Data
   202     private: // Data
   207 
   203 
   208 	/// A memory chunk that is mapped to the Virtual Video HW's physical memory area
   204     /// A memory chunk that is mapped to the Virtual Video HW's physical memory area
   209 	DChunk* iRegisterMemoryChunk;	
   205     DChunk* iRegisterMemoryChunk;   
   210 	/// The virtual start address of the Virtual Video HW's memory map
   206     /// The virtual start address of the Virtual Video HW's memory map
   211 	TLinAddr iRegisterChunkKernelAddress;
   207     TLinAddr iRegisterChunkKernelAddress;
   212 
   208 
   213 	/// A memory chunk that is mapped to the Virtual Video HW's physical memory area
   209     /// A memory chunk that is mapped to the Virtual Video HW's physical memory area
   214 	DChunk* iInputParametersMemoryChunk;	
   210     DChunk* iInputParametersMemoryChunk;    
   215 	/// The virtual start address of the Virtual Video HW's memory map
   211     /// The virtual start address of the Virtual Video HW's memory map
   216 	TLinAddr iInputParametersChunkKernelAddress;
   212     TLinAddr iInputParametersChunkKernelAddress;
   217 
   213 
   218 	/// A memory chunk that is mapped to the Virtual Video HW's physical memory area
   214     /// A memory chunk that is mapped to the Virtual Video HW's physical memory area
   219 	DChunk* iOutputParametersMemoryChunk;	
   215     DChunk* iOutputParametersMemoryChunk;        
   220 	/// The virtual start address of the Virtual Video HW's memory map
   216         
   221 	TLinAddr iOutputParametersChunkKernelAddress;
   217     /// The virtual start address of the Virtual Video HW's memory map
   222     TPhysAddr iVideoRamPhys;
   218     TLinAddr iOutputParametersChunkKernelAddress;
       
   219         
       
   220     /// The virtual graphics device physical base address
       
   221     static TPhysAddr iVideoRamBasePhys;
       
   222 
   223     };
   223     };
   224 
   224 
   225 
   225 
   226 #endif // VIRTUALVIDEOHWINTERFACE_H
   226 #endif // VIRTUALVIDEOHWINTERFACE_H