OVP Forums - A community of assistance, help, questions, and answers.
  FAQFAQ    SearchSearch      RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in
Callbacks for icmMapExternalMemory have abnormal behavior

 
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Getting started
View previous topic :: View next topic  
Author Message
ArchieZhang



Joined: 23 Feb 2009
Posts: 37

PostPosted: Tue Apr 14, 2009 4:39 pm    Post subject: Callbacks for icmMapExternalMemory have abnormal behavior Reply with quote

Hi OVP experts,

It's really strange. I use icmMapExternalMemory to register peripherial callbacks for certain memory area. In most cases it works well, but for certain peripherial the callbacks sometimes get the abnormal address parameter.

For example, I registered two callbacks:
Code:

    icmMapExternalMemory(
        _bus, "Mail", ICM_PRIV_RW, 0x15024000, 0x150240FF, myreadCB, mywriteCB, 0);


In most cases it works when MIPS code access 0x150240XX, but sometimes strange things will happen, see my log message:
Code:

[MAIL] [B5024060]=00000001
[MAIL] 00000000=[B50240A0]
[MAIL] [B50240A0]=00400000
[MAIL] [B50240A4]=01600000
[MAIL] [AAAB2004]=00000000
[MAIL] [AAAB2008]=00000000
[MAIL] [AAAB2000]=00000000
[MAIL] [AAAB2000]=00A38838
[MAIL] [AAAB2000]=80A38838
[MAIL] 00400000=[B50240A0]
[MAIL] [B50240A0]=00400001

In the call back the address parameter will be AAAB20XX, rather than B50240XX. In the above log,
Code:

[AAAB2004]=00000000

should be
Code:

[B5024004]=00000000

Another peripherial callbacks also get such abnormal parameters. Some time it gets AABA2XXX instead of BB000XXX.
Code:

[SYSTEM] 0000=[BB00016C]
[SYSTEM] 0000=[BB00016E]
[SYSTEM] [BB00016C]=0000
[SYSTEM] [BB00016E]=0000
[SYSTEM] [BB00016C]=0008
[SYSTEM] [BB00016E]=0000
[SYSTEM] [AABA208E]=6008
[SYSTEM] [AABA2086]=0225
[SYSTEM] [AABA2092]=200A
[SYSTEM] [AABA2098]=7170
[SYSTEM] [AABA209A]=0004
[SYSTEM] [AABA209C]=7170
[SYSTEM] [AABA209E]=0004
[SYSTEM] [AABA20A0]=7170
[SYSTEM] [AABA20A2]=0004
[SYSTEM] 0000=[BB00016C]
[SYSTEM] 0000=[BB00016E]
[SYSTEM] [BB00016C]=0000


Any idea?
Back to top
View user's profile Send private message
ArchieZhang



Joined: 23 Feb 2009
Posts: 37

PostPosted: Tue Apr 14, 2009 5:30 pm    Post subject: Reply with quote

I checked the memory access function, our kernel driver mmaped the 15024000 to virtual address 2AAAE000, so actually the callback function gets the addr parameter as 2AAAE000 (my code adds the highest bit).

If the driver doesn't mmap the memory address to B5024000, how can my callback know it?

Hope the callback function can only receive the offset, not the absolulate address.

Is there any method to workaround this? If the function icmMapExternalMemory can't be used, my whole architecture need be reconstructed. Help!
Back to top
View user's profile Send private message
ArchieZhang



Joined: 23 Feb 2009
Posts: 37

PostPosted: Tue Apr 14, 2009 5:47 pm    Post subject: Reply with quote

My temporary solution is, since mmap is 4K aligned, my callbacks only monitor < 4K memory, so offset = (addr - hw_addr) & 0xFFF shall work.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Getting started All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Information regarding OVP © 2008-2022 Imperas Software