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
wangwenhui
OpenXG-RAN
Commits
85b9db74
Commit
85b9db74
authored
Feb 15, 2018
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding a crc check
parent
ce9c021d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
openair1/PHY/CODING/crc_byte.c
openair1/PHY/CODING/crc_byte.c
+66
-0
openair1/PHY/CODING/defs.h
openair1/PHY/CODING/defs.h
+1
-0
No files found.
openair1/PHY/CODING/crc_byte.c
View file @
85b9db74
...
...
@@ -199,6 +199,72 @@ crc8 (unsigned char * inptr, int bitlen)
return
crc
;
}
uint8_t
check_crc
(
uint8_t
*
decoded_bytes
,
uint16_t
len
,
uint8_t
crc_type
)
{
uint8_t
crc_len
,
temp
;
uint16_t
oldcrc
,
crc
;
switch
(
crc_type
)
{
case
CRC24_A
:
case
CRC24_B
:
crc_len
=
3
;
break
;
case
CRC16
:
crc_len
=
2
;
break
;
case
CRC8
:
crc_len
=
1
;
break
;
default:
crc_len
=
3
;
}
// check the CRC
oldcrc
=
*
((
unsigned
int
*
)(
&
decoded_bytes
[(
len
>>
3
)
-
crc_len
]));
switch
(
crc_type
)
{
case
CRC24_A
:
oldcrc
&=
0x00ffffff
;
crc
=
crc24a
(
decoded_bytes
,
len
-
24
)
>>
8
;
temp
=
((
uint8_t
*
)
&
crc
)[
2
];
((
uint8_t
*
)
&
crc
)[
2
]
=
((
uint8_t
*
)
&
crc
)[
0
];
((
uint8_t
*
)
&
crc
)[
0
]
=
temp
;
break
;
case
CRC24_B
:
oldcrc
&=
0x00ffffff
;
crc
=
crc24b
(
decoded_bytes
,
len
-
24
)
>>
8
;
temp
=
((
uint8_t
*
)
&
crc
)[
2
];
((
uint8_t
*
)
&
crc
)[
2
]
=
((
uint8_t
*
)
&
crc
)[
0
];
((
uint8_t
*
)
&
crc
)[
0
]
=
temp
;
break
;
case
CRC16
:
oldcrc
&=
0x0000ffff
;
crc
=
crc16
(
decoded_bytes
,
len
-
16
)
>>
16
;
break
;
case
CRC8
:
oldcrc
&=
0x000000ff
;
crc
=
crc8
(
decoded_bytes
,
len
-
8
)
>>
24
;
break
;
default:
printf
(
"FATAL: Unknown CRC
\n
"
);
return
(
255
);
break
;
}
printf
(
"old CRC %x, CRC %x
\n
"
,
oldcrc
,
crc
);
return
(
crc
==
oldcrc
);
}
#ifdef DEBUG_CRC
/*******************************************************************/
/**
...
...
openair1/PHY/CODING/defs.h
View file @
85b9db74
...
...
@@ -576,4 +576,5 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
int
ldpc_encoder_orig
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
int
nom_rate
,
int
denom_rate
,
unsigned
char
gen_code
);
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
int
nom_rate
,
int
denom_rate
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
);
uint8_t
check_crc
(
uint8_t
*
decoded_bytes
,
uint16_t
len
,
uint8_t
crc_type
);
#endif
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