Пример #1
0
void hfc_fifo_drop(struct hfc_fifo *fifo, int size)
{
	int available_bytes = hfc_fifo_used(fifo);
	if (available_bytes + 1 < size) {
		hfc_msg_fifo(fifo, KERN_WARNING,
			"RX FIFO not enough (%d) bytes to drop!\n",
			available_bytes);

		return;
	}

	// FIXME read and drop bytes
}
Пример #2
0
static ssize_t hfc_show_rx_fifo_used(
	struct visdn_chan *visdn_chan,
	struct ks_chan_attribute *attr,
	char *buf)
{
	struct hfc_sys_chan *chan = to_sys_chan(visdn_chan);
	int fifo_used;

	hfc_card_lock(chan->port->card);
	hfc_fifo_select(&chan->rx_fifo);
	fifo_used = hfc_fifo_used(&chan->rx_fifo);
	hfc_card_unlock(chan->port->card);

	return snprintf(buf, PAGE_SIZE, "%d\n", fifo_used);
}
Пример #3
0
static ssize_t hfc_show_fifo_state(
	struct visdn_port *visdn_port,
	struct visdn_port_attribute *attr,
	char *buf)
{
	struct hfc_sys_port *port = to_sys_port(visdn_port);
	struct hfc_card *card = port->card;
	int i;

	*buf = '\0';

	sanprintf(buf, PAGE_SIZE,
		"\n"
		"    Receive                            Transmit\n"
		" #  F1 F2   Z1   Z2 Used Mode Conn     F1 F2   Z1   Z2"
		" Used Mode Conn\n");

	hfc_card_lock(card);

	for (i=0; i<port->num_chans; i++) {
//		if (!card->fifos[i][RX].used && !card->fifos[i][TX].used)
//			continue;

		struct hfc_fifo *fifo_rx = &port->chans[i].rx.fifo;
		struct hfc_fifo *fifo_tx = &port->chans[i].tx.fifo;

		union hfc_fgroup f;
		union hfc_zgroup z;

		sanprintf(buf, PAGE_SIZE,
			"%2d:", i);

		hfc_fifo_select(fifo_rx);

		f.f1f2 = hfc_inw(card, hfc_A_F12);
		z.z1z2 = hfc_inl(card, hfc_A_Z12);

		sanprintf(buf, PAGE_SIZE,
			" %02x %02x %04x %04x %4d %c%c%c  ",
			f.f1, f.f2, z.z1, z.z2,
			hfc_fifo_used(fifo_rx),
			fifo_rx->framer_enabled ? 'H' : ' ',
			fifo_rx->enabled ? 'E' : ' ',
			fifo_rx->bit_reversed ? 'R' : ' ');

		{
		struct ks_chan *prev_chan;
		prev_chan = ks_pipeline_prev(&port->chans[i].rx.ks_chan);

		if (!prev_chan) {
			sanprintf(buf, PAGE_SIZE, "      ");
		} else if (prev_chan->ops == &hfc_st_chan_rx_chan_ops) {
			struct hfc_st_chan_rx *chan_rx =
				container_of(prev_chan, struct hfc_st_chan_rx,
								ks_chan);

			sanprintf(buf, PAGE_SIZE,
				"st%d:%-2s",
				chan_rx->chan->port->id,
				kobject_name(&chan_rx->chan->ks_node.kobj));
/*		} else if (prev_chan->ops == &hfc_pcm_chan_rx_chan_ops) {
			struct hfc_pcm_chan_rx *chan_rx =
				container_of(prev_chan, struct hfc_pcm_chan_rx,
								ks_chan);

			sanprintf(buf, PAGE_SIZE,
				"pcm%d:%s",
				chan_rx->chan->port->id,
				chan_rx->chan->ks_node.kobj.name);*/
		}
		}

		hfc_fifo_select(fifo_tx);

		f.f1f2 = hfc_inw(card, hfc_A_F12);
		z.z1z2 = hfc_inl(card, hfc_A_Z12);

		sanprintf(buf, PAGE_SIZE,
			"   %02x %02x %04x %04x %4d %c%c%c  ",
			f.f1, f.f2, z.z1, z.z2,
			hfc_fifo_used(fifo_tx),
			fifo_tx->framer_enabled ? 'H' : ' ',
			fifo_tx->enabled ? 'E' : ' ',
			fifo_tx->bit_reversed ? 'R' : ' ');

		{
		struct ks_chan *next_chan;
		next_chan = ks_pipeline_next(&port->chans[i].tx.ks_chan);

		if (!next_chan) {
			sanprintf(buf, PAGE_SIZE, "\n");
		} else if (next_chan->ops == &hfc_st_chan_tx_chan_ops) {
			struct hfc_st_chan_tx *chan_tx =
				container_of(next_chan, struct hfc_st_chan_tx,
								ks_chan);

			sanprintf(buf, PAGE_SIZE,
				"st%d:%-2s\n",
				chan_tx->chan->port->id,
				kobject_name(&chan_tx->chan->ks_node.kobj));
/*		} else if (next_chan->ops == &hfc_pcm_chan_tx_chan_ops) {
			struct hfc_pcm_chan_tx *chan_tx =
				container_of(next_chan, struct hfc_pcm_chan_tx,
								ks_chan);

			sanprintf(buf, PAGE_SIZE,
				"pcm%d:%s\n",
				chan_tx->chan->port->id,
				chan_tx->chan->ks_node.kobj.name);*/
		}
		}
	}

	hfc_card_unlock(card);

	return strlen(buf);
}