Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Mar 2005 16:47:40 -0700
From:      Jeremy Gale <jgale.work@gmail.com>
To:        freebsd-isdn@freebsd.org
Subject:   Multiple Port Passive ISDN Card
Message-ID:  <1a4ba29305030315476c92b656@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi everyone,

I'm trying to evalutate the feasibility of using the i4b framework to
write a driver for a multiple port (AKA multiple trunk, multiple span)
passive ISDN card. E.g. a card with 8 BRI ports. I'm writing the
driver for NetBSD so that's mostly what I've been looking at. If
things are significantly different on FreeBSD please let me know.

The one problem I've isolated is the l1_token member in the
isdn_l3_driver struct. It looks to me that for all passive cards, it
is used as a pointer to the l2_softc struct. For the CAPI active cards
it points to a capi_softc_t structure. For the incomplete daic driver,
the only multiple port card I am aware of, it is a pointer to the
structure for the specific port being used. I believe I need to do
something similar to the daic driver, but also need the l2_softc
pointer.

One of the crucial functions seems to be
i4b_link_bchandrvr(call_desc_t *cd) for connecting a call to a B
channel driver. The function first gets a port-specific l3drv driver
'd', and then calls

cd->ilt = d->l3driver->get_linktab(d->l1_token, cd->channelid);

I assume the channel ID cannot belong to a huge range (my card could
have 130+ B channels) and is specific to the port. So the l1_token
needs to be used to specify what port is being used.

daic_ret_linktab uses this to calculate which daic_connection linktab
to return like so:

struct daic_unit *du = token;
struct daic_softc *sc = du->du_sc;
int port = du->du_port;
struct daic_connection *con = &sc->sc_con[port*2+channel];
return(&con->isdn_linktab);

I also need to do something like this - index into my large B channel array.

Right now I'm thinking of using a hack. Each port will have an
l2_softc structure and the member immediately after the structure will
be the port number. Then I can use some trickery like:

struct l2_softc *l2sc = token;
int* port_ptr = (int *) (token + sizeof(l2_softc));
int port = *port_ptr;

My pointer arithmetic may be a little off there but you get the idea.

Does this seem like a good idea? Is there a cleaner way to do it? Am I
likely to encounter other problems trying to develop a multiple port
driver?

How far along is the daic driver? Is it a proof of concept or farther than that?

Thanks very much!

Jeremy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1a4ba29305030315476c92b656>