Hello all-
        I apologize for bringing yet another off the topic issue to the table.  I
have successfully installed the allocator.c file sent to me by Phil Daly.
It loaded as a module fine, and I have used the allocator_allocate_dma
function in another module.  I have a question now - I need to write the
contents of this high memory area (I've allocated 16 megabytes)to a scsi
drive but I am having 2 problems.  The first is with the actual file i/o.  I
have the following code in a user space program:

unsigned long scene_number;
int param_fd;

if(param_fd=open("/data/param.sys", O_CREAT | O_EXCL)<0){
   if(errno==EEXIST){
      if(param_fd=open("/data/param.sys", O_RDWR | O_NONBLOCK)<0)
         printf("errno=%i\n", errno);
      else{
         if(retn=read(param_fd, &scene_number, 4)<0)
            printf("errno=%i\n", errno);
         close(param_fd);
      }
   }else{
      printf("errno=%i\n", errno);
}else{
   close(param_fd);
   if(param_fd=creat("/data/param.sys", S_IRWXU | S_IRWXG | S_IRWXO)<0)
      printf("errno=%i\n", errno);
   else{
      close(param_fd);
      if(param_fd=open("/data/param.sys", O_WRONLY | O_NONBLOCK)<0)
         printf("errno=%i\n", errno);
      else{
         if(retn=write(param_fd, &scene_number, 4)<0)
            printf("errno=%i\n", errno);
         close(param_fd);
      }
   }
}

        It creates the file above without any problems, and will write the
scenenumber value to the file.  I can open this file in pico and read and
write to it.  But in the code above, the program stops at the read
statement.  If you hit the enter key on the keyboard, the program continues,
filling in a value for scene_number (it's always ten).  This is very strange
to me.
        The above file is being opened on a scsi drive formatted as fat32.  It is
being mounted without any problems.  I have tried the above with the
param.sys file located at root ("/param.sys") and have the same problem.
        The second problem is really more of a question - does anyone know if you
can do a write using the physical memory address given by
allocator_allocate_dma above?  This is what I'm trying:

unsigned long dma_addr;

write(raw_fd, (unsigned long*) dma_addr, 4194304)

The address is stored as a value in dma_addr, but I'm not sure this is even
setting up the pointer correctly.  Any help would be greatly appreciated, as
being unable to read from files (but still create and write to them!) is
driving me nuts.  Again, it is off topic, but my other sources of possible
assistance have been unable to help me.

Troy Davis
Airborne Data Systems, Inc.

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to