Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - problem with read/write registers (cpld) on i.mx31: (2 Items)
   
problem with read/write registers (cpld) on i.mx31  
hi,

i have a problem with reading/writing from/to the CPLD registers:
my code looks like this:

#include <stdlib.h>
#include <stdio.h>
#include <arm/inout.h>

typedef unsigned short uint16;
const uint16* BSTAT1 = (uint16*) 0xb4000014;

int main(int argc, char *argv[]) {
 	uint16 reg = in16( 0xb4000014);
 	printf("0x%04x\n", reg);
	return EXIT_SUCCESS;
}

while running i gdb terminated with:
<terminated>cpld_test [C/C++ QNX QConn (IP)]	
	<terminated>QNX GDB Debugger (16.05.08 14:08)	
	<terminated, exit value: 1>/tmp/cpld_test_ ... on mx31_ pid 110600
	<terminated, exit value: 0>C:\QNX632\host\win32\x86\usr\bin\ntoarm-gdb.exe

i tried to include the QNXBSP/src/hardware/devg/imx31/imx31.h, too. (i'm using an freescale i.mx31 board) But that 
doesn't help.

maybe there is a memory mapping? but how i get the mapped addresses?
or am i in principle wrong?
Re: problem with read/write registers (cpld) on i.mx31  
Is it device memory? You probably need     ThreadCtl(_NTO_TCTL_IO,0);
and mmap_device_io, ask on bsp forum.

Hannes Bock wrote:
>
> hi,
>
> i have a problem with reading/writing from/to the CPLD registers:
> my code looks like this:
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <arm/inout.h>
>
> typedef unsigned short uint16;
> const uint16* BSTAT1 = (uint16*) 0xb4000014;
>
> int main(int argc, char *argv[]) {
>         uint16 reg = in16( 0xb4000014);
>         printf("0x%04x\n", reg);
>         return EXIT_SUCCESS;
> }
>
> while running i gdb terminated with:
> <terminated>cpld_test [C/C++ QNX QConn (IP)]   
>         <terminated>QNX GDB Debugger (16.05.08 14:08)  
>         <terminated, exit value: 1>/tmp/cpld_test_ ... on mx31_ pid 
> 110600
>         <terminated, exit value: 
> 0>C:\QNX632\host\win32\x86\usr\bin\ntoarm-gdb.exe
>
> i tried to include the QNXBSP/src/hardware/devg/imx31/imx31.h, too. 
> (i'm using an freescale i.mx31 board) But that doesn't help.
>
> maybe there is a memory mapping? but how i get the mapped addresses?
> or am i in principle wrong?
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post8181
>