[1] | 1 | /* |
---|
| 2 | * arch.h - architecture specific implementation of kernel's HAL |
---|
| 3 | * (see kern/hal-arch.h) |
---|
| 4 | * |
---|
| 5 | * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless |
---|
| 6 | * Copyright (c) 2011,2012 UPMC Sorbonne Universites |
---|
| 7 | * |
---|
| 8 | * This file is part of ALMOS-kernel. |
---|
| 9 | * |
---|
| 10 | * ALMOS-kernel is free software; you can redistribute it and/or modify it |
---|
| 11 | * under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 13 | * |
---|
| 14 | * ALMOS-kernel is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | * General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with ALMOS-kernel; if not, write to the Free Software Foundation, |
---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | #ifndef _ARCH_H_ |
---|
| 25 | #define _ARCH_H_ |
---|
| 26 | |
---|
| 27 | #include <config.h> |
---|
| 28 | #include <segmentation.h> |
---|
| 29 | #include <types.h> |
---|
| 30 | |
---|
| 31 | #ifndef _HAL_ARCH_H_ |
---|
| 32 | #error arch.h connot be included directly, use system.h instead |
---|
| 33 | #endif |
---|
| 34 | |
---|
| 35 | /* CPUs/CLUSTERs Numbers */ |
---|
| 36 | #define CACHE_LINE_SIZE CONFIG_CACHE_LINE_SIZE |
---|
| 37 | #define __CPU_NR CONFIG_CPU_NR |
---|
| 38 | #define __CPUs CONFIG_CPU_PER_CLUSTER_NR |
---|
| 39 | #define __CLUSTER_NR CONFIG_CLUSTER_NR |
---|
| 40 | #define __CPU_BITS_NR CONFIG_CPU_BITS_NR |
---|
| 41 | #define __CLUSTER_BITS_NR CONFIG_CLUSTER_BITS_NR |
---|
| 42 | #define __PAGE_SIZE CONFIG_CACHE_LINE_SIZE |
---|
| 43 | |
---|
| 44 | #undef CPU_NR |
---|
| 45 | #undef CLUSTER_NR |
---|
| 46 | #undef CPU_PER_CLUSTER |
---|
| 47 | #undef GET_CPU_ID |
---|
| 48 | #undef GET_CLUSTER_ID |
---|
| 49 | #undef MAKE_CPU_ID |
---|
| 50 | |
---|
| 51 | #define CPU_NR __CPU_NR |
---|
| 52 | #define CLUSTER_NR __CLUSTER_NR |
---|
| 53 | #define CPU_PER_CLUSTER __CPUs |
---|
| 54 | #define GET_CPU_ID(_cpu_id) ((_cpu_id) & (__CPU_NR - 1)) |
---|
| 55 | #define GET_CLUSTER_ID(_cpu_id) ((_cpu_id) >> __CPU_BITS_NR) |
---|
| 56 | #define MAKE_CPU_ID(_cluster,_cpu) (((_cluster) << __CPU_BITS_NR) | (_cpu)) |
---|
| 57 | |
---|
| 58 | /* Timer parameters macros */ |
---|
| 59 | #undef TIC |
---|
| 60 | #undef CYCLES_PER_SECOND |
---|
| 61 | |
---|
| 62 | #define TIC 40000 |
---|
| 63 | #define CYCLES_PER_SECOND 200000 |
---|
| 64 | #define ALPHA 20 |
---|
| 65 | |
---|
| 66 | /* Structures definitions */ |
---|
| 67 | struct irq_action_s; |
---|
| 68 | |
---|
| 69 | struct arch_cpu_s |
---|
| 70 | { |
---|
| 71 | struct irq_action_s *action; |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | #endif /* _ARCH_H_ */ |
---|