Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / ioram / include / mem_intf.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: mem_intf.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named program 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 work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
#ifndef __IOMEM_INTF_H__
#define __IOMEM_INTF_H__
#include <stdio.h>
class ioMemIntf{
public:
// the address is taken to be the relative address from
// the start of the memory segment which is always 0.
// the caller must translate the absolute address to the start of this
// segment before calling the routines below.
// id to be used for debug messages, routine printf's etc
virtual void setId( const char * name ) = 0;
virtual void st8( uint64_t addr, uint8_t data ) = 0;
virtual void st16( uint64_t addr, uint16_t data ) = 0;
virtual void st32( uint64_t addr, uint32_t data ) = 0;
virtual void st64_nl( uint64_t addr, uint64_t data ) = 0;
virtual void st64 ( uint64_t addr, uint64_t data ) = 0;
virtual void st128( uint64_t addr, uint64_t data[2] ) = 0;
virtual void st512( uint64_t addr, uint64_t data[8] ) = 0;
virtual uint8_t ld8u ( uint64_t addr ) = 0;
virtual int8_t ld8s( uint64_t addr ) = 0;
virtual uint16_t ld16u( uint64_t addr ) = 0;
virtual int16_t ld16s( uint64_t addr ) = 0;
virtual uint32_t ld32u( uint64_t addr ) = 0;
virtual int32_t ld32s( uint64_t addr ) = 0;
virtual uint64_t ld64( uint64_t addr ) = 0;
virtual void ld128( uint64_t addr, uint64_t data[2] ) = 0;
virtual void ld256( uint64_t addr, uint64_t data[4] ) = 0;
virtual void ld512( uint64_t addr, uint64_t data[8] ) = 0;
virtual int load_img( const char* mem_image_filename, uint64_t start_pa ) = 0;
virtual int load_bin( const char *file, uint64_t addr) = 0;
virtual int load_elf( const char *filename, uint64_t base_pa ) = 0;
// dump/restore memory into a file
virtual int dump ( FILE * fp ) = 0;
virtual int restore ( FILE * fp ) = 0;
// save a chunk of mem contents into 'filename'
virtual int save ( const char * filename, uint64_t addr = 0, uint64_t size = 0);
};
#endif // __IOMEM_INTF_H__