-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlibSystemCTLM-SoC_wo_async_questa.patch
179 lines (163 loc) · 5.13 KB
/
libSystemCTLM-SoC_wo_async_questa.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
diff --git a/libremote-port/remote-port-proto.c b/libremote-port/remote-port-proto.c
index 612d035..03012e0 100644
--- a/libremote-port/remote-port-proto.c
+++ b/libremote-port/remote-port-proto.c
@@ -300,7 +300,7 @@ size_t rp_encode_write_resp(uint32_t id, uint32_t dev,
size_t rp_encode_busaccess(struct rp_peer_state *peer,
struct rp_pkt_busaccess_ext_base *pkt,
struct rp_encode_busaccess_in *in) {
- struct rp_pkt_busaccess *pkt_v4_0 = (void *) pkt;
+ struct rp_pkt_busaccess *pkt_v4_0 = (struct rp_pkt_busaccess *) pkt;
uint32_t hsize = 0;
uint32_t ret_size = 0;
@@ -428,8 +428,8 @@ void rp_dpkt_alloc(RemotePortDynPkt *dpkt, size_t size)
{
if (dpkt->size < size) {
char *u8;
- dpkt->pkt = realloc(dpkt->pkt, size);
- u8 = (void *) dpkt->pkt;
+ dpkt->pkt = (struct rp_pkt *) realloc(dpkt->pkt, size);
+ u8 = (char *) dpkt->pkt;
memset(u8 + dpkt->size, 0, size - dpkt->size);
dpkt->size = size;
}
diff --git a/libremote-port/remote-port-tlm.cc b/libremote-port/remote-port-tlm.cc
index 8aa9b0f..a3c9098 100644
--- a/libremote-port/remote-port-tlm.cc
+++ b/libremote-port/remote-port-tlm.cc
@@ -42,7 +42,7 @@ extern "C" {
#include "remote-port-sk.h"
};
-#include "utils/async_event.h"
+//#include "utils/async_event.h"
#include "remote-port-tlm.h"
#include "remote-port-tlm-wires.h"
#include "remote-port-tlm-memory-master.h"
@@ -143,7 +143,7 @@ protected:
tlm_utils::tlm_quantumkeeper m_qk;
private:
sc_time time_start;
- async_event event;
+ //async_event event;
pthread_t thread;
};
@@ -233,7 +233,8 @@ void remoteport_packet::alloc(size_t new_size)
u8 = (uint8_t *) realloc(u8, new_size);
if (u8 == NULL) {
cerr << "out of mem" << endl;
- exit(EXIT_FAILURE);
+ //exit(EXIT_FAILURE);
+ for(;;);
}
memset(u8 + size, 0, new_size - size);
size = new_size;
@@ -260,8 +261,8 @@ remoteport_tlm::remoteport_tlm(sc_module_name name,
bool blocking_socket)
: sc_module(name),
rst("rst"),
- blocking_socket(blocking_socket),
- rp_pkt_event("rp-pkt-ev")
+ blocking_socket(blocking_socket)//,
+ //rp_pkt_event("rp-pkt-ev")
{
this->fd = fd;
this->sk_descr = sk_descr;
@@ -286,7 +287,8 @@ remoteport_tlm::remoteport_tlm(sc_module_name name,
if (sk_descr) {
perror(sk_descr);
}
- exit(EXIT_FAILURE);
+ //exit(EXIT_FAILURE);
+ for(;;);
}
}
@@ -313,10 +315,11 @@ void remoteport_tlm::rp_pkt_main(void)
if (r == -1) {
perror("select()");
- exit(EXIT_FAILURE);
+ //exit(EXIT_FAILURE);
+ for(;;);
}
- rp_pkt_event.notify(SC_ZERO_TIME);
+ //rp_pkt_event.notify(SC_ZERO_TIME);
pthread_mutex_unlock(&rp_pkt_mutex);
}
}
@@ -416,7 +419,8 @@ ssize_t remoteport_tlm::rp_read(void *rbuf, size_t count)
if (r < (ssize_t)count) {
if (r < 0)
perror(__func__);
- exit(EXIT_FAILURE);
+ //exit(EXIT_FAILURE);
+ return -1;
}
return r;
}
@@ -429,7 +433,8 @@ ssize_t remoteport_tlm::rp_write(const void *wbuf, size_t count)
if (r < (ssize_t)count) {
if (r < 0)
perror(__func__);
- exit(EXIT_FAILURE);
+ //exit(EXIT_FAILURE);
+ return -1;
}
return r;
}
@@ -443,7 +448,8 @@ void remoteport_tlm::rp_cmd_hello(struct rp_pkt &pkt)
<< " local=" << RP_VERSION_MAJOR
<< "." << RP_VERSION_MINOR
<< endl;
- exit(EXIT_FAILURE);
+ //exit(EXIT_FAILURE);
+ for(;;);
}
if (pkt.hello.caps.len) {
@@ -516,8 +522,11 @@ bool remoteport_tlm::rp_process(bool can_sync)
uint32_t dlen;
size_t datalen;
- if (!blocking_socket)
- wait(rp_pkt_event);
+ if (!blocking_socket) {
+ printf("Modded version not compatible with non blocking socket !\n");
+ for(;;);
+ //wait(rp_pkt_event);
+ }
pthread_mutex_lock(&rp_pkt_mutex);
r = rp_read(&pkt_rx.pkt->hdr, sizeof pkt_rx.pkt->hdr);
diff --git a/libremote-port/remote-port-tlm.h b/libremote-port/remote-port-tlm.h
index 8dfe426..091e280 100644
--- a/libremote-port/remote-port-tlm.h
+++ b/libremote-port/remote-port-tlm.h
@@ -25,7 +25,7 @@
#ifndef REMOTE_PORT_TLM
#define REMOTE_PORT_TLM
-#include "utils/async_event.h"
+//#include "utils/async_event.h"
extern "C" {
#include "remote-port-proto.h"
@@ -183,7 +183,7 @@ private:
sc_process_handle adaptor_proc;
- async_event rp_pkt_event;
+ //async_event rp_pkt_event;
pthread_t rp_pkt_thread;
pthread_mutex_t rp_pkt_mutex;
diff --git a/libremote-port/safeio.c b/libremote-port/safeio.c
index 8dd4f29..a758e6d 100644
--- a/libremote-port/safeio.c
+++ b/libremote-port/safeio.c
@@ -52,7 +52,7 @@ rp_safe_read(int fd, void *rbuf, size_t count)
{
ssize_t r;
size_t rlen = 0;
- unsigned char *buf = rbuf;
+ unsigned char *buf = (unsigned char *) rbuf;
do {
if ((r = read(fd, buf + rlen, count - rlen)) < 0) {
@@ -71,7 +71,7 @@ rp_safe_write(int fd, const void *wbuf, size_t count)
{
ssize_t r;
size_t wlen = 0;
- const unsigned char *buf = wbuf;
+ const unsigned char *buf = (unsigned char *) wbuf;
do {
if ((r = write(fd, buf + wlen, count - wlen)) < 0) {