source:
soft/giet_vm/giet_drivers/sim_driver.c
@
445
Last change on this file since 445 was 437, checked in by , 10 years ago | |
---|---|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[258] | 1 | /////////////////////////////////////////////////////////////////////////////////// |
2 | // File : sim_driver.c | |
3 | // Date : 23/11/2013 | |
4 | // Author : alain greiner / cesar fuguet | |
5 | // Copyright (c) UPMC-LIP6 | |
6 | /////////////////////////////////////////////////////////////////////////////////// | |
7 | ||
[320] | 8 | #include <hard_config.h> |
[258] | 9 | #include <giet_config.h> |
10 | #include <sim_driver.h> | |
11 | ||
[320] | 12 | #if !defined(SEG_SIM_BASE) |
13 | # error: You must define SEG_SIM_BASE in the hard_config.h file | |
14 | #endif | |
15 | ||
[437] | 16 | ///////////////////////////////////////////////////// |
17 | void _sim_helper_access( unsigned int register_index, | |
18 | unsigned int value, | |
19 | unsigned int * retval ) | |
[258] | 20 | { |
[345] | 21 | volatile unsigned int* sim_helper_address = (unsigned int*)&seg_sim_base; |
[258] | 22 | |
[437] | 23 | if (register_index == SIMHELPER_SC_STOP) |
[258] | 24 | { |
25 | sim_helper_address[register_index] = value; | |
26 | } | |
27 | else if (register_index == SIMHELPER_CYCLES) | |
28 | { | |
29 | *retval = sim_helper_address[register_index]; | |
30 | } | |
31 | else | |
32 | { | |
33 | _tty_get_lock( 0 ); | |
[437] | 34 | _puts("\n[GIET ERROR] in _sim_helper_access() : undefined register\n"); |
[258] | 35 | _tty_release_lock( 0 ); |
[437] | 36 | _exit(); |
[258] | 37 | } |
38 | } | |
39 | ||
40 | // Local Variables: | |
41 | // tab-width: 4 | |
42 | // c-basic-offset: 4 | |
43 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) | |
44 | // indent-tabs-mode: nil | |
45 | // End: | |
46 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | |
47 |
Note: See TracBrowser
for help on using the repository browser.