source: trunk/tools/arch_info/arch_info.c @ 266

Last change on this file since 266 was 1, checked in by alain, 8 years ago

First import

File size: 2.1 KB
RevLine 
[1]1/*
2 * arch_info.c - Access functions to Hardware Architecture Information Structure
3 *
4 * Author  Alain Greiner (2016)
5 *
6 * Copyright (c)  UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH.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-MKH.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-MKH.; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24///////////////////////////////////////////////////////////////////////
25archinfo_core_t * archinfo_get_core_base(archinfo_header_t * header) 
26{
27    return (archinfo_core_t *) ((char *) header +
28            ARCHINFO_HEADER_SIZE);
29}
30
31//////////////////////////////////////////////////////////////////////
32archinfo_cluster_t * archinfo_get_cluster_base(archinfo_header_t * header) 
33{
34    return (archinfo_cluster_t *) ((char *) header +
35            ARCHINFO_HEADER_SIZE +
36            ARCHINFO_CORE_SIZE * header->cores);
37}
38
39///////////////////////////////////////////////////////////////////////
40archinfo_device_t *archinfo_get_device_base(archinfo_header_t * header) 
41{
42    return (archinfo_device_t *) ((char *) header +
43            ARCHINFO_HEADER_SIZE +
44            ARCHINFO_CORE_SIZE * header->cores +
45            ARCHINFO_CLUSTER_SIZE * header->x_size * header->y_size);
46}
47
48////////////////////////////////////////////////////////////////////
49archinfo_irq_t *archinfo_get_irq_base(archinfo_header_t * header) 
50{
51    return (archinfo_irq_t *) ((char *) header +
52            ARCHINFO_HEADER_SIZE +
53            ARCHINFO_CORE_SIZE * header->cores +
54            ARCHINFO_CLUSTER_SIZE * header->x_size * header->y_size +
55            ARCHINFO_DEVICE_SIZE * header->devices);
56}
Note: See TracBrowser for help on using the repository browser.