Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmp_tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Loidolt
cmp_tool
Commits
2f37f0b3
Commit
2f37f0b3
authored
Nov 8, 2023
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
add memcpy and cpu_to_bex macro
parent
72a0a723
No related branches found
No related tags found
1 merge request
!26
Adapt cmp_tool to the chunk decompression
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/rdcu_ctrl.c
+10
-8
10 additions, 8 deletions
lib/rdcu_ctrl.c
lib/rdcu_rmap.c
+6
-13
6 additions, 13 deletions
lib/rdcu_rmap.c
with
16 additions
and
21 deletions
lib/rdcu_ctrl.c
+
10
−
8
View file @
2f37f0b3
...
...
@@ -1658,9 +1658,11 @@ int rdcu_write_sram_16(const uint16_t *buf, uint32_t addr, uint32_t size)
#else
{
uint32_t
i
;
for
(
i
=
0
;
i
<
size
;
i
+=
2
)
{
rdcu
->
sram
[
addr
+
i
]
=
buf
[
i
/
2
]
>>
8
;
rdcu
->
sram
[
addr
+
i
+
1
]
=
buf
[
i
/
2
]
&
0xFFU
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint16_t
);
i
++
)
{
uint16_t
tmp
=
cpu_to_be16
(
buf
[
i
]);
memcpy
(
&
rdcu
->
sram
[
addr
+
i
*
sizeof
(
tmp
)],
&
tmp
,
sizeof
(
tmp
));
}
}
return
(
int
)
size
;
/* lol */
...
...
@@ -1702,11 +1704,11 @@ int rdcu_write_sram_32(const uint32_t *buf, uint32_t addr, uint32_t size)
#else
{
uint32_t
i
;
for
(
i
=
0
;
i
<
size
;
i
+=
4
)
{
rdcu
->
sram
[
addr
+
i
]
=
buf
[
i
/
4
]
>>
24
;
rdcu
->
sram
[
addr
+
i
+
1
]
=
(
buf
[
i
/
4
]
>>
16
)
&
0xFFU
;
rdcu
->
sram
[
addr
+
i
+
2
]
=
(
buf
[
i
/
4
]
>>
8
)
&
0xFFU
;
rdcu
->
sram
[
addr
+
i
+
3
]
=
buf
[
i
/
4
]
&
0xFFU
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint32_t
);
i
++
)
{
uint32_t
tmp
=
cpu_to_be32
(
buf
[
i
])
;
memcpy
(
&
rdcu
->
sram
[
addr
+
i
*
sizeof
(
tmp
)],
&
tmp
,
sizeof
(
tmp
))
;
}
}
return
(
int
)
size
;
/* lol */
...
...
This diff is collapsed.
Click to expand it.
lib/rdcu_rmap.c
+
6
−
13
View file @
2f37f0b3
...
...
@@ -291,22 +291,15 @@ static int rdcu_process_rx(void)
if
(
rp
->
data_len
)
{
uint8_t
crc8
;
/* convert endianness if needed */
/* convert endianness
in-place
if needed */
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
{
uint32_t
i
;
for
(
i
=
0
;
i
<
rp
->
data_len
;
i
+=
4
)
{
uint32_t
tmp
=
rp
->
data
[
i
];
tmp
|=
(
uint32_t
)
rp
->
data
[
i
+
1
]
<<
8
;
tmp
|=
(
uint32_t
)
rp
->
data
[
i
+
2
]
<<
16
;
tmp
|=
(
uint32_t
)
rp
->
data
[
i
+
3
]
<<
24
;
uint32_t
i
,
tmp
;
rp
->
data
[
i
]
=
tmp
>>
24
;
rp
->
data
[
i
+
1
]
=
(
tmp
>>
16
)
&
0xFFU
;
rp
->
data
[
i
+
2
]
=
(
tmp
>>
8
)
&
0xFFU
;
rp
->
data
[
i
+
3
]
=
tmp
&
0xFFU
;
for
(
i
=
0
;
i
<
rp
->
data_len
;
i
+=
sizeof
(
tmp
))
{
memcpy
(
&
tmp
,
&
rp
->
data
[
i
],
sizeof
(
tmp
))
;
be32_to_cpus
(
&
tmp
)
;
memcpy
(
&
rp
->
data
[
i
],
&
tmp
,
sizeof
(
tmp
))
;
}
}
#endif
/* __BYTE_ORDER__ */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment