I miss a question that i used to the same source code to read value of PCI device register in my system on qnx4.24 and 4.25 os ,but register value is difference.I used source code is same , Compile environment is same that watcom 10.6 of qnx4.25 os, just run environment is difference.
I don’t know why?please tell me reason and solve way!
Thanks in advance!
i source code:
value = pciBase+blockSel+regAddr;(read)
pciBase+blockSel+regAddr = value;(write)
i find address is the same on 4.24 and 4.25 , but value from register is differ.
How do you get pciBase;
I’m assuming the code you posted is pseudo code right? Because it can’t work.
Can you post some real code and more of it.
pciBase is a virtual address and not a physical address, hence although it could be the same it may point to different physical space.
I personnaly have never used statement 4 in my code.
Doing a += on mem_base is bad cause it means you can’t unmap it properly. Although that has nothing to do with your problem.
What does the value of *dwordval mean, is it possible it could be different for some reason.
The way you build teh REG32 macro is confusing (at least to me) because one of the argument has the same name as the variable pciBase.
i check busnum,devfuncnum,address2,mem_base,pciBase in turn, i find all is same.in this case ,may pcibase point to different physical space? please tell me.
mario ,you said :“Doing a += on mem_base is bad cause it means you can’t unmap it properly” , what mean? i don’t know(for example:what is mean unmap ?), please explain?
dwordval is pointer variable , it defination is “ULONG *dwordval”,it point to variable of storage register value.
Usually when you mmap a memory region you must unmmap it at some point in time. Some people rely on this kind of stuff being cleaned up automaticaly at when the program terminates but depending on what you are doing this could cause some unwanted side effect. Hence it’s usually best to clean thing up properly at termination time and in this case it means unmmaping memory you got from mmap. Look at function unmmap ().
As for dword you says it points to storage register value, but when you say the value is different from when running 4.24, the value you get from that register means what? Is it a value you wrote, or is a a status of some kind? What are the value (in hex) read with 4.24 and 4.25?
dwordval is used to storage value reading from register , the value that i get from that register , the value is in hex
i heard that qnx4.24 is 16 bit os , 4.25 is 32 bit os , what is difference of them?
Can difference of them cause problem that I miss ?
No QNX4.24 is a 32 bit os, as a matter of fact QNX4.22 is 32 bit but not all application that came with it was 32 bit. QNX4 can run 16 and 32 bit at the same time. It’s how you compile it that matters and you mentionned earlier that you use the same version of compiler.
Ok so *dwordval is used as storage, I understand that, but it stores what? What are the exact value you get in 4.25 and in 4.24 (just want to see if there isn’t some kind of patter in the difference). If it stores something is it possible that whatever writes to it behaves differently for some reason.
From memory 4.24 and 4.25 may behave differently regarding page alignment, but I don’t see how that could affect the code you showed here. My gut feeling tells me you are looking at the wrong place in your code.
you said:“It’s how you compile it that matters and you mentionned earlier that you use the same version of compiler” , it’s mean that application program is 16 or 32 depending on compiler? i am useing watcom 10.6 compiler , how i can compile 32 bit program ?
Currently , my problem is that when using the same process to read value in the register from a PCI device in Qnx4.24 and 4.25 , the result is different. And , *dwordval is a variable which can use to save the value that reading from register . When we print it out , we found the problem i mentioned previously.
With Watcom 10.6 the default is to build 32 bit program. To build 16 bit program you need to specify -2, anything above -2 means it’s 32 bit (3=386, 4=486, 5=586).
English is not my native language but I can tell this is not proper English “which can use to save the value that reading from register”
I can’t help you as you are not supplying enough and precise information.