I've attached the patch drafts. It works fine for me. it prepare the work to
implement the other iflag values as describe in man tcsetattr.

2007/9/26, Guillaume Gaudonville <[EMAIL PROTECTED]>:
>
>
>
> 2007/9/26, Jan Kiszka <[EMAIL PROTECTED]>:
> >
> > Guillaume Gaudonville wrote:
> > > Hello,
> > >
> > > I'm working on a project which aims at porting an application
> > > running under VxWorks to Linux. This application uses the serial
> > > port.
> > >
> > > I would like to add an ioctl or a field in the config structure
> > > to permit to strip or not the parity bit of each byte on reception.
> > This
> > > feature is implemented on Linux and VxWorks.
> > >
> > > Is it something I can do and then submit to Xenomai or your driver is
> > only
> > > an example and will never be improved?
> >
> > The driver is far from being just an example, it's used in real
> > applications.
>
>
> It was just to be sure... I'm using it for a real application.
>
> If your feature is useful and doesn't turn the existing code upside
> > down, it will surely be considered for merging.
> >
> > >
> > > I think that I will have more feature to add to the driver, that's why
> > I'm
> > > asking this.
> >
> > I don't want to exclude anything (specifically as long as I haven't seen
> > some patch yet), but I also don't want to overload the driver over the
> > time with corner-case features. We need a good balance.
> >
> > But we first of all need more details about what you plan to add, what
> > application scenario is behind it, why you need the driver to implement
> > the feature, and what impact it may have on the code. You are welcome to
> >
> > elaborate on this or, even better, post some patch drafts here.
>
>
> I don't  know  which  features  I'll need. For the ISTRIP feature the goal
> is only to
> remove the eigth'th bit of every byte received: I've got a VxWorks
> application which communicate
> with an external clock on the serial port. The clock uses the parity bit
> but my application
> do not. In the original code an ioctl was done to say the serial driver to
> remove the parity bit on
> reception. This feature is also offered under Linux and seems to be posix
> (man tcsetattr, search ISTRIP).
> In order to reduce the code modifications, I would like to implement it in
> the driver.
>
> If so, I think the better way would be to add a field in the rtser_config
> struct, do you agree? And then depending
> upon this field to apply a mask (0x7f) to the character in the interrupt
> handler rt_16550_rx_interrupt() or only
> to the characters passed to user space depending upon what is done in
> other driver.
> to reproduce the same behaviour).
>
> Jan
> >
> > --
> > Siemens AG, Corporate Technology, CT SE 2
> > Corporate Competence Center Embedded Linux
> >
>
>
>
> --
> Guillaume Gaudonville
> E-mail: [EMAIL PROTECTED]
>



-- 
Guillaume Gaudonville
E-mail: [EMAIL PROTECTED]
Index: ksrc/drivers/serial/16550A.c
===================================================================
--- ksrc/drivers/serial/16550A.c	(révision 2765)
+++ ksrc/drivers/serial/16550A.c	(copie de travail)
@@ -153,7 +153,10 @@ static inline int rt_16550_rx_interrupt(
 	do {
 		c = rt_16550_reg_in(mode, base, RHR);	/* read input char */
 
-		ctx->in_buf[ctx->in_tail] = c;
+		if (testbits(ctx->config.iflags, RTSER_IFLAG_ISTRIP))
+			ctx->in_buf[ctx->in_tail] = c & 0x7f;
+		else
+			ctx->in_buf[ctx->in_tail] = c;
 		if (ctx->in_history)
 			ctx->in_history[ctx->in_tail] = *timestamp;
 		ctx->in_tail = (ctx->in_tail + 1) & (IN_BUFFER_SIZE - 1);
@@ -426,6 +429,10 @@ static int rt_16550_set_config(struct rt
 		rtdm_lock_put_irqrestore(&ctx->lock, lock_ctx);
 	}
 
+	if (testbits(config->config_mask, RTSER_SET_IFLAGS)) {
+		ctx->config.iflags = config->iflags;
+	}
+
 	return err;
 }
 
Index: include/rtdm/rtserial.h
===================================================================
--- include/rtdm/rtserial.h	(révision 2765)
+++ include/rtdm/rtserial.h	(copie de travail)
@@ -184,6 +184,7 @@
 #define RTSER_SET_TIMEOUT_EVENT		0x0400
 #define RTSER_SET_TIMESTAMP_HISTORY	0x0800
 #define RTSER_SET_EVENT_MASK		0x1000
+#define RTSER_SET_IFLAGS		0x2000
 /** @} */
 
 
@@ -238,6 +239,15 @@
 #define RTSER_BREAK_SET			0x01
 
 
+/*!
+ * @anchor RTSER_IFLAG_xxx   @name RTSER_IFLAG_xxx
+ * Input behaviour (when used every bits will be set by the ioctl command)
+ * @{ */
+#define RTSER_IFLAG_NONE		0x00
+#define RTSER_IFLAG_ISTRIP		0x01
+#define RTSER_IFLAG_DEFAULT		0x00
+
+
 /**
  * Serial device configuration
  */
@@ -280,6 +290,11 @@ typedef struct rtser_config {
 	/** event mask to be used with @ref RTSER_RTIOC_WAIT_EVENT, see
 	 *  @ref RTSER_EVENT_xxx */
 	int		event_mask;
+
+	/** input flags, see @ref RTSER_IFLAG_xxx, RTSER_IFLAG_ISTRIP is
+	 *  the only one supported for the moment (when used every bits
+	 *  must be set according to the desired configuration)*/
+	int		iflags;
 } rtser_config_t;
 
 /**
_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to