VirtualComponentInterface.h 7.17 KB

//=========================================================
// Copyright 2001 VAutomation Inc. Nashua NH USA. All rights reserved.
// This software is provided under license and contains proprietary   
// and confidential material which is the property of VAutomation Inc.
// HTTP://www.vautomation.com											
//==========================================================
//
//  Class Name:	CVirtualComponentInterface
//  Author:  
//  Company:  VAutomation An Arc Cores Company
//  Date created:  2/01/2001 at 9:46
//
//
//==========================================================
//
//  Notes: This file should not modified. It is designed to 
//  compile under a wide range of compilers and any addtional
//  dependencies may defeat the purpose of its structure.
//
//
//
//==========================================================
#ifndef __CVIRTUALCOMPONENTINTERFACE__
#define __CVIRTUALCOMPONENTINTERFACE__

//=========================================================
// Member Varible Includes
//=========================================================



//=========================================================
//             HEADER INCLUDE FILE SECTION
//=========================================================
#include "DataTypes.h"

//=========================================================
//                       TYPES
//=========================================================

//=========================================================
//These device types are used to direct the BFM signal connections in the simulation.
//The BFM will use these types to figure out what types of signals need to be connected to
//to send and receive data from the CVirtualComponentInterface object and/or if  memory will
//with a slave interface will need to be modeled.
//
// Note 1) When this is used with an embedded processor implementation the bus types are ignored since 
//	 the software typically has no concept of underlying bus architecture. That is, when
//	this CVirtualComponentInterface wrapper is implemented for an embedded processor
//	this type is ignored for the most part. 
//=========================================================

enum VCDeviceType{ 
				   BVCI_INITIATOR,									
				   BVCI_TARGET,										//Should not be used for embedded processor code
				   BVCI_TARGET_CONNECTED_TO_HOST_MEMORY_DEVICE,		
				   BVCI_TARGET_CONNECTED_TO_DMA_DEVICE,				
				   AMBA_AHB_MASTER,									
				   AMBA_AHB_SLAVE,									//Should not be used for embedded processor code
				   AMBA_AHB_SLAVE_CONNECTED_TO_HOST_MEMORY_DEVICE,	
				   AMBA_AHB_SLAVE_CONNECTED_TO_DMA_DEVICE,	
				   AMBA_APB_MASTER,									
				   AMBA_APB_SLAVE,									//Should not be used for embedded processor code
				   AMBA_APB_SLAVE_CONNECTED_TO_HOST_MEMORY_DEVICE,	
				   AMBA_APB_SLAVE_CONNECTED_TO_DMA_DEVICE,	
				   DIGITAL_OUTPUT_32BIT,							
				   DIGITAL_INPUT_32BIT,								//Should not be used for embedded processor code
				   DIGITAL_OUTPUT_8BIT,								
				   DIGITAL_INPUT_8BIT								//Should not be used for embedded processor code
				};

//=========================================================
//                       FUNCTIONS TYPES
//=========================================================

//=========================================================
// These functions are used to handle slave or target accesses in the absence of a memory model typically.
// These callbacks should not be used for embedded processor code since an embedded processor has no
// concept of memory access detection. These function types are used strictly for BFM simulations where the 
// concept of a memory is absent. For example, these functions may do data score boarding for read and write 
// operations.
//=========================================================
typedef bool ReadOperationCallbackType( const char* source_id_str, const AddressType& address, UnSignedLong &data );
typedef bool WriteOperationCallbackType( const char* source_id_str, const AddressType& address, const UnSignedLong &data );

//=========================================================
//
// Class Comments:
// 
// This class is used as a wrapper for memory accesses to a particular interface in a system. The intent of 
// the implementation is to segment accesses for a particular peripheral in the system. The wrapper provides 
// an interface that will direct traffic to another hardware interface in the system. For example, an object 
// of this class type might implement an interface for accesses to a BVCI target on a particular device in 
// the system using a BVCI_INITIATOR as a device type. 
//
// The separation of the interfaces allows the use of bus functional models in simulation. The abstract 
// concept of a connection to a remote interface is made using a class interface. The implementation 
// of this class provides a connection to another interface in the system.
//
// 	
// 
// Public function comments:
//
//		Create - This must be call before any other function is called. 
//
//		WriteBuffer - Transfers data from the source location to the destination location like memcpy, 
//			destination address is typically an address of a device interface when writing emmbeded processor code.
//
//		ReadBuffer - Transfers data from the source location to the destination location like memcpy,
//			source addressis typically an address of a device interface when writing emmbeded processor code.
//
//		DeviceGetName - Get the device name passed in at creation time. This name is useful for error and status messages.
//	
//		SetCallbacks, SetAttribute, GetAttribute are functions used for code that will not be re-hosted to a processor.
// 
// Private function comments:
// 
// 
// Protected function comments:
// 
// 
//=========================================================

class CVirtualComponentInterface
{

  public:

	// Member functions used in both simulation and embedded prcessor implimentations.
	bool Create( char *device_name, VCDeviceType device_type  );
	bool WriteBuffer( const AddressType& dest_address, const AddressType& src_address, const UnSignedLong& byte_count , const bool asynchronous_operation=false);
	bool ReadBuffer( const AddressType& dest_address, const AddressType& src_address, const UnSignedLong& byte_count, const bool asynchronous_operation=false);
	const char *DeviceGetName();
	
	//Member functions used when embedded processor re-hosting is not needed.
	bool SetCallbacks( ReadOperationCallbackType *read_func, WriteOperationCallbackType *write_func );
	bool SetAttribute( char* attribute_name, char* value );
	bool GetAttribute( char* attribute_name, char* value );
	
	// Member functions default overrides
	CVirtualComponentInterface( ); // Default constructor
	virtual ~CVirtualComponentInterface( ); // Destructor

	// Operator Members

	// GetCopy Member Functions

	// Set Member Functions


  public:

	// Member varibles


  private:

	// Member functions


  private:

	// Member varibles
	VCDeviceType m_device_type;  // The type of interface this object will impliment.
	void *m_internal_info_pointer; //Internal information that is hidden in the implimentation.


  protected:

	// Member functions
	
  protected:

	// Member varibles


  public:

	// Friend functions

};

#endif

//=========================================================