[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: file i/o



Title: Message
This has been discussed on the Linux Kernel Mailing List numerous time and the
standard answer is "don't do that, do it in userspace instead." You could e.g. have
an ioctl or /proc entry that userspace can use to get the data. If you still want to
do it something like this may or may not work.
 
extern long sys_open(char* filename, int flags, int mode);
extern long sys_close(int fd);
extern long sys_write(unsigned int fd, const char* buf, suze_t count);
 
and then use these as you would use open(), write() and close(). Don't ever call
these from an interrupt handler or similar.
 
No guarantees :-)
 
/Mikael
-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com] On Behalf Of Jonathan Makofske
Sent: Thursday, September 30, 2004 6:15 PM
To: dev-etrax
Subject: file i/o

I'm currently working writing driver-level code on the Axis ETRAX 100LX MCM 2+8.  Specifically, I'm working in the ethernet and parallel port driver files (ethernet.c and e100lpslavenet.c).  We are using the chip for high-speed handling of ethernet packets, so a lot of "high-level" functionality has been stripped out.  That being said, I need a way to write a small amount of data (no more than 64 bytes) to memory (or to file), so it can be retrieved on power-up.
 
I'm also very new at all this (and the Linux environment), so please bear with me if my questions seem somewhat uninformed.
 
I tried including <asm/unistd.h> for file i/o, but it doesn't appear the functions are available to me (maybe I'm just not including the right files)
I get the following [compiler error]: undefined reference to 'open'
 
If it is practical, and if file i/o is possible at the driver-level, what might I be doing wrong?
 
Alternatively, I was wondering if I could just write to/read from the built-in flash?  (As I mentioned, it's only 64 bytes of data.)  If so, are there functions that I may use to do this and where are they?
 
 
Thanks for your help.
Jon