/* * A simple I-PIPE test module. * * Copyright (C) 2005 Philippe Gerum. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, * USA; either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * This module implements a trivial IPIPE client domain. Basically, * it creates an IPIPE domain which has a higher priority in the * pipeline than the root (i.e. Linux) domain, then virtualizes the * timer interrupt for it. As a result of this, each timer tick is * first processed by this domain's timer_tick() routine, then by * the Linux domain handler. */ #include #include MODULE_LICENSE("GPL"); static struct ipipe_sysinfo sys_info; static struct ipipe_domain this_domain; static int timer_hits[IPIPE_NR_CPUS]; void timer_tick (unsigned irq) { timer_hits[ipipe_processor_id()]++; ipipe_propagate_irq(irq); } void domain_entry (void) { printk("Domain %s started on CPU#%d.\n", ipipe_current_domain->name, ipipe_processor_id()); ipipe_get_sysinfo(&sys_info); ipipe_virtualize_irq(sys_info.archdep.tmirq, &timer_tick, NULL, IPIPE_DYNAMIC_MASK); } static int __init __ipipe_domain_init (void) { struct ipipe_domain_attr attr; ipipe_init_attr(&attr); attr.name = "TestDomain"; attr.domid = 1; attr.entry = &domain_entry; attr.priority = IPIPE_ROOT_PRI + 1; return ipipe_register_domain(&this_domain,&attr); } static void __exit __ipipe_domain_exit (void) { int cpu; ipipe_unregister_domain(&this_domain); for (cpu = 0; cpu < sys_info.ncpus; cpu++) { printk("IPIPE TEST ON CPU #%d:\n",cpu); printk(" %d TIMER TICKS ON IRQ #%d\n",timer_hits[cpu],sys_info.archdep.tmirq); } } module_init(__ipipe_domain_init); module_exit(__ipipe_domain_exit);