ts-7000
[Top] [All Lists]

[ts-7000] Re: Can I use xdio of ts-7300 as CMOS sensor interface?

To:
Subject: [ts-7000] Re: Can I use xdio of ts-7300 as CMOS sensor interface?
From: "zzmde" <>
Date: Fri, 25 May 2007 02:48:27 -0000
Thank you very much for your interpretation.
Now I meet with a new problem. After I reduce clock rate of CMOS 
sensor, I still cannot recognize each pixel value. Because the 
reading procedure seems not isochronous. Sometimes I read 638 data 
per line, sometimes 714 data per line. The extact pixel number should 
be 640 per line. Is it possible to make I/O speed isochronous?
The following is my code:

"
#include <assert.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <stdio.h>
#include <unistd.h>
#include "xdio.h"
#include <sys/mman.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <fcntl.h>

#define MAP_SIZE 4096Ul
#define MAP_MASK (MAP_SIZE-1)

int main() 
{
unsigned int buf[1280*4];
unsigned char *virt_addr;
void *regs;
  struct xdio xdio1,xdio2,*xd1=0,*xd2=0;
  int i,n=0;
FILE* outfile;
int fd=open("/dev/mem", O_RDWR|O_SYNC);

regs=mmap(0,4096,
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x72000046&~MAP_MASK);

outfile=fopen("/home/zzm/xdio/test.txt", "w");
  if (open_xdio(&xdio1,0)) {
    xd1 = &xdio1;
  }
  if (open_xdio(&xdio2,1)) {
    xd2 = &xdio2;
  }
  
    assert(xd1); 
     assert(xd2); 

  printf("Clock xd2 period is %d ns\n",setClockSpeed(xd2,1));
  printf("Clock xd1 period is %d ns\n",setClockSpeed(xd1,1));  

  setMODE(xd1->base,0);
 setMODE(xd2->base,0);

virt_addr=regs+(0x72000046&MAP_MASK)+0x0000;
 for (i=0;i<1280*4;i++){
buf[i]=*virt_addr;
}
 for (i=0;i<1280*4;i++){
fprintf(outfile, "%x\t", buf[i]);
}

 fclose(outfile); 
  close_xdio(xd1);
  close_xdio(xd2);
  return 0;
}
"

Thanks
Zhaomin

--- In  David Hawkins <> wrote:
> Hi Zhaomin,
> 
> There is no difference in I/O speed between user-space and
> kernel space.
> 
> When you map /dev/mem into the process (user-space) application,
> the MMU is setup to map the XDIO to process addresses. If you
> work in the kernel, you end up doing something similar to
> get addresses mapped to the kernel.
> 
> The difference comes when you want to use interrupts, or want
> to allow non-root users to access the hardware.
> 
> You're better off to get things working first, and then
> decide later if you want to change things like users.
> 
> Cheers
> Dave
>




 
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/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU