Monday, July 21, 2008


  1. struct zt_span *span - This is a pointer to current span structure on which the operation is taking place
  2. struct zt_lineconfig *lc - This is the user supplied data
Functionalities: This is used to set the parameters present in zaptel.conf to the driver. The parameters are present in the lc structure. These parameters are extracted and set in the span structure. In tor2.c, this function is responsible mainly for changing the sync source status of the span.

sync source status of the span: Is whether the current span is an input source, output source or a sink of a time pulse.

This function also takes care about restarting the card if it is currently running

static int tor2_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
int i;
struct tor2_span *p = span->pvt;

if (debug)
printk("Tor2: Configuring span %d\n", span->spanno);

span->syncsrc = p->tor->syncsrc;

/* remove this span number from the current sync sources, if there */
for (i = 0; i <>tor->syncs[i] == span->spanno) {
p->tor->syncs[i] = 0;
p->tor->psyncs[i] = 0;
p->tor->syncpos[p->span] = lc->sync;
/* if a sync src, put it in the proper place */
if (lc->sync) {
p->tor->syncs[lc->sync - 1] = span->spanno;
p->tor->psyncs[lc->sync - 1] = p->span + 1;
/* If we're already running, then go ahead and apply the changes */
if (span->flags & ZT_FLAG_RUNNING)
return tor2_startup(span);

return 0;

No comments: