Hi Arnaud,
this is an example of code using FSLFIFO for write, not guarantee
it works or ever compile.
Just a starting point for you.
Regards,
Claudio Lanconelli
/*************************************/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <asm/fslfifo_ioctl.h>
#include <sys/ioctl.h>
#define FIFO_DEVICE "/dev/fslfifo0"
int main(void)
{
int fd;
int rv;
unsigned long val;
fd = open(FIFO_DEVICE, O_RDWR);
if (fd < 1)
{
printf("ERROR: failed to open FSLFIFO device %s\n",
FIFO_DEVICE);
return fd;
}
else
{
unsigned long arg;
// Set the FIFO width (1, 2, 4 bytes)
arg = 4;
rv = ioctl(fd, FSLFIFO_IOCTWIDTH, arg);
if (rv < 0)
{
printf("ERROR: ioctl(FSLFIFO_IOCTWIDTH,%d) failed, errno=
%d\n", arg, errno);
close(fd);
return rv;
}
// Read back the FIFO width
rv = ioctl(fd, FSLFIFO_IOCQWIDTH, arg);
if (rv < 0)
{
printf("ERROR: ioctl(ofd, FSLFIFO_IOCQWIDTH) failed,
errno=%d\n", errno);
close(fd);
return rv;
}
// Write a data value
val = 0x55;
rv = write(fd, &val, sizeof(val));
if ( rv != sizeof(val) )
{
printf("ERROR: write(%s) failed, returned=%d, errno=%d
\n", DACDEVICE, rv, errno);
}
// Write a control value
val = 0xAA;
rv = ioctl(fd, FSLFIFO_IOCTCONTROL, val);
if (rv < 0)
{
printf("ERROR: ioctl(FSLFIFO_IOCTCONTROL,%d) failed,
errno=%d\n", val, errno);
}
close(fd);
}
return 0;
}
Arnaud Lagger wrote:
Thanks, so I can use directly "cat file > /dev/fslfifo0" :)
But my dream would be a piece of C code which use fslfifo to write
some data and retrieve the result. Then I would be able to
customize it to control my FSL module.
Arnaud Lagger
Stephen Craven a écrit :
Having never tried this, I can't say if its relavent or not, but
have a look
at this paper by John Williams:
http://doi.ieeecomputersociety.org/10.1109/FCCM.2005.35
Stephen
----- Original Message ----- From: "Paul Hartke"
<phartke@xxxxxxxxxxxx>
To: <microblaze-uclinux@xxxxxxxxxxxxxx>; "Arnaud Lagger"
<arnaud.lagger@xxxxxxx>
Cc: <microblaze-uclinux@xxxxxxxxxxxxxx>
Sent: Tuesday, October 25, 2005 12:21 PM
Subject: Re: [microblaze-uclinux] Using fslfifo driver
Sounds like a common task that folks including myself would want
to do.
Hopefully folks will post their experiences and we can collectively
generate some guides for this.
Thanks.
Paul
Quoting Arnaud Lagger <arnaud.lagger@xxxxxxx>:
Hello,
I have an FSL module and I want to use the fslfifo driver to
simply give
a data to the module and then retrieve it.
Can anyone give me some code to do that?
Thanks,
Arnaud Lagger
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-
uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/
microblaze-uclinux/
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-
uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/
microblaze-uclinux/