Imported Upstream version 2.9.0
[debian/cc1111] / sim / ucsim / sim.src / itsrccl.h
1 /*
2  * Simulator of microcontrollers (sim.src/itsrccl.h)
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 #ifndef SIM_ITSRCCL_HEADER
29 #define SIM_ITSRCCL_HEADER
30
31 #include "pobjcl.h"
32 #include "stypes.h"
33
34
35 /*
36  * Represents source of interrupt
37  */
38
39 class cl_it_src: public cl_base
40 {
41 public:
42   int poll_priority;
43   uchar ie_mask;  // Mask in IE register
44   uchar src_reg;  // Register in SFR of source
45   uchar src_mask; // Mask of source bit in src_reg
46   uint  addr;     // Address of service routine
47   bool  clr_bit;  // Request bit must be cleared when IT accepted
48   //char  *name;          // For debug
49   bool  active;   // Acceptance can be disabled
50
51   cl_it_src(uchar Iie_mask,
52             uchar Isrc_reg,
53             uchar Isrc_mask,
54             uint  Iaddr,
55             bool  Iclr_bit,
56             const char  *Iname,
57             int   apoll_priority);
58   virtual ~cl_it_src(void);
59
60           bool is_active(void);
61   virtual void set_active_status(bool Aactive);
62   virtual void activate(void);
63   virtual void deactivate(void);
64 };
65
66
67 class cl_irqs: public cl_sorted_list
68 {
69 public:
70   cl_irqs(t_index alimit, t_index adelta);
71   virtual const void *key_of(void *item); 
72   virtual int compare(const void *key1, const void *key2);
73 };
74
75
76 /*
77  * This class is used to follow levels of accepted interrupts
78  * It used on a stack of active interrupt services (it_levels of cl_uc)
79  */
80
81 class it_level: public cl_base
82 {
83 public:
84   int level;
85   uint addr;
86   uint PC;
87   class cl_it_src *source;
88 public:
89   it_level(int alevel, uint aaddr, uint aPC, class cl_it_src *is);
90 };
91
92
93 #endif
94
95 /* End of itsrccl.h */