Sorry for asking again, but I think I can now elaborate better my issues. I've been trying to make the ERC32 read the serial port. First I tried to use C basic functions such as getchar and gets, and they worked (like a read function in blocking mode). However I want to use read and write functions. The write function worked but the read function didn't work and I guess that there are configuration issues. I have the source code of the rdbmon monitor used in the board. I saw that it uses the write function to the terminal (Serial A) as something write(1,&char_var,1) and uses the read and write function for the debugging channel (Serial B) as something as write(3,&char_var,1) and read (3,&char_var,1). So the file descriptor 1 is for terminal and the 3 is for the debugging channel. I'm interested in communication through the terminal, so I used the write functios as write(1,&char_var,1) and it worked. I tried the same for the read function but no success, ir returns
> ERRNO: 9 = Bad file number. > I know that in linux for example, I can have a blocking read function or a non-blocking one using an assynchronous file descriptor and using a signal (interrupt-like) to get when there are available bytes in the UART buffer. I tried to open a file descriptor with something like > fd=open("/dev/console_%c", O_RDWR | O_NOCTTY | O_NDELAY) > as I saw in RTEMS Uart loopback example. However it returns an error ( I don't remember exactly now because I don't have access to the lab at the moment). I suspect that rdbmon opens the terminal first to post the board initial message and when I try to open, it blocks a second instance. The problem that as I haven't choose the opening mode I can't configure it termios-like properly. Another issue: I have a sample code here with an isr routine, the rtems_interrupt_catch function is called in the Init function and it is associed with the ERC32 UART A Data readyTransmitter ready trap. I noticed that isr is executing whether there is data to send or receive, but I want it to work just when there is data to receive. If something is printed before it executes indefinitely and I can't properly use a read function in this case. It is worth to say that there is an ERC_Unmask command for the UART A interrupt in the Init function. Sorry for the long text, hope can someone help. Thanks ! Em sex, 27 de set de 2019 às 02:33, Michel Macena <mmacena....@gmail.com> escreveu: > I'm using an ERC32 chip (sparc) . Do you mean the console driver ? > > > > Em ter, 24 de set de 2019 às 20:47, Chris Johns <chr...@rtems.org> > escreveu: > >> On 21/9/19 8:39 am, Michel Macena wrote: >> > I noticed in the IO primitive manager section in the RTEMS POSIX guide >> that >> > there are a read and a write function, however the IO guide are not >> finished >> > yet, so I don't know if those functions are in good shape to use. Are >> they ok ? >> > Also is there a tcdrain (from termios.h) equivalent function for RTEMS? >> > >> > I want to make a hardware loop with the board and a pc with linux >> through serial >> > communication. Is there any RTEMS specific functions to send and >> receive data >> > through serial UART ? >> >> RTEMS supports termios for UART communications. All you need is a driver >> for >> your hardware. >> >> Chris >> >
_______________________________________________ users mailing list users@rtems.org http://lists.rtems.org/mailman/listinfo/users