ipxact-ruby 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.autotest +15 -0
- data/.gitignore +2 -0
- data/README.html +89 -0
- data/README.mdown +91 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/autotest/discover.rb +17 -0
- data/lib/ipxact.rb +263 -0
- data/lib/ipxact/component.rb +235 -0
- data/lib/ipxact/parser.rb +27 -0
- data/lib/ipxact/parser/bus_data_parser.rb +229 -0
- data/lib/ipxact/parser/component_data_parser.rb +309 -0
- data/lib/ipxact/parser/platform_data_parser.rb +63 -0
- data/lib/ipxact/pathfinder/graph_pathfinder.rb +191 -0
- data/lib/ipxact/platform.rb +43 -0
- data/schemas/abstractionDefinition.xsd +332 -0
- data/schemas/abstractor.xsd +156 -0
- data/schemas/autoConfigure.xsd +226 -0
- data/schemas/busDefinition.xsd +99 -0
- data/schemas/busInterface.xsd +640 -0
- data/schemas/commonStructures.xsd +189 -0
- data/schemas/component.xsd +253 -0
- data/schemas/configurable.xsd +82 -0
- data/schemas/constraints.xsd +283 -0
- data/schemas/design.xsd +105 -0
- data/schemas/designConfig.xsd +144 -0
- data/schemas/file.xsd +560 -0
- data/schemas/fileType.xsd +86 -0
- data/schemas/generator.xsd +240 -0
- data/schemas/identifier.xsd +93 -0
- data/schemas/index.xsd +67 -0
- data/schemas/memoryMap.xsd +1007 -0
- data/schemas/model.xsd +291 -0
- data/schemas/port.xsd +441 -0
- data/schemas/signalDrivers.xsd +220 -0
- data/schemas/simpleTypes.xsd +90 -0
- data/schemas/subInstances.xsd +256 -0
- data/spec/integration/bus_data_extraction_spec.rb +105 -0
- data/spec/integration/data_calculation_spec.rb +133 -0
- data/spec/integration/data_construction_spec.rb +52 -0
- data/spec/integration/general_spec.rb +121 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.h +135 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.tpp +247 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port_base.h +189 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.h +205 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.tpp +278 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.h +115 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.tpp +126 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port.h +168 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port_base.h +133 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_tlm_if.h +280 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/user_types.h +38 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/Leon2Platform.xml +77 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/design_Leon2Platform.xml +156 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/tlmsrc/Leon2Platform.h +149 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/apbSubSystem.xml +406 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/design_apbSubSystem.xml +135 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/tlmsrc/apbSubSystem.h +133 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/Leon2Platform.xml +77 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/design_Leon2Platform.xml +157 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/tlmsrc/Leon2Platform.h +150 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/apbSubSystem.xml +422 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/designConfig_apbSubSystem.xml +79 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/design_apbSubSystem.xml +184 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/tlmsrc/apbSubSystem.h +164 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/Leon2Platform.xml +105 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/design_Leon2Platform.xml +157 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/tlmsrc/Leon2Platform.h +152 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/apbSubSystem.xml +429 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/designConfig_apbSubSystem.xml +64 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/design_apbSubSystem.xml +150 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/tlmsrc/apbSubSystem.h +167 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/ahbbus22.xml +236 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/tlmsrc/ahbbus.h +52 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/ahbram.xml +184 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.cc +93 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.h +77 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/apbbus8.xml +544 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/tlmsrc/apbbus.h +55 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/apbmst.xml +209 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/tlmsrc/apbmst.h +53 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/apbram.xml +395 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.cc +89 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.h +69 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.v +82 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.vhd +132 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/cgu.xml +686 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.cc +121 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.h +81 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/cgu.xml +707 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.cc +121 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.h +81 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/dma.xml +272 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.cc +230 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.h +116 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/irqctrl.xml +530 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.cc +211 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.h +108 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/processor.xml +423 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.cc +331 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.h +121 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/pv2apb.xml +240 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.cc +153 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.h +77 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/pv2tac.xml +154 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.cc +114 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.h +67 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/rgu.xml +766 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.cc +126 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.h +105 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/scmlAdaptor.xml +154 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.cc +100 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.h +62 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/serial_device.xml +151 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/tlmsrc/serial_device.h +85 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/timers.xml +460 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.cc +201 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.h +102 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart.h +152 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_fifo.h +113 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_memory_map.h +96 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_types.h +60 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart.cc +125 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_interrupt_handler.cc +136 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_register_bank.cc +129 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_serial_tx_rx.cc +145 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/uart_scml.xml +372 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/Leon2_uart.h +216 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/def_Leon2_uart.h +34 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_field.h +72 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_register.h +129 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlmreg_Leon2_uart.h +133 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/Leon2_uart.cc +316 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/tlmreg_Leon2_uart.cc +197 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/user_specific_Leon2_uart.cc +146 -0
- data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/uart_tac.xml +222 -0
- data/spec/unit/component_spec.rb +98 -0
- data/spec/unit/graph_pathfinder_spec.rb +128 -0
- data/spec/unit/interconnect_spec.rb +177 -0
- data/spec/unit/ipxact_spec.rb +69 -0
- data/spec/unit/platform_spec.rb +34 -0
- metadata +225 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Revision: $Revision: 1506 $
|
|
3
|
+
// Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2005, 2006, 2007, 2008, 2009 The SPIRIT Consortium.
|
|
6
|
+
//
|
|
7
|
+
// This work forms part of a deliverable of The SPIRIT Consortium.
|
|
8
|
+
//
|
|
9
|
+
// Use of these materials are governed by the legal terms and conditions
|
|
10
|
+
// outlined in the disclaimer available from www.spiritconsortium.org.
|
|
11
|
+
//
|
|
12
|
+
// This source file is provided on an AS IS basis. The SPIRIT
|
|
13
|
+
// Consortium disclaims any warranty express or implied including
|
|
14
|
+
// any warranty of merchantability and fitness for use for a
|
|
15
|
+
// particular purpose.
|
|
16
|
+
//
|
|
17
|
+
// The user of the source file shall indemnify and hold The SPIRIT
|
|
18
|
+
// Consortium and its members harmless from any damages or liability.
|
|
19
|
+
// Users are requested to provide feedback to The SPIRIT Consortium
|
|
20
|
+
// using either mailto:feedback@lists.spiritconsortium.org or the forms at
|
|
21
|
+
// http://www.spiritconsortium.org/about/contact_us/
|
|
22
|
+
//
|
|
23
|
+
// This file may be copied, and distributed, with or without
|
|
24
|
+
// modifications; but this notice must be included on any copy.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// uart_fifo.h
|
|
28
|
+
|
|
29
|
+
#ifndef H_UART_FIFO
|
|
30
|
+
#define H_UART_FIFO
|
|
31
|
+
|
|
32
|
+
//***************************
|
|
33
|
+
//* Includes *
|
|
34
|
+
//***************************
|
|
35
|
+
#include "systemc.h" // For 'sc_module'
|
|
36
|
+
|
|
37
|
+
//***********************************
|
|
38
|
+
//* UART FIFO Module Class *
|
|
39
|
+
//***********************************
|
|
40
|
+
template <class DT> // Template for the Data Type of the fifo
|
|
41
|
+
class UART_FIFO : public sc_module {
|
|
42
|
+
public:
|
|
43
|
+
//**** Constructor ****//
|
|
44
|
+
UART_FIFO<DT>(sc_module_name N, int pSize) : sc_module(N) {
|
|
45
|
+
fifo = new std::queue<DT>; // Create a new queue object
|
|
46
|
+
Size = pSize;
|
|
47
|
+
TriggerLevel = 1;
|
|
48
|
+
CurrentLevel = 0;
|
|
49
|
+
};
|
|
50
|
+
//**** Destructor ****//
|
|
51
|
+
~UART_FIFO() { delete fifo; };
|
|
52
|
+
|
|
53
|
+
// Function for writing data to the fifo
|
|
54
|
+
void write(DT WriteData) {
|
|
55
|
+
if (CurrentLevel < Size) {
|
|
56
|
+
cout << sc_time_stamp() << ": " << name() << ": Writing to FIFO: " << WriteData;
|
|
57
|
+
fifo->push(WriteData);
|
|
58
|
+
CurrentLevel++;
|
|
59
|
+
cout << " (New FIFO Level = " << CurrentLevel << ")" << endl;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
// Function for reading data from the fifo
|
|
63
|
+
DT read() {
|
|
64
|
+
if (CurrentLevel > 0) {
|
|
65
|
+
DT ReturnData;
|
|
66
|
+
ReturnData = fifo->front();
|
|
67
|
+
fifo->pop();
|
|
68
|
+
CurrentLevel--;
|
|
69
|
+
cout << sc_time_stamp() << ": " << name() << ": Reading from FIFO: " << ReturnData << " (New FIFO Level = " << CurrentLevel << ")" << endl;
|
|
70
|
+
return ReturnData;
|
|
71
|
+
}
|
|
72
|
+
return 0;
|
|
73
|
+
};
|
|
74
|
+
// Function for setting a new trigger level
|
|
75
|
+
void SetTriggerLevel(int level) {
|
|
76
|
+
if (level == 0)
|
|
77
|
+
TriggerLevel = 1; // Minimum Trigger level = 1
|
|
78
|
+
if (level > Size-2)
|
|
79
|
+
TriggerLevel = Size-2; // Maximum Trigger level = Size - 2
|
|
80
|
+
else
|
|
81
|
+
TriggerLevel = level;
|
|
82
|
+
cout << sc_time_stamp() << ": " << name() << ": Trigger Level set to: " << TriggerLevel << endl;
|
|
83
|
+
};
|
|
84
|
+
// Function that returns 1 if FIFO is empty
|
|
85
|
+
bool IsEmpty() {
|
|
86
|
+
return (CurrentLevel == 0);
|
|
87
|
+
};
|
|
88
|
+
// Function that returns 1 if FIFO is full
|
|
89
|
+
bool IsFull() {
|
|
90
|
+
return (CurrentLevel == Size);
|
|
91
|
+
};
|
|
92
|
+
// Function that returns 1 if FIFO is above (or at) the trigger level
|
|
93
|
+
bool IsAboveTriggerLevel() {
|
|
94
|
+
if (CurrentLevel >= TriggerLevel)
|
|
95
|
+
return true;
|
|
96
|
+
else
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
// Function that returns 1 if FIFO is below the trigger level
|
|
100
|
+
bool IsBelowTriggerLevel() {
|
|
101
|
+
if (CurrentLevel < TriggerLevel)
|
|
102
|
+
return true;
|
|
103
|
+
else
|
|
104
|
+
return false;
|
|
105
|
+
};
|
|
106
|
+
private:
|
|
107
|
+
int Size; // The size of the FIFO
|
|
108
|
+
int TriggerLevel; // Trigger Level of the FIFO
|
|
109
|
+
int CurrentLevel; // This variable indicates how many elements are currently in the FIFO
|
|
110
|
+
std::queue<DT> * fifo; // Pointer to the FIFO queue
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
#endif //H_UART_FIFO
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Revision: $Revision: 1506 $
|
|
3
|
+
// Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2005, 2006, 2007, 2008, 2009 The SPIRIT Consortium.
|
|
6
|
+
//
|
|
7
|
+
// This work forms part of a deliverable of The SPIRIT Consortium.
|
|
8
|
+
//
|
|
9
|
+
// Use of these materials are governed by the legal terms and conditions
|
|
10
|
+
// outlined in the disclaimer available from www.spiritconsortium.org.
|
|
11
|
+
//
|
|
12
|
+
// This source file is provided on an AS IS basis. The SPIRIT
|
|
13
|
+
// Consortium disclaims any warranty express or implied including
|
|
14
|
+
// any warranty of merchantability and fitness for use for a
|
|
15
|
+
// particular purpose.
|
|
16
|
+
//
|
|
17
|
+
// The user of the source file shall indemnify and hold The SPIRIT
|
|
18
|
+
// Consortium and its members harmless from any damages or liability.
|
|
19
|
+
// Users are requested to provide feedback to The SPIRIT Consortium
|
|
20
|
+
// using either mailto:feedback@lists.spiritconsortium.org or the forms at
|
|
21
|
+
// http://www.spiritconsortium.org/about/contact_us/
|
|
22
|
+
//
|
|
23
|
+
// This file may be copied, and distributed, with or without
|
|
24
|
+
// modifications; but this notice must be included on any copy.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#ifndef H_UART_MEMORY_MAP
|
|
28
|
+
#define H_UART_MEMORY_MAP
|
|
29
|
+
|
|
30
|
+
// Register Address Map:
|
|
31
|
+
#define UART_MEM_SIZE 6 // Size of the UART address space
|
|
32
|
+
#define UART_REG_WIDTH sizeof(DATA_TYPE) // Byte width of the registers
|
|
33
|
+
|
|
34
|
+
// Index of UART registers
|
|
35
|
+
#define UART_REG_RBR 0 // Receiver Buffer Register
|
|
36
|
+
#define UART_REG_THR 0 // Transmitter Holding Register
|
|
37
|
+
#define UART_REG_IER 1 // Interrupt Enable (Mask) Register
|
|
38
|
+
#define UART_REG_IIR 2 // Interrupt Identification Register
|
|
39
|
+
#define UART_REG_FCR 2 // FIFO Control Register
|
|
40
|
+
#define UART_REG_LCR 3 // Line Control Register
|
|
41
|
+
#define UART_REG_LSR 5 // Line Status Register
|
|
42
|
+
|
|
43
|
+
// Individual Bit positions within registers
|
|
44
|
+
#define UART_BIT_FCR_FIFOE 0 // Position of FIFO Enable bit in FCR register
|
|
45
|
+
|
|
46
|
+
#define UART_BIT_LSR_THRE 5 // Position of THR Empty bit in LSR register
|
|
47
|
+
#define UART_BIT_LSR_BI 4 // Position of Break Indicator bit in LSR register
|
|
48
|
+
#define UART_BIT_LSR_FE 3 // Position of Frame Error bit in LSR register
|
|
49
|
+
#define UART_BIT_LSR_PE 2 // Position of Parity Error bit in LSR register
|
|
50
|
+
#define UART_BIT_LSR_OE 1 // Position of Overflow Error bit in LSR register
|
|
51
|
+
#define UART_BIT_LSR_DR 0 // Position of Data Ready bit in LSR register
|
|
52
|
+
|
|
53
|
+
#define UART_BIT_IER_ELSI 2 // Position of Enable Line Status Interrupt bit in IER register
|
|
54
|
+
#define UART_BIT_IER_ETBEI 1 // Position of Enable Transmit Buffer Empty Interrupt bit in IER register
|
|
55
|
+
#define UART_BIT_IER_ERBFI 0 // Position of Enable Receive Buffer Full Interrupt bit in IER register
|
|
56
|
+
|
|
57
|
+
#define UART_BIT_LCR_SB 6 // Position of Set Break bit in LCR register
|
|
58
|
+
#define UART_BIT_LCR_SP 5 // Position of Stick Parity bit in LCR register
|
|
59
|
+
#define UART_BIT_LCR_EPS 4 // Position of Even Parity Select bit in LCR register
|
|
60
|
+
#define UART_BIT_LCR_PEN 3 // Position of Parity Enable bit in LCR register
|
|
61
|
+
#define UART_BIT_LCR_STB 2 // Position of Number of Stop Bits bit in LCR register
|
|
62
|
+
#define UART_BIT_LCR_WLS1 1 // Position of Word Length Select bit 1 in LCR register
|
|
63
|
+
#define UART_BIT_LCR_WLS0 0 // Position of Word Length Select bit 0 in LCR register
|
|
64
|
+
|
|
65
|
+
// Line Control Register Options
|
|
66
|
+
#define UART_LCR_SET_BREAK (1 << UART_BIT_LCR_SB)
|
|
67
|
+
|
|
68
|
+
#define UART_LCR_NO_PARITY ((0 << UART_BIT_LCR_PEN) | (0 << UART_BIT_LCR_EPS) | (0 << UART_BIT_LCR_SP))
|
|
69
|
+
#define UART_LCR_ODD_PARITY ((1 << UART_BIT_LCR_PEN) | (0 << UART_BIT_LCR_EPS) | (0 << UART_BIT_LCR_SP))
|
|
70
|
+
#define UART_LCR_EVEN_PARITY ((1 << UART_BIT_LCR_PEN) | (1 << UART_BIT_LCR_EPS) | (0 << UART_BIT_LCR_SP))
|
|
71
|
+
#define UART_LCR_STICK1_PARITY ((1 << UART_BIT_LCR_PEN) | (0 << UART_BIT_LCR_EPS) | (1 << UART_BIT_LCR_SP))
|
|
72
|
+
#define UART_LCR_STICK0_PARITY ((1 << UART_BIT_LCR_PEN) | (1 << UART_BIT_LCR_EPS) | (1 << UART_BIT_LCR_SP))
|
|
73
|
+
|
|
74
|
+
#define UART_LCR_TWO_STOPBITS (1 << UART_BIT_LCR_STB)
|
|
75
|
+
|
|
76
|
+
#define UART_LCR_WL5 ((0 << UART_BIT_LCR_WLS1) | (0 << UART_BIT_LCR_WLS0))
|
|
77
|
+
#define UART_LCR_WL6 ((0 << UART_BIT_LCR_WLS1) | (1 << UART_BIT_LCR_WLS0))
|
|
78
|
+
#define UART_LCR_WL7 ((1 << UART_BIT_LCR_WLS1) | (0 << UART_BIT_LCR_WLS0))
|
|
79
|
+
#define UART_LCR_WL8 ((1 << UART_BIT_LCR_WLS1) | (1 << UART_BIT_LCR_WLS0))
|
|
80
|
+
|
|
81
|
+
// Interrupt Identification
|
|
82
|
+
#define UART_IRQ_NONE 0x01 // No Interrupt
|
|
83
|
+
#define UART_IRQ_LS 0x06 // Line Status Interrupt
|
|
84
|
+
#define UART_IRQ_RX 0x04 // Data Received or RX FIFO trigger level reached
|
|
85
|
+
#define UART_IRQ_TX 0x02 // THR Empty or TX FIFO below trigger level
|
|
86
|
+
|
|
87
|
+
// Default Register values
|
|
88
|
+
#define UART_DEFAULT_RBR 0x00 //00000000b
|
|
89
|
+
#define UART_DEFAULT_THR 0x00 //00000000b
|
|
90
|
+
#define UART_DEFAULT_IER 0x00 //00000001b
|
|
91
|
+
#define UART_DEFAULT_IIR 0x01 //00000001b
|
|
92
|
+
#define UART_DEFAULT_FCR 0x01 //00000001b
|
|
93
|
+
#define UART_DEFAULT_LCR (UART_LCR_ODD_PARITY | UART_LCR_WL7)
|
|
94
|
+
#define UART_DEFAULT_LSR 0x60 //01100000b
|
|
95
|
+
|
|
96
|
+
#endif // H_UART_MEMORY_MAP
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Revision: $Revision: 1506 $
|
|
3
|
+
// Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2005, 2006, 2007, 2008, 2009 The SPIRIT Consortium.
|
|
6
|
+
//
|
|
7
|
+
// This work forms part of a deliverable of The SPIRIT Consortium.
|
|
8
|
+
//
|
|
9
|
+
// Use of these materials are governed by the legal terms and conditions
|
|
10
|
+
// outlined in the disclaimer available from www.spiritconsortium.org.
|
|
11
|
+
//
|
|
12
|
+
// This source file is provided on an AS IS basis. The SPIRIT
|
|
13
|
+
// Consortium disclaims any warranty express or implied including
|
|
14
|
+
// any warranty of merchantability and fitness for use for a
|
|
15
|
+
// particular purpose.
|
|
16
|
+
//
|
|
17
|
+
// The user of the source file shall indemnify and hold The SPIRIT
|
|
18
|
+
// Consortium and its members harmless from any damages or liability.
|
|
19
|
+
// Users are requested to provide feedback to The SPIRIT Consortium
|
|
20
|
+
// using either mailto:feedback@lists.spiritconsortium.org or the forms at
|
|
21
|
+
// http://www.spiritconsortium.org/about/contact_us/
|
|
22
|
+
//
|
|
23
|
+
// This file may be copied, and distributed, with or without
|
|
24
|
+
// modifications; but this notice must be included on any copy.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// uart_types.h
|
|
28
|
+
|
|
29
|
+
#ifndef H_UART_TYPES
|
|
30
|
+
#define H_UART_TYPES
|
|
31
|
+
|
|
32
|
+
//*******************************
|
|
33
|
+
//* Type Definitions *
|
|
34
|
+
//*******************************
|
|
35
|
+
typedef unsigned int DATA_TYPE;
|
|
36
|
+
typedef unsigned int ADDRESS_TYPE;
|
|
37
|
+
|
|
38
|
+
typedef struct SerialDataStructure { // This structure is send and received through the serial UART interface
|
|
39
|
+
bool StartBit;
|
|
40
|
+
unsigned char Data;
|
|
41
|
+
bool Parity;
|
|
42
|
+
bool StopBit;
|
|
43
|
+
|
|
44
|
+
// Default Constructor
|
|
45
|
+
SerialDataStructure() {
|
|
46
|
+
StartBit = 1;
|
|
47
|
+
Data = '0';
|
|
48
|
+
Parity = 1;
|
|
49
|
+
StopBit = 1;
|
|
50
|
+
};
|
|
51
|
+
// Constructor with argument passing
|
|
52
|
+
SerialDataStructure(bool pStartBit, unsigned char pData, bool pParity, bool pStopBit) {
|
|
53
|
+
StartBit = pStartBit;
|
|
54
|
+
Data = pData;
|
|
55
|
+
Parity = pParity;
|
|
56
|
+
StopBit = pStopBit;
|
|
57
|
+
}
|
|
58
|
+
} SERIAL_DATA_STRUCTURE;
|
|
59
|
+
|
|
60
|
+
#endif // H_UART_TYPES
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Revision: $Revision: 1506 $
|
|
3
|
+
// Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2005, 2006, 2007, 2008, 2009 The SPIRIT Consortium.
|
|
6
|
+
//
|
|
7
|
+
// This work forms part of a deliverable of The SPIRIT Consortium.
|
|
8
|
+
//
|
|
9
|
+
// Use of these materials are governed by the legal terms and conditions
|
|
10
|
+
// outlined in the disclaimer available from www.spiritconsortium.org.
|
|
11
|
+
//
|
|
12
|
+
// This source file is provided on an AS IS basis. The SPIRIT
|
|
13
|
+
// Consortium disclaims any warranty express or implied including
|
|
14
|
+
// any warranty of merchantability and fitness for use for a
|
|
15
|
+
// particular purpose.
|
|
16
|
+
//
|
|
17
|
+
// The user of the source file shall indemnify and hold The SPIRIT
|
|
18
|
+
// Consortium and its members harmless from any damages or liability.
|
|
19
|
+
// Users are requested to provide feedback to The SPIRIT Consortium
|
|
20
|
+
// using either mailto:feedback@lists.spiritconsortium.org or the forms at
|
|
21
|
+
// http://www.spiritconsortium.org/about/contact_us/
|
|
22
|
+
//
|
|
23
|
+
// This file may be copied, and distributed, with or without
|
|
24
|
+
// modifications; but this notice must be included on any copy.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// uart.cpp
|
|
28
|
+
|
|
29
|
+
//***************************
|
|
30
|
+
//* Includes *
|
|
31
|
+
//***************************
|
|
32
|
+
#include "uart.h"
|
|
33
|
+
|
|
34
|
+
//***************************************
|
|
35
|
+
//* UART Module: Constructor *
|
|
36
|
+
//***************************************
|
|
37
|
+
uart::uart(sc_module_name Name) :
|
|
38
|
+
sc_module(Name),
|
|
39
|
+
pPVTargetPort("pPVTargetPort"),
|
|
40
|
+
pReset("pReset"),
|
|
41
|
+
pInterrupt("pInterrupt"),
|
|
42
|
+
pSerialOut("pSerialOut"),
|
|
43
|
+
pSerialIn("pSerialIn"),
|
|
44
|
+
mRegisterBank("mRegisterBank", scml_memsize(UART_MEM_SIZE)),
|
|
45
|
+
rRBR_THR("rRBR_THR", mRegisterBank, UART_REG_RBR, 1),
|
|
46
|
+
rIIR_FCR("rIIR_FCR", mRegisterBank, UART_REG_IIR, 1),
|
|
47
|
+
rIER("rIER", mRegisterBank, UART_REG_IER, 1),
|
|
48
|
+
bIER_ELSI("bIER_ELSI", rIER, UART_BIT_IER_ELSI, 1),
|
|
49
|
+
bIER_ETBEI("bIER_ETBEI", rIER, UART_BIT_IER_ETBEI, 1),
|
|
50
|
+
bIER_ERBFI("bIER_ERBFI", rIER, UART_BIT_IER_ERBFI, 1),
|
|
51
|
+
rLCR("rLCR", mRegisterBank, UART_REG_LCR, 1),
|
|
52
|
+
bLCR_SB("bLCR_SB", rLCR, UART_BIT_LCR_SB, 1),
|
|
53
|
+
bLCR_SP("bLCR_SP", rLCR, UART_BIT_LCR_SP, 1),
|
|
54
|
+
bLCR_EPS("bLCR_EPS", rLCR, UART_BIT_LCR_EPS, 1),
|
|
55
|
+
bLCR_PEN("bLCR_PEN", rLCR, UART_BIT_LCR_PEN, 1),
|
|
56
|
+
bLCR_STB("bLCR_STB", rLCR, UART_BIT_LCR_STB, 1),
|
|
57
|
+
bLCR_WLS1("bLCR_WLS1", rLCR, UART_BIT_LCR_WLS1, 1),
|
|
58
|
+
bLCR_WLS0("bLCR_WLS0", rLCR, UART_BIT_LCR_WLS0, 1),
|
|
59
|
+
rLSR("rLSR", mRegisterBank, UART_REG_LSR, 1),
|
|
60
|
+
bLSR_THRE("bLSR_THRE", rLSR, UART_BIT_LSR_THRE, 1),
|
|
61
|
+
bLSR_BI("bLSR_BI", rLSR, UART_BIT_LSR_BI, 1),
|
|
62
|
+
bLSR_FE("bLSR_FE", rLSR, UART_BIT_LSR_FE, 1),
|
|
63
|
+
bLSR_PE("bLSR_PE", rLSR, UART_BIT_LSR_PE, 1),
|
|
64
|
+
bLSR_OE("bLSR_OE", rLSR, UART_BIT_LSR_OE, 1),
|
|
65
|
+
bLSR_DR("bLSR_DR", rLSR, UART_BIT_LSR_DR, 1),
|
|
66
|
+
rRBR("rRBR", scml_memsize(1)),
|
|
67
|
+
rTHR("rTHR", scml_memsize(1)),
|
|
68
|
+
rIIR("rIIR", scml_memsize(1)),
|
|
69
|
+
rFCR("rFCR", scml_memsize(1)),
|
|
70
|
+
bFCR_FIFOE("bFCR_FIFOE", rFCR, UART_BIT_FCR_FIFOE, 1),
|
|
71
|
+
TX_FIFO("TX_FIFO", TX_FIFO_SIZE),
|
|
72
|
+
RX_FIFO("RX_FIFO", RX_FIFO_SIZE)
|
|
73
|
+
{
|
|
74
|
+
|
|
75
|
+
mRegisterBank.set_addressing_mode(8); // Set memory to byte addressing
|
|
76
|
+
|
|
77
|
+
pPVTargetPort(mRegisterBank); // Bind the PV port to the register bank
|
|
78
|
+
|
|
79
|
+
// Initialize global class variables
|
|
80
|
+
Clear_LS_Interrupt = false;
|
|
81
|
+
Clear_RX_Interrupt = false;
|
|
82
|
+
Clear_TX_Interrupt = false;
|
|
83
|
+
CurrentInterruptPriority = 6;
|
|
84
|
+
|
|
85
|
+
pSerialIn.bind(*this); // bind the 'pSerialIn' export to this module
|
|
86
|
+
|
|
87
|
+
// Register the call-back functions of the register aliases
|
|
88
|
+
MEMORY_REGISTER_NB_WRITE(rRBR_THR, RegCB_RBR_THR_Write);
|
|
89
|
+
MEMORY_REGISTER_NB_READ(rRBR_THR, RegCB_RBR_THR_Read);
|
|
90
|
+
|
|
91
|
+
MEMORY_REGISTER_NB_WRITE(rIIR_FCR, RegCB_IIR_FCR_Write);
|
|
92
|
+
MEMORY_REGISTER_NB_READ(rIIR_FCR, RegCB_IIR_FCR_Read);
|
|
93
|
+
|
|
94
|
+
MEMORY_REGISTER_NB_READ(rLSR, RegCB_LSR_Read);
|
|
95
|
+
|
|
96
|
+
MEMORY_REGISTER_NB_WRITE(rIER, RegCB_IER_Write);
|
|
97
|
+
|
|
98
|
+
// Declare methods
|
|
99
|
+
SC_METHOD(Serial_Transmit);
|
|
100
|
+
sensitive << TransmitEvent;
|
|
101
|
+
dont_initialize();
|
|
102
|
+
|
|
103
|
+
SC_METHOD(Handle_Interrupts);
|
|
104
|
+
sensitive << InterruptEvent;
|
|
105
|
+
dont_initialize();
|
|
106
|
+
|
|
107
|
+
SC_METHOD(Reset);
|
|
108
|
+
sensitive << pReset.pos();
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
//*******************************************************************
|
|
112
|
+
//* UART Module: Reset() *
|
|
113
|
+
//* This Function resets all registers to their default value. *
|
|
114
|
+
//*******************************************************************
|
|
115
|
+
void uart::Reset() {
|
|
116
|
+
cout << name() << " resetting registers" << endl;
|
|
117
|
+
mRegisterBank.initialize(0);
|
|
118
|
+
rRBR = UART_DEFAULT_RBR;
|
|
119
|
+
rTHR = UART_DEFAULT_THR;
|
|
120
|
+
rIER = UART_DEFAULT_IER;
|
|
121
|
+
rIIR = UART_DEFAULT_IIR;
|
|
122
|
+
rFCR = UART_DEFAULT_FCR;
|
|
123
|
+
rLCR = UART_DEFAULT_LCR;
|
|
124
|
+
rLSR = UART_DEFAULT_LSR;
|
|
125
|
+
};
|
data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_interrupt_handler.cc
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Revision: $Revision: 1506 $
|
|
3
|
+
// Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2005, 2006, 2007, 2008, 2009 The SPIRIT Consortium.
|
|
6
|
+
//
|
|
7
|
+
// This work forms part of a deliverable of The SPIRIT Consortium.
|
|
8
|
+
//
|
|
9
|
+
// Use of these materials are governed by the legal terms and conditions
|
|
10
|
+
// outlined in the disclaimer available from www.spiritconsortium.org.
|
|
11
|
+
//
|
|
12
|
+
// This source file is provided on an AS IS basis. The SPIRIT
|
|
13
|
+
// Consortium disclaims any warranty express or implied including
|
|
14
|
+
// any warranty of merchantability and fitness for use for a
|
|
15
|
+
// particular purpose.
|
|
16
|
+
//
|
|
17
|
+
// The user of the source file shall indemnify and hold The SPIRIT
|
|
18
|
+
// Consortium and its members harmless from any damages or liability.
|
|
19
|
+
// Users are requested to provide feedback to The SPIRIT Consortium
|
|
20
|
+
// using either mailto:feedback@lists.spiritconsortium.org or the forms at
|
|
21
|
+
// http://www.spiritconsortium.org/about/contact_us/
|
|
22
|
+
//
|
|
23
|
+
// This file may be copied, and distributed, with or without
|
|
24
|
+
// modifications; this notice must be included on any copy.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// uart_interrupt_handler.cpp
|
|
28
|
+
|
|
29
|
+
//***************************
|
|
30
|
+
//* Includes *
|
|
31
|
+
//***************************
|
|
32
|
+
#include "uart.h"
|
|
33
|
+
|
|
34
|
+
//***********************************************************************************
|
|
35
|
+
//* UART Module: Handle_Interrupts() *
|
|
36
|
+
//* This Method is triggered by the 'InterruptEvent' event. *
|
|
37
|
+
//* It checks the status of the UART and issues interrupts when necessary. *
|
|
38
|
+
//***********************************************************************************
|
|
39
|
+
void uart::Handle_Interrupts() {
|
|
40
|
+
|
|
41
|
+
rIIR = (bFCR_FIFOE << 7) | (bFCR_FIFOE << 6) | UART_IRQ_NONE; // Set the IIR register do default value (NO interrupt pending)
|
|
42
|
+
|
|
43
|
+
if (CurrentInterruptPriority == 1 && Clear_LS_Interrupt == true) { // If the Line Status Interrupt is to be cleared...
|
|
44
|
+
cout << sc_time_stamp() << ": " << name() << ": Line Status Interrupt Cleared." << endl;
|
|
45
|
+
Clear_LS_Interrupt = false;
|
|
46
|
+
bLSR_OE = 0; // Clear the Overflow Error bit
|
|
47
|
+
bLSR_PE = 0; // Clear the Parity Error bit
|
|
48
|
+
bLSR_FE = 0; // Clear the Framing Error bit
|
|
49
|
+
bLSR_BI = 0; // Clear the Break Indicator bit
|
|
50
|
+
CurrentInterruptPriority = 6; // Reset interrupt priority level
|
|
51
|
+
pInterrupt = 0; // Clear Interrupt line
|
|
52
|
+
InterruptEvent.notify(); // Check for additional interrupts
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (CurrentInterruptPriority == 2 && Clear_RX_Interrupt == true) { // If the Receive Buffer full Interrupt is to be cleared...
|
|
56
|
+
cout << sc_time_stamp() << ": " << name() << ": Receiver Interrupt Cleared." << endl;
|
|
57
|
+
Clear_RX_Interrupt = false;
|
|
58
|
+
CurrentInterruptPriority = 6; // Reset interrupt priority level
|
|
59
|
+
pInterrupt = 0; // Clear Interrupt line
|
|
60
|
+
InterruptEvent.notify(); // Check for additional interrupts
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (CurrentInterruptPriority == 3 && Clear_TX_Interrupt == true) { // If the Transmit Buffer empty Interrupt is to be cleared...
|
|
64
|
+
cout << sc_time_stamp() << ": " << name() << ": Transmitter Interrupt Cleared." << endl;
|
|
65
|
+
Clear_TX_Interrupt = false;
|
|
66
|
+
CurrentInterruptPriority = 6; // Reset interrupt priority level
|
|
67
|
+
pInterrupt = 0; // Clear Interrupt line
|
|
68
|
+
InterruptEvent.notify(); // Check for additional interrupts
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Reset the Clear Interrupt variables
|
|
72
|
+
Clear_LS_Interrupt = false;
|
|
73
|
+
Clear_TX_Interrupt = false;
|
|
74
|
+
Clear_RX_Interrupt = false;
|
|
75
|
+
|
|
76
|
+
// Check for new Interrupts:
|
|
77
|
+
if (bIER_ELSI){ // If the Line Status Interrupt is Enabled...
|
|
78
|
+
if (bLSR_OE | bLSR_PE | bLSR_FE | bLSR_BI) { // If the Overflow Error, Parity Error, Framing Error or Break Indicator flag is set...
|
|
79
|
+
rIIR = (bFCR_FIFOE << 7) | (bFCR_FIFOE << 6) | UART_IRQ_LS; // Update IIR to indicate a Line Status Interrupt is set
|
|
80
|
+
CurrentInterruptPriority = 1; // Update Interrupt Priority level
|
|
81
|
+
if (pInterrupt == 1) { // If there already is an interrupt pending
|
|
82
|
+
pInterrupt = 0; // Clear the interrupt line
|
|
83
|
+
InterruptEvent.notify(SC_ZERO_TIME); // Call this function again, with a delta cycle delay. This should make the interrupt line low for one delta cycle.
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
pInterrupt = 1; // Set the interrupt line
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (bIER_ERBFI) { // If the Receive Buffer Full Interrupt is Enabled...
|
|
91
|
+
if (bLSR_DR) { // If the Data Ready flag is set...
|
|
92
|
+
if (bFCR_FIFOE) { // If the FIFOs are Enabled...
|
|
93
|
+
if (RX_FIFO.IsAboveTriggerLevel()) { // If the Receive FIFO is above its trigger level...
|
|
94
|
+
rIIR = (bFCR_FIFOE << 7) | (bFCR_FIFOE << 6) | UART_IRQ_RX; // Update IIR to indicate a Receive Buffer Full Interrupt is set
|
|
95
|
+
CurrentInterruptPriority = 2; // Update Interrupt Priority level
|
|
96
|
+
if (pInterrupt == 1) { // If there already is an interrupt pending...
|
|
97
|
+
pInterrupt = 0; // Clear the interrupt line
|
|
98
|
+
InterruptEvent.notify(SC_ZERO_TIME); // Call this function again, with a delta cycle delay. This should make the interrupt line low for one delta cycle.
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
pInterrupt = 1; // Set the interrupt line
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
rIIR = (bFCR_FIFOE << 7) | (bFCR_FIFOE << 6) | UART_IRQ_RX; // Update IIR to indicate a Receive Buffer Full Interrupt is set
|
|
106
|
+
CurrentInterruptPriority = 2; // Update Interrupt Priority level
|
|
107
|
+
if (pInterrupt == 1) { // If there already is an interrupt pending...
|
|
108
|
+
pInterrupt = 0; // Clear the interrupt line
|
|
109
|
+
InterruptEvent.notify(SC_ZERO_TIME); // Call this function again, with a delta cycle delay. This should make the interrupt line low for one delta cycle.
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
pInterrupt = 1; // Set the interrupt line
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (bIER_ETBEI) { // If the Transmit Buffer Empty Interrupt is Enabled...
|
|
118
|
+
if (bLSR_THRE) { // If the THR Empty bit is set...
|
|
119
|
+
rIIR = (bFCR_FIFOE << 7) | (bFCR_FIFOE << 6) | UART_IRQ_TX; // Update IIR to indicate a Transmit Buffer Empty Interrupt is set
|
|
120
|
+
CurrentInterruptPriority = 3; // Update Interrupt Priority level
|
|
121
|
+
if (pInterrupt == 1) { // If there already is an interrupt pending...
|
|
122
|
+
pInterrupt = 0; // Clear the interrupt line
|
|
123
|
+
InterruptEvent.notify(SC_ZERO_TIME); // Call this function again, with a delta cycle delay. This should make the interrupt line low for one delta cycle.
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
pInterrupt = 1; // Set the interrupt line
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// No interrups
|
|
132
|
+
CurrentInterruptPriority = 6; // Reset interrupt priority level
|
|
133
|
+
pInterrupt = 0; // Clear the interrupt line
|
|
134
|
+
|
|
135
|
+
return;
|
|
136
|
+
};
|