source: trunk/libs/nostdio.c @ 425

Last change on this file since 425 was 412, checked in by alain, 6 years ago

Introduce user libraries

File size: 2.0 KB
Line 
1/*
2 * nostdio.c - User side non-standard syscalls API implementation.
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#include  <shared_syscalls.h>
25#include  <hal_user.h>
26
27#define   reg_t    int
28
29
30//////////////////////////////////////
31int get_config( unsigned int * x_size,
32                unsigned int * y_size,
33                unsigned int * ncores )
34{
35    return hal_user_syscall( SYS_GET_CONFIG,
36                             (reg_t)x_size,
37                             (reg_t)y_size,
38                             (reg_t)ncores, 0 );
39}
40
41/////////////////////////////////
42int get_core( unsigned int * cxy,
43              unsigned int * lid )
44{
45    return hal_user_syscall( SYS_GET_CORE,
46                             (reg_t)cxy,
47                             (reg_t)lid, 0, 0 );
48}
49
50///////////////////////////////////////////
51int get_cycle( unsigned long long * cycle )
52{
53    return hal_user_syscall( SYS_GET_CYCLE,
54                             (reg_t)cycle, 0, 0, 0 );
55}
56
57////////////////////////////////
58int get_sched( unsigned int cxy,
59               unsigned int lid )
60{
61    return hal_user_syscall( SYS_GET_SCHED,
62                             (reg_t)cxy,
63                             (reg_t)lid, 0, 0 );
64} 
65
66///////////////////////////
67void panic( char * string )
68{
69    hal_user_syscall( SYS_PANIC,
70                      (reg_t)string, 0, 0, 0 );
71}
Note: See TracBrowser for help on using the repository browser.