Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zzha zzha
OpenXG-RAN
Commits
5aed7d30
Commit
5aed7d30
authored
Jun 12, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use calloc() in new_channel_desc_scm()
parent
4819b6b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
openair1/SIMULATION/TOOLS/random_channel.c
openair1/SIMULATION/TOOLS/random_channel.c
+13
-13
No files found.
openair1/SIMULATION/TOOLS/random_channel.c
View file @
5aed7d30
...
...
@@ -110,7 +110,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
LOG_D
(
OCM
,
"[CHANNEL] Doing delays ...
\n
"
);
if
(
delays
==
NULL
)
{
chan_desc
->
delays
=
(
double
*
)
malloc
(
nb_taps
*
sizeof
(
double
));
chan_desc
->
delays
=
calloc
(
nb_taps
,
sizeof
(
double
));
chan_desc
->
free_flags
=
chan_desc
->
free_flags
|
CHANMODEL_FREE_DELAY
;
delta_tau
=
Td
/
nb_taps
;
...
...
@@ -131,22 +131,22 @@ void fill_channel_desc(channel_desc_t *chan_desc,
chan_desc
->
first_run
=
1
;
chan_desc
->
ip
=
0
.
0
;
chan_desc
->
max_Doppler
=
max_Doppler
;
chan_desc
->
ch
=
(
struct
complexd
**
)
malloc
(
nb_tx
*
nb_rx
*
sizeof
(
struct
complexd
*
));
chan_desc
->
chF
=
(
struct
complexd
**
)
malloc
(
nb_tx
*
nb_rx
*
sizeof
(
struct
complexd
*
));
chan_desc
->
a
=
(
struct
complexd
**
)
malloc
(
nb_taps
*
sizeof
(
struct
complexd
*
));
chan_desc
->
ch
=
calloc
(
nb_tx
*
nb_rx
,
sizeof
(
struct
complexd
*
));
chan_desc
->
chF
=
calloc
(
nb_tx
*
nb_rx
,
sizeof
(
struct
complexd
*
));
chan_desc
->
a
=
calloc
(
nb_taps
,
sizeof
(
struct
complexd
*
));
LOG_D
(
OCM
,
"[CHANNEL] Filling ch
\n
"
);
for
(
i
=
0
;
i
<
nb_tx
*
nb_rx
;
i
++
)
chan_desc
->
ch
[
i
]
=
(
struct
complexd
*
)
malloc
(
channel_length
*
sizeof
(
struct
complexd
));
chan_desc
->
ch
[
i
]
=
calloc
(
channel_length
,
sizeof
(
struct
complexd
));
for
(
i
=
0
;
i
<
nb_tx
*
nb_rx
;
i
++
)
chan_desc
->
chF
[
i
]
=
(
struct
complexd
*
)
malloc
(
275
*
12
*
sizeof
(
struct
complexd
));
// allocate for up to 275 RBs, 12 symbols per RB
chan_desc
->
chF
[
i
]
=
calloc
(
275
*
12
,
sizeof
(
struct
complexd
));
// allocate for up to 275 RBs, 12 symbols per RB
LOG_D
(
OCM
,
"[CHANNEL] Filling a (nb_taps %d)
\n
"
,
nb_taps
);
for
(
i
=
0
;
i
<
nb_taps
;
i
++
)
{
LOG_D
(
OCM
,
"tap %d (%p,%zu)
\n
"
,
i
,
&
chan_desc
->
a
[
i
],
nb_tx
*
nb_rx
*
sizeof
(
struct
complexd
));
chan_desc
->
a
[
i
]
=
(
struct
complexd
*
)
malloc
(
nb_tx
*
nb_rx
*
sizeof
(
struct
complexd
));
chan_desc
->
a
[
i
]
=
calloc
(
nb_tx
*
nb_rx
,
sizeof
(
struct
complexd
));
}
LOG_D
(
OCM
,
"[CHANNEL] Doing R_sqrt ...
\n
"
);
...
...
@@ -637,7 +637,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc
->
Td
=
4
.
625
;
chan_desc
->
channel_length
=
(
int
)
(
2
*
chan_desc
->
sampling_rate
*
chan_desc
->
Td
+
1
+
2
/
(
M_PI
*
M_PI
)
*
log
(
4
*
M_PI
*
chan_desc
->
sampling_rate
*
chan_desc
->
Td
));
sum_amps
=
0
;
chan_desc
->
amps
=
(
double
*
)
malloc
(
chan_desc
->
nb_taps
*
sizeof
(
double
));
chan_desc
->
amps
=
calloc
(
chan_desc
->
nb_taps
,
sizeof
(
double
));
chan_desc
->
free_flags
=
chan_desc
->
free_flags
|
CHANMODEL_FREE_AMPS
;
for
(
i
=
0
;
i
<
chan_desc
->
nb_taps
;
i
++
)
{
...
...
@@ -657,15 +657,15 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc
->
a
=
(
struct
complexd
**
)
malloc
(
chan_desc
->
nb_taps
*
sizeof
(
struct
complexd
*
));
for
(
i
=
0
;
i
<
nb_tx
*
nb_rx
;
i
++
)
chan_desc
->
ch
[
i
]
=
(
struct
complexd
*
)
malloc
(
chan_desc
->
channel_length
*
sizeof
(
struct
complexd
));
chan_desc
->
ch
[
i
]
=
calloc
(
chan_desc
->
channel_length
,
sizeof
(
struct
complexd
));
for
(
i
=
0
;
i
<
nb_tx
*
nb_rx
;
i
++
)
chan_desc
->
chF
[
i
]
=
(
struct
complexd
*
)
malloc
(
1200
*
sizeof
(
struct
complexd
));
chan_desc
->
chF
[
i
]
=
calloc
(
1200
,
sizeof
(
struct
complexd
));
for
(
i
=
0
;
i
<
chan_desc
->
nb_taps
;
i
++
)
chan_desc
->
a
[
i
]
=
(
struct
complexd
*
)
malloc
(
nb_tx
*
nb_rx
*
sizeof
(
struct
complexd
));
chan_desc
->
a
[
i
]
=
calloc
(
nb_tx
*
nb_rx
,
sizeof
(
struct
complexd
));
chan_desc
->
R_sqrt
=
(
struct
complexd
**
)
malloc
(
6
*
sizeof
(
struct
complexd
**
));
chan_desc
->
R_sqrt
=
calloc
(
6
,
sizeof
(
struct
complexd
**
));
if
(
nb_tx
==
2
&&
nb_rx
==
2
)
{
for
(
i
=
0
;
i
<
6
;
i
++
)
...
...
@@ -680,7 +680,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc
->
free_flags
=
chan_desc
->
free_flags
|
CHANMODEL_FREE_RSQRT_6
;
for
(
i
=
0
;
i
<
6
;
i
++
)
{
chan_desc
->
R_sqrt
[
i
]
=
(
struct
complexd
*
)
malloc
(
nb_tx
*
nb_rx
*
nb_tx
*
nb_rx
*
sizeof
(
struct
complexd
));
chan_desc
->
R_sqrt
[
i
]
=
calloc
(
nb_tx
*
nb_rx
*
nb_tx
*
nb_rx
,
sizeof
(
struct
complexd
));
for
(
j
=
0
;
j
<
nb_tx
*
nb_rx
*
nb_tx
*
nb_rx
;
j
+=
(
nb_tx
*
nb_rx
+
1
))
{
chan_desc
->
R_sqrt
[
i
][
j
].
r
=
1
.
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment