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

Rtems_termios_ioctl problem



Hi,

As I wrote in my previous email, I'm still trying to modify the file termios.c to add TCFLSH request like following:

case TCFLSH:
	{
	switch (args->buffer) {
		case TCIFLUSH:	/* flush input buffer */
			{
			unsigned int head;
			sc = rtems_semaphore_obtain (tty->rawInBuf.Semaphore,
									RTEMS_WAIT,
									RTEMS_NO_TIMEOUT);
								
			int rawnc = tty->rawInBuf.Tail - tty->rawInBuf.Head;
			if ( rawnc < 0 )
				/* buffer is not empty*/ 					
				head = tty->rawInBuf.Head;
				tty->rawInBuf.Tail = head;
				tty->rawInBuf.theBuf[head] = '\0';
					
			sc = rtems_semaphore_release (tty->rawInBuf.Semaphore);					
			}
			break;

I don't know if it is the correct way to flush the buffer. If someone knows how to do it,I'm interested.

Thanks for your help.

St?phane.