Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / dev / timeofday / src / SS_TimeOfDay.cc
CommitLineData
920dae64
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: SS_TimeOfDay.cc
4// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21
22#include <sys/socket.h>
23#include <unistd.h>
24#include "SS_TimeOfDay.h"
25
26SS_TimeOfDay::SS_TimeOfDay( SS_AddressMap* map, SS_Paddr lo, SS_Paddr hi )/*{{{*/
27 :
28 base(lo)
29{
30 map->add(lo,hi,this,SS_AddressMap::REL,SS_TimeOfDay::access);
31}
32/*}}}*/
33SS_TimeOfDay::~SS_TimeOfDay()/*{{{*/
34{
35}
36/*}}}*/
37
38void SS_TimeOfDay::access( void* obj, uint_t sid, SS_Access::Type type, SS_Paddr pa, uint_t size, uint64_t* data )/*{{{*/
39{
40 SS_TimeOfDay* self = (SS_TimeOfDay*)obj;
41
42 // I wonder whether the time should be captured when this
43 // device is created and then incremented based of simulated
44 // time or not ...
45
46 if ((type == SS_Access::LOAD) && (pa == 0) && (size == 8))
47 *data = time(0);
48 else
49 fprintf(stderr,"TOD: Invalid access type from 0x%llx - IGNORED\n",size,self->base + pa);
50}
51/*}}}*/
52
53
54
55