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
promise
OpenXG-RAN
Commits
63143b87
Commit
63143b87
authored
Jan 28, 2019
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Go on removing printf arguments warnings, add a suppression file to be used with cppcheck command
parent
875bdaf2
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1174 additions
and
1393 deletions
+1174
-1393
ci-scripts/cppcheck_suppressions.list
ci-scripts/cppcheck_suppressions.list
+6
-0
common/utils/backtrace.c
common/utils/backtrace.c
+7
-8
common/utils/hashtable/obj_hashtable.c
common/utils/hashtable/obj_hashtable.c
+189
-172
openair1/PHY/CODING/ccoding_byte.c
openair1/PHY/CODING/ccoding_byte.c
+1
-1
openair1/PHY/CODING/lte_rate_matching.c
openair1/PHY/CODING/lte_rate_matching.c
+3
-4
openair1/PHY/CODING/lte_segmentation.c
openair1/PHY/CODING/lte_segmentation.c
+2
-2
openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
+4
-27
openair1/PHY/LTE_REFSIG/lte_ul_ref.c
openair1/PHY/LTE_REFSIG/lte_ul_ref.c
+15
-28
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+238
-292
openair1/SIMULATION/LTE_PHY/dlsim.c
openair1/SIMULATION/LTE_PHY/dlsim.c
+709
-859
No files found.
ci-scripts/cppcheck_suppressions.list
0 → 100644
View file @
63143b87
// suppress error about keysP not free, it is done by calling func */
memleak:common/utils/hashtable/obj_hashtable.c
// followings errors are in file not used in oai exec's included in CI
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c
memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
common/utils/backtrace.c
View file @
63143b87
...
...
@@ -31,18 +31,18 @@
#include "backtrace.h"
/* Obtain a backtrace and print it to stdout. */
void
display_backtrace
(
void
)
{
void
display_backtrace
(
void
)
{
void
*
array
[
10
];
size_t
size
;
char
**
strings
;
size_t
i
;
char
*
test
=
getenv
(
"NO_BACKTRACE"
);
if
(
test
!=
0
)
*
((
int
*
)
0
)
=
0
;
char
*
test
=
getenv
(
"NO_BACKTRACE"
);
if
(
test
!=
0
)
*
((
int
*
)
0
)
=
0
;
size
=
backtrace
(
array
,
10
);
strings
=
backtrace_symbols
(
array
,
size
);
printf
(
"Obtained %zd stack frames.
\n
"
,
size
);
printf
(
"Obtained %u stack frames.
\n
"
,
(
unsigned
int
)
size
);
for
(
i
=
0
;
i
<
size
;
i
++
)
printf
(
"%s
\n
"
,
strings
[
i
]);
...
...
@@ -50,8 +50,7 @@ void display_backtrace(void)
free
(
strings
);
}
void
backtrace_handle_signal
(
siginfo_t
*
info
)
{
void
backtrace_handle_signal
(
siginfo_t
*
info
)
{
display_backtrace
();
//exit(EXIT_FAILURE);
}
common/utils/hashtable/obj_hashtable.c
View file @
63143b87
...
...
@@ -30,11 +30,10 @@
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
*/
static
hash_size_t
def_hashfunc
(
const
void
*
keyP
,
int
key_sizeP
)
{
static
hash_size_t
def_hashfunc
(
const
void
*
keyP
,
int
key_sizeP
)
{
hash_size_t
hash
=
0
;
while
(
key_sizeP
)
hash
^=
((
unsigned
char
*
)
keyP
)[
key_sizeP
--
];
while
(
key_sizeP
)
hash
^=
((
unsigned
char
*
)
keyP
)[
key_sizeP
--
];
return
hash
;
}
...
...
@@ -46,13 +45,12 @@ static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
* If an error occurred, NULL is returned. All other values in the returned obj_hash_table_t pointer should be released with hashtable_destroy().
*/
obj_hash_table_t
*
obj_hashtable_create
(
hash_size_t
sizeP
,
hash_size_t
(
*
hashfuncP
)(
const
void
*
,
int
),
void
(
*
freekeyfuncP
)(
void
*
),
void
(
*
freedatafuncP
)(
void
*
))
{
obj_hash_table_t
*
obj_hashtable_create
(
hash_size_t
sizeP
,
hash_size_t
(
*
hashfuncP
)(
const
void
*
,
int
),
void
(
*
freekeyfuncP
)(
void
*
),
void
(
*
freedatafuncP
)(
void
*
))
{
obj_hash_table_t
*
hashtbl
;
if
(
!
(
hashtbl
=
malloc
(
sizeof
(
obj_hash_table_t
))))
return
NULL
;
if
(
!
(
hashtbl
->
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
{
if
(
!
(
hashtbl
->
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
{
free
(
hashtbl
);
return
NULL
;
}
...
...
@@ -75,13 +73,13 @@ obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfunc
* Cleanup
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the obj_hash_table_t.
*/
hashtable_rc_t
obj_hashtable_destroy
(
obj_hash_table_t
*
hashtblP
)
{
hashtable_rc_t
obj_hashtable_destroy
(
obj_hash_table_t
*
hashtblP
)
{
hash_size_t
n
;
obj_hash_node_t
*
node
,
*
oldnode
;
for
(
n
=
0
;
n
<
hashtblP
->
size
;
++
n
)
{
node
=
hashtblP
->
nodes
[
n
];
while
(
node
)
{
oldnode
=
node
;
node
=
node
->
next
;
...
...
@@ -90,12 +88,13 @@ hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP)
free
(
oldnode
);
}
}
free
(
hashtblP
->
nodes
);
free
(
hashtblP
);
return
HASH_TABLE_OK
;
}
//-------------------------------------------------------------------------------------------------------------------------------
hashtable_rc_t
obj_hashtable_is_key_exists
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
)
hashtable_rc_t
obj_hashtable_is_key_exists
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
)
//-------------------------------------------------------------------------------------------------------------------------------
{
obj_hash_node_t
*
node
;
...
...
@@ -104,8 +103,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
if
(
hashtblP
==
NULL
)
{
return
HASH_TABLE_BAD_PARAMETER_HASHTABLE
;
}
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
(
node
->
key
==
keyP
)
{
return
HASH_TABLE_OK
;
...
...
@@ -114,8 +115,10 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
return
HASH_TABLE_OK
;
}
}
node
=
node
->
next
;
}
return
HASH_TABLE_KEY_NOT_EXISTS
;
}
//-------------------------------------------------------------------------------------------------------------------------------
...
...
@@ -123,35 +126,42 @@ hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* ke
* Adding a new element
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
*/
hashtable_rc_t
obj_hashtable_insert
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
,
void
*
dataP
)
{
hashtable_rc_t
obj_hashtable_insert
(
obj_hash_table_t
*
hashtblP
,
void
*
keyP
,
int
key_sizeP
,
void
*
dataP
)
{
obj_hash_node_t
*
node
;
hash_size_t
hash
;
if
(
hashtblP
==
NULL
)
{
return
HASH_TABLE_BAD_PARAMETER_HASHTABLE
;
}
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
(
node
->
key
==
keyP
)
{
if
(
node
->
data
)
{
hashtblP
->
freedatafunc
(
node
->
data
);
}
node
->
data
=
dataP
;
// waste of memory here (keyP is lost) we should free it now
return
HASH_TABLE_INSERT_OVERWRITTEN_DATA
;
}
node
=
node
->
next
;
}
if
(
!
(
node
=
malloc
(
sizeof
(
obj_hash_node_t
))))
return
-
1
;
node
->
key
=
keyP
;
node
->
data
=
dataP
;
if
(
hashtblP
->
nodes
[
hash
])
{
node
->
next
=
hashtblP
->
nodes
[
hash
];
}
else
{
node
->
next
=
NULL
;
}
hashtblP
->
nodes
[
hash
]
=
node
;
return
HASH_TABLE_OK
;
}
...
...
@@ -160,8 +170,7 @@ hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
*/
hashtable_rc_t
obj_hashtable_remove
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
)
{
hashtable_rc_t
obj_hashtable_remove
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
)
{
obj_hash_node_t
*
node
,
*
prevnode
=
NULL
;
hash_size_t
hash
;
...
...
@@ -171,21 +180,25 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
((
node
->
key
==
keyP
)
||
((
node
->
key_size
==
key_sizeP
)
&&
(
memcmp
(
node
->
key
,
keyP
,
key_sizeP
)
==
0
)))
{
if
((
node
->
key
==
keyP
)
||
((
node
->
key_size
==
key_sizeP
)
&&
(
memcmp
(
node
->
key
,
keyP
,
key_sizeP
)
==
0
)))
{
if
(
prevnode
)
{
prevnode
->
next
=
node
->
next
;
}
else
{
hashtblP
->
nodes
[
hash
]
=
node
->
next
;
}
hashtblP
->
freekeyfunc
(
node
->
key
);
hashtblP
->
freedatafunc
(
node
->
data
);
free
(
node
);
return
HASH_TABLE_OK
;
}
prevnode
=
node
;
node
=
node
->
next
;
}
return
HASH_TABLE_KEY_NOT_EXISTS
;
}
//-------------------------------------------------------------------------------------------------------------------------------
...
...
@@ -193,8 +206,7 @@ hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
* NULL is returned if we didn't find it.
*/
hashtable_rc_t
obj_hashtable_get
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
,
void
**
dataP
)
{
hashtable_rc_t
obj_hashtable_get
(
obj_hash_table_t
*
hashtblP
,
const
void
*
keyP
,
int
key_sizeP
,
void
**
dataP
)
{
obj_hash_node_t
*
node
;
hash_size_t
hash
;
...
...
@@ -202,8 +214,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
*
dataP
=
NULL
;
return
HASH_TABLE_BAD_PARAMETER_HASHTABLE
;
}
hash
=
hashtblP
->
hashfunc
(
keyP
,
key_sizeP
)
%
hashtblP
->
size
;
node
=
hashtblP
->
nodes
[
hash
];
while
(
node
)
{
if
(
node
->
key
==
keyP
)
{
*
dataP
=
node
->
data
;
...
...
@@ -214,8 +228,10 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
return
HASH_TABLE_OK
;
}
}
node
=
node
->
next
;
}
*
dataP
=
NULL
;
return
HASH_TABLE_KEY_NOT_EXISTS
;
}
...
...
@@ -223,14 +239,14 @@ hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, i
/*
* Function to return all keys of an object hash table
*/
hashtable_rc_t
obj_hashtable_get_keys
(
obj_hash_table_t
*
hashtblP
,
void
**
keysP
,
unsigned
int
*
sizeP
)
{
hashtable_rc_t
obj_hashtable_get_keys
(
obj_hash_table_t
*
hashtblP
,
void
**
keysP
,
unsigned
int
*
sizeP
)
{
size_t
n
=
0
;
obj_hash_node_t
*
node
=
NULL
;
obj_hash_node_t
*
next
=
NULL
;
*
sizeP
=
0
;
keysP
=
calloc
(
hashtblP
->
num_elements
,
sizeof
(
void
*
));
if
(
keysP
)
{
for
(
n
=
0
;
n
<
hashtblP
->
size
;
++
n
)
{
for
(
node
=
hashtblP
->
nodes
[
n
];
node
;
node
=
next
)
{
...
...
@@ -238,8 +254,11 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
next
=
node
->
next
;
}
}
// cppcheck-suppress memleak
return
HASH_TABLE_OK
;
}
return
HASH_TABLE_SYSTEM_ERROR
;
}
//-------------------------------------------------------------------------------------------------------------------------------
...
...
@@ -253,8 +272,7 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
* This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
*/
hashtable_rc_t
obj_hashtable_resize
(
obj_hash_table_t
*
hashtblP
,
hash_size_t
sizeP
)
{
hashtable_rc_t
obj_hashtable_resize
(
obj_hash_table_t
*
hashtblP
,
hash_size_t
sizeP
)
{
obj_hash_table_t
newtbl
;
hash_size_t
n
;
obj_hash_node_t
*
node
,
*
next
;
...
...
@@ -266,7 +284,7 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size
newtbl
.
size
=
sizeP
;
newtbl
.
hashfunc
=
hashtblP
->
hashfunc
;
if
(
!
(
newtbl
.
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
return
HASH_TABLE_SYSTEM_ERROR
;
if
(
!
(
newtbl
.
nodes
=
calloc
(
sizeP
,
sizeof
(
obj_hash_node_t
*
))))
return
HASH_TABLE_SYSTEM_ERROR
;
for
(
n
=
0
;
n
<
hashtblP
->
size
;
++
n
)
{
for
(
node
=
hashtblP
->
nodes
[
n
];
node
;
node
=
next
)
{
...
...
@@ -279,7 +297,6 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t size
free
(
hashtblP
->
nodes
);
hashtblP
->
size
=
newtbl
.
size
;
hashtblP
->
nodes
=
newtbl
.
nodes
;
return
HASH_TABLE_OK
;
}
...
...
openair1/PHY/CODING/ccoding_byte.c
View file @
63143b87
...
...
@@ -130,7 +130,7 @@ ccodedot11_encode (unsigned int numbytes,
*
outPtr
++
=
(
out
>>
1
)
&
1
;
#ifdef DEBUG_CCODE
printf
(
"%
d
: %u -> %d (%u)
\n
"
,
dummy
,
state
,
out
,
ccodedot11_table
[
state
]);
printf
(
"%
u
: %u -> %d (%u)
\n
"
,
dummy
,
state
,
out
,
ccodedot11_table
[
state
]);
dummy
+=
2
;
#endif //DEBUG_CCODE
bit_index
=
(
bit_index
==
0
)
?
1
:
0
;
...
...
openair1/PHY/CODING/lte_rate_matching.c
View file @
63143b87
...
...
@@ -236,7 +236,7 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
ND
=
Kpi
-
D
;
#ifdef RM_DEBUG2
printf
(
"sub_block_interleaving_cc : D = %d (%d), d %p, w %p
\n
"
,
D
,
D
*
3
,
d
,
w
);
printf
(
"RCC = %d, Kpi=%d, ND=%ld
\n
"
,
RCC
,
Kpi
,
ND
);
printf
(
"RCC = %d, Kpi=%d, ND=%ld
\n
"
,
RCC
,
Kpi
,
(
long
)
ND
);
#endif
ND3
=
ND
*
3
;
k
=
0
;
...
...
@@ -253,7 +253,8 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
d
[
index3
-
ND3
+
1
]
=
w
[
Kpi
+
k
];
d
[
index3
-
ND3
+
2
]
=
w
[(
Kpi
<<
1
)
+
k
];
#ifdef RM_DEBUG2
printf
(
"row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)
\n
"
,
row
,
index
,
k
,
index3
-
ND3
,
w
[
k
],
w
[
Kpi
+
k
],
w
[(
Kpi
<<
1
)
+
k
]);
printf
(
"row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)
\n
"
,
row
,
index
,
k
,(
long
)(
index3
-
ND3
),
w
[
k
],
w
[
Kpi
+
k
],
w
[(
Kpi
<<
1
)
+
k
]);
#endif
index3
+=
96
;
index
+=
32
;
...
...
@@ -453,7 +454,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
int
threed
=
0
;
uint32_t
nulled
=
0
;
static
unsigned
char
*
counter_buffer
[
MAX_NUM_DLSCH_SEGMENTS
][
4
];
FILE
*
counter_fd
;
char
fname
[
512
];
#endif
...
...
@@ -476,7 +476,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
}
else
if
(
rvidx
==
3
)
{
sprintf
(
fname
,
"mcs%d_rate_matching_RB_%d.txt"
,
m
,
nb_rb
);
// sprintf(fname,"mcs0_rate_matching_RB_6.txt");
counter_fd
=
fopen
(
fname
,
"w"
);
}
#endif
...
...
openair1/PHY/CODING/lte_segmentation.c
View file @
63143b87
...
...
@@ -124,8 +124,8 @@ int lte_segmentation(unsigned char *input_buffer,
Bprime
,
*
Cplus
,
*
Kplus
,
*
Cminus
,
*
Kminus
);
*
F
=
((
*
Cplus
)
*
(
*
Kplus
)
+
(
*
Cminus
)
*
(
*
Kminus
)
-
(
Bprime
));
#ifdef DEBUG_SEGMENTATION
printf
(
"C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u
\n
"
,
*
C
,
*
Cplus
,
*
Cminus
,
*
Kplus
,
*
Kminus
,
Bprime
>>
3
,
Bprime
,
*
F
);
#endif
printf
(
"C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u
\n
"
,
*
C
,
*
Cplus
,
*
Cminus
,
*
Kplus
,
*
Kminus
,
Bprime
>>
3
,
Bprime
,
*
F
);
if
((
input_buffer
)
&&
(
output_buffers
))
{
for
(
k
=
0
;
k
<*
F
>>
3
;
k
++
)
{
...
...
openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
View file @
63143b87
...
...
@@ -35,30 +35,22 @@
int
lte_dl_mbsfn
(
PHY_VARS_eNB
*
eNB
,
int32_t
*
output
,
short
amp
,
int
subframe
,
unsigned
char
l
)
{
unsigned
char
l
)
{
unsigned
int
mprime
,
mprime_dword
,
mprime_qpsk_symb
,
m
;
unsigned
short
k
=
0
,
a
;
int32_t
qpsk
[
4
];
a
=
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
((
short
*
)
&
qpsk
[
0
])[
0
]
=
a
;
((
short
*
)
&
qpsk
[
0
])[
1
]
=
a
;
((
short
*
)
&
qpsk
[
1
])[
0
]
=
-
a
;
((
short
*
)
&
qpsk
[
1
])[
1
]
=
a
;
((
short
*
)
&
qpsk
[
2
])[
0
]
=
a
;
((
short
*
)
&
qpsk
[
2
])[
1
]
=
-
a
;
((
short
*
)
&
qpsk
[
3
])[
0
]
=
-
a
;
((
short
*
)
&
qpsk
[
3
])[
1
]
=
-
a
;
mprime
=
3
*
(
110
-
eNB
->
frame_parms
.
N_RB_DL
);
for
(
m
=
0
;
m
<
eNB
->
frame_parms
.
N_RB_DL
*
6
;
m
++
)
{
if
((
l
==
0
)
||
(
l
==
2
))
k
=
m
<<
1
;
else
if
(
l
==
1
)
...
...
@@ -69,7 +61,6 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
}
k
+=
eNB
->
frame_parms
.
first_carrier_offset
;
mprime_dword
=
mprime
>>
4
;
mprime_qpsk_symb
=
mprime
&
0xf
;
...
...
@@ -80,22 +71,18 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
output
[
k
]
=
qpsk
[(
eNB
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
];
//output[k] = (lte_gold_table[eNB_offset][subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
#ifdef DEBUG_DL_MBSFN
LOG_D
(
PHY
,
"subframe %d, l %d, m %d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d
\n
"
,
subframe
,
l
,
m
,
mprime
,
mprime_dword
,
mprime_qpsk_symb
);
LOG_D
(
PHY
,
"index = %d (k %d)(%x)
\n
"
,(
eNB
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
,
k
,
eNB
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]);
#endif
mprime
++
;
#ifdef DEBUG_DL_MBSFN
if
(
m
<
18
)
printf
(
"subframe %d, l %d output[%d] = (%d,%d)
\n
"
,
subframe
,
l
,
k
,((
short
*
)
&
output
[
k
])[
0
],((
short
*
)
&
output
[
k
])[
1
]);
#endif
}
return
(
0
);
...
...
@@ -106,15 +93,11 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
int
lte_dl_mbsfn_rx
(
PHY_VARS_UE
*
ue
,
int
*
output
,
int
subframe
,
unsigned
char
l
)
{
unsigned
char
l
)
{
unsigned
int
mprime
,
mprime_dword
,
mprime_qpsk_symb
,
m
;
unsigned
short
k
=
0
;
unsigned
int
qpsk
[
4
];
// This includes complex conjugate for channel estimation
((
short
*
)
&
qpsk
[
0
])[
0
]
=
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
0
])[
1
]
=
-
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
1
])[
0
]
=
-
ONE_OVER_SQRT2_Q15
;
...
...
@@ -123,23 +106,18 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
((
short
*
)
&
qpsk
[
2
])[
1
]
=
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
3
])[
0
]
=
-
ONE_OVER_SQRT2_Q15
;
((
short
*
)
&
qpsk
[
3
])[
1
]
=
ONE_OVER_SQRT2_Q15
;
mprime
=
3
*
(
110
-
ue
->
frame_parms
.
N_RB_DL
);
for
(
m
=
0
;
m
<
ue
->
frame_parms
.
N_RB_DL
*
6
;
m
++
)
{
mprime_dword
=
mprime
>>
4
;
mprime_qpsk_symb
=
mprime
&
0xf
;
// this is r_mprime from 3GPP 36-211 6.10.1.2
output
[
k
]
=
qpsk
[(
ue
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
];
#ifdef DEBUG_DL_MBSFN
printf
(
"subframe %d, l %d, m %
d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d
\n
"
,
printf
(
"subframe %d, l %d, m %
u, mprime %u, mprime_dword %u, mprime_qpsk_symbol %u
\n
"
,
subframe
,
l
,
m
,
mprime
,
mprime_dword
,
mprime_qpsk_symb
);
printf
(
"index = %d (k %d) (%x)
\n
"
,(
ue
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]
>>
(
2
*
mprime_qpsk_symb
))
&
3
,
k
,
ue
->
lte_gold_mbsfn_table
[
subframe
][
l
][
mprime_dword
]);
#endif
mprime
++
;
#ifdef DEBUG_DL_MBSFN
...
...
@@ -148,7 +126,6 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
#endif
k
++
;
}
return
(
0
);
...
...
openair1/PHY/LTE_REFSIG/lte_ul_ref.c
View file @
63143b87
...
...
@@ -20,9 +20,9 @@
*/
#ifdef MAIN
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#endif
#include "lte_refsig.h"
#include "PHY/defs_eNB.h"
...
...
@@ -43,8 +43,7 @@ char ref24[720] = {
-
1
,
3
,
1
,
-
3
,
3
,
-
1
,
1
,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
,
-
1
,
-
3
,
-
1
,
1
,
3
,
1
,
1
,
-
3
,
-
1
,
-
1
,
-
3
,
3
,
-
3
,
3
,
1
,
-
3
,
3
,
-
3
,
1
,
-
1
,
1
,
-
3
,
1
,
1
,
1
,
-
1
,
-
3
,
3
,
3
,
1
,
1
,
3
,
-
1
,
-
3
,
-
1
,
-
1
,
-
1
,
3
,
1
,
-
3
,
-
3
,
-
1
,
3
,
-
3
,
-
1
,
-
3
,
-
1
,
-
3
,
-
1
,
-
1
,
-
3
,
-
1
,
-
1
,
1
,
-
3
,
-
1
,
-
1
,
1
,
-
1
,
-
3
,
1
,
1
,
-
3
,
1
,
-
3
,
-
3
,
3
,
1
,
1
,
-
1
,
3
,
-
1
,
-
1
,
1
,
1
,
-
1
,
-
1
,
-
3
,
-
1
,
3
,
-
1
,
3
,
-
1
,
1
,
3
,
1
,
-
1
,
3
,
1
,
3
,
-
3
,
-
3
,
1
,
-
1
,
-
1
,
1
,
3
};
void
generate_ul_ref_sigs
(
void
)
{
void
generate_ul_ref_sigs
(
void
)
{
double
qbar
,
phase
;
unsigned
int
u
,
v
,
Msc_RS
,
q
,
m
,
n
;
...
...
@@ -53,7 +52,7 @@ void generate_ul_ref_sigs(void)
for
(
u
=
0
;
u
<
30
;
u
++
)
{
for
(
v
=
0
;
v
<
2
;
v
++
)
{
qbar
=
ref_primes
[
Msc_RS
]
*
(
u
+
1
)
/
(
double
)
31
;
ul_ref_sigs
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
ul_ref_sigs
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
if
((((
int
)
floor
(
2
*
qbar
))
&
1
)
==
0
)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
-
v
;
...
...
@@ -61,7 +60,7 @@ void generate_ul_ref_sigs(void)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
+
v
;
#ifdef MAIN
printf
(
"Msc_RS %
d (%d), u %d, v %d -> q %d
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
printf
(
"Msc_RS %
u (%d), u %u, v %u -> q %u
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
#endif
for
(
n
=
0
;
n
<
dftsizes
[
Msc_RS
];
n
++
)
{
...
...
@@ -89,32 +88,26 @@ void generate_ul_ref_sigs(void)
// These are the sequences for RB 1
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
ul_ref_sigs
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
for
(
n
=
0
;
n
<
dftsizes
[
0
];
n
++
)
{
ul_ref_sigs
[
u
][
0
][
0
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref12
[(
u
*
12
)
+
n
]
/
4
)));
ul_ref_sigs
[
u
][
0
][
0
][
1
+
(
n
<<
1
)]
=
(
int16_t
)(
floor
(
32767
*
sin
(
M_PI
*
ref12
[(
u
*
12
)
+
n
]
/
4
)));
}
}
// These are the sequences for RB 2
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
ul_ref_sigs
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
for
(
n
=
0
;
n
<
dftsizes
[
1
];
n
++
)
{
ul_ref_sigs
[
u
][
0
][
1
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
ul_ref_sigs
[
u
][
0
][
1
][
1
+
(
n
<<
1
)]
=
(
int16_t
)(
floor
(
32767
*
sin
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
}
}
}
void
generate_ul_ref_sigs_rx
(
void
)
{
void
generate_ul_ref_sigs_rx
(
void
)
{
double
qbar
,
phase
;
unsigned
int
u
,
v
,
Msc_RS
,
q
,
m
,
n
;
...
...
@@ -123,7 +116,7 @@ void generate_ul_ref_sigs_rx(void)
for
(
u
=
0
;
u
<
30
;
u
++
)
{
for
(
v
=
0
;
v
<
2
;
v
++
)
{
qbar
=
ref_primes
[
Msc_RS
]
*
(
u
+
1
)
/
(
double
)
31
;
ul_ref_sigs_rx
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
ul_ref_sigs_rx
[
u
][
v
][
Msc_RS
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
Msc_RS
]);
if
((((
int
)
floor
(
2
*
qbar
))
&
1
)
==
0
)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
-
v
;
...
...
@@ -131,7 +124,7 @@ void generate_ul_ref_sigs_rx(void)
q
=
(
int
)(
floor
(
qbar
+
.
5
))
+
v
;
#ifdef MAIN
printf
(
"Msc_RS %
d (%d), u %d, v %d -> q %d
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
printf
(
"Msc_RS %
u (%d), u %u, v %u -> q %u
(qbar %f)
\n
"
,
Msc_RS
,
dftsizes
[
Msc_RS
],
u
,
v
,
q
,
qbar
);
#endif
for
(
n
=
0
;
n
<
dftsizes
[
Msc_RS
];
n
++
)
{
...
...
@@ -159,7 +152,7 @@ void generate_ul_ref_sigs_rx(void)
// These are the sequences for RB 1
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
ul_ref_sigs_rx
[
u
][
0
][
0
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
0
]);
for
(
n
=
0
;
n
<
dftsizes
[
0
];
n
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
0
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref12
[(
u
*
12
)
+
n
]
/
4
)));
...
...
@@ -169,21 +162,17 @@ void generate_ul_ref_sigs_rx(void)
// These are the sequences for RB 2
for
(
u
=
0
;
u
<
30
;
u
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
ul_ref_sigs_rx
[
u
][
0
][
1
]
=
(
int16_t
*
)
malloc16
(
2
*
sizeof
(
int16_t
)
*
dftsizes
[
1
]);
for
(
n
=
0
;
n
<
dftsizes
[
1
];
n
++
)
{
ul_ref_sigs_rx
[
u
][
0
][
1
][
n
<<
1
]
=
(
int16_t
)(
floor
(
32767
*
cos
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
ul_ref_sigs_rx
[
u
][
0
][
1
][
1
+
(
n
<<
1
)]
=
(
int16_t
)(
floor
(
32767
*
sin
(
M_PI
*
ref24
[(
u
*
24
)
+
n
]
/
4
)));
}
}
}
void
free_ul_ref_sigs
(
void
)
{
void
free_ul_ref_sigs
(
void
)
{
unsigned
int
u
,
v
,
Msc_RS
;
for
(
Msc_RS
=
0
;
Msc_RS
<
34
;
Msc_RS
++
)
{
...
...
@@ -204,9 +193,7 @@ void free_ul_ref_sigs(void)
}
#ifdef MAIN
main
()
{
main
()
{
generate_ul_ref_sigs
();
generate_ul_ref_sigs_rx
();
free_ul_ref_sigs
();
...
...
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
View file @
63143b87
This diff is collapsed.
Click to expand it.
openair1/SIMULATION/LTE_PHY/dlsim.c
View file @
63143b87
This diff is collapsed.
Click to expand it.
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