d865a9767a7e3f1f2f7571d16ebb669d080a7b31
[fw/sdcc] / sim / ucsim / sim.src / itsrc.cc
1 /*
2  * Simulator of microcontrollers (itsrc.cc)
3  *
4  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5  * 
6  * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
7  *
8  */
9
10 /* This file is part of microcontroller simulator: ucsim.
11
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING.  If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 02111-1307, USA. */
26 /*@1@*/
27
28 #include "ddconfig.h"
29
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include "i_string.h"
33
34 #include "itsrccl.h"
35 #include "pobjcl.h"
36 #include "stypes.h"
37
38
39 /*
40  * Interrupt source
41  ******************************************************************************
42  */
43
44 cl_it_src::cl_it_src(uchar Iie_mask,
45                      uchar Isrc_reg,
46                      uchar Isrc_mask,
47                      uint  Iaddr,
48                      bool  Iclr_bit,
49                      char  *Iname):
50   cl_base()
51 {
52   ie_mask = Iie_mask;
53   src_reg = Isrc_reg;
54   src_mask= Isrc_mask;
55   addr    = Iaddr;
56   clr_bit = Iclr_bit;
57   if (Iname != NULL)
58     name= strdup(Iname);
59   else
60     name= strdup("unknown");
61   active= TRUE;
62 }
63
64 cl_it_src::~cl_it_src(void)
65 {
66   free(name);
67 }
68
69 bool
70 cl_it_src::is_active(void)
71 {
72   return(active);
73 }
74
75 void
76 cl_it_src::set_active_status(bool Aactive)
77 {
78   active= Aactive;
79 }
80
81 void
82 cl_it_src::activate(void)
83 {
84   set_active_status(TRUE);
85 }
86
87 void
88 cl_it_src::deactivate(void)
89 {
90   set_active_status(FALSE);
91 }
92
93
94 /*
95  * Interrupt level
96  ******************************************************************************
97  */
98
99 it_level::it_level(int alevel, uint aaddr, uint aPC, class cl_it_src *is):
100   cl_base()
101 {
102   level = alevel;
103   addr  = aaddr;
104   PC    = aPC;
105   source= is;
106 }
107
108
109
110 /* End of itsrc.cc */