Hans-Peter Reichert
|
AW: Problem accessing NV memory
|
Hans-Peter Reichert
09/23/2009 1:16 AM
post38523
|
AW: Problem accessing NV memory
with QNX you'll need IO privileges
add this ThreadCtl before mapping:
int rc = ThreadCtl( _NTO_TCTL_IO, 0 );
if(-1 == rc) {
printf("can't get IO privileges\n");
exit(-1);
}
>-----Ursprüngliche Nachricht-----
>Von: Ricardo Ahumada [mailto:community-noreply@qnx.com]
>Gesendet: Mittwoch, 23. September 2009 00:26
>An: momentics-community
>Betreff: Problem accessing NV memory
>
>Hi,
>I a new to QNX and I am trying to port from VxWorks. In the
>CPU board I have NV RAM located at: 0x00F00000 I have the
>following code but is not working:
>ThreadCtl(_NTO_TCTL_IO, 0);
>
>int val = munmap( 0x00F00000, 0x1F400 );
>
> volatile uint32_t * bat_pub_addr;
> bat_pub_addr = mmap_device_memory( 0,
> 0x1F400,
> PROT_READ|PROT_WRITE|PROT_NOCACHE,
> 0,
> 0x00F00000);
>
>
> if (bat_pub_addr == MAP_FAILED )
> {
> cout << "bat pub alloc error " << errno << endl;
> }
>When I try to access the bat_pub_addr by showing memory I get
>all 0xFFFFFFFF This works OK in VxWorks, so is not a hardware issue.
>Am I doing something wrong here.
>
>Please Help.
>
>Ricardo
>
>
>
>
>_______________________________________________
>
>QNX Momentics Community Support
>http://community.qnx.com/sf/go/post38519
>
>
*******************************************
Harman Becker Automotive Systems GmbH
Management Board: Dr. Klaus Blickle (Chairman), Dr. Udo Hüls, Michael Mauser
Chairman of the Supervisory Board: Ansgar Rempp | Domicile: Karlsbad |
Local Court Mannheim: Register No. 361395
*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat
sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail
. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have
received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying,
disclosure or distribution of the contents in this e-mail is strictly forbidden.
*******************************************
|
|
|
Colin Burgess(deleted)
|
Re: Problem accessing NV memory
|
Colin Burgess(deleted)
09/23/2009 9:07 AM
post38540
|
Re: Problem accessing NV memory
The munmap is not necessary - the first parameter to munmap is a virtual address, not a physical address!
I'm not sure that's the error though. What platform is this running on?
Ricardo Ahumada wrote:
> Hi,
> I a new to QNX and I am trying to port from VxWorks. In the CPU board I have NV RAM located at: 0x00F00000
> I have the following code but is not working:
> ThreadCtl(_NTO_TCTL_IO, 0);
>
> int val = munmap( 0x00F00000, 0x1F400 );
>
> volatile uint32_t * bat_pub_addr;
> bat_pub_addr = mmap_device_memory( 0,
> 0x1F400,
> PROT_READ|PROT_WRITE|PROT_NOCACHE,
> 0,
> 0x00F00000);
>
>
> if (bat_pub_addr == MAP_FAILED )
> {
> cout << "bat pub alloc error " << errno << endl;
> }
> When I try to access the bat_pub_addr by showing memory I get all 0xFFFFFFFF
> This works OK in VxWorks, so is not a hardware issue.
> Am I doing something wrong here.
>
> Please Help.
>
> Ricardo
>
>
>
>
> _______________________________________________
>
> QNX Momentics Community Support
> http://community.qnx.com/sf/go/post38519
>
--
cburgess@qnx.com
|
|
|