[1] | 1 | /* |
---|
| 2 | * arch.c - architecture related operations (see kern/hal-arch.h) |
---|
| 3 | * |
---|
| 4 | * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless |
---|
| 5 | * Copyright (c) 2011,2012 UPMC Sorbonne Universites |
---|
| 6 | * |
---|
| 7 | * This file is part of ALMOS-kernel. |
---|
| 8 | * |
---|
| 9 | * ALMOS-kernel is free software; you can redistribute it and/or modify it |
---|
| 10 | * under the terms of the GNU General Public License as published by |
---|
| 11 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 12 | * |
---|
| 13 | * ALMOS-kernel is distributed in the hope that it will be useful, but |
---|
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 16 | * General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with ALMOS-kernel; if not, write to the Free Software Foundation, |
---|
| 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #include <errno.h> |
---|
| 24 | #include <types.h> |
---|
| 25 | #include <kdmsg.h> |
---|
| 26 | #include <cpu.h> |
---|
| 27 | #include <device.h> |
---|
| 28 | #include <system.h> |
---|
| 29 | |
---|
| 30 | error_t arch_cpu_init(struct cpu_s *cpu) |
---|
| 31 | { |
---|
| 32 | cpu->arch.action = NULL; |
---|
| 33 | return 0; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | error_t arch_cpu_set_irq_entry(struct cpu_s *cpu, int irq_nr, struct irq_action_s *action) |
---|
| 37 | { |
---|
| 38 | assert(cpu->arch.action == NULL && "IRQ entry has been already specified\n"); |
---|
| 39 | cpu->arch.action = action; |
---|
| 40 | return 0; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | error_t arch_cpu_get_irq_entry(struct cpu_s *cpu, int irq_nr, struct irq_action_s **action) |
---|
| 44 | { |
---|
| 45 | if(cpu->arch.action == NULL) |
---|
| 46 | return EINVAL; |
---|
| 47 | |
---|
| 48 | cpu->arch.action->data = (void*)irq_nr; |
---|
| 49 | *action = cpu->arch.action; |
---|
| 50 | return 0; |
---|
| 51 | } |
---|