2 * Copyright (C) 2004, 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
5 * Procfs support for Basler eXcite
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/proc_fs.h>
23 #include <linux/stat.h>
26 #include <asm/system.h>
27 #include <asm/rm9k-ocd.h>
31 static int excite_get_unit_id(char *buf, char **addr, off_t offs, int size)
33 const int len = snprintf(buf, PAGE_SIZE, "%06x", unit_id);
34 const int w = len - offs;
36 return w < size ? w : size;
40 excite_bootrom_read(char *page, char **start, off_t off, int count,
45 if (off >= EXCITE_SIZE_BOOTROM) {
50 if ((off + count) > EXCITE_SIZE_BOOTROM)
51 count = EXCITE_SIZE_BOOTROM - off;
53 src = ioremap(EXCITE_PHYS_BOOTROM + off, count);
55 memcpy_fromio(page, src, count);
65 void excite_procfs_init(void)
67 /* Create & populate /proc/excite */
68 struct proc_dir_entry * const pdir = proc_mkdir("excite", &proc_root);
70 struct proc_dir_entry * e;
72 e = create_proc_info_entry("unit_id", S_IRUGO, pdir,
76 e = create_proc_read_entry("bootrom", S_IRUGO, pdir,
77 excite_bootrom_read, NULL);
78 if (e) e->size = EXCITE_SIZE_BOOTROM;