[412] | 1 | /* |
---|
| 2 | * nostdio.h - User side non-standard syscalls API. |
---|
| 3 | * |
---|
| 4 | * Author Alain Greiner (2016,2017) |
---|
| 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 | #ifndef _NOSTD_H_ |
---|
| 25 | #define _NOSTD_H_ |
---|
| 26 | |
---|
| 27 | /*************************************************************************************** |
---|
| 28 | * This function uses the relevant syscall to return the hardware platform parameters. |
---|
| 29 | *************************************************************************************** |
---|
| 30 | * @ x_size : [out] number of clusters in a row. |
---|
| 31 | * @ y_size : [out] number of clusters in a column. |
---|
| 32 | * @ ncores : [out] number of cores per cluster. |
---|
| 33 | * @ return 0 if success / return -1 if illegal pointers arguments. |
---|
| 34 | **************************************************************************************/ |
---|
| 35 | int get_config( unsigned int * x_size, |
---|
| 36 | unsigned int * y_size, |
---|
| 37 | unsigned int * ncores ); |
---|
| 38 | |
---|
| 39 | /*************************************************************************************** |
---|
| 40 | * This function uses the relevant syscall to returns the cluster an local index |
---|
| 41 | * for the calling core. |
---|
| 42 | *************************************************************************************** |
---|
| 43 | * @ cxy : [out] cluster identifier. |
---|
| 44 | * @ lid : [out] core local index in cluster. |
---|
| 45 | * @ return 0 if success / return -1 if illegal pointers arguments. |
---|
| 46 | **************************************************************************************/ |
---|
| 47 | int get_core( unsigned int * cxy, |
---|
| 48 | unsigned int * lid ); |
---|
| 49 | |
---|
| 50 | /*************************************************************************************** |
---|
| 51 | * This function uses the relevant syscall to returns the calling core cycles counter, |
---|
| 52 | * taking into account a possible overflow on 32 bits architectures. |
---|
| 53 | *************************************************************************************** |
---|
| 54 | * @ cycle : [out] current cycle value. |
---|
| 55 | * @ return 0 if success / return -1 if illegal pointer argument. |
---|
| 56 | **************************************************************************************/ |
---|
| 57 | int get_cycle( unsigned long long * cycle ); |
---|
| 58 | |
---|
| 59 | /*************************************************************************************** |
---|
| 60 | * This function uses the relevant syscall to display the state of the scheduler |
---|
| 61 | * identified by the <cxy> and <lid> arguments. |
---|
| 62 | *************************************************************************************** |
---|
| 63 | * @ cxy : [in] target cluster identifier. |
---|
| 64 | * @ lid : [in] target core local index. |
---|
| 65 | * @ return 0 if success / return -1 if illegal arguments. |
---|
| 66 | **************************************************************************************/ |
---|
| 67 | int get_sched( unsigned int cxy, |
---|
| 68 | unsigned int lid ); |
---|
| 69 | |
---|
| 70 | /*************************************************************************************** |
---|
| 71 | * This function uses the relevant syscall to display on the kernel terminal a debug |
---|
| 72 | * message in case of panic (such as a printf failure). |
---|
| 73 | * This message contains the thread / process / core identifiers, and the cause, |
---|
| 74 | * as defined by the <string> argument. |
---|
| 75 | *************************************************************************************** |
---|
| 76 | * @ string : [in] cause of user panic. |
---|
| 77 | **************************************************************************************/ |
---|
| 78 | void panic( char * string ); |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | #endif // _NOSTD_H_ |
---|
| 83 | |
---|