Changeset 437 for soft/giet_vm/giet_drivers/sim_driver.c
- Timestamp:
- Nov 3, 2014, 10:53:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/sim_driver.c
r345 r437 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 // The sim_driver.c and sim_driver.h files are part ot the GIET-VM nano-kernel.8 // This driver supports the vci_sim_helper component.9 // There is at most one such component in the architecture.10 //11 // The SEG_SIM_BASE address must be defined in the hard_config.h file.12 ////////////////////////////////////////////////////////////////////////////////13 7 14 8 #include <hard_config.h> … … 20 14 #endif 21 15 22 //////////////////////////////////////////////////////////////////////////////// 23 // _sim_helper_access() 24 // Accesses the Simulation Helper Component. 25 // 26 // If the access is on a writable register (except SIMHELPER_PAUSE_SIM), 27 // the simulation will stop. 28 // If the access is on a readable register, value is written in retval buffer. 29 // Returns 0 on success, 1 on failure. 30 //////////////////////////////////////////////////////////////////////////////// 31 unsigned int _sim_helper_access( unsigned int register_index, 32 unsigned int value, 33 unsigned int * retval) 16 ///////////////////////////////////////////////////// 17 void _sim_helper_access( unsigned int register_index, 18 unsigned int value, 19 unsigned int * retval ) 34 20 { 35 21 volatile unsigned int* sim_helper_address = (unsigned int*)&seg_sim_base; 36 22 37 if (register_index == SIMHELPER_SC_STOP || 38 register_index == SIMHELPER_END_WITH_RETVAL || 39 register_index == SIMHELPER_EXCEPT_WITH_VAL || 40 register_index == SIMHELPER_PAUSE_SIM || 41 register_index == SIMHELPER_SIGINT) 23 if (register_index == SIMHELPER_SC_STOP) 42 24 { 43 25 sim_helper_address[register_index] = value; 44 return 0;45 26 } 46 27 else if (register_index == SIMHELPER_CYCLES) 47 28 { 48 29 *retval = sim_helper_address[register_index]; 49 return 0;50 30 } 51 31 else 52 32 { 53 33 _tty_get_lock( 0 ); 54 _puts("\n[GIET ERROR] in _sim_helper_access() : access to unmapped register\n");34 _puts("\n[GIET ERROR] in _sim_helper_access() : undefined register\n"); 55 35 _tty_release_lock( 0 ); 56 return 1;36 _exit(); 57 37 } 58 38 }
Note: See TracChangeset
for help on using the changeset viewer.