The addresses 0x300, 0x301, 0x302 are addresses of BYTES not ints.
Change your pointers to volatile unsigned char *
On Mon, 4 Jun 2012, Damian wrote:
> Hello:
>
> I am using a TS-7260 WITH a custom pc/104 has a FPGA,which offer 4 serial
> uart ports in which you have to set dinamically the I/O and IRQ for each
> port. Now, according to the board specifications this device contains a UART
> in which you set the BASE(0x300) with rotatory switches and the IO and IRQ
> dynamically. So lets say you set them to 0x300(BASE). This means at 0x300 you
> then need to write the upper Most Significant Bye (MSB) of the Serial port IO
> address and at 0x301 you need to write the Least Significant Byte (LSB) of
> the Serial Port IO address, like this:
> 0x300 0x03(msb)
> 0x301 0xf8(lsb)
> 0x302 0x06(irq=6 in board)
>
> Now use mmap for doing this purpose. First I use the code below for
> configuring the custom pc104
>
>
>
> int fd;
> volatile unsigned int *Msb,*Lsb,*Irq;
> unsigned int *pc104base;
> fd = open("/dev/mem", O_RDWR | O_SYNC); //opening the com for
> communication
> if(fd < 0)
> {
> printf("Open do not return a sucessfull value\n");
> perror("fd :");
> }
> pc104base = mmap(0, getpagesize(),PROT_READ | PROT_WRITE, MAP_SHARED, fd,
> PC104_8BIT_IO_BASE);
> if (pc104base == MAP_FAILED)
> {
> printf("problem with mmap \n");
> perror ("pc104base");
> exit(1);
> }
>
>
> Msb = (unsigned int *)(pc104base + 0x00); //port b data
> Lsb = (unsigned int *)(pc104base + 0x01); //port b direction
> Irq = (unsigned int *)(pc104base + 0x02); //port c data
>
> *Msb = 0x03;
> *Lsb = 0xf8;
> *Irq = 0x06;
> printf("microbee mapped\n");
> close(fd);
>
>
>
>
>
> Then I just open another char device for the communications purposes
>
>
> printf("Starting to use the setserial\n");
> system("setserial /dev/ttyTS0 port 0x11E00300 baud_base 9600 irq 33");
> // Com 1 is oppened with this function, it will control the acces to it in
> the program
> GpsCOM1 = open("/dev/ttyTS0", O_RDWR | O_SYNC); //opening the com for
> communication
> if(GpsCOM1 < 0)
> {
> printf("Open do not return a sucessfull value\n");
> perror("GpsCOM1");
> }
> else
> {
> printf("starting to use the fucking GPS\n");
>
> printf("Executing code\n");
> SendCommand(interfacemode);
> printf("interfacemode passed\n");
> SendCommand(satvislog);
> check = GetSatVis();
> }
>
>
> All the above is performed sucessfully however the I cannot get any
> feedback of the attached GPS in the custom pc/104. It seems like no
> communication is established since the program stops indefinetily when
> waiting for the GPS data.
>
> Sorry for the long email, but I do not want to lose any details.thanks
> Damian
>
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|