Re: ttycreate from FreeBSD equivalent

2023-02-27 Thread jon
Ok well I have been using puc_cardbus as a starting point and in
fact in the beginning I was hoping to just the interrupt handler
and so on to it, but I belive com(4) cannot be used for the serial
ports this card presents.

I'm confused as to how things interact with the device tree: I see
for example that cz(4) should come up at /dev/cuaZ* yet there is a
cdev_decl(cztty) in dev/pci/cz.c. Will I also have to add an entry
in sys/conf or e.g. arch/macppc/macppc/conf.c ?

Thank you for taking interest



Re: ttycreate from FreeBSD equivalent

2023-02-25 Thread Theo de Raadt
I think your process is difficult because it is backwards.

Probably easier to take the closest openbsd driver, start removing
wrong-device-specific parts from it and put your own device specific
parts into it.

It will difficult to ensure your driver-independent pieces are correct
if you are picking them one by one out of other code.

jon@elytron.openbsd.amsterdam wrote:

> Thanks for your reply. Yes, I'm using ttymalloc but I'm having a
> hard time telling where the terminal has attached to. For context,
> I'm working on adding support for a certain cardbus 3g modem. For
> a while I considered using puc at cardbus but it seems both the
> interrupt handling and the non  standard terminal sequences warrant
> a full separate driver. I wondered if attaching com at this new
> device would make sense, but at the moment I'm taking the linux
> approach of implementing it's own tty code.
> 
> At the moment I can initialize the card and process interrups, just
> need to figure out the tty bits. Here is the freebsd driver I'm
> using as reference (was also work in progress)
> 
> http://web.archive.org/web/20080327050955/http://bsd.vwsoft.com/3g/nozomi/nozomi.c
> 
> also, https://marc.info/?l=openbsd-tech=166127896828617=2
> 



Re: ttycreate from FreeBSD equivalent

2023-02-25 Thread jon
Thanks for your reply. Yes, I'm using ttymalloc but I'm having a
hard time telling where the terminal has attached to. For context,
I'm working on adding support for a certain cardbus 3g modem. For
a while I considered using puc at cardbus but it seems both the
interrupt handling and the non  standard terminal sequences warrant
a full separate driver. I wondered if attaching com at this new
device would make sense, but at the moment I'm taking the linux
approach of implementing it's own tty code.

At the moment I can initialize the card and process interrups, just
need to figure out the tty bits. Here is the freebsd driver I'm
using as reference (was also work in progress)

http://web.archive.org/web/20080327050955/http://bsd.vwsoft.com/3g/nozomi/nozomi.c

also, https://marc.info/?l=openbsd-tech=166127896828617=2



Re: ttycreate from FreeBSD equivalent

2023-02-25 Thread Stuart Henderson
On 2023/02/25 11:32, jon@elytron.openbsd.amsterdam wrote:
> Hello, I'm in the process of adapting a driver from freebsd to
> openbsd. I was wondering what I should use in place of a call like
> ttycreate(tmptty, TS_CALLOUT, "N%r", i);
> 
> any hints appreciated, tmptty is a struct tty from /sys/kern/tty.c
> (openbsd)

Probably something involving ttymalloc. That must be rather old FreeBSD
code I think? They don't sem to have used ttycreate for a long time
either.