Posted: Sun Nov 07, 2004 12:50 pm Post subject: [Asterisk-bsd] zaptel device open semantics?
Hi-
I'm currently working on porting some of the zaptel drivers to NetBSD,
and I'm pretty far along... I have compiling code for zaptel, wcfxs, and
ztdummy. However, I'm now realizing that the 'zaptel' piece is doing
something funky, and I hope that someone here can explain to me how it's
expecting to operate, so I can translate that into NetBSD semantics... I
expect that once I have this piece, I should have something working
(FSVO "working") within a few days.
I'm coming at this from a position of not being terribly familiar with
FreeBSD driver internals, (in fact, everything I know about them I've
learned in the process of doing this port) so please be as explicit as
possible in any explanation.
From what I can tell of the way the drivers fit together, the "zaptel"
driver is the one that actually handles the device open, and calls
routines in the hardware-specific drivers to handle the actual work -
this makes a certain amount of sense. What I don't understand is that
the cdevsw structure only defines an "open" routine - no close, no read,
etc...:
OK, so the zaptel driver handles opens. How is a device read (for
example) then handled? I see a number of functions which look promising
in the 'struct fileops':
... but I'm unclear how these functions then get called. Obviously, I'm
missing something pretty fundamental here, so if someone could whack me
with a clue-by-four, I'd greatly appreciate it.
(I'm sure I'll have a lot more questions, so if someone who's familiar
with the workings would like to contact me privately and offer to help,
I'd be grateful - riz at boogers.sf.ca.us.
Posted: Mon Nov 08, 2004 1:47 am Post subject: [Asterisk-bsd] zaptel device open semantics?
Jeff Rizzo (riz+asterisk@boogers.sf.ca.us) wrote:
Quote:
Hi-
I'm currently working on porting some of the zaptel drivers to NetBSD,
and I'm pretty far along... I have compiling code for zaptel, wcfxs, and
ztdummy. However, I'm now realizing that the 'zaptel' piece is doing
something funky, and I hope that someone here can explain to me how it's
expecting to operate, so I can translate that into NetBSD semantics... I
expect that once I have this piece, I should have something working
(FSVO "working") within a few days.
.. skipped ..
Quote:
... but I'm unclear how these functions then get called. Obviously, I'm
missing something pretty fundamental here, so if someone could whack me
with a clue-by-four, I'd greatly appreciate it.
Let me explain. On linux every open() call generates device private
data(kind of *_softc) for the new file descriptor. On FreeBSD there is only
one cdevsw instance per device, so we should emulate the behaviour of
linux kernel. We could do it by redefining file operations for brand-new
file descriptor (zt_fileops structure) and setting f_data field of
'struct file' to pointer to device private data.
Quote:
(I'm sure I'll have a lot more questions, so if someone who's familiar
with the workings would like to contact me privately and offer to help,
I'd be grateful - riz at boogers.sf.ca.us.
Feel free to drop me a line if you will have any question regarding
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum