Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - mmap_device_io not functioning: (5 Items)
   
mmap_device_io not functioning  
Hi QNX,

       qnx sdp 6.6,
       BSP_ti-am335x-beaglebone_br-660_be-660_SVN797070_JBN574.zip
       beaglebone black Rev. C

I am not able to modify register value through mmap_device_io, which always readback as the pre-setted value defined in 
BSP.

#include <errno.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
#include <hw/inout.h>
#include <arm/am335x.h>

#include <sys/iofunc.h>
#include <sys/dispatch.h>

#define conf_mcasp0_aclkx             0x0990

int main(int argc, char *argv[])
{
        uintptr_t   mode_base;

       ThreadCtl(_NTO_TCTL_IO, 0);

        mode_base = mmap_device_io(0x2000, AM335X_CTRL_BASE);
    	out32(mode_base + conf_mcasp0_aclkx, 0x37);
        sleep(2);
    	printf("conf_mcasp0_aclkx = %x\n", in32(mode_base + conf_mcasp0_aclkx));
        munmap_device_io(mode_base, 0x2000);

    return 1;
}

program outputs: "conf_mcasp0_aclkx = 23"

which is exactly that conf_mcasp0_aclkx was initialized in init_pinmux.c as 0x23. I would like to change it to 0x37.

Please help, thanks in advance

Mike
RE: mmap_device_io not functioning  
If mmap_device_io wasn't working you would be getting a core file, and be unable to read the value.
This is more likely being caused by the chipset being locked, in some way, or that being a read only register or some 
such. 

If it wasn't mapped correctly for write access you would expect to see a SIGSEGV ACCERR.
Cheers
John

________________________________________
From: mike scott [community-noreply@qnx.com]
Sent: Thursday, February 14, 2019 04:02
To: ostech-core_os
Subject: mmap_device_io not functioning

Hi QNX,

       qnx sdp 6.6,
       BSP_ti-am335x-beaglebone_br-660_be-660_SVN797070_JBN574.zip
       beaglebone black Rev. C

I am not able to modify register value through mmap_device_io, which always readback as the pre-setted value defined in 
BSP.

#include <errno.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
#include <hw/inout.h>
#include <arm/am335x.h>

#include <sys/iofunc.h>
#include <sys/dispatch.h>

#define conf_mcasp0_aclkx             0x0990

int main(int argc, char *argv[])
{
        uintptr_t   mode_base;

       ThreadCtl(_NTO_TCTL_IO, 0);

        mode_base = mmap_device_io(0x2000, AM335X_CTRL_BASE);
        out32(mode_base + conf_mcasp0_aclkx, 0x37);
        sleep(2);
        printf("conf_mcasp0_aclkx = %x\n", in32(mode_base + conf_mcasp0_aclkx));
        munmap_device_io(mode_base, 0x2000);

    return 1;
}

program outputs: "conf_mcasp0_aclkx = 23"

which is exactly that conf_mcasp0_aclkx was initialized in init_pinmux.c as 0x23. I would like to change it to 0x37.

Please help, thanks in advance

Mike



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post119515
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com
Re: RE: mmap_device_io not functioning  
Hi John,

Running my program did not incur "SIGSEGV ACCERR" or any other warning/error. Actually I just extract this piece of code
 from a large program, which is able to complete and function very well.
 
Please advise any QNX document to elaborate "core file", or chipset locked situation etc.  

Thanks in advance

Mike
RE: RE: mmap_device_io not functioning  
This is a non QNX specific question, you need to refer to the chipset specific documentation/forums. 

I just mentions core files in passing, mainly to point out that your program didn't crash. As such everything on the os 
side seems to be ok.

________________________________________
From: mike scott [community-noreply@qnx.com]
Sent: Thursday, February 14, 2019 12:46
To: ostech-core_os
Subject: Re: RE: mmap_device_io not functioning

Hi John,

Running my program did not incur "SIGSEGV ACCERR" or any other warning/error. Actually I just extract this piece of code
 from a large program, which is able to complete and function very well.

Please advise any QNX document to elaborate "core file", or chipset locked situation etc.

Thanks in advance

Mike



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post119518
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com
Re: RE: RE: mmap_device_io not functioning  
problem solved on the previous post http://community.qnx.com/sf/discussion/do/listPosts/projects.core_os/discussion.
newcode.topc27488

ThreadCtl(_NTO_TCTL_IO_PRIV, 0);

Mike