static int io_show(struct seq_file *seq, void *p)
{
	void (*show_bank)(struct seq_file *, struct s3c_cpufreq_config *, union s3c_iobank *);
	struct s3c_cpufreq_config *cfg;
	struct s3c_iotimings *iot;
	union s3c_iobank *iob;
	int bank;

	cfg = s3c_cpufreq_getconfig();
	if (!cfg) {
		seq_printf(seq, "no configuration registered\n");
		return 0;
	}

	show_bank = cfg->info->debug_io_show;
	if (!show_bank) {
		seq_printf(seq, "no code to show bank timing\n");
		return 0;
	}

	iot = s3c_cpufreq_getiotimings();
	if (!iot) {
		seq_printf(seq, "no io timings registered\n");
		return 0;
	}

	seq_printf(seq, "hclk period is %lu.%lu ns\n", print_ns(cfg->freq.hclk_tns));

	for (bank = 0; bank < MAX_BANKS; bank++) {
		iob = &iot->bank[bank];

		seq_printf(seq, "bank %d: ", bank);

		if (!iob->io_2410) {
			seq_printf(seq, "nothing set\n");
			continue;
		}

		show_bank(seq, cfg, iob);
	}

	return 0;
}
/**
 * s3c2412_iotiming_debugfs - debugfs show io bank timing information
 * @seq: The seq_file to write output to using seq_printf().
 * @cfg: The current configuration.
 * @iob: The IO bank information to decode.
*/
void s3c2412_iotiming_debugfs(struct seq_file *seq,
			      struct s3c_cpufreq_config *cfg,
			      union s3c_iobank *iob)
{
	struct s3c2412_iobank_timing *bt = iob->io_2412;

	seq_printf(seq,
		   "\tRead: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
		   "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n",
		   print_ns(bt->idcy),
		   print_ns(bt->wstrd),
		   print_ns(bt->wstwr),
		   print_ns(bt->wstoen),
		   print_ns(bt->wstwen),
		   print_ns(bt->wstbrd));
}
/**
 * s3c2412_print_timing - print timing infromation via printk.
 * @pfx: The prefix to print each line with.
 * @iot: The IO timing information
 */
static void s3c2412_print_timing(const char *pfx, struct s3c_iotimings *iot)
{
	struct s3c2412_iobank_timing *bt;
	unsigned int bank;

	for (bank = 0; bank < MAX_BANKS; bank++) {
		bt = iot->bank[bank].io_2412;
		if (!bt)
			continue;

		printk(KERN_DEBUG "%s: %d: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
		       "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n", pfx, bank,
		       print_ns(bt->idcy),
		       print_ns(bt->wstrd),
		       print_ns(bt->wstwr),
		       print_ns(bt->wstoen),
		       print_ns(bt->wstwen),
		       print_ns(bt->wstbrd));
	}
}
Exemple #4
0
static void node_print(buf_t *buf, node_t *node, unsigned depth)
{
    size_t i;

    if (!node) return;

    indent(buf, depth);

    switch (node->type)
    {
    case DOCTYPE:
        buf_add(buf, "<!DOCTYPE ");
        buf_add(buf, node->data.doctype.name);

        if (node->data.doctype.public_id ||
                node->data.doctype.system_id) {
            if (node->data.doctype.public_id) {
                buf_add(buf, " \"");
                buf_add(buf, node->data.doctype.public_id);
                buf_add(buf, "\" ");
            } else {
                buf_add(buf, "\"\" ");
            }

            if (node->data.doctype.system_id) {
                buf_add(buf, " \"");
                buf_add(buf, node->data.doctype.system_id);
                buf_add(buf, "\"");
            } else {
                buf_add(buf, "\"\"");
            }
        }

        buf_add(buf, ">\n");
        break;
    case ELEMENT:
        buf_add(buf, "<");
        print_ns(buf, node->data.element.ns);
        buf_add(buf, node->data.element.name);
        buf_add(buf, ">\n");

        qsort(node->data.element.attrs, node->data.element.n_attrs,
              sizeof *node->data.element.attrs,
              compare_attrs);

        for (i = 0; i < node->data.element.n_attrs; i++) {
            indent(buf, depth + 1);
            print_ns(buf, node->data.element.attrs[i].ns);
            buf_add(buf, node->data.element.attrs[i].name);
            buf_add(buf, "=");
            buf_add(buf, "\"");
            buf_add(buf, node->data.element.attrs[i].value);
            buf_add(buf, "\"\n");
        }

        break;
    case CHARACTER:
        buf_add(buf, "\"");
        buf_add(buf, node->data.content);
        buf_add(buf, "\"\n");
        break;
    case COMMENT:
        buf_add(buf, "<!-- ");
        buf_add(buf, node->data.content);
        buf_add(buf, " -->\n");
        break;
    default:
        printf("Unexpected node type %d\n", node->type);
        assert(0);
    }

    if (node->child) {
        node_print(buf, node->child, depth + 1);
    }

    if (node->next) {
        node_print(buf, node->next, depth);
    }
}