source: soft/giet_vm/giet_drivers/sim_driver.c @ 271

Last change on this file since 271 was 258, checked in by alain, 11 years ago

This is a major release, including a deep restructuration of code.
The main evolutions are

  • use of the Tsar preloader to load the GIET boot-loader from disk
  • introduction of a FAT32 file system library,
  • use of this fat32 library by the boot-loader to load the map.bin data structure, and the various .elf files
  • reorganisation of drivers (one file per peripheral).
  • introduction of drivers for new peripherals: vci_chbuf_dma and vci_multi_ahci.
  • introduction of a new physical memory allocator in the boot code.

This release has been tested on the tsar_generic_iob architecture,
for the two following mappings: 4c_1p_iob_four.xml and 4c_1p_iob_sort.xml

File size: 2.3 KB
RevLine 
[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// 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 giet_vsegs.ld file.
12////////////////////////////////////////////////////////////////////////////////
13
14#include <giet_config.h>
15#include <sim_driver.h>
16#include <utils.h>
17
18////////////////////////////////////////////////////////////////////////////////
19// _sim_helper_access()
20// Accesses the Simulation Helper Component.
21//
22// If the access is on a writable register (except SIMHELPER_PAUSE_SIM),
23// the simulation will stop.
24// If the access is on a readable register, value is written in retval buffer.
25// Returns 0 on success, 1 on failure.
26////////////////////////////////////////////////////////////////////////////////
27unsigned int _sim_helper_access( unsigned int register_index,
28                                 unsigned int value,
29                                 unsigned int * retval) 
30{
31    unsigned int* sim_helper_address = (unsigned int*)&seg_sim_base;
32   
33    if (register_index == SIMHELPER_SC_STOP         ||
34        register_index == SIMHELPER_END_WITH_RETVAL ||
35        register_index == SIMHELPER_EXCEPT_WITH_VAL ||
36        register_index == SIMHELPER_PAUSE_SIM       ||
37        register_index == SIMHELPER_SIGINT) 
38    {
39        sim_helper_address[register_index] = value;
40        return 0;
41    }
42    else if (register_index == SIMHELPER_CYCLES) 
43    {
44        *retval = sim_helper_address[register_index];
45        return 0;
46    }
47    else 
48    {
49        _tty_get_lock( 0 );
50        _puts("\n[GIET ERROR] in _sim_helper_access() : access to unmapped register\n");
51        _tty_release_lock( 0 );
52        return 1;
53    }
54}
55
56// Local Variables:
57// tab-width: 4
58// c-basic-offset: 4
59// c-file-offsets:((innamespace . 0)(inline-open . 0))
60// indent-tabs-mode: nil
61// End:
62// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
63
Note: See TracBrowser for help on using the repository browser.