hi all
I am trying to use the posixio call open, read, write and close. I have
made a driver i RT-linux. and declared rtl_register_chrdev and it works
fine. Then I try to make another RT-kernel module with open, read write,
close and there is no problem in that. Then I try to change it into a
userspace program, but then i can't open the device.

And then my question :
Have i made a fialure ore is the rtl_posix_io only to be used in the
RT-kernel?

BTW
I am using rtlinux 3.0 with kernel 2.4.1.
 some info :
Makefile ->
TARGET = test_rt
CC = gcc
include /usr/src/rtlinux/rtl.mk

all: $(TARGET)


$(TARGET).o: $(TARGET).o
        $(CC) $(CFLAGS) -o $(TARGET) $(TARGET).o

$(TARGET).o: $(TARGET).c
        $(CC) ${CFLAGS} -c $(TARGET).c

Program. some header added and rtl_printf changed to printf
->
#include <stdio.h> /* needed for printf. in kernel module it was
rtl_printf*/
#include <rtl_fifo.h>
#include <rtl.h>
#include <unistd.h>
#include <asm/io.h>
#include <rtl_posixio.h>
#include <rtl_core.h>
#include <rtl_conf.h>
#include <rtl_sync.h>
#include "../rt_serial.h"  /* I have made my own device */


int main(void) {
  char buf[16] = {2,0x11,0x50};
  int fd[2],i=20;
  fd[0] = open("/dev/ttyS0",O_RDWR);
  printf(" TEST : opened /dev/ttys0 %d \n ",fd[0]);

  fd[1] = open("/dev/ttyS1",O_RDWR);
  printf(" TEST : opened /dev/ttys1 %d \n ",fd[1]);

  write(fd[0],buf,3);
  write(fd[1],"s",1);
  while(i-->0)
    write(fd[1],0,1);
  read(fd[1],buf,16);
  /*   rtl_printf("TEST :");
  for(i=0;i<16;i++) {
    rtl_printf(" 0x%x",buf[i]);
  }
  rtl_printf("\n");*/
  close(fd[0]);
  close(fd[1]);
  return 0;
}
-- [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