~ubuntu-branches/ubuntu/lucid/skyeye/lucid-proposed

« back to all changes in this revision

Viewing changes to arch/bfin/common/iomem.c

  • Committer: Bazaar Package Importer
  • Author(s): Yu Guanghui
  • Date: 2007-08-07 13:25:49 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20070807132549-96159k1obat1fxr0
Tags: 1.2.3-1
* New upstream release
* Added NO_BFD=1, don't require libbfd now. (Closes:Bug#423933) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
        iomem.c - implementation of read/write function for blackfin simulation 
 
3
        Copyright (C) 2003 Skyeye Develop Group
 
4
        for help please send mail to <skyeye-developer@lists.sf.linuxforum.net>
 
5
 
 
6
        This program is free software; you can redistribute it and/or modify
 
7
        it under the terms of the GNU General Public License as published by
 
8
        the Free Software Foundation; either version 2 of the License, or
 
9
        (at your option) any later version.
 
10
 
 
11
        This program is distributed in the hope that it will be useful,
 
12
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
        GNU General Public License for more details.
 
15
 
 
16
        You should have received a copy of the GNU General Public License
 
17
        along with this program; if not, write to the Free Software
 
18
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 
 
20
*/
 
21
/*
 
22
 * 12/16/2006   Michael.Kang  <blackfin.kang@gmail.com>
 
23
 */
1
24
 
2
25
#include "bfin-sim.h"
3
26
#include "types.h"
4
 
#include "mach.h"
5
27
#include "mem_map.h"
6
28
#include <signal.h>
7
 
 
 
29
#include <skyeye_config.h>
 
30
bu32
 
31
get_long (unsigned char *memory, bu32 addr);
8
32
//#define IO_ERR {printf("\n%s io error!addr=0x%x\n",__FUNCTION__,addr);exit(-1);}
9
33
 
10
 
#define IO_ERR {printf("\n%s io error!addr=0x%x,pc=0x%x,oldpc=0x%x,sp=0x%x\n",__FUNCTION__,addr,PCREG,OLDPCREG,SPREG);}
 
34
#define IO_ERR {printf("\n%s io error!addr=0x%x,pc=0x%x,oldpc=0x%x,sp=0x%x,insn@pc=0x%x\n",__FUNCTION__,addr,PCREG,OLDPCREG,SPREG,get_long(saved_state.memory,PCREG));exit(-1);}
 
35
 
11
36
 
12
37
static void
13
38
isram_write_word (bu32 addr, bu16 v)
124
149
void
125
150
put_byte (unsigned char *memory, bu32 addr, bu8 v)
126
151
{
127
 
        if(addr == 0xc0900){    
128
 
                fprintf(PF,"KSDBG:addr=0xc0900,PC=0x%x\n",PCREG);
129
 
        }
130
152
        if ((addr >= IO_START) && (addr < IO_END)) {
131
 
                saved_state.p_mach->io_write_byte (addr, v);
 
153
                skyeye_config.mach->mach_io_write_byte (&saved_state, addr, v);
132
154
 
133
155
        }
134
156
        else if (addr >= ISRAM_START && addr < ISRAM_END) {
155
177
void
156
178
put_word (unsigned char *memory, bu32 addr, bu16 v)
157
179
{
158
 
        if(addr == 0xc0900){    
159
 
                fprintf(PF,"KSDBG:addr=0xc0900,PC=0x%x\n",PCREG);
160
 
        }
161
180
        if ((addr >= IO_START) && (addr < IO_END)) {
162
 
                saved_state.p_mach->io_write_word (addr, v);
 
181
                skyeye_config.mach->mach_io_write_halfword (&saved_state, addr, v);
163
182
        }
164
183
        else if (addr >= ISRAM_START && addr < ISRAM_END) {
165
184
                IO_ERR;
182
201
void
183
202
put_long (unsigned char *memory, bu32 addr, bu32 v)
184
203
{
185
 
        if(addr == 0xc0900){    
186
 
                fprintf(PF,"KSDBG:addr=0xc0900,v=0x%x,PC=0x%x\n", v, PCREG);
187
 
        }
188
204
        if ((addr > IO_START) && (addr < IO_END)) {
189
 
                saved_state.p_mach->io_write_long (addr, v);
 
205
                skyeye_config.mach->mach_io_write_word (&saved_state, addr, v);
190
206
        } // PSW 061606
191
207
        else if (addr >= SSRAM_START && addr < SSRAM_END) {
192
208
                ssram_write_long (addr, v);
208
224
get_byte (unsigned char *memory, bu32 addr)
209
225
{
210
226
        if ((addr >= IO_START) && (addr < IO_END)) {
211
 
                return saved_state.p_mach->io_read_byte (addr);
 
227
                return skyeye_config.mach->mach_io_read_byte (&saved_state, addr);
212
228
        }
213
229
        else if (addr >= ISRAM_START && addr < ISRAM_END) {
214
230
                return isram_read_byte (addr);
230
246
get_word (unsigned char *memory, bu32 addr)
231
247
{
232
248
        if ((addr >= IO_START) && (addr < IO_END)) {
233
 
                return saved_state.p_mach->io_read_word (addr);
 
249
                return skyeye_config.mach->mach_io_read_halfword (&saved_state, addr);
234
250
        }
235
251
        else if (addr >= ISRAM_START && addr < ISRAM_END) {
236
252
                return isram_read_word (addr);
251
267
get_long (unsigned char *memory, bu32 addr)
252
268
{
253
269
        if ((addr >= IO_START) && (addr < IO_END)) {
254
 
                return saved_state.p_mach->io_read_long (addr);
 
270
                return skyeye_config.mach->mach_io_read_word (&saved_state, addr);
255
271
        }
256
272
        else if (addr >= ISRAM_START && addr < ISRAM_END) {
257
273
                IO_ERR;