Skip to contentSkip to conversation

Add new ASYNC_SPD_WARP13?

DISCUSSION Grant Edwards 2 participants 8 messages Apr 6, 2011 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

I'm working on a driver for a serial board that supports 921600 bps, and it would be awfully nice if there was a way to specify that using the ASYNC_SPD_xxxxx mechanism. Is there any reason why this wouldn't work?

  #define ASYNC_SPD_HI         (1U << ASYNCB_SPD_HI)
  #define ASYNC_SPD_VHI        (1U << ASYNCB_SPD_VHI)
  #define ASYNC_SPD_SHI        (1U << ASYNCB_SPD_SHI)
  #define ASYNC_SPD_CUST       (ASYNC_SPD_HI|ASYNC_SPD_VHI)
  #define ASYNC_SPD_WARP       (ASYNC_SPD_HI|ASYNC_SPD_SHI)
+ #define ASYNC_SPD_WARP13     (ASYNC_SPD_HI|ASYNC_SPD_SHI|ASYNC_SPD_SHI)
  #define ASYNC_SPD_MASK       (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
Signature · 3 lines
Grant Edwards               grant.b.edwards        Yow! I'm wearing PAMPERS!!
                                  at               
                              gmail.com            
#1 lore raw
Quoted 4 lines · On Wed, 6 Apr 2011 16:48:49 +0000 (UTC) Grant Edwards…

I'm working on a driver for a serial board that supports 921600 bps, and it would be awfully nice if there was a way to specify that using the ASYNC_SPD_xxxxx mechanism. Is there any reason why this wouldn't work?

The ASYNC_SPD_xxxx mechanism is obsolete. Just set the baud rate to 921600, the kernel has supported arbitary baud rates for some time.

#2 lore raw
Quoted 9 lines · Alan Cox
Quoted 4 lines · On Wed, 6 Apr 2011 16:48:49 +0000 (UTC) Grant Edwards…

I'm working on a driver for a serial board that supports 921600 bps, and it would be awfully nice if there was a way to specify that using the ASYNC_SPD_xxxxx mechanism. Is there any reason why this wouldn't work?

The ASYNC_SPD_xxxx mechanism is obsolete.

I know -- unfortunately, so are many customer applications.

Quoted 2 lines

Just set the baud rate to 921600, the kernel has supported arbitary baud rates for some time.

Yep, but there are customers with existing, fielded, applications that depend on the ASYNC_SPD_xxxx mechanism to map 38400 to <whatever> [where <whatever> is determined by the SPD_xxxx flags controlled by setserial].

In the past, we've provided a customized version of setserial that supported a SPD_WARP13 flag setting for 921600, but it only worked with a particular driver. I'd like to ditch that and in future use the standard setserial and standard SPD_xxxx flags. But, there is no standard way to set flags for 921600.

I could tell them to go the SPD_CUST route to get 921600, but I was hoping to provide an option that would support 921600 the same way that 57600, 230400, and 460800 are supported.

Signature · 3 lines
Grant Edwards               grant.b.edwards        Yow! I'm dressing up in
                                  at               an ill-fitting IVY-LEAGUE
                              gmail.com            SUIT!!  Too late...
#3 lore raw
Quoted 3 lines

I could tell them to go the SPD_CUST route to get 921600, but I was hoping to provide an option that would support 921600 the same way that 57600, 230400, and 460800 are supported.

And no doubt in time other speeds as well.

ASYNC_SPD_xxx is legacy, it remains simply because we provided it as a historic interface to some drivers and we don't want to break stuff

So please use SPD_CUST if you must do this.

Alan

#4 lore raw
Quoted 10 lines · Alan Cox
Quoted 3 lines

I could tell them to go the SPD_CUST route to get 921600, but I was hoping to provide an option that would support 921600 the same way that 57600, 230400, and 460800 are supported.

And no doubt in time other speeds as well.

ASYNC_SPD_xxx is legacy, it remains simply because we provided it as a historic interface to some drivers and we don't want to break stuff

So please use SPD_CUST if you must do this.

I don't understand: what's the non-legacy alternative to using SPD_CUST?

Signature · 3 lines
Grant Edwards               grant.b.edwards        Yow! I'm having a
                                  at               tax-deductible experience!
                              gmail.com            I need an energy crunch!!
#5 lore raw
In reply to Alan Cox
Quoted 2 lines · Alan Cox

The ASYNC_SPD_xxxx mechanism is obsolete. Just set the baud rate to 921600, the kernel has supported arbitary baud rates for some time.

This raises a question I've been wondering about for some time. While the kernel and the serial driver API support arbitrary baud rates, termios doesn't AFAICT.

How does one use the standard POSIX serial port API to obtain an abritrary baud rate?

The only way I can find to get arbitrary baud rates from a user perspective is to use the ASYNC_SPD_xxxx mechanism.

Signature · 3 lines
Grant Edwards               grant.b.edwards        Yow! Catsup and Mustard all
                                  at               over the place!  It's the
                              gmail.com            Human Hamburger!
#6 lore raw
Quoted 6 lines

This raises a question I've been wondering about for some time. While the kernel and the serial driver API support arbitrary baud rates, termios doesn't AFAICT.

How does one use the standard POSIX serial port API to obtain an abritrary baud rate?

The POSIX API is completely broken in this respect. So the kernel provides its own interface.

Quoted 2 lines

The only way I can find to get arbitrary baud rates from a user perspective is to use the ASYNC_SPD_xxxx mechanism.

Which is also not POSIX

Simple example app:

http://www.kerneltrap.com/mailarchive/linux-usb/2008/10/2/3484644

#7 lore raw
Quoted 7 lines · Alan Cox
Quoted 6 lines

This raises a question I've been wondering about for some time. While the kernel and the serial driver API support arbitrary baud rates, termios doesn't AFAICT.

How does one use the standard POSIX serial port API to obtain an abritrary baud rate?

Quoted 7 lines

The POSIX API is completely broken in this respect. So the kernel provides its own interface.

Quoted 2 lines

The only way I can find to get arbitrary baud rates from a user perspective is to use the ASYNC_SPD_xxxx mechanism.

Which is also not POSIX

Right.

Quoted 3 lines

Simple example app:

http://www.kerneltrap.com/mailarchive/linux-usb/2008/10/2/3484644

Brilliant!

I've been looking for that (off and on) for months. I knew that the kernel/driver API supported arbitrary baud rates and that termios didn't. So I figured there must be an alternative to SPD_CUST, but hadn't been able to figure out what it was.

I had found the BSD IOSSIOSPEED ioctl, but hadn't stumbled across the Linux equivalent.

Signature · 4 lines
Grant Edwards               grant.b.edwards        Yow! Look DEEP into the
                                  at               OPENINGS!!  Do you see any
                              gmail.com            ELVES or EDSELS ... or a
                                                   HIGHBALL?? ...