Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: mem_intf.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | #ifndef __IOMEM_INTF_H__ | |
24 | #define __IOMEM_INTF_H__ | |
25 | ||
26 | #include <stdio.h> | |
27 | ||
28 | class ioMemIntf{ | |
29 | public: | |
30 | ||
31 | // the address is taken to be the relative address from | |
32 | // the start of the memory segment which is always 0. | |
33 | // the caller must translate the absolute address to the start of this | |
34 | // segment before calling the routines below. | |
35 | ||
36 | // id to be used for debug messages, routine printf's etc | |
37 | virtual void setId( const char * name ) = 0; | |
38 | ||
39 | virtual void st8( uint64_t addr, uint8_t data ) = 0; | |
40 | virtual void st16( uint64_t addr, uint16_t data ) = 0; | |
41 | virtual void st32( uint64_t addr, uint32_t data ) = 0; | |
42 | virtual void st64_nl( uint64_t addr, uint64_t data ) = 0; | |
43 | virtual void st64 ( uint64_t addr, uint64_t data ) = 0; | |
44 | virtual void st128( uint64_t addr, uint64_t data[2] ) = 0; | |
45 | virtual void st512( uint64_t addr, uint64_t data[8] ) = 0; | |
46 | ||
47 | virtual uint8_t ld8u ( uint64_t addr ) = 0; | |
48 | virtual int8_t ld8s( uint64_t addr ) = 0; | |
49 | virtual uint16_t ld16u( uint64_t addr ) = 0; | |
50 | virtual int16_t ld16s( uint64_t addr ) = 0; | |
51 | virtual uint32_t ld32u( uint64_t addr ) = 0; | |
52 | virtual int32_t ld32s( uint64_t addr ) = 0; | |
53 | virtual uint64_t ld64( uint64_t addr ) = 0; | |
54 | virtual void ld128( uint64_t addr, uint64_t data[2] ) = 0; | |
55 | virtual void ld256( uint64_t addr, uint64_t data[4] ) = 0; | |
56 | virtual void ld512( uint64_t addr, uint64_t data[8] ) = 0; | |
57 | ||
58 | virtual int load_img( const char* mem_image_filename, uint64_t start_pa ) = 0; | |
59 | virtual int load_bin( const char *file, uint64_t addr) = 0; | |
60 | virtual int load_elf( const char *filename, uint64_t base_pa ) = 0; | |
61 | ||
62 | ||
63 | // dump/restore memory into a file | |
64 | virtual int dump ( FILE * fp ) = 0; | |
65 | virtual int restore ( FILE * fp ) = 0; | |
66 | ||
67 | // save a chunk of mem contents into 'filename' | |
68 | virtual int save ( const char * filename, uint64_t addr = 0, uint64_t size = 0); | |
69 | }; | |
70 | ||
71 | #endif // __IOMEM_INTF_H__ |